@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
|
@@ -1,223 +1,713 @@
|
|
|
1
1
|
# Getting Started
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This guide serves two audiences:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
1. **Contributors** setting up the XMachines JS monorepo for development.
|
|
6
|
+
2. **Application developers** installing XMachines packages into their own project.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Jump to the section that applies to you:
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
- [Contributor Setup](#contributor-setup) — Clone, install, build, and test the monorepo
|
|
11
|
+
- [Application Developer Quickstart](#application-developer-quickstart) — Install packages, define a machine, connect router and renderer
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Contributor Setup
|
|
16
|
+
|
|
17
|
+
### Prerequisites
|
|
18
|
+
|
|
19
|
+
You need the following installed before cloning the repository:
|
|
20
|
+
|
|
21
|
+
| Requirement | Version | Notes |
|
|
22
|
+
| ----------- | ------------------ | --------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| Node.js | `>= 22.0.0` | Specified in all `package.json` `engines` fields |
|
|
24
|
+
| pnpm | via corepack | Enable with `corepack enable`; the version is pinned by the `packageManager` field. The project uses pnpm workspaces. |
|
|
25
|
+
| Git | any recent version | Conventional commit format is enforced by CI |
|
|
26
|
+
|
|
27
|
+
No global TypeScript install is needed — it is installed as a dev dependency via `pnpm install --frozen-lockfile`.
|
|
28
|
+
|
|
29
|
+
> **Node.js version manager tip:** If you manage multiple Node versions with `nvm` or `fnm`, install and activate Node 22 before proceeding.
|
|
30
|
+
|
|
31
|
+
### Installation Steps
|
|
32
|
+
|
|
33
|
+
#### 1. Clone the repository
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone git@gitlab.com:xmachin-es/xmachines-js.git
|
|
37
|
+
cd xmachines-js
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### 2. Install dependencies
|
|
41
|
+
|
|
42
|
+
Always use `pnpm install --frozen-lockfile` (not `pnpm install`) to respect the lockfile exactly:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
corepack enable
|
|
46
|
+
pnpm install --frozen-lockfile
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This installs the exact versions recorded in the lockfile for all workspace packages.
|
|
50
|
+
|
|
51
|
+
#### 3. Build all packages
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pnpm run build
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The root `tsc --build` command uses TypeScript project references to compile all packages in correct dependency order. Build outputs go to each package's `dist/` directory (gitignored).
|
|
58
|
+
|
|
59
|
+
### First Run
|
|
60
|
+
|
|
61
|
+
Verify your setup is working end-to-end:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm test
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
All tests should pass on a freshly cloned and built repository. If they do, your environment is correctly configured.
|
|
68
|
+
|
|
69
|
+
### Dev Container (Optional)
|
|
70
|
+
|
|
71
|
+
A fully configured dev container is provided at `.devcontainer/`. It uses Docker Compose with a Node 22 Bookworm base image and includes Docker-outside-of-Docker, Claude Code, and OpenCode pre-installed.
|
|
72
|
+
|
|
73
|
+
**VS Code:** Open the repository and choose **Reopen in Container** when prompted.
|
|
74
|
+
|
|
75
|
+
**CLI:**
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pnpm run devcontainer:up
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
To customize the container, copy the sample env file:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
cp .devcontainer/.env.sample .devcontainer/.env
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Available variables:
|
|
88
|
+
|
|
89
|
+
| Variable | Default | Description |
|
|
90
|
+
| ----------------------------- | ------- | -------------------------------------------------- |
|
|
91
|
+
| `OPENCODE_EXPERIMENTAL_OXFMT` | `false` | Enables experimental oxfmt inside the opencode UI |
|
|
92
|
+
| `OPENCODE_PORT_MAPPING` | `4096` | Docker port mapping for the opencode web interface |
|
|
93
|
+
|
|
94
|
+
### Common Setup Issues (Monorepo)
|
|
95
|
+
|
|
96
|
+
#### Tests fail with `Cannot find module` errors
|
|
97
|
+
|
|
98
|
+
The test suite relies on TypeScript path aliases that resolve to source files. If aliases are not resolving:
|
|
99
|
+
|
|
100
|
+
1. Run `pnpm run build` first — some packages need their `dist/` present even in development.
|
|
101
|
+
2. Confirm your package's `vitest.config.ts` uses `defineXmVitestConfig` from `@xmachines/shared/vitest`, which automatically configures the `@xmachines/*` path aliases.
|
|
102
|
+
|
|
103
|
+
#### TypeScript errors about missing types after adding a dependency
|
|
12
104
|
|
|
13
|
-
|
|
105
|
+
Run `pnpm install --frozen-lockfile` again to ensure all types are installed. If you added a workspace-local dependency, also add the correct `references` entry in the package's `tsconfig.base.json`.
|
|
14
106
|
|
|
15
|
-
|
|
107
|
+
#### Lint errors about import extensions
|
|
16
108
|
|
|
17
|
-
|
|
18
|
-
- Catch navigation errors and state bugs at compile time
|
|
19
|
-
- Zod validation for UI schemas and state structures
|
|
109
|
+
All TypeScript imports must end with `.js`, even for `.ts` source files:
|
|
20
110
|
|
|
21
|
-
|
|
111
|
+
```typescript
|
|
112
|
+
// ✅ Correct
|
|
113
|
+
import { PlayError } from "./errors.js";
|
|
114
|
+
|
|
115
|
+
// ❌ Wrong — will fail at runtime
|
|
116
|
+
import { PlayError } from "./errors";
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Your editor's auto-import may omit the extension — fix it manually or configure the editor to add `.js` automatically.
|
|
120
|
+
|
|
121
|
+
#### Build is slow after `git clean`
|
|
122
|
+
|
|
123
|
+
TypeScript incremental builds depend on `.tsbuildinfo` files. After a full clean, these are gone and the initial build will be slower. This is expected.
|
|
22
124
|
|
|
23
|
-
|
|
24
|
-
- Actor model ensures clear message passing patterns
|
|
25
|
-
- Guard enforcement prevents invalid state transitions
|
|
125
|
+
### Next Steps (Contributors)
|
|
26
126
|
|
|
27
|
-
|
|
127
|
+
Once your setup is verified, continue with:
|
|
28
128
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
129
|
+
- **[Architecture](../contributing/architecture.md)** — System design, layers, invariants, and data flow
|
|
130
|
+
- **[Contributing](../../../CONTRIBUTING.md)** — Coding standards, branch conventions, and PR process
|
|
131
|
+
- **[Development](../contributing/development.md)** — Full development lifecycle: build commands, adding packages, commit conventions
|
|
132
|
+
- **[Testing](../contributing/testing.md)** — Vitest setup, test conventions, coverage thresholds, browser tests
|
|
133
|
+
- **[packages/docs/rfc/](../rfc/)** — RFC specifications (read the relevant RFC before implementing any feature)
|
|
32
134
|
|
|
33
|
-
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Application Developer Quickstart
|
|
138
|
+
|
|
139
|
+
This section covers installing XMachines packages into your own application and wiring together a state machine, router adapter, and view renderer.
|
|
34
140
|
|
|
35
|
-
|
|
36
|
-
- `@xmachines/play` foundation works with any infrastructure
|
|
37
|
-
- Mix and match adapters based on your stack
|
|
141
|
+
### Prerequisites
|
|
38
142
|
|
|
39
|
-
|
|
143
|
+
- **Node.js** `>= 22.0.0`
|
|
144
|
+
- **pnpm** via corepack (`corepack enable`)
|
|
145
|
+
- **TypeScript** `>= 5.7` (strict mode recommended)
|
|
146
|
+
- **XState** `v5` (required peer dependency for [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md))
|
|
147
|
+
|
|
148
|
+
All packages are ES modules (`"type": "module"`). Use `.js` extensions in all TypeScript imports.
|
|
40
149
|
|
|
41
150
|
### Installation
|
|
42
151
|
|
|
43
|
-
|
|
152
|
+
#### Step 1: Install the core packages
|
|
153
|
+
|
|
154
|
+
Every XMachines application needs these three packages plus XState:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
pnpm add xstate @xmachines/play-xstate @xmachines/play-actor @xmachines/play-signals
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
| Package | Role |
|
|
161
|
+
| --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
162
|
+
| `xstate` | XState v5 state machine engine (peer dependency) |
|
|
163
|
+
| [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) | [`definePlayer()`](../api/@xmachines/play-xstate/functions/definePlayer.md), [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md), routing helpers |
|
|
164
|
+
| [`@xmachines/play-actor`](../api/@xmachines/play-actor/README.md) | Abstract actor base class and interface types |
|
|
165
|
+
| [`@xmachines/play-signals`](../api/@xmachines/play-signals/README.md) | TC39 Signals polyfill (`Signal.State`, `Signal.Computed`, [`watchSignal`](../api/@xmachines/play-signals/functions/watchSignal.md)) |
|
|
166
|
+
|
|
167
|
+
#### Step 2: Install a router adapter (pick one)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Provider pattern (framework-integrated routers)
|
|
171
|
+
pnpm add @xmachines/play-tanstack-react-router # TanStack Router (React)
|
|
172
|
+
pnpm add @xmachines/play-tanstack-solid-router # TanStack Router (SolidJS)
|
|
173
|
+
pnpm add @xmachines/play-react-router # React Router v7
|
|
174
|
+
pnpm add @xmachines/play-vue-router # Vue Router 4.x/5.x
|
|
175
|
+
pnpm add @xmachines/play-solid-router # SolidJS Router
|
|
176
|
+
|
|
177
|
+
# connectRouter pattern (framework-agnostic)
|
|
178
|
+
pnpm add @xmachines/play-dom-router # Vanilla DOM (Browser History API)
|
|
179
|
+
pnpm add @xmachines/play-sveltekit-router # SvelteKit
|
|
180
|
+
pnpm add @xmachines/play-svelte-spa-router # Svelte SPA Router
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Step 3: Install a view renderer (pick one)
|
|
44
184
|
|
|
45
185
|
```bash
|
|
46
|
-
|
|
186
|
+
pnpm add @xmachines/play-react # React 18/19
|
|
187
|
+
pnpm add @xmachines/play-vue # Vue 3
|
|
188
|
+
pnpm add @xmachines/play-solid # SolidJS
|
|
189
|
+
pnpm add @xmachines/play-svelte # Svelte 5
|
|
190
|
+
pnpm add @xmachines/play-dom # Vanilla DOM
|
|
47
191
|
```
|
|
48
192
|
|
|
49
|
-
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### Core Actor (No Router, No Renderer)
|
|
196
|
+
|
|
197
|
+
The minimum viable XMachines actor — no framework dependencies:
|
|
50
198
|
|
|
51
199
|
```typescript
|
|
52
|
-
import {
|
|
200
|
+
import { setup } from "xstate";
|
|
201
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
202
|
+
|
|
203
|
+
// 1. Declare types with setup() — the XState v5 typed entry point
|
|
204
|
+
const appSetup = setup({
|
|
205
|
+
types: {
|
|
206
|
+
context: {} as { count: number },
|
|
207
|
+
events: {} as { type: "toggle" },
|
|
208
|
+
input: {} as undefined,
|
|
209
|
+
},
|
|
210
|
+
});
|
|
53
211
|
|
|
54
|
-
//
|
|
55
|
-
const
|
|
56
|
-
id: "
|
|
57
|
-
initial: "
|
|
212
|
+
// 2. Create the machine using setup().createMachine()
|
|
213
|
+
const machine = appSetup.createMachine({
|
|
214
|
+
id: "app",
|
|
215
|
+
initial: "off",
|
|
216
|
+
context: { count: 0 },
|
|
58
217
|
states: {
|
|
59
|
-
|
|
60
|
-
on: {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
218
|
+
off: {
|
|
219
|
+
on: {
|
|
220
|
+
toggle: {
|
|
221
|
+
target: "on",
|
|
222
|
+
actions: appSetup.assign({ count: ({ context }) => context.count + 1 }),
|
|
223
|
+
},
|
|
224
|
+
},
|
|
64
225
|
},
|
|
65
|
-
|
|
66
|
-
on: {
|
|
226
|
+
on: {
|
|
227
|
+
on: {
|
|
228
|
+
toggle: {
|
|
229
|
+
target: "off",
|
|
230
|
+
actions: appSetup.assign({ count: ({ context }) => context.count + 1 }),
|
|
231
|
+
},
|
|
232
|
+
},
|
|
67
233
|
},
|
|
68
234
|
},
|
|
69
235
|
});
|
|
236
|
+
|
|
237
|
+
// 3. Create a player factory
|
|
238
|
+
const createPlayer = definePlayer({ machine });
|
|
239
|
+
|
|
240
|
+
// 4. Create and start an actor
|
|
241
|
+
const actor = createPlayer();
|
|
242
|
+
actor.start();
|
|
243
|
+
|
|
244
|
+
// 5. Read state
|
|
245
|
+
console.log(actor.getSnapshot().value); // "off"
|
|
246
|
+
console.log(actor.state.get().value); // "off" (TC39 Signal)
|
|
247
|
+
|
|
248
|
+
// 6. Send events — the machine's guards decide all transitions
|
|
249
|
+
actor.send({ type: "toggle" });
|
|
250
|
+
console.log(actor.getSnapshot().value); // "on"
|
|
251
|
+
|
|
252
|
+
// 7. Cleanup
|
|
253
|
+
actor.stop();
|
|
70
254
|
```
|
|
71
255
|
|
|
72
|
-
|
|
256
|
+
**Key rules:**
|
|
257
|
+
|
|
258
|
+
- Always use `setup({ types })` before `createMachine` — never bare `createMachine` from xstate.
|
|
259
|
+
- Use `setup.assign(...)` for context mutations — not the bare `assign` from xstate.
|
|
260
|
+
- Call `actor.start()` before sending events.
|
|
261
|
+
- Call `actor.stop()` when done to clean up signal subscriptions.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
### Adding Routing
|
|
266
|
+
|
|
267
|
+
State machines control navigation through `meta.route` on states and `play.route` events. The router is passive infrastructure that observes `actor.currentRoute`.
|
|
268
|
+
|
|
269
|
+
#### Define a routable machine with `formatPlayRouteTransitions`
|
|
270
|
+
|
|
271
|
+
[`formatPlayRouteTransitions`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md) auto-generates `play.route` handlers from `id` + `meta.route` state pairs:
|
|
73
272
|
|
|
74
273
|
```typescript
|
|
75
|
-
import {
|
|
274
|
+
import { setup } from "xstate";
|
|
275
|
+
import { definePlayer, formatPlayRouteTransitions } from "@xmachines/play-xstate";
|
|
276
|
+
import type { PlayRouteEvent } from "@xmachines/play-router";
|
|
277
|
+
|
|
278
|
+
const appSetup = setup({
|
|
279
|
+
types: {
|
|
280
|
+
// params and query are REQUIRED for formatPlayRouteTransitions
|
|
281
|
+
context: {} as {
|
|
282
|
+
isAuthenticated: boolean;
|
|
283
|
+
params: Record<string, string>;
|
|
284
|
+
query: Record<string, string>;
|
|
285
|
+
},
|
|
286
|
+
events: {} as
|
|
287
|
+
PlayRouteEvent | { type: "auth.login"; username: string } | { type: "auth.logout" },
|
|
288
|
+
input: {} as undefined,
|
|
289
|
+
},
|
|
290
|
+
});
|
|
76
291
|
|
|
77
|
-
|
|
78
|
-
|
|
292
|
+
const appMachine = appSetup.createMachine(
|
|
293
|
+
// formatPlayRouteTransitions auto-generates play.route handlers from id + meta.route pairs
|
|
294
|
+
formatPlayRouteTransitions({
|
|
295
|
+
id: "app",
|
|
296
|
+
initial: "home",
|
|
297
|
+
context: { isAuthenticated: false, params: {}, query: {} },
|
|
298
|
+
states: {
|
|
299
|
+
home: { id: "home", meta: { route: "/" } },
|
|
300
|
+
about: { id: "about", meta: { route: "/about" } },
|
|
301
|
+
login: { id: "login", meta: { route: "/login" } },
|
|
302
|
+
dashboard: {
|
|
303
|
+
id: "dashboard",
|
|
304
|
+
meta: { route: "/dashboard" },
|
|
305
|
+
// always guard: redirect to /login if not authenticated
|
|
306
|
+
always: {
|
|
307
|
+
guard: ({ context }) => !context.isAuthenticated,
|
|
308
|
+
target: "login",
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
profile: { id: "profile", meta: { route: "/profile/:username" } },
|
|
312
|
+
},
|
|
313
|
+
on: {
|
|
314
|
+
"auth.login": {
|
|
315
|
+
target: ".dashboard",
|
|
316
|
+
guard: ({ context }) => !context.isAuthenticated,
|
|
317
|
+
actions: appSetup.assign({
|
|
318
|
+
isAuthenticated: true,
|
|
319
|
+
}),
|
|
320
|
+
},
|
|
321
|
+
"auth.logout": {
|
|
322
|
+
target: ".home",
|
|
323
|
+
guard: ({ context }) => context.isAuthenticated,
|
|
324
|
+
actions: appSetup.assign({ isAuthenticated: false }),
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
}),
|
|
328
|
+
);
|
|
79
329
|
|
|
80
|
-
|
|
330
|
+
const createPlayer = definePlayer({ machine: appMachine });
|
|
331
|
+
const actor = createPlayer();
|
|
81
332
|
actor.start();
|
|
82
333
|
|
|
83
|
-
//
|
|
84
|
-
console.log(actor.
|
|
334
|
+
// Read the current route via TC39 Signal
|
|
335
|
+
console.log(actor.currentRoute.get()); // "/"
|
|
336
|
+
|
|
337
|
+
// Navigate — actor guards validate the transition
|
|
338
|
+
actor.send({ type: "play.route", to: "#about" });
|
|
339
|
+
console.log(actor.currentRoute.get()); // "/about"
|
|
340
|
+
|
|
341
|
+
// Attempt a protected route — always guard redirects to login
|
|
342
|
+
actor.send({ type: "play.route", to: "#dashboard" });
|
|
343
|
+
console.log(actor.getSnapshot().value); // "login" (guard fired)
|
|
85
344
|
|
|
86
|
-
//
|
|
87
|
-
actor.send({ type: "
|
|
88
|
-
|
|
345
|
+
// Navigate with params
|
|
346
|
+
actor.send({ type: "auth.login", username: "alice" });
|
|
347
|
+
actor.send({ type: "play.route", to: "#profile", params: { username: "alice" } });
|
|
348
|
+
console.log(actor.currentRoute.get()); // "/profile/alice"
|
|
89
349
|
|
|
90
|
-
actor.
|
|
91
|
-
console.log(actor.getSnapshot().value); // "yellow"
|
|
350
|
+
actor.stop();
|
|
92
351
|
```
|
|
93
352
|
|
|
94
|
-
|
|
353
|
+
**Routing rules:**
|
|
95
354
|
|
|
96
|
-
|
|
97
|
-
|
|
355
|
+
- Every routable state **must** have an `id` — [`formatPlayRouteTransitions`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md) throws `MissingStateIdError` if absent.
|
|
356
|
+
- Send `play.route` events with `to: "#stateId"` — always use the `id` field prefixed with `#`, never raw URL paths.
|
|
357
|
+
- The machine context **must** include `params: Record<string, string>` and `query: Record<string, string>`.
|
|
358
|
+
- Use `always` guards to protect states from direct URL access — these fire even on browser back/forward.
|
|
98
359
|
|
|
99
|
-
|
|
100
|
-
const currentState = signal(actor.getSnapshot().value);
|
|
360
|
+
---
|
|
101
361
|
|
|
102
|
-
|
|
103
|
-
actor.subscribe((snapshot) => {
|
|
104
|
-
currentState.value = snapshot.value;
|
|
105
|
-
});
|
|
362
|
+
### Connecting a Router Adapter
|
|
106
363
|
|
|
107
|
-
|
|
108
|
-
const canProceed = computed(() => currentState.value === "green");
|
|
364
|
+
Router adapters synchronize `actor.currentRoute` with the browser URL bidirectionally. There are two integration patterns:
|
|
109
365
|
|
|
110
|
-
|
|
366
|
+
#### Pattern 1: Provider pattern (React, Vue, SolidJS)
|
|
367
|
+
|
|
368
|
+
Used with framework-integrated routers like TanStack Router. All three props (`actor`, `router`, `routeMap`) **must be stable references** — construct them outside JSX or memoize them.
|
|
369
|
+
|
|
370
|
+
```tsx
|
|
371
|
+
// React + TanStack Router example
|
|
372
|
+
import { useMemo, useEffect } from "react";
|
|
373
|
+
import { createRouter, createRootRoute } from "@tanstack/react-router";
|
|
374
|
+
import {
|
|
375
|
+
PlayRouterProvider,
|
|
376
|
+
extractMachineRoutes,
|
|
377
|
+
createRouteMapFromTree,
|
|
378
|
+
} from "@xmachines/play-tanstack-react-router";
|
|
379
|
+
|
|
380
|
+
// Build OUTSIDE of JSX — must be stable references
|
|
381
|
+
const routeTree = extractMachineRoutes(appMachine);
|
|
382
|
+
const routeMap = createRouteMapFromTree(routeTree);
|
|
383
|
+
const router = createRouter({ routeTree: createRootRoute() });
|
|
384
|
+
|
|
385
|
+
// Actor also created outside the component (or memoized inside)
|
|
386
|
+
const actor = createPlayer();
|
|
387
|
+
actor.start();
|
|
388
|
+
|
|
389
|
+
export function App() {
|
|
390
|
+
return (
|
|
391
|
+
<PlayRouterProvider
|
|
392
|
+
actor={actor}
|
|
393
|
+
router={router}
|
|
394
|
+
routeMap={routeMap}
|
|
395
|
+
renderer={(currentActor, currentRouter) => (
|
|
396
|
+
// Your shell/layout component here
|
|
397
|
+
<Shell actor={currentActor} />
|
|
398
|
+
)}
|
|
399
|
+
/>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
111
402
|
```
|
|
112
403
|
|
|
113
|
-
|
|
404
|
+
#### Pattern 2: `connectRouter` pattern (Vanilla DOM, SvelteKit, Svelte)
|
|
114
405
|
|
|
115
|
-
|
|
406
|
+
Used with framework-agnostic or server-rendered routers. `connectRouter` handles bidirectional sync: `actor.currentRoute` signal → browser URL, and browser URL changes → `play.route` events sent to the actor.
|
|
116
407
|
|
|
117
408
|
```typescript
|
|
118
|
-
import {
|
|
119
|
-
import {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
409
|
+
import { createBrowserHistory, createRouter, connectRouter } from "@xmachines/play-dom-router";
|
|
410
|
+
import { extractMachineRoutes, createRouteMapFromTree } from "@xmachines/play-router";
|
|
411
|
+
|
|
412
|
+
const routeTree = extractMachineRoutes(appMachine);
|
|
413
|
+
const routeMap = createRouteMapFromTree(routeTree);
|
|
414
|
+
const history = createBrowserHistory({ window });
|
|
415
|
+
const router = createRouter({ routeTree, history });
|
|
416
|
+
|
|
417
|
+
const actor = createPlayer();
|
|
418
|
+
actor.start();
|
|
419
|
+
|
|
420
|
+
const disconnectRouter = connectRouter({ actor, router, routeMap });
|
|
421
|
+
|
|
422
|
+
// Cleanup on unload
|
|
423
|
+
window.addEventListener("beforeunload", () => {
|
|
424
|
+
disconnectRouter();
|
|
425
|
+
router.destroy();
|
|
426
|
+
actor.stop();
|
|
427
|
+
});
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### Connecting a View Renderer
|
|
433
|
+
|
|
434
|
+
View renderers map `meta.view` specs from your machine states to real UI components. Each framework package exports a `defineRegistry` function that binds components and actions to a catalog.
|
|
435
|
+
|
|
436
|
+
#### React
|
|
437
|
+
|
|
438
|
+
```tsx
|
|
439
|
+
import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-react";
|
|
440
|
+
import { defineCatalog } from "@xmachines/json-render-core";
|
|
441
|
+
import { schema } from "@xmachines/play-react";
|
|
442
|
+
import { z } from "zod";
|
|
443
|
+
|
|
444
|
+
const catalog = defineCatalog(schema, {
|
|
445
|
+
components: {
|
|
446
|
+
Home: { props: z.object({ title: z.string() }) },
|
|
447
|
+
Login: { props: z.object({}) },
|
|
448
|
+
},
|
|
449
|
+
actions: {
|
|
450
|
+
login: { params: z.object({ username: z.string() }) },
|
|
451
|
+
logout: {},
|
|
452
|
+
},
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
const registryResult = defineRegistry(catalog, {
|
|
456
|
+
components: {
|
|
457
|
+
Home: ({ props }) => <section>{props.title}</section>,
|
|
458
|
+
Login: ({ on }) => <button onClick={() => on("submit").emit()}>Log in</button>,
|
|
459
|
+
},
|
|
460
|
+
actions: {
|
|
461
|
+
login: async ({ username }) => actor.send({ type: "auth.login", username }),
|
|
462
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
463
|
+
},
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
function App() {
|
|
467
|
+
return (
|
|
468
|
+
<PlayUIProvider actor={actor} registryResult={registryResult}>
|
|
469
|
+
<PlayRenderer />
|
|
470
|
+
</PlayUIProvider>
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
#### Vue 3
|
|
476
|
+
|
|
477
|
+
```html
|
|
478
|
+
<!-- App.vue -->
|
|
479
|
+
<template>
|
|
480
|
+
<PlayUIProvider :actor="actor" :registry-result="registryResult">
|
|
481
|
+
<PlayRenderer />
|
|
482
|
+
</PlayUIProvider>
|
|
483
|
+
</template>
|
|
484
|
+
|
|
485
|
+
<script setup lang="ts">
|
|
486
|
+
import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-vue";
|
|
487
|
+
import { defineCatalog } from "@xmachines/json-render-core";
|
|
488
|
+
import { schema } from "@xmachines/play-vue";
|
|
489
|
+
import { z } from "zod";
|
|
490
|
+
|
|
491
|
+
const catalog = defineCatalog(schema, {
|
|
492
|
+
components: {
|
|
493
|
+
Home: { props: z.object({ title: z.string() }) },
|
|
494
|
+
Login: { props: z.object({}) },
|
|
129
495
|
},
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
on: {
|
|
141
|
-
TOGGLE: {
|
|
142
|
-
target: "inactive",
|
|
143
|
-
actions: "incrementCount",
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
496
|
+
actions: {
|
|
497
|
+
login: { params: z.object({ username: z.string() }) },
|
|
498
|
+
logout: {},
|
|
499
|
+
},
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
const registryResult = defineRegistry(catalog, {
|
|
503
|
+
components: {
|
|
504
|
+
Home: { template: `<section>{{ props.title }}</section>` },
|
|
505
|
+
Login: { template: `<button @click="on('submit').emit()">Log in</button>` },
|
|
147
506
|
},
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
507
|
actions: {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}),
|
|
508
|
+
login: async ({ username }) => actor.send({ type: "auth.login", username }),
|
|
509
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
154
510
|
},
|
|
511
|
+
});
|
|
512
|
+
</script>
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
#### SolidJS
|
|
516
|
+
|
|
517
|
+
```tsx
|
|
518
|
+
import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-solid";
|
|
519
|
+
import { defineCatalog } from "@xmachines/json-render-core";
|
|
520
|
+
import { schema } from "@xmachines/play-solid";
|
|
521
|
+
import { z } from "zod";
|
|
522
|
+
|
|
523
|
+
const catalog = defineCatalog(schema, {
|
|
524
|
+
components: {
|
|
525
|
+
Home: { props: z.object({ title: z.string() }) },
|
|
526
|
+
Login: { props: z.object({}) },
|
|
155
527
|
},
|
|
156
|
-
|
|
528
|
+
actions: {
|
|
529
|
+
login: { params: z.object({ username: z.string() }) },
|
|
530
|
+
logout: {},
|
|
531
|
+
},
|
|
532
|
+
});
|
|
157
533
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
534
|
+
const registryResult = defineRegistry(catalog, {
|
|
535
|
+
components: {
|
|
536
|
+
Home: ({ props }) => <section>{props.title}</section>,
|
|
537
|
+
Login: ({ on }) => <button onClick={() => on("submit").emit()}>Log in</button>,
|
|
538
|
+
},
|
|
539
|
+
actions: {
|
|
540
|
+
login: async ({ username }) => actor.send({ type: "auth.login", username }),
|
|
541
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
542
|
+
},
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
function App() {
|
|
546
|
+
return (
|
|
547
|
+
<PlayUIProvider actor={actor} registryResult={registryResult}>
|
|
548
|
+
<PlayRenderer />
|
|
549
|
+
</PlayUIProvider>
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
```
|
|
161
553
|
|
|
162
|
-
|
|
163
|
-
const state = signal(toggleActor.getSnapshot());
|
|
554
|
+
#### Vanilla DOM
|
|
164
555
|
|
|
165
|
-
|
|
166
|
-
|
|
556
|
+
```typescript
|
|
557
|
+
import { createPlayUI, defineRegistry, schema } from "@xmachines/play-dom";
|
|
558
|
+
import { defineCatalog } from "@xmachines/json-render-core";
|
|
559
|
+
import { z } from "zod";
|
|
560
|
+
import type { ComponentFn } from "@xmachines/play-dom";
|
|
561
|
+
|
|
562
|
+
const catalog = defineCatalog(schema, {
|
|
563
|
+
components: {
|
|
564
|
+
Home: { props: z.object({ title: z.string() }) },
|
|
565
|
+
Login: { props: z.object({}) },
|
|
566
|
+
},
|
|
567
|
+
actions: {
|
|
568
|
+
login: { params: z.object({ username: z.string() }) },
|
|
569
|
+
logout: {},
|
|
570
|
+
},
|
|
167
571
|
});
|
|
168
572
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
573
|
+
const Home: ComponentFn<typeof catalog, "Home"> = ({ props }) => {
|
|
574
|
+
const el = document.createElement("section");
|
|
575
|
+
el.textContent = props.title;
|
|
576
|
+
return el;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
const Login: ComponentFn<typeof catalog, "Login"> = ({ on }) => {
|
|
580
|
+
const el = document.createElement("div");
|
|
581
|
+
const btn = document.createElement("button");
|
|
582
|
+
btn.textContent = "Log in";
|
|
583
|
+
btn.addEventListener("click", () => on("submit").emit());
|
|
584
|
+
el.append(btn);
|
|
585
|
+
return el;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const registryResult = defineRegistry(catalog, {
|
|
589
|
+
components: { Home, Login },
|
|
590
|
+
actions: {
|
|
591
|
+
login: async ({ username }) => actor.send({ type: "auth.login", username }),
|
|
592
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
593
|
+
},
|
|
594
|
+
});
|
|
595
|
+
|
|
596
|
+
const mount = createPlayUI(registryResult);
|
|
597
|
+
const disconnect = mount(actor, document.getElementById("app")!);
|
|
598
|
+
|
|
599
|
+
window.addEventListener("beforeunload", () => disconnect());
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
---
|
|
603
|
+
|
|
604
|
+
### Common Setup Issues (Application Developers)
|
|
605
|
+
|
|
606
|
+
#### Query parameters missing from derived URLs
|
|
607
|
+
|
|
608
|
+
**Symptom:** `currentRoute` renders the path but the `?query=...` string from a
|
|
609
|
+
`play.route` event never appears. No error is raised — a context without a
|
|
610
|
+
`query` field builds a query-less URL, exactly like `query: {}`.
|
|
173
611
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
612
|
+
**Fix:** With [`formatPlayRouteTransitions`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md)
|
|
613
|
+
nothing is needed — the generated transitions assign `event.query` to context
|
|
614
|
+
on every navigation. A machine that handles `play.route` by hand must do that
|
|
615
|
+
assignment itself:
|
|
616
|
+
|
|
617
|
+
```typescript
|
|
618
|
+
on: {
|
|
619
|
+
"play.route": {
|
|
620
|
+
actions: assign({
|
|
621
|
+
params: ({ event }) => event.params ?? {},
|
|
622
|
+
query: ({ event }) => event.query ?? {},
|
|
623
|
+
}),
|
|
624
|
+
},
|
|
625
|
+
}
|
|
177
626
|
```
|
|
178
627
|
|
|
179
|
-
|
|
628
|
+
(Older releases threw `MissingQueryContextError` at construction for a
|
|
629
|
+
routing-aware context without a `query` field; the error class remains
|
|
630
|
+
exported for `instanceof` compatibility but is never thrown.)
|
|
180
631
|
|
|
181
|
-
|
|
632
|
+
#### Missing `id` on routable states
|
|
182
633
|
|
|
183
|
-
**
|
|
634
|
+
**Error:** `MissingStateIdError: State "home" has meta.route "/" but no id`.
|
|
184
635
|
|
|
185
|
-
**
|
|
636
|
+
**Fix:** Every state with `meta.route` must declare an explicit `id`:
|
|
186
637
|
|
|
187
|
-
|
|
638
|
+
```typescript
|
|
639
|
+
// ❌ Missing id
|
|
640
|
+
home: { meta: { route: "/" } }
|
|
188
641
|
|
|
189
|
-
|
|
642
|
+
// ✅ Correct
|
|
643
|
+
home: { id: "home", meta: { route: "/" } }
|
|
644
|
+
```
|
|
190
645
|
|
|
191
|
-
|
|
646
|
+
#### Actor sends events before `start()`
|
|
192
647
|
|
|
193
|
-
**
|
|
648
|
+
**Symptom:** Events are silently dropped; state never changes.
|
|
194
649
|
|
|
195
|
-
|
|
650
|
+
**Fix:** Always call `actor.start()` before `actor.send()`:
|
|
196
651
|
|
|
197
|
-
|
|
652
|
+
```typescript
|
|
653
|
+
const actor = createPlayer();
|
|
654
|
+
actor.start(); // required before any send()
|
|
655
|
+
actor.send({ type: "toggle" });
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
#### `routeMap` or `actor` recreated on every render (React/SolidJS)
|
|
198
659
|
|
|
199
|
-
**
|
|
660
|
+
**Symptom:** The router bridge disconnects and reconnects on every render.
|
|
200
661
|
|
|
201
|
-
|
|
202
|
-
- [Package Overview](/docs/api/guides/package-overview) - Choose the right packages for your needs
|
|
203
|
-
- [API Reference](/docs/api/xmachines/play/readme) - Detailed API documentation
|
|
662
|
+
**Fix:** Construct stable references outside JSX or memoize them:
|
|
204
663
|
|
|
205
|
-
|
|
664
|
+
```typescript
|
|
665
|
+
// ✅ Built outside the component
|
|
666
|
+
const routeTree = extractMachineRoutes(appMachine);
|
|
667
|
+
const routeMap = createRouteMapFromTree(routeTree);
|
|
206
668
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
669
|
+
// ✅ Or memoized inside the component (React)
|
|
670
|
+
const routeMap = useMemo(() => createRouteMapFromTree(routeTree), [routeTree]);
|
|
671
|
+
```
|
|
210
672
|
|
|
211
|
-
|
|
673
|
+
#### Wrong Node.js version
|
|
212
674
|
|
|
213
|
-
|
|
214
|
-
- Working dashboard demo (coming soon)
|
|
675
|
+
**Error:** `SyntaxError: Cannot use import statement in a module` or TC39 Signals not available.
|
|
215
676
|
|
|
216
|
-
**
|
|
677
|
+
**Fix:** Use Node.js `>= 22.0.0`. Check with:
|
|
217
678
|
|
|
218
|
-
|
|
219
|
-
|
|
679
|
+
```bash
|
|
680
|
+
node --version
|
|
681
|
+
```
|
|
220
682
|
|
|
221
683
|
---
|
|
222
684
|
|
|
223
|
-
|
|
685
|
+
## Key Concepts Reference
|
|
686
|
+
|
|
687
|
+
| Term | Description |
|
|
688
|
+
| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
689
|
+
| `setup({ types })` | XState v5 entry point — declares TypeScript types for context, events, and input |
|
|
690
|
+
| [`definePlayer({ machine })`](../api/@xmachines/play-xstate/functions/definePlayer.md) | Creates a factory that produces [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md) instances |
|
|
691
|
+
| `actor.start()` | Activates the machine — always call before sending events |
|
|
692
|
+
| `actor.send({ type })` | Sends an event; machine guards decide whether a transition occurs |
|
|
693
|
+
| `actor.getSnapshot()` | Synchronous read of current state and context |
|
|
694
|
+
| `actor.state` | `Signal.State<Snapshot>` — TC39 Signal for reactive state observation |
|
|
695
|
+
| `actor.currentRoute` | `Signal.Computed<string \| null>` — resolved URL from active state's `meta.route` |
|
|
696
|
+
| `actor.currentView` | `Signal.State<PlaySpec \| null>` — view spec from active state's `meta.view` |
|
|
697
|
+
| [`formatPlayRouteTransitions`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md) | Generates `play.route` handlers from `id` + `meta.route` state pairs |
|
|
698
|
+
| `play.route` event | Navigation event — `to: "#stateId"`, optional `params`, `query` |
|
|
699
|
+
| `always` guard | Protects states — fires on entry before any event, even on direct URL access |
|
|
700
|
+
| [`extractMachineRoutes`](../api/@xmachines/play-router/functions/extractMachineRoutes.md) | Extracts a `RouteTree` from a state machine — used by framework-integrated router adapters |
|
|
701
|
+
| [`createRouteMapFromTree`](../api/@xmachines/play-router/functions/createRouteMapFromTree.md) | Builds a `RouteMap` from a `RouteTree` for bidirectional state ID ↔ URL lookups |
|
|
702
|
+
| [`connectRouter`](../api/@xmachines/play-dom-router/functions/connectRouter.md) | Connects a vanilla DOM router to an actor — returns a disconnect cleanup function |
|
|
703
|
+
| [`PlayRouterProvider`](../api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md) | React component that connects a `PlayerActor` to TanStack React Router |
|
|
704
|
+
|
|
705
|
+
---
|
|
706
|
+
|
|
707
|
+
## Next Steps
|
|
708
|
+
|
|
709
|
+
- **[Architecture](../contributing/architecture.md)** — System design, layers, invariants, and data flow
|
|
710
|
+
- **[Play RFC](../rfc/play.md)** — Complete architectural specification
|
|
711
|
+
- **[API Reference](../api/README.md)** — Auto-generated API docs for all packages
|
|
712
|
+
- **[Examples](../examples/)** — Basic state machine, form validation, routing pattern demos
|
|
713
|
+
- **[Contributing](../../../CONTRIBUTING.md)** — Coding standards, branch conventions, and PR process (contributors)
|