@xmachines/docs 1.0.0-beta.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -7
- package/api/@xmachines/play/README.md +160 -38
- package/api/@xmachines/play/classes/NonNullableError.md +189 -0
- package/api/@xmachines/play/classes/PlayError.md +251 -0
- package/api/@xmachines/play/functions/assertNonNullable.md +56 -0
- package/api/@xmachines/play/type-aliases/PlayEvent.md +6 -6
- package/api/@xmachines/play-actor/README.md +141 -160
- package/api/@xmachines/play-actor/classes/AbstractActor.md +91 -122
- package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +40 -0
- package/api/@xmachines/play-actor/functions/toAtomState.md +33 -0
- package/api/@xmachines/play-actor/functions/typedSpec.md +54 -0
- package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +46 -0
- package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +33 -0
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +28 -0
- package/api/@xmachines/play-actor/interfaces/Routable.md +6 -21
- package/api/@xmachines/play-actor/interfaces/Viewable.md +12 -6
- package/api/@xmachines/play-dom/README.md +384 -0
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +115 -0
- package/api/@xmachines/play-dom/functions/createPlayUI.md +28 -0
- package/api/@xmachines/play-dom/functions/createRenderer.md +44 -0
- package/api/@xmachines/play-dom/functions/defineRegistry.md +26 -0
- package/api/@xmachines/play-dom/functions/renderSpec.md +67 -0
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +23 -0
- package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +34 -0
- package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +17 -0
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +28 -0
- package/api/@xmachines/play-dom/interfaces/EventHandle.md +15 -0
- package/api/@xmachines/play-dom/interfaces/MountOptions.md +18 -0
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +30 -0
- package/api/@xmachines/play-dom/interfaces/RenderSpecOptions.md +26 -0
- package/api/@xmachines/play-dom/interfaces/UIProviderOptions.md +32 -0
- package/api/@xmachines/play-dom/type-aliases/ActionFn.md +46 -0
- package/api/@xmachines/play-dom/type-aliases/Actions.md +18 -0
- package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +114 -0
- package/api/@xmachines/play-dom/type-aliases/CatalogHasActions.md +25 -0
- package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +26 -0
- package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +15 -0
- package/api/@xmachines/play-dom/type-aliases/ConfirmHandler.md +44 -0
- package/api/@xmachines/play-dom/type-aliases/DefineRegistryOptions.md +39 -0
- package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +20 -0
- package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +9 -0
- package/api/@xmachines/play-dom/type-aliases/DomSchema.md +9 -0
- package/api/@xmachines/play-dom/type-aliases/MountFn.md +27 -0
- package/api/@xmachines/play-dom/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-dom/type-aliases/SetState.md +30 -0
- package/api/@xmachines/play-dom/variables/schema.md +62 -0
- package/api/@xmachines/play-dom-router/README.md +271 -0
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +43 -0
- package/api/@xmachines/{play-router → play-dom-router}/functions/createBrowserHistory.md +10 -2
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-dom-router/functions/createRouter.md +54 -0
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +176 -0
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +69 -0
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +15 -0
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +129 -0
- package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +68 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +54 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +121 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +28 -0
- package/api/@xmachines/play-react/README.md +185 -334
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +46 -42
- package/api/@xmachines/play-react/functions/ActionProvider.md +21 -0
- package/api/@xmachines/play-react/functions/JSONUIProvider.md +21 -0
- package/api/@xmachines/play-react/functions/Renderer.md +21 -0
- package/api/@xmachines/play-react/functions/StateProvider.md +27 -0
- package/api/@xmachines/play-react/functions/ValidationProvider.md +21 -0
- package/api/@xmachines/play-react/functions/VisibilityProvider.md +21 -0
- package/api/@xmachines/play-react/functions/defineRegistry.md +49 -0
- package/api/@xmachines/play-react/functions/useActor.md +13 -0
- package/api/@xmachines/play-react/functions/useBoundProp.md +45 -0
- package/api/@xmachines/play-react/functions/usePlayView.md +32 -0
- package/api/@xmachines/play-react/functions/useSignalEffect.md +29 -20
- package/api/@xmachines/play-react/interfaces/ActionProviderProps.md +15 -0
- package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +27 -0
- package/api/@xmachines/play-react/interfaces/ComponentContext.md +37 -0
- package/api/@xmachines/play-react/interfaces/JSONUIProviderProps.md +22 -0
- 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 +26 -0
- package/api/@xmachines/play-react/interfaces/RendererProps.md +17 -0
- package/api/@xmachines/play-react/interfaces/StateProviderProps.md +16 -0
- package/api/@xmachines/play-react/interfaces/ValidationProviderProps.md +14 -0
- package/api/@xmachines/play-react/interfaces/ViewContextValue.md +20 -0
- package/api/@xmachines/play-react/interfaces/VisibilityProviderProps.md +13 -0
- package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-react/type-aliases/ComponentFn.md +36 -0
- package/api/@xmachines/play-react/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-react/variables/ActorProvider.md +33 -0
- package/api/@xmachines/play-react/variables/PlayRenderer.md +6 -56
- package/api/@xmachines/play-react/variables/PlayUIProvider.md +43 -0
- package/api/@xmachines/play-react-router/README.md +130 -114
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +19 -242
- package/api/@xmachines/play-react-router/classes/RouteMap.md +48 -36
- package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +45 -0
- package/api/@xmachines/play-react-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +23 -12
- package/api/@xmachines/play-react-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +32 -0
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +25 -9
- package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +19 -9
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
- package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +32 -0
- package/api/@xmachines/play-router/README.md +275 -353
- package/api/@xmachines/play-router/classes/RouteMap.md +149 -0
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +21 -221
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +32 -0
- package/api/@xmachines/play-router/functions/buildRouteTree.md +12 -2
- package/api/@xmachines/play-router/functions/createRouteMap.md +22 -36
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +46 -0
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +14 -7
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +10 -46
- package/api/@xmachines/play-router/functions/extractQuery.md +22 -0
- package/api/@xmachines/play-router/functions/extractRouteParams.md +54 -0
- package/api/@xmachines/play-router/functions/findRouteById.md +2 -2
- package/api/@xmachines/play-router/functions/findRouteByPath.md +2 -2
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +2 -2
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +2 -2
- package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +43 -0
- package/api/@xmachines/play-router/functions/isRouteReachable.md +38 -0
- package/api/@xmachines/play-router/functions/machineToGraph.md +19 -0
- package/api/@xmachines/play-router/functions/routeExists.md +2 -2
- package/api/@xmachines/play-router/functions/sanitizePathname.md +40 -0
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -9
- package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
- package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +13 -0
- package/api/@xmachines/play-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +15 -0
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +17 -0
- package/api/@xmachines/play-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +17 -0
- package/api/@xmachines/play-router/interfaces/RoutableActor.md +64 -0
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
- package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +12 -0
- package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
- package/api/@xmachines/play-router/interfaces/RouteObject.md +5 -5
- package/api/@xmachines/play-router/interfaces/RouteTree.md +8 -7
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +55 -0
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +20 -0
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
- package/api/@xmachines/play-signals/README.md +116 -65
- package/api/@xmachines/play-signals/functions/watchSignal.md +42 -0
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +7 -5
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +3 -3
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +7 -5
- package/api/@xmachines/play-signals/interfaces/SignalState.md +4 -4
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +5 -5
- package/api/@xmachines/play-signals/namespaces/Signal/README.md +1 -1
- package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +7 -7
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +8 -8
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +7 -7
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/README.md +1 -1
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +9 -9
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +2 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +2 -2
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +2 -2
- package/api/@xmachines/play-solid/README.md +196 -234
- package/api/@xmachines/play-solid/functions/ActionProvider.md +19 -0
- package/api/@xmachines/play-solid/functions/JSONUIProvider.md +21 -0
- package/api/@xmachines/play-solid/functions/Renderer.md +21 -0
- package/api/@xmachines/play-solid/functions/StateProvider.md +19 -0
- package/api/@xmachines/play-solid/functions/ValidationProvider.md +19 -0
- package/api/@xmachines/play-solid/functions/VisibilityProvider.md +20 -0
- package/api/@xmachines/play-solid/functions/defineRegistry.md +49 -0
- package/api/@xmachines/play-solid/functions/useAction.md +24 -0
- package/api/@xmachines/play-solid/functions/useActions.md +13 -0
- package/api/@xmachines/play-solid/functions/useActor.md +13 -0
- package/api/@xmachines/play-solid/functions/useBoundProp.md +45 -0
- package/api/@xmachines/play-solid/functions/useFieldValidation.md +29 -0
- package/api/@xmachines/play-solid/functions/useIsVisible.md +19 -0
- package/api/@xmachines/play-solid/functions/useOptionalValidation.md +13 -0
- package/api/@xmachines/play-solid/functions/usePlayView.md +30 -0
- package/api/@xmachines/play-solid/functions/useStateBinding.md +25 -0
- package/api/@xmachines/play-solid/functions/useStateStore.md +13 -0
- package/api/@xmachines/play-solid/functions/useStateValue.md +25 -0
- package/api/@xmachines/play-solid/functions/useVisibility.md +13 -0
- package/api/@xmachines/play-solid/interfaces/ActionProviderProps.md +12 -0
- package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +30 -0
- package/api/@xmachines/play-solid/interfaces/ComponentContext.md +37 -0
- package/api/@xmachines/play-solid/interfaces/DefineRegistryResult.md +15 -0
- package/api/@xmachines/play-solid/interfaces/JSONUIProviderProps.md +22 -0
- package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +26 -0
- package/api/@xmachines/play-solid/interfaces/RendererProps.md +17 -0
- package/api/@xmachines/play-solid/interfaces/StateProviderProps.md +13 -0
- package/api/@xmachines/play-solid/interfaces/ValidationProviderProps.md +11 -0
- package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +21 -0
- package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +36 -0
- package/api/@xmachines/play-solid/type-aliases/ComponentRegistry.md +11 -0
- package/api/@xmachines/play-solid/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-solid/type-aliases/SetState.md +21 -0
- package/api/@xmachines/play-solid/type-aliases/VisibilityProviderProps.md +9 -0
- package/api/@xmachines/play-solid/variables/ActorContext.md +13 -0
- package/api/@xmachines/play-solid/variables/ActorProvider.md +27 -0
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -62
- package/api/@xmachines/play-solid/variables/PlayUIProvider.md +26 -0
- package/api/@xmachines/play-solid-router/README.md +151 -560
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +31 -32
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +27 -242
- package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +44 -0
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +18 -11
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +84 -115
- package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +30 -0
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +25 -9
- package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +20 -7
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +34 -0
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +8 -4
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +22 -19
- package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +52 -0
- package/api/@xmachines/play-svelte/README.md +269 -0
- package/api/@xmachines/play-svelte/functions/defineRegistry.md +31 -0
- package/api/@xmachines/play-svelte/functions/getActorContext.md +21 -0
- package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +19 -0
- package/api/@xmachines/play-svelte/functions/setActorContext.md +19 -0
- package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +44 -0
- package/api/@xmachines/play-svelte/interfaces/BaseComponentProps.md +29 -0
- package/api/@xmachines/play-svelte/interfaces/ComponentContext.md +29 -0
- package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +24 -0
- package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +43 -0
- package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +24 -0
- package/api/@xmachines/play-svelte/type-aliases/ActionFn.md +30 -0
- package/api/@xmachines/play-svelte/type-aliases/Actions.md +17 -0
- package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-svelte/type-aliases/ComponentFn.md +18 -0
- package/api/@xmachines/play-svelte/type-aliases/JSONUIProviderProps.md +7 -0
- package/api/@xmachines/play-svelte/type-aliases/PlayRenderer.md +9 -0
- package/api/@xmachines/play-svelte/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-svelte/type-aliases/SetState.md +21 -0
- package/api/@xmachines/play-svelte/variables/PlayRenderer.md +9 -0
- package/api/@xmachines/play-svelte-spa-router/README.md +199 -0
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +149 -0
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +32 -0
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +17 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +129 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +65 -0
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-sveltekit-router/README.md +211 -0
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +149 -0
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +32 -0
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +39 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +13 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +27 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +129 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +27 -0
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-tanstack-react-router/README.md +155 -126
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +48 -36
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +31 -252
- package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +45 -0
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +22 -36
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +23 -12
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +28 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +32 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +25 -9
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +19 -9
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +6 -6
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +40 -18
- package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +34 -0
- package/api/@xmachines/play-tanstack-router/README.md +58 -0
- package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +131 -0
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +57 -0
- package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +100 -0
- package/api/@xmachines/play-tanstack-solid-router/README.md +215 -175
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +31 -32
- package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +121 -0
- package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +44 -0
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +18 -11
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +31 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +23 -9
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +14 -10
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +8 -4
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +40 -18
- package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +33 -0
- package/api/@xmachines/play-vue/README.md +192 -210
- package/api/@xmachines/play-vue/functions/defineRegistry.md +32 -0
- package/api/@xmachines/play-vue/functions/getPlayViewContext.md +28 -0
- package/api/@xmachines/play-vue/functions/useActor.md +13 -0
- package/api/@xmachines/play-vue/functions/useBoundProp.md +45 -0
- package/api/@xmachines/play-vue/interfaces/ActionProviderProps.md +12 -0
- package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +25 -0
- package/api/@xmachines/play-vue/interfaces/ComponentContext.md +37 -0
- package/api/@xmachines/play-vue/interfaces/DefineRegistryResult.md +15 -0
- package/api/@xmachines/play-vue/interfaces/JSONUIProviderProps.md +21 -0
- package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +24 -0
- package/api/@xmachines/play-vue/interfaces/RendererProps.md +17 -0
- package/api/@xmachines/play-vue/interfaces/StateProviderProps.md +15 -0
- package/api/@xmachines/play-vue/interfaces/ValidationProviderProps.md +11 -0
- package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +21 -0
- package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +5 -0
- package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +16 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentFn.md +35 -0
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +15 -0
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +22 -0
- package/api/@xmachines/play-vue/type-aliases/RenderErrorHandler.md +23 -0
- package/api/@xmachines/play-vue/variables/ActionProvider.md +64 -0
- package/api/@xmachines/play-vue/variables/JSONUIProvider.md +105 -0
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +2 -2
- package/api/@xmachines/play-vue/variables/Renderer.md +88 -0
- package/api/@xmachines/play-vue/variables/StateProvider.md +79 -0
- package/api/@xmachines/play-vue/variables/ValidationProvider.md +55 -0
- package/api/@xmachines/play-vue/variables/VisibilityProvider.md +40 -0
- package/api/@xmachines/play-vue-router/README.md +173 -487
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +56 -116
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +23 -271
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +26 -6
- package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +68 -0
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +22 -12
- package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +13 -0
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +20 -8
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +8 -8
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +8 -4
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +12 -6
- package/api/@xmachines/play-xstate/README.md +178 -347
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +161 -191
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +31 -20
- package/api/@xmachines/play-xstate/functions/composeGuards.md +2 -2
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +2 -2
- package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +38 -0
- package/api/@xmachines/play-xstate/functions/definePlayer.md +14 -63
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +3 -3
- package/api/@xmachines/play-xstate/functions/eventMatches.md +2 -2
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +3 -3
- package/api/@xmachines/play-xstate/functions/hasContext.md +2 -2
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +2 -2
- package/api/@xmachines/play-xstate/functions/negateGuard.md +2 -2
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +10 -14
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +22 -0
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +12 -13
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -13
- package/api/@xmachines/play-xstate/interfaces/RouteObject.md +17 -0
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +2 -2
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +3 -3
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +10 -9
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +15 -5
- package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +9 -0
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +22 -6
- package/api/@xmachines/shared/README.md +95 -295
- package/api/@xmachines/shared/vite-aliases/README.md +11 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +38 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +27 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +30 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +42 -0
- package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +33 -0
- package/api/@xmachines/shared/vitest/README.md +12 -0
- package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +42 -0
- package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +34 -0
- package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +16 -0
- package/api/README.md +6 -7
- package/api/llms.txt +72 -23
- package/contributing/README.md +10 -0
- package/contributing/architecture.md +599 -0
- package/contributing/configuration.md +368 -0
- package/contributing/deployment.md +312 -0
- package/contributing/development.md +464 -0
- package/contributing/testing.md +453 -0
- package/examples/@xmachines/play-dom-demo/README.md +181 -0
- package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +24 -0
- package/examples/@xmachines/play-dom-demo/functions/initShell.md +24 -0
- package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-dom-demo/variables/About.md +12 -0
- package/examples/@xmachines/play-dom-demo/variables/Contact.md +12 -0
- package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Home.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Login.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +16 -0
- package/examples/@xmachines/play-dom-demo/variables/Navigation.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Overview.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Profile.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Settings.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/Stats.md +13 -0
- package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-dom-router-demo/README.md +145 -0
- package/examples/@xmachines/play-react-demo/README.md +187 -0
- package/examples/@xmachines/play-react-demo/functions/App.md +13 -0
- package/examples/@xmachines/play-react-demo/functions/DebugPanel.md +20 -0
- package/examples/@xmachines/play-react-demo/functions/HeaderNav.md +20 -0
- package/examples/@xmachines/play-react-demo/functions/Shell.md +22 -0
- package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-react-demo/variables/About.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Contact.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Dashboard.md +15 -0
- package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +15 -0
- package/examples/@xmachines/play-react-demo/variables/Home.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Login.md +16 -0
- package/examples/@xmachines/play-react-demo/variables/NavBar.md +16 -0
- package/examples/@xmachines/play-react-demo/variables/NavBarView.md +15 -0
- package/examples/@xmachines/play-react-demo/variables/Navigation.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Overview.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Profile.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Settings.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/Shell.md +18 -0
- package/examples/@xmachines/play-react-demo/variables/Stats.md +14 -0
- package/examples/@xmachines/play-react-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-react-router-demo/README.md +151 -0
- package/examples/@xmachines/play-solid-demo/README.md +187 -0
- package/examples/@xmachines/play-solid-demo/functions/App.md +13 -0
- package/examples/@xmachines/play-solid-demo/functions/DebugPanel.md +20 -0
- package/examples/@xmachines/play-solid-demo/functions/HeaderNav.md +20 -0
- package/examples/@xmachines/play-solid-demo/functions/Shell.md +22 -0
- package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/About.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Contact.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +15 -0
- package/examples/@xmachines/play-solid-demo/variables/Home.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Login.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/NavBar.md +11 -0
- package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +15 -0
- package/examples/@xmachines/play-solid-demo/variables/Navigation.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Overview.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Profile.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Settings.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/Shell.md +17 -0
- package/examples/@xmachines/play-solid-demo/variables/Stats.md +9 -0
- package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-solid-router-demo/README.md +137 -0
- package/examples/@xmachines/play-svelte-demo/README.md +143 -0
- package/examples/@xmachines/play-svelte-demo/type-aliases/App.md +9 -0
- package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-svelte-demo/variables/App.md +9 -0
- package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-svelte-spa-router-demo/README.md +129 -0
- package/examples/@xmachines/play-sveltekit-router-demo/README.md +133 -0
- package/examples/@xmachines/play-tanstack-react-router-demo/README.md +156 -0
- package/examples/@xmachines/play-tanstack-solid-router-demo/README.md +139 -0
- package/examples/@xmachines/play-vue-demo/README.md +183 -0
- package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +9 -0
- package/examples/@xmachines/play-vue-demo/variables/App.md +9 -0
- package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +172 -0
- package/examples/@xmachines/play-vue-router-demo/README.md +139 -0
- package/examples/README.md +78 -30
- package/examples/basic-state-machine.md +75 -31
- package/examples/form-validation.md +261 -118
- package/examples/multi-router-integration.md +314 -194
- package/examples/routing-patterns.md +230 -189
- package/examples/traffic-light.md +114 -65
- package/guides/README.md +9 -21
- package/guides/actor-model.md +180 -0
- package/guides/getting-started.md +619 -137
- package/guides/signals.md +166 -0
- package/guides/state-machines.md +284 -0
- package/package.json +18 -7
- package/rfc/broker.md +100 -0
- package/rfc/browser.md +44 -0
- package/rfc/cli.md +118 -0
- package/rfc/git.md +61 -0
- package/rfc/mcp.md +43 -0
- package/rfc/node.md +36 -0
- package/rfc/play.md +472 -0
- package/rfc/rest.md +102 -0
- package/rfc/run.md +159 -0
- package/rfc/streams.md +168 -0
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +0 -17
- package/api/@xmachines/play-catalog/README.md +0 -331
- package/api/@xmachines/play-catalog/functions/defineCatalog.md +0 -98
- package/api/@xmachines/play-catalog/functions/defineComponents.md +0 -134
- package/api/@xmachines/play-catalog/type-aliases/Catalog.md +0 -48
- package/api/@xmachines/play-catalog/type-aliases/ComponentsFor.md +0 -20
- package/api/@xmachines/play-catalog/type-aliases/InferComponentProps.md +0 -65
- package/api/@xmachines/play-catalog/type-aliases/NoExtraKeys.md +0 -17
- package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +0 -15
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-react-router-demo/README.md +0 -137
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +0 -142
- package/api/@xmachines/play-router/functions/connectRouter.md +0 -67
- package/api/@xmachines/play-router/functions/crawlMachine.md +0 -92
- package/api/@xmachines/play-router/functions/createRouter.md +0 -76
- package/api/@xmachines/play-router/functions/extractRoute.md +0 -45
- package/api/@xmachines/play-router/interfaces/BaseRouteMapping.md +0 -27
- package/api/@xmachines/play-router/interfaces/BrowserHistory.md +0 -172
- package/api/@xmachines/play-router/interfaces/BrowserWindow.md +0 -69
- package/api/@xmachines/play-router/interfaces/ConnectRouterOptions.md +0 -13
- package/api/@xmachines/play-router/interfaces/RouteMap.md +0 -56
- package/api/@xmachines/play-router/interfaces/StateVisit.md +0 -15
- package/api/@xmachines/play-router/interfaces/VanillaRouter.md +0 -28
- package/api/@xmachines/play-router-demo/README.md +0 -137
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +0 -15
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-solid-router-demo/README.md +0 -127
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +0 -38
- package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +0 -33
- package/api/@xmachines/play-tanstack-react-router/variables/extractMachineRoutes.md +0 -64
- package/api/@xmachines/play-tanstack-react-router-demo/README.md +0 -126
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +0 -343
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +0 -19
- package/api/@xmachines/play-tanstack-solid-router-demo/README.md +0 -126
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +0 -14
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +0 -201
- package/api/@xmachines/play-vue-router-demo/README.md +0 -133
- package/api/@xmachines/play-xstate/functions/mergeViewProps.md +0 -26
- package/api/@xmachines/play-xstate/functions/stateMatches.md +0 -25
- package/api/@xmachines/play-xstate/functions/validateComponentBinding.md +0 -39
- package/api/@xmachines/play-xstate/functions/validateViewProps.md +0 -80
- package/api/@xmachines/play-xstate/interfaces/CatalogEntry.md +0 -16
- package/api/@xmachines/play-xstate/type-aliases/Catalog.md +0 -21
- package/api/@xmachines/play-xstate/type-aliases/ValidationResult.md +0 -17
- package/api/@xmachines/play-xstate/type-aliases/ViewMergeContext.md +0 -35
- package/api/@xmachines/shared/functions/defineXmVitestConfig.md +0 -29
- package/api/@xmachines/shared/functions/xmAliases.md +0 -24
- package/guides/installation.md +0 -323
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
[Examples](../../README.md) / @xmachines/play-sveltekit-router-demo
|
|
2
|
+
|
|
3
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
+
|
|
5
|
+
# @xmachines/play-sveltekit-router-demo
|
|
6
|
+
|
|
7
|
+
Svelte 5 + SvelteKit router adapter integration demo for the XMachines Play architecture using browser pathname URL routing.
|
|
8
|
+
|
|
9
|
+
## What This Demonstrates
|
|
10
|
+
|
|
11
|
+
- Shared auth machine reused without framework-specific business logic
|
|
12
|
+
- `connectRouter` pathname URL ↔ actor sync via [`@xmachines/play-sveltekit-router`](../../../api/@xmachines/play-sveltekit-router/README.md)
|
|
13
|
+
- Shell-driven rendering via `PlayUIProvider` + `PlayRenderer` with actor-authoritative navigation
|
|
14
|
+
- Canonical TC39 Signals lifecycle integrated with Svelte 5 runes
|
|
15
|
+
- Non-browser invariant tests plus browser E2E coverage
|
|
16
|
+
|
|
17
|
+
## Running the Demo
|
|
18
|
+
|
|
19
|
+
From the repository root:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install
|
|
23
|
+
pnpm --filter @xmachines/play-sveltekit-router-demo run dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then open `http://localhost:3009`.
|
|
27
|
+
|
|
28
|
+
## Step-by-Step Code Flow
|
|
29
|
+
|
|
30
|
+
Use this order to understand the implementation:
|
|
31
|
+
|
|
32
|
+
1. `src/main.ts` mounts `App.svelte` and registers HMR cleanup via `cleanup`.
|
|
33
|
+
2. `src/runtime.ts` creates the actor, builds the registry, calls `createRouteMap(authMachine)`, and wires `connectRouter({ actor, routeMap })`.
|
|
34
|
+
3. `connectRouter` synchronizes browser pathname changes with the actor via `play.route` events and reflects actor-approved routes back to the pathname URL.
|
|
35
|
+
4. `src/App.svelte` imports the singleton `actor` and `registryResult` from `src/runtime.ts` and delegates to the shared `Shell.svelte`.
|
|
36
|
+
5. `Shell.svelte` renders `<PlayUIProvider>` + `<PlayRenderer />` with the actor and registryResult and provides the shared UI shell (nav, debug panel).
|
|
37
|
+
6. Browser tests in `test/browser/` validate startup and auth route transitions.
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
// src/runtime.ts (shape)
|
|
41
|
+
const createDemoPlayer = definePlayer({ machine: authMachine });
|
|
42
|
+
export const actor = createDemoPlayer();
|
|
43
|
+
actor.start();
|
|
44
|
+
|
|
45
|
+
export const routeMap = createRouteMap(authMachine);
|
|
46
|
+
export const disconnectRouter = connectRouter({ actor, routeMap });
|
|
47
|
+
|
|
48
|
+
export function cleanup(): void {
|
|
49
|
+
disconnectRouter();
|
|
50
|
+
actor.stop();
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```svelte
|
|
55
|
+
<!-- src/App.svelte (shape) -->
|
|
56
|
+
<script lang="ts">
|
|
57
|
+
import { Shell } from "@xmachines/play-svelte-demo";
|
|
58
|
+
import { actor, registryResult } from "./runtime.js";
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<Shell {actor} {registryResult} />
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```svelte
|
|
65
|
+
<!-- Shell.svelte — rendering (shape) -->
|
|
66
|
+
<PlayUIProvider actor={props.actor} registryResult={props.registryResult}>
|
|
67
|
+
<PlayRenderer />
|
|
68
|
+
</PlayUIProvider>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Key Files
|
|
72
|
+
|
|
73
|
+
- `src/main.ts` - Svelte app mount and HMR cleanup registration
|
|
74
|
+
- `src/runtime.ts` - actor creation, registry construction, route map, and `connectRouter` wiring
|
|
75
|
+
- `src/lib/navigation.ts` - History API shim implementing SvelteKit's `$app/navigation` contract for Vite dev and production builds
|
|
76
|
+
- `src/app-navigation.d.ts` - TypeScript ambient declaration for the `$app/navigation` module
|
|
77
|
+
- `src/App.svelte` - minimal root component delegating to shared `Shell.svelte`
|
|
78
|
+
- `test/library-pattern.test.ts` - architecture boundary and invariant assertions
|
|
79
|
+
- `test/browser/shared-demo.browser.test.ts` - browser startup and auth route flow coverage
|
|
80
|
+
|
|
81
|
+
## State Machine & Architecture Details
|
|
82
|
+
|
|
83
|
+
The demo utilizes XMachines architectural invariants:
|
|
84
|
+
|
|
85
|
+
1. **Actor Authority:** When a user clicks a nav link, the browser pathname changes. `connectRouter` intercepts this, translates it to a `play.route` event, and sends it to the actor. The actor evaluates guards (e.g. `isAuthenticated`) and transitions to the appropriate state.
|
|
86
|
+
2. **Passive Infrastructure:** The SvelteKit router adapter does not execute business logic. The actor dictates whether navigation is permitted. The Svelte application only renders the state.
|
|
87
|
+
3. **Signal-Only Reactivity:** The bridge leverages Svelte 5 rune reactivity internally to react precisely when actor signals update, without ad-hoc `$state` stores for business logic.
|
|
88
|
+
|
|
89
|
+
## Watcher Lifecycle and Cleanup Contract
|
|
90
|
+
|
|
91
|
+
This demo follows the canonical watcher lifecycle used across all `@xmachines` framework adapters:
|
|
92
|
+
|
|
93
|
+
1. `notify`
|
|
94
|
+
2. `queueMicrotask`
|
|
95
|
+
3. `getPending()`
|
|
96
|
+
4. Read actor signals and project Svelte-local render state
|
|
97
|
+
5. Re-arm with `watch()`/`watch(...signals)`
|
|
98
|
+
|
|
99
|
+
Watcher notifications are one-shot. Cleanup is explicit: `cleanup()` calls `disconnectRouter()` and `actor.stop()` during HMR disposal, preventing memory leaks and ghost subscriptions.
|
|
100
|
+
|
|
101
|
+
## Adapter Boundaries
|
|
102
|
+
|
|
103
|
+
`connectRouter` (from [`@xmachines/play-sveltekit-router`](../../../api/@xmachines/play-sveltekit-router/README.md)) is passive infrastructure. It translates pathname URL changes into `play.route` events and reflects actor-approved route changes back to the browser pathname. Business validity remains actor-owned. The shared `Shell.svelte` from `@xmachines/play-svelte-demo` is reused to avoid duplicating view components across router demos.
|
|
104
|
+
|
|
105
|
+
The `$app/navigation` module is shimmed by `src/lib/navigation.ts` using the History API, so the demo runs outside a full SvelteKit project (plain Vite dev server and production build).
|
|
106
|
+
|
|
107
|
+
## Available Scripts
|
|
108
|
+
|
|
109
|
+
These commands are defined in `package.json`:
|
|
110
|
+
|
|
111
|
+
| Command | Description |
|
|
112
|
+
| ---------------------------------------------------------------------- | ---------------------------------------------- |
|
|
113
|
+
| `pnpm --filter @xmachines/play-sveltekit-router-demo run dev` | Start Vite dev server (http://localhost:3009/) |
|
|
114
|
+
| `pnpm --filter @xmachines/play-sveltekit-router-demo run build` | Build production bundle |
|
|
115
|
+
| `pnpm --filter @xmachines/play-sveltekit-router-demo run preview` | Preview built bundle |
|
|
116
|
+
| `pnpm --filter @xmachines/play-sveltekit-router-demo run test` | Run Vitest test suite |
|
|
117
|
+
| `pnpm --filter @xmachines/play-sveltekit-router-demo run test:browser` | Run browser-focused Vitest suite |
|
|
118
|
+
|
|
119
|
+
## Verification
|
|
120
|
+
|
|
121
|
+
Use these checks to validate README claims against the current demo implementation:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pnpm --filter @xmachines/play-sveltekit-router-demo run test
|
|
125
|
+
pnpm --filter @xmachines/play-sveltekit-router-demo run test:browser
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Expected result: library-pattern invariant tests pass and the browser demo suite validates startup rendering and auth navigation.
|
|
129
|
+
|
|
130
|
+
## Learn More
|
|
131
|
+
|
|
132
|
+
- [SvelteKit Router](../../../api/@xmachines/play-sveltekit-router/README.md)
|
|
133
|
+
- [Svelte](../../../api/@xmachines/play-svelte/README.md)
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
[Examples](../../README.md) / @xmachines/play-tanstack-react-router-demo
|
|
2
|
+
|
|
3
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
+
|
|
5
|
+
# @xmachines/play-tanstack-react-router-demo
|
|
6
|
+
|
|
7
|
+
React + TanStack Router integration demo for the XMachines Play architecture with actor-authoritative routing.
|
|
8
|
+
|
|
9
|
+
## What This Demonstrates
|
|
10
|
+
|
|
11
|
+
- Shared auth machine reused without framework-specific business logic
|
|
12
|
+
- `PlayRouterProvider` renderer-based integration with TanStack Router
|
|
13
|
+
- Shell-driven rendering via `PlayRenderer` with actor-authoritative navigation
|
|
14
|
+
- Non-browser invariant tests plus browser E2E coverage
|
|
15
|
+
|
|
16
|
+
## Running the Demo
|
|
17
|
+
|
|
18
|
+
From the repository root:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm install
|
|
22
|
+
pnpm --filter @xmachines/play-tanstack-react-router-demo run dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then open `http://localhost:3011`.
|
|
26
|
+
|
|
27
|
+
## Step-by-Step Code Flow
|
|
28
|
+
|
|
29
|
+
Use this order to understand the implementation:
|
|
30
|
+
|
|
31
|
+
1. `src/main.tsx` mounts `<App />`.
|
|
32
|
+
2. `src/App.tsx` calls `useMemo(createAppRuntime, [])` to create the actor from the shared machine and start it once per mounted app.
|
|
33
|
+
3. `src/runtime.ts` exports `createPlayer` (via `definePlayer`), `routeMap` (via `createRouteMap(authMachine)`), and `createRegistryResult` which binds UI components and actor event actions.
|
|
34
|
+
4. `createAppRuntime()` constructs a TanStack `createRootRoute`/`createRouter` instance, then `PlayRouterProvider` bridges it to the actor and renders `Shell` via `renderer(actor, router)`.
|
|
35
|
+
5. `Shell` renders `PlayRenderer`, header/nav, and debug panel from actor state.
|
|
36
|
+
6. Tests in `test/` and `test/browser/` validate invariant and runtime behavior.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
// src/App.tsx (shape)
|
|
40
|
+
function createAppRuntime() {
|
|
41
|
+
const actor = createPlayer();
|
|
42
|
+
actor.start();
|
|
43
|
+
|
|
44
|
+
const registryResult = createRegistryResult(actor);
|
|
45
|
+
|
|
46
|
+
const rootRoute = createRootRoute();
|
|
47
|
+
const router = createRouter({ routeTree: rootRoute, defaultPreload: "intent" });
|
|
48
|
+
|
|
49
|
+
return { actor, router, registryResult };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const { actor, router, registryResult } = useMemo(createAppRuntime, []);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<PlayRouterProvider
|
|
56
|
+
actor={actor}
|
|
57
|
+
router={router}
|
|
58
|
+
routeMap={routeMap}
|
|
59
|
+
renderer={(currentActor, currentRouter) => (
|
|
60
|
+
<Shell actor={currentActor} router={currentRouter} registryResult={registryResult} />
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
// src/runtime.ts (shape)
|
|
68
|
+
export const createPlayer = definePlayer({ machine: authMachine });
|
|
69
|
+
export const routeMap = createRouteMap(authMachine);
|
|
70
|
+
|
|
71
|
+
export function createRegistryResult(actor) {
|
|
72
|
+
return defineRegistry(authCatalog, {
|
|
73
|
+
actions: {
|
|
74
|
+
login: async (args) => actor.send({ type: "auth.login", username: args.username }),
|
|
75
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
76
|
+
route: async (args) => actor.send({ type: "play.route", to: args.to, ...args.params }),
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Key Files
|
|
83
|
+
|
|
84
|
+
- `src/main.tsx` - React entry point that mounts `<App />`
|
|
85
|
+
- `src/App.tsx` - actor lifecycle, provider wiring, and `Shell` rendering
|
|
86
|
+
- `src/runtime.ts` - actor factory, route map creation, and registry/action binding
|
|
87
|
+
- `test/actor-authority.test.ts` - actor authority and guarded navigation behavior
|
|
88
|
+
- `test/passive-infra.test.ts` - passive infrastructure separation contracts
|
|
89
|
+
- `test/strict-separation.test.ts` - machine/view infrastructure separation contracts
|
|
90
|
+
- `test/signal-only.test.ts` - signal-only reactivity invariant
|
|
91
|
+
- `test/route-parameters.test.ts` - route parameter handling
|
|
92
|
+
- `test/invalid-route-redirect.test.ts` - invalid route redirect behavior
|
|
93
|
+
- `test/xstate-route-events.test.ts` - XState route event contracts
|
|
94
|
+
- `test/browser/shared-demo.browser.test.tsx` - canonical browser auth flow
|
|
95
|
+
- `test/browser/auth-flow.browser.test.tsx` - extended browser auth flow checks
|
|
96
|
+
- `test/browser/back-forward-sync.browser.test.tsx` - URL sync and history behavior
|
|
97
|
+
- `test/browser/dashboard-logout.browser.test.tsx` - logout and redirection flow
|
|
98
|
+
- `test/browser/guard-rejection.browser.test.tsx` - guard-driven rejection in browser
|
|
99
|
+
- `test/browser/login-flow.browser.test.tsx` - login flow browser coverage
|
|
100
|
+
- `test/browser/navigation.browser.test.tsx` - navigation behavior in browser
|
|
101
|
+
- `test/browser/settings-parameter.browser.test.tsx` - parameterized route in browser
|
|
102
|
+
- `test/browser/invalid-route-redirect.browser.test.tsx` - invalid route redirect in browser
|
|
103
|
+
- `test/browser/tanstack-integration.browser.test.tsx` - TanStack Router integration checks
|
|
104
|
+
|
|
105
|
+
## State Machine & Architecture Details
|
|
106
|
+
|
|
107
|
+
The demo utilizes XMachines architectural invariants:
|
|
108
|
+
|
|
109
|
+
1. **Actor Authority:** When a user navigates to a protected route, TanStack Router updates the URL. The `PlayRouterProvider` intercepts this, translates it to a `play.route` event, and sends it to the actor. The actor evaluates guards (e.g. `isAuthenticated`) and executes state transitions.
|
|
110
|
+
2. **Passive Infrastructure:** The router does not execute route loaders or guards for business logic. The actor dictates whether navigation is permitted.
|
|
111
|
+
3. **Signal-Only Reactivity:** The bridge leverages React's internal mechanisms combined with TanStack's `router.subscribe` to react precisely when signals update, without relying on `useEffect` synchronization inside the application codebase.
|
|
112
|
+
|
|
113
|
+
## Watcher Lifecycle and Cleanup Contract
|
|
114
|
+
|
|
115
|
+
This demo follows the canonical watcher lifecycle:
|
|
116
|
+
|
|
117
|
+
1. `notify`
|
|
118
|
+
2. `queueMicrotask`
|
|
119
|
+
3. `getPending()`
|
|
120
|
+
4. Read actor signals and trigger React state updates
|
|
121
|
+
5. Re-arm with `watch()`/`watch(...signals)`
|
|
122
|
+
|
|
123
|
+
Watcher notifications are one-shot. Cleanup is explicit and lifecycle-bound: the provider automatically triggers `bridge.disconnect()` when the component tree unmounts to prevent memory leaks and zombie subscriptions.
|
|
124
|
+
|
|
125
|
+
## Adapter Boundaries
|
|
126
|
+
|
|
127
|
+
The TanStack React adapter wraps TanStack's `router.navigate({ to })` and `router.subscribe` methods while delegating core synchronization policy to `RouterBridgeBase`.
|
|
128
|
+
|
|
129
|
+
## Available Scripts
|
|
130
|
+
|
|
131
|
+
These commands are defined in `package.json`:
|
|
132
|
+
|
|
133
|
+
| Command | Description |
|
|
134
|
+
| --------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
135
|
+
| `pnpm --filter @xmachines/play-tanstack-react-router-demo run dev` | Start Vite dev server (http://localhost:3011/) |
|
|
136
|
+
| `pnpm --filter @xmachines/play-tanstack-react-router-demo run build` | Build production bundle |
|
|
137
|
+
| `pnpm --filter @xmachines/play-tanstack-react-router-demo run preview` | Preview built bundle |
|
|
138
|
+
| `pnpm --filter @xmachines/play-tanstack-react-router-demo run test` | Run Vitest test suite |
|
|
139
|
+
| `pnpm --filter @xmachines/play-tanstack-react-router-demo run test:browser` | Run browser-focused Vitest suite |
|
|
140
|
+
|
|
141
|
+
## Verification
|
|
142
|
+
|
|
143
|
+
Use these checks to validate README claims against the current demo implementation:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pnpm --filter @xmachines/play-tanstack-react-router-demo run test
|
|
147
|
+
pnpm --filter @xmachines/play-tanstack-react-router-demo run test:browser
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Expected result: invariant test suite and the browser shared-demo suite both pass, confirming actor authority, route sync, and guard-driven redirection.
|
|
151
|
+
|
|
152
|
+
## Learn More
|
|
153
|
+
|
|
154
|
+
- [TanStack React Router](../../../api/@xmachines/play-tanstack-react-router/README.md)
|
|
155
|
+
- [React](../../../api/@xmachines/play-react/README.md)
|
|
156
|
+
- [TanStack Solid Router](../play-tanstack-solid-router-demo/README.md)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
[Examples](../../README.md) / @xmachines/play-tanstack-solid-router-demo
|
|
2
|
+
|
|
3
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
+
|
|
5
|
+
# @xmachines/play-tanstack-solid-router-demo
|
|
6
|
+
|
|
7
|
+
Solid + `@tanstack/solid-router` integration demo for the XMachines Play architecture with actor-authoritative routing.
|
|
8
|
+
|
|
9
|
+
## What This Demonstrates
|
|
10
|
+
|
|
11
|
+
- Shared auth machine reused without framework-specific business logic
|
|
12
|
+
- `PlayRouterProvider` renderer-based integration with TanStack Router
|
|
13
|
+
- Shell-driven rendering via `PlayRenderer` with actor-authoritative navigation
|
|
14
|
+
- Object-based routing and deep location observation using TanStack's Solid primitives
|
|
15
|
+
- Non-browser invariant tests plus browser E2E coverage
|
|
16
|
+
|
|
17
|
+
## Running the Demo
|
|
18
|
+
|
|
19
|
+
From the repository root:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install
|
|
23
|
+
pnpm --filter @xmachines/play-tanstack-solid-router-demo run dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then open `http://localhost:3012`.
|
|
27
|
+
|
|
28
|
+
## Step-by-Step Code Flow
|
|
29
|
+
|
|
30
|
+
Use this order to understand the implementation:
|
|
31
|
+
|
|
32
|
+
1. `src/main.tsx` bootstraps the demo app and mounts `<App />` onto `#app`.
|
|
33
|
+
2. `src/runtime.ts` initializes the actor, builds the registry, and creates the route map using `createRouteMap(authMachine)`.
|
|
34
|
+
3. `src/App.tsx` constructs the TanStack Router route tree from machine routes and wires `PlayRouterProvider` with the actor, router, and route map from `runtime.ts`.
|
|
35
|
+
4. Router infrastructure stays passive: it forwards navigation intent to the actor via the `PlayRouterProvider` and reflects actor-approved route changes back to TanStack.
|
|
36
|
+
5. `Shell` (from `@xmachines/play-solid-demo`) renders actor-projected state (`PlayRenderer`) and emits actor events via the `registryResult` actions.
|
|
37
|
+
6. `test/library-pattern.test.ts` plus `test/browser/` verify invariants and browser routing behavior.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// src/main.tsx (shape)
|
|
41
|
+
render(() => <App />, document.getElementById("app")!);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// src/runtime.ts (shape)
|
|
46
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
47
|
+
export const actor = createPlayer();
|
|
48
|
+
actor.start();
|
|
49
|
+
|
|
50
|
+
export const routeMap = createRouteMap(authMachine);
|
|
51
|
+
const routeTree = extractMachineRoutes(authMachine);
|
|
52
|
+
export const routes = getRoutableRoutes(routeTree);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
// src/App.tsx (shape)
|
|
57
|
+
import { actor, registryResult, routeMap, routes } from "./runtime.js";
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<PlayRouterProvider
|
|
61
|
+
actor={actor}
|
|
62
|
+
router={router}
|
|
63
|
+
routeMap={routeMap}
|
|
64
|
+
renderer={(currentActor, currentRouter) => (
|
|
65
|
+
<Shell actor={currentActor} router={currentRouter} registryResult={registryResult} />
|
|
66
|
+
)}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
// src/runtime.ts — actor events wired via registryResult actions
|
|
73
|
+
login: async (args) => actor.send({ type: "auth.login", username: args.username }),
|
|
74
|
+
logout: async () => actor.send({ type: "auth.logout" }),
|
|
75
|
+
route: async (args) => actor.send({ type: "play.route", to: args.to, ...params }),
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Key Files
|
|
79
|
+
|
|
80
|
+
- `src/runtime.ts` - actor lifecycle, registry, route map, and routable routes setup
|
|
81
|
+
- `src/App.tsx` - TanStack router construction and `PlayRouterProvider` wiring
|
|
82
|
+
- `src/main.tsx` - Vite bootstrap that mounts `<App />` via Solid's `render`
|
|
83
|
+
- `test/library-pattern.test.ts` - architecture boundary and invariant assertions
|
|
84
|
+
- `test/browser/shared-demo.browser.test.ts` - browser startup and full auth flow coverage
|
|
85
|
+
- `test/browser/xstate-route-events.browser.test.ts` - actor route event behavior in the browser
|
|
86
|
+
|
|
87
|
+
## State Machine & Architecture Details
|
|
88
|
+
|
|
89
|
+
The demo utilizes XMachines architectural invariants:
|
|
90
|
+
|
|
91
|
+
1. **Actor Authority:** When a user clicks a link, TanStack Router updates the location object. The `PlayRouterProvider` intercepts this, translates it to a `play.route` event, and sends it to the actor. The actor evaluates guards and applies state transitions.
|
|
92
|
+
2. **Passive Infrastructure:** The router does not execute route loaders or guards for business logic. The actor dictates whether navigation is permitted.
|
|
93
|
+
3. **Signal-Only Reactivity:** The bridge leverages Solid's `createEffect` and TanStack's `router.subscribe` to observe location changes and signal updates without polling.
|
|
94
|
+
|
|
95
|
+
## Watcher Lifecycle and Cleanup Contract
|
|
96
|
+
|
|
97
|
+
This demo follows the canonical watcher lifecycle:
|
|
98
|
+
|
|
99
|
+
1. `notify`
|
|
100
|
+
2. `queueMicrotask`
|
|
101
|
+
3. `getPending()`
|
|
102
|
+
4. Read actor signals and trigger state updates
|
|
103
|
+
5. Re-arm with `watch()`/`watch(...signals)`
|
|
104
|
+
|
|
105
|
+
In Solid, this is largely abstracted by `createEffect` within the bridge adapter. Cleanup remains explicit: the provider executes `bridge.disconnect()` on unmount (`onCleanup`) to prevent ghost subscriptions, ensuring safe component teardown and hot module replacement.
|
|
106
|
+
|
|
107
|
+
## Adapter Boundaries
|
|
108
|
+
|
|
109
|
+
The TanStack Solid adapter wraps TanStack's `router.navigate({ to })` and `router.subscribe` methods while delegating core synchronization policy to `RouterBridgeBase`. This keeps complex double-dispatch logic normalized across all frameworks.
|
|
110
|
+
|
|
111
|
+
## Available Scripts
|
|
112
|
+
|
|
113
|
+
These commands are defined in `package.json`:
|
|
114
|
+
|
|
115
|
+
| Command | Description |
|
|
116
|
+
| --------------------------------------------------------------------------- | ---------------------------------------------- |
|
|
117
|
+
| `pnpm --filter @xmachines/play-tanstack-solid-router-demo run dev` | Start Vite dev server (http://localhost:3012/) |
|
|
118
|
+
| `pnpm --filter @xmachines/play-tanstack-solid-router-demo run build` | Build production bundle |
|
|
119
|
+
| `pnpm --filter @xmachines/play-tanstack-solid-router-demo run preview` | Preview built bundle |
|
|
120
|
+
| `pnpm --filter @xmachines/play-tanstack-solid-router-demo run test` | Run Vitest test suite |
|
|
121
|
+
| `pnpm --filter @xmachines/play-tanstack-solid-router-demo run test:browser` | Run browser-focused Vitest suite |
|
|
122
|
+
|
|
123
|
+
## Verification
|
|
124
|
+
|
|
125
|
+
Use these checks to validate README claims against the current demo implementation:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pnpm --filter @xmachines/play-tanstack-solid-router-demo run test
|
|
129
|
+
pnpm --filter @xmachines/play-tanstack-solid-router-demo run test:browser
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Expected result: library-pattern invariant tests and the browser shared-demo suite both pass, confirming actor-driven route and view updates including protected route redirection.
|
|
133
|
+
|
|
134
|
+
## Learn More
|
|
135
|
+
|
|
136
|
+
- [TanStack Solid Router](../../../api/@xmachines/play-tanstack-solid-router/README.md)
|
|
137
|
+
- [SolidJS](../../../api/@xmachines/play-solid/README.md)
|
|
138
|
+
- [Solid Router](../play-solid-router-demo/README.md)
|
|
139
|
+
- [TanStack React Router](../play-tanstack-react-router-demo/README.md)
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
[Examples](../../README.md) / @xmachines/play-vue-demo
|
|
2
|
+
|
|
3
|
+
<!-- generated-by: gsd-doc-writer -->
|
|
4
|
+
|
|
5
|
+
# @xmachines/play-vue-demo
|
|
6
|
+
|
|
7
|
+
Vue 3 renderer demo for [`@xmachines/play-vue`](../../../api/@xmachines/play-vue/README.md) — actor + `PlayRenderer` without a router.
|
|
8
|
+
|
|
9
|
+
## What This Demonstrates
|
|
10
|
+
|
|
11
|
+
- Shared auth machine reused without framework-specific business logic
|
|
12
|
+
- `PlayRenderer` rendering actor-projected views with a typed `defineRegistry` catalog
|
|
13
|
+
- Auth machine states drive view switching via `auth.login` / `auth.logout` events only — no URL routing
|
|
14
|
+
- Vue Composition API mapping to TC39 Signals lifecycle
|
|
15
|
+
- Non-browser invariant tests plus browser renderer coverage
|
|
16
|
+
|
|
17
|
+
## Running the Demo
|
|
18
|
+
|
|
19
|
+
From the repository root:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install
|
|
23
|
+
pnpm --filter @xmachines/play-vue-demo run dev
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then open `http://localhost:3004`.
|
|
27
|
+
|
|
28
|
+
## Step-by-Step Code Flow
|
|
29
|
+
|
|
30
|
+
Use this order to understand the implementation:
|
|
31
|
+
|
|
32
|
+
1. `src/main.ts` calls `definePlayer({ machine: authMachine })`, starts the actor, and mounts the Vue app.
|
|
33
|
+
2. The actor is provided to all components via `app.provide("actor", actor)`.
|
|
34
|
+
3. `src/App.vue` injects the actor, declares a typed `ComponentsMap<typeof authCatalog>` for `demoViews`, and builds the `registryResult` with `defineRegistry(authCatalog, { components: demoViews, actions })` inside `computed` — action handlers use `satisfies ActionFn` for catalog-typed safety and dispatch to `actor.send()`.
|
|
35
|
+
4. `<PlayUIProvider :actor="typedActor" :registryResult="registryResult"><PlayRenderer /></PlayUIProvider>` observes `actor.currentView` and renders the active spec.
|
|
36
|
+
5. A `NavBar` SFC observes `actor` signals directly for nav visibility.
|
|
37
|
+
6. `<DebugPanel :actor="typedActor" />` shows live state, auth status, and current route.
|
|
38
|
+
7. HMR cleanup calls `actor.stop()` via `import.meta.hot.dispose`.
|
|
39
|
+
8. Browser tests in `test/browser/` validate startup and interaction behavior.
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
// src/main.ts
|
|
43
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
44
|
+
const actor = createPlayer() as AuthActor;
|
|
45
|
+
actor.start();
|
|
46
|
+
|
|
47
|
+
const app = createApp(App);
|
|
48
|
+
app.provide("actor", actor);
|
|
49
|
+
app.mount("#app");
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<!-- src/App.vue -->
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import type { ComponentsMap } from "@xmachines/play-vue";
|
|
56
|
+
import type { ActionFn } from "@xmachines/json-render-vue";
|
|
57
|
+
|
|
58
|
+
const typedActor = assertNonNullable(inject<AuthActor>("actor"), "actor");
|
|
59
|
+
|
|
60
|
+
const demoViews: ComponentsMap<typeof authCatalog> = {
|
|
61
|
+
Home: HomeSFC,
|
|
62
|
+
About: AboutSFC,
|
|
63
|
+
Contact: ContactSFC,
|
|
64
|
+
Login: LoginSFC,
|
|
65
|
+
Dashboard: DashboardSFC,
|
|
66
|
+
Overview: OverviewSFC,
|
|
67
|
+
Stats: StatsSFC,
|
|
68
|
+
Profile: ProfileSFC,
|
|
69
|
+
Settings: SettingsSFC,
|
|
70
|
+
Navigation: NavigationSFC,
|
|
71
|
+
NavBar: NavBarViewSFC,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const registryResult = computed(() =>
|
|
75
|
+
defineRegistry(authCatalog, {
|
|
76
|
+
components: demoViews,
|
|
77
|
+
actions: {
|
|
78
|
+
login: (async (args) => {
|
|
79
|
+
typedActor.send({
|
|
80
|
+
type: "auth.login",
|
|
81
|
+
username: assertNonNullable(args, "args").username,
|
|
82
|
+
});
|
|
83
|
+
}) satisfies ActionFn<typeof authCatalog, "login">,
|
|
84
|
+
logout: async () => typedActor.send({ type: "auth.logout" }),
|
|
85
|
+
route: (async (args) => {
|
|
86
|
+
const { to, params } = assertNonNullable(args, "args");
|
|
87
|
+
typedActor.send({
|
|
88
|
+
type: "play.route",
|
|
89
|
+
to,
|
|
90
|
+
...(params != null && { params }),
|
|
91
|
+
});
|
|
92
|
+
}) satisfies ActionFn<typeof authCatalog, "route">,
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
</script>
|
|
97
|
+
|
|
98
|
+
<template>
|
|
99
|
+
<div class="demo-app" data-demo-shell>
|
|
100
|
+
<header class="demo-header">
|
|
101
|
+
<h1 class="demo-title">XMachines Play Vue Demo</h1>
|
|
102
|
+
<NavBar :actor="typedActor" />
|
|
103
|
+
</header>
|
|
104
|
+
<main class="demo-content" data-demo-content>
|
|
105
|
+
<PlayUIProvider :actor="typedActor" :registryResult="registryResult">
|
|
106
|
+
<PlayRenderer />
|
|
107
|
+
</PlayUIProvider>
|
|
108
|
+
</main>
|
|
109
|
+
<DebugPanel :actor="typedActor" />
|
|
110
|
+
</div>
|
|
111
|
+
</template>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Key Files
|
|
115
|
+
|
|
116
|
+
- `src/main.ts` - actor creation/start and Vue app mount with actor injection
|
|
117
|
+
- `src/App.vue` - typed `ComponentsMap` declaration, registry construction, and `PlayUIProvider` + `PlayRenderer` composition
|
|
118
|
+
- `src/catalog.ts` - `authCatalog` built via `defineCatalog` with the `@xmachines/json-render-vue` schema
|
|
119
|
+
- `src/components/` - demo view components bound to catalog component keys (Home, Login, Dashboard, Profile, etc.)
|
|
120
|
+
- `src/index.ts` - re-exports all components and catalog for library-pattern testing
|
|
121
|
+
- `test/library-pattern.test.ts` - architecture boundary and invariant assertions
|
|
122
|
+
- `test/browser/renderer-demo.browser.test.ts` - browser-mode renderer coverage
|
|
123
|
+
|
|
124
|
+
## State Machine & Architecture Details
|
|
125
|
+
|
|
126
|
+
The demo utilizes XMachines architectural invariants:
|
|
127
|
+
|
|
128
|
+
1. **Actor Authority:** View components dispatch `auth.login` and `auth.logout` events to the actor. The actor evaluates guards and transitions — Vue never decides which view to render.
|
|
129
|
+
2. **Passive Infrastructure:** `PlayRenderer` observes `actor.currentView` signals only. It holds no business state and makes no routing decisions.
|
|
130
|
+
3. **Signal-Only Reactivity:** The bridge leverages Vue's reactivity model internally to react precisely when actor signals update, without polluting the component tree with reactive refs holding business state.
|
|
131
|
+
|
|
132
|
+
## Watcher Lifecycle and Cleanup Contract
|
|
133
|
+
|
|
134
|
+
This demo follows the canonical watcher lifecycle used across all `@xmachines` framework adapters:
|
|
135
|
+
|
|
136
|
+
1. `notify`
|
|
137
|
+
2. `queueMicrotask`
|
|
138
|
+
3. `getPending()`
|
|
139
|
+
4. Read actor signals and sync Vue-local render state
|
|
140
|
+
5. Re-arm with `watch()`/`watch(...signals)`
|
|
141
|
+
|
|
142
|
+
Watcher notifications are one-shot. Cleanup is explicit: `actor.stop()` is called during HMR disposal, and `PlayRenderer` handles internal watcher teardown natively on component unmount.
|
|
143
|
+
|
|
144
|
+
## Adapter Boundaries
|
|
145
|
+
|
|
146
|
+
`PlayRenderer` and `defineRegistry` stay passive infrastructure. Business validity remains actor-owned. The registry maps catalog component keys to Vue SFC implementations — the actor owns which key is active. The demo intentionally omits URL routing to isolate the renderer contract.
|
|
147
|
+
|
|
148
|
+
## Available Scripts
|
|
149
|
+
|
|
150
|
+
These commands are defined in `package.json`:
|
|
151
|
+
|
|
152
|
+
| Command | Description |
|
|
153
|
+
| --------------------------------------------------------- | ---------------------------------------------- |
|
|
154
|
+
| `pnpm --filter @xmachines/play-vue-demo run dev` | Start Vite dev server (http://localhost:3004/) |
|
|
155
|
+
| `pnpm --filter @xmachines/play-vue-demo run build` | Build production bundle |
|
|
156
|
+
| `pnpm --filter @xmachines/play-vue-demo run preview` | Preview built bundle |
|
|
157
|
+
| `pnpm --filter @xmachines/play-vue-demo run test` | Run Vitest test suite |
|
|
158
|
+
| `pnpm --filter @xmachines/play-vue-demo run test:browser` | Run browser-focused Vitest suite |
|
|
159
|
+
|
|
160
|
+
## Verification
|
|
161
|
+
|
|
162
|
+
Use these checks to validate README claims against the current demo implementation:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pnpm --filter @xmachines/play-vue-demo run test
|
|
166
|
+
pnpm --filter @xmachines/play-vue-demo run test:browser
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Expected result: library-pattern invariant tests pass and the browser renderer suite completes.
|
|
170
|
+
|
|
171
|
+
## Learn More
|
|
172
|
+
|
|
173
|
+
- [Vue](../../../api/@xmachines/play-vue/README.md)
|
|
174
|
+
- [Vue Router](../play-vue-router-demo/README.md)
|
|
175
|
+
|
|
176
|
+
## Type Aliases
|
|
177
|
+
|
|
178
|
+
- [AuthCatalog](type-aliases/AuthCatalog.md)
|
|
179
|
+
|
|
180
|
+
## Variables
|
|
181
|
+
|
|
182
|
+
- [App](variables/App.md)
|
|
183
|
+
- [authCatalog](variables/authCatalog.md)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
[Examples](../../../README.md) / [@xmachines/play-vue-demo](../README.md) / AuthCatalog
|
|
2
|
+
|
|
3
|
+
# Type Alias: AuthCatalog
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type AuthCatalog = typeof authCatalog;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-vue/examples/demo/src/catalog.ts:6](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0/packages/play-vue/examples/demo/src/catalog.ts#L6)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
[Examples](../../../README.md) / [@xmachines/play-vue-demo](../README.md) / App
|
|
2
|
+
|
|
3
|
+
# Variable: App
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
const App: DefineComponent<{}, {}, unknown>;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-vue/examples/demo/src/env.d.ts:5](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0/packages/play-vue/examples/demo/src/env.d.ts#L5)
|