@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
|
@@ -11,6 +11,7 @@ This guide covers everything you need to set up a local development environment,
|
|
|
11
11
|
- [TypeScript Composite Build System](#typescript-composite-build-system)
|
|
12
12
|
- [Code Style](#code-style)
|
|
13
13
|
- [Writing Style](#writing-style-asd-ste100)
|
|
14
|
+
- [Link a Package That You Name](#link-a-package-that-you-name)
|
|
14
15
|
- [Branch Conventions](#branch-conventions)
|
|
15
16
|
- [PR Process](#pr-process)
|
|
16
17
|
|
|
@@ -82,14 +83,17 @@ The repository is organized as a **pnpm workspaces** monorepo with all packages
|
|
|
82
83
|
packages/
|
|
83
84
|
├── shared/ # Shared configs (tsconfig, oxlint, oxfmt, vitest)
|
|
84
85
|
├── play/ # Core protocol (PlayEvent, PlayError)
|
|
85
|
-
├── play-
|
|
86
|
-
├── play-
|
|
86
|
+
├── play-atom/ # The atom primitives over @xstate/store
|
|
87
|
+
├── play-pattern/ # The route pattern language: one parse, and the path it builds back
|
|
88
|
+
├── play-url/ # The URL layer: the URLPattern API, a base path, framework params
|
|
89
|
+
├── play-actor/ # The actor contract (PlayActor). It names no engine
|
|
90
|
+
├── play-view/ # The shared view half (Viewable, PlaySpec, the view store lifecycle)
|
|
87
91
|
├── play-xstate/ # XState v5 adapter (definePlayer, PlayerActor)
|
|
88
92
|
├── play-router/ # Route extraction and RouterBridgeBase
|
|
89
93
|
├── play-dom/ # Vanilla DOM renderer
|
|
90
94
|
├── play-dom-router/ # DOM router adapter
|
|
91
95
|
├── play-react/ # React renderer (PlayRenderer)
|
|
92
|
-
├── play-react-router/ # React Router
|
|
96
|
+
├── play-react-router/ # React Router 7/8 adapter
|
|
93
97
|
├── play-vue/ # Vue 3 renderer
|
|
94
98
|
├── play-vue-router/ # Vue Router adapter
|
|
95
99
|
├── play-solid/ # SolidJS renderer
|
|
@@ -181,6 +185,22 @@ What that costs is worth stating plainly: **CI only ever exercises the dev versi
|
|
|
181
185
|
|
|
182
186
|
React 18 and vue-router 4 are supported by intent — nothing known depends on 19-only or 5-only behaviour — but neither is installed by any job, so a regression there would surface as a consumer's bug report rather than a red pipeline. Narrowing either range to what is tested would be a breaking change for consumers and needs a major release; adding a floor-install job would close the gap instead. Until one of those happens, treat the lower major as untested.
|
|
183
187
|
|
|
188
|
+
### The packages that must exist one time
|
|
189
|
+
|
|
190
|
+
[`@xmachines/play`](../api/@xmachines/play/README.md) and [`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md) are a peer of every package that reads them, and a dependency of none.
|
|
191
|
+
|
|
192
|
+
[`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md) re-exports the atom of `@xstate/store`, and that library holds the active subscriber in a variable of its own module. Two copies build two graphs. A computed atom of the first copy and a subscription of the second copy therefore never meet: the subscriber stays silent, and no error reports the fault. Every propagation of state in this architecture goes through an atom, so the second copy stops the reactivity of a whole application.
|
|
193
|
+
|
|
194
|
+
[`@xmachines/play`](../api/@xmachines/play/README.md) holds `PlayError`, and the documentation sends a consumer to `err instanceof PlayError`. That check answers `false` for an error of the second copy.
|
|
195
|
+
|
|
196
|
+
A dependency invites that second copy. `scripts/lib/workspace-deps.mjs` pins a `workspace:*` range to an EXACT version, so two packages of two releases name two versions, and an installer resolves both. A peer moves the choice to the consumer, who brings one copy. The `@xmachines/json-render-*` packages carry the same rule for the same reason.
|
|
197
|
+
|
|
198
|
+
Each of the two needs a `devDependency` beside the peer, because the workspace installs no peer. Without that entry a package resolves the specifier through the hoisting of another package, and it compiles until that other package stops declaring it.
|
|
199
|
+
|
|
200
|
+
`tests/singleton-peers.test.ts` holds the three rules true: no dependency, a dev entry beside each peer, and a peer for each one that `src/` imports. A package that reads one of the two in its TESTS alone needs the dev entry alone — [`@xmachines/play-tanstack-router`](../api/@xmachines/play-tanstack-router/README.md) is that case.
|
|
201
|
+
|
|
202
|
+
The rule reads in both directions. A peer that the `src/` directory never imports is a peer that a consumer installs for nothing, and four router adapters carried one. A package declares the peer when it reads the package, and a `devDependency` alone when its tests read it.
|
|
203
|
+
|
|
184
204
|
---
|
|
185
205
|
|
|
186
206
|
## TypeScript Composite Build System
|
|
@@ -201,14 +221,15 @@ Packages are grouped into dependency layers as defined in the root `tsconfig.jso
|
|
|
201
221
|
| Layer | Packages | Depends on |
|
|
202
222
|
| ----- | -------------------------------------------------------------------------------- | ------------------ |
|
|
203
223
|
| 0 | `docs`, `play`, `shared` | External libs only |
|
|
204
|
-
| 1 | `play-
|
|
205
|
-
| 2 | `play-actor`
|
|
206
|
-
| 3 | `play-
|
|
207
|
-
| 4 | `play-
|
|
208
|
-
| 5 | `play-
|
|
209
|
-
| 6 |
|
|
210
|
-
| 7 |
|
|
211
|
-
| 8 | router
|
|
224
|
+
| 1 | `play-atom`, `play-pattern` | Layer 0 |
|
|
225
|
+
| 2 | `play-actor`, `play-url` | Layers 0–1 |
|
|
226
|
+
| 3 | `play-view` | Layers 0–2 |
|
|
227
|
+
| 4 | `play-dom`, `play-react`, `play-router`, `play-solid`, `play-svelte`, `play-vue` | Layers 0–3 |
|
|
228
|
+
| 5 | `play-tanstack-router`, `play-xstate` | Layers 0–4 |
|
|
229
|
+
| 6 | `play-actor/examples/shared` | Layers 0–5 |
|
|
230
|
+
| 7 | renderer demo apps | Layers 0–6 |
|
|
231
|
+
| 8 | the eight router adapters | Layers 0–7 |
|
|
232
|
+
| 9 | router demo apps | Layers 0–8 |
|
|
212
233
|
|
|
213
234
|
The layer of an entry is its longest path to a package with no workspace dependency, and `tests/tsconfig-reference-graph.test.ts` computes it from the manifests.
|
|
214
235
|
|
|
@@ -223,14 +244,20 @@ flowchart LR
|
|
|
223
244
|
end
|
|
224
245
|
|
|
225
246
|
subgraph L1["Layer 1"]
|
|
226
|
-
play-
|
|
247
|
+
play-atom
|
|
248
|
+
play-pattern
|
|
227
249
|
end
|
|
228
250
|
|
|
229
251
|
subgraph L2["Layer 2"]
|
|
230
252
|
play-actor
|
|
253
|
+
play-url
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
subgraph L3["Layer 3"]
|
|
257
|
+
play-view
|
|
231
258
|
end
|
|
232
259
|
|
|
233
|
-
subgraph
|
|
260
|
+
subgraph L4["Layer 4 — view renderers, and the router core"]
|
|
234
261
|
play-dom
|
|
235
262
|
play-react
|
|
236
263
|
play-router
|
|
@@ -239,31 +266,31 @@ flowchart LR
|
|
|
239
266
|
play-vue
|
|
240
267
|
end
|
|
241
268
|
|
|
242
|
-
subgraph
|
|
269
|
+
subgraph L5["Layer 5"]
|
|
243
270
|
play-tanstack-router
|
|
244
271
|
play-xstate
|
|
245
272
|
end
|
|
246
273
|
|
|
247
|
-
subgraph
|
|
274
|
+
subgraph L6["Layer 6"]
|
|
248
275
|
actorshared["play-actor/examples/shared"]
|
|
249
276
|
end
|
|
250
277
|
|
|
251
|
-
subgraph
|
|
278
|
+
subgraph L7["Layer 7"]
|
|
252
279
|
renderdemos["renderer demo apps"]
|
|
253
280
|
end
|
|
254
281
|
|
|
255
|
-
subgraph
|
|
282
|
+
subgraph L8["Layer 8 — the eight router adapters"]
|
|
256
283
|
adapters["play-dom-router, play-react-router, play-solid-router,
|
|
257
284
|
play-svelte-spa-router, play-sveltekit-router,
|
|
258
285
|
play-tanstack-react-router, play-tanstack-solid-router,
|
|
259
286
|
play-vue-router"]
|
|
260
287
|
end
|
|
261
288
|
|
|
262
|
-
subgraph
|
|
289
|
+
subgraph L9["Layer 9"]
|
|
263
290
|
routerdemos["router demo apps"]
|
|
264
291
|
end
|
|
265
292
|
|
|
266
|
-
L0 --> L1 --> L2 --> L3 --> L4 --> L5 --> L6 --> L7 --> L8
|
|
293
|
+
L0 --> L1 --> L2 --> L3 --> L4 --> L5 --> L6 --> L7 --> L8 --> L9
|
|
267
294
|
```
|
|
268
295
|
|
|
269
296
|
### Adding a New Package
|
|
@@ -294,15 +321,11 @@ flowchart LR
|
|
|
294
321
|
}
|
|
295
322
|
```
|
|
296
323
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
"compilerOptions": { "skipLibCheck": true },
|
|
303
|
-
"references": [{ "path": "../play" }, { "path": "../play-actor" }]
|
|
304
|
-
}
|
|
305
|
-
```
|
|
324
|
+
Declare no `references` here. TypeScript does not inherit a `references` array
|
|
325
|
+
through `extends`, so an array in this file orders nothing: `--showConfig` on the
|
|
326
|
+
package reports `references: None`. A package declares its dependencies in
|
|
327
|
+
`package.json`, with a `workspace:*` range, and the root `tsconfig.json` holds the
|
|
328
|
+
one build order. Step 4 below adds the entry.
|
|
306
329
|
|
|
307
330
|
3. **`tsconfig.json`** — enable composite build:
|
|
308
331
|
|
|
@@ -337,7 +360,7 @@ All style rules are **mandatory** — CI enforces them on every merge request.
|
|
|
337
360
|
|
|
338
361
|
### Formatter — oxfmt
|
|
339
362
|
|
|
340
|
-
oxfmt (Biome-based) is configured via `oxfmt.config.ts` at the root (extends `@xmachines/shared/oxfmt`).
|
|
363
|
+
oxfmt (Biome-based) is configured via `oxfmt.config.ts` at the root (extends [`@xmachines/shared/oxfmt`](../api/@xmachines/shared/README.md)).
|
|
341
364
|
|
|
342
365
|
```bash
|
|
343
366
|
pnpm run format # Format all files
|
|
@@ -357,7 +380,7 @@ Key settings (from `packages/shared/config/oxfmt.config.ts`):
|
|
|
357
380
|
|
|
358
381
|
### Linter — oxlint
|
|
359
382
|
|
|
360
|
-
oxlint is configured via `oxlint.config.ts` at the root (extends `@xmachines/shared/oxlint`).
|
|
383
|
+
oxlint is configured via `oxlint.config.ts` at the root (extends [`@xmachines/shared/oxlint`](../api/@xmachines/shared/README.md)).
|
|
361
384
|
|
|
362
385
|
```bash
|
|
363
386
|
pnpm run lint # Lint all packages
|
|
@@ -386,7 +409,7 @@ Active plugins: `typescript`, `unicorn`, `import`. Key rules:
|
|
|
386
409
|
|
|
387
410
|
### TypeScript Strict Mode
|
|
388
411
|
|
|
389
|
-
All packages extend `@xmachines/shared/tsconfig` which enables full strict mode. Mandatory constraints:
|
|
412
|
+
All packages extend [`@xmachines/shared/tsconfig`](../api/@xmachines/shared/README.md) which enables full strict mode. Mandatory constraints:
|
|
390
413
|
|
|
391
414
|
| Option | Value |
|
|
392
415
|
| ---------------------------- | ------ |
|
|
@@ -447,13 +470,37 @@ The root `AGENTS.md` carries the same rules for AI coding agents.
|
|
|
447
470
|
|
|
448
471
|
---
|
|
449
472
|
|
|
473
|
+
## Link a Package That You Name
|
|
474
|
+
|
|
475
|
+
A document that names a package of this workspace links to the page of that package. A reader who meets a package name in the middle of a paragraph needs the page of that package, and a code span gives no way to reach it.
|
|
476
|
+
|
|
477
|
+
Write the link against the place that holds the document:
|
|
478
|
+
|
|
479
|
+
| Document | Link |
|
|
480
|
+
| ------------------------------------------------------------ | -------------------------------------- |
|
|
481
|
+
| `packages/<name>/README.md` | `../<target>/README.md` |
|
|
482
|
+
| `packages/<name>/examples/<demo>/README.md` | `../../../<target>/README.md` |
|
|
483
|
+
| `packages/docs/{guides,contributing,rfc,examples}/<file>.md` | `../api/@xmachines/<target>/README.md` |
|
|
484
|
+
|
|
485
|
+
A subpath names the package that holds it, so [`@xmachines/play-router/xstate`](../api/@xmachines/play-router/README.md) links to the README of [`@xmachines/play-router`](../api/@xmachines/play-router/README.md).
|
|
486
|
+
|
|
487
|
+
Three places keep a plain code span:
|
|
488
|
+
|
|
489
|
+
- A code block. The text is code, and an import specifier is not a reference to follow.
|
|
490
|
+
- A heading. The heading names the section, and the body links the package.
|
|
491
|
+
- The README of the package itself. A page does not link to itself.
|
|
492
|
+
|
|
493
|
+
`tests/package-mentions-are-linked.test.ts` holds the rule true. It reads every README and every hand-written document of `packages/docs/`, and it fails when a mention carries no link, or when the link names a file that is absent.
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
450
497
|
## Branch Conventions
|
|
451
498
|
|
|
452
499
|
Use a `<type>/` prefix that matches the conventional commit type for the work being done:
|
|
453
500
|
|
|
454
501
|
```
|
|
455
502
|
feat/vue-router-adapter
|
|
456
|
-
fix/
|
|
503
|
+
fix/atom-subscription-cleanup
|
|
457
504
|
docs/play-actor-jsdoc
|
|
458
505
|
chore/update-vitest-4
|
|
459
506
|
refactor/route-map-extraction
|
|
@@ -500,12 +547,34 @@ This project uses **Conventional Commits** — changelogs and version bumps are
|
|
|
500
547
|
| `perf` | No bump (unless breaking) | Performance improvements |
|
|
501
548
|
| `ci` | No bump | CI/CD pipeline changes |
|
|
502
549
|
|
|
503
|
-
Breaking changes: append `!` after the type (`feat!:`)
|
|
550
|
+
Breaking changes: append `!` after the type (`feat!:`) AND write a `BREAKING CHANGE:`
|
|
551
|
+
footer. The two do different work, and neither one replaces the other:
|
|
552
|
+
|
|
553
|
+
- The `!` decides the BUMP. `release.config.mjs` gives both semantic-release plugins a
|
|
554
|
+
`breakingHeaderPattern`, because the angular preset reads `!` not at all: without that
|
|
555
|
+
pattern, `feat!: …` parses with no type, and a release made of nothing but such commits
|
|
556
|
+
is no release.
|
|
557
|
+
- The footer writes the NOTE. The changelog lists a breaking change from the footer alone,
|
|
558
|
+
so a `!` commit with no footer bumps the major and tells a reader nothing about what
|
|
559
|
+
broke. Seven commits shipped that way once, and none of them appears in `CHANGELOG.md`.
|
|
560
|
+
|
|
561
|
+
Write the footer as one paragraph that names the old form and the new one:
|
|
562
|
+
|
|
563
|
+
```
|
|
564
|
+
refactor(play-actor)!: make the actor contract an interface
|
|
565
|
+
|
|
566
|
+
BREAKING CHANGE: `AbstractActor` is removed. Use the `PlayActor` interface, and extend
|
|
567
|
+
the actor class of your engine directly.
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
Keep every other line of the body from starting with a `word: ` prefix. The parser reads
|
|
571
|
+
such a line as a footer token, and a line that opens with "BREAKING CHANGE" inside a
|
|
572
|
+
wrapped paragraph therefore announces a major that nobody intended.
|
|
504
573
|
|
|
505
574
|
Use the package short-name as scope when the change is isolated to one package:
|
|
506
575
|
|
|
507
576
|
```
|
|
508
|
-
fix(play-actor): correct
|
|
577
|
+
fix(play-actor): correct atom cleanup on dispose
|
|
509
578
|
feat(play-react): add PlayRenderer suspense boundary
|
|
510
579
|
```
|
|
511
580
|
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Migrating to `@xmachines/play-atom`
|
|
2
|
+
|
|
3
|
+
`@xmachines/play-signals` is gone. [`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md) replaces it.
|
|
4
|
+
|
|
5
|
+
The old package wrapped the [TC39 Signals](https://github.com/tc39/proposal-signals) polyfill. The new package re-exports the atom of [`@xstate/store`](https://stately.ai/docs/xstate-store), whose reactive core adapts the [Alien Signals](https://github.com/stackblitz/alien-signals) algorithm.
|
|
6
|
+
|
|
7
|
+
The two APIs agree on the shape: both read with `get()`, and both write with `set()`. A codemod therefore does most of the work. Three behaviours differ, and no codemod can decide those for you — read [What the codemod cannot do](#what-the-codemod-cannot-do).
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
Every renderer of this workspace already imported `createAtom` from `@xstate/store`, for the state store of the view. Every application therefore shipped TWO reactive graphs: the Signals polyfill for the actor, the route and the view, and the atom for the view store. The move collapses them into one.
|
|
14
|
+
|
|
15
|
+
It also drops about 3 KB gzip, and it inherits the diamond fix and the `compare` option that merge request [statelyai/xstate#5250](https://github.com/statelyai/xstate/pull/5250) landed.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Run the codemod
|
|
20
|
+
|
|
21
|
+
The script travels with the repository, and no package publishes it. Download it first:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
curl -O https://gitlab.com/xmachin-es/xmachines-js/-/raw/main/scripts/codemod-play-atom.mjs
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Look first. It writes nothing.
|
|
29
|
+
node codemod-play-atom.mjs --dry-run .
|
|
30
|
+
|
|
31
|
+
# Then write.
|
|
32
|
+
node codemod-play-atom.mjs .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The codemod reads `.ts`, `.tsx`, `.mts`, `.cts`, `.js`, `.jsx`, `.mjs`, `.vue`, `.svelte`, `.md` and `.json`, so it covers a manifest and a single-file component too. It skips `node_modules`, `dist`, `coverage` and every generated API directory.
|
|
36
|
+
|
|
37
|
+
It exits non-zero when it finds a site that needs a human, and it names each one.
|
|
38
|
+
|
|
39
|
+
Install the new package afterwards:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pnpm remove @xmachines/play-signals
|
|
43
|
+
pnpm add @xmachines/play-atom @xstate/store
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## The name table
|
|
49
|
+
|
|
50
|
+
| `@xmachines/play-signals` | [`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md) |
|
|
51
|
+
| ------------------------------------------ | --------------------------------------------------------------- |
|
|
52
|
+
| `new Signal.State(value)` | `createAtom(value)` |
|
|
53
|
+
| `new Signal.Computed(fn)` | `createAtom(fn)` |
|
|
54
|
+
| `Signal.State<T>` (type) | `Atom<T>` |
|
|
55
|
+
| `Signal.Computed<T>` (type) | `ReadonlyAtom<T>` |
|
|
56
|
+
| `SignalState<T>` / `SignalComputed<T>` | `Atom<T>` / `ReadonlyAtom<T>` |
|
|
57
|
+
| `{ equals }` | `{ compare }` |
|
|
58
|
+
| `SignalOptions<T>` / `ComputedOptions<T>` | `AtomOptions<T>` |
|
|
59
|
+
| `watchSignal(signal, onValue)` | `watchAtom(atom, onValue)` |
|
|
60
|
+
| `useSignalEffect(cb, deps)` (`play-react`) | `useAtomEffect(sources, cb, deps)` |
|
|
61
|
+
| `Signal.subtle.Watcher` | `atom.subscribe(fn)`, or `watchAtom` |
|
|
62
|
+
| `Signal.subtle.untrack(fn)` | — no equivalent. See below |
|
|
63
|
+
| `signal.set(value)` | `atom.set(value)`, and `atom.set(fn)` |
|
|
64
|
+
|
|
65
|
+
`createAtom` also accepts a function in `set`, which `Signal.State` did not.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## What the codemod cannot do
|
|
70
|
+
|
|
71
|
+
### 1. A computed atom with a subscriber is EAGER
|
|
72
|
+
|
|
73
|
+
A TC39 `Signal.Computed` stayed lazy. A watcher notified, and the consumer read the value when it chose to.
|
|
74
|
+
|
|
75
|
+
`@xstate/store` builds a subscription on an effect that READS the atom. A write to a dependency therefore evaluates the derivation at once, inside that write.
|
|
76
|
+
|
|
77
|
+
What this changes:
|
|
78
|
+
|
|
79
|
+
- A derivation runs one time for each write of a dependency, and not one time for each microtask. Keep a derivation cheap, and keep it free of a side effect that must not repeat.
|
|
80
|
+
- `useAtomEffect` of [`@xmachines/play-react`](../api/@xmachines/play-react/README.md) runs your callback from `watchAtom`, which coalesces. Three writes in one tick therefore run the callback ONE time, with the last value, exactly as `useSignalEffect` did. The eagerness above applies to the DERIVATION, and not to your callback.
|
|
81
|
+
|
|
82
|
+
A computed atom that nobody subscribes to still stays lazy.
|
|
83
|
+
|
|
84
|
+
**Write ONE atom for each change, and derive the rest.** The library exposes no batching, so every `set` flushes by itself: two writes give two propagations, and an observer that reads both atoms is evaluated in between, on a half-updated pair. The actor of this workspace writes `state` alone for that reason, and `currentRoute` and `currentView` derive from it. If your own code writes two atoms that must agree, make one of them a `createAtom(fn)` over the other.
|
|
85
|
+
|
|
86
|
+
### 2. The propagation is SYNCHRONOUS, inside `set`
|
|
87
|
+
|
|
88
|
+
An observer of `subscribe` runs inside the `set` of the atom that changed. An observer that THROWS therefore throws inside that `set`, and the failure lands in the code that wrote the atom — a failure of one view would break the actor for every other observer of it.
|
|
89
|
+
|
|
90
|
+
Contain it. `watchAtom` does this for you, because it defers the callback to a microtask. `useAtomEffect` catches a throw of a later run and throws it again from a microtask, which reaches the global handler of the runtime.
|
|
91
|
+
|
|
92
|
+
If you call `subscribe` directly, wrap the body.
|
|
93
|
+
|
|
94
|
+
**A DERIVATION must contain its own failures.** A subscriber makes a computed atom eager, so the derivation itself runs inside the `set`, before any observer. No subscriber can wrap that, so the rule belongs to the derivation: report through your error channel, and return the previous value. `currentRoute` and `currentView` of the actor both do this, and a release before this one let `currentRoute` throw — which was safe only while the TC39 watcher read it from a microtask.
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// A derivation that a subscriber may watch.
|
|
98
|
+
const derived = createAtom((previous) => {
|
|
99
|
+
try {
|
|
100
|
+
return expensiveDerivation(source.get());
|
|
101
|
+
} catch (error) {
|
|
102
|
+
report(error);
|
|
103
|
+
return previous ?? null;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### 3. There is no `untrack`
|
|
109
|
+
|
|
110
|
+
`@xstate/store` exports no equivalent of `Signal.subtle.untrack`, because it keeps the active subscriber in a variable of its own module.
|
|
111
|
+
|
|
112
|
+
**Derive the value, and read `previous`.** Almost every `untrack` guarded the same shape: a gate that compares the new value with the last one it emitted. A computed atom is handed that last value, so the gate needs no read and therefore tracks nothing. `withView` of [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) is the worked example:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// Before: a written atom, plus untrack to read what it held.
|
|
116
|
+
this.currentView = new Signal.State<View | null>(null);
|
|
117
|
+
const last = Signal.subtle.untrack(() => this.currentView.get());
|
|
118
|
+
if (!equivalent(last, next)) this.currentView.set(next);
|
|
119
|
+
|
|
120
|
+
// After: a computed atom. `previous` IS what the atom holds.
|
|
121
|
+
this.currentView = createAtom((previous): View | null => {
|
|
122
|
+
const last = previous ?? null;
|
|
123
|
+
const next = derive(this.state.get());
|
|
124
|
+
return equivalent(last, next) ? last : next;
|
|
125
|
+
});
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The second form is shorter, and it removes more than the `untrack`: the atom stops being written, so the gate keeps no bookkeeping of its own.
|
|
129
|
+
|
|
130
|
+
A read that already stands outside every computed atom and every effect tracks nothing, so it needs no wrapper at all.
|
|
131
|
+
|
|
132
|
+
### 4. `useAtomEffect` takes the sources first
|
|
133
|
+
|
|
134
|
+
`useSignalEffect(callback, deps)` tracked every signal that its callback read. `useAtomEffect(sources, callback, deps)` tracks the atoms of its FIRST argument, and the callback runs OUTSIDE the tracking scope.
|
|
135
|
+
|
|
136
|
+
The codemod renames the call, and it cannot write the source list. Add that array yourself, and move the callback one place to the right:
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// Before
|
|
140
|
+
useSignalEffect(() => {
|
|
141
|
+
setView(actor.currentView.get());
|
|
142
|
+
}, [actor]);
|
|
143
|
+
|
|
144
|
+
// After
|
|
145
|
+
useAtomEffect(
|
|
146
|
+
[actor.currentView],
|
|
147
|
+
() => {
|
|
148
|
+
setView(actor.currentView.get());
|
|
149
|
+
},
|
|
150
|
+
[actor],
|
|
151
|
+
);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The list is the reason the hook exists in this form: a callback that reads a view store no longer depends on that store, so a write of the store runs the effect never. Name every atom that must run the effect, and read whatever else you need inside the callback.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Install ONE copy of `@xstate/store`
|
|
159
|
+
|
|
160
|
+
`@xstate/store` holds the active subscriber in a variable of its own module. Two copies build two separate graphs: a computed atom of the first copy and a subscription of the second copy never meet, the subscriber stays silent, and no error reports the fault.
|
|
161
|
+
|
|
162
|
+
[`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md) declares `@xstate/store` as a PEER dependency for this reason. A renderer declares it no more: a renderer reads the atom through [`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md), and it imports the engine in no source file. Declare it once in your application, and let every `@xmachines` package resolve to that copy.
|
|
163
|
+
|
|
164
|
+
Check an install:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
pnpm why @xstate/store
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
More than one version in the output is the fault above.
|
|
171
|
+
|
|
172
|
+
## The engine moved to `@xstate/store` 4
|
|
173
|
+
|
|
174
|
+
XMachines 5.0.0 declares `@xstate/store` `^4.2.3`, where the release before it declared `^3.17.0`. Install the new major with this release.
|
|
175
|
+
|
|
176
|
+
One signature changed. A computed getter took a `read` helper in its first position in version 3, and it takes the previous value alone now, because `get` records the dependency by itself. The codemod writes the new form, and a derivation that you wrote by hand needs the first parameter deleted:
|
|
177
|
+
|
|
178
|
+
```diff
|
|
179
|
+
-const derived = createAtom((_read, previous) => …);
|
|
180
|
+
+const derived = createAtom((previous) => …);
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
`createAsyncAtom` gives its getter an `AbortSignal` now. A getter that needs none takes no parameter, so nothing forces a change.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## A type error that names a type you never wrote
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
Property 'set' is missing in type 'ReadonlyAtom<T>' but required in type 'Atom<T>'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`createAtom` carries two signatures, and TypeScript must prove the argument is not a function before it reaches the writable one. For a concrete type it proves that at once. For a type parameter, or a conditional type over one, it cannot, so it picks the computed signature.
|
|
194
|
+
|
|
195
|
+
Use `createWritableAtom`, which states the one signature:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
import { createWritableAtom } from "@xmachines/play-atom";
|
|
199
|
+
|
|
200
|
+
this.state = createWritableAtom(this.getSnapshot());
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## See also
|
|
206
|
+
|
|
207
|
+
- [Understanding Atoms](../guides/atoms.md) — the concepts, and the invariants
|
|
208
|
+
- [`@xmachines/play-atom`](../api/@xmachines/play-atom/README.md) — the API reference
|
|
209
|
+
- [Play RFC](../rfc/play.md) — section 5.1.1 defines the reactive substrate
|