@xmachines/docs 2.0.0-alpha.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -17
- package/api/@xmachines/play/README.md +58 -66
- package/api/@xmachines/play/classes/NonNullableError.md +14 -14
- package/api/@xmachines/play/classes/PlayError.md +32 -34
- package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
- package/api/@xmachines/play/type-aliases/PlayEvent.md +28 -27
- package/api/@xmachines/play-actor/README.md +114 -50
- package/api/@xmachines/play-actor/classes/AbstractActor.md +45 -30
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
- package/api/@xmachines/play-actor/functions/composePlayState.md +27 -0
- package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +21 -0
- package/api/@xmachines/play-actor/functions/guardContextWrites.md +43 -0
- package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +28 -0
- package/api/@xmachines/play-actor/functions/reuseComposedState.md +42 -0
- package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +29 -0
- package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
- package/api/@xmachines/play-actor/functions/typedSpec.md +25 -27
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -15
- package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +11 -0
- package/api/@xmachines/play-actor/interfaces/Routable.md +6 -6
- package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +50 -0
- package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +15 -0
- package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
- package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +15 -0
- package/api/@xmachines/play-dom/README.md +123 -86
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
- package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
- package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
- package/api/@xmachines/play-dom/functions/createValidationRegistry.md +22 -0
- package/api/@xmachines/play-dom/functions/defineRegistry.md +5 -5
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +9 -8
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +16 -16
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +2 -0
- package/api/@xmachines/play-dom/interfaces/FieldValidationState.md +16 -0
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +17 -17
- package/api/@xmachines/play-dom/interfaces/RenderSpecOptions.md +2 -0
- package/api/@xmachines/play-dom/interfaces/ValidationRegistry.md +21 -0
- package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +10 -0
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
- package/api/@xmachines/play-dom/variables/schema.md +35 -45
- package/api/@xmachines/play-dom-router/README.md +68 -51
- package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +21 -20
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
- package/api/@xmachines/play-react/README.md +65 -55
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
- package/api/@xmachines/play-react/functions/defineRegistry.md +5 -5
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useFieldValidation.md +31 -0
- package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
- package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
- package/api/@xmachines/play-react/interfaces/ComponentContext.md +9 -8
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -6
- package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
- package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
- package/api/@xmachines/play-react-router/README.md +38 -31
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
- package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
- package/api/@xmachines/play-router/README.md +99 -95
- package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
- package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
- package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
- package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
- package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
- package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
- package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +8 -8
- package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +6 -6
- package/api/@xmachines/play-router/interfaces/LocationLike.md +11 -11
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -9
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
- package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +38 -36
- package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
- package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
- package/api/@xmachines/play-solid/README.md +46 -42
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
- package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
- package/api/@xmachines/play-solid-router/README.md +39 -34
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +45 -30
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-svelte/README.md +60 -33
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
- package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
- package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
- package/api/@xmachines/play-svelte-spa-router/README.md +43 -52
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router/README.md +43 -39
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +11 -11
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/README.md +67 -49
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
- package/api/@xmachines/play-tanstack-router/README.md +38 -16
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/README.md +76 -50
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
- package/api/@xmachines/play-vue/README.md +39 -39
- package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/functions/useFieldValidation.md +31 -0
- package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
- 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 +4 -4
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
- package/api/@xmachines/play-vue-router/README.md +66 -57
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +41 -35
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
- package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
- package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
- package/api/@xmachines/play-xstate/README.md +129 -138
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +148 -114
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -23
- package/api/@xmachines/play-xstate/functions/composeGuards.md +34 -33
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +27 -22
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +19 -14
- package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
- package/api/@xmachines/play-xstate/functions/eventMatches.md +12 -7
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +17 -48
- package/api/@xmachines/play-xstate/functions/hasContext.md +12 -9
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
- package/api/@xmachines/play-xstate/functions/negateGuard.md +26 -20
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -11
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +9 -25
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +13 -11
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +8 -5
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +11 -15
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -19
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -26
- package/api/@xmachines/shared/README.md +12 -14
- 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 +12 -7
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +9 -4
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +6 -6
- package/contributing/architecture.md +27 -28
- package/contributing/configuration.md +10 -10
- package/contributing/deployment.md +51 -30
- package/contributing/development.md +90 -21
- package/contributing/testing.md +36 -14
- package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +1 -1
- package/examples/@xmachines/play-dom-demo/functions/initShell.md +1 -1
- package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-react-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-react-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-solid-demo/functions/App.md +1 -1
- package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/About.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Contact.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Home.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Login.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBar.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Navigation.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Overview.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Profile.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Settings.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Shell.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/Stats.md +1 -1
- package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +1 -1
- package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/App.md +1 -1
- package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +1 -1
- package/examples/README.md +4 -1
- package/examples/basic-state-machine.md +24 -24
- package/examples/form-validation.md +110 -121
- package/examples/multi-router-integration.md +0 -2
- package/examples/routing-patterns.md +60 -94
- package/examples/traffic-light.md +57 -48
- package/guides/README.md +6 -2
- package/guides/actor-model.md +1 -1
- package/guides/getting-started.md +89 -90
- package/guides/inspector.md +197 -0
- package/guides/state-machines.md +55 -69
- package/package.json +10 -7
- package/rfc/play.md +15 -6
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
- package/api/@xmachines/play-xstate/functions/createRoutedMachine.md +0 -87
- package/api/@xmachines/play-xstate/type-aliases/PlayRoutePayload.md +0 -30
- package/api/@xmachines/play-xstate/type-aliases/SetupLike.md +0 -33
- package/api/@xmachines/play-xstate/type-aliases/WithOptional.md +0 -31
- package/api/@xmachines/play-xstate/variables/emptyEventSchema.md +0 -37
- package/api/@xmachines/play-xstate/variables/playMetaSchema.md +0 -40
- package/api/@xmachines/play-xstate/variables/playRouteEventSchema.md +0 -9
package/README.md
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
<!-- generated-by: gsd-doc-writer -->
|
|
2
|
-
|
|
3
1
|
# @xmachines/docs
|
|
4
2
|
|
|
5
3
|
> Documentation, guides, RFCs, and generated API reference for XMachines.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[](https://opensource.org/licenses/MIT)
|
|
10
|
-
[](https://www.npmjs.com/package/@xmachines/docs)
|
|
5
|
+
[](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/docs)
|
|
11
6
|
|
|
12
7
|
## Overview
|
|
13
8
|
|
|
14
|
-
`@xmachines/docs` is the documentation package
|
|
9
|
+
`@xmachines/docs` is the documentation package of the XMachines Play monorepo. It ships five categories of content:
|
|
15
10
|
|
|
16
11
|
| Location | Contents |
|
|
17
12
|
| --------------- | ---------------------------------------------------------------- |
|
|
@@ -19,7 +14,7 @@ Part of the `XMachines Play monorepo`.
|
|
|
19
14
|
| `guides/` | Concept guides, tutorials, and getting-started docs |
|
|
20
15
|
| `contributing/` | Operational docs for contributors and maintainers |
|
|
21
16
|
| `examples/` | Runnable code examples and demo application references |
|
|
22
|
-
| `api/` |
|
|
17
|
+
| `api/` | The API reference for every public package, generated by TypeDoc |
|
|
23
18
|
|
|
24
19
|
## Installation
|
|
25
20
|
|
|
@@ -31,7 +26,7 @@ pnpm add @xmachines/docs
|
|
|
31
26
|
|
|
32
27
|
### Import the package URL
|
|
33
28
|
|
|
34
|
-
The
|
|
29
|
+
The default export of the package is its own module URL. Use it to resolve documentation assets at run time:
|
|
35
30
|
|
|
36
31
|
```typescript
|
|
37
32
|
import docsUrl from "@xmachines/docs";
|
|
@@ -40,7 +35,7 @@ import docsUrl from "@xmachines/docs";
|
|
|
40
35
|
|
|
41
36
|
### Access documentation files directly
|
|
42
37
|
|
|
43
|
-
|
|
38
|
+
The package exports every documentation directory:
|
|
44
39
|
|
|
45
40
|
```typescript
|
|
46
41
|
// Access RFC files
|
|
@@ -65,7 +60,7 @@ Architectural specifications that define the XMachines system:
|
|
|
65
60
|
| File | Title | Description |
|
|
66
61
|
| ---------------------------------- | ------- | -------------------------------------------------------------------- |
|
|
67
62
|
| [`rfc/play.md`](rfc/play.md) | Play | Universal Player Architecture — core protocol, roles, and invariants |
|
|
68
|
-
| [`rfc/streams.md`](rfc/streams.md) | Streams | WHATWG Streams as integration boundary
|
|
63
|
+
| [`rfc/streams.md`](rfc/streams.md) | Streams | WHATWG Streams as the integration boundary |
|
|
69
64
|
| [`rfc/broker.md`](rfc/broker.md) | Broker | Event broker specification |
|
|
70
65
|
| [`rfc/git.md`](rfc/git.md) | Git | Git-compatible ID and history model |
|
|
71
66
|
| [`rfc/run.md`](rfc/run.md) | Run | Runtime execution model |
|
|
@@ -77,7 +72,7 @@ Architectural specifications that define the XMachines system:
|
|
|
77
72
|
|
|
78
73
|
### Guides
|
|
79
74
|
|
|
80
|
-
Concept guides and tutorials
|
|
75
|
+
Concept guides and tutorials that show how to use XMachines:
|
|
81
76
|
|
|
82
77
|
**Learning:**
|
|
83
78
|
|
|
@@ -86,6 +81,10 @@ Concept guides and tutorials for working with XMachines:
|
|
|
86
81
|
- **[Understanding the Actor Model](guides/actor-model.md)** — Actor/infrastructure split, `AbstractActor`, and the reset invariant
|
|
87
82
|
- **[Understanding TC39 Signals](guides/signals.md)** — Signal primitives and the five architectural invariants they enforce
|
|
88
83
|
|
|
84
|
+
**Tooling:**
|
|
85
|
+
|
|
86
|
+
- **[Inspecting a Running Actor](guides/inspector.md)** — `PlayerOptions.inspect`, the Stately inspector, late attachment, and browser-free transports
|
|
87
|
+
|
|
89
88
|
### Contributing & Operations
|
|
90
89
|
|
|
91
90
|
Reference documentation for contributors and maintainers:
|
|
@@ -98,19 +97,19 @@ Reference documentation for contributors and maintainers:
|
|
|
98
97
|
|
|
99
98
|
### Examples
|
|
100
99
|
|
|
101
|
-
Practical code examples
|
|
100
|
+
Practical code examples that show the XMachines patterns:
|
|
102
101
|
|
|
103
102
|
- **[Basic State Machine](examples/basic-state-machine.md)** — `setup().createMachine()` + `definePlayer()` + TC39 Signals
|
|
104
103
|
- **[Traffic Light](examples/traffic-light.md)** — Multi-state machine with `meta.route` and `formatPlayRouteTransitions`
|
|
105
|
-
- **[Form Validation](examples/form-validation.md)** — Typed context
|
|
104
|
+
- **[Form Validation](examples/form-validation.md)** — Typed context mutations with `setup.assign`, guards, and `$bindState`
|
|
106
105
|
- **[Routing Patterns](examples/routing-patterns.md)** — `meta.route`, `play.route` events, `always` auth guards
|
|
107
106
|
- **[Multi-Router Integration](examples/multi-router-integration.md)** — All 8 router adapters
|
|
108
107
|
|
|
109
108
|
### API Reference
|
|
110
109
|
|
|
111
|
-
TypeDoc
|
|
110
|
+
TypeDoc generates the API reference for every public package. See [`api/README.md`](api/README.md).
|
|
112
111
|
|
|
113
|
-
|
|
112
|
+
The documented packages:
|
|
114
113
|
|
|
115
114
|
- [`@xmachines/play`](../play/README.md) — Core protocols (`PlayEvent`, `PlayError`)
|
|
116
115
|
- [`@xmachines/play-actor`](../play-actor/README.md) — `AbstractActor`, `Routable`, `Viewable`
|
|
@@ -134,7 +133,7 @@ pnpm test
|
|
|
134
133
|
|
|
135
134
|
## Regenerating API Docs
|
|
136
135
|
|
|
137
|
-
|
|
136
|
+
TypeDoc generates the `api/` directory. Never edit it by hand. Generate it again from the monorepo root:
|
|
138
137
|
|
|
139
138
|
```bash
|
|
140
139
|
pnpm run docs
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
[API](../../README.md) / @xmachines/play
|
|
2
2
|
|
|
3
|
-
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
-
|
|
5
3
|
# `@xmachines/play`
|
|
6
4
|
|
|
7
|
-
> Core protocol layer for the Universal Player Architecture
|
|
8
|
-
|
|
9
|
-
[](https://opensource.org/licenses/MIT)
|
|
10
|
-
[](https://www.npmjs.com/package/@xmachines/play)
|
|
5
|
+
> Core protocol layer for the Universal Player Architecture. It defines `PlayEvent`, `PlayError`, and the contracts that keep the business logic loosely coupled to the runtime adapters.
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
[](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play)
|
|
13
8
|
|
|
14
9
|
---
|
|
15
10
|
|
|
@@ -19,27 +14,27 @@ Part of the [XMachines JS monorepo](../../README.md).
|
|
|
19
14
|
pnpm add @xmachines/play
|
|
20
15
|
```
|
|
21
16
|
|
|
22
|
-
> **Node.js `>= 22.0.0
|
|
17
|
+
> **This package requires Node.js `>= 22.0.0`.** Every package is an ES module (`"type": "module"`).
|
|
23
18
|
|
|
24
19
|
---
|
|
25
20
|
|
|
26
21
|
## Overview
|
|
27
22
|
|
|
28
|
-
`@xmachines/play` is the
|
|
23
|
+
`@xmachines/play` is the base package of the XMachines ecosystem. It defines the smallest set of types and utilities that every other `@xmachines/*` package builds on:
|
|
29
24
|
|
|
30
25
|
- **`PlayEvent<TPayload>`** — the universal event contract for Actor ↔ Infrastructure communication
|
|
31
26
|
- **`PlayError`** — the typed base class for all `@xmachines/*` runtime errors
|
|
32
|
-
- **`NonNullableError`** —
|
|
33
|
-
- **`assertNonNullable()`** — assertion utility that narrows `T | null | undefined` to `T`
|
|
27
|
+
- **`NonNullableError`** — the error that a package throws when a required value is `null` or `undefined`
|
|
28
|
+
- **`assertNonNullable()`** — the assertion utility that narrows `T | null | undefined` to `T`
|
|
34
29
|
|
|
35
|
-
These protocols implement the architectural invariants
|
|
30
|
+
These protocols implement the architectural invariants that the Play RFC defines:
|
|
36
31
|
|
|
37
|
-
| # | Invariant | Description
|
|
38
|
-
| ------ | -------------------------- |
|
|
39
|
-
| INV-01 | **Actor Authority** | The Actor is the final authority
|
|
40
|
-
| INV-02 | **Strict Separation** |
|
|
41
|
-
| INV-04 | **Passive Infrastructure** |
|
|
42
|
-
| INV-05 | **Signal-Only Reactivity** | TC39 Signals are the
|
|
32
|
+
| # | Invariant | Description |
|
|
33
|
+
| ------ | -------------------------- | ------------------------------------------------------------------------ |
|
|
34
|
+
| INV-01 | **Actor Authority** | The Actor is the final authority. Guards decide all transitions |
|
|
35
|
+
| INV-02 | **Strict Separation** | The business logic never imports a UI framework or a routing library |
|
|
36
|
+
| INV-04 | **Passive Infrastructure** | The infrastructure observes the Actor signals. It never enforces a guard |
|
|
37
|
+
| INV-05 | **Signal-Only Reactivity** | TC39 Signals are the only medium that crosses a boundary |
|
|
43
38
|
|
|
44
39
|
---
|
|
45
40
|
|
|
@@ -47,7 +42,7 @@ These protocols implement the architectural invariants defined in the Play RFC:
|
|
|
47
42
|
|
|
48
43
|
### `PlayEvent<TPayload>`
|
|
49
44
|
|
|
50
|
-
The minimal event contract
|
|
45
|
+
The minimal event contract is any object with a `type: string` property. The contract is framework-agnostic. It works with XState, with Robot, and with every other state machine library.
|
|
51
46
|
|
|
52
47
|
```typescript
|
|
53
48
|
import type { PlayEvent } from "@xmachines/play";
|
|
@@ -70,14 +65,14 @@ const invalid: LoginEvent = { type: "auth.login" }; // Error!
|
|
|
70
65
|
|
|
71
66
|
### `PlayError`
|
|
72
67
|
|
|
73
|
-
Base class for
|
|
68
|
+
Base class for every `@xmachines/*` runtime error. Each error has a stable `scope` (the class or the module that throws it) and a stable `code` (a machine-readable identifier). Always branch on `.code` or on the subclass. Never branch on `.message`.
|
|
74
69
|
|
|
75
70
|
```typescript
|
|
76
|
-
import { PlayError } from "@xmachines/play";
|
|
71
|
+
import { PlayError, assertNonNullable } from "@xmachines/play";
|
|
77
72
|
import { NonNullableError } from "@xmachines/play/errors";
|
|
78
73
|
|
|
79
74
|
try {
|
|
80
|
-
|
|
75
|
+
assertNonNullable(document.getElementById("app"), "#app");
|
|
81
76
|
} catch (err) {
|
|
82
77
|
if (err instanceof NonNullableError) {
|
|
83
78
|
// err.scope === "assertNonNullable"
|
|
@@ -107,15 +102,12 @@ export class MyPackageError extends PlayError {
|
|
|
107
102
|
|
|
108
103
|
### `assertNonNullable(value, name?)`
|
|
109
104
|
|
|
110
|
-
|
|
105
|
+
The assertion utility returns `value` with the type `NonNullable<V>`, or it throws `NonNullableError`. It removes the unsafe `!` non-null assertion.
|
|
111
106
|
|
|
112
107
|
```typescript
|
|
113
108
|
import { assertNonNullable } from "@xmachines/play";
|
|
114
109
|
|
|
115
|
-
//
|
|
116
|
-
const actor = assertNonNullable(inject<AuthActor>("actor"), "actor");
|
|
117
|
-
|
|
118
|
-
// DOM element lookup:
|
|
110
|
+
// DOM element lookup — no intermediate variable or `!` needed:
|
|
119
111
|
const el = assertNonNullable(document.getElementById("app"), "#app");
|
|
120
112
|
```
|
|
121
113
|
|
|
@@ -125,18 +117,18 @@ const el = assertNonNullable(document.getElementById("app"), "#app");
|
|
|
125
117
|
|
|
126
118
|
### Exported from `@xmachines/play`
|
|
127
119
|
|
|
128
|
-
| Export | Kind | Description
|
|
129
|
-
| --------------------- | ---------- |
|
|
130
|
-
| `PlayEvent<TPayload>` | `type` | Universal event contract — `{ type: string } & TPayload`
|
|
131
|
-
| `PlayError` | `class` | Base class for all `@xmachines/*` typed errors
|
|
132
|
-
| `NonNullableError` | `class` |
|
|
133
|
-
| `assertNonNullable` | `function` | Asserts
|
|
120
|
+
| Export | Kind | Description |
|
|
121
|
+
| --------------------- | ---------- | ------------------------------------------------------------------- |
|
|
122
|
+
| `PlayEvent<TPayload>` | `type` | Universal event contract — `{ type: string } & TPayload` |
|
|
123
|
+
| `PlayError` | `class` | Base class for all `@xmachines/*` typed errors |
|
|
124
|
+
| `NonNullableError` | `class` | `assertNonNullable` throws it when a value is `null` or `undefined` |
|
|
125
|
+
| `assertNonNullable` | `function` | Asserts that the value is not null. It returns the narrowed value |
|
|
134
126
|
|
|
135
127
|
### Exported from `@xmachines/play/errors`
|
|
136
128
|
|
|
137
129
|
| Export | Kind | Description |
|
|
138
130
|
| ------------------ | ------- | --------------------------------------------------------- |
|
|
139
|
-
| `PlayError` | `class` |
|
|
131
|
+
| `PlayError` | `class` | The base error class, re-exported |
|
|
140
132
|
| `NonNullableError` | `class` | `scope: "assertNonNullable"`, `code: "PLAY_NON_NULLABLE"` |
|
|
141
133
|
|
|
142
134
|
---
|
|
@@ -147,15 +139,13 @@ const el = assertNonNullable(document.getElementById("app"), "#app");
|
|
|
147
139
|
| ------------------- | ------------------ | ---------------------------------------------------- |
|
|
148
140
|
| `PLAY_NON_NULLABLE` | `NonNullableError` | `assertNonNullable()` receives `null` or `undefined` |
|
|
149
141
|
|
|
150
|
-
|
|
142
|
+
Every other `@xmachines/*` package exports its own error subclasses from its `./errors` subpath:
|
|
151
143
|
|
|
152
144
|
| Package | Import path |
|
|
153
145
|
| ---------------------------- | ----------------------------------- |
|
|
154
146
|
| `@xmachines/play` | `@xmachines/play/errors` |
|
|
155
147
|
| `@xmachines/play-router` | `@xmachines/play-router/errors` |
|
|
156
148
|
| `@xmachines/play-xstate` | `@xmachines/play-xstate/errors` |
|
|
157
|
-
| `@xmachines/play-react` | `@xmachines/play-react/errors` |
|
|
158
|
-
| `@xmachines/play-solid` | `@xmachines/play-solid/errors` |
|
|
159
149
|
| `@xmachines/play-vue-router` | `@xmachines/play-vue-router/errors` |
|
|
160
150
|
|
|
161
151
|
---
|
|
@@ -184,59 +174,61 @@ MIT © [Mikael Karon](mailto:mikael@karon.se)
|
|
|
184
174
|
|
|
185
175
|
See [LICENSE](./LICENSE) for details.
|
|
186
176
|
|
|
187
|
-
@xmachines/play -
|
|
177
|
+
@xmachines/play - the core protocol layer
|
|
188
178
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
179
|
+
This package defines the architectural contracts that carry the communication
|
|
180
|
+
between the Actor and the infrastructure, with no direct dependency between them.
|
|
181
|
+
RFC section 5.2 gives these protocols. They are the base of the loose coupling
|
|
182
|
+
between the business logic and the runtime adapters.
|
|
192
183
|
|
|
193
|
-
##
|
|
184
|
+
## The exports
|
|
194
185
|
|
|
195
|
-
**PlayEvent<TPayload>** -
|
|
186
|
+
**PlayEvent<TPayload>** - the generic event type of the Actor communication
|
|
196
187
|
|
|
197
|
-
-
|
|
198
|
-
-
|
|
199
|
-
-
|
|
200
|
-
-
|
|
188
|
+
- It is every object with a `type: string` property
|
|
189
|
+
- The generic `TPayload` parameter gives a type-safe event shape, and it is optional
|
|
190
|
+
- The default is `Record<string, unknown>`, which accepts each shape
|
|
191
|
+
- It is framework-agnostic, and it is not bound to XState or to another library
|
|
201
192
|
|
|
202
|
-
**
|
|
193
|
+
**Use:**
|
|
203
194
|
|
|
204
195
|
```typescript
|
|
205
|
-
// Flexible
|
|
196
|
+
// Flexible, the default:
|
|
206
197
|
const event: PlayEvent = { type: "auth.login", userId: "123" };
|
|
207
198
|
|
|
208
|
-
// Type-safe
|
|
199
|
+
// Type-safe, with the generic parameter:
|
|
209
200
|
type LoginEvent = PlayEvent<{ userId: string }>;
|
|
210
201
|
const event: LoginEvent = { type: "auth.login", userId: "123" };
|
|
211
202
|
```
|
|
212
203
|
|
|
213
|
-
**
|
|
204
|
+
**The common event patterns:**
|
|
214
205
|
|
|
215
|
-
-
|
|
216
|
-
-
|
|
206
|
+
- A domain event: `{ type: 'auth.login', userId: '123' }`
|
|
207
|
+
- Your own event: `{ type: 'form.submit', data: {...} }`
|
|
217
208
|
|
|
218
|
-
**
|
|
209
|
+
**The routing events** come from @xmachines/play-router:
|
|
219
210
|
|
|
220
|
-
- PlayRouteEvent:
|
|
221
|
-
- RouterBridge:
|
|
211
|
+
- PlayRouteEvent: the routing event with the parameters and the target state ID
|
|
212
|
+
- RouterBridge: the protocol that connects a router adapter to an actor
|
|
222
213
|
|
|
223
|
-
**
|
|
224
|
-
|
|
225
|
-
|
|
214
|
+
**The browser navigation:** a router adapter handles the browser BACK and FORWARD
|
|
215
|
+
buttons, through the `popstate` event. The user presses BACK or FORWARD, the
|
|
216
|
+
router detects the new URL, and it sends a PlayRouteEvent to the actor. The actor
|
|
217
|
+
then checks the event.
|
|
226
218
|
|
|
227
219
|
```typescript
|
|
228
220
|
import type { PlayRouteEvent, RouterBridge } from "@xmachines/play-router";
|
|
229
221
|
```
|
|
230
222
|
|
|
231
|
-
##
|
|
223
|
+
## The architectural invariants
|
|
232
224
|
|
|
233
|
-
These protocols enforce the
|
|
225
|
+
These protocols enforce the invariants below:
|
|
234
226
|
|
|
235
|
-
1. **Actor Authority**:
|
|
236
|
-
2. **Strict Separation**:
|
|
237
|
-
3. **Passive Infrastructure**:
|
|
238
|
-
4. **Signal-Only Reactivity**:
|
|
239
|
-
5. **State-Driven Reset**:
|
|
227
|
+
1. **Actor Authority**: the infrastructure makes a request, and the Actor decides the validity
|
|
228
|
+
2. **Strict Separation**: no layer depends on another layer directly
|
|
229
|
+
3. **Passive Infrastructure**: the infrastructure observes the Actor signals. It never controls them
|
|
230
|
+
4. **Signal-Only Reactivity**: every state change goes through a TC39 Signal
|
|
231
|
+
5. **State-Driven Reset**: each navigation follows the transition rules of the state machine
|
|
240
232
|
|
|
241
233
|
## Classes
|
|
242
234
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: NonNullableError
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play/src/errors.ts:
|
|
5
|
+
Defined in: [packages/play/src/errors.ts:110](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L110)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[assertNonNullable](../functions/assertNonNullable.md) throws this error when a value is `null` or `undefined`.
|
|
8
8
|
|
|
9
|
-
Catch
|
|
10
|
-
|
|
9
|
+
Catch it to separate a failed assertion of a missing value from every other
|
|
10
|
+
runtime error:
|
|
11
11
|
|
|
12
12
|
```ts
|
|
13
13
|
import { NonNullableError } from "@xmachines/play/errors";
|
|
@@ -35,7 +35,7 @@ try {
|
|
|
35
35
|
new NonNullableError(message, options?): NonNullableError;
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Defined in: [packages/play/src/errors.ts:
|
|
38
|
+
Defined in: [packages/play/src/errors.ts:111](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L111)
|
|
39
39
|
|
|
40
40
|
#### Parameters
|
|
41
41
|
|
|
@@ -54,15 +54,15 @@ Defined in: [packages/play/src/errors.ts:112](https://gitlab.com/xmachin-es/xmac
|
|
|
54
54
|
|
|
55
55
|
## Properties
|
|
56
56
|
|
|
57
|
-
| Property | Modifier | Type | Description | Inherited from | Defined in
|
|
58
|
-
| ------------------------------------------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
59
|
-
| <a id="property-cause"></a> `cause?` | `public` | `unknown` | - | [`PlayError`](PlayError.md).[`cause`](PlayError.md#property-cause) | -
|
|
60
|
-
| <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable error
|
|
61
|
-
| <a id="property-message"></a> `message` | `public` | `string` | - | [`PlayError`](PlayError.md).[`message`](PlayError.md#property-message) | -
|
|
62
|
-
| <a id="property-name"></a> `name` | `public` | `string` | - | [`PlayError`](PlayError.md).[`name`](PlayError.md#property-name) | -
|
|
63
|
-
| <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or module that threw this error
|
|
64
|
-
| <a id="property-stack"></a> `stack?` | `public` | `string` | - | [`PlayError`](PlayError.md).[`stack`](PlayError.md#property-stack) | -
|
|
65
|
-
| <a id="property-stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | [`PlayError`](PlayError.md).[`stackTraceLimit`](PlayError.md#property-stacktracelimit) | -
|
|
57
|
+
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
58
|
+
| ------------------------------------------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
59
|
+
| <a id="property-cause"></a> `cause?` | `public` | `unknown` | - | [`PlayError`](PlayError.md).[`cause`](PlayError.md#property-cause) | - |
|
|
60
|
+
| <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable identifier of the error. An error code follows the naming convention `PLAY_<PACKAGE>_<DESCRIPTION>`. It stays the same across each patch release and each minor release of one major version. Never match on `.message`. Always match on `.code`, or on the subclass. | [`PlayError`](PlayError.md).[`code`](PlayError.md#property-code) | [packages/play/src/errors.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L74) |
|
|
61
|
+
| <a id="property-message"></a> `message` | `public` | `string` | - | [`PlayError`](PlayError.md).[`message`](PlayError.md#property-message) | - |
|
|
62
|
+
| <a id="property-name"></a> `name` | `public` | `string` | - | [`PlayError`](PlayError.md).[`name`](PlayError.md#property-name) | - |
|
|
63
|
+
| <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or the module that threw this error, for example `"RouterBridgeBase"`. | [`PlayError`](PlayError.md).[`scope`](PlayError.md#property-scope) | [packages/play/src/errors.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L64) |
|
|
64
|
+
| <a id="property-stack"></a> `stack?` | `public` | `string` | - | [`PlayError`](PlayError.md).[`stack`](PlayError.md#property-stack) | - |
|
|
65
|
+
| <a id="property-stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | [`PlayError`](PlayError.md).[`stackTraceLimit`](PlayError.md#property-stacktracelimit) | - |
|
|
66
66
|
|
|
67
67
|
## Methods
|
|
68
68
|
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayError
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play/src/errors.ts:
|
|
5
|
+
Defined in: [packages/play/src/errors.ts:62](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L62)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The base class of every typed runtime error of an `@xmachines/*` package.
|
|
8
8
|
|
|
9
|
-
`PlayError` gives
|
|
9
|
+
`PlayError` gives each error two structured fields:
|
|
10
10
|
|
|
11
|
-
- `scope` — the class or module that threw
|
|
12
|
-
- `code` — a stable, machine-readable identifier
|
|
11
|
+
- `scope` — the class or the module that threw the error, for example `"RouterBridgeBase"`
|
|
12
|
+
- `code` — a stable, machine-readable identifier, for example `"PLAY_ROUTER_SYNC_FAILED"`
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Your application code therefore branches on the type of an error, and it does not
|
|
15
|
+
parse the `.message` string. A message changes between releases.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## The error codes
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
An `@xmachines/*` package that defines typed subclasses exports them from an
|
|
20
20
|
`"./errors"` subpath:
|
|
21
21
|
|
|
22
22
|
| Package | Import |
|
|
@@ -25,13 +25,11 @@ Each `@xmachines/*` package exports its own typed subclasses from an
|
|
|
25
25
|
| `@xmachines/play-router` | `@xmachines/play-router/errors` |
|
|
26
26
|
| `@xmachines/play-vue-router` | `@xmachines/play-vue-router/errors` |
|
|
27
27
|
| `@xmachines/play-xstate` | `@xmachines/play-xstate/errors` |
|
|
28
|
-
| `@xmachines/play-react` | `@xmachines/play-react/errors` |
|
|
29
|
-
| `@xmachines/play-solid` | `@xmachines/play-solid/errors` |
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
The root `@xmachines/play` exports `PlayError` itself, and it is the base of every
|
|
30
|
+
subclass above.
|
|
33
31
|
|
|
34
|
-
##
|
|
32
|
+
## How to catch an error by its type
|
|
35
33
|
|
|
36
34
|
```typescript
|
|
37
35
|
import { PlayError } from "@xmachines/play";
|
|
@@ -43,18 +41,18 @@ try {
|
|
|
43
41
|
if (err instanceof RouterSyncError) {
|
|
44
42
|
// err.scope === "RouterBridgeBase"
|
|
45
43
|
// err.code === "PLAY_ROUTER_SYNC_FAILED"
|
|
46
|
-
// err.cause — the original error
|
|
44
|
+
// err.cause — the original error of the failed synchronization
|
|
47
45
|
reportToMonitoring(err);
|
|
48
46
|
} else if (err instanceof PlayError) {
|
|
49
|
-
//
|
|
47
|
+
// Every other @xmachines/* error
|
|
50
48
|
console.error(`[${err.scope}:${err.code}] ${err.message}`);
|
|
51
49
|
} else {
|
|
52
|
-
throw err; //
|
|
50
|
+
throw err; // Throw an unknown error again
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
```
|
|
56
54
|
|
|
57
|
-
##
|
|
55
|
+
## How to extend PlayError
|
|
58
56
|
|
|
59
57
|
```typescript
|
|
60
58
|
import { PlayError } from "@xmachines/play";
|
|
@@ -87,16 +85,16 @@ new PlayError(
|
|
|
87
85
|
options?): PlayError;
|
|
88
86
|
```
|
|
89
87
|
|
|
90
|
-
Defined in: [packages/play/src/errors.ts:
|
|
88
|
+
Defined in: [packages/play/src/errors.ts:82](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L82)
|
|
91
89
|
|
|
92
90
|
#### Parameters
|
|
93
91
|
|
|
94
|
-
| Parameter | Type | Description
|
|
95
|
-
| ---------- | -------------- |
|
|
96
|
-
| `scope` | `string` | The class or module
|
|
97
|
-
| `code` | `string` |
|
|
98
|
-
| `message` | `string` |
|
|
99
|
-
| `options?` | `ErrorOptions` |
|
|
92
|
+
| Parameter | Type | Description |
|
|
93
|
+
| ---------- | -------------- | --------------------------------------------------------------------------------------- |
|
|
94
|
+
| `scope` | `string` | The class or the module that throws this error. |
|
|
95
|
+
| `code` | `string` | The machine-readable identifier of the error, for example `"PLAY_ROUTER_SYNC_FAILED"`. |
|
|
96
|
+
| `message` | `string` | The description for a person. Never match on it in your code. |
|
|
97
|
+
| `options?` | `ErrorOptions` | The standard `ErrorOptions`. Give `{ cause: originalError }` to make a chain of errors. |
|
|
100
98
|
|
|
101
99
|
#### Returns
|
|
102
100
|
|
|
@@ -110,15 +108,15 @@ Error.constructor;
|
|
|
110
108
|
|
|
111
109
|
## Properties
|
|
112
110
|
|
|
113
|
-
| Property | Modifier | Type | Description | Inherited from | Defined in
|
|
114
|
-
| ------------------------------------------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
|
|
115
|
-
| <a id="property-cause"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | -
|
|
116
|
-
| <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable error
|
|
117
|
-
| <a id="property-message"></a> `message` | `public` | `string` | - | `Error.message` | -
|
|
118
|
-
| <a id="property-name"></a> `name` | `public` | `string` | - | `Error.name` | -
|
|
119
|
-
| <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or module that threw this error
|
|
120
|
-
| <a id="property-stack"></a> `stack?` | `public` | `string` | - | `Error.stack` | -
|
|
121
|
-
| <a id="property-stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | -
|
|
111
|
+
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
112
|
+
| ------------------------------------------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
113
|
+
| <a id="property-cause"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | - |
|
|
114
|
+
| <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable identifier of the error. An error code follows the naming convention `PLAY_<PACKAGE>_<DESCRIPTION>`. It stays the same across each patch release and each minor release of one major version. Never match on `.message`. Always match on `.code`, or on the subclass. | - | [packages/play/src/errors.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L74) |
|
|
115
|
+
| <a id="property-message"></a> `message` | `public` | `string` | - | `Error.message` | - |
|
|
116
|
+
| <a id="property-name"></a> `name` | `public` | `string` | - | `Error.name` | - |
|
|
117
|
+
| <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or the module that threw this error, for example `"RouterBridgeBase"`. | - | [packages/play/src/errors.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L64) |
|
|
118
|
+
| <a id="property-stack"></a> `stack?` | `public` | `string` | - | `Error.stack` | - |
|
|
119
|
+
| <a id="property-stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | - |
|
|
122
120
|
|
|
123
121
|
## Methods
|
|
124
122
|
|