@xmachines/docs 1.0.0-beta.9 → 1.0.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 +137 -7
- package/api/@xmachines/play/README.md +160 -38
- 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 +141 -160
- package/api/@xmachines/play-actor/classes/AbstractActor.md +91 -122
- 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 +384 -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 +271 -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 -334
- 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 -114
- 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 -353
- 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 +116 -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 -234
- 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 -560
- 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 +84 -115
- 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 +269 -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 +199 -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 +211 -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 -126
- 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 +58 -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 +215 -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 +192 -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 -487
- 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 +178 -347
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +161 -191
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +31 -20
- package/api/@xmachines/play-xstate/functions/composeGuards.md +2 -2
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +2 -2
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +38 -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 +2 -2
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +3 -3
- package/api/@xmachines/play-xstate/functions/hasContext.md +2 -2
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +2 -2
- package/api/@xmachines/play-xstate/functions/negateGuard.md +2 -2
- 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 +12 -13
- 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 +2 -2
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +3 -3
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +10 -9
- 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 +30 -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 +599 -0
- package/contributing/configuration.md +368 -0
- package/contributing/deployment.md +312 -0
- package/contributing/development.md +464 -0
- package/contributing/testing.md +453 -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 +24 -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 +15 -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 +18 -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 +15 -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 +17 -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 +75 -31
- package/examples/form-validation.md +261 -118
- package/examples/multi-router-integration.md +314 -194
- package/examples/routing-patterns.md +230 -189
- package/examples/traffic-light.md +114 -65
- package/guides/README.md +9 -21
- package/guides/actor-model.md +180 -0
- package/guides/getting-started.md +619 -137
- package/guides/signals.md +166 -0
- package/guides/state-machines.md +284 -0
- package/package.json +18 -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,99 +1,148 @@
|
|
|
1
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
2
|
+
|
|
1
3
|
# Traffic Light State Machine
|
|
2
4
|
|
|
3
|
-
Multi-state machine with
|
|
5
|
+
Multi-state machine with `meta.route` on every state, demonstrating cyclic transitions and `formatPlayRouteTransitions`.
|
|
4
6
|
|
|
5
7
|
## Use Case
|
|
6
8
|
|
|
7
|
-
This example models a traffic light with a red → green → yellow → red cycle.
|
|
9
|
+
This example models a traffic light with a red → green → yellow → red cycle. Because traffic lights map naturally to URLs (each light colour is a distinct page in a web app), it is a good vehicle for showing how `meta.route` and `formatPlayRouteTransitions` work together.
|
|
10
|
+
|
|
11
|
+
Applicable patterns:
|
|
8
12
|
|
|
9
13
|
- Traffic light controllers
|
|
10
14
|
- Multi-step workflows with repeating cycles
|
|
11
|
-
-
|
|
12
|
-
-
|
|
15
|
+
- Tab or wizard navigation where each step has a URL
|
|
16
|
+
- Game state loops with distinct URL states
|
|
13
17
|
|
|
14
18
|
## Complete Code
|
|
15
19
|
|
|
16
20
|
```typescript
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const trafficMachine = createMachine<TrafficState, TrafficEvent>({
|
|
27
|
-
id: "traffic",
|
|
28
|
-
initial: "red",
|
|
29
|
-
states: {
|
|
30
|
-
red: {
|
|
31
|
-
on: {
|
|
32
|
-
TIMER: "green",
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
green: {
|
|
36
|
-
on: {
|
|
37
|
-
TIMER: "yellow",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
yellow: {
|
|
41
|
-
on: {
|
|
42
|
-
TIMER: "red",
|
|
43
|
-
},
|
|
21
|
+
import { setup } from "xstate";
|
|
22
|
+
import { definePlayer, formatPlayRouteTransitions } from "@xmachines/play-xstate";
|
|
23
|
+
|
|
24
|
+
// 1. Typed setup
|
|
25
|
+
const trafficSetup = setup({
|
|
26
|
+
types: {
|
|
27
|
+
context: {} as {
|
|
28
|
+
params: Record<string, string>;
|
|
29
|
+
query: Record<string, string>;
|
|
44
30
|
},
|
|
31
|
+
events: {} as
|
|
32
|
+
| { type: "timer" }
|
|
33
|
+
| {
|
|
34
|
+
type: "play.route";
|
|
35
|
+
to: string;
|
|
36
|
+
params?: Record<string, string>;
|
|
37
|
+
query?: Record<string, string>;
|
|
38
|
+
},
|
|
39
|
+
input: {} as undefined,
|
|
45
40
|
},
|
|
46
41
|
});
|
|
47
42
|
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
// 2. Machine with meta.route on every state
|
|
44
|
+
// formatPlayRouteTransitions() reads each state's id + meta.route and
|
|
45
|
+
// auto-generates the root-level play.route event handlers.
|
|
46
|
+
const trafficMachine = trafficSetup.createMachine(
|
|
47
|
+
formatPlayRouteTransitions({
|
|
48
|
+
id: "traffic",
|
|
49
|
+
initial: "red",
|
|
50
|
+
context: {
|
|
51
|
+
params: {},
|
|
52
|
+
query: {},
|
|
53
|
+
},
|
|
54
|
+
states: {
|
|
55
|
+
red: {
|
|
56
|
+
id: "red",
|
|
57
|
+
meta: { route: "/red" },
|
|
58
|
+
on: { timer: "green" },
|
|
59
|
+
},
|
|
60
|
+
green: {
|
|
61
|
+
id: "green",
|
|
62
|
+
meta: { route: "/green" },
|
|
63
|
+
on: { timer: "yellow" },
|
|
64
|
+
},
|
|
65
|
+
yellow: {
|
|
66
|
+
id: "yellow",
|
|
67
|
+
meta: { route: "/yellow" },
|
|
68
|
+
on: { timer: "red" },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
51
73
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
state = trafficMachine.transition(state, { type: "TIMER" });
|
|
55
|
-
console.log(`Light changed to: ${state}`);
|
|
56
|
-
}, 3000); // Change every 3 seconds
|
|
57
|
-
```
|
|
74
|
+
// 3. Player factory
|
|
75
|
+
const createPlayer = definePlayer({ machine: trafficMachine });
|
|
58
76
|
|
|
59
|
-
|
|
77
|
+
// 4. Create and start actor
|
|
78
|
+
const actor = createPlayer();
|
|
79
|
+
actor.start();
|
|
60
80
|
|
|
61
|
-
|
|
81
|
+
// 5. Read current route via signal
|
|
82
|
+
console.log(actor.currentRoute.get()); // "/red"
|
|
62
83
|
|
|
63
|
-
|
|
84
|
+
// 6. Advance with domain events
|
|
85
|
+
actor.send({ type: "timer" });
|
|
86
|
+
console.log(actor.currentRoute.get()); // "/green"
|
|
64
87
|
|
|
65
|
-
|
|
88
|
+
actor.send({ type: "timer" });
|
|
89
|
+
console.log(actor.currentRoute.get()); // "/yellow"
|
|
66
90
|
|
|
67
|
-
|
|
91
|
+
actor.send({ type: "timer" });
|
|
92
|
+
console.log(actor.currentRoute.get()); // "/red"
|
|
68
93
|
|
|
69
|
-
|
|
94
|
+
// 7. Or navigate directly via play.route events (generated by formatPlayRouteTransitions)
|
|
95
|
+
actor.send({ type: "play.route", to: "#green" });
|
|
96
|
+
console.log(actor.currentRoute.get()); // "/green"
|
|
70
97
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
- **Deterministic**: Same sequence of events always produces the same sequence of states
|
|
98
|
+
// 8. Cleanup
|
|
99
|
+
actor.stop();
|
|
100
|
+
```
|
|
75
101
|
|
|
76
|
-
##
|
|
102
|
+
## How `formatPlayRouteTransitions` Works
|
|
77
103
|
|
|
78
|
-
**
|
|
104
|
+
`formatPlayRouteTransitions` crawls every state that has **both** an `id` and a `meta.route`, then generates root-level `play.route` event handlers of the form:
|
|
79
105
|
|
|
80
106
|
```typescript
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
scheduleNext();
|
|
89
|
-
}, timings[state]);
|
|
107
|
+
// Auto-generated by formatPlayRouteTransitions — you don't write this manually:
|
|
108
|
+
on: {
|
|
109
|
+
"play.route": [
|
|
110
|
+
{ target: ".red", guard: ({ event }) => event.to === "#red", reenter: true, actions: assign({ params, query }) },
|
|
111
|
+
{ target: ".green", guard: ({ event }) => event.to === "#green", reenter: true, actions: assign({ params, query }) },
|
|
112
|
+
{ target: ".yellow", guard: ({ event }) => event.to === "#yellow", reenter: true, actions: assign({ params, query }) },
|
|
113
|
+
],
|
|
90
114
|
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Requirements:**
|
|
118
|
+
|
|
119
|
+
- Every routable state must have both `id` (the `#id` navigation target) and `meta.route` (the URL template).
|
|
120
|
+
- The machine's context must include `params` and `query` fields (both `Record<string, string>`), because `formatPlayRouteTransitions` assigns them on every `play.route` transition.
|
|
91
121
|
|
|
92
|
-
|
|
122
|
+
## `actor.currentRoute` Signal
|
|
123
|
+
|
|
124
|
+
`actor.currentRoute` is a `Signal.Computed<string | null>` derived from the active state's `meta.route` template and `context.params`. Route signals let router bridges observe URL changes reactively without polling.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
import { watchSignal } from "@xmachines/play-signals";
|
|
128
|
+
|
|
129
|
+
const unwatch = watchSignal(actor.currentRoute, () => {
|
|
130
|
+
console.log("URL changed to:", actor.currentRoute.get());
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// later...
|
|
134
|
+
unwatch();
|
|
93
135
|
```
|
|
94
136
|
|
|
137
|
+
## Key Concepts
|
|
138
|
+
|
|
139
|
+
- **`meta.route`**: Marks a state as routable. The value is a URL template (e.g. `"/profile/:username"`).
|
|
140
|
+
- **`formatPlayRouteTransitions`**: Utility that auto-generates `play.route` handlers from `id` + `meta.route` pairs. Wrap your machine config before passing to `createMachine`.
|
|
141
|
+
- **`actor.currentRoute`**: TC39 `Signal.Computed` containing the resolved URL for the active state.
|
|
142
|
+
- **`play.route` events**: Navigation events with a `to: "#stateId"` target. Use `to: "#red"` (state ID), not `to: "/red"` (URL path).
|
|
143
|
+
|
|
95
144
|
## Next Steps
|
|
96
145
|
|
|
97
|
-
- **[Form Validation Example](form-validation.md)**
|
|
98
|
-
- **[
|
|
99
|
-
- **[
|
|
146
|
+
- **[Form Validation Example](form-validation.md)** — Context mutations with `setup.assign` and guards
|
|
147
|
+
- **[Routing Patterns](routing-patterns.md)** — Parameter routes, relative routes, and `always` auth guards
|
|
148
|
+
- **[Play RFC](../rfc/play.md)** — Complete architectural specification
|
package/guides/README.md
CHANGED
|
@@ -1,29 +1,17 @@
|
|
|
1
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
2
|
+
|
|
1
3
|
# XMachines Guides
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
User-facing guides for the XMachines Play architecture.
|
|
4
6
|
|
|
5
7
|
## Start Here
|
|
6
8
|
|
|
7
|
-
- [
|
|
8
|
-
- [Examples Index](../examples/README.md) - Runnable and conceptual usage patterns
|
|
9
|
-
|
|
10
|
-
## Router Adapter Guides
|
|
11
|
-
|
|
12
|
-
Use these READMEs for the current RouterBridge-first integrations:
|
|
13
|
-
|
|
14
|
-
- [@xmachines/play-router](../../packages/play-router/README.md) - Route extraction, route maps, and `RouterBridgeBase`
|
|
15
|
-
- [@xmachines/play-tanstack-react-router](../../packages/play-tanstack-react-router/README.md) - TanStack React adapter
|
|
16
|
-
- [@xmachines/play-react-router](../../packages/play-react-router/README.md) - `react-router` v7 data-router adapter
|
|
17
|
-
- [@xmachines/play-tanstack-solid-router](../../packages/play-tanstack-solid-router/README.md) - TanStack Solid adapter
|
|
18
|
-
- [@xmachines/play-solid-router](../../packages/play-solid-router/README.md) - SolidJS Router adapter
|
|
19
|
-
- [@xmachines/play-vue-router](../../packages/play-vue-router/README.md) - Vue Router adapter
|
|
20
|
-
|
|
21
|
-
## Core Runtime Guides
|
|
9
|
+
- **[Getting Started](getting-started.md)** — Installation, first actor, routing, router adapters, and view renderers
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
- [@xmachines/play-react](../../packages/play-react/README.md) - React rendering from actor-driven view state
|
|
25
|
-
- [@xmachines/play-catalog](../../packages/play-catalog/README.md) - Catalog and schema contracts
|
|
11
|
+
## Concepts
|
|
26
12
|
|
|
27
|
-
|
|
13
|
+
Background reading that explains the _why_ behind XMachines design decisions.
|
|
28
14
|
|
|
29
|
-
- [
|
|
15
|
+
- **[Understanding State Machines](state-machines.md)** — What finite state machines are, how `meta.route` and `meta.view` extend them, and why they replace boolean flags and component-level routing logic
|
|
16
|
+
- **[Understanding the Actor Model](actor-model.md)** — The actor/infrastructure split, why the machine has zero framework imports, and how the reset invariant works
|
|
17
|
+
- **[Understanding TC39 Signals](signals.md)** — The three signal primitives (`Signal.State`, `Signal.Computed`, `Signal.subtle.Watcher`), why XMachines uses them instead of observables, and the architectural invariants they enforce
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# Understanding the Actor Model and the Actor/Infrastructure Split
|
|
2
|
+
|
|
3
|
+
XMachines is built around one central design principle: **business logic must never depend on infrastructure**. This page explains what that means, why the split is enforced the way it is, and what concrete responsibilities belong to each side of the boundary.
|
|
4
|
+
|
|
5
|
+
After reading this, you will understand why a state machine in XMachines has no import from React, Vue, or any router — and why that constraint is a feature, not a limitation.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Two roles, one boundary
|
|
10
|
+
|
|
11
|
+
Every XMachines application has exactly two roles:
|
|
12
|
+
|
|
13
|
+
**The Actor** — owns state, guards, routing intent, and view structure. It has zero knowledge of browsers, routing libraries, or UI frameworks.
|
|
14
|
+
|
|
15
|
+
**Infrastructure** — the runtime environment. It reflects actor state into the world and forwards world events to the actor. It has no opinion on whether a transition is valid.
|
|
16
|
+
|
|
17
|
+
The boundary between them is enforced by the signal protocol: the actor exposes `Signal.State` and `Signal.Computed` properties; infrastructure observes them. The actor never calls into infrastructure; infrastructure never mutates actor state directly.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
Actor (business logic)
|
|
21
|
+
│
|
|
22
|
+
│ emits signals: state, currentRoute, currentView
|
|
23
|
+
▼
|
|
24
|
+
Infrastructure (runtime adapters)
|
|
25
|
+
├── Router Bridge — reflects currentRoute into the URL bar
|
|
26
|
+
├── Renderer — renders currentView into framework components
|
|
27
|
+
└── ... (any other observer)
|
|
28
|
+
|
|
29
|
+
Infrastructure → actor: only via actor.send({ type: "..." })
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## What the actor owns
|
|
35
|
+
|
|
36
|
+
An actor in XMachines is a [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md) — a concrete class that extends XState's `Actor` class via [`AbstractActor`](../api/@xmachines/play-actor/classes/AbstractActor.md). It implements three reactive properties:
|
|
37
|
+
|
|
38
|
+
| Property | Type | What it is |
|
|
39
|
+
| -------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
40
|
+
| `actor.state` | `Signal.State<Snapshot>` | Updated on every XState transition. The full machine snapshot. |
|
|
41
|
+
| `actor.currentRoute` | `Signal.Computed<string \| null>` | Derived from the active state node's `meta.route`. |
|
|
42
|
+
| `actor.currentView` | `Signal.State<PlaySpec \| null>` | Updated on each transition. Holds the [`PlaySpec`](../api/@xmachines/play-actor/interfaces/PlaySpec.md) that drives renderers. |
|
|
43
|
+
|
|
44
|
+
All three are set by the actor, never by infrastructure. Infrastructure reads them via signals.
|
|
45
|
+
|
|
46
|
+
The actor also owns:
|
|
47
|
+
|
|
48
|
+
- **Guards** — it decides whether a transition is valid. If a router sends a `play.route` event for a path the actor's guards reject, the actor does not transition. It then emits its current valid route back through `currentRoute`, and the router bridge overwrites the URL to match.
|
|
49
|
+
- **Error states** — structured errors ([`PlayError`](../api/@xmachines/play/classes/PlayError.md)) are part of the actor's state graph, not thrown into the environment.
|
|
50
|
+
- **Initial route** — `actor.initialRoute` is the route the actor starts in. Router adapters use this for initial navigation, not the browser's current URL.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## What infrastructure owns
|
|
55
|
+
|
|
56
|
+
Infrastructure owns everything that touches the environment:
|
|
57
|
+
|
|
58
|
+
- **Pushing URLs**: reading `actor.currentRoute` and calling `history.pushState()` or a router's navigation API.
|
|
59
|
+
- **Forwarding navigation events**: listening to `popstate`, `routeChange`, or equivalent, then calling `actor.send({ type: "play.route", to: path })`.
|
|
60
|
+
- **Rendering**: reading `actor.currentView` and projecting the spec through framework components.
|
|
61
|
+
- **Lifecycle**: connecting on mount, disconnecting on unmount, explicitly cleaning up signal subscriptions.
|
|
62
|
+
|
|
63
|
+
Infrastructure does **not**:
|
|
64
|
+
|
|
65
|
+
- Decide whether a `play.route` event is valid (that is the actor's job via guards).
|
|
66
|
+
- Override the URL to something the actor did not emit.
|
|
67
|
+
- Read `actor.getSnapshot()` to make routing decisions (use `actor.currentRoute` instead).
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## The reset invariant
|
|
72
|
+
|
|
73
|
+
One of the most important behaviors in XMachines falls out directly from this split.
|
|
74
|
+
|
|
75
|
+
If a user navigates directly to `/admin` in the browser but the actor's guards reject that route (because the user is not authenticated), the actor:
|
|
76
|
+
|
|
77
|
+
1. Receives `{ type: "play.route", to: "/admin" }` from the router bridge.
|
|
78
|
+
2. Evaluates its guards. The guard fails.
|
|
79
|
+
3. Does not transition. It remains in its current state (e.g., `/login`).
|
|
80
|
+
4. `actor.currentRoute` still signals `"/login"`.
|
|
81
|
+
5. The router bridge, watching `currentRoute`, calls its `navigateRouter("/login")` method.
|
|
82
|
+
6. The URL bar resets to `/login`.
|
|
83
|
+
|
|
84
|
+
The environment is always made to match actor reality. The router bridge does not need any special "auth guard" logic — the state machine already has it.
|
|
85
|
+
|
|
86
|
+
This is why the invariant is called **State-Driven Reset** in the Play RFC.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## [`AbstractActor`](../api/@xmachines/play-actor/classes/AbstractActor.md) — the enforced contract
|
|
91
|
+
|
|
92
|
+
[`AbstractActor`](../api/@xmachines/play-actor/classes/AbstractActor.md) (from [`@xmachines/play-actor`](../api/@xmachines/play-actor/README.md)) is the abstract base class that all actor implementations must extend. It extends XState's `Actor`, which means:
|
|
93
|
+
|
|
94
|
+
- XState's inspection API works (`@xstate/inspect`)
|
|
95
|
+
- XState DevTools attach to actors normally
|
|
96
|
+
- The full XState ecosystem (testing utilities, visualization) is compatible
|
|
97
|
+
|
|
98
|
+
[`AbstractActor`](../api/@xmachines/play-actor/classes/AbstractActor.md) adds one abstract requirement: a reactive `state` property of type `Signal.State<unknown>`. This is the single point where XState's pull-based snapshot API is bridged to TC39's push-based signal system.
|
|
99
|
+
|
|
100
|
+
The two optional capability interfaces — [`Routable`](../api/@xmachines/play-actor/interfaces/Routable.md) and [`Viewable`](../api/@xmachines/play-actor/interfaces/Viewable.md) — are deliberately separate:
|
|
101
|
+
|
|
102
|
+
- Not every actor needs routing (e.g., a background data-sync actor).
|
|
103
|
+
- Not every actor drives a view (e.g., a sub-actor composed inside a parent).
|
|
104
|
+
|
|
105
|
+
An actor implements only the capabilities it actually uses:
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Minimal actor: just reactive state
|
|
109
|
+
class MinimalActor extends AbstractActor<SomeLogic> {
|
|
110
|
+
state = new Signal.State(this.getSnapshot());
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Full actor: state + routing + view
|
|
114
|
+
class PlayerActor extends AbstractActor<SomeMachine> implements Routable, Viewable {
|
|
115
|
+
state = new Signal.State(this.getSnapshot());
|
|
116
|
+
currentRoute = new Signal.Computed(() => deriveRoute(this.state.get()));
|
|
117
|
+
currentView = new Signal.State<PlaySpec | null>(null);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
In practice you never write [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md) yourself — [`definePlayer`](../api/@xmachines/play-xstate/functions/definePlayer.md) from [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) creates one from your machine definition.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## [`definePlayer`](../api/@xmachines/play-xstate/functions/definePlayer.md) — the factory builder
|
|
126
|
+
|
|
127
|
+
[`definePlayer({ machine })`](../api/@xmachines/play-xstate/functions/definePlayer.md) is the primary entry point for creating actors:
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
131
|
+
import { myMachine } from "./machine.js";
|
|
132
|
+
|
|
133
|
+
const createPlayer = definePlayer({ machine: myMachine });
|
|
134
|
+
|
|
135
|
+
// Each call creates an independent actor instance
|
|
136
|
+
const actor = createPlayer();
|
|
137
|
+
actor.start();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
[`definePlayer`](../api/@xmachines/play-xstate/functions/definePlayer.md) returns a **factory function**, not an actor. This is intentional: it lets you create multiple independent instances (e.g., one per test, one per user session) without re-processing the machine definition each time.
|
|
141
|
+
|
|
142
|
+
The factory accepts optional `input` (initial context overrides) and a `restore` snapshot (for resumable sessions):
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
const actor = createPlayer({ userId: "abc" }); // with input
|
|
146
|
+
const actor = createPlayer(undefined, { snapshot }); // restored from snapshot
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Why the actor has no framework imports
|
|
152
|
+
|
|
153
|
+
The machine definition — the `setup().createMachine(...)` call — is pure TypeScript with zero runtime dependencies on browsers, routers, or UI frameworks. This is not a convention; it is enforced by the dependency graph.
|
|
154
|
+
|
|
155
|
+
[`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) depends on `xstate` and [`@xmachines/play-signals`](../api/@xmachines/play-signals/README.md). It does not depend on React, Vue, any router library, or any browser API. Your machine file inherits those same boundaries.
|
|
156
|
+
|
|
157
|
+
This has concrete practical benefits:
|
|
158
|
+
|
|
159
|
+
- **Portable**: the same machine runs in a browser, a Node.js server, a web worker, and a Vitest test suite — with zero modification.
|
|
160
|
+
- **Testable in isolation**: you test the machine with `actor.send()` and `actor.state.get()`. No DOM, no router, no React to mock.
|
|
161
|
+
- **Replaceable infrastructure**: swap the React renderer for a Vue renderer, or swap TanStack Router for React Router, without touching the machine file.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## The lock statement
|
|
166
|
+
|
|
167
|
+
The Play RFC captures the actor/infrastructure split in a single statement:
|
|
168
|
+
|
|
169
|
+
> _Logic is sovereign. Infrastructure reflects, never decides. Capabilities compose, never prescribe. Logic owns structure and flow. Adapters project, never decide. This is Universal Player._
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## See also
|
|
174
|
+
|
|
175
|
+
- [Understanding TC39 Signals](signals.md) — how the actor communicates with infrastructure
|
|
176
|
+
- [Understanding State Machines](state-machines.md) — how the machine definition drives actor behavior
|
|
177
|
+
- [Getting Started](getting-started.md) — hands-on walkthrough creating and starting an actor
|
|
178
|
+
- [@xmachines/play-actor](../api/@xmachines/play-actor/README.md) — API reference for [`AbstractActor`](../api/@xmachines/play-actor/classes/AbstractActor.md)
|
|
179
|
+
- [@xmachines/play-xstate](../api/@xmachines/play-xstate/README.md) — API reference for [`definePlayer`](../api/@xmachines/play-xstate/functions/definePlayer.md) and [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md)
|
|
180
|
+
- [Play RFC](../rfc/play.md) — complete architectural specification
|