@xmachines/docs 3.0.0 → 5.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 +14 -20
- package/api/@xmachines/play/README.md +29 -118
- package/api/@xmachines/play/errors/README.md +8 -0
- package/api/@xmachines/play/{classes → errors/classes}/NonNullableError.md +6 -6
- package/api/@xmachines/play/{classes → errors/classes}/PlayError.md +36 -10
- package/api/@xmachines/play/index/README.md +75 -0
- package/api/@xmachines/play/index/functions/asCleanup.md +77 -0
- package/api/@xmachines/play/{functions → index/functions}/assertNonNullable.md +2 -2
- package/api/@xmachines/{play-actor → play/index}/functions/shallowEqualExcept.md +3 -3
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/Cleanup.md +5 -5
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/DisposeKey.md +2 -2
- package/api/@xmachines/play/{type-aliases → index/type-aliases}/PlayEvent.md +4 -4
- package/api/@xmachines/play/{variables → index/variables}/DISPOSE.md +2 -2
- package/api/@xmachines/play-actor/README.md +80 -231
- package/api/@xmachines/play-actor/interfaces/ActorEvent.md +18 -0
- package/api/@xmachines/play-actor/interfaces/PlayActor.md +73 -0
- package/api/@xmachines/play-atom/README.md +281 -0
- package/api/@xmachines/play-atom/functions/watchAtom.md +79 -0
- package/api/@xmachines/play-atom/interfaces/AsyncAtomOptions.md +16 -0
- package/api/@xmachines/play-atom/interfaces/Atom.md +149 -0
- package/api/@xmachines/play-atom/interfaces/AtomObserver.md +25 -0
- package/api/@xmachines/play-atom/interfaces/AtomOptions.md +33 -0
- package/api/@xmachines/play-atom/interfaces/AtomSubscription.md +23 -0
- package/api/@xmachines/play-atom/interfaces/BaseAtom.md +97 -0
- package/api/@xmachines/play-atom/interfaces/CreateAtom.md +91 -0
- package/api/@xmachines/play-atom/interfaces/Readable.md +93 -0
- package/api/@xmachines/play-atom/interfaces/ReadonlyAtom.md +108 -0
- package/api/@xmachines/play-atom/type-aliases/AnyAtom.md +13 -0
- package/api/@xmachines/play-atom/type-aliases/AsyncAtomState.md +32 -0
- package/api/@xmachines/{play-signals → play-atom}/type-aliases/Cleanup.md +5 -5
- package/api/@xmachines/play-atom/variables/createAsyncAtom.md +42 -0
- package/api/@xmachines/play-atom/variables/createAtom.md +18 -0
- package/api/@xmachines/play-atom/variables/createWritableAtom.md +70 -0
- package/api/@xmachines/play-dom/README.md +44 -52
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +17 -16
- package/api/@xmachines/play-dom/functions/asCleanup.md +77 -0
- package/api/@xmachines/play-dom/functions/createPlayUI.md +4 -4
- package/api/@xmachines/play-dom/functions/createRenderer.md +1 -1
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +3 -3
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +3 -3
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +6 -6
- package/api/@xmachines/play-dom/type-aliases/Cleanup.md +4 -4
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +29 -12
- package/api/@xmachines/play-dom-router/README.md +83 -83
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +24 -23
- package/api/@xmachines/play-dom-router/{interfaces → classes}/RouteMap.md +42 -7
- package/api/@xmachines/{play → play-dom-router}/functions/asCleanup.md +5 -6
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +3 -8
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +9 -3
- package/api/@xmachines/play-dom-router/functions/createRouter.md +8 -14
- package/api/@xmachines/play-dom-router/interfaces/BasePathOptions.md +5 -9
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +70 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +11 -9
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +24 -21
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +10 -4
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +15 -17
- package/api/@xmachines/play-dom-router/interfaces/RouterConnection.md +8 -8
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +36 -23
- package/api/@xmachines/play-dom-router/type-aliases/Cleanup.md +4 -4
- package/api/@xmachines/play-dom-router/variables/DISPOSE.md +2 -2
- package/api/@xmachines/play-pattern/README.md +115 -0
- package/api/@xmachines/play-pattern/functions/buildPath.md +46 -0
- package/api/@xmachines/play-pattern/functions/createPatternCache.md +47 -0
- package/api/@xmachines/play-pattern/functions/getIndexKey.md +30 -0
- package/api/@xmachines/play-pattern/functions/isDotSegment.md +40 -0
- package/api/@xmachines/play-pattern/functions/parsePattern.md +28 -0
- package/api/@xmachines/play-pattern/interfaces/GroupPart.md +15 -0
- package/api/@xmachines/play-pattern/interfaces/LiteralPart.md +14 -0
- package/api/@xmachines/play-pattern/interfaces/ParamPart.md +21 -0
- package/api/@xmachines/play-pattern/interfaces/ParseOptions.md +19 -0
- package/api/@xmachines/play-pattern/interfaces/ParsedPattern.md +23 -0
- package/api/@xmachines/play-pattern/interfaces/PatternCache.md +65 -0
- package/api/@xmachines/play-pattern/interfaces/PatternParam.md +15 -0
- package/api/@xmachines/play-pattern/type-aliases/PathBuildResult.md +74 -0
- package/api/@xmachines/play-pattern/type-aliases/PathParams.md +15 -0
- package/api/@xmachines/play-pattern/type-aliases/PatternModifier.md +11 -0
- package/api/@xmachines/play-pattern/type-aliases/PatternPart.md +9 -0
- package/api/@xmachines/play-react/README.md +46 -58
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -10
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useAtomEffect.md +103 -0
- package/api/@xmachines/play-react/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +6 -6
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-react/variables/ActorProvider.md +2 -2
- package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-react/variables/schema.md +52 -0
- package/api/@xmachines/play-react-router/README.md +23 -51
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +24 -23
- package/api/@xmachines/play-react-router/classes/RouteMap.md +18 -12
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +11 -8
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +16 -9
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +14 -12
- package/api/@xmachines/play-react-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +10 -4
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +15 -17
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +29 -12
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-router/README.md +116 -197
- package/api/@xmachines/play-router/errors/README.md +15 -0
- package/api/@xmachines/play-router/errors/classes/DuplicateBridgeError.md +191 -0
- package/api/@xmachines/play-router/errors/classes/DuplicateRoutePathError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/EmptyRoutePathError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/InvalidBasePathError.md +200 -0
- package/api/@xmachines/play-router/errors/classes/InvalidRoutePatternError.md +203 -0
- package/api/@xmachines/play-router/errors/classes/InvalidStateIdError.md +175 -0
- package/api/@xmachines/play-router/errors/classes/MissingBasePathParamError.md +199 -0
- package/api/@xmachines/play-router/errors/classes/RouterSyncError.md +192 -0
- package/api/@xmachines/play-router/errors/classes/UnknownStateTypeError.md +182 -0
- package/api/@xmachines/play-router/index/README.md +83 -0
- package/api/@xmachines/play-router/{classes → index/classes}/RouteMap.md +19 -13
- package/api/@xmachines/play-router/{classes → index/classes}/RouterBridgeBase.md +22 -20
- package/api/@xmachines/play-router/{functions → index/functions}/buildPlayRouteEvent.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/buildRouteTree.md +14 -4
- package/api/@xmachines/play-router/{functions → index/functions}/cleanFrameworkParams.md +3 -4
- package/api/@xmachines/play-router/index/functions/createPatternCache.md +47 -0
- package/api/@xmachines/play-router/{functions → index/functions}/createRouteMapFromTree.md +17 -10
- package/api/@xmachines/play-router/{functions → index/functions}/createRouterConnection.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/detectDuplicateRoutes.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/extractQuery.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/extractRouteParams.md +9 -8
- package/api/@xmachines/play-router/{functions → index/functions}/findRouteById.md +2 -2
- package/api/@xmachines/play-router/index/functions/findRouteByPath.md +48 -0
- package/api/@xmachines/play-router/{functions → index/functions}/isMountableBridge.md +2 -2
- package/api/@xmachines/play-router/index/functions/joinBasePath.md +38 -0
- package/api/@xmachines/play-router/{functions → index/functions}/mountKey.md +2 -2
- package/api/@xmachines/play-router/index/functions/normalizeBasePath.md +43 -0
- package/api/@xmachines/play-router/{functions → index/functions}/openProviderBridge.md +14 -14
- package/api/@xmachines/play-router/index/functions/parsePattern.md +28 -0
- package/api/@xmachines/play-router/index/functions/pickOwnParams.md +41 -0
- package/api/@xmachines/play-router/{functions → index/functions}/repointProviderBridge.md +2 -2
- package/api/@xmachines/play-router/index/functions/resolveBasePath.md +51 -0
- package/api/@xmachines/play-router/index/functions/resolveFrameworkParams.md +49 -0
- package/api/@xmachines/play-router/index/functions/sanitizePathname.md +27 -0
- package/api/@xmachines/play-router/index/functions/splitLocation.md +37 -0
- package/api/@xmachines/play-router/index/functions/stripBasePath.md +44 -0
- package/api/@xmachines/play-router/{functions → index/functions}/validateRouteFormat.md +2 -2
- package/api/@xmachines/play-router/{functions → index/functions}/validateStateExists.md +2 -2
- package/api/@xmachines/play-router/index/interfaces/BasePathOptions.md +32 -0
- package/api/@xmachines/play-router/index/interfaces/BuildPlayRouteEventOptions.md +13 -0
- package/api/@xmachines/play-router/index/interfaces/CompileOptions.md +35 -0
- package/api/@xmachines/play-router/index/interfaces/FrameworkParamsSource.md +52 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/LocationLike.md +6 -6
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/MountableRouterBridge.md +12 -12
- package/api/@xmachines/play-router/index/interfaces/OpenProviderBridgeArgs.md +30 -0
- package/api/@xmachines/play-router/index/interfaces/ParseOptions.md +24 -0
- package/api/@xmachines/play-router/index/interfaces/ParsedPattern.md +23 -0
- package/api/@xmachines/play-router/index/interfaces/PatternCache.md +65 -0
- package/api/@xmachines/play-router/index/interfaces/PlayRouteEvent.md +130 -0
- package/api/@xmachines/play-router/index/interfaces/PlayRouterProviderBaseProps.md +39 -0
- package/api/@xmachines/play-router/index/interfaces/ResolvedBasePath.md +14 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/ResolvedRoutePath.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/Routable.md +26 -0
- package/api/@xmachines/play-router/index/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/index/interfaces/RouteMapOptions.md +19 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteMapping.md +6 -6
- package/api/@xmachines/play-router/index/interfaces/RouteMatch.md +12 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouteNode.md +13 -13
- package/api/@xmachines/play-router/index/interfaces/RouteObject.md +34 -0
- package/api/@xmachines/play-router/index/interfaces/RouteTree.md +27 -0
- package/api/@xmachines/play-router/index/interfaces/RouteWatcherHandle.md +55 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouterBridge.md +17 -19
- package/api/@xmachines/play-router/index/interfaces/RouterBridgeOptions.md +31 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/RouterConnection.md +10 -10
- package/api/@xmachines/play-router/index/interfaces/SplitLocation.md +16 -0
- package/api/@xmachines/play-router/{interfaces → index/interfaces}/WindowLike.md +4 -4
- package/api/@xmachines/play-router/index/type-aliases/PlayRouterBridgeConstructor.md +53 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteData.md +12 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteDataResolver.md +31 -0
- package/api/@xmachines/play-router/index/type-aliases/RouteMetadata.md +11 -0
- package/api/@xmachines/play-router/index/type-aliases/URLPatternLike.md +68 -0
- package/api/@xmachines/{play-xstate → play-router/index}/variables/DISPOSE.md +3 -3
- package/api/@xmachines/play-router/index/variables/NO_BASE_PATH.md +18 -0
- package/api/@xmachines/play-router/index/variables/ROOT_NODE_ID.md +18 -0
- package/api/@xmachines/play-router/xstate/README.md +53 -0
- package/api/@xmachines/play-router/{functions → xstate/functions}/createRouteMap.md +11 -9
- package/api/@xmachines/play-router/xstate/functions/extractMachineRoutes.md +30 -0
- package/api/@xmachines/play-router/xstate/functions/getNavigableRoutes.md +35 -0
- package/api/@xmachines/play-router/{functions → xstate/functions}/getRoutableRoutes.md +6 -6
- package/api/@xmachines/play-router/{functions → xstate/functions}/getRouteMappings.md +7 -7
- package/api/@xmachines/play-router/{functions → xstate/functions}/getTransitionReachableRoutes.md +2 -2
- package/api/@xmachines/play-router/{functions → xstate/functions}/isRouteReachable.md +2 -2
- package/api/@xmachines/play-router/{functions → xstate/functions}/machineToGraph.md +2 -2
- package/api/@xmachines/play-router/xstate/functions/routeExists.md +26 -0
- package/api/@xmachines/play-router/xstate/interfaces/MachineEdgeData.md +15 -0
- package/api/@xmachines/play-router/xstate/interfaces/MachineNodeData.md +17 -0
- package/api/@xmachines/play-router/{type-aliases → xstate/type-aliases}/MachineGraph.md +2 -2
- package/api/@xmachines/play-solid/README.md +21 -34
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-solid/variables/ActorContext.md +1 -1
- package/api/@xmachines/play-solid/variables/ActorProvider.md +2 -2
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +1 -1
- package/api/@xmachines/play-solid/variables/schema.md +71 -0
- package/api/@xmachines/play-solid-router/README.md +34 -55
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +18 -12
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +33 -56
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +9 -8
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +38 -35
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +14 -12
- package/api/@xmachines/play-solid-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +10 -4
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +15 -17
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +29 -12
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-svelte/README.md +18 -29
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-svelte/functions/getActorContext.md +1 -1
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +1 -1
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +12 -12
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +4 -4
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-svelte/variables/schema.md +16 -0
- package/api/@xmachines/play-svelte-spa-router/README.md +25 -44
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +18 -12
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +24 -23
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -2
- package/api/@xmachines/play-svelte-spa-router/interfaces/BasePathOptions.md +5 -9
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +11 -9
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-svelte-spa-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +10 -4
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +15 -17
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterConnection.md +8 -8
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/README.md +32 -50
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +18 -12
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +24 -23
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -2
- package/api/@xmachines/play-sveltekit-router/interfaces/BasePathOptions.md +5 -9
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +15 -23
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-sveltekit-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +10 -4
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +15 -17
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterConnection.md +8 -8
- package/api/@xmachines/play-tanstack-react-router/README.md +25 -49
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +18 -12
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +22 -21
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +11 -8
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +16 -9
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +14 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +10 -4
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +15 -17
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +29 -12
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-tanstack-router/README.md +6 -4
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +26 -29
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +3 -3
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/README.md +29 -55
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +18 -12
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +52 -48
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +9 -14
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +14 -12
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +10 -4
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +15 -17
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +29 -12
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterProviderBaseProps.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +4 -4
- package/api/@xmachines/play-url/README.md +75 -0
- package/api/@xmachines/play-url/errors/README.md +17 -0
- package/api/@xmachines/play-url/errors/classes/InvalidBasePathError.md +200 -0
- package/api/@xmachines/play-url/errors/classes/InvalidRoutePatternError.md +203 -0
- package/api/@xmachines/play-url/errors/classes/MissingBasePathParamError.md +199 -0
- package/api/@xmachines/play-url/index/README.md +72 -0
- package/api/@xmachines/play-url/index/functions/buildPath.md +46 -0
- package/api/@xmachines/play-url/index/functions/cleanFrameworkParams.md +39 -0
- package/api/@xmachines/play-url/index/functions/createPatternCache.md +47 -0
- package/api/@xmachines/play-url/index/functions/getCandidates.md +29 -0
- package/api/@xmachines/play-url/index/functions/getCompiledPattern.md +32 -0
- package/api/@xmachines/play-url/index/functions/getIndexKey.md +30 -0
- package/api/@xmachines/play-url/index/functions/holdsUnsubstitutedParam.md +36 -0
- package/api/@xmachines/play-url/index/functions/isDotSegment.md +40 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/joinBasePath.md +3 -2
- package/api/@xmachines/{play-router → play-url/index}/functions/normalizeBasePath.md +2 -2
- package/api/@xmachines/play-url/index/functions/parsePattern.md +28 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/pickOwnParams.md +4 -4
- package/api/@xmachines/{play-router → play-url/index}/functions/resolveBasePath.md +2 -2
- package/api/@xmachines/play-url/index/functions/resolveFrameworkParams.md +49 -0
- package/api/@xmachines/play-url/index/functions/sanitizePathname.md +27 -0
- package/api/@xmachines/play-url/index/functions/splitLocation.md +37 -0
- package/api/@xmachines/{play-router → play-url/index}/functions/stripBasePath.md +2 -2
- package/api/@xmachines/{play-router → play-url/index}/interfaces/BasePathOptions.md +6 -10
- package/api/@xmachines/play-url/index/interfaces/CompileOptions.md +21 -0
- package/api/@xmachines/play-url/index/interfaces/FrameworkParamsSource.md +52 -0
- package/api/@xmachines/play-url/index/interfaces/GroupPart.md +15 -0
- package/api/@xmachines/play-url/index/interfaces/LiteralPart.md +14 -0
- package/api/@xmachines/play-url/index/interfaces/ParamPart.md +21 -0
- package/api/@xmachines/play-url/index/interfaces/ParseOptions.md +24 -0
- package/api/@xmachines/play-url/index/interfaces/ParsedPattern.md +23 -0
- package/api/@xmachines/play-url/index/interfaces/PatternCache.md +65 -0
- package/api/@xmachines/play-url/index/interfaces/PatternParam.md +15 -0
- package/api/@xmachines/{play-router → play-url/index}/interfaces/ResolvedBasePath.md +6 -6
- package/api/@xmachines/play-url/index/interfaces/SplitLocation.md +16 -0
- package/api/@xmachines/play-url/index/type-aliases/PathBuildResult.md +74 -0
- package/api/@xmachines/play-url/index/type-aliases/PathParams.md +15 -0
- package/api/@xmachines/play-url/index/type-aliases/PatternModifier.md +11 -0
- package/api/@xmachines/play-url/index/type-aliases/PatternPart.md +9 -0
- package/api/@xmachines/play-url/index/type-aliases/URLPatternCtor.md +22 -0
- package/api/@xmachines/play-url/index/type-aliases/URLPatternLike.md +68 -0
- package/api/@xmachines/{play-router → play-url/index}/variables/NO_BASE_PATH.md +2 -2
- package/api/@xmachines/play-url/index/variables/URLPattern.md +21 -0
- package/api/@xmachines/play-view/README.md +176 -0
- package/api/@xmachines/play-view/errors/README.md +17 -0
- package/api/@xmachines/play-view/errors/classes/ReadOnlyContextError.md +192 -0
- package/api/@xmachines/play-view/index/README.md +55 -0
- package/api/@xmachines/{play-actor → play-view/index}/functions/attachRenderErrorHandler.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/functions/composePlayState.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createFailureLatch.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createReportGuard.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/createViewStoreLifecycle.md +2 -2
- package/api/@xmachines/play-view/index/functions/guardContextWrites.md +19 -0
- package/api/@xmachines/{play-actor → play-view/index}/functions/refreshContextSubtree.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/reuseComposedState.md +3 -3
- package/api/@xmachines/{play-actor → play-view/index}/functions/sameViewInputs.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/toAtomState.md +2 -2
- package/api/@xmachines/{play-actor → play-view/index}/functions/typedSpec.md +2 -2
- package/api/@xmachines/play-view/index/interfaces/BaseActorProviderProps.md +49 -0
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/BaseViewContextValue.md +12 -12
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/FailureLatch.md +6 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/PlaySpec.md +8 -8
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ReportGuard.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ReportGuardMessages.md +6 -6
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ResolveViewStoreOptions.md +5 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewInputs.md +7 -7
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewStoreLifecycle.md +6 -5
- package/api/@xmachines/{play-actor → play-view/index}/interfaces/ViewStoreResolution.md +7 -7
- package/api/@xmachines/play-view/index/interfaces/Viewable.md +18 -0
- package/api/@xmachines/play-view/index/type-aliases/ViewActor.md +26 -0
- package/api/@xmachines/{play-actor → play-view/index}/variables/CONTEXT_STATE_KEY.md +2 -2
- package/api/@xmachines/play-vue/README.md +26 -40
- package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/usePlayView.md +1 -1
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +9 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +11 -11
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -3
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/schema.md +71 -0
- package/api/@xmachines/play-vue-router/README.md +42 -84
- package/api/@xmachines/play-vue-router/errors/README.md +8 -0
- package/api/@xmachines/play-vue-router/errors/classes/VueRouterNavigationError.md +193 -0
- package/api/@xmachines/play-vue-router/errors/classes/VueRouterSendError.md +177 -0
- package/api/@xmachines/play-vue-router/index/README.md +20 -0
- package/api/@xmachines/play-vue-router/{classes → index/classes}/RouteMap.md +19 -13
- package/api/@xmachines/play-vue-router/{classes → index/classes}/VueRouterBridge.md +26 -45
- package/api/@xmachines/play-vue-router/index/interfaces/PlayRouteEvent.md +130 -0
- package/api/@xmachines/play-vue-router/index/interfaces/RoutableActor.md +72 -0
- package/api/@xmachines/play-vue-router/index/interfaces/RouteMapOptions.md +19 -0
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouteMapping.md +6 -6
- package/api/@xmachines/play-vue-router/{interfaces → index/interfaces}/RouterBridge.md +17 -19
- package/api/@xmachines/play-vue-router/{variables → index/variables}/PlayRouterProvider.md +26 -4
- package/api/@xmachines/play-xstate/README.md +195 -116
- package/api/@xmachines/play-xstate/errors/README.md +14 -0
- package/api/@xmachines/play-xstate/errors/classes/ActorThrewNonErrorError.md +199 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidEventError.md +198 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidMachineError.md +169 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidRouteHandlerError.md +197 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidRouteMetadataError.md +176 -0
- package/api/@xmachines/play-xstate/errors/classes/InvalidRouteParamError.md +207 -0
- package/api/@xmachines/play-xstate/errors/classes/MissingRouteParamError.md +199 -0
- package/api/@xmachines/play-xstate/errors/classes/MissingStateIdError.md +203 -0
- package/api/@xmachines/play-xstate/index/README.md +38 -0
- package/api/@xmachines/play-xstate/index/classes/PlayerActor.md +583 -0
- package/api/@xmachines/play-xstate/index/functions/compose.md +224 -0
- package/api/@xmachines/play-xstate/index/functions/definePlayer.md +158 -0
- package/api/@xmachines/play-xstate/index/interfaces/PlayerConfig.md +22 -0
- package/api/@xmachines/play-xstate/{interfaces → index/interfaces}/PlayerFactoryResumeOptions.md +3 -3
- package/api/@xmachines/play-xstate/{interfaces → index/interfaces}/PlayerOptions.md +10 -10
- package/api/@xmachines/play-xstate/index/type-aliases/Capability.md +33 -0
- package/api/@xmachines/play-xstate/index/type-aliases/PlayerConstructor.md +39 -0
- package/api/@xmachines/play-xstate/index/type-aliases/PlayerFactory.md +27 -0
- package/api/@xmachines/{play-router → play-xstate/index}/variables/DISPOSE.md +3 -3
- package/api/@xmachines/play-xstate/with-routing/README.md +46 -0
- package/api/@xmachines/play-xstate/with-routing/functions/buildRouteUrl.md +57 -0
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/deriveRoute.md +4 -4
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/formatPlayRouteTransitions.md +2 -2
- package/api/@xmachines/play-xstate/{functions → with-routing/functions}/isAbsoluteRoute.md +3 -3
- package/api/@xmachines/play-xstate/with-routing/functions/withRouting.md +36 -0
- package/api/@xmachines/play-xstate/{interfaces → with-routing/interfaces}/RouteContext.md +6 -6
- package/api/@xmachines/play-xstate/with-routing/interfaces/RouteObject.md +34 -0
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteData.md +12 -0
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteDataResolver.md +31 -0
- package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteMachineConfig.md +5 -5
- package/api/@xmachines/play-xstate/with-routing/type-aliases/RouteMetadata.md +11 -0
- package/api/@xmachines/play-xstate/{type-aliases → with-routing/type-aliases}/RouteStateNode.md +21 -7
- package/api/@xmachines/play-xstate/with-view/README.md +31 -0
- package/api/@xmachines/play-xstate/with-view/functions/withView.md +33 -0
- package/api/@xmachines/shared/README.md +10 -32
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +2 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
- package/api/README.md +4 -1
- package/api/llms.txt +18 -12
- package/contributing/architecture.md +157 -148
- package/contributing/configuration.md +100 -41
- package/contributing/deployment.md +112 -34
- package/contributing/development.md +103 -34
- package/contributing/migrating-to-play-atom.md +209 -0
- package/contributing/testing.md +136 -80
- package/examples/README.md +11 -9
- package/examples/basic-state-machine.md +4 -4
- package/examples/form-validation.md +4 -3
- package/examples/multi-router-integration.md +81 -59
- package/examples/routing-patterns.md +20 -19
- package/examples/traffic-light.md +17 -11
- package/guides/README.md +2 -1
- package/guides/actor-model.md +50 -32
- package/guides/atoms.md +264 -0
- package/guides/getting-started.md +91 -53
- package/guides/inspector.md +7 -7
- package/guides/routing.md +265 -0
- package/guides/state-machines.md +20 -21
- package/package.json +10 -9
- package/rfc/play.md +104 -60
- package/api/@xmachines/play-actor/classes/AbstractActor.md +0 -505
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +0 -43
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +0 -48
- package/api/@xmachines/play-actor/interfaces/Routable.md +0 -14
- package/api/@xmachines/play-actor/interfaces/Viewable.md +0 -18
- package/api/@xmachines/play-dom/type-aliases/DisposablePlayUI.md +0 -36
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-dom-router/interfaces/DisposableBrowserHistory.md +0 -262
- package/api/@xmachines/play-dom-router/interfaces/DisposableVanillaRouter.md +0 -80
- package/api/@xmachines/play-react/functions/useSignalEffect.md +0 -77
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +0 -13
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +0 -29
- package/api/@xmachines/play-router/functions/findRouteByPath.md +0 -41
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +0 -35
- package/api/@xmachines/play-router/functions/getPatternParamNames.md +0 -24
- package/api/@xmachines/play-router/functions/getRequiredPatternParamNames.md +0 -36
- package/api/@xmachines/play-router/functions/resolveFrameworkParams.md +0 -51
- package/api/@xmachines/play-router/functions/routeExists.md +0 -26
- package/api/@xmachines/play-router/functions/sanitizePathname.md +0 -42
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +0 -13
- package/api/@xmachines/play-router/interfaces/FrameworkParamsSource.md +0 -47
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +0 -15
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +0 -17
- package/api/@xmachines/play-router/interfaces/OpenProviderBridgeArgs.md +0 -28
- package/api/@xmachines/play-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +0 -135
- package/api/@xmachines/play-router/interfaces/PlayRouterProviderBaseProps.md +0 -33
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +0 -65
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +0 -13
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +0 -12
- package/api/@xmachines/play-router/interfaces/RouteObject.md +0 -21
- package/api/@xmachines/play-router/interfaces/RouteTree.md +0 -21
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +0 -55
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +0 -13
- package/api/@xmachines/play-router/type-aliases/PlayRouterBridgeConstructor.md +0 -36
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +0 -11
- package/api/@xmachines/play-signals/README.md +0 -231
- package/api/@xmachines/play-signals/functions/watchSignal.md +0 -65
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +0 -36
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +0 -49
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +0 -37
- package/api/@xmachines/play-signals/interfaces/SignalState.md +0 -68
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +0 -97
- package/api/@xmachines/play-signals/namespaces/Signal/README.md +0 -22
- package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +0 -52
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +0 -72
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +0 -19
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/README.md +0 -21
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +0 -85
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +0 -13
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +0 -19
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +0 -19
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +0 -19
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +0 -19
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +0 -25
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +0 -9
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +0 -9
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +0 -19
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +0 -19
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +0 -19
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +0 -33
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +0 -471
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +0 -9
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +0 -9
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +0 -29
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +0 -31
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +0 -9
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +0 -39
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +0 -40
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +0 -70
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +0 -135
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +0 -13
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +0 -13
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +0 -13
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +0 -13
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +0 -568
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +0 -50
- package/api/@xmachines/play-xstate/functions/composeGuards.md +0 -86
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +0 -72
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +0 -43
- package/api/@xmachines/play-xstate/functions/definePlayer.md +0 -78
- package/api/@xmachines/play-xstate/functions/eventMatches.md +0 -45
- package/api/@xmachines/play-xstate/functions/hasContext.md +0 -45
- package/api/@xmachines/play-xstate/functions/negateGuard.md +0 -67
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +0 -20
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +0 -17
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +0 -19
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +0 -36
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +0 -23
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +0 -26
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +0 -9
- package/guides/signals.md +0 -209
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# Architecture
|
|
2
2
|
|
|
3
|
-
XMachines Play implements the **Universal Player Architecture** — a layered, actor-authority design where XState machines are the single source of truth for routing, navigation, and view selection. Infrastructure (routers, renderers) is strictly passive: it observes actor
|
|
3
|
+
XMachines Play implements the **Universal Player Architecture** — a layered, actor-authority design where XState machines are the single source of truth for routing, navigation, and view selection. Infrastructure (routers, renderers) is strictly passive: it observes actor atoms and reflects them, never enforcing guards or making decisions.
|
|
4
4
|
|
|
5
5
|
## System Overview
|
|
6
6
|
|
|
7
|
-
XMachines JS is the JavaScript/TypeScript reference implementation of the **Universal Player Architecture** ([Play RFC](../rfc/play.md)). It is a monorepo of modular packages that strictly separates **business logic (the Actor)** from **infrastructure (router adapters and view renderers)**. An XState v5 state machine is the single source of truth; it owns all state, guards, and route validity. Infrastructure is passive: it observes
|
|
7
|
+
XMachines JS is the JavaScript/TypeScript reference implementation of the **Universal Player Architecture** ([Play RFC](../rfc/play.md)). It is a monorepo of modular packages that strictly separates **business logic (the Actor)** from **infrastructure (router adapters and view renderers)**. An XState v5 state machine is the single source of truth; it owns all state, guards, and route validity. Infrastructure is passive: it observes atoms emitted by the Actor and proposes state changes via typed events. The Actor's guards make every navigation and transition decision. Communication across the boundary is exclusively through atoms — never subscriptions, callbacks, or direct state mutation. Five architectural invariants (documented in the [Play RFC](../rfc/play.md)) enforce this contract across the entire package graph.
|
|
8
8
|
|
|
9
9
|
## Architectural Invariants
|
|
10
10
|
|
|
11
|
-
| ID | Name | Rule
|
|
12
|
-
| ------ | -------------------------- |
|
|
13
|
-
| INV-01 | **Actor Authority** | Infrastructure proposes intents via `play.route` events; Actor decides via XState guards
|
|
14
|
-
| INV-02 | **Strict Separation** | No direct dependencies between Actor and Infrastructure layers. `play-xstate` never imports UI frameworks or routing libraries
|
|
15
|
-
| INV-03 | **
|
|
16
|
-
| INV-04 | **
|
|
17
|
-
| INV-05 | **State-Driven Reset** | Invalid external navigation is overwritten by Actor-derived state
|
|
11
|
+
| ID | Name | Rule |
|
|
12
|
+
| ------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
13
|
+
| INV-01 | **Actor Authority** | Infrastructure proposes intents via `play.route` events; Actor decides via XState guards |
|
|
14
|
+
| INV-02 | **Strict Separation** | No direct dependencies between Actor and Infrastructure layers. `play-xstate` never imports UI frameworks or routing libraries |
|
|
15
|
+
| INV-03 | **Atom-Only Reactivity** | All Actor→Infrastructure state changes flow through atoms (`Atom`, `ReadonlyAtom`). No subscriptions or event emitters |
|
|
16
|
+
| INV-04 | **Passive Infrastructure** | Infrastructure observes Actor atoms, never controls state |
|
|
17
|
+
| INV-05 | **State-Driven Reset** | Invalid external navigation is overwritten by Actor-derived state |
|
|
18
18
|
|
|
19
19
|
## Component Diagram
|
|
20
20
|
|
|
@@ -22,17 +22,22 @@ XMachines JS is the JavaScript/TypeScript reference implementation of the **Univ
|
|
|
22
22
|
graph TD
|
|
23
23
|
subgraph Layer0["Layer 0 — Protocol / Primitives"]
|
|
24
24
|
play["@xmachines/play\n(PlayEvent, PlayError)"]
|
|
25
|
-
|
|
25
|
+
atoms["@xmachines/play-atom\n(atoms, watchAtom)"]
|
|
26
26
|
shared["@xmachines/shared\n(tsconfig, oxlint, oxfmt)"]
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
subgraph Layer1["Layer 1 — Abstract Actor Base"]
|
|
30
|
-
actor["@xmachines/play-actor\n(
|
|
30
|
+
actor["@xmachines/play-actor\n(PlayActor)"]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
subgraph Layer2v["Layer 2 — The View Half"]
|
|
34
|
+
view["@xmachines/play-view\n(Viewable, PlaySpec, the view store lifecycle)"]
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
subgraph Layer2["Layer 2 — Concrete Implementations"]
|
|
34
|
-
xstate["@xmachines/play-xstate\n(PlayerActor, definePlayer,
|
|
35
|
-
router["@xmachines/play-router\n(RouterBridgeBase, RouteMap,
|
|
38
|
+
xstate["@xmachines/play-xstate\n(PlayerActor, definePlayer, routing)"]
|
|
39
|
+
router["@xmachines/play-router\n(RouterBridgeBase, RouteMap, Routable)"]
|
|
40
|
+
routerxstate["@xmachines/play-router/xstate\n(extractMachineRoutes, createRouteMap)"]
|
|
36
41
|
|
|
37
42
|
subgraph Views["View Renderers"]
|
|
38
43
|
react["@xmachines/play-react"]
|
|
@@ -55,12 +60,12 @@ graph TD
|
|
|
55
60
|
end
|
|
56
61
|
|
|
57
62
|
play --> actor
|
|
58
|
-
|
|
63
|
+
atoms --> actor
|
|
59
64
|
actor --> xstate
|
|
60
65
|
actor --> router
|
|
61
66
|
actor --> Views
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
atoms --> xstate
|
|
68
|
+
atoms --> router
|
|
64
69
|
play --> xstate
|
|
65
70
|
play --> router
|
|
66
71
|
router --> RouterAdapters
|
|
@@ -72,24 +77,29 @@ graph TD
|
|
|
72
77
|
| Package | Responsibility | Key File |
|
|
73
78
|
| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
74
79
|
| [`@xmachines/play`](../api/@xmachines/play/README.md) | Core protocol types and error base class | `packages/play/src/index.ts` |
|
|
75
|
-
| [`@xmachines/play-
|
|
76
|
-
| [`@xmachines/play-actor`](../api/@xmachines/play-actor/README.md) | `
|
|
80
|
+
| [`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md) | The atom primitives, isolated in one package | `packages/play-atom/src/index.ts` |
|
|
81
|
+
| [`@xmachines/play-actor`](../api/@xmachines/play-actor/README.md) | `PlayActor`, and nothing else | `packages/play-actor/src/play-actor.ts` |
|
|
82
|
+
| [`@xmachines/play-view`](../api/@xmachines/play-view/README.md) | `Viewable`, `PlaySpec`, the shared view half | `packages/play-view/src/view-types.ts` |
|
|
77
83
|
| [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) | XState v5 adapter: `definePlayer`, `PlayerActor` | `packages/play-xstate/src/player-actor.ts` |
|
|
78
|
-
| [`@xmachines/play-
|
|
84
|
+
| [`@xmachines/play-pattern`](../api/@xmachines/play-pattern/README.md) | The route pattern language: one parse, and `buildPath` | `packages/play-pattern/src/pattern-grammar.ts` |
|
|
85
|
+
| [`@xmachines/play-url`](../api/@xmachines/play-url/README.md) | The URLPattern API, a base path, framework params | `packages/play-url/src/url-pattern-utils.ts` |
|
|
86
|
+
| [`@xmachines/play-router`](../api/@xmachines/play-router/README.md) | `RouteMap`, `RouterBridgeBase`, the provider lifecycle | `packages/play-router/src/router-bridge-base.ts` |
|
|
87
|
+
| [`@xmachines/play-router/xstate`](../api/@xmachines/play-router/README.md) | Route extraction from an XState machine | `packages/play-router/src/xstate/extract-routes.ts` |
|
|
79
88
|
| [`@xmachines/play-react`](../api/@xmachines/play-react/README.md) | React renderer: `ActorProvider`, `PlayRenderer` | `packages/play-react/src/ActorProvider.tsx` |
|
|
80
89
|
| [`@xmachines/play-vue`](../api/@xmachines/play-vue/README.md) | Vue 3 renderer: `ActorProvider.vue`, `PlayRenderer.vue` | `packages/play-vue/src/ActorProvider.vue` |
|
|
81
90
|
| [`@xmachines/play-solid`](../api/@xmachines/play-solid/README.md) | SolidJS renderer | `packages/play-solid/src/ActorProvider.tsx` |
|
|
82
91
|
| [`@xmachines/play-svelte`](../api/@xmachines/play-svelte/README.md) | Svelte 5 renderer | `packages/play-svelte/src/ActorProvider.svelte` |
|
|
83
92
|
| [`@xmachines/play-dom`](../api/@xmachines/play-dom/README.md) | Vanilla DOM renderer | `packages/play-dom/src/create-play-ui.ts` |
|
|
93
|
+
| [`@xmachines/play-tanstack-router`](../api/@xmachines/play-tanstack-router/README.md) | The framework-free TanStack bridge base | `packages/play-tanstack-router/src/tanstack-router-bridge-base.ts` |
|
|
84
94
|
| [`@xmachines/play-tanstack-react-router`](../api/@xmachines/play-tanstack-react-router/README.md) | TanStack React Router bridge | `packages/play-tanstack-react-router/src/tanstack-router-bridge.ts` |
|
|
85
95
|
| [`@xmachines/play-tanstack-solid-router`](../api/@xmachines/play-tanstack-solid-router/README.md) | TanStack SolidJS Router bridge | `packages/play-tanstack-solid-router/src/solid-router-bridge.ts` |
|
|
86
96
|
| [`@xmachines/play-vue-router`](../api/@xmachines/play-vue-router/README.md) | Vue Router 4/5 bridge | `packages/play-vue-router/src/vue-router-bridge.ts` |
|
|
87
|
-
| [`@xmachines/play-react-router`](../api/@xmachines/play-react-router/README.md) | React Router
|
|
97
|
+
| [`@xmachines/play-react-router`](../api/@xmachines/play-react-router/README.md) | React Router 7/8 bridge | `packages/play-react-router/src/react-router-bridge.ts` |
|
|
88
98
|
| [`@xmachines/play-solid-router`](../api/@xmachines/play-solid-router/README.md) | SolidJS Router bridge | `packages/play-solid-router/src/solid-router-bridge.ts` |
|
|
89
99
|
| [`@xmachines/play-dom-router`](../api/@xmachines/play-dom-router/README.md) | Vanilla DOM hash/history router bridge | `packages/play-dom-router/src/dom-router-bridge.ts` |
|
|
90
100
|
| [`@xmachines/play-sveltekit-router`](../api/@xmachines/play-sveltekit-router/README.md) | SvelteKit router bridge | `packages/play-sveltekit-router/src/sveltekit-router-bridge.ts` |
|
|
91
101
|
| [`@xmachines/play-svelte-spa-router`](../api/@xmachines/play-svelte-spa-router/README.md) | Svelte SPA Router bridge | `packages/play-svelte-spa-router/src/svelte-spa-router-bridge.ts` |
|
|
92
|
-
| `@xmachines/shared`
|
|
102
|
+
| [`@xmachines/shared`](../api/@xmachines/shared/README.md) | Shared configs: tsconfig, oxlint, oxfmt, vitest | `packages/shared/config/` |
|
|
93
103
|
| `@xmachines/docs` | API docs and RFC documentation | `packages/docs/` |
|
|
94
104
|
|
|
95
105
|
## Data Flow
|
|
@@ -100,14 +110,19 @@ graph TD
|
|
|
100
110
|
flowchart TD
|
|
101
111
|
A["XState machine transition"]
|
|
102
112
|
B["PlayerActor observes its own transitions"]
|
|
103
|
-
C["actor.state
|
|
104
|
-
D["actor.currentRoute
|
|
105
|
-
E["
|
|
106
|
-
F["Framework
|
|
113
|
+
C["actor.state atom updated — the ONE write of the transition"]
|
|
114
|
+
D["actor.currentRoute computed atom recomputes\nderives URL from meta.route + context.params"]
|
|
115
|
+
E["actor.currentView computed atom recomputes\nderives the PlaySpec from meta.view"]
|
|
116
|
+
F["Framework atom subscription fires\nmicrotask"]
|
|
107
117
|
G["ActorProvider reads actor.currentView.get()"]
|
|
108
118
|
H["PlayRenderer renders via @xmachines/json-render-* Renderer"]
|
|
109
119
|
|
|
110
|
-
A --> B --> C
|
|
120
|
+
A --> B --> C
|
|
121
|
+
C --> D
|
|
122
|
+
C --> E
|
|
123
|
+
D --> F
|
|
124
|
+
E --> F
|
|
125
|
+
F --> G --> H
|
|
111
126
|
```
|
|
112
127
|
|
|
113
128
|
### User Navigation (Browser URL → Actor)
|
|
@@ -121,7 +136,7 @@ flowchart TD
|
|
|
121
136
|
E["buildPlayRouteEvent(path, routeMap)\nresolves stateId from URL via URLPattern"]
|
|
122
137
|
F["actor.send({ type: 'play.route', to: '#stateId', params, query })"]
|
|
123
138
|
G["XState machine guard evaluates transition"]
|
|
124
|
-
H["machine transitions →
|
|
139
|
+
H["machine transitions → atoms update\n→ URL bar updated"]
|
|
125
140
|
I["guard blocks → machine stays\n→ router re-syncs to actor's current route"]
|
|
126
141
|
|
|
127
142
|
A --> B --> C --> D --> E --> F --> G
|
|
@@ -133,9 +148,9 @@ flowchart TD
|
|
|
133
148
|
|
|
134
149
|
```mermaid
|
|
135
150
|
flowchart TD
|
|
136
|
-
A["actor.currentRoute
|
|
137
|
-
B["RouterBridgeBase routeWatcher\
|
|
138
|
-
C["
|
|
151
|
+
A["actor.currentRoute computed atom changes"]
|
|
152
|
+
B["RouterBridgeBase routeWatcher\natom subscription fires"]
|
|
153
|
+
C["watchAtom microtask queued\nscheduled dedup guard"]
|
|
139
154
|
D["syncRouterFromActor(route) called"]
|
|
140
155
|
E["lastSyncedPath set\necho suppression — prevents circular callback"]
|
|
141
156
|
F["navigateRouter(path)\ncalls framework router's navigate API"]
|
|
@@ -170,23 +185,23 @@ flowchart TD
|
|
|
170
185
|
B["resolveViewMeta(meta)\nfinds deepest meta.view with root + elements\n(its record key becomes viewKey)"]
|
|
171
186
|
C["snapshot.context\nprojected wholesale as the /context slice"]
|
|
172
187
|
D["composePlayState(spec.state, slice)\nstate: { ...authored, context: slice }"]
|
|
173
|
-
E["reuseComposedState (in
|
|
174
|
-
F["Derived PlaySpec (with viewKey)
|
|
188
|
+
E["reuseComposedState (in the currentView atom)\ncarry previous state reference when the slice is value-unchanged"]
|
|
189
|
+
F["Derived PlaySpec (with viewKey) is the value of the currentView atom"]
|
|
175
190
|
|
|
176
191
|
A --> B --> C --> D --> E --> F
|
|
177
192
|
```
|
|
178
193
|
|
|
179
|
-
**State
|
|
194
|
+
**State atoms on the actor:**
|
|
180
195
|
|
|
181
|
-
|
|
|
182
|
-
| -------------------- |
|
|
183
|
-
| `actor.state` | `
|
|
184
|
-
| `actor.currentRoute` | `
|
|
185
|
-
| `actor.currentView` | `
|
|
196
|
+
| Atom | Type | Description |
|
|
197
|
+
| -------------------- | -------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
198
|
+
| `actor.state` | `Atom<AnyMachineSnapshot>` | XState snapshot; the ONE write of a transition, on active states only |
|
|
199
|
+
| `actor.currentRoute` | `ReadonlyAtom<string \| null>` | Derived from `meta.route` + `context.params`; `null` when unroutable. It carries `compare: () => false`, so EVERY transition notifies — a refused guard derives the same path, and the bridge must still hear it |
|
|
200
|
+
| `actor.currentView` | `ReadonlyAtom<PlaySpec \| null>` | Derived from `meta.view`; the `previous` value gates an emission, so an unchanged view keeps its reference |
|
|
186
201
|
|
|
187
202
|
## Key Abstractions
|
|
188
203
|
|
|
189
|
-
### [`PlayEvent<TPayload>`](../api/@xmachines/play/type-aliases/PlayEvent.md)
|
|
204
|
+
### [`PlayEvent<TPayload>`](../api/@xmachines/play/index/type-aliases/PlayEvent.md)
|
|
190
205
|
|
|
191
206
|
The minimal event contract for Actor communication: any object with a `readonly type: string` property. `TPayload` extends `Record<string, unknown>` for additional fields. Framework-agnostic; used directly by XState, router adapters, and domain logic. Part of [`@xmachines/play`](../api/@xmachines/play/README.md).
|
|
192
207
|
|
|
@@ -196,12 +211,12 @@ import type { PlayEvent } from "@xmachines/play";
|
|
|
196
211
|
type LoginEvent = PlayEvent<{ userId: string; timestamp: number }>;
|
|
197
212
|
```
|
|
198
213
|
|
|
199
|
-
### [`PlayError`](../api/@xmachines/play/classes/PlayError.md)
|
|
214
|
+
### [`PlayError`](../api/@xmachines/play/errors/classes/PlayError.md)
|
|
200
215
|
|
|
201
216
|
Base class for all `@xmachines/*` typed runtime errors. Carries `scope` (throwing class/module) and `code` (stable machine-readable identifier, e.g. `"PLAY_ROUTER_SYNC_FAILED"`). Subclassed per package, exported from each package's `./errors` subpath. Never match on `.message` — always match on `.code` or the subclass.
|
|
202
217
|
|
|
203
218
|
```typescript
|
|
204
|
-
import { PlayError } from "@xmachines/play";
|
|
219
|
+
import { PlayError } from "@xmachines/play/errors";
|
|
205
220
|
import { RouterSyncError } from "@xmachines/play-router/errors";
|
|
206
221
|
|
|
207
222
|
if (err instanceof RouterSyncError) {
|
|
@@ -209,27 +224,39 @@ if (err instanceof RouterSyncError) {
|
|
|
209
224
|
}
|
|
210
225
|
```
|
|
211
226
|
|
|
212
|
-
### [`
|
|
227
|
+
### [`PlayActor<TSnapshot, TEvent>`](../api/@xmachines/play-actor/interfaces/PlayActor.md)
|
|
213
228
|
|
|
214
|
-
|
|
229
|
+
The actor contract, as an INTERFACE. It asks for two members: a reactive `state: Atom<TSnapshot>`, and a typed `send(event: TEvent): void`. It names no state machine library, so a consumer of the contract installs `xstate` never. An implementation satisfies it (e.g. [`PlayerActor`](../api/@xmachines/play-xstate/index/classes/PlayerActor.md)).
|
|
215
230
|
|
|
216
|
-
### [`Routable`](../api/@xmachines/play-
|
|
231
|
+
### [`Routable`](../api/@xmachines/play-router/index/interfaces/Routable.md)
|
|
217
232
|
|
|
218
|
-
Optional capability interface. Exposes `currentRoute:
|
|
233
|
+
Optional capability interface. Exposes `currentRoute: ReadonlyAtom<string | null>` (derived URL path) and `readonly initialRoute: string | null` (machine's initial route, fixed at definition time). Router bridges consume this interface directly — they never depend on the concrete [`PlayerActor`](../api/@xmachines/play-xstate/index/classes/PlayerActor.md).
|
|
219
234
|
|
|
220
|
-
### [`Viewable`](../api/@xmachines/play-
|
|
235
|
+
### [`Viewable`](../api/@xmachines/play-view/index/interfaces/Viewable.md)
|
|
221
236
|
|
|
222
|
-
Optional capability interface. Exposes `currentView:
|
|
237
|
+
Optional capability interface. Exposes `currentView: ReadonlyAtom<PlaySpec | null>`. View renderers (`PlayRenderer`) consume this contract to resolve the current view description into UI without coupling to the framework or actor implementation.
|
|
223
238
|
|
|
224
|
-
### [`PlaySpec`](../api/@xmachines/play-
|
|
239
|
+
### [`PlaySpec`](../api/@xmachines/play-view/index/interfaces/PlaySpec.md)
|
|
225
240
|
|
|
226
241
|
Extends `@xmachines/json-render-core` `Spec`. `deriveCurrentView` projects the machine's whole context into the derived spec's `state` under the read-only `/context` subtree, and stamps a `viewKey` from the selected meta entry so providers can reseed vs refresh their store. Specs read context through the ordinary `{ $state: "/context/…" }` grammar; element props are never enriched. `typedSpec()` type-checks the spec literal at the definition site (XState's `meta` is untyped).
|
|
227
242
|
|
|
228
|
-
### [`PlayerActor<TMachine>`](../api/@xmachines/play-xstate/classes/PlayerActor.md)
|
|
243
|
+
### [`PlayerActor<TMachine>`](../api/@xmachines/play-xstate/index/classes/PlayerActor.md)
|
|
244
|
+
|
|
245
|
+
Concrete XState v5 actor. It extends XState's own `Actor` directly, and it implements [`PlayActor`](../api/@xmachines/play-actor/interfaces/PlayActor.md). It receives the machine in its constructor, so an instance IS the actor rather than a wrapper around one. Bridges its own subscription to atoms. Exposes: `state`, `send()`, `start()`, `stop()`, `can()`.
|
|
246
|
+
|
|
247
|
+
[`Routable`](../api/@xmachines/play-router/index/interfaces/Routable.md) and [`Viewable`](../api/@xmachines/play-view/index/interfaces/Viewable.md) are OPTIONAL capabilities, and the class implements neither. Each one is a mixin behind its own entry point — [`@xmachines/play-xstate/routing`](../api/@xmachines/play-xstate/README.md) and [`@xmachines/play-xstate/view`](../api/@xmachines/play-xstate/README.md) — and `compose` builds the class that an application needs:
|
|
248
|
+
|
|
249
|
+
```typescript
|
|
250
|
+
definePlayer({ machine, actor: compose(PlayerActor, withRouting, withView) });
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
The core imports neither capability, so an application that declares no route loads no routing code, and one that renders no view loads no view code and installs no json-render.
|
|
254
|
+
|
|
255
|
+
**The composition order decides nothing.** `PlayerActor` writes ONE atom for each transition — `state` — and every capability that publishes a value DERIVES it with a computed atom over that one. The engine evaluates `currentRoute` and `currentView` from a single write, in topological order, so a router bridge sees a guard redirect and a renderer sees the view of the same snapshot whatever order `compose` applied.
|
|
229
256
|
|
|
230
|
-
|
|
257
|
+
An earlier release wrote `currentView` from an `onSnapshot` override, and the order was load-bearing there: two writes flushed two times, and an observer of `state` and `currentView` read the new state beside the old view in between. `onSnapshot` remains for a capability that must run an EFFECT on a transition, and an override still calls `super.onSnapshot()` first.
|
|
231
258
|
|
|
232
|
-
### [`definePlayer(config)`](../api/@xmachines/play-xstate/functions/definePlayer.md) → [`PlayerFactory`](../api/@xmachines/play-xstate/type-aliases/PlayerFactory.md)
|
|
259
|
+
### [`definePlayer(config)`](../api/@xmachines/play-xstate/index/functions/definePlayer.md) → [`PlayerFactory`](../api/@xmachines/play-xstate/index/type-aliases/PlayerFactory.md)
|
|
233
260
|
|
|
234
261
|
Factory creator. Each call constructs one `PlayerActor`, which is itself the XState actor and derives its own `initialRoute` from its pre-start snapshot. Restoring a snapshot is the exception: the default initial route can only come from XState's pure `initialTransition` helper, whose inert actor scope constructs a throwaway actor and evaluates the initial transition twice. Returns `(input?, restore?) => PlayerActor<TMachine>`.
|
|
235
262
|
|
|
@@ -241,7 +268,7 @@ const actor = createPlayer(); // or createPlayer(input) or createPlayer(undefine
|
|
|
241
268
|
actor.start();
|
|
242
269
|
```
|
|
243
270
|
|
|
244
|
-
### [`RouterBridgeBase`](../api/@xmachines/play-router/classes/RouterBridgeBase.md)
|
|
271
|
+
### [`RouterBridgeBase`](../api/@xmachines/play-router/index/classes/RouterBridgeBase.md)
|
|
245
272
|
|
|
246
273
|
Abstract base class capturing all common router bridge logic. Template Method pattern — subclasses implement exactly three abstract methods: `navigateRouter(path)`, `watchRouterChanges()`, `unwatchRouterChanges()`. Manages `isConnected`, `lastSyncedPath` (echo suppression), `isProcessingNavigation` (re-entrant guard redirect prevention), and `routeWatcher` lifecycle. Enforces one-bridge-per-actor via a module-level `WeakMap`.
|
|
247
274
|
|
|
@@ -259,11 +286,11 @@ class MyRouterBridge extends RouterBridgeBase {
|
|
|
259
286
|
}
|
|
260
287
|
```
|
|
261
288
|
|
|
262
|
-
### [`RouteMap`](../api/@xmachines/play-router/classes/RouteMap.md) / [`createRouteMap`](../api/@xmachines/play-router/functions/createRouteMap.md)
|
|
289
|
+
### [`RouteMap`](../api/@xmachines/play-router/index/classes/RouteMap.md) / [`createRouteMap`](../api/@xmachines/play-router/xstate/functions/createRouteMap.md)
|
|
263
290
|
|
|
264
|
-
Bidirectional `stateId ↔ URL path` lookup. [`createRouteMap(machine)`](../api/@xmachines/play-router/functions/createRouteMap.md) → [`RouteMap`](../api/@xmachines/play-router/classes/RouteMap.md). [`createRouteMapFromTree(routeTree)`](../api/@xmachines/play-router/functions/createRouteMapFromTree.md) takes the output of [`extractMachineRoutes(machine)`](../api/@xmachines/play-router/functions/extractMachineRoutes.md) directly.
|
|
291
|
+
Bidirectional `stateId ↔ URL path` lookup. [`createRouteMap(machine)`](../api/@xmachines/play-router/xstate/functions/createRouteMap.md) of [`@xmachines/play-router/xstate`](../api/@xmachines/play-router/README.md) → [`RouteMap`](../api/@xmachines/play-router/index/classes/RouteMap.md). [`createRouteMapFromTree(routeTree)`](../api/@xmachines/play-router/index/functions/createRouteMapFromTree.md) of [`@xmachines/play-router`](../api/@xmachines/play-router/README.md) takes the output of [`extractMachineRoutes(machine)`](../api/@xmachines/play-router/xstate/functions/extractMachineRoutes.md) directly. Both drop the synthetic root node of the tree, so neither map answers a state ID that the machine does not hold. The match of a parameterized route, for example `/profile/:userId`, uses `URLPattern` of [`@xmachines/play-url`](../api/@xmachines/play-url/README.md).
|
|
265
292
|
|
|
266
|
-
### [`PlayRouteEvent`](../api/@xmachines/play-router/interfaces/PlayRouteEvent.md)
|
|
293
|
+
### [`PlayRouteEvent`](../api/@xmachines/play-router/index/interfaces/PlayRouteEvent.md)
|
|
267
294
|
|
|
268
295
|
Unified routing event sent by router adapters to the Actor.
|
|
269
296
|
|
|
@@ -277,11 +304,11 @@ interface PlayRouteEvent {
|
|
|
277
304
|
}
|
|
278
305
|
```
|
|
279
306
|
|
|
280
|
-
### [`
|
|
307
|
+
### [`watchAtom(atom, callback)`](../api/@xmachines/play-atom/functions/watchAtom.md)
|
|
281
308
|
|
|
282
|
-
Subscribe to a single
|
|
309
|
+
Subscribe to a single atom with microtask coalescing and memory-safe cleanup. It builds one `subscribe` for the life of the watch, so no code arms anything again. The `disposed` flag guards post-cleanup callbacks, and the `scheduled` guard deduplicates rapid synchronous atom changes. Returns a `Cleanup` function.
|
|
283
310
|
|
|
284
|
-
### [`formatPlayRouteTransitions(machineConfig)`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md)
|
|
311
|
+
### [`formatPlayRouteTransitions(machineConfig)`](../api/@xmachines/play-xstate/with-routing/functions/formatPlayRouteTransitions.md)
|
|
285
312
|
|
|
286
313
|
Crawls machine state configs looking for states with `meta.route` and auto-generates `play.route` transition handlers at the root machine level. Each generated transition targets the matching state, guards on `event.to === "#stateId"`, and assigns `event.params` and `event.query` to context. Returns the same config type `T` — directly usable by `setup().createMachine()`.
|
|
287
314
|
|
|
@@ -291,26 +318,26 @@ All five view renderer packages follow an identical structural pattern:
|
|
|
291
318
|
|
|
292
319
|
| Component | Role |
|
|
293
320
|
| ---------------- | ------------------------------------------------------------------------------------------------ |
|
|
294
|
-
| `ActorProvider` | Subscribes to `actor.currentView`
|
|
321
|
+
| `ActorProvider` | Subscribes to the `actor.currentView` atom; owns the atom lifecycle; provides view context |
|
|
295
322
|
| `PlayUIProvider` | Convenience wrapper combining `ActorProvider` + framework's `JSONUIProvider` |
|
|
296
323
|
| `PlayRenderer` | Zero-prop leaf component; reads from context; delegates to `@xmachines/json-render-*` `Renderer` |
|
|
297
324
|
| `useActor()` | Hook/composable for accessing the raw actor in consuming components |
|
|
298
325
|
|
|
299
|
-
**Framework-specific
|
|
326
|
+
**Framework-specific atom bridging:**
|
|
300
327
|
|
|
301
|
-
| Package |
|
|
328
|
+
| Package | Atom → Render mechanism |
|
|
302
329
|
| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
303
|
-
| [`@xmachines/play-react`](../api/@xmachines/play-react/README.md) | `
|
|
330
|
+
| [`@xmachines/play-react`](../api/@xmachines/play-react/README.md) | `useAtomEffect` → `useReducer` force-update |
|
|
304
331
|
| [`@xmachines/play-vue`](../api/@xmachines/play-vue/README.md) | Vue reactivity bridge via `watchEffect` equivalent |
|
|
305
332
|
| [`@xmachines/play-solid`](../api/@xmachines/play-solid/README.md) | SolidJS native reactive integration |
|
|
306
333
|
| [`@xmachines/play-svelte`](../api/@xmachines/play-svelte/README.md) | Svelte 5 runes (`$effect`) via `actor-context.svelte.ts` |
|
|
307
334
|
| [`@xmachines/play-dom`](../api/@xmachines/play-dom/README.md) | Manual DOM updates via [`createPlayUI`](../api/@xmachines/play-dom/functions/createPlayUI.md) / [`createRenderer`](../api/@xmachines/play-dom/functions/createRenderer.md) / [`PlayRenderer`](../api/@xmachines/play-dom/classes/PlayRenderer.md) |
|
|
308
335
|
|
|
309
|
-
Per-view component state is managed by `@xstate/store`: a fresh store atom is created per [`PlaySpec`](../api/@xmachines/play-
|
|
336
|
+
Per-view component state is managed by `@xstate/store`: a fresh store atom is created per [`PlaySpec`](../api/@xmachines/play-view/index/interfaces/PlaySpec.md) transition (uncontrolled mode), or an external `store` prop is passed via `ActorProvider`/`PlayUIProvider` (controlled mode).
|
|
310
337
|
|
|
311
338
|
## Router Adapter Pattern
|
|
312
339
|
|
|
313
|
-
All eight router adapter packages follow the Template Method pattern via [`RouterBridgeBase`](../api/@xmachines/play-router/classes/RouterBridgeBase.md). Each adapter implements exactly three abstract methods:
|
|
340
|
+
All eight router adapter packages follow the Template Method pattern via [`RouterBridgeBase`](../api/@xmachines/play-router/index/classes/RouterBridgeBase.md). Each adapter implements exactly three abstract methods:
|
|
314
341
|
|
|
315
342
|
```typescript
|
|
316
343
|
// How to tell the framework router to change URL
|
|
@@ -342,24 +369,25 @@ Each adapter also exports a framework-integrated provider component (e.g. `PlayR
|
|
|
342
369
|
packages/
|
|
343
370
|
├── shared/ # Zero-dependency shared configs (tsconfig, oxlint, oxfmt, vitest)
|
|
344
371
|
├── play/ # Layer 0: Core protocol: PlayEvent, PlayError, assertNonNullable
|
|
345
|
-
├── play-
|
|
346
|
-
│ └── src/ #
|
|
347
|
-
├── play-actor/ # Layer
|
|
372
|
+
├── play-atom/ # Layer 1: the atom primitives — all atom imports go here
|
|
373
|
+
│ └── src/ # Declares the atom contract, binds the engine; watchAtom utility
|
|
374
|
+
├── play-actor/ # Layer 2: the PlayActor contract — state and send, and nothing else
|
|
375
|
+
├── play-pattern/ # Layer 1: the route pattern language — one parse, and the path it builds back
|
|
376
|
+
├── play-url/ # Layer 2: the URL layer — the URLPattern API, a base path, framework params
|
|
377
|
+
├── play-view/ # Layer 3: Viewable, PlaySpec, the view store lifecycle, the context projection
|
|
348
378
|
│
|
|
349
|
-
├── play-xstate/ # Layer
|
|
379
|
+
├── play-xstate/ # Layer 5: Concrete XState v5 actor: definePlayer, PlayerActor
|
|
350
380
|
│ └── src/
|
|
351
381
|
│ ├── player-actor.ts # PlayerActor — concrete actor
|
|
352
382
|
│ ├── define-player.ts # definePlayer factory
|
|
353
|
-
│ ├── guards/ # composeGuards, composeGuardsOr, negateGuard, hasContext...
|
|
354
383
|
│ ├── routing/ # deriveRoute, buildRouteUrl, formatPlayRouteTransitions
|
|
355
384
|
│ └── view/ # deriveCurrentView (meta.view → PlaySpec)
|
|
356
385
|
│
|
|
357
|
-
├── play-router/ # Layer
|
|
386
|
+
├── play-router/ # Layer 4: Route extraction, bidirectional mapping, bridge base
|
|
358
387
|
│ └── src/
|
|
359
388
|
│ ├── router-bridge-base.ts # RouterBridgeBase (Template Method for all adapters)
|
|
360
|
-
│ ├── extract-routes.ts # extractMachineRoutes → RouteTree
|
|
361
389
|
│ ├── base-route-map.ts # RouteMap (bidirectional stateId ↔ path)
|
|
362
|
-
│ ├──
|
|
390
|
+
│ ├── xstate/ # the machine half — extractMachineRoutes, createRouteMap
|
|
363
391
|
│ ├── router-sync.ts # buildPlayRouteEvent, extractRouteParams, sanitizePathname
|
|
364
392
|
│ └── types.ts # PlayRouteEvent, RouterBridge, RouteTree, WindowLike...
|
|
365
393
|
│
|
|
@@ -371,7 +399,7 @@ packages/
|
|
|
371
399
|
│
|
|
372
400
|
├── play-tanstack-react-router/ # Router adapter: TanStack Router (React)
|
|
373
401
|
├── play-tanstack-solid-router/ # Router adapter: TanStack Router (SolidJS)
|
|
374
|
-
├── play-react-router/ # Router adapter: React Router
|
|
402
|
+
├── play-react-router/ # Router adapter: React Router 7/8
|
|
375
403
|
├── play-vue-router/ # Router adapter: Vue Router 4/5
|
|
376
404
|
├── play-solid-router/ # Router adapter: SolidJS Router
|
|
377
405
|
├── play-svelte-spa-router/ # Router adapter: Svelte SPA Router
|
|
@@ -398,56 +426,39 @@ packages/<name>/
|
|
|
398
426
|
|
|
399
427
|
## TypeScript Build Graph
|
|
400
428
|
|
|
401
|
-
The monorepo uses **TypeScript composite project references** (`"composite": true` per package) for a correct, incremental, dependency-ordered build. The root `tsconfig.json` lists
|
|
429
|
+
The monorepo uses **TypeScript composite project references** (`"composite": true` per package) for a correct, incremental, dependency-ordered build. The root `tsconfig.json` lists every package in layer order — leaves first, dependents last — and it is the ONLY build order of the workspace. `tsc --build` at the root reads that array and resolves the graph.
|
|
402
430
|
|
|
403
|
-
|
|
404
|
-
flowchart LR
|
|
405
|
-
subgraph L0["Layer 0 — no internal deps"]
|
|
406
|
-
ps[play-signals]
|
|
407
|
-
p[play]
|
|
408
|
-
d[docs]
|
|
409
|
-
end
|
|
410
|
-
subgraph L1["Layer 1 — depends on L0"]
|
|
411
|
-
pa[play-actor]
|
|
412
|
-
end
|
|
413
|
-
subgraph L2["Layer 2 — depends on L0 + L1"]
|
|
414
|
-
pr[play-router]
|
|
415
|
-
pdr[play-dom-router]
|
|
416
|
-
psk[play-sveltekit-router]
|
|
417
|
-
px[play-xstate]
|
|
418
|
-
prea[play-react]
|
|
419
|
-
pv[play-vue]
|
|
420
|
-
pso[play-solid]
|
|
421
|
-
psv[play-svelte]
|
|
422
|
-
pdo[play-dom]
|
|
423
|
-
ptsr[play-tanstack-react-router]
|
|
424
|
-
pvr[play-vue-router]
|
|
425
|
-
psor[play-solid-router]
|
|
426
|
-
pssr[play-svelte-spa-router]
|
|
427
|
-
ptss[play-tanstack-solid-router]
|
|
428
|
-
end
|
|
429
|
-
subgraph L3["Layer 3 — examples / play-react-router"]
|
|
430
|
-
ex["play-react-router\nplay-*/examples/demo"]
|
|
431
|
-
end
|
|
431
|
+
**The layer table and the diagram live in [development.md](development.md#build-layers).** They stood here too, and the copy drifted: it kept the numbers of an earlier release, so a reader who added a package placed it in the wrong block of the root array. One home for the question, as for the `references` arrays that the root file replaced.
|
|
432
432
|
|
|
433
|
-
|
|
434
|
-
|
|
433
|
+
Two facts about the graph belong to this document, because they are architecture and not build order:
|
|
434
|
+
|
|
435
|
+
- **The routers read NO view package.** `play-router` and the eight adapters name `play-view` and the five renderers in no manifest. A consumer that routes and renders nothing of its own therefore installs no json-render.
|
|
436
|
+
- **The renderers read no router.** The two halves meet in the application alone, which is INV-02.
|
|
435
437
|
|
|
436
|
-
With `declarationMap: true` in the base tsconfig (from `@xmachines/shared/tsconfig`), IDE "Go to Definition" jumps to TypeScript source files rather than compiled `.d.ts` files, and refactoring works correctly across package boundaries without requiring a build step.
|
|
438
|
+
With `declarationMap: true` in the base tsconfig (from [`@xmachines/shared/tsconfig`](../api/@xmachines/shared/README.md)), IDE "Go to Definition" jumps to TypeScript source files rather than compiled `.d.ts` files, and refactoring works correctly across package boundaries without requiring a build step.
|
|
437
439
|
|
|
438
440
|
**Dependency rules:**
|
|
439
441
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
|
443
|
-
|
|
|
444
|
-
|
|
|
445
|
-
|
|
|
446
|
-
|
|
|
442
|
+
The **protocol layer** is `play`, `play-atom` and `play-actor`. The three form a chain — `play-atom` reads `play`, and `play-actor` reads `play-atom` — and none of them reads a package below.
|
|
443
|
+
|
|
444
|
+
| Layer | May import from | Must not import from |
|
|
445
|
+
| ------------------------------------- | ------------------------------------------------------- | -------------------------------- |
|
|
446
|
+
| Protocol (`play`) | External libs only | Any other `@xmachines/*` package |
|
|
447
|
+
| Protocol (`play-atom`) | `play`, `@xstate/store` | Any other `@xmachines/*` package |
|
|
448
|
+
| Protocol (`play-actor`) | `play`, `play-atom` | Any other `@xmachines/*` package |
|
|
449
|
+
| Pattern language (`play-pattern`) | External libs only | Any other `@xmachines/*` package |
|
|
450
|
+
| URL layer (`play-url`) | Protocol layer, `play-pattern`, `urlpattern-polyfill` | Any other `@xmachines/*` package |
|
|
451
|
+
| View half (`play-view`) | Protocol layer, `@xmachines/json-render-core` | Router adapters, framework code |
|
|
452
|
+
| Actor logic (`play-xstate`) | Protocol layer, `play-pattern`, `xstate` | View renderers, router adapters |
|
|
453
|
+
| Router infrastructure (`play-router`) | Protocol layer, `play-url`, `@statelyai/graph` | View renderers |
|
|
454
|
+
| Router adapters (`play-*-router`) | `play-router`, protocol layer, framework router lib | View renderers |
|
|
455
|
+
| View renderers (`play-*`) | Protocol layer, `play-view`, `@xmachines/json-render-*` | Router adapters |
|
|
456
|
+
|
|
457
|
+
`play-view` and `play-router` are OPTIONAL peer dependencies of `play-xstate`, because the two capability subpaths carry them: [`@xmachines/play-xstate/view`](../api/@xmachines/play-xstate/README.md) names the first and [`@xmachines/play-xstate/routing`](../api/@xmachines/play-xstate/README.md) names the second. The core entry point imports neither.
|
|
447
458
|
|
|
448
459
|
## Error Handling
|
|
449
460
|
|
|
450
|
-
All `@xmachines/*` errors extend [`PlayError`](../api/@xmachines/play/classes/PlayError.md) and carry two stable fields:
|
|
461
|
+
All `@xmachines/*` errors extend [`PlayError`](../api/@xmachines/play/errors/classes/PlayError.md) and carry two stable fields:
|
|
451
462
|
|
|
452
463
|
- `scope` — the class or module that threw (e.g. `"RouterBridgeBase"`)
|
|
453
464
|
- `code` — a stable machine-readable identifier (e.g. `"PLAY_ROUTER_SYNC_FAILED"`)
|
|
@@ -456,48 +467,46 @@ All `@xmachines/*` errors extend [`PlayError`](../api/@xmachines/play/classes/Pl
|
|
|
456
467
|
|
|
457
468
|
```mermaid
|
|
458
469
|
flowchart TD
|
|
459
|
-
PE["PlayError\n@xmachines/play"]
|
|
470
|
+
PE["PlayError\n@xmachines/play/errors"]
|
|
460
471
|
PE --> NNE["NonNullableError\nPLAY_NON_NULLABLE"]
|
|
461
472
|
PE --> RSE["RouterSyncError\nPLAY_ROUTER_SYNC_FAILED"]
|
|
462
|
-
PE --> UPE["URLPatternUnavailableError\nPLAY_ROUTE_MAP_URLPATTERN_UNAVAILABLE"]
|
|
463
473
|
PE --> DBE["DuplicateBridgeError\nPLAY_ROUTER_DUPLICATE_BRIDGE"]
|
|
464
474
|
PE --> IEE["InvalidEventError\nPLAY_XSTATE_INVALID_EVENT"]
|
|
465
475
|
PE --> IME["InvalidMachineError\nPLAY_XSTATE_INVALID_MACHINE"]
|
|
466
476
|
PE --> MRP["MissingRouteParamError\nPLAY_XSTATE_ROUTE_PARAM_MISSING"]
|
|
477
|
+
PE --> IRP["InvalidRouteParamError\nPLAY_XSTATE_ROUTE_PARAM_INVALID"]
|
|
467
478
|
PE --> MSI["MissingStateIdError\nPLAY_XSTATE_MISSING_STATE_ID"]
|
|
468
|
-
PE --> MQC["MissingQueryContextError\nPLAY_XSTATE_MISSING_QUERY_CONTEXT\n(deprecated — never thrown)"]
|
|
469
479
|
PE --> IRE["InvalidRouteMetadataError\nPLAY_XSTATE_INVALID_ROUTE_METADATA"]
|
|
470
480
|
PE --> ATN["ActorThrewNonErrorError\nPLAY_XSTATE_NON_ERROR_THROWN"]
|
|
471
|
-
PE --> EGA["EmptyGuardArrayError\nPLAY_XSTATE_EMPTY_GUARD_ARRAY"]
|
|
472
481
|
```
|
|
473
482
|
|
|
474
483
|
Package-specific errors are exported from `./errors` subpath imports:
|
|
475
484
|
|
|
476
485
|
```typescript
|
|
477
|
-
import { PlayError } from "@xmachines/play";
|
|
486
|
+
import { PlayError } from "@xmachines/play/errors";
|
|
478
487
|
import { RouterSyncError } from "@xmachines/play-router/errors";
|
|
479
488
|
import { InvalidEventError } from "@xmachines/play-xstate/errors";
|
|
480
489
|
```
|
|
481
490
|
|
|
482
491
|
**Error behavior by case:**
|
|
483
492
|
|
|
484
|
-
| Error
|
|
485
|
-
|
|
|
486
|
-
| `MissingRouteParamError`
|
|
487
|
-
| `
|
|
488
|
-
| `ActorThrewNonErrorError`
|
|
489
|
-
| `
|
|
490
|
-
| `
|
|
491
|
-
|
|
|
492
|
-
| `URLPatternUnavailableError` | `play-router` | URLPattern API missing — load `urlpattern-polyfill` |
|
|
493
|
-
| View errors | `play-xstate` | Caught in `validateAndCacheView()`; forwarded to `onError` hook; last valid view retained |
|
|
493
|
+
| Error | Package | Behavior |
|
|
494
|
+
| ------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
495
|
+
| `MissingRouteParamError` | `play-xstate` | Transient — `currentRoute` returns `null`; does not throw |
|
|
496
|
+
| `InvalidRouteParamError` | `play-xstate` | Permanent — `deriveCurrentRoute` passes it on: `currentRoute` reports it through `onError` and keeps its last route, and `initialRoute` throws from the constructor |
|
|
497
|
+
| `ActorThrewNonErrorError` | `play-xstate` | Constructed for `onError` when the machine throws a non-`Error`; original value on `cause` |
|
|
498
|
+
| `RouterSyncError` | `play-router` | Wraps router sync failures |
|
|
499
|
+
| `DuplicateBridgeError` | `play-router` | Two bridges registered for the same actor |
|
|
500
|
+
| View errors | `play-xstate` | Caught in the `currentView` atom; forwarded to `onError` hook; last valid view retained |
|
|
494
501
|
|
|
495
502
|
## Application Bootstrap (React example)
|
|
496
503
|
|
|
497
504
|
```typescript
|
|
498
505
|
import { setup } from "xstate";
|
|
499
|
-
import { definePlayer,
|
|
500
|
-
import {
|
|
506
|
+
import { definePlayer, compose, PlayerActor } from "@xmachines/play-xstate";
|
|
507
|
+
import { formatPlayRouteTransitions, withRouting } from "@xmachines/play-xstate/routing";
|
|
508
|
+
import { withView } from "@xmachines/play-xstate/view";
|
|
509
|
+
import { extractMachineRoutes } from "@xmachines/play-router/xstate";
|
|
501
510
|
import { createRouteMapFromTree, PlayRouterProvider } from "@xmachines/play-tanstack-react-router";
|
|
502
511
|
import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-react";
|
|
503
512
|
|
|
@@ -530,8 +539,8 @@ const machine = setup({}).createMachine(machineConfig);
|
|
|
530
539
|
const routeTree = extractMachineRoutes(machine);
|
|
531
540
|
const routeMap = createRouteMapFromTree(routeTree);
|
|
532
541
|
|
|
533
|
-
// 3. Create player factory and start actor
|
|
534
|
-
const createPlayer = definePlayer({ machine });
|
|
542
|
+
// 3. Create player factory and start actor — the providers need BOTH capabilities
|
|
543
|
+
const createPlayer = definePlayer({ machine, actor: compose(PlayerActor, withRouting, withView) });
|
|
535
544
|
const actor = createPlayer();
|
|
536
545
|
actor.start();
|
|
537
546
|
|
|
@@ -552,53 +561,53 @@ function App() {
|
|
|
552
561
|
|
|
553
562
|
## Anti-Patterns
|
|
554
563
|
|
|
555
|
-
### Importing `
|
|
564
|
+
### Importing `@xstate/store` directly
|
|
556
565
|
|
|
557
566
|
```typescript
|
|
558
|
-
// ❌ Wrong — bypasses the
|
|
559
|
-
import {
|
|
567
|
+
// ❌ Wrong — bypasses the atom isolation layer, and names the engine in your own .d.ts
|
|
568
|
+
import { createAtom } from "@xstate/store";
|
|
560
569
|
|
|
561
|
-
// ✅ Correct — all
|
|
562
|
-
import {
|
|
570
|
+
// ✅ Correct — all atom imports go through play-atom
|
|
571
|
+
import { createAtom } from "@xmachines/play-atom";
|
|
563
572
|
```
|
|
564
573
|
|
|
565
574
|
### Using framework state for business logic
|
|
566
575
|
|
|
567
576
|
```typescript
|
|
568
|
-
// ❌ Wrong — violates INV-
|
|
577
|
+
// ❌ Wrong — violates INV-03 (Atom-Only Reactivity) and INV-04 (Passive Infrastructure)
|
|
569
578
|
const [currentUser, setCurrentUser] = useState(null);
|
|
570
579
|
|
|
571
|
-
// ✅ Correct — observe the actor
|
|
580
|
+
// ✅ Correct — observe the actor atom directly
|
|
572
581
|
const currentUser = useActorSelector(actor, (s) => s.context.currentUser);
|
|
573
582
|
```
|
|
574
583
|
|
|
575
584
|
### Calling `navigateRouter` inside `watchRouterChanges`
|
|
576
585
|
|
|
577
|
-
Calling `navigateRouter()` before updating `lastSyncedPath` inside the `watchRouterChanges` callback causes an echo loop. The router navigation fires the watcher again, which sends a duplicate `play.route` event. Always update `lastSyncedPath` before calling `navigateRouter()` — see [`RouterBridgeBase`](../api/@xmachines/play-router/classes/RouterBridgeBase.md) source at `packages/play-router/src/router-bridge-base.ts`.
|
|
586
|
+
Calling `navigateRouter()` before updating `lastSyncedPath` inside the `watchRouterChanges` callback causes an echo loop. The router navigation fires the watcher again, which sends a duplicate `play.route` event. Always update `lastSyncedPath` before calling `navigateRouter()` — see [`RouterBridgeBase`](../api/@xmachines/play-router/index/classes/RouterBridgeBase.md) source at `packages/play-router/src/router-bridge-base.ts`.
|
|
578
587
|
|
|
579
588
|
### Skipping `sanitizePathname` in custom bridge implementations
|
|
580
589
|
|
|
581
|
-
Custom `watchRouterChanges()` implementations that bypass `syncActorFromRouter()` and process pathnames directly skip the length/content guards that protect the route-map lookup from malformed or oversized paths. Always call [`sanitizePathname(path)`](../api/@xmachines/play-router/functions/sanitizePathname.md) before processing.
|
|
590
|
+
Custom `watchRouterChanges()` implementations that bypass `syncActorFromRouter()` and process pathnames directly skip the length/content guards that protect the route-map lookup from malformed or oversized paths. Always call [`sanitizePathname(path)`](../api/@xmachines/play-router/index/functions/sanitizePathname.md) before processing.
|
|
582
591
|
|
|
583
592
|
## Cross-Cutting Concerns
|
|
584
593
|
|
|
585
|
-
**Circular update prevention:** `lastSyncedPath` in [`RouterBridgeBase`](../api/@xmachines/play-router/classes/RouterBridgeBase.md) provides echo suppression for the actor→router direction; `isProcessingNavigation` flag guards against re-entrant guard-redirect loops in `syncActorFromRouter`. `
|
|
594
|
+
**Circular update prevention:** `lastSyncedPath` in [`RouterBridgeBase`](../api/@xmachines/play-router/index/classes/RouterBridgeBase.md) provides echo suppression for the actor→router direction; `isProcessingNavigation` flag guards against re-entrant guard-redirect loops in `syncActorFromRouter`. `scheduled` in [`watchAtom`](../api/@xmachines/play-atom/functions/watchAtom.md) deduplicates rapid synchronous atom changes via microtask coalescing.
|
|
586
595
|
|
|
587
|
-
**SSR / test injection:** [`WindowLike`](../api/@xmachines/play-router/interfaces/WindowLike.md) and [`LocationLike`](../api/@xmachines/play-router/interfaces/LocationLike.md) structural interfaces in [`@xmachines/play-router`](../api/@xmachines/play-router/README.md) allow injecting mock objects in router adapters, enabling testing without a real browser environment.
|
|
596
|
+
**SSR / test injection:** [`WindowLike`](../api/@xmachines/play-router/index/interfaces/WindowLike.md) and [`LocationLike`](../api/@xmachines/play-router/index/interfaces/LocationLike.md) structural interfaces in [`@xmachines/play-router`](../api/@xmachines/play-router/README.md) allow injecting mock objects in router adapters, enabling testing without a real browser environment.
|
|
588
597
|
|
|
589
|
-
**Logging:** No structured logging framework. [`PlayerOptions`](../api/@xmachines/play-xstate/interfaces/PlayerOptions.md) exposes lifecycle hooks — `onStart`, `onStop`, `onTransition`, `onStateChange`, `onError` — as observability extension points. A renderer writes to `console.error` in ONE case: it contained a failure, and no handler of the host receives that failure. Such a failure is the one result that nobody can debug. Give `onError` to send the failure of a view to your own observability tool instead.
|
|
598
|
+
**Logging:** No structured logging framework. [`PlayerOptions`](../api/@xmachines/play-xstate/index/interfaces/PlayerOptions.md) exposes lifecycle hooks — `onStart`, `onStop`, `onTransition`, `onStateChange`, `onError` — as observability extension points. A renderer writes to `console.error` in ONE case: it contained a failure, and no handler of the host receives that failure. Such a failure is the one result that nobody can debug. Give `onError` to send the failure of a view to your own observability tool instead.
|
|
590
599
|
|
|
591
600
|
Five paths reach that case. The host gives no `onError` prop. The handler of the host throws, or the producer of the `fallback` throws, or a release of the caller throws — each of those reports the failure of the HOST, which no handler of the host receives. `ActorProvider` of play-vue stops a second report of one error, and `onError` stays silent there on purpose, because the four other renderers see such an error never.
|
|
592
601
|
|
|
593
|
-
Three other places write to `console.warn`, and each one reports a configuration that the library cannot refuse: `warnOnce` of `@xmachines/play-
|
|
602
|
+
Three other places write to `console.warn`, and each one reports a configuration that the library cannot refuse: `warnOnce` of [`@xmachines/play-view`](../api/@xmachines/play-view/README.md) names a `/context` projection that it cannot derive, one time for each spec; [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) names the `meta.view.contextProps` field that 1.x removed, one time for each spec; and [`@xmachines/play-router`](../api/@xmachines/play-router/README.md) names a `basePath` that a bridge with no mount ignores. A warning is the answer where a throw would stop an application for a fault that it can still run with. No other library source calls `console.*`.
|
|
594
603
|
|
|
595
604
|
**Authentication:** Not in scope. Enforced via XState guards on `play.route` transitions. The guard evaluates machine `context` (e.g., `isLoggedIn`) before permitting navigation. No library-level auth primitives — the machine defines all access control.
|
|
596
605
|
|
|
597
|
-
**
|
|
606
|
+
**Atom isolation:** All atom imports go through [`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md), which re-exports the atom of `@xstate/store`. This isolates the codebase from churn in that library — a version upgrade or API change requires editing only one package.
|
|
598
607
|
|
|
599
608
|
**Global state:** An `activeBridges` WeakMap at module level in `packages/play-router/src/router-bridge-base.ts` prevents duplicate bridges per actor. This is the only module-level mutable state in the library.
|
|
600
609
|
|
|
601
|
-
**Threading:** Single-threaded event loop. No worker threads. XState actor subscription callbacks fire synchronously in `send()`.
|
|
610
|
+
**Threading:** Single-threaded event loop. No worker threads. XState actor subscription callbacks fire synchronously in `send()`. Atom updates are synchronous to ensure router bridges see guard redirects immediately.
|
|
602
611
|
|
|
603
612
|
---
|
|
604
613
|
|