@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
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteObject
|
|
4
4
|
|
|
5
|
-
Defined in: [types.ts:
|
|
5
|
+
Defined in: [types.ts:45](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L45)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A route object, with more metadata.
|
|
8
8
|
|
|
9
9
|
## Indexable
|
|
10
10
|
|
|
@@ -12,10 +12,10 @@ Route object with additional metadata.
|
|
|
12
12
|
[key: string]: unknown
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The additional metadata of the route: a title, a breadcrumb, and so on
|
|
16
16
|
|
|
17
17
|
## Properties
|
|
18
18
|
|
|
19
|
-
| Property | Type | Description
|
|
20
|
-
| --------------------------------- | -------- |
|
|
21
|
-
| <a id="property-path"></a> `path` | `string` |
|
|
19
|
+
| Property | Type | Description | Defined in |
|
|
20
|
+
| --------------------------------- | -------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| <a id="property-path"></a> `path` | `string` | The template of the route path, for example '/user/:id' | [types.ts:47](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L47) |
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteTree
|
|
4
4
|
|
|
5
|
-
Defined in: [types.ts:
|
|
5
|
+
Defined in: [types.ts:122](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L122)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The complete route tree, with its lookup maps
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
It gives you the map between a state ID and a URL path, in both directions:
|
|
10
10
|
|
|
11
|
-
- byStateId:
|
|
12
|
-
- byPath:
|
|
11
|
+
- byStateId: it maps each state ID to its route node, for the target of a play.route event
|
|
12
|
+
- byPath: it maps each URL path to its route node, for the browser navigation
|
|
13
13
|
|
|
14
14
|
## Properties
|
|
15
15
|
|
|
16
|
-
| Property | Type | Description
|
|
17
|
-
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
18
|
-
| <a id="property-bypath"></a> `byPath` | `Map`\<`string`, [`RouteNode`](RouteNode.md)\> |
|
|
19
|
-
| <a id="property-bystateid"></a> `byStateId` | `Map`\<`string`, [`RouteNode`](RouteNode.md)\> |
|
|
20
|
-
| <a id="property-graph"></a> `graph?` | `Graph`\<[`MachineNodeData`](MachineNodeData.md), [`MachineEdgeData`](MachineEdgeData.md), `any`, `any`\> |
|
|
21
|
-
| <a id="property-root"></a> `root` | [`RouteNode`](RouteNode.md) |
|
|
16
|
+
| Property | Type | Description | Defined in |
|
|
17
|
+
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
18
|
+
| <a id="property-bypath"></a> `byPath` | `Map`\<`string`, [`RouteNode`](RouteNode.md)\> | The map from a complete path to its route node. It gives you the state ID of a URL path, for the target of a play.route event | [types.ts:134](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L134) |
|
|
19
|
+
| <a id="property-bystateid"></a> `byStateId` | `Map`\<`string`, [`RouteNode`](RouteNode.md)\> | The map from a state ID to its route node. It gives you the URL path of a state ID, for the update of the browser URL | [types.ts:129](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L129) |
|
|
20
|
+
| <a id="property-graph"></a> `graph?` | `Graph`\<[`MachineNodeData`](MachineNodeData.md), [`MachineEdgeData`](MachineEdgeData.md), `any`, `any`\> | The graph of the state machine, for an advanced query. extractMachineRoutes() fills it. Use it for a query of the hierarchy, for a test of the reachability, and for a navigation that knows the transitions, through the algorithms of @statelyai/graph. **Example** `import { getSuccessors, hasPath } from "@statelyai/graph"; const successors = getSuccessors(tree.graph!, "myMachine.home");` | [types.ts:147](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L147) |
|
|
21
|
+
| <a id="property-root"></a> `root` | [`RouteNode`](RouteNode.md) | The root node of the routes | [types.ts:124](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L124) |
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouteWatcherHandle
|
|
4
4
|
|
|
5
|
-
Defined in: [router-bridge-base.ts:
|
|
5
|
+
Defined in: [router-bridge-base.ts:72](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-bridge-base.ts#L72)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
The narrow interface of the TC39 Signal watcher. `RouterBridgeBase` uses it to
|
|
8
|
+
observe each change of `actor.currentRoute`.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
The interface hides the complete `Signal.subtle.Watcher` surface. It exposes the
|
|
11
|
+
two operations that `RouterBridgeBase` needs:
|
|
12
12
|
|
|
13
|
-
- `watch(signal)` —
|
|
14
|
-
- `unwatch()` —
|
|
13
|
+
- `watch(signal)` — it arms the watcher on one signal
|
|
14
|
+
- `unwatch()` — it stops the watch and frees the resources
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
A framework adapter subclass touches this handle never. `RouterBridgeBase` makes
|
|
17
|
+
it and manages it internally.
|
|
18
18
|
|
|
19
19
|
## Methods
|
|
20
20
|
|
|
@@ -24,9 +24,9 @@ created and managed internally by `RouterBridgeBase`.
|
|
|
24
24
|
unwatch(): void;
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Defined in: [router-bridge-base.ts:
|
|
27
|
+
Defined in: [router-bridge-base.ts:76](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-bridge-base.ts#L76)
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
Stops the observation and frees the watcher.
|
|
30
30
|
|
|
31
31
|
#### Returns
|
|
32
32
|
|
|
@@ -40,9 +40,9 @@ Stop observing and release the watcher.
|
|
|
40
40
|
watch(signal): void;
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Defined in: [router-bridge-base.ts:
|
|
43
|
+
Defined in: [router-bridge-base.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-bridge-base.ts#L74)
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
Arms the watcher on the given signal.
|
|
46
46
|
|
|
47
47
|
#### Parameters
|
|
48
48
|
|
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: RouterBridge
|
|
4
4
|
|
|
5
|
-
Defined in: [types.ts:
|
|
5
|
+
Defined in: [types.ts:358](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L358)
|
|
6
6
|
|
|
7
|
-
RouterBridge interface
|
|
7
|
+
The RouterBridge interface of a runtime infrastructure adapter
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
The interface defines the connection of the lifecycle between the infrastructure,
|
|
10
|
+
for example a framework router, and the Actor. The infrastructure builds a "bridge"
|
|
11
|
+
to the Actor: it observes the signals of the Actor, and it manages its own
|
|
12
|
+
lifecycle accordingly.
|
|
12
13
|
|
|
13
|
-
**Architectural
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
**Architectural context:** the interface implements **Passive Infrastructure
|
|
15
|
+
(INV-04)**, because it gives an observation in one direction. The infrastructure
|
|
16
|
+
connects to observe the signals of the Actor (currentRoute, currentView, and
|
|
17
|
+
state), and it reflects each change. It makes no decision about the state.
|
|
16
18
|
|
|
17
19
|
## Example
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
The implementation of a framework router bridge
|
|
20
22
|
|
|
21
23
|
```typescript
|
|
22
24
|
import type { RouterBridge } from "@xmachines/play-router";
|
|
@@ -26,7 +28,7 @@ class MyRouterBridge implements RouterBridge {
|
|
|
26
28
|
private watcher: Signal.Watcher | null = null;
|
|
27
29
|
|
|
28
30
|
async connect(): Promise<void> {
|
|
29
|
-
// Start
|
|
31
|
+
// Start the observation of the actor.currentRoute signal
|
|
30
32
|
this.watcher = new Signal.subtle.Watcher(() => {
|
|
31
33
|
const route = actor.currentRoute.get();
|
|
32
34
|
if (route) router.navigate(route);
|
|
@@ -35,7 +37,7 @@ class MyRouterBridge implements RouterBridge {
|
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
async disconnect(): Promise<void> {
|
|
38
|
-
// Stop
|
|
40
|
+
// Stop the observation, and clean the watchers up
|
|
39
41
|
this.watcher?.unwatch(actor.currentRoute);
|
|
40
42
|
this.watcher = null;
|
|
41
43
|
}
|
|
@@ -44,7 +46,7 @@ class MyRouterBridge implements RouterBridge {
|
|
|
44
46
|
|
|
45
47
|
## See
|
|
46
48
|
|
|
47
|
-
[Play RFC](../../../../rfc/play.md) -
|
|
49
|
+
[Play RFC](../../../../rfc/play.md) - invariant INV-04
|
|
48
50
|
|
|
49
51
|
## Methods
|
|
50
52
|
|
|
@@ -54,25 +56,26 @@ class MyRouterBridge implements RouterBridge {
|
|
|
54
56
|
connect(): void | Promise<void>;
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
Defined in: [types.ts:
|
|
59
|
+
Defined in: [types.ts:375](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L375)
|
|
58
60
|
|
|
59
|
-
|
|
61
|
+
Connects the router bridge to the Actor
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
The infrastructure calls it when it must start the observation of the Actor
|
|
64
|
+
signals, and when it must bring its own state, for example the browser URL, in line
|
|
65
|
+
with the Actor state.
|
|
63
66
|
|
|
64
67
|
#### Returns
|
|
65
68
|
|
|
66
69
|
`void` \| `Promise`\<`void`\>
|
|
67
70
|
|
|
68
|
-
|
|
71
|
+
The promise that resolves after the connection, or void for a synchronous connection
|
|
69
72
|
|
|
70
73
|
#### Example
|
|
71
74
|
|
|
72
75
|
```typescript
|
|
73
76
|
const bridge: RouterBridge = createBridge(actor, router);
|
|
74
77
|
await bridge.connect();
|
|
75
|
-
//
|
|
78
|
+
// The bridge observes the actor.currentRoute signal now
|
|
76
79
|
```
|
|
77
80
|
|
|
78
81
|
---
|
|
@@ -83,22 +86,22 @@ await bridge.connect();
|
|
|
83
86
|
disconnect(): void | Promise<void>;
|
|
84
87
|
```
|
|
85
88
|
|
|
86
|
-
Defined in: [types.ts:
|
|
89
|
+
Defined in: [types.ts:391](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L391)
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
Disconnects the router bridge from the Actor
|
|
89
92
|
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
The infrastructure calls it when it must stop the observation and free its
|
|
94
|
+
resources, for example a signal watcher and an event listener.
|
|
92
95
|
|
|
93
96
|
#### Returns
|
|
94
97
|
|
|
95
98
|
`void` \| `Promise`\<`void`\>
|
|
96
99
|
|
|
97
|
-
|
|
100
|
+
The promise that resolves after the disconnection, or void for a synchronous disconnection
|
|
98
101
|
|
|
99
102
|
#### Example
|
|
100
103
|
|
|
101
104
|
```typescript
|
|
102
105
|
await bridge.disconnect();
|
|
103
|
-
//
|
|
106
|
+
// The bridge stopped its observation, and it freed its resources
|
|
104
107
|
```
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: WindowLike
|
|
4
4
|
|
|
5
|
-
Defined in: [types.ts:
|
|
5
|
+
Defined in: [types.ts:412](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L412)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
the global `window` when
|
|
7
|
+
The minimal window interface of an adapter that subscribes to a DOM event, for
|
|
8
|
+
example to `hashchange`. You can inject it for SSR and for a test: give a mock in
|
|
9
|
+
place of the global `window` when no DOM is available.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
the DOM lib.
|
|
11
|
+
The definition is structural, and it holds no reference to `Window`. This package
|
|
12
|
+
therefore compiles without the DOM lib.
|
|
13
13
|
|
|
14
14
|
## Example
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
|
-
//
|
|
17
|
+
// The normal use — the global window, which is the default
|
|
18
18
|
connectRouter({ actor, routeMap });
|
|
19
19
|
|
|
20
|
-
// SSR
|
|
20
|
+
// SSR or a test — an injected mock
|
|
21
21
|
const mockWin: WindowLike = { addEventListener: vi.fn(), removeEventListener: vi.fn() };
|
|
22
22
|
connectRouter({ actor, routeMap, window: mockWin });
|
|
23
23
|
```
|
|
@@ -30,7 +30,7 @@ connectRouter({ actor, routeMap, window: mockWin });
|
|
|
30
30
|
addEventListener(type, listener): void;
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Defined in: [types.ts:
|
|
33
|
+
Defined in: [types.ts:413](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L413)
|
|
34
34
|
|
|
35
35
|
#### Parameters
|
|
36
36
|
|
|
@@ -51,7 +51,7 @@ Defined in: [types.ts:414](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
|
51
51
|
removeEventListener(type, listener): void;
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Defined in: [types.ts:
|
|
54
|
+
Defined in: [types.ts:414](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L414)
|
|
55
55
|
|
|
56
56
|
#### Parameters
|
|
57
57
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[API](../../../README.md) / [@xmachines/play-router](../README.md) / BaseRouteMapping
|
|
2
|
+
|
|
3
|
+
# ~~Type Alias: BaseRouteMapping~~
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type BaseRouteMapping = RouteMapping;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [index.ts:61](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/index.ts#L61)
|
|
10
|
+
|
|
11
|
+
## Deprecated
|
|
12
|
+
|
|
13
|
+
Use [RouteMapping](../interfaces/RouteMapping.md). Will be removed in the next major.
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
type MachineGraph = Graph<MachineNodeData, MachineEdgeData>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [machine-to-graph.ts:
|
|
9
|
+
Defined in: [machine-to-graph.ts:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/machine-to-graph.ts#L19)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
The typed Graph of @statelyai/graph that represents a state machine.
|
|
12
|
+
It gives you the queries of the hierarchy, the algorithms of a walk, and the tests
|
|
13
|
+
of the reachability.
|
|
13
14
|
|
|
14
15
|
## Example
|
|
15
16
|
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
type RouteMetadata = string | RouteObject;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [types.ts:
|
|
9
|
+
Defined in: [types.ts:55](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/types.ts#L55)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The route metadata of the `meta.route` field of a state machine.
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
[API](../../README.md) / @xmachines/play-signals
|
|
2
2
|
|
|
3
|
-
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
-
|
|
5
3
|
# @xmachines/play-signals
|
|
6
4
|
|
|
7
|
-
TC39 Signals polyfill for XMachines
|
|
5
|
+
TC39 Signals polyfill for XMachines. It gives the Play Architecture fine-grained reactive state primitives. The primitives propagate state without a glitch and without a subscription.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
[](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-signals)
|
|
10
8
|
|
|
11
9
|
## Installation
|
|
12
10
|
|
|
@@ -16,9 +14,9 @@ pnpm add @xmachines/play-signals
|
|
|
16
14
|
|
|
17
15
|
## Overview
|
|
18
16
|
|
|
19
|
-
This package wraps the [`signal-polyfill`](https://github.com/nicolo-ribaudo/tc39-proposal-signals-polyfill) reference implementation of the [TC39 Signals proposal](https://github.com/tc39/proposal-signals) (Stage 1). It re-exports the
|
|
17
|
+
This package wraps the [`signal-polyfill`](https://github.com/nicolo-ribaudo/tc39-proposal-signals-polyfill) reference implementation of the [TC39 Signals proposal](https://github.com/tc39/proposal-signals) (Stage 1). It re-exports the complete `Signal` namespace, and it adds the memory-safe `watchSignal` utility. The wrapper keeps the rest of the code away from a Stage 1 API that can still change.
|
|
20
18
|
|
|
21
|
-
**
|
|
19
|
+
**Import every signal in the XMachines ecosystem from this package**, not from `signal-polyfill`. One import point keeps each polyfill update and each API change in one place.
|
|
22
20
|
|
|
23
21
|
## Usage
|
|
24
22
|
|
|
@@ -48,11 +46,11 @@ console.log(doubled.get()); // 10 (recomputed because dependency changed)
|
|
|
48
46
|
console.log(doubled.get()); // 10 (memoized — no recomputation)
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
A computation tracks each signal that it reads. A dynamic branch is safe: the computation keeps only the signals of the _current_ execution path as its dependencies.
|
|
52
50
|
|
|
53
51
|
### `watchSignal` — memory-safe one-shot effect
|
|
54
52
|
|
|
55
|
-
Use `watchSignal` to subscribe to a `Signal.State` or `Signal.Computed
|
|
53
|
+
Use `watchSignal` to subscribe to a `Signal.State` or to a `Signal.Computed`. The callback receives the value after each change. `watchSignal` groups the updates of one synchronous batch into a single microtask.
|
|
56
54
|
|
|
57
55
|
```typescript
|
|
58
56
|
import { Signal, watchSignal } from "@xmachines/play-signals";
|
|
@@ -71,11 +69,11 @@ count.set(3); // → logs "count changed: 3" once
|
|
|
71
69
|
cleanup();
|
|
72
70
|
```
|
|
73
71
|
|
|
74
|
-
The
|
|
72
|
+
The cleanup function is idempotent. A second call is safe, and it does not throw.
|
|
75
73
|
|
|
76
74
|
### `Signal.subtle.Watcher` — low-level multi-signal observation
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
Advanced code, such as a framework integration, can use the complete `Signal.subtle.Watcher` API:
|
|
79
77
|
|
|
80
78
|
```typescript
|
|
81
79
|
import { Signal } from "@xmachines/play-signals";
|
|
@@ -99,7 +97,7 @@ count.set(5); // schedules microtask notification
|
|
|
99
97
|
|
|
100
98
|
### Custom equality
|
|
101
99
|
|
|
102
|
-
Both `Signal.State` and `Signal.Computed` accept an `equals` option
|
|
100
|
+
Both `Signal.State` and `Signal.Computed` accept an `equals` option. The option controls when a signal notifies its dependents:
|
|
103
101
|
|
|
104
102
|
```typescript
|
|
105
103
|
import { Signal } from "@xmachines/play-signals";
|
|
@@ -110,7 +108,7 @@ const options: SignalOptions<{ name: string; age: number }> = {
|
|
|
110
108
|
};
|
|
111
109
|
|
|
112
110
|
const person = new Signal.State({ name: "Alice", age: 30 }, options);
|
|
113
|
-
//
|
|
111
|
+
// A structurally identical value does not notify the dependents
|
|
114
112
|
person.set({ name: "Alice", age: 30 });
|
|
115
113
|
```
|
|
116
114
|
|
|
@@ -119,13 +117,13 @@ person.set({ name: "Alice", age: 30 });
|
|
|
119
117
|
| Export | Kind | Description |
|
|
120
118
|
| ------------------------------ | --------- | ------------------------------------------------------------------------------------------------------ |
|
|
121
119
|
| `Signal` | namespace | Full TC39 Signals namespace (`State`, `Computed`, `subtle.Watcher`) re-exported from `signal-polyfill` |
|
|
122
|
-
| `watchSignal(signal, onValue)` | function |
|
|
120
|
+
| `watchSignal(signal, onValue)` | function | The memory-safe subscription helper. It returns a cleanup function |
|
|
123
121
|
| `SignalState<T>` | interface | Shape of `Signal.State<T>` (`.get()`, `.set()`) |
|
|
124
122
|
| `SignalComputed<T>` | interface | Shape of `Signal.Computed<T>` (`.get()`) |
|
|
125
123
|
| `SignalWatcher` | interface | Shape of `Signal.subtle.Watcher` (`.watch()`, `.unwatch()`, `.getPending()`) |
|
|
126
|
-
| `SignalOptions<T>` | interface |
|
|
127
|
-
| `ComputedOptions<T>` | interface |
|
|
128
|
-
| `WatcherNotify` | type |
|
|
124
|
+
| `SignalOptions<T>` | interface | The options object for the `Signal.State` constructor (`equals?`) |
|
|
125
|
+
| `ComputedOptions<T>` | interface | The options object for the `Signal.Computed` constructor (`equals?`) |
|
|
126
|
+
| `WatcherNotify` | type | The callback signature of the `Signal.subtle.Watcher` notify function |
|
|
129
127
|
|
|
130
128
|
## Testing
|
|
131
129
|
|
|
@@ -152,36 +150,38 @@ pnpm run test:coverage
|
|
|
152
150
|
## Requirements
|
|
153
151
|
|
|
154
152
|
- **Node.js** `>= 22.0.0`
|
|
155
|
-
- **TypeScript** `5.7+` (for
|
|
153
|
+
- **TypeScript** `5.7+` (for a consumer that uses TypeScript)
|
|
156
154
|
|
|
157
155
|
## License
|
|
158
156
|
|
|
159
157
|
MIT — see [LICENSE](LICENSE).
|
|
160
158
|
|
|
161
|
-
TC39 Signals
|
|
159
|
+
The TC39 Signals polyfill of the XMachines Play Architecture
|
|
162
160
|
|
|
163
|
-
|
|
164
|
-
|
|
161
|
+
This package gives you the fine-grained reactive state primitives of the TC39
|
|
162
|
+
Signals proposal (Stage 1). It keeps the TC39 polyfill in one place, and it
|
|
163
|
+
therefore protects the code from a change of the Stage 1 API.
|
|
165
164
|
|
|
166
|
-
**Architectural
|
|
167
|
-
the reactive primitives that
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
**Architectural context:** the package implements **Signal-Only Reactivity
|
|
166
|
+
(INV-05)**. It gives the reactive primitives that carry the communication from
|
|
167
|
+
the Actor to the infrastructure, without a subscription and without an event
|
|
168
|
+
emitter. Every propagation of state in the Play Architecture uses a TC39 Signal,
|
|
169
|
+
which tracks each dependency and updates without a glitch.
|
|
170
170
|
|
|
171
171
|
## Example
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
The basic use of a signal
|
|
174
174
|
|
|
175
175
|
```typescript
|
|
176
176
|
import { Signal } from "@xmachines/play-signals";
|
|
177
177
|
|
|
178
|
-
// Create state signal
|
|
178
|
+
// Create a state signal
|
|
179
179
|
const count = new Signal.State(0);
|
|
180
180
|
|
|
181
|
-
// Create computed signal
|
|
181
|
+
// Create a computed signal
|
|
182
182
|
const doubled = new Signal.Computed(() => count.get() * 2);
|
|
183
183
|
|
|
184
|
-
// Observe changes
|
|
184
|
+
// Observe the changes
|
|
185
185
|
const watcher = new Signal.subtle.Watcher(() => {
|
|
186
186
|
console.log("Count:", count.get(), "Doubled:", doubled.get());
|
|
187
187
|
});
|
|
@@ -192,19 +192,21 @@ count.set(5); // Logs: Count: 5 Doubled: 10
|
|
|
192
192
|
|
|
193
193
|
## See
|
|
194
194
|
|
|
195
|
-
- [Play RFC](../../../rfc/play.md) -
|
|
195
|
+
- [Play RFC](../../../rfc/play.md) - invariant INV-05
|
|
196
196
|
- [TC39 Signals Proposal](https://github.com/tc39/proposal-signals)
|
|
197
197
|
|
|
198
198
|
## Remarks
|
|
199
199
|
|
|
200
|
-
**Stage 1
|
|
201
|
-
uses the official `signal-polyfill` reference implementation
|
|
202
|
-
|
|
203
|
-
this package
|
|
200
|
+
**Stage 1 status:** TC39 Signals is at Stage 1 in the TC39 process now. This
|
|
201
|
+
package uses the official `signal-polyfill` reference implementation. The code
|
|
202
|
+
therefore stays separate from an API that can change while the proposal
|
|
203
|
+
develops. Import every signal through this package, and the separation stays
|
|
204
|
+
complete.
|
|
204
205
|
|
|
205
|
-
**
|
|
206
|
-
|
|
207
|
-
consuming
|
|
206
|
+
**The reason for the separation:** this dedicated package re-exports the
|
|
207
|
+
polyfill. Therefore one place holds each new polyfill version and each change of
|
|
208
|
+
the API, and no consuming package changes. This architectural decision protects
|
|
209
|
+
the code from a change of the Stage 1 API.
|
|
208
210
|
|
|
209
211
|
## Namespaces
|
|
210
212
|
|
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
function watchSignal<T>(signal, onValue): () => void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-signals/src/watch-signal.ts:21](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.
|
|
9
|
+
Defined in: [packages/play-signals/src/watch-signal.ts:21](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-signals/src/watch-signal.ts#L21)
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Subscribes to one signal, with the canonical one-shot watcher lifecycle.
|
|
12
12
|
|
|
13
|
-
The callback runs from a
|
|
14
|
-
|
|
15
|
-
The
|
|
16
|
-
|
|
13
|
+
The callback runs from a microtask in the queue, after the watcher drains the
|
|
14
|
+
notifications that wait. The watcher then arms itself again, so that it misses no
|
|
15
|
+
later update. The cleanup function is idempotent, because it accepts a watcher
|
|
16
|
+
that is detached already.
|
|
17
17
|
|
|
18
18
|
**Memory safety (Phase 29):**
|
|
19
19
|
|
|
20
|
-
- `disposed` flag
|
|
21
|
-
|
|
22
|
-
- `needsEnqueue` guard
|
|
23
|
-
|
|
20
|
+
- The `disposed` flag stops a callback after the cleanup: the microtask returns at
|
|
21
|
+
once when the cleanup runs before the microtask fires.
|
|
22
|
+
- The `needsEnqueue` guard removes the duplicates of rapid synchronous signal
|
|
23
|
+
changes: one batch of synchronous changes queues one microtask only.
|
|
24
24
|
|
|
25
25
|
## Type Parameters
|
|
26
26
|
|
|
@@ -30,13 +30,13 @@ watchers.
|
|
|
30
30
|
|
|
31
31
|
## Parameters
|
|
32
32
|
|
|
33
|
-
| Parameter | Type | Description
|
|
34
|
-
| --------- | --------------------------------------------------------------------------------------------------------------------------- |
|
|
35
|
-
| `signal` | \| [`State`](../namespaces/Signal/classes/State.md)\<`T`\> \| [`Computed`](../namespaces/Signal/classes/Computed.md)\<`T`\> |
|
|
36
|
-
| `onValue` | (`value`) => `void` |
|
|
33
|
+
| Parameter | Type | Description |
|
|
34
|
+
| --------- | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
|
35
|
+
| `signal` | \| [`State`](../namespaces/Signal/classes/State.md)\<`T`\> \| [`Computed`](../namespaces/Signal/classes/Computed.md)\<`T`\> | The `Signal.State` or `Signal.Computed` to subscribe to. |
|
|
36
|
+
| `onValue` | (`value`) => `void` | The watcher calls it with the current signal value after each change. |
|
|
37
37
|
|
|
38
38
|
## Returns
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
The cleanup function. It removes the watcher.
|
|
41
41
|
|
|
42
42
|
() => `void`
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: ComputedOptions\<T\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-signals/src/types.ts:
|
|
5
|
+
Defined in: [packages/play-signals/src/types.ts:85](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-signals/src/types.ts#L85)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The options of a Signal.Computed
|
|
8
8
|
|
|
9
9
|
## Param
|
|
10
10
|
|
|
11
11
|
**equals**
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
The optional equality function of your own, for the memoization
|
|
14
14
|
|
|
15
15
|
## Example
|
|
16
16
|
|
|
@@ -31,6 +31,6 @@ const options: ComputedOptions<string> = {
|
|
|
31
31
|
|
|
32
32
|
## Properties
|
|
33
33
|
|
|
34
|
-
| Property | Type | Description
|
|
35
|
-
| -------------------------------------- | ----------------------- |
|
|
36
|
-
| <a id="property-equals"></a> `equals?` | (`a`, `b`) => `boolean` |
|
|
34
|
+
| Property | Type | Description | Defined in |
|
|
35
|
+
| -------------------------------------- | ----------------------- | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
36
|
+
| <a id="property-equals"></a> `equals?` | (`a`, `b`) => `boolean` | The equality function of your own, for the memoization | [packages/play-signals/src/types.ts:89](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-signals/src/types.ts#L89) |
|