@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,19 +1,19 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-vue-router](../../README.md) / [index](../README.md) / RouterBridge
|
|
2
2
|
|
|
3
3
|
# Interface: RouterBridge
|
|
4
4
|
|
|
5
|
-
Defined in: [play-router/src/types.ts:
|
|
5
|
+
Defined in: [packages/play-router/src/types.ts:436](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v5.0.0/packages/play-router/src/types.ts#L436)
|
|
6
6
|
|
|
7
7
|
The RouterBridge interface of a runtime infrastructure adapter
|
|
8
8
|
|
|
9
9
|
The interface defines the connection of the lifecycle between the infrastructure,
|
|
10
10
|
for example a framework router, and the Actor. The infrastructure builds a "bridge"
|
|
11
|
-
to the Actor: it observes the
|
|
11
|
+
to the Actor: it observes the atoms of the Actor, and it manages its own
|
|
12
12
|
lifecycle accordingly.
|
|
13
13
|
|
|
14
14
|
**Architectural context:** the interface implements **Passive Infrastructure
|
|
15
15
|
(INV-04)**, because it gives an observation in one direction. The infrastructure
|
|
16
|
-
connects to observe the
|
|
16
|
+
connects to observe the atoms of the Actor (currentRoute, currentView, and
|
|
17
17
|
state), and it reflects each change. It makes no decision about the state.
|
|
18
18
|
|
|
19
19
|
## Example
|
|
@@ -22,31 +22,29 @@ The implementation of a framework router bridge
|
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
24
|
import type { RouterBridge } from "@xmachines/play-router";
|
|
25
|
-
import {
|
|
25
|
+
import { watchAtom, type Cleanup } from "@xmachines/play-atom";
|
|
26
26
|
|
|
27
27
|
class MyRouterBridge implements RouterBridge {
|
|
28
|
-
private
|
|
28
|
+
private stop: Cleanup | null = null;
|
|
29
29
|
|
|
30
30
|
async connect(): Promise<void> {
|
|
31
|
-
// Start the observation of the actor.currentRoute
|
|
32
|
-
this.
|
|
33
|
-
const route = actor.currentRoute.get();
|
|
31
|
+
// Start the observation of the actor.currentRoute atom
|
|
32
|
+
this.stop = watchAtom(actor.currentRoute, (route) => {
|
|
34
33
|
if (route) router.navigate(route);
|
|
35
34
|
});
|
|
36
|
-
this.watcher.watch(actor.currentRoute);
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
async disconnect(): Promise<void> {
|
|
40
|
-
// Stop the observation, and
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
38
|
+
// Stop the observation, and release the subscription
|
|
39
|
+
this.stop?.();
|
|
40
|
+
this.stop = null;
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
```
|
|
46
44
|
|
|
47
45
|
## See
|
|
48
46
|
|
|
49
|
-
[Play RFC](
|
|
47
|
+
[Play RFC](../../../../../rfc/play.md) - invariant INV-04
|
|
50
48
|
|
|
51
49
|
## Methods
|
|
52
50
|
|
|
@@ -56,12 +54,12 @@ class MyRouterBridge implements RouterBridge {
|
|
|
56
54
|
connect(): void | Promise<void>;
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
Defined in: [play-router/src/types.ts:
|
|
57
|
+
Defined in: [packages/play-router/src/types.ts:453](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v5.0.0/packages/play-router/src/types.ts#L453)
|
|
60
58
|
|
|
61
59
|
Connects the router bridge to the Actor
|
|
62
60
|
|
|
63
61
|
The infrastructure calls it when it must start the observation of the Actor
|
|
64
|
-
|
|
62
|
+
atoms, and when it must bring its own state, for example the browser URL, in line
|
|
65
63
|
with the Actor state.
|
|
66
64
|
|
|
67
65
|
#### Returns
|
|
@@ -75,7 +73,7 @@ The promise that resolves after the connection, or void for a synchronous connec
|
|
|
75
73
|
```typescript
|
|
76
74
|
const bridge: RouterBridge = createBridge(actor, router);
|
|
77
75
|
await bridge.connect();
|
|
78
|
-
// The bridge observes the actor.currentRoute
|
|
76
|
+
// The bridge observes the actor.currentRoute atom now
|
|
79
77
|
```
|
|
80
78
|
|
|
81
79
|
---
|
|
@@ -86,12 +84,12 @@ await bridge.connect();
|
|
|
86
84
|
disconnect(): void | Promise<void>;
|
|
87
85
|
```
|
|
88
86
|
|
|
89
|
-
Defined in: [play-router/src/types.ts:
|
|
87
|
+
Defined in: [packages/play-router/src/types.ts:469](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v5.0.0/packages/play-router/src/types.ts#L469)
|
|
90
88
|
|
|
91
89
|
Disconnects the router bridge from the Actor
|
|
92
90
|
|
|
93
91
|
The infrastructure calls it when it must stop the observation and free its
|
|
94
|
-
resources, for example
|
|
92
|
+
resources, for example an atom watcher and an event listener.
|
|
95
93
|
|
|
96
94
|
#### Returns
|
|
97
95
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[API](
|
|
1
|
+
[API](../../../../README.md) / [@xmachines/play-vue-router](../../README.md) / [index](../README.md) / PlayRouterProvider
|
|
2
2
|
|
|
3
3
|
# Variable: PlayRouterProvider
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ const PlayRouterProvider: DefineComponent<
|
|
|
7
7
|
ExtractPropTypes<{
|
|
8
8
|
actor: {
|
|
9
9
|
required: true;
|
|
10
|
-
type: PropType<
|
|
10
|
+
type: PropType<RoutableActor>;
|
|
11
11
|
};
|
|
12
12
|
basePath: {
|
|
13
13
|
default: undefined;
|
|
@@ -19,6 +19,16 @@ const PlayRouterProvider: DefineComponent<
|
|
|
19
19
|
required: false;
|
|
20
20
|
type: PropType<Record<string, string | number>>;
|
|
21
21
|
};
|
|
22
|
+
compiledCache: {
|
|
23
|
+
default: undefined;
|
|
24
|
+
required: false;
|
|
25
|
+
type: PropType<PatternCache<URLPatternLike>>;
|
|
26
|
+
};
|
|
27
|
+
patternCache: {
|
|
28
|
+
default: undefined;
|
|
29
|
+
required: false;
|
|
30
|
+
type: PropType<PatternCache<ParsedPattern>>;
|
|
31
|
+
};
|
|
22
32
|
renderer: {
|
|
23
33
|
required: true;
|
|
24
34
|
type: PropType<(actor, router) => VNodeChild>;
|
|
@@ -45,7 +55,7 @@ const PlayRouterProvider: DefineComponent<
|
|
|
45
55
|
ExtractPropTypes<{
|
|
46
56
|
actor: {
|
|
47
57
|
required: true;
|
|
48
|
-
type: PropType<
|
|
58
|
+
type: PropType<RoutableActor>;
|
|
49
59
|
};
|
|
50
60
|
basePath: {
|
|
51
61
|
default: undefined;
|
|
@@ -57,6 +67,16 @@ const PlayRouterProvider: DefineComponent<
|
|
|
57
67
|
required: false;
|
|
58
68
|
type: PropType<Record<string, string | number>>;
|
|
59
69
|
};
|
|
70
|
+
compiledCache: {
|
|
71
|
+
default: undefined;
|
|
72
|
+
required: false;
|
|
73
|
+
type: PropType<PatternCache<URLPatternLike>>;
|
|
74
|
+
};
|
|
75
|
+
patternCache: {
|
|
76
|
+
default: undefined;
|
|
77
|
+
required: false;
|
|
78
|
+
type: PropType<PatternCache<ParsedPattern>>;
|
|
79
|
+
};
|
|
60
80
|
renderer: {
|
|
61
81
|
required: true;
|
|
62
82
|
type: PropType<(actor, router) => VNodeChild>;
|
|
@@ -75,6 +95,8 @@ const PlayRouterProvider: DefineComponent<
|
|
|
75
95
|
{
|
|
76
96
|
basePath: string;
|
|
77
97
|
basePathParams: Record<string, string | number>;
|
|
98
|
+
compiledCache: PatternCache<URLPatternLike>;
|
|
99
|
+
patternCache: PatternCache<ParsedPattern>;
|
|
78
100
|
},
|
|
79
101
|
{},
|
|
80
102
|
{},
|
|
@@ -87,7 +109,7 @@ const PlayRouterProvider: DefineComponent<
|
|
|
87
109
|
>;
|
|
88
110
|
```
|
|
89
111
|
|
|
90
|
-
Defined in: [play-vue-router/src/play-router-provider.ts:
|
|
112
|
+
Defined in: [packages/play-vue-router/src/play-router-provider.ts:18](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v5.0.0/packages/play-vue-router/src/play-router-provider.ts#L18)
|
|
91
113
|
|
|
92
114
|
PlayRouterProvider — the Vue wrapper of VueRouterBridge.
|
|
93
115
|
|
|
@@ -2,25 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
# @xmachines/play-xstate
|
|
4
4
|
|
|
5
|
-
> XState v5 adapter for the XMachines Play Architecture. It binds a state machine to the actor base, with
|
|
5
|
+
> XState v5 adapter for the XMachines Play Architecture. It binds a state machine to the actor base, with atom-driven reactivity and a router integration.
|
|
6
6
|
|
|
7
|
-
[](https://opensource.org/licenses/MIT) [](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-xstate)
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
> **Browser floor: Chrome 110, Firefox 115, Safari 16.4.** This package calls the ES2023
|
|
12
12
|
> change-by-copy array methods, so a browser below that floor throws
|
|
13
|
-
> `TypeError: ... is not a function`.
|
|
14
|
-
> `baseline-widely-available` target to Firefox 114, which is below it — raise
|
|
15
|
-
> `build.target` when you bundle for the browser. The root README carries the table.
|
|
13
|
+
> `TypeError: ... is not a function`. The root README carries the table.
|
|
16
14
|
|
|
17
15
|
## Installation
|
|
18
16
|
|
|
19
17
|
```bash
|
|
20
|
-
pnpm add @xmachines/play-xstate xstate
|
|
18
|
+
pnpm add @xmachines/play-xstate @xmachines/play @xmachines/play-atom xstate
|
|
21
19
|
```
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
**Peer dependencies.** Install them with the package:
|
|
22
|
+
|
|
23
|
+
- [`@xmachines/play`](../play/README.md) — the core protocol. This package reads `shallowEqualExcept` and `DISPOSE` from it.
|
|
24
|
+
- [`@xmachines/play-atom`](../play-atom/README.md) — the atom primitives. `PlayerActor` holds `currentView` and `currentRoute` as atoms.
|
|
25
|
+
- `xstate` ^5.33.0 — the XState v5 runtime.
|
|
26
|
+
|
|
27
|
+
**Optional peers.** Each capability subpath carries one. Install it when you read that subpath, and not before:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add @xmachines/play-router # @xmachines/play-xstate/routing
|
|
31
|
+
pnpm add @xmachines/play-view # @xmachines/play-xstate/view
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
- [`@xmachines/play-router`](../play-router/README.md) — the routing capability reads `Routable`, `PlayRouteEvent` and `RouteData` from it.
|
|
35
|
+
- [`@xmachines/play-view`](../play-view/README.md) — the view capability reads `composePlayState`, `PlaySpec` and `Viewable` from it.
|
|
24
36
|
|
|
25
37
|
---
|
|
26
38
|
|
|
@@ -28,7 +40,8 @@ pnpm add @xmachines/play-xstate xstate
|
|
|
28
40
|
|
|
29
41
|
```typescript
|
|
30
42
|
import { setup } from "xstate";
|
|
31
|
-
import { definePlayer } from "@xmachines/play-xstate";
|
|
43
|
+
import { definePlayer, compose, PlayerActor } from "@xmachines/play-xstate";
|
|
44
|
+
import { withRouting } from "@xmachines/play-xstate/routing";
|
|
32
45
|
|
|
33
46
|
// 1. Define your XState v5 machine
|
|
34
47
|
const machine = setup({}).createMachine({
|
|
@@ -40,13 +53,13 @@ const machine = setup({}).createMachine({
|
|
|
40
53
|
});
|
|
41
54
|
|
|
42
55
|
// 2. Create a player factory
|
|
43
|
-
const createPlayer = definePlayer({ machine });
|
|
56
|
+
const createPlayer = definePlayer({ machine, actor: compose(PlayerActor, withRouting) });
|
|
44
57
|
|
|
45
58
|
// 3. Instantiate and start an actor
|
|
46
59
|
const actor = createPlayer();
|
|
47
60
|
actor.start();
|
|
48
61
|
|
|
49
|
-
// 4. Observe
|
|
62
|
+
// 4. Observe atom-based reactive state
|
|
50
63
|
console.log(actor.currentRoute.get()); // "/"
|
|
51
64
|
console.log(actor.state.get().value); // "idle"
|
|
52
65
|
|
|
@@ -135,16 +148,91 @@ console.log(restored.currentRoute.get()); // same route as when saved
|
|
|
135
148
|
|
|
136
149
|
### `PlayerActor<TMachine>`
|
|
137
150
|
|
|
138
|
-
This concrete actor class is an XState v5 actor that
|
|
151
|
+
This concrete actor class is an XState v5 actor that exposes reactive atoms. It holds the protocol of `PlayActor` and nothing else: `state` and `send`.
|
|
152
|
+
|
|
153
|
+
#### Atoms
|
|
154
|
+
|
|
155
|
+
| Atom | Type | Description |
|
|
156
|
+
| ------- | ------------------------------ | ---------------------------------------------------------------------------- |
|
|
157
|
+
| `state` | `Atom<SnapshotFrom<TMachine>>` | The current XState snapshot. The actor updates it on every active transition |
|
|
158
|
+
|
|
159
|
+
### The capabilities
|
|
139
160
|
|
|
140
|
-
|
|
161
|
+
Routing and the view are OPTIONAL, and each one is a mixin behind its own entry point. An application that declares no route loads no routing code, and an application that renders no view loads no view code and installs no json-render.
|
|
141
162
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
163
|
+
Each capability package is an OPTIONAL peer dependency. Install the one that you compose:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pnpm add @xmachines/play-router # for @xmachines/play-xstate/routing
|
|
167
|
+
pnpm add @xmachines/play-view # for @xmachines/play-xstate/view
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The main entry point of this package names neither. `@xmachines/play-xstate/routing` also
|
|
171
|
+
carries the route utilities — `deriveRoute`, `isAbsoluteRoute`, `buildRouteUrl`,
|
|
172
|
+
`formatPlayRouteTransitions` and the route types — because each one names
|
|
173
|
+
[`@xmachines/play-router`](../play-router/README.md) in its own types.
|
|
174
|
+
|
|
175
|
+
| Capability | Entry point | Adds | Interface |
|
|
176
|
+
| ---------- | -------------------------------- | ------------------------------ | ------------------------------------------------------------------ |
|
|
177
|
+
| Routing | `@xmachines/play-xstate/routing` | `currentRoute`, `initialRoute` | `Routable` of [`@xmachines/play-router`](../play-router/README.md) |
|
|
178
|
+
| View | `@xmachines/play-xstate/view` | `currentView` | `Viewable` of [`@xmachines/play-view`](../play-view/README.md) |
|
|
179
|
+
|
|
180
|
+
`compose` applies each capability from left to right:
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import { definePlayer, PlayerActor, compose } from "@xmachines/play-xstate";
|
|
184
|
+
import { withRouting } from "@xmachines/play-xstate/routing";
|
|
185
|
+
import { withView } from "@xmachines/play-xstate/view";
|
|
186
|
+
|
|
187
|
+
// Both capabilities
|
|
188
|
+
const createPlayer = definePlayer({
|
|
189
|
+
machine,
|
|
190
|
+
actor: compose(PlayerActor, withRouting, withView),
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// Routing alone: `currentView` is a compile error on this actor
|
|
194
|
+
const createRouted = definePlayer({ machine, actor: compose(PlayerActor, withRouting) });
|
|
195
|
+
|
|
196
|
+
// Neither: `state` and `send`
|
|
197
|
+
const createBare = definePlayer({ machine });
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
**The composition ORDER decides nothing.** `currentRoute` and `currentView` are computed atoms over `state`, and neither reads the other, so one write for each transition reaches both and the engine evaluates them in topological order. A router bridge therefore sees a guard redirect and a renderer sees the view of the same snapshot, whatever order `compose` applied. A release before this one wrote `currentView` from an `onSnapshot` override, and the order was load-bearing there.
|
|
201
|
+
|
|
202
|
+
**A lifecycle hook receives the bare actor.** `PlayerOptions` is typed before the class is composed, so it cannot name the capabilities, and a narrower hook parameter is refused under `strictFunctionTypes`. A hook that reads `currentRoute` or `currentView` reads them through a binding of the composed type:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
let composed: PlayerActor<typeof machine> & Routable & Viewable;
|
|
206
|
+
|
|
207
|
+
const actor = definePlayer({
|
|
208
|
+
machine,
|
|
209
|
+
options: { onStateChange: () => console.log(composed.currentRoute.get()) },
|
|
210
|
+
actor: compose(PlayerActor, withRouting, withView),
|
|
211
|
+
})();
|
|
212
|
+
composed = actor;
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
| Atom | Type | Capability | Description |
|
|
216
|
+
| -------------- | -------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
217
|
+
| `currentRoute` | `ReadonlyAtom<string \| null>` | routing | The URL that comes from the `meta.route` template of the active state and from the context |
|
|
218
|
+
| `initialRoute` | `readonly string \| null` | routing | The route of the initial state of the machine. The construction fixes it, and a router bridge uses it to detect a deep link or a restore |
|
|
219
|
+
| `currentView` | `ReadonlyAtom<PlaySpec \| null>` | view | The view spec from the `meta.view` metadata of the active state, with the context params added |
|
|
220
|
+
|
|
221
|
+
`state` is the ONE atom that the actor writes. `currentRoute` and `currentView` are
|
|
222
|
+
COMPUTED over it, so one write for each transition reaches both in one propagation and no
|
|
223
|
+
observer reads the new state beside an old derivation. Each derivation reports a failure
|
|
224
|
+
through the `onError` option and keeps its last good value; it throws never, because it
|
|
225
|
+
runs inside the write.
|
|
226
|
+
|
|
227
|
+
**`currentRoute` notifies on every transition, and `currentView` notifies on a change of
|
|
228
|
+
the view alone.** The two atoms answer two different questions. A router bridge needs the
|
|
229
|
+
answer of the actor to each event that it proposed, and a guard that refuses an inbound
|
|
230
|
+
location and holds the machine where it was derives the SAME path — so `currentRoute`
|
|
231
|
+
compares "different" always, and the bridge learns that the address bar must go back.
|
|
232
|
+
`currentView` gates its emission on the value, and a snapshot that changes no view on the
|
|
233
|
+
screen keeps the previous reference, so a provider below it mounts the UI again not on
|
|
234
|
+
every event. Debounce your own `watchAtom(actor.currentRoute, ...)` callback, or compare
|
|
235
|
+
the path yourself, when you run work that belongs to a change of the route alone.
|
|
148
236
|
|
|
149
237
|
#### Methods
|
|
150
238
|
|
|
@@ -155,59 +243,45 @@ This concrete actor class is an XState v5 actor that also exposes reactive TC39
|
|
|
155
243
|
| `send(event)` | Sends a typed event to the machine and calls the `onTransition` hook |
|
|
156
244
|
| `can(event)` | Returns `true` when the current state accepts the given event |
|
|
157
245
|
| `getSnapshot()` | Returns the current XState snapshot |
|
|
158
|
-
| `dispose()` | The alias of `stop()`. Deprecated — call `stop()`, or write `using` |
|
|
159
246
|
| `[DISPOSE]()` | Stops the actor at the end of a `using` scope. The release is `stop()` |
|
|
160
247
|
|
|
161
|
-
####
|
|
248
|
+
#### Atom usage example
|
|
162
249
|
|
|
163
250
|
```typescript
|
|
164
|
-
import {
|
|
251
|
+
import { watchAtom } from "@xmachines/play-atom";
|
|
165
252
|
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
console.log("Route changed:", actor.currentRoute.get());
|
|
169
|
-
});
|
|
253
|
+
const stop = watchAtom(actor.currentRoute, (route) => {
|
|
254
|
+
console.log("Route changed:", route);
|
|
170
255
|
});
|
|
171
256
|
|
|
172
|
-
watcher.watch(actor.currentRoute);
|
|
173
257
|
actor.start();
|
|
258
|
+
|
|
259
|
+
// Later, on teardown
|
|
260
|
+
stop();
|
|
174
261
|
```
|
|
175
262
|
|
|
176
263
|
---
|
|
177
264
|
|
|
178
|
-
###
|
|
179
|
-
|
|
180
|
-
> **Deprecated:** these guard helpers wrap the `and()`, `or()`, and `not()`
|
|
181
|
-
> combinators of XState, but they do not compose with a guard slot that
|
|
182
|
-
> `setup()` types. Use the combinators of XState directly. The next major
|
|
183
|
-
> version removes this module.
|
|
265
|
+
### Guards
|
|
184
266
|
|
|
185
|
-
|
|
267
|
+
This package gives no guard utility. Compose a guard with the `and()`, `or()` and `not()` combinators of XState:
|
|
186
268
|
|
|
187
269
|
```typescript
|
|
188
|
-
import { setup } from "xstate";
|
|
189
|
-
import {
|
|
190
|
-
composeGuards, // AND logic: all guards must pass
|
|
191
|
-
composeGuardsOr, // OR logic: at least one guard must pass
|
|
192
|
-
negateGuard, // NOT logic: inverts a guard
|
|
193
|
-
hasContext, // guard: context field is present and non-null
|
|
194
|
-
eventMatches, // guard: event type matches a string
|
|
195
|
-
contextFieldMatches, // guard: context field equals a value
|
|
196
|
-
} from "@xmachines/play-xstate";
|
|
270
|
+
import { and, not, setup } from "xstate";
|
|
197
271
|
|
|
198
272
|
const machine = setup({
|
|
199
273
|
guards: {
|
|
200
|
-
isLoggedIn: ({ context }) =>
|
|
274
|
+
isLoggedIn: ({ context }) => context.userId !== "",
|
|
201
275
|
hasAdminRole: ({ context }) => context.role === "admin",
|
|
202
276
|
},
|
|
203
277
|
}).createMachine({
|
|
204
278
|
on: {
|
|
205
279
|
accessAdmin: {
|
|
206
|
-
guard:
|
|
280
|
+
guard: and(["isLoggedIn", "hasAdminRole"]),
|
|
207
281
|
target: "adminPanel",
|
|
208
282
|
},
|
|
209
283
|
accessLogin: {
|
|
210
|
-
guard:
|
|
284
|
+
guard: not("isLoggedIn"),
|
|
211
285
|
target: "login",
|
|
212
286
|
},
|
|
213
287
|
},
|
|
@@ -215,6 +289,10 @@ const machine = setup({
|
|
|
215
289
|
});
|
|
216
290
|
```
|
|
217
291
|
|
|
292
|
+
A combinator resolves each name against the `guards` of `setup()`. A name that the map does not hold therefore fails to compile, and it names the fault: `Type '"typoGuardName"' is not assignable to type '"isLoggedIn"'`.
|
|
293
|
+
|
|
294
|
+
`composeGuards`, `composeGuardsOr`, `negateGuard`, `hasContext`, `eventMatches` and `contextFieldMatches` stood here before. They closed two gaps of the types of XState 5.28. The peer floor of this package is `^5.33.0`, and 5.33 holds neither gap. The helpers also fitted a guard slot that `setup()` types never: the example of this package reached them through an `as never` cast. Write the combinator instead, and write a plain predicate in place of each helper.
|
|
295
|
+
|
|
218
296
|
---
|
|
219
297
|
|
|
220
298
|
### Routing utilities
|
|
@@ -227,7 +305,7 @@ This function reads each machine state that has a `meta.route` field. It then ge
|
|
|
227
305
|
|
|
228
306
|
```typescript
|
|
229
307
|
import { setup } from "xstate";
|
|
230
|
-
import { formatPlayRouteTransitions } from "@xmachines/play-xstate";
|
|
308
|
+
import { formatPlayRouteTransitions } from "@xmachines/play-xstate/routing";
|
|
231
309
|
|
|
232
310
|
const config = formatPlayRouteTransitions({
|
|
233
311
|
id: "app",
|
|
@@ -311,17 +389,75 @@ import type {
|
|
|
311
389
|
PlayerOptions, // Lifecycle hooks (onStart, onStop, onTransition, onStateChange, onError) + inspect
|
|
312
390
|
PlayerFactory, // Factory function returned by definePlayer()
|
|
313
391
|
PlayerFactoryResumeOptions, // { snapshot? } for restoring actor state
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
392
|
+
} from "@xmachines/play-xstate";
|
|
393
|
+
|
|
394
|
+
import type {
|
|
317
395
|
RouteMachineConfig, // Minimal machine config accepted by formatPlayRouteTransitions
|
|
318
396
|
RouteStateNode, // Single state node shape used during route crawling
|
|
319
397
|
RouteContext, // Context shape expected by buildRouteUrl ({ params?, query?, basePath?, hash? })
|
|
320
|
-
RouteObject, // Route metadata object shape: { path
|
|
398
|
+
RouteObject, // Route metadata object shape: { path, reenter?, handler?, data? }
|
|
321
399
|
RouteMetadata, // Union: string | RouteObject
|
|
322
|
-
|
|
400
|
+
RouteData, // The resolved extra data of a route: Record<string, unknown>
|
|
401
|
+
RouteDataResolver, // The function form of RouteObject.data
|
|
402
|
+
} from "@xmachines/play-xstate/routing";
|
|
323
403
|
```
|
|
324
404
|
|
|
405
|
+
`RouteObject`, `RouteMetadata`, `RouteData`, and `RouteDataResolver` have one
|
|
406
|
+
definition, and it lives in [`@xmachines/play-router`](../play-router/README.md). `@xmachines/play-xstate/routing`
|
|
407
|
+
re-exports them, so either import path gives you the same type. The MAIN entry point of
|
|
408
|
+
this package re-exports them no longer: it would name an optional peer in the types of
|
|
409
|
+
every consumer, including one that composes no routing.
|
|
410
|
+
|
|
411
|
+
### The object form of `meta.route`
|
|
412
|
+
|
|
413
|
+
The string form declares the path only. The object form declares the path and the
|
|
414
|
+
behaviour of the generated `play.route` transition:
|
|
415
|
+
|
|
416
|
+
```typescript
|
|
417
|
+
meta: {
|
|
418
|
+
route: {
|
|
419
|
+
path: "/doc/:docId",
|
|
420
|
+
// Where the generated transition sits. The default is "root", which is what
|
|
421
|
+
// XState does: every route transition sits on the root of the machine.
|
|
422
|
+
// "root" — one transition on the root. A route from any state arrives.
|
|
423
|
+
// "local" — one transition on the PARENT. The parent keeps its entry action,
|
|
424
|
+
// and a route from outside the parent arrives NOWHERE.
|
|
425
|
+
// "both" — one in each place. The parent keeps its entry action, and a route
|
|
426
|
+
// from outside the parent still arrives.
|
|
427
|
+
handler: "both",
|
|
428
|
+
// Whether the transition re-enters its OWN DOMAIN. The default is false, which
|
|
429
|
+
// is the default of XState. Under `handler: "root"` the domain is the root of
|
|
430
|
+
// the machine, so `false` spares the root alone: each ancestor between the root
|
|
431
|
+
// and the target still runs its exit and its entry actions. `handler` is the
|
|
432
|
+
// field that spares those intermediate ancestors.
|
|
433
|
+
reenter: false,
|
|
434
|
+
// The extra data of the route. The generated transition assigns it to
|
|
435
|
+
// `context.data`. A literal value, or a function of { context, event }.
|
|
436
|
+
data: { titleKey: "doc.view" },
|
|
437
|
+
},
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
An unknown `handler` value throws `InvalidRouteHandlerError` at the format time.
|
|
442
|
+
|
|
443
|
+
> **Upgrading from 3.x: the `reenter` default changed, and a machine that relies on it
|
|
444
|
+
> goes quiet.** An earlier release wrote `reenter: true` on EVERY generated transition,
|
|
445
|
+
> so every routed state re-entered its own domain on each navigation and ran its `entry`
|
|
446
|
+
> actions again. The flag is now what `meta.route` declares, and the default is `false` —
|
|
447
|
+
> which is the default of XState. A state whose `entry` action must run on each
|
|
448
|
+
> navigation has to declare `reenter: true` for itself. Nothing throws, and the action
|
|
449
|
+
> simply stops running.
|
|
450
|
+
|
|
451
|
+
The `data` field follows the `WithDynamicParams` shape of XState, so the function form
|
|
452
|
+
reads the context and the event:
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
data: ({ context, event }) => ({ title: `Document ${event.params?.docId}` });
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
A function does not survive `JSON.stringify`. Use the literal form for a machine that
|
|
459
|
+
Stately Studio reads, or that a process sends over a wire.
|
|
460
|
+
|
|
325
461
|
---
|
|
326
462
|
|
|
327
463
|
## Error Classes
|
|
@@ -331,31 +467,17 @@ The `@xmachines/play-xstate/errors` subpath exports the error classes. The main
|
|
|
331
467
|
```typescript
|
|
332
468
|
import {
|
|
333
469
|
MissingRouteParamError, // Required :param absent from context when resolving currentRoute
|
|
334
|
-
|
|
470
|
+
InvalidRouteParamError, // A :param carries a dot segment, which a URL resolves away
|
|
335
471
|
MissingStateIdError, // meta.route declared without a state id field
|
|
336
472
|
InvalidMachineError, // PlayerActor constructed with a non-object machine
|
|
337
473
|
InvalidEventError, // actor.send() called with null/undefined/non-object
|
|
338
474
|
ActorThrewNonErrorError, // actor failed with a thrown value that is not an Error
|
|
339
475
|
InvalidRouteMetadataError, // meta.route is neither a string nor { path: string }
|
|
340
|
-
|
|
476
|
+
InvalidRouteHandlerError, // meta.route.handler is not "root", "local", or "both"
|
|
341
477
|
} from "@xmachines/play-xstate/errors";
|
|
342
478
|
```
|
|
343
479
|
|
|
344
|
-
Every error class extends `PlayError` from `@xmachines/play
|
|
345
|
-
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
## Testing
|
|
349
|
-
|
|
350
|
-
```bash
|
|
351
|
-
# Run tests for this package in isolation
|
|
352
|
-
pnpm --filter @xmachines/play-xstate test
|
|
353
|
-
|
|
354
|
-
# Watch mode
|
|
355
|
-
pnpm --filter @xmachines/play-xstate run test:watch
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
The tests use [Vitest](https://vitest.dev/). They are in `packages/play-xstate/test/`.
|
|
480
|
+
Every error class extends `PlayError` from [`@xmachines/play/errors`](../play/README.md). Each class also carries typed detail fields, such as `param`, `template`, and `handler`. Your code therefore reads the details of an error, and it does not parse the message.
|
|
359
481
|
|
|
360
482
|
---
|
|
361
483
|
|
|
@@ -363,52 +485,9 @@ The tests use [Vitest](https://vitest.dev/). They are in `packages/play-xstate/t
|
|
|
363
485
|
|
|
364
486
|
MIT — see [LICENSE](LICENSE) for details.
|
|
365
487
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
This package gives you the definePlayer() API. That function binds an XState state
|
|
369
|
-
machine to the actor base, with the signal lifecycle and the DevTools
|
|
370
|
-
integration.
|
|
371
|
-
|
|
372
|
-
The Play RFC gives this package as the adapter of the logic layer. It converts a
|
|
373
|
-
declarative machine definition into a live actor with a signal-driven
|
|
374
|
-
reactivity.
|
|
375
|
-
|
|
376
|
-
## Classes
|
|
377
|
-
|
|
378
|
-
- [PlayerActor](classes/PlayerActor.md)
|
|
379
|
-
|
|
380
|
-
## Interfaces
|
|
381
|
-
|
|
382
|
-
- [PlayerConfig](interfaces/PlayerConfig.md)
|
|
383
|
-
- [PlayerFactoryResumeOptions](interfaces/PlayerFactoryResumeOptions.md)
|
|
384
|
-
- [PlayerOptions](interfaces/PlayerOptions.md)
|
|
385
|
-
- [RouteContext](interfaces/RouteContext.md)
|
|
386
|
-
- [RouteObject](interfaces/RouteObject.md)
|
|
387
|
-
|
|
388
|
-
## Type Aliases
|
|
389
|
-
|
|
390
|
-
- [~~ComposedGuard~~](type-aliases/ComposedGuard.md)
|
|
391
|
-
- [~~Guard~~](type-aliases/Guard.md)
|
|
392
|
-
- [~~GuardArray~~](type-aliases/GuardArray.md)
|
|
393
|
-
- [PlayerFactory](type-aliases/PlayerFactory.md)
|
|
394
|
-
- [RouteMachineConfig](type-aliases/RouteMachineConfig.md)
|
|
395
|
-
- [RouteMetadata](type-aliases/RouteMetadata.md)
|
|
396
|
-
- [RouteStateNode](type-aliases/RouteStateNode.md)
|
|
397
|
-
|
|
398
|
-
## Variables
|
|
399
|
-
|
|
400
|
-
- [DISPOSE](variables/DISPOSE.md)
|
|
401
|
-
|
|
402
|
-
## Functions
|
|
488
|
+
## Modules
|
|
403
489
|
|
|
404
|
-
- [
|
|
405
|
-
- [
|
|
406
|
-
- [
|
|
407
|
-
- [
|
|
408
|
-
- [definePlayer](functions/definePlayer.md)
|
|
409
|
-
- [deriveRoute](functions/deriveRoute.md)
|
|
410
|
-
- [~~eventMatches~~](functions/eventMatches.md)
|
|
411
|
-
- [formatPlayRouteTransitions](functions/formatPlayRouteTransitions.md)
|
|
412
|
-
- [~~hasContext~~](functions/hasContext.md)
|
|
413
|
-
- [isAbsoluteRoute](functions/isAbsoluteRoute.md)
|
|
414
|
-
- [~~negateGuard~~](functions/negateGuard.md)
|
|
490
|
+
- [errors](errors/README.md)
|
|
491
|
+
- [index](index/README.md)
|
|
492
|
+
- [with-routing](with-routing/README.md)
|
|
493
|
+
- [with-view](with-view/README.md)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-xstate](../README.md) / errors
|
|
2
|
+
|
|
3
|
+
# errors
|
|
4
|
+
|
|
5
|
+
## Classes
|
|
6
|
+
|
|
7
|
+
- [ActorThrewNonErrorError](classes/ActorThrewNonErrorError.md)
|
|
8
|
+
- [InvalidEventError](classes/InvalidEventError.md)
|
|
9
|
+
- [InvalidMachineError](classes/InvalidMachineError.md)
|
|
10
|
+
- [InvalidRouteHandlerError](classes/InvalidRouteHandlerError.md)
|
|
11
|
+
- [InvalidRouteMetadataError](classes/InvalidRouteMetadataError.md)
|
|
12
|
+
- [InvalidRouteParamError](classes/InvalidRouteParamError.md)
|
|
13
|
+
- [MissingRouteParamError](classes/MissingRouteParamError.md)
|
|
14
|
+
- [MissingStateIdError](classes/MissingStateIdError.md)
|