@xmachines/docs 1.0.0-beta.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -7
- package/api/@xmachines/play/README.md +159 -39
- package/api/@xmachines/play/classes/NonNullableError.md +189 -0
- package/api/@xmachines/play/classes/PlayError.md +251 -0
- package/api/@xmachines/play/functions/assertNonNullable.md +56 -0
- package/api/@xmachines/play/type-aliases/PlayEvent.md +6 -6
- package/api/@xmachines/play-actor/README.md +153 -160
- package/api/@xmachines/play-actor/classes/AbstractActor.md +106 -121
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +40 -0
- package/api/@xmachines/play-actor/functions/toAtomState.md +33 -0
- package/api/@xmachines/play-actor/functions/typedSpec.md +54 -0
- 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 +28 -0
- package/api/@xmachines/play-actor/interfaces/Routable.md +6 -21
- package/api/@xmachines/play-actor/interfaces/Viewable.md +12 -6
- package/api/@xmachines/play-dom/README.md +385 -0
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +115 -0
- package/api/@xmachines/play-dom/functions/createPlayUI.md +28 -0
- package/api/@xmachines/play-dom/functions/createRenderer.md +44 -0
- package/api/@xmachines/play-dom/functions/defineRegistry.md +26 -0
- package/api/@xmachines/play-dom/functions/renderSpec.md +67 -0
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +23 -0
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +34 -0
- package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +17 -0
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +28 -0
- package/api/@xmachines/play-dom/interfaces/EventHandle.md +15 -0
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +18 -0
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +30 -0
- package/api/@xmachines/play-dom/interfaces/RenderSpecOptions.md +26 -0
- package/api/@xmachines/play-dom/interfaces/UIProviderOptions.md +32 -0
- package/api/@xmachines/play-dom/type-aliases/ActionFn.md +46 -0
- package/api/@xmachines/play-dom/type-aliases/Actions.md +18 -0
- 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 +26 -0
- package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +15 -0
- package/api/@xmachines/play-dom/type-aliases/ConfirmHandler.md +44 -0
- package/api/@xmachines/play-dom/type-aliases/DefineRegistryOptions.md +39 -0
- package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +20 -0
- package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +9 -0
- package/api/@xmachines/play-dom/type-aliases/DomSchema.md +9 -0
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +27 -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 +62 -0
- package/api/@xmachines/play-dom-router/README.md +272 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +43 -0
- package/api/@xmachines/{play-router → play-dom-router}/functions/createBrowserHistory.md +10 -2
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-dom-router/functions/createRouter.md +54 -0
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +176 -0
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +69 -0
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +15 -0
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +129 -0
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +68 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +54 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +121 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +28 -0
- package/api/@xmachines/play-react/README.md +185 -333
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +46 -42
- 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/defineRegistry.md +49 -0
- package/api/@xmachines/play-react/functions/useActor.md +13 -0
- package/api/@xmachines/play-react/functions/useBoundProp.md +45 -0
- package/api/@xmachines/play-react/functions/usePlayView.md +32 -0
- package/api/@xmachines/play-react/functions/useSignalEffect.md +29 -20
- 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/ComponentContext.md +37 -0
- package/api/@xmachines/play-react/interfaces/JSONUIProviderProps.md +22 -0
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -6
- 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/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-react/type-aliases/ComponentFn.md +36 -0
- 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 +6 -56
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +43 -0
- package/api/@xmachines/play-react-router/README.md +130 -115
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +19 -242
- package/api/@xmachines/play-react-router/classes/RouteMap.md +48 -36
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +45 -0
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +23 -12
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +32 -0
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +25 -9
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +19 -9
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +32 -0
- package/api/@xmachines/play-router/README.md +275 -352
- package/api/@xmachines/play-router/classes/RouteMap.md +149 -0
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +21 -221
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +32 -0
- package/api/@xmachines/play-router/functions/buildRouteTree.md +12 -2
- package/api/@xmachines/play-router/functions/createRouteMap.md +22 -36
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +46 -0
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +14 -7
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +10 -46
- package/api/@xmachines/play-router/functions/extractQuery.md +22 -0
- package/api/@xmachines/play-router/functions/extractRouteParams.md +54 -0
- package/api/@xmachines/play-router/functions/findRouteById.md +2 -2
- package/api/@xmachines/play-router/functions/findRouteByPath.md +2 -2
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +2 -2
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +2 -2
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +43 -0
- package/api/@xmachines/play-router/functions/isRouteReachable.md +38 -0
- package/api/@xmachines/play-router/functions/machineToGraph.md +19 -0
- package/api/@xmachines/play-router/functions/routeExists.md +2 -2
- package/api/@xmachines/play-router/functions/sanitizePathname.md +40 -0
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -9
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +13 -0
- package/api/@xmachines/play-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +15 -0
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +17 -0
- package/api/@xmachines/play-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +17 -0
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +64 -0
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +12 -0
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteTree.md +8 -7
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +55 -0
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +20 -0
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +117 -65
- package/api/@xmachines/play-signals/functions/watchSignal.md +42 -0
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +7 -5
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +3 -3
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +7 -5
- package/api/@xmachines/play-signals/interfaces/SignalState.md +4 -4
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +5 -5
- package/api/@xmachines/play-signals/namespaces/Signal/README.md +1 -1
- package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +7 -7
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +8 -8
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +7 -7
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/README.md +1 -1
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +9 -9
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +2 -2
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +2 -2
- package/api/@xmachines/play-solid/README.md +196 -233
- 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 +49 -0
- 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 +13 -0
- package/api/@xmachines/play-solid/functions/useBoundProp.md +45 -0
- 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/ComponentContext.md +37 -0
- package/api/@xmachines/play-solid/interfaces/DefineRegistryResult.md +15 -0
- package/api/@xmachines/play-solid/interfaces/JSONUIProviderProps.md +22 -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/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +36 -0
- package/api/@xmachines/play-solid/type-aliases/ComponentRegistry.md +11 -0
- 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 +6 -62
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +26 -0
- package/api/@xmachines/play-solid-router/README.md +151 -559
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +31 -32
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +27 -242
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +44 -0
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +18 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +99 -114
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +30 -0
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +25 -9
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +20 -7
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +34 -0
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +8 -4
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +22 -19
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +52 -0
- package/api/@xmachines/play-svelte/README.md +270 -0
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +31 -0
- 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 +44 -0
- package/api/@xmachines/play-svelte/interfaces/BaseComponentProps.md +29 -0
- package/api/@xmachines/play-svelte/interfaces/ComponentContext.md +29 -0
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +24 -0
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +43 -0
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +24 -0
- package/api/@xmachines/play-svelte/type-aliases/ActionFn.md +30 -0
- package/api/@xmachines/play-svelte/type-aliases/Actions.md +17 -0
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-svelte/type-aliases/ComponentFn.md +18 -0
- package/api/@xmachines/play-svelte/type-aliases/JSONUIProviderProps.md +7 -0
- package/api/@xmachines/play-svelte/type-aliases/PlayRenderer.md +9 -0
- package/api/@xmachines/play-svelte/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-svelte/type-aliases/SetState.md +21 -0
- package/api/@xmachines/play-svelte/variables/PlayRenderer.md +9 -0
- package/api/@xmachines/play-svelte-spa-router/README.md +197 -0
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +149 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +32 -0
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +17 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +129 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-sveltekit-router/README.md +212 -0
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +149 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +32 -0
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +13 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +129 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-tanstack-react-router/README.md +155 -125
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +48 -36
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +31 -252
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +45 -0
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +22 -36
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +23 -12
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +28 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +32 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +25 -9
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +19 -9
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +6 -6
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +40 -18
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +34 -0
- package/api/@xmachines/play-tanstack-router/README.md +61 -0
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +131 -0
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +57 -0
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +100 -0
- package/api/@xmachines/play-tanstack-solid-router/README.md +216 -175
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +31 -32
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +121 -0
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +44 -0
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +18 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +31 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +23 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +14 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +8 -4
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +40 -18
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +33 -0
- package/api/@xmachines/play-vue/README.md +190 -210
- package/api/@xmachines/play-vue/functions/defineRegistry.md +32 -0
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +28 -0
- package/api/@xmachines/play-vue/functions/useActor.md +13 -0
- package/api/@xmachines/play-vue/functions/useBoundProp.md +45 -0
- 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/ComponentContext.md +37 -0
- package/api/@xmachines/play-vue/interfaces/DefineRegistryResult.md +15 -0
- package/api/@xmachines/play-vue/interfaces/JSONUIProviderProps.md +21 -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/interfaces/VisibilityProviderProps.md +5 -0
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +16 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentFn.md +35 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +15 -0
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +22 -0
- 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 +105 -0
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +2 -2
- package/api/@xmachines/play-vue/variables/Renderer.md +88 -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/README.md +173 -486
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +56 -116
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +23 -271
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +26 -6
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +20 -8
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +8 -4
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +12 -6
- package/api/@xmachines/play-xstate/README.md +203 -354
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +195 -201
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +24 -20
- package/api/@xmachines/play-xstate/functions/composeGuards.md +8 -3
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +8 -3
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +43 -0
- package/api/@xmachines/play-xstate/functions/definePlayer.md +14 -63
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +3 -3
- package/api/@xmachines/play-xstate/functions/eventMatches.md +8 -3
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +3 -3
- package/api/@xmachines/play-xstate/functions/hasContext.md +8 -5
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +2 -2
- package/api/@xmachines/play-xstate/functions/negateGuard.md +8 -3
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +10 -14
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +22 -0
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +14 -16
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -13
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +17 -0
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +8 -3
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +8 -6
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +9 -7
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +15 -18
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +15 -5
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +9 -0
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +22 -6
- package/api/@xmachines/shared/README.md +95 -295
- package/api/@xmachines/shared/vite-aliases/README.md +11 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +38 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +27 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +35 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +42 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +33 -0
- package/api/@xmachines/shared/vitest/README.md +12 -0
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +42 -0
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +34 -0
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +16 -0
- package/api/README.md +6 -7
- package/api/llms.txt +72 -23
- package/contributing/README.md +10 -0
- package/contributing/architecture.md +601 -0
- package/contributing/configuration.md +368 -0
- package/contributing/deployment.md +333 -0
- package/contributing/development.md +503 -0
- package/contributing/testing.md +461 -0
- package/examples/@xmachines/play-dom-demo/README.md +181 -0
- package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +24 -0
- package/examples/@xmachines/play-dom-demo/functions/initShell.md +25 -0
- package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-dom-demo/variables/About.md +12 -0
- package/examples/@xmachines/play-dom-demo/variables/Contact.md +12 -0
- package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Home.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Login.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +16 -0
- package/examples/@xmachines/play-dom-demo/variables/Navigation.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Overview.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Profile.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Settings.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Stats.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-dom-router-demo/README.md +145 -0
- package/examples/@xmachines/play-react-demo/README.md +187 -0
- package/examples/@xmachines/play-react-demo/functions/App.md +13 -0
- package/examples/@xmachines/play-react-demo/functions/DebugPanel.md +20 -0
- package/examples/@xmachines/play-react-demo/functions/HeaderNav.md +20 -0
- package/examples/@xmachines/play-react-demo/functions/Shell.md +22 -0
- package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-react-demo/variables/About.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Contact.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Dashboard.md +15 -0
- package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +16 -0
- package/examples/@xmachines/play-react-demo/variables/Home.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Login.md +16 -0
- package/examples/@xmachines/play-react-demo/variables/NavBar.md +16 -0
- package/examples/@xmachines/play-react-demo/variables/NavBarView.md +15 -0
- package/examples/@xmachines/play-react-demo/variables/Navigation.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Overview.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Profile.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Settings.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Shell.md +19 -0
- package/examples/@xmachines/play-react-demo/variables/Stats.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-react-router-demo/README.md +151 -0
- package/examples/@xmachines/play-solid-demo/README.md +187 -0
- package/examples/@xmachines/play-solid-demo/functions/App.md +13 -0
- package/examples/@xmachines/play-solid-demo/functions/DebugPanel.md +20 -0
- package/examples/@xmachines/play-solid-demo/functions/HeaderNav.md +20 -0
- package/examples/@xmachines/play-solid-demo/functions/Shell.md +22 -0
- package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/About.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Contact.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +17 -0
- package/examples/@xmachines/play-solid-demo/variables/Home.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Login.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/NavBar.md +11 -0
- package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +15 -0
- package/examples/@xmachines/play-solid-demo/variables/Navigation.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Overview.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Profile.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Settings.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Shell.md +18 -0
- package/examples/@xmachines/play-solid-demo/variables/Stats.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-solid-router-demo/README.md +137 -0
- package/examples/@xmachines/play-svelte-demo/README.md +143 -0
- package/examples/@xmachines/play-svelte-demo/type-aliases/App.md +9 -0
- package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-svelte-demo/variables/App.md +9 -0
- package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-svelte-spa-router-demo/README.md +129 -0
- package/examples/@xmachines/play-sveltekit-router-demo/README.md +133 -0
- package/examples/@xmachines/play-tanstack-react-router-demo/README.md +156 -0
- package/examples/@xmachines/play-tanstack-solid-router-demo/README.md +139 -0
- package/examples/@xmachines/play-vue-demo/README.md +183 -0
- package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-vue-demo/variables/App.md +9 -0
- package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-vue-router-demo/README.md +139 -0
- package/examples/README.md +78 -30
- package/examples/basic-state-machine.md +73 -31
- package/examples/form-validation.md +259 -118
- package/examples/multi-router-integration.md +312 -194
- package/examples/routing-patterns.md +228 -189
- package/examples/traffic-light.md +112 -65
- package/guides/README.md +7 -21
- package/guides/actor-model.md +180 -0
- package/guides/getting-started.md +627 -137
- package/guides/signals.md +166 -0
- package/guides/state-machines.md +284 -0
- package/package.json +21 -7
- package/rfc/broker.md +100 -0
- package/rfc/browser.md +44 -0
- package/rfc/cli.md +118 -0
- package/rfc/git.md +61 -0
- package/rfc/mcp.md +43 -0
- package/rfc/node.md +36 -0
- package/rfc/play.md +472 -0
- package/rfc/rest.md +102 -0
- package/rfc/run.md +159 -0
- package/rfc/streams.md +168 -0
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +0 -17
- package/api/@xmachines/play-catalog/README.md +0 -331
- package/api/@xmachines/play-catalog/functions/defineCatalog.md +0 -98
- package/api/@xmachines/play-catalog/functions/defineComponents.md +0 -134
- package/api/@xmachines/play-catalog/type-aliases/Catalog.md +0 -48
- package/api/@xmachines/play-catalog/type-aliases/ComponentsFor.md +0 -20
- package/api/@xmachines/play-catalog/type-aliases/InferComponentProps.md +0 -65
- package/api/@xmachines/play-catalog/type-aliases/NoExtraKeys.md +0 -17
- package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +0 -15
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-react-router-demo/README.md +0 -137
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +0 -142
- package/api/@xmachines/play-router/functions/connectRouter.md +0 -67
- package/api/@xmachines/play-router/functions/crawlMachine.md +0 -92
- package/api/@xmachines/play-router/functions/createRouter.md +0 -76
- package/api/@xmachines/play-router/functions/extractRoute.md +0 -45
- package/api/@xmachines/play-router/interfaces/BaseRouteMapping.md +0 -27
- package/api/@xmachines/play-router/interfaces/BrowserHistory.md +0 -172
- package/api/@xmachines/play-router/interfaces/BrowserWindow.md +0 -69
- package/api/@xmachines/play-router/interfaces/ConnectRouterOptions.md +0 -13
- package/api/@xmachines/play-router/interfaces/RouteMap.md +0 -56
- package/api/@xmachines/play-router/interfaces/StateVisit.md +0 -15
- package/api/@xmachines/play-router/interfaces/VanillaRouter.md +0 -28
- package/api/@xmachines/play-router-demo/README.md +0 -137
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +0 -15
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-solid-router-demo/README.md +0 -127
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +0 -38
- package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +0 -33
- package/api/@xmachines/play-tanstack-react-router/variables/extractMachineRoutes.md +0 -64
- package/api/@xmachines/play-tanstack-react-router-demo/README.md +0 -126
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +0 -343
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-tanstack-solid-router-demo/README.md +0 -126
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +0 -14
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +0 -201
- package/api/@xmachines/play-vue-router-demo/README.md +0 -133
- package/api/@xmachines/play-xstate/functions/mergeViewProps.md +0 -26
- package/api/@xmachines/play-xstate/functions/stateMatches.md +0 -25
- package/api/@xmachines/play-xstate/functions/validateComponentBinding.md +0 -39
- package/api/@xmachines/play-xstate/functions/validateViewProps.md +0 -80
- package/api/@xmachines/play-xstate/interfaces/CatalogEntry.md +0 -16
- package/api/@xmachines/play-xstate/type-aliases/Catalog.md +0 -21
- package/api/@xmachines/play-xstate/type-aliases/ValidationResult.md +0 -17
- package/api/@xmachines/play-xstate/type-aliases/ViewMergeContext.md +0 -35
- package/api/@xmachines/shared/functions/defineXmVitestConfig.md +0 -29
- package/api/@xmachines/shared/functions/xmAliases.md +0 -24
- package/guides/installation.md +0 -323
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / createPlayUI
|
|
2
|
+
|
|
3
|
+
# Function: createPlayUI()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function createPlayUI(registryResult, options?): MountFn;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-dom/src/create-play-ui.ts:93](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/create-play-ui.ts#L93)
|
|
10
|
+
|
|
11
|
+
Create a batteries-included DOM renderer mount function.
|
|
12
|
+
|
|
13
|
+
The caller is responsible for producing `registryResult` via `defineRegistry`.
|
|
14
|
+
`createPlayUI` closes over it and returns a `MountFn` that can be invoked
|
|
15
|
+
once per actor/container pair.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ---------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
21
|
+
| `registryResult` | [`DefineRegistryResult`](../interfaces/DefineRegistryResult.md) | Result from `defineRegistry()` — provides the registry and the lazy handlers factory. |
|
|
22
|
+
| `options` | [`CreatePlayUIOptions`](../interfaces/CreatePlayUIOptions.md) | Factory-level configuration (see [CreatePlayUIOptions](../interfaces/CreatePlayUIOptions.md)): - `functions` — named compute functions for `$computed` prop expressions. - `directives` — custom `$`-prefixed dynamic values resolved during prop resolution. - `validationFunctions` — custom validation functions; available at `ctx.ctx.validationFunctions`. - `navigate` — navigation callback; invoked on `onSuccess: { navigate: "..." }`. - `onRenderError` — `(error, name)` handler for component render errors and action handler rejections. - `fallback` — element shown when the actor's initial view is `null`. |
|
|
23
|
+
|
|
24
|
+
## Returns
|
|
25
|
+
|
|
26
|
+
[`MountFn`](../type-aliases/MountFn.md)
|
|
27
|
+
|
|
28
|
+
`MountFn`: `(actor, container, mountOptions?) → disconnect`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / createRenderer
|
|
2
|
+
|
|
3
|
+
# Function: createRenderer()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function createRenderer<C>(catalog, componentMap): (actor, container, options?) => () => void;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-dom/src/create-renderer.ts:84](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/create-renderer.ts#L84)
|
|
10
|
+
|
|
11
|
+
Create a reusable DOM renderer factory from a catalog and component map.
|
|
12
|
+
|
|
13
|
+
Returns a `mount(actor, container, options?)` function that wires up the
|
|
14
|
+
PlayRenderer in one call and returns a `disconnect` cleanup function.
|
|
15
|
+
|
|
16
|
+
## Type Parameters
|
|
17
|
+
|
|
18
|
+
| Type Parameter |
|
|
19
|
+
| ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
20
|
+
| `C` _extends_ `Catalog`\<`SchemaDefinition`\<`SchemaType`\<`string`, `unknown`\>, `SchemaType`\<`string`, `unknown`\>\>, `unknown`\> |
|
|
21
|
+
|
|
22
|
+
## Parameters
|
|
23
|
+
|
|
24
|
+
| Parameter | Type | Description |
|
|
25
|
+
| -------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------- |
|
|
26
|
+
| `catalog` | `C` | The json-render Catalog describing component and action schemas. |
|
|
27
|
+
| `componentMap` | [`ComponentRegistry`](../type-aliases/ComponentRegistry.md)\<`C`\> | Component implementations keyed by catalog component name. |
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
A `mount` function that accepts `(actor, container, options?)` and returns `disconnect`.
|
|
32
|
+
|
|
33
|
+
(`actor`, `container`, `options?`) => () => `void`
|
|
34
|
+
|
|
35
|
+
## Remarks
|
|
36
|
+
|
|
37
|
+
`createRenderer` manages `registryResult` internally — it calls `defineRegistry` once and
|
|
38
|
+
reuses the result across all `mount()` calls. The `mount` options type therefore excludes
|
|
39
|
+
`registryResult` (it is always provided by `createRenderer` itself and cannot be overridden).
|
|
40
|
+
|
|
41
|
+
If you need to call `registryResult.executeAction()` programmatically (outside the emit/on
|
|
42
|
+
flow), or pass additional provider options (`navigate`, `onRenderError`, `functions`, etc.),
|
|
43
|
+
use `createPlayUI` (which accepts the full `CreatePlayUIOptions`) or `defineRegistry` with
|
|
44
|
+
`PlayRenderer` directly rather than `createRenderer`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / defineRegistry
|
|
2
|
+
|
|
3
|
+
# Function: defineRegistry()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function defineRegistry<C>(_catalog, options): DefineRegistryResult;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: `@xmachines/json-render-dom`
|
|
10
|
+
|
|
11
|
+
## Type Parameters
|
|
12
|
+
|
|
13
|
+
| Type Parameter |
|
|
14
|
+
| ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
15
|
+
| `C` _extends_ `Catalog`\<`SchemaDefinition`\<`SchemaType`\<`string`, `unknown`\>, `SchemaType`\<`string`, `unknown`\>\>, `unknown`\> |
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| ---------- | -------------------------------------------------------------------------- |
|
|
21
|
+
| `_catalog` | `C` |
|
|
22
|
+
| `options` | [`DefineRegistryOptions`](../type-aliases/DefineRegistryOptions.md)\<`C`\> |
|
|
23
|
+
|
|
24
|
+
## Returns
|
|
25
|
+
|
|
26
|
+
[`DefineRegistryResult`](../interfaces/DefineRegistryResult.md)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / renderSpec
|
|
2
|
+
|
|
3
|
+
# Function: renderSpec()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function renderSpec(spec, store, registry, options?): Node | null;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: `@xmachines/json-render-dom`
|
|
10
|
+
|
|
11
|
+
Render a Spec tree into DOM nodes using the provided `DomRegistry`.
|
|
12
|
+
|
|
13
|
+
Traverses the spec from `spec.root`, evaluates visibility, resolves all prop
|
|
14
|
+
expressions (including `$state`, `$bindState`, `$computed`, `$template`, etc.),
|
|
15
|
+
and calls the matching `DomComponentRenderer` for each visible element.
|
|
16
|
+
|
|
17
|
+
Event wiring and child rendering are handled inside the component wrapper
|
|
18
|
+
built by `defineRegistry` — this function only orchestrates the traversal.
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Type | Description |
|
|
23
|
+
| ---------- | --------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
24
|
+
| `spec` | `Spec` | The json-render `Spec` describing the UI tree. |
|
|
25
|
+
| `store` | `StateStore` | Live `StateStore` bound to `spec.state`. |
|
|
26
|
+
| `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) | Map of element type names → `DomComponentRenderer`. |
|
|
27
|
+
| `options?` | [`RenderSpecOptions`](../interfaces/RenderSpecOptions.md) | Named options — see [RenderSpecOptions](../interfaces/RenderSpecOptions.md). |
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
`Node` \| `null`
|
|
32
|
+
|
|
33
|
+
The root DOM `Node`, or `null` if the root is invisible
|
|
34
|
+
or has no registered renderer.
|
|
35
|
+
|
|
36
|
+
## Remarks
|
|
37
|
+
|
|
38
|
+
**Devtools isolation in tests:** The module-level `devtoolsActive` flag is a
|
|
39
|
+
singleton that persists for the lifetime of the module. In test environments,
|
|
40
|
+
any call to `markDevtoolsActive()` MUST be paired with a `release()` call
|
|
41
|
+
inside a `try/finally` block. Failing to do so leaves `devtoolsActive = true`
|
|
42
|
+
for all subsequent tests, causing false positives in devtools-conditional
|
|
43
|
+
rendering paths (e.g. `data-jr-key` wrapper spans).
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const release = markDevtoolsActive();
|
|
47
|
+
try {
|
|
48
|
+
// test code
|
|
49
|
+
} finally {
|
|
50
|
+
release();
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Example
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
const { registry, handlers } = defineRegistry(catalog, { components, actions });
|
|
58
|
+
const resolvedHandlers = handlers(
|
|
59
|
+
() => undefined,
|
|
60
|
+
() => ({}),
|
|
61
|
+
);
|
|
62
|
+
const node = renderSpec(spec, store, registry, {
|
|
63
|
+
send: actor.send.bind(actor),
|
|
64
|
+
handlers: resolvedHandlers,
|
|
65
|
+
});
|
|
66
|
+
if (node) container.appendChild(node);
|
|
67
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / ComponentContext
|
|
2
|
+
|
|
3
|
+
# Interface: ComponentContext\<C, K\>
|
|
4
|
+
|
|
5
|
+
Defined in: `@xmachines/json-render-dom`
|
|
6
|
+
|
|
7
|
+
## Type Parameters
|
|
8
|
+
|
|
9
|
+
| Type Parameter |
|
|
10
|
+
| --------------------------------------------------- |
|
|
11
|
+
| `C` _extends_ `Catalog` |
|
|
12
|
+
| `K` _extends_ keyof `InferCatalogComponents`\<`C`\> |
|
|
13
|
+
|
|
14
|
+
## Properties
|
|
15
|
+
|
|
16
|
+
| Property | Type | Description | Defined in |
|
|
17
|
+
| ----------------------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------- | ---------- |
|
|
18
|
+
| <a id="property-bindings"></a> `bindings` | `Record`\<`string`, `string`\> \| `undefined` | Two-way binding paths resolved from `$bindState` / `$bindItem` prop expressions. | - |
|
|
19
|
+
| <a id="property-children"></a> `children` | `Node`[] | Rendered child nodes from the spec's `children` list. | - |
|
|
20
|
+
| <a id="property-ctx"></a> `ctx` | [`DomRenderContext`](DomRenderContext.md) | Low-level render context. | - |
|
|
21
|
+
| <a id="property-emit"></a> `emit` | (`event`) => `void` | Dispatch a named event defined in the spec's `on` map. | - |
|
|
22
|
+
| <a id="property-on"></a> `on` | (`event`) => [`EventHandle`](EventHandle.md) | Get an `EventHandle` for a named event from the spec's `on` map. | - |
|
|
23
|
+
| <a id="property-props"></a> `props` | `InferComponentProps`\<`C`, `K`\> | Catalog-typed, store-resolved props for this component. | - |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / CreatePlayUIOptions
|
|
2
|
+
|
|
3
|
+
# Interface: CreatePlayUIOptions
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/play-dom/src/types.ts:67](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/types.ts#L67)
|
|
6
|
+
|
|
7
|
+
Options for `createPlayUI()` — the batteries-included DOM factory.
|
|
8
|
+
|
|
9
|
+
Extends [UIProviderOptions](UIProviderOptions.md), which contributes `functions`,
|
|
10
|
+
`directives`, `validationFunctions`, `navigate`, and `onRenderError`. All
|
|
11
|
+
are closed over at factory creation time and forwarded into `PlayRenderer`
|
|
12
|
+
on every `mount()` call.
|
|
13
|
+
|
|
14
|
+
Parallel to `PlayUIProvider`'s props in the framework renderers.
|
|
15
|
+
|
|
16
|
+
## See
|
|
17
|
+
|
|
18
|
+
createPlayUI
|
|
19
|
+
|
|
20
|
+
## Extends
|
|
21
|
+
|
|
22
|
+
- [`UIProviderOptions`](UIProviderOptions.md)
|
|
23
|
+
|
|
24
|
+
## Properties
|
|
25
|
+
|
|
26
|
+
| Property | Type | Description | Inherited from | Defined in |
|
|
27
|
+
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| <a id="property-directives"></a> `directives?` | `DirectiveDefinition`\<`ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>\>[] | Custom directives — user-defined `$`-prefixed dynamic values that extend the spec expression language (e.g. `{ $format: "currency", value: ... }`). Each entry is a `DirectiveDefinition` built with `defineDirective` from `@xmachines/json-render-core`. The array is converted to a `DirectiveRegistry` once per render pass and forwarded to `resolveElementProps` via `PropResolutionContext.directives`. Built-in expressions (`$state`, `$cond`, etc.) always take precedence over custom directives. Mirrors the `directives` prop on `JSONUIProvider` / `JsonUIProvider` introduced in **Json-render** 0.19. **Example** `import { defineDirective, resolvePropValue } from "@xmachines/json-render-core"; import { z } from "zod"; const formatDirective = defineDirective({ name: "$format", description: "Locale-aware number formatting.", schema: z.object({ $format: z.enum(["number", "currency"]), value: z.unknown() }), resolve(value, ctx) { const resolved = resolvePropValue(value.value, ctx); return new Intl.NumberFormat().format(resolved as number); }, }); renderSpec(spec, store, registry, { directives: [formatDirective] });` | [`UIProviderOptions`](UIProviderOptions.md).[`directives`](UIProviderOptions.md#property-directives) | - |
|
|
29
|
+
| <a id="property-fallback"></a> `fallback?` | `HTMLElement` \| `null` | Optional fallback element shown when `currentView` is `null` on **initial mount** only. The fallback is appended immediately after `mount()` if the container is empty at that moment (i.e. the actor's initial view is `null`). **Limitation:** If the actor's view transitions to `null` after mount, the container will be cleared but this fallback will NOT be re-appended. For dynamic fallback behavior (null view after non-null), use `PlayRenderer` directly and wrap the `actor.currentView` signal to inject fallback content. | - | [packages/play-dom/src/types.ts:79](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/types.ts#L79) |
|
|
30
|
+
| <a id="property-functions"></a> `functions?` | `Record`\<`string`, `ComputedFunction`\> | Named compute functions for `{ $computed: "name", args: {...} }` prop expressions. Each function receives the resolved `args` object and returns the computed value. Forwarded directly to `resolveElementProps` via `PropResolutionContext.functions`, matching the `FunctionsContext` provider in the framework renderers. Without this option, `$computed` expressions resolve to `undefined` (no throw). **Example** `renderSpec(spec, store, registry, { functions: { fullName: (args) => `${args.first} ${args.last}`, formatCurrency: (args) => new Intl.NumberFormat().format(args.amount as number), }, });` Mirrors the `functions` prop on `JSONUIProvider` / `JsonUIProvider`. | [`UIProviderOptions`](UIProviderOptions.md).[`functions`](UIProviderOptions.md#property-functions) | - |
|
|
31
|
+
| <a id="property-navigate"></a> `navigate?` | (`path`) => `void` | Programmatic navigation function. Called automatically when an action binding resolves with `onSuccess: { navigate: "/path" }`. The resolved path string is passed as the sole argument. Mirrors the `navigate` prop in `ActionProvider` from the framework renderers, where it is captured in the `execute()` closure. Also available to component implementations directly via `ctx.ctx.navigate` for cases where navigation needs to be triggered outside of an action binding. **Example** `import { useNavigate } from "my-router"; const navigate = useNavigate(); renderSpec(spec, store, registry, { navigate });` Spec binding that triggers navigation: `{ "on": { "click": { "action": "doSomething", "onSuccess": { "navigate": "/dashboard" } } } }` | [`UIProviderOptions`](UIProviderOptions.md).[`navigate`](UIProviderOptions.md#property-navigate) | - |
|
|
32
|
+
| <a id="property-onconfirm"></a> `onConfirm?` | [`ConfirmHandler`](../type-aliases/ConfirmHandler.md) | Confirmation hook for actions that declare `confirm` in their binding. Consulted by `emit()` before executing a confirm-gated action. Return (or resolve) `true` to execute, `false` to skip. Without this handler, confirm-gated actions are skipped with a `console.warn` — they never execute unconfirmed. See [ConfirmHandler](../type-aliases/ConfirmHandler.md) for the full contract. This is the headless equivalent of the `pendingConfirmation` / `confirmAction()` / `cancelAction()` flow in the framework adapters. | [`UIProviderOptions`](UIProviderOptions.md).[`onConfirm`](UIProviderOptions.md#property-onconfirm) | - |
|
|
33
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | Unified error handler for component render errors and action handler rejections. Matches `RenderErrorHandler = (error: unknown, name: string) => void`. Invoked for three distinct error classes: - `(error, elementType)` — when a component renderer throws synchronously during `renderSpec` - `(error, actionName)` — when an action handler rejects during `emit()` (on-event path) - `(error, actionName)` — when an action handler rejects during a `watch` binding callback When provided, suppresses the `console.error` fallback for all three error types. Forwarded into `renderSpec` as the `onRenderError` parameter and into `DomRenderContext.onRenderError` so both `emit()` and `watch` handlers route their errors through the same channel as component render errors. **Example** `renderSpec(spec, store, registry, { onRenderError: (err, name) => { myErrorReporter.capture(err, { context: name }); }, });` | [`UIProviderOptions`](UIProviderOptions.md).[`onRenderError`](UIProviderOptions.md#property-onrendererror) | - |
|
|
34
|
+
| <a id="property-validationfunctions"></a> `validationFunctions?` | `Record`\<`string`, (`value`, `args?`) => `boolean`\> | Custom validation functions for inline field validation. Each function receives `(value, args?)` and returns `true` (valid) or `false` (invalid). Functions are available to component implementations via `ctx.ctx.validationFunctions` and should be passed as `customFunctions` to `runValidationCheck` / `runValidation` from `@xmachines/json-render-core`. Mirrors `customFunctions` in `ValidationProvider` from the framework renderers. The DOM renderer has no automatic `ValidationProvider` tree — validation must be invoked explicitly by component implementations. **Example** `import { runValidationCheck } from "@xmachines/json-render-core"; renderSpec(spec, store, registry, { validationFunctions: { isEven: (value) => typeof value === "number" && value % 2 === 0, phoneNumber: (value) => /^\+?[\d\s\-()]{7,}$/.test(String(value)), }, }); // Inside a ComponentFn: const MyField: ComponentFn<typeof catalog, "MyField"> = ({ ctx }) => { const result = runValidationCheck( { type: "isEven", message: "must be even" }, { value: someValue, stateModel: {}, customFunctions: ctx.ctx.validationFunctions }, ); // result.valid, result.message };` | [`UIProviderOptions`](UIProviderOptions.md).[`validationFunctions`](UIProviderOptions.md#property-validationfunctions) | - |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / DefineRegistryResult
|
|
2
|
+
|
|
3
|
+
# Interface: DefineRegistryResult
|
|
4
|
+
|
|
5
|
+
Defined in: `@xmachines/json-render-dom`
|
|
6
|
+
|
|
7
|
+
Result returned by `defineRegistry`.
|
|
8
|
+
|
|
9
|
+
Matches `DefineRegistryResult` from @xmachines/json-render-react, /solid, /svelte, /vue.
|
|
10
|
+
|
|
11
|
+
## Properties
|
|
12
|
+
|
|
13
|
+
| Property | Type | Description | Defined in |
|
|
14
|
+
| --------------------------------------------------- | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
|
|
15
|
+
| <a id="property-executeaction"></a> `executeAction` | (`actionName`, `params`, `setState`, `state?`) => `Promise`\<`void`\> | Execute a named action by name, with optional params. Mirrors `executeAction` on `DefineRegistryResult` from @xmachines/json-render-react, /solid, /vue, /svelte. Useful for programmatically triggering actions outside of the emit/on flow. | - |
|
|
16
|
+
| <a id="property-handlers"></a> `handlers` | (`getSetState`, `getState`) => `Record`\<`string`, `ActionHandler`\> | Create ActionProvider-compatible handlers. Accepts getter functions (called lazily at action-invocation time) so handlers always see the latest setState and state snapshot — matching the pattern from the framework renderers. Host renderers typically wire these from their state store. Pass `() => undefined, () => ({})` only in tests or when state management is not needed. | - |
|
|
17
|
+
| <a id="property-registry"></a> `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) | The built `DomRegistry`, ready to pass to `renderSpec`. | - |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / DomRenderContext
|
|
2
|
+
|
|
3
|
+
# Interface: DomRenderContext
|
|
4
|
+
|
|
5
|
+
Defined in: `@xmachines/json-render-dom`
|
|
6
|
+
|
|
7
|
+
Low-level render context passed to each `DomComponentRenderer`.
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
| Property | Type | Description | Defined in |
|
|
12
|
+
| ---------------------------------------------------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
|
|
13
|
+
| <a id="property-directives"></a> `directives?` | `DirectiveRegistry` | Custom directive registry, converted from `UIProviderOptions.directives` (a `DirectiveDefinition[]`) once per render pass and forwarded to `PropResolutionContext.directives`. Components that resolve prop sub-values themselves (via `resolvePropValue` from `@xmachines/json-render-core`) should include this in their resolution context so custom `$`-prefixed dynamic values keep working inside those values. Mirrors the directives context from the framework renderers (`useDirectives` / `DirectivesContextProvider` / `DIRECTIVES_KEY`). | - |
|
|
14
|
+
| <a id="property-elementbindings"></a> `elementBindings?` | `Record`\<`string`, `string`\> | Pre-computed two-way binding paths for this element's props. | - |
|
|
15
|
+
| <a id="property-functions"></a> `functions?` | `Record`\<`string`, `ComputedFunction`\> | Optional map of named compute functions, forwarded to PropResolutionContext. Enables { $computed: "funcName", args: {...} } prop expressions to resolve. Mirrors the `functions` prop from framework renderer providers. | - |
|
|
16
|
+
| <a id="property-handlers"></a> `handlers` | `Record`\<`string`, `ActionHandler`\> | Map of json-render catalog action names → async ActionHandler functions. | - |
|
|
17
|
+
| <a id="property-loading"></a> `loading?` | `boolean` | When true, indicates the spec is still streaming (e.g. from an AI provider). Component implementations can use this to show skeleton/loading states. When loading=true, missing-child warnings are suppressed. Mirrors the `loading` prop from framework renderer providers. | - |
|
|
18
|
+
| <a id="property-navigate"></a> `navigate?` | (`path`) => `void` | Navigation function forwarded from `UIProviderOptions`. Called when an action binding has `onSuccess: { navigate: "/path" }`. Mirrors the `navigate` prop in `ActionProvider` from framework renderers. | - |
|
|
19
|
+
| <a id="property-onconfirm"></a> `onConfirm?` | [`ConfirmHandler`](../type-aliases/ConfirmHandler.md) | Confirmation hook forwarded from `UIProviderOptions.onConfirm`. Consulted by `emit()` before executing an action binding that declares `confirm`. When absent, confirm-gated actions are skipped with a `console.warn` instead of executing unconfirmed. | - |
|
|
20
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | Error handler forwarded from `UIProviderOptions.onRenderError`. Matches `RenderErrorHandler = (error: unknown, name: string) => void`. Called by `emit()` when an action handler rejects, with `(error, actionName)`. Also called by `renderSpec` when a component renderer throws, with `(error, elementType)`. When absent, both fall back to `console.error`. Component implementations may call this directly via `ctx.ctx.onRenderError` to surface errors through the application's central error channel. | - |
|
|
21
|
+
| <a id="property-renderchildren"></a> `renderChildren` | (`keys`) => `Node`[] | Render a list of child element keys into DOM nodes. | - |
|
|
22
|
+
| <a id="property-repeatbasepath"></a> `repeatBasePath?` | `string` | Absolute JSON Pointer path to the current repeat item (e.g. "/todos/0"). Mirrors `repeatBasePath` in `PropResolutionContext`. | - |
|
|
23
|
+
| <a id="property-repeatindex"></a> `repeatIndex?` | `number` | Current repeat array index when inside a repeat scope. Mirrors `repeatIndex` in `PropResolutionContext`. | - |
|
|
24
|
+
| <a id="property-repeatitem"></a> `repeatItem?` | `unknown` | Current repeat item when inside a repeat scope. Mirrors `repeatItem` in `@xmachines/json-render-core`'s `PropResolutionContext`. | - |
|
|
25
|
+
| <a id="property-send"></a> `send` | (`event`) => `void` | Dispatch an event (e.g. to an XState actor). | - |
|
|
26
|
+
| <a id="property-spec"></a> `spec` | `Spec` | Full spec tree for this render pass. | - |
|
|
27
|
+
| <a id="property-store"></a> `store` | `StateStore` | Live state store bound to `spec.state`. | - |
|
|
28
|
+
| <a id="property-validationfunctions"></a> `validationFunctions?` | `Record`\<`string`, (`value`, `args?`) => `boolean`\> | Custom validation functions available to `runValidation` / `runValidationCheck`. Each function receives `(value, args?)` and returns a boolean. Mirrors `customFunctions` in `ValidationProvider` from framework renderers. Components that perform inline validation (e.g. form fields) should read this from `ctx.ctx.validationFunctions` and pass it as `customFunctions` to `runValidationCheck` / `runValidation` from `@xmachines/json-render-core`. | - |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / EventHandle
|
|
2
|
+
|
|
3
|
+
# Interface: EventHandle
|
|
4
|
+
|
|
5
|
+
Defined in: `@xmachines/json-render-dom`
|
|
6
|
+
|
|
7
|
+
Handle returned by `ComponentContext.on(eventName)`.
|
|
8
|
+
|
|
9
|
+
## Properties
|
|
10
|
+
|
|
11
|
+
| Property | Type | Description | Defined in |
|
|
12
|
+
| ----------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------ | ---------- |
|
|
13
|
+
| <a id="property-bound"></a> `bound` | `boolean` | `true` if an `on` binding exists for this event name; `false` otherwise. | - |
|
|
14
|
+
| <a id="property-emit"></a> `emit` | () => `void` | Fire the bound action, resolving params from the current state store. | - |
|
|
15
|
+
| <a id="property-shouldpreventdefault"></a> `shouldPreventDefault` | `boolean` | Whether any binding for this event has `preventDefault: true`. | - |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / MountOptions
|
|
2
|
+
|
|
3
|
+
# Interface: MountOptions
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/play-dom/src/create-play-ui.ts:48](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/create-play-ui.ts#L48)
|
|
6
|
+
|
|
7
|
+
Per-mount options passed to the `MountFn` returned by `createPlayUI`.
|
|
8
|
+
|
|
9
|
+
These override or supplement the factory-level options on a per-actor/container
|
|
10
|
+
basis. Factory-level options (`functions`, `validationFunctions`, `navigate`,
|
|
11
|
+
`onRenderError`, `fallback`) are set once when calling `createPlayUI`.
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
| Property | Type | Description | Defined in |
|
|
16
|
+
| ---------------------------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| <a id="property-loading"></a> `loading?` | `boolean` | When `true`, suppresses missing-child warnings during streaming spec ingestion and exposes `ctx.ctx.loading` to component implementations. | [packages/play-dom/src/create-play-ui.ts:59](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/create-play-ui.ts#L59) |
|
|
18
|
+
| <a id="property-store"></a> `store?` | `StateStore` | Optional external `StateStore` (controlled mode). When omitted, a fresh `@xstate/store` atom is created per view transition seeded from `spec.state`. | [packages/play-dom/src/create-play-ui.ts:54](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/create-play-ui.ts#L54) |
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / PlayDomOptions
|
|
2
|
+
|
|
3
|
+
# Interface: PlayDomOptions
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/play-dom/src/types.ts:23](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/types.ts#L23)
|
|
6
|
+
|
|
7
|
+
Options for `PlayRenderer`.
|
|
8
|
+
|
|
9
|
+
Extends [UIProviderOptions](UIProviderOptions.md), which contributes `functions`,
|
|
10
|
+
`directives`, `validationFunctions`, `navigate`, and `onRenderError`. All
|
|
11
|
+
are forwarded into `DomRenderContext` on every render pass and are readable
|
|
12
|
+
by component implementations via `ctx.ctx.*`.
|
|
13
|
+
|
|
14
|
+
## Extends
|
|
15
|
+
|
|
16
|
+
- [`UIProviderOptions`](UIProviderOptions.md)
|
|
17
|
+
|
|
18
|
+
## Properties
|
|
19
|
+
|
|
20
|
+
| Property | Type | Description | Inherited from | Defined in |
|
|
21
|
+
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
22
|
+
| <a id="property-directives"></a> `directives?` | `DirectiveDefinition`\<`ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>\>[] | Custom directives — user-defined `$`-prefixed dynamic values that extend the spec expression language (e.g. `{ $format: "currency", value: ... }`). Each entry is a `DirectiveDefinition` built with `defineDirective` from `@xmachines/json-render-core`. The array is converted to a `DirectiveRegistry` once per render pass and forwarded to `resolveElementProps` via `PropResolutionContext.directives`. Built-in expressions (`$state`, `$cond`, etc.) always take precedence over custom directives. Mirrors the `directives` prop on `JSONUIProvider` / `JsonUIProvider` introduced in **Json-render** 0.19. **Example** `import { defineDirective, resolvePropValue } from "@xmachines/json-render-core"; import { z } from "zod"; const formatDirective = defineDirective({ name: "$format", description: "Locale-aware number formatting.", schema: z.object({ $format: z.enum(["number", "currency"]), value: z.unknown() }), resolve(value, ctx) { const resolved = resolvePropValue(value.value, ctx); return new Intl.NumberFormat().format(resolved as number); }, }); renderSpec(spec, store, registry, { directives: [formatDirective] });` | [`UIProviderOptions`](UIProviderOptions.md).[`directives`](UIProviderOptions.md#property-directives) | - |
|
|
23
|
+
| <a id="property-functions"></a> `functions?` | `Record`\<`string`, `ComputedFunction`\> | Named compute functions for `{ $computed: "name", args: {...} }` prop expressions. Each function receives the resolved `args` object and returns the computed value. Forwarded directly to `resolveElementProps` via `PropResolutionContext.functions`, matching the `FunctionsContext` provider in the framework renderers. Without this option, `$computed` expressions resolve to `undefined` (no throw). **Example** `renderSpec(spec, store, registry, { functions: { fullName: (args) => `${args.first} ${args.last}`, formatCurrency: (args) => new Intl.NumberFormat().format(args.amount as number), }, });` Mirrors the `functions` prop on `JSONUIProvider` / `JsonUIProvider`. | [`UIProviderOptions`](UIProviderOptions.md).[`functions`](UIProviderOptions.md#property-functions) | - |
|
|
24
|
+
| <a id="property-loading"></a> `loading?` | `boolean` | When `true`, indicates the spec is still streaming (e.g. from an AI provider). Forwarded to `renderSpec` so component implementations can read `ctx.ctx.loading` to render skeleton states. Also suppresses missing-child warnings during stream ingestion, since referenced elements may not yet have arrived in the incremental spec. Mirrors the `loading` prop from framework renderer providers. | - | [packages/play-dom/src/types.ts:52](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/types.ts#L52) |
|
|
25
|
+
| <a id="property-navigate"></a> `navigate?` | (`path`) => `void` | Programmatic navigation function. Called automatically when an action binding resolves with `onSuccess: { navigate: "/path" }`. The resolved path string is passed as the sole argument. Mirrors the `navigate` prop in `ActionProvider` from the framework renderers, where it is captured in the `execute()` closure. Also available to component implementations directly via `ctx.ctx.navigate` for cases where navigation needs to be triggered outside of an action binding. **Example** `import { useNavigate } from "my-router"; const navigate = useNavigate(); renderSpec(spec, store, registry, { navigate });` Spec binding that triggers navigation: `{ "on": { "click": { "action": "doSomething", "onSuccess": { "navigate": "/dashboard" } } } }` | [`UIProviderOptions`](UIProviderOptions.md).[`navigate`](UIProviderOptions.md#property-navigate) | - |
|
|
26
|
+
| <a id="property-onconfirm"></a> `onConfirm?` | [`ConfirmHandler`](../type-aliases/ConfirmHandler.md) | Confirmation hook for actions that declare `confirm` in their binding. Consulted by `emit()` before executing a confirm-gated action. Return (or resolve) `true` to execute, `false` to skip. Without this handler, confirm-gated actions are skipped with a `console.warn` — they never execute unconfirmed. See [ConfirmHandler](../type-aliases/ConfirmHandler.md) for the full contract. This is the headless equivalent of the `pendingConfirmation` / `confirmAction()` / `cancelAction()` flow in the framework adapters. | [`UIProviderOptions`](UIProviderOptions.md).[`onConfirm`](UIProviderOptions.md#property-onconfirm) | - |
|
|
27
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | Unified error handler for component render errors and action handler rejections. Matches `RenderErrorHandler = (error: unknown, name: string) => void`. Invoked for three distinct error classes: - `(error, elementType)` — when a component renderer throws synchronously during `renderSpec` - `(error, actionName)` — when an action handler rejects during `emit()` (on-event path) - `(error, actionName)` — when an action handler rejects during a `watch` binding callback When provided, suppresses the `console.error` fallback for all three error types. Forwarded into `renderSpec` as the `onRenderError` parameter and into `DomRenderContext.onRenderError` so both `emit()` and `watch` handlers route their errors through the same channel as component render errors. **Example** `renderSpec(spec, store, registry, { onRenderError: (err, name) => { myErrorReporter.capture(err, { context: name }); }, });` | [`UIProviderOptions`](UIProviderOptions.md).[`onRenderError`](UIProviderOptions.md#property-onrendererror) | - |
|
|
28
|
+
| <a id="property-registryresult"></a> `registryResult?` | [`DefineRegistryResult`](DefineRegistryResult.md) | The result from `defineRegistry` — provides both the registry and the handlers factory. When provided, `PlayRenderer` wires `setState` and `getState` from the @xstate/store-backed `StateStore` into the handlers factory automatically. This is the preferred approach as it ensures actions always receive live `setState` and `state` bound to the current store. | - | [packages/play-dom/src/types.ts:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/types.ts#L31) |
|
|
29
|
+
| <a id="property-store"></a> `store?` | `StateStore` | Optional external StateStore (e.g. from `xstateStoreStateStore` in @xmachines/json-render-xstate). When provided, `PlayRenderer` operates in controlled mode — `spec.state` is ignored and this store is the single source of truth for UI state (form values, etc.). When omitted, a fresh `@xstate/store` atom is created internally per view transition, seeded from `spec.state`. | - | [packages/play-dom/src/types.ts:41](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.1.0/packages/play-dom/src/types.ts#L41) |
|
|
30
|
+
| <a id="property-validationfunctions"></a> `validationFunctions?` | `Record`\<`string`, (`value`, `args?`) => `boolean`\> | Custom validation functions for inline field validation. Each function receives `(value, args?)` and returns `true` (valid) or `false` (invalid). Functions are available to component implementations via `ctx.ctx.validationFunctions` and should be passed as `customFunctions` to `runValidationCheck` / `runValidation` from `@xmachines/json-render-core`. Mirrors `customFunctions` in `ValidationProvider` from the framework renderers. The DOM renderer has no automatic `ValidationProvider` tree — validation must be invoked explicitly by component implementations. **Example** `import { runValidationCheck } from "@xmachines/json-render-core"; renderSpec(spec, store, registry, { validationFunctions: { isEven: (value) => typeof value === "number" && value % 2 === 0, phoneNumber: (value) => /^\+?[\d\s\-()]{7,}$/.test(String(value)), }, }); // Inside a ComponentFn: const MyField: ComponentFn<typeof catalog, "MyField"> = ({ ctx }) => { const result = runValidationCheck( { type: "isEven", message: "must be even" }, { value: someValue, stateModel: {}, customFunctions: ctx.ctx.validationFunctions }, ); // result.valid, result.message };` | [`UIProviderOptions`](UIProviderOptions.md).[`validationFunctions`](UIProviderOptions.md#property-validationfunctions) | - |
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / RenderSpecOptions
|
|
2
|
+
|
|
3
|
+
# Interface: RenderSpecOptions
|
|
4
|
+
|
|
5
|
+
Defined in: `@xmachines/json-render-dom`
|
|
6
|
+
|
|
7
|
+
Named options for [renderSpec](../functions/renderSpec.md).
|
|
8
|
+
|
|
9
|
+
All fields are optional — `send` defaults to a no-op and `handlers` to an
|
|
10
|
+
empty map, so `renderSpec(spec, store, registry)` renders a static tree.
|
|
11
|
+
|
|
12
|
+
## Properties
|
|
13
|
+
|
|
14
|
+
| Property | Type | Description | Defined in |
|
|
15
|
+
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
|
|
16
|
+
| <a id="property-directives"></a> `directives?` | `DirectiveDefinition`\<`ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>\>[] | Custom directives — user-defined `$`-prefixed dynamic values that extend the spec expression language. Converted to a `DirectiveRegistry` once per `renderSpec` call and forwarded to `PropResolutionContext.directives`, matching the framework renderers' `directives` prop (@json-render 0.19). Built-in expressions always take precedence over custom directives. | - |
|
|
17
|
+
| <a id="property-fallback"></a> `fallback?` | [`DomComponentRenderer`](../type-aliases/DomComponentRenderer.md) | Renderer called when `registry` has no entry for an element's `type` (GAP-04). If absent, unknown types render as `null`. | - |
|
|
18
|
+
| <a id="property-functions"></a> `functions?` | `Record`\<`string`, `ComputedFunction`\> | Map of named compute functions forwarded to `PropResolutionContext` (GAP-03). Enables `{ $computed: "fn", args }` prop expressions to resolve. When absent, `$computed` expressions return `undefined` (no throw). | - |
|
|
19
|
+
| <a id="property-handlers"></a> `handlers?` | `Record`\<`string`, `ActionHandler`\> | Map of catalog action names → async `ActionHandler` functions, consumed by `defineRegistry`'s `emit()`/`watch` dispatch. Defaults to `{}`. | - |
|
|
20
|
+
| <a id="property-loading"></a> `loading?` | `boolean` | Flag indicating the spec is still streaming (GAP-06). When `true`, components can read `ctx.loading` to render skeleton states, and missing-child warnings (GAP-07) are suppressed since referenced elements may not yet have arrived in the incremental spec. | - |
|
|
21
|
+
| <a id="property-navigate"></a> `navigate?` | (`path`) => `void` | Navigation callback forwarded to `DomRenderContext.navigate`. Invoked automatically by `defineRegistry`'s `emit()` when an action binding resolves with `onSuccess: { navigate: "/path" }`. Also readable by component implementations via `ctx.navigate`. | - |
|
|
22
|
+
| <a id="property-onconfirm"></a> `onConfirm?` | [`ConfirmHandler`](../type-aliases/ConfirmHandler.md) | Confirmation hook forwarded to `DomRenderContext.onConfirm`. Consulted by `defineRegistry`'s `emit()` before executing an action binding that declares `confirm`. Without it, confirm-gated actions are skipped with a `console.warn` (never executed unconfirmed). | - |
|
|
23
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | Callback matching `RenderErrorHandler = (error, name)`. Invoked for three distinct error classes: - `(error, elementType)` when a component renderer throws (GAP-08) - `(error, actionName)` when an action handler rejects during `emit()` - `(error, actionName)` when an action handler rejects in a `watch` binding If absent, all three fall back to `console.error`. Forwarded into `DomRenderContext.onRenderError` so `emit()` and `watch` handlers route errors through the same channel as component render errors. | - |
|
|
24
|
+
| <a id="property-onwatchsetup"></a> `onWatchSetup?` | (`cleanup`) => `void` \| (() => `void`) | Callback invoked with each watch subscription cleanup function (GAP-02). When an element declares `watch`, the renderer sets up a store subscription and passes its unsubscribe function to this callback. Host renderers collect these to call on teardown. When absent, `watch` bindings are not wired. May return a replacement cleanup: when the caller wraps the supplied cleanup (e.g. to drop it from its own collection when invoked), the incremental renderer registers the returned wrapper so an unmount-driven release also runs the caller's bookkeeping. Returning nothing keeps the supplied cleanup. | - |
|
|
25
|
+
| <a id="property-send"></a> `send?` | (`event`) => `void` | Dispatcher for interaction events (e.g. `actor.send`), exposed to component implementations via `ctx.send`. Defaults to a no-op. | - |
|
|
26
|
+
| <a id="property-validationfunctions"></a> `validationFunctions?` | `Record`\<`string`, (`value`, `args?`) => `boolean`\> | Custom validation functions forwarded to `DomRenderContext.validationFunctions`. Components pass these as `customFunctions` to `runValidationCheck` / `runValidation` from `@xmachines/json-render-core`. Has no effect on prop resolution. | - |
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / UIProviderOptions
|
|
2
|
+
|
|
3
|
+
# Interface: UIProviderOptions
|
|
4
|
+
|
|
5
|
+
Defined in: `@xmachines/json-render-dom`
|
|
6
|
+
|
|
7
|
+
Shared UI-provider options — the configurable rendering behaviours that sit
|
|
8
|
+
above the core actor/registry wiring.
|
|
9
|
+
|
|
10
|
+
These fields mirror the forwarded props on `JSONUIProvider` /
|
|
11
|
+
`JsonUIProvider` across @xmachines/json-render-react, /vue, /solid, /svelte.
|
|
12
|
+
Grouping them here lets host renderers extend a single source of truth
|
|
13
|
+
without repeating field declarations.
|
|
14
|
+
|
|
15
|
+
All four fields are threaded into `DomRenderContext` on every render pass
|
|
16
|
+
and are available to component implementations via `ctx.ctx.*`.
|
|
17
|
+
|
|
18
|
+
## Extended by
|
|
19
|
+
|
|
20
|
+
- [`PlayDomOptions`](PlayDomOptions.md)
|
|
21
|
+
- [`CreatePlayUIOptions`](CreatePlayUIOptions.md)
|
|
22
|
+
|
|
23
|
+
## Properties
|
|
24
|
+
|
|
25
|
+
| Property | Type | Description | Defined in |
|
|
26
|
+
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
|
|
27
|
+
| <a id="property-directives"></a> `directives?` | `DirectiveDefinition`\<`ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>\>[] | Custom directives — user-defined `$`-prefixed dynamic values that extend the spec expression language (e.g. `{ $format: "currency", value: ... }`). Each entry is a `DirectiveDefinition` built with `defineDirective` from `@xmachines/json-render-core`. The array is converted to a `DirectiveRegistry` once per render pass and forwarded to `resolveElementProps` via `PropResolutionContext.directives`. Built-in expressions (`$state`, `$cond`, etc.) always take precedence over custom directives. Mirrors the `directives` prop on `JSONUIProvider` / `JsonUIProvider` introduced in **Json-render** 0.19. **Example** `import { defineDirective, resolvePropValue } from "@xmachines/json-render-core"; import { z } from "zod"; const formatDirective = defineDirective({ name: "$format", description: "Locale-aware number formatting.", schema: z.object({ $format: z.enum(["number", "currency"]), value: z.unknown() }), resolve(value, ctx) { const resolved = resolvePropValue(value.value, ctx); return new Intl.NumberFormat().format(resolved as number); }, }); renderSpec(spec, store, registry, { directives: [formatDirective] });` | - |
|
|
28
|
+
| <a id="property-functions"></a> `functions?` | `Record`\<`string`, `ComputedFunction`\> | Named compute functions for `{ $computed: "name", args: {...} }` prop expressions. Each function receives the resolved `args` object and returns the computed value. Forwarded directly to `resolveElementProps` via `PropResolutionContext.functions`, matching the `FunctionsContext` provider in the framework renderers. Without this option, `$computed` expressions resolve to `undefined` (no throw). **Example** `renderSpec(spec, store, registry, { functions: { fullName: (args) => `${args.first} ${args.last}`, formatCurrency: (args) => new Intl.NumberFormat().format(args.amount as number), }, });` Mirrors the `functions` prop on `JSONUIProvider` / `JsonUIProvider`. | - |
|
|
29
|
+
| <a id="property-navigate"></a> `navigate?` | (`path`) => `void` | Programmatic navigation function. Called automatically when an action binding resolves with `onSuccess: { navigate: "/path" }`. The resolved path string is passed as the sole argument. Mirrors the `navigate` prop in `ActionProvider` from the framework renderers, where it is captured in the `execute()` closure. Also available to component implementations directly via `ctx.ctx.navigate` for cases where navigation needs to be triggered outside of an action binding. **Example** `import { useNavigate } from "my-router"; const navigate = useNavigate(); renderSpec(spec, store, registry, { navigate });` Spec binding that triggers navigation: `{ "on": { "click": { "action": "doSomething", "onSuccess": { "navigate": "/dashboard" } } } }` | - |
|
|
30
|
+
| <a id="property-onconfirm"></a> `onConfirm?` | [`ConfirmHandler`](../type-aliases/ConfirmHandler.md) | Confirmation hook for actions that declare `confirm` in their binding. Consulted by `emit()` before executing a confirm-gated action. Return (or resolve) `true` to execute, `false` to skip. Without this handler, confirm-gated actions are skipped with a `console.warn` — they never execute unconfirmed. See [ConfirmHandler](../type-aliases/ConfirmHandler.md) for the full contract. This is the headless equivalent of the `pendingConfirmation` / `confirmAction()` / `cancelAction()` flow in the framework adapters. | - |
|
|
31
|
+
| <a id="property-onrendererror"></a> `onRenderError?` | [`RenderErrorHandler`](../type-aliases/RenderErrorHandler.md) | Unified error handler for component render errors and action handler rejections. Matches `RenderErrorHandler = (error: unknown, name: string) => void`. Invoked for three distinct error classes: - `(error, elementType)` — when a component renderer throws synchronously during `renderSpec` - `(error, actionName)` — when an action handler rejects during `emit()` (on-event path) - `(error, actionName)` — when an action handler rejects during a `watch` binding callback When provided, suppresses the `console.error` fallback for all three error types. Forwarded into `renderSpec` as the `onRenderError` parameter and into `DomRenderContext.onRenderError` so both `emit()` and `watch` handlers route their errors through the same channel as component render errors. **Example** `renderSpec(spec, store, registry, { onRenderError: (err, name) => { myErrorReporter.capture(err, { context: name }); }, });` | - |
|
|
32
|
+
| <a id="property-validationfunctions"></a> `validationFunctions?` | `Record`\<`string`, (`value`, `args?`) => `boolean`\> | Custom validation functions for inline field validation. Each function receives `(value, args?)` and returns `true` (valid) or `false` (invalid). Functions are available to component implementations via `ctx.ctx.validationFunctions` and should be passed as `customFunctions` to `runValidationCheck` / `runValidation` from `@xmachines/json-render-core`. Mirrors `customFunctions` in `ValidationProvider` from the framework renderers. The DOM renderer has no automatic `ValidationProvider` tree — validation must be invoked explicitly by component implementations. **Example** `import { runValidationCheck } from "@xmachines/json-render-core"; renderSpec(spec, store, registry, { validationFunctions: { isEven: (value) => typeof value === "number" && value % 2 === 0, phoneNumber: (value) => /^\+?[\d\s\-()]{7,}$/.test(String(value)), }, }); // Inside a ComponentFn: const MyField: ComponentFn<typeof catalog, "MyField"> = ({ ctx }) => { const result = runValidationCheck( { type: "isEven", message: "must be even" }, { value: someValue, stateModel: {}, customFunctions: ctx.ctx.validationFunctions }, ); // result.valid, result.message };` | - |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / ActionFn
|
|
2
|
+
|
|
3
|
+
# Type Alias: ActionFn\<C, K\>
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type ActionFn<C, K> = (params, setState, state) => Promise<void>;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: `@xmachines/json-render-dom`
|
|
10
|
+
|
|
11
|
+
Catalog-typed action function — mirrors `ActionFn<C, K>` from @xmachines/json-render-react, /solid, /vue.
|
|
12
|
+
|
|
13
|
+
- `params` is typed to the exact param schema defined in the catalog, or `undefined` if the
|
|
14
|
+
spec provided no params. Guard against undefined before accessing params.
|
|
15
|
+
- `setState` writes to the backing local state store. Use it to update ephemeral
|
|
16
|
+
UI state (e.g. form field values, error messages) from within an action handler.
|
|
17
|
+
- `state` is a snapshot of the current state model at the time the action was invoked.
|
|
18
|
+
|
|
19
|
+
## Type Parameters
|
|
20
|
+
|
|
21
|
+
| Type Parameter |
|
|
22
|
+
| ------------------------------------------------ |
|
|
23
|
+
| `C` _extends_ `Catalog` |
|
|
24
|
+
| `K` _extends_ keyof `InferCatalogActions`\<`C`\> |
|
|
25
|
+
|
|
26
|
+
## Parameters
|
|
27
|
+
|
|
28
|
+
| Parameter | Type |
|
|
29
|
+
| ---------- | ---------------------------------------------- |
|
|
30
|
+
| `params` | `InferActionParams`\<`C`, `K`\> \| `undefined` |
|
|
31
|
+
| `setState` | [`SetState`](SetState.md) |
|
|
32
|
+
| `state` | `StateModel` |
|
|
33
|
+
|
|
34
|
+
## Returns
|
|
35
|
+
|
|
36
|
+
`Promise`\<`void`\>
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
login: async (params, setState, state) => {
|
|
42
|
+
if (!params) return;
|
|
43
|
+
setState((prev) => ({ ...prev, loading: true }));
|
|
44
|
+
await actor.send({ type: "auth.login", username: params.username });
|
|
45
|
+
};
|
|
46
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-dom](../README.md) / Actions
|
|
2
|
+
|
|
3
|
+
# Type Alias: Actions\<C\>
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type Actions<C> = { [K in keyof InferCatalogActions<C>]: ActionFn<C, K> };
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: `@xmachines/json-render-dom`
|
|
10
|
+
|
|
11
|
+
Map of catalog-typed action handler functions.
|
|
12
|
+
Each key is a catalog action name; each value is an `ActionFn<C, K>` for that action.
|
|
13
|
+
|
|
14
|
+
## Type Parameters
|
|
15
|
+
|
|
16
|
+
| Type Parameter |
|
|
17
|
+
| ----------------------- |
|
|
18
|
+
| `C` _extends_ `Catalog` |
|