@xmachines/docs 1.0.0-beta.10

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.
Files changed (197) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/api/@xmachines/play/README.md +130 -0
  4. package/api/@xmachines/play/type-aliases/PlayEvent.md +81 -0
  5. package/api/@xmachines/play-actor/README.md +247 -0
  6. package/api/@xmachines/play-actor/classes/AbstractActor.md +520 -0
  7. package/api/@xmachines/play-actor/interfaces/Routable.md +29 -0
  8. package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +17 -0
  9. package/api/@xmachines/play-actor/interfaces/Viewable.md +12 -0
  10. package/api/@xmachines/play-catalog/README.md +331 -0
  11. package/api/@xmachines/play-catalog/functions/defineCatalog.md +98 -0
  12. package/api/@xmachines/play-catalog/functions/defineComponents.md +134 -0
  13. package/api/@xmachines/play-catalog/type-aliases/Catalog.md +48 -0
  14. package/api/@xmachines/play-catalog/type-aliases/ComponentsFor.md +20 -0
  15. package/api/@xmachines/play-catalog/type-aliases/InferComponentProps.md +65 -0
  16. package/api/@xmachines/play-catalog/type-aliases/NoExtraKeys.md +17 -0
  17. package/api/@xmachines/play-react/README.md +423 -0
  18. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +613 -0
  19. package/api/@xmachines/play-react/functions/useSignalEffect.md +68 -0
  20. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +15 -0
  21. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +14 -0
  22. package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +15 -0
  23. package/api/@xmachines/play-react/variables/PlayRenderer.md +64 -0
  24. package/api/@xmachines/play-react-router/README.md +198 -0
  25. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +321 -0
  26. package/api/@xmachines/play-react-router/classes/RouteMap.md +137 -0
  27. package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +19 -0
  28. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +35 -0
  29. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +119 -0
  30. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +14 -0
  31. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +17 -0
  32. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +104 -0
  33. package/api/@xmachines/play-react-router-demo/README.md +137 -0
  34. package/api/@xmachines/play-router/README.md +502 -0
  35. package/api/@xmachines/play-router/classes/BaseRouteMap.md +142 -0
  36. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +300 -0
  37. package/api/@xmachines/play-router/functions/buildRouteTree.md +27 -0
  38. package/api/@xmachines/play-router/functions/connectRouter.md +67 -0
  39. package/api/@xmachines/play-router/functions/crawlMachine.md +92 -0
  40. package/api/@xmachines/play-router/functions/createBrowserHistory.md +47 -0
  41. package/api/@xmachines/play-router/functions/createRouteMap.md +53 -0
  42. package/api/@xmachines/play-router/functions/createRouter.md +76 -0
  43. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +32 -0
  44. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +64 -0
  45. package/api/@xmachines/play-router/functions/extractRoute.md +45 -0
  46. package/api/@xmachines/play-router/functions/findRouteById.md +37 -0
  47. package/api/@xmachines/play-router/functions/findRouteByPath.md +39 -0
  48. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +35 -0
  49. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +39 -0
  50. package/api/@xmachines/play-router/functions/routeExists.md +26 -0
  51. package/api/@xmachines/play-router/functions/validateRouteFormat.md +29 -0
  52. package/api/@xmachines/play-router/functions/validateStateExists.md +29 -0
  53. package/api/@xmachines/play-router/interfaces/BaseRouteMapping.md +27 -0
  54. package/api/@xmachines/play-router/interfaces/BrowserHistory.md +172 -0
  55. package/api/@xmachines/play-router/interfaces/BrowserWindow.md +69 -0
  56. package/api/@xmachines/play-router/interfaces/ConnectRouterOptions.md +13 -0
  57. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +119 -0
  58. package/api/@xmachines/play-router/interfaces/RouteInfo.md +19 -0
  59. package/api/@xmachines/play-router/interfaces/RouteMap.md +56 -0
  60. package/api/@xmachines/play-router/interfaces/RouteNode.md +21 -0
  61. package/api/@xmachines/play-router/interfaces/RouteObject.md +21 -0
  62. package/api/@xmachines/play-router/interfaces/RouteTree.md +20 -0
  63. package/api/@xmachines/play-router/interfaces/RouterBridge.md +104 -0
  64. package/api/@xmachines/play-router/interfaces/StateVisit.md +15 -0
  65. package/api/@xmachines/play-router/interfaces/VanillaRouter.md +28 -0
  66. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +11 -0
  67. package/api/@xmachines/play-router-demo/README.md +137 -0
  68. package/api/@xmachines/play-signals/README.md +176 -0
  69. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +34 -0
  70. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +49 -0
  71. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +35 -0
  72. package/api/@xmachines/play-signals/interfaces/SignalState.md +68 -0
  73. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +97 -0
  74. package/api/@xmachines/play-signals/namespaces/Signal/README.md +22 -0
  75. package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +52 -0
  76. package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +72 -0
  77. package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +19 -0
  78. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/README.md +21 -0
  79. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +85 -0
  80. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +13 -0
  81. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +19 -0
  82. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +19 -0
  83. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +19 -0
  84. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +19 -0
  85. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +25 -0
  86. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +9 -0
  87. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +9 -0
  88. package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +19 -0
  89. package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +19 -0
  90. package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +19 -0
  91. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +32 -0
  92. package/api/@xmachines/play-solid/README.md +311 -0
  93. package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +15 -0
  94. package/api/@xmachines/play-solid/variables/PlayRenderer.md +70 -0
  95. package/api/@xmachines/play-solid-router/README.md +666 -0
  96. package/api/@xmachines/play-solid-router/classes/RouteMap.md +150 -0
  97. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +347 -0
  98. package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +19 -0
  99. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +32 -0
  100. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +486 -0
  101. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +119 -0
  102. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +14 -0
  103. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +14 -0
  104. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +104 -0
  105. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +9 -0
  106. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +51 -0
  107. package/api/@xmachines/play-solid-router-demo/README.md +127 -0
  108. package/api/@xmachines/play-tanstack-react-router/README.md +226 -0
  109. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +137 -0
  110. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +348 -0
  111. package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +19 -0
  112. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +53 -0
  113. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +35 -0
  114. package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +38 -0
  115. package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +33 -0
  116. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +119 -0
  117. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +14 -0
  118. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +17 -0
  119. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +26 -0
  120. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +104 -0
  121. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +9 -0
  122. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +78 -0
  123. package/api/@xmachines/play-tanstack-react-router/variables/extractMachineRoutes.md +64 -0
  124. package/api/@xmachines/play-tanstack-react-router-demo/README.md +126 -0
  125. package/api/@xmachines/play-tanstack-solid-router/README.md +285 -0
  126. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +150 -0
  127. package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +343 -0
  128. package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +19 -0
  129. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +32 -0
  130. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +119 -0
  131. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +14 -0
  132. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +23 -0
  133. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +104 -0
  134. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +9 -0
  135. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +9 -0
  136. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +78 -0
  137. package/api/@xmachines/play-tanstack-solid-router-demo/README.md +126 -0
  138. package/api/@xmachines/play-vue/README.md +292 -0
  139. package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +14 -0
  140. package/api/@xmachines/play-vue/variables/PlayRenderer.md +9 -0
  141. package/api/@xmachines/play-vue-router/README.md +604 -0
  142. package/api/@xmachines/play-vue-router/classes/RouteMap.md +209 -0
  143. package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +201 -0
  144. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +360 -0
  145. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +19 -0
  146. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +119 -0
  147. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +15 -0
  148. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +104 -0
  149. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +9 -0
  150. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +67 -0
  151. package/api/@xmachines/play-vue-router-demo/README.md +133 -0
  152. package/api/@xmachines/play-xstate/README.md +512 -0
  153. package/api/@xmachines/play-xstate/classes/PlayerActor.md +527 -0
  154. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +43 -0
  155. package/api/@xmachines/play-xstate/functions/composeGuards.md +79 -0
  156. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +67 -0
  157. package/api/@xmachines/play-xstate/functions/definePlayer.md +127 -0
  158. package/api/@xmachines/play-xstate/functions/deriveRoute.md +109 -0
  159. package/api/@xmachines/play-xstate/functions/eventMatches.md +40 -0
  160. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +54 -0
  161. package/api/@xmachines/play-xstate/functions/hasContext.md +42 -0
  162. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +41 -0
  163. package/api/@xmachines/play-xstate/functions/mergeViewProps.md +26 -0
  164. package/api/@xmachines/play-xstate/functions/negateGuard.md +61 -0
  165. package/api/@xmachines/play-xstate/functions/stateMatches.md +25 -0
  166. package/api/@xmachines/play-xstate/functions/validateComponentBinding.md +39 -0
  167. package/api/@xmachines/play-xstate/functions/validateViewProps.md +80 -0
  168. package/api/@xmachines/play-xstate/interfaces/CatalogEntry.md +16 -0
  169. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +24 -0
  170. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +26 -0
  171. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +22 -0
  172. package/api/@xmachines/play-xstate/type-aliases/Catalog.md +21 -0
  173. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +14 -0
  174. package/api/@xmachines/play-xstate/type-aliases/Guard.md +34 -0
  175. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +20 -0
  176. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +29 -0
  177. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +45 -0
  178. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +51 -0
  179. package/api/@xmachines/play-xstate/type-aliases/ValidationResult.md +17 -0
  180. package/api/@xmachines/play-xstate/type-aliases/ViewMergeContext.md +35 -0
  181. package/api/@xmachines/shared/README.md +379 -0
  182. package/api/@xmachines/shared/functions/defineXmVitestConfig.md +29 -0
  183. package/api/@xmachines/shared/functions/xmAliases.md +24 -0
  184. package/api/README.md +25 -0
  185. package/api/llms.txt +26 -0
  186. package/examples/README.md +63 -0
  187. package/examples/basic-state-machine.md +70 -0
  188. package/examples/form-validation.md +167 -0
  189. package/examples/multi-router-integration.md +277 -0
  190. package/examples/routing-patterns.md +260 -0
  191. package/examples/traffic-light.md +99 -0
  192. package/guides/README.md +29 -0
  193. package/guides/getting-started.md +223 -0
  194. package/guides/installation.md +323 -0
  195. package/index.d.ts +3 -0
  196. package/index.js +4 -0
  197. package/package.json +54 -0
@@ -0,0 +1,9 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-tanstack-solid-router](../README.md) / TanStackRouterInstance
2
+
3
+ # Type Alias: TanStackRouterInstance
4
+
5
+ ```ts
6
+ type TanStackRouterInstance = ConstructorParameters<typeof SolidRouterBridge>[0];
7
+ ```
8
+
9
+ Defined in: [play-tanstack-solid-router/src/play-router-provider.tsx:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-tanstack-solid-router/src/play-router-provider.tsx#L8)
@@ -0,0 +1,78 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-tanstack-solid-router](../README.md) / TanStackRouterLike
2
+
3
+ # Type Alias: TanStackRouterLike
4
+
5
+ ```ts
6
+ type TanStackRouterLike = object;
7
+ ```
8
+
9
+ Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-tanstack-solid-router/src/solid-router-bridge.ts#L28)
10
+
11
+ ## Properties
12
+
13
+ ### history
14
+
15
+ ```ts
16
+ history: object;
17
+ ```
18
+
19
+ Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-tanstack-solid-router/src/solid-router-bridge.ts#L31)
20
+
21
+ #### subscribe()
22
+
23
+ ```ts
24
+ subscribe(handler): () => void;
25
+ ```
26
+
27
+ ##### Parameters
28
+
29
+ | Parameter | Type |
30
+ | --------- | ------------------- |
31
+ | `handler` | (`event`) => `void` |
32
+
33
+ ##### Returns
34
+
35
+ () => `void`
36
+
37
+ ---
38
+
39
+ ### state?
40
+
41
+ ```ts
42
+ optional state?: object;
43
+ ```
44
+
45
+ Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-tanstack-solid-router/src/solid-router-bridge.ts#L30)
46
+
47
+ #### location?
48
+
49
+ ```ts
50
+ optional location?: object;
51
+ ```
52
+
53
+ ##### location.pathname?
54
+
55
+ ```ts
56
+ optional pathname?: string;
57
+ ```
58
+
59
+ ## Methods
60
+
61
+ ### navigate()
62
+
63
+ ```ts
64
+ navigate(args): void;
65
+ ```
66
+
67
+ Defined in: [play-tanstack-solid-router/src/solid-router-bridge.ts:29](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-tanstack-solid-router/src/solid-router-bridge.ts#L29)
68
+
69
+ #### Parameters
70
+
71
+ | Parameter | Type |
72
+ | --------- | --------------------- |
73
+ | `args` | \{ `to`: `string`; \} |
74
+ | `args.to` | `string` |
75
+
76
+ #### Returns
77
+
78
+ `void`
@@ -0,0 +1,126 @@
1
+ [Documentation](../../README.md) / @xmachines/play-tanstack-solid-router-demo
2
+
3
+ # TanStack Solid Router Demo
4
+
5
+ Solid + `@tanstack/solid-router` demonstration of the Play architecture with TanStack router integration.
6
+
7
+ ## What This Demonstrates
8
+
9
+ - Shared auth machine reused without framework-specific business logic
10
+ - `PlayRouterProvider` renderer-based integration with TanStack Router
11
+ - Shell-driven rendering via `PlayRenderer` with actor-authoritative navigation
12
+ - Object-based routing and deep location observation using TanStack's Solid primitives
13
+ - Non-browser invariant tests plus browser E2E coverage
14
+
15
+ ## Running the Demo
16
+
17
+ From this directory (`packages/play-tanstack-solid-router/examples/demo`):
18
+
19
+ ```bash
20
+ npm install
21
+ npm run dev
22
+ ```
23
+
24
+ Open `http://localhost:5173`.
25
+
26
+ ## Step-by-Step Code Flow
27
+
28
+ Use this order to understand the implementation:
29
+
30
+ 1. `src/main.tsx` bootstraps the demo app and mounts `<App />`.
31
+ 2. `src/App.tsx` sets up actor lifecycle, route mapping, and TanStack Solid router integration.
32
+ 3. Shared machine/catalog logic comes from the common demo module to keep business logic framework-agnostic.
33
+ 4. Router infrastructure stays passive: it forwards navigation intent to the actor via the `PlayRouterProvider` and reflects actor-approved route changes back to TanStack.
34
+ 5. `Shell` (inside `src/App.tsx`) renders actor-projected state (`PlayRenderer`) and emits actor events.
35
+ 6. `test/library-pattern.test.ts` plus `test/browser/` verify invariants and browser routing behavior.
36
+
37
+ ```tsx
38
+ // src/main.tsx (shape)
39
+ render(() => <App />, document.getElementById("root")!);
40
+ ```
41
+
42
+ ```tsx
43
+ // src/App.tsx (shape)
44
+ const routeTree = extractMachineRoutes(authMachine);
45
+ const routeMap = createRouteMap(authMachine);
46
+
47
+ return (
48
+ <PlayRouterProvider
49
+ actor={actor}
50
+ router={router}
51
+ routeMap={routeMap}
52
+ renderer={(currentActor, currentRouter) => (
53
+ <Shell actor={currentActor} router={currentRouter} />
54
+ )}
55
+ />
56
+ );
57
+ ```
58
+
59
+ ```tsx
60
+ // src/components/Login.tsx (shape)
61
+ <button onClick={() => actor.send({ type: "auth.login", username, password })}>Login</button>
62
+ ```
63
+
64
+ ## Key Files
65
+
66
+ - `src/App.tsx` - Wires actor lifecycle, route map, TanStack router setup, and provider/renderer integration.
67
+ - `src/main.tsx` - Vite bootstrap for the Solid TanStack demo.
68
+ - `src/components/` - Demo views that dispatch machine events.
69
+ - `test/library-pattern.test.ts` - Invariant and architecture checks for package behavior.
70
+ - `test/browser/startup.browser.test.ts` - Browser startup and wiring checks.
71
+ - `test/browser/auth-flow.browser.test.ts` - Browser auth + route-flow checks.
72
+
73
+ ## State Machine & Architecture Details
74
+
75
+ The demo utilizes XMachines architectural invariants:
76
+
77
+ 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.
78
+ 2. **Passive Infrastructure:** The router does not execute route loaders or guards for business logic. The actor dictates whether navigation is permitted.
79
+ 3. **Signal-Only Reactivity:** The bridge leverages Solid's `createEffect` and TanStack's `router.subscribe` to effortlessly observe location changes and signal updates.
80
+
81
+ ## Watcher Lifecycle and Cleanup Contract
82
+
83
+ This demo follows the canonical watcher lifecycle:
84
+
85
+ 1. `notify`
86
+ 2. `queueMicrotask`
87
+ 3. `getPending()`
88
+ 4. Read actor signals and trigger state updates
89
+ 5. Re-arm with `watch()`/`watch(...signals)`
90
+
91
+ 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.
92
+
93
+ ## Adapter Boundaries
94
+
95
+ 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.
96
+
97
+ ## Available Scripts
98
+
99
+ ```bash
100
+ npm run dev # Start Vite dev server (default: http://localhost:5173)
101
+ npm run build # Build production assets
102
+ npm run preview # Preview production build locally
103
+ npm run test # Run unit/integration tests via Vitest
104
+ npm run test:browser # Run browser-mode tests via vitest.browser.config.ts
105
+ ```
106
+
107
+ ## Verification
108
+
109
+ Use these checks from this directory:
110
+
111
+ ```bash
112
+ npm run test
113
+ npm run test:browser
114
+ ```
115
+
116
+ Manual sanity check:
117
+
118
+ 1. Start with `npm run dev`.
119
+ 2. Open `http://localhost:5173`.
120
+ 3. Verify login/logout transitions and URL updates remain actor-driven, including protected route redirection.
121
+
122
+ ## Learn More
123
+
124
+ - [TanStack Solid Router package README](../play-tanstack-solid-router/README.md)
125
+ - [Solid Router demo README](../play-solid-router-demo/README.md)
126
+ - [TanStack React Router demo README](../play-tanstack-react-router-demo/README.md)
@@ -0,0 +1,292 @@
1
+ [Documentation](../../README.md) / @xmachines/play-vue
2
+
3
+ # @xmachines/play-vue
4
+
5
+ **Vue renderer consuming signals and UI schema with provider pattern**
6
+
7
+ Signal-driven Vue rendering layer observing actor state with zero Vue state for business logic.
8
+
9
+ ## Overview
10
+
11
+ `@xmachines/play-vue` provides `PlayRenderer` for building Vue 3 UIs that passively observe actor signals. This package enables framework-swappable architecture where Vue is just a rendering target subscribing to signal changes — business logic lives entirely in the actor.
12
+
13
+ Per [RFC Play v1](https://gitlab.com/xmachin-es/rfc/-/blob/main/src/play-v1.md), this package implements:
14
+
15
+ - **Signal-Only Reactivity (INV-05):** No refs/reactive for business logic, TC39 signals only
16
+ - **Passive Infrastructure (INV-04):** Components observe signals, send events to actor
17
+
18
+ **Key Principle:** Vue state is never used for business logic. Signals are the source of truth.
19
+
20
+ Renderer receives actor via props (provider pattern), not children.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ npm install vue@^3.5.0
26
+ npm install @xmachines/play-vue
27
+ ```
28
+
29
+ ## Current Exports
30
+
31
+ - `PlayRenderer` (Vue component)
32
+ - `PlayRendererProps` (TypeScript interface)
33
+
34
+ **Peer dependencies:**
35
+
36
+ - `vue` ^3.5.0 — Vue 3 runtime
37
+
38
+ ## Quick Start
39
+
40
+ ```vue
41
+ <!-- App.vue -->
42
+ <script setup lang="ts">
43
+ import { definePlayer } from "@xmachines/play-xstate";
44
+ import { defineCatalog } from "@xmachines/play-catalog";
45
+ import { PlayRenderer } from "@xmachines/play-vue";
46
+ import { z } from "zod";
47
+ import LoginForm from "./components/LoginForm.vue";
48
+ import Dashboard from "./components/Dashboard.vue";
49
+
50
+ // 1. Define catalog (business logic layer)
51
+ const catalog = defineCatalog({
52
+ LoginForm: z.object({ error: z.string().optional() }),
53
+ Dashboard: z.object({
54
+ userId: z.string(),
55
+ username: z.string(),
56
+ }),
57
+ });
58
+
59
+ // 2. Define component map (view layer)
60
+ const components = {
61
+ LoginForm,
62
+ Dashboard,
63
+ };
64
+
65
+ // 3. Create player actor (business logic runtime)
66
+ const createPlayer = definePlayer({ machine: authMachine, catalog });
67
+ const actor = createPlayer();
68
+ actor.start();
69
+ </script>
70
+
71
+ <template>
72
+ <!-- 4. Render UI (actor via props) -->
73
+ <PlayRenderer :actor="actor" :components="components">
74
+ <template #fallback>
75
+ <div>Loading...</div>
76
+ </template>
77
+ </PlayRenderer>
78
+ </template>
79
+ ```
80
+
81
+ ## API Reference
82
+
83
+ ### PlayRenderer
84
+
85
+ Main renderer component subscribing to actor signals and dynamically rendering catalog components:
86
+
87
+ ```typescript
88
+ interface PlayRendererProps {
89
+ actor: AbstractActor<any>;
90
+ components: Record<string, Component>;
91
+ }
92
+ ```
93
+
94
+ **Props:**
95
+
96
+ - `actor` - Actor instance with `currentView` signal
97
+ - `components` - Map of component names to Vue components
98
+
99
+ **Slots:**
100
+
101
+ - `fallback` - Slot shown when `currentView` is null
102
+
103
+ **Behavior:**
104
+
105
+ 1. Subscribes to `actor.currentView` signal using a `Signal.subtle.Watcher` inside a Vue component
106
+ 2. Looks up component from `components` map using `view.component` string
107
+ 3. Renders component with props from `view.props` + `send` function via Vue's dynamic `<component :is="..."/>`
108
+
109
+ **Example Component (LoginForm.vue):**
110
+
111
+ ```vue
112
+ <script setup lang="ts">
113
+ import type { AbstractActor } from "@xmachines/play-actor";
114
+ import { ref } from "vue";
115
+
116
+ const props = defineProps<{
117
+ error?: string;
118
+ send: AbstractActor<any>["send"];
119
+ }>();
120
+
121
+ const username = ref("");
122
+
123
+ function handleSubmit() {
124
+ props.send({
125
+ type: "auth.login",
126
+ username: username.value,
127
+ });
128
+ }
129
+ </script>
130
+
131
+ <template>
132
+ <form @submit.prevent="handleSubmit">
133
+ <p v-if="error" style="color: red">{{ error }}</p>
134
+ <input v-model="username" required placeholder="Username" />
135
+ <button type="submit">Log In</button>
136
+ </form>
137
+ </template>
138
+ ```
139
+
140
+ ## Examples
141
+
142
+ ### Provider Pattern
143
+
144
+ ```vue
145
+ <!-- App.vue -->
146
+ <script setup lang="ts">
147
+ import { PlayVueRouterProvider } from "@xmachines/play-vue-router";
148
+ import { PlayRenderer } from "@xmachines/play-vue";
149
+ import { provide } from "vue";
150
+ import Header from "./components/Header.vue";
151
+ import Footer from "./components/Footer.vue";
152
+
153
+ // Provide actor to nested components like Header
154
+ provide("actor", actor);
155
+ </script>
156
+
157
+ <template>
158
+ <PlayVueRouterProvider :actor="actor" :router="router" :routeMap="routeMap">
159
+ <template #default="{ currentActor, currentRouter }">
160
+ <div>
161
+ <Header />
162
+ <PlayRenderer :actor="currentActor" :components="components" />
163
+ <Footer />
164
+ </div>
165
+ </template>
166
+ </PlayVueRouterProvider>
167
+ </template>
168
+ ```
169
+
170
+ ```vue
171
+ <!-- Header.vue -->
172
+ <script setup lang="ts">
173
+ import { inject, ref, onMounted, onUnmounted } from "vue";
174
+ import type { AbstractActor } from "@xmachines/play-actor";
175
+
176
+ const actor = inject<AbstractActor<any>>("actor")!;
177
+ const route = ref<string | null>(null);
178
+
179
+ let watcher: any;
180
+
181
+ onMounted(() => {
182
+ let pending = false;
183
+ watcher = new Signal.subtle.Watcher(() => {
184
+ if (!pending) {
185
+ pending = true;
186
+ queueMicrotask(() => {
187
+ pending = false;
188
+ for (const s of watcher.getPending()) s.get();
189
+ route.value = actor.currentRoute.get();
190
+ watcher.watch(actor.currentRoute);
191
+ });
192
+ }
193
+ });
194
+ route.value = actor.currentRoute.get();
195
+ watcher.watch(actor.currentRoute);
196
+ });
197
+
198
+ onUnmounted(() => {
199
+ if (watcher) watcher.unwatch(actor.currentRoute);
200
+ });
201
+ </script>
202
+
203
+ <template>
204
+ <header>
205
+ <nav>Current: {{ route }}</nav>
206
+ </header>
207
+ </template>
208
+ ```
209
+
210
+ ## Architecture
211
+
212
+ This package implements **Signal-Only Reactivity (INV-05)** and **Passive Infrastructure (INV-04)**:
213
+
214
+ 1. **No Business Logic in Vue:**
215
+ - No ref/reactive for business state
216
+ - No watch/watchEffect for business side effects
217
+ - Vue only triggers renders, doesn't control state
218
+
219
+ 2. **Signals as Source of Truth:**
220
+ - `actor.currentView.get()` provides UI structure
221
+ - `actor.currentRoute.get()` provides navigation state
222
+ - Components observe signals via explicit watcher patterns
223
+
224
+ 3. **Event Forwarding:**
225
+ - Components receive `send` function via props
226
+ - User actions send events to actor (e.g., `{ type: "auth.login" }`)
227
+ - Actor guards validate and process events
228
+
229
+ 4. **Microtask Batching:**
230
+ - `Signal.subtle.Watcher` coalesces rapid signal changes
231
+ - Prevents Vue thrashing from multiple signal updates
232
+ - Single Vue render per microtask batch
233
+
234
+ 5. **Explicit Disposal Contract:**
235
+ - Component teardown calls watcher `unwatch` in `onUnmounted`
236
+ - Do not rely on GC-only cleanup
237
+
238
+ **Pattern:**
239
+
240
+ - Renderer receives actor via props (provider pattern)
241
+ - Enables composition with navigation, headers, footers
242
+ - Supports multiple renderers in same app
243
+
244
+ **Architectural Invariants:**
245
+
246
+ - **Signal-Only Reactivity (INV-05):** No Vue state for business logic
247
+ - **Passive Infrastructure (INV-04):** Components reflect, never decide
248
+
249
+ ## Canonical Watcher Lifecycle
250
+
251
+ If you write your own custom integration, use the same watcher flow as `PlayRenderer`:
252
+
253
+ 1. `notify` callback runs
254
+ 2. Schedule work with `queueMicrotask`
255
+ 3. Drain `watcher.getPending()`
256
+ 4. Read actor signals and update Vue-local ref state
257
+ 5. Re-arm with `watch(...)` or `watch()`
258
+
259
+ Watcher notify is one-shot. Re-arm is required for continuous observation.
260
+
261
+ ## Benefits
262
+
263
+ - **Framework Swappable:** Business logic has zero Vue imports
264
+ - **Type Safety:** Props validated against catalog schemas
265
+ - **Simple Testing:** Test actors without Vue renderer
266
+ - **Performance:** Microtask batching reduces unnecessary renders
267
+ - **Composability:** Renderer prop enables complex layouts
268
+
269
+ ## Related Packages
270
+
271
+ - **[@xmachines/play-xstate](../play-xstate/README.md)** - XState adapter providing actors
272
+ - **[@xmachines/play-catalog](../play-catalog/README.md)** - UI schema validation
273
+ - **[@xmachines/play-vue-router](../play-vue-router/README.md)** - Vue Router integration
274
+ - **[@xmachines/play-actor](../play-actor/README.md)** - Actor base
275
+ - **[@xmachines/play-signals](../play-signals/README.md)** - TC39 Signals primitives
276
+
277
+ ## License
278
+
279
+ Copyright (c) 2016 [Mikael Karon](mailto:mikael@karon.se). All rights reserved.
280
+
281
+ This work is licensed under the terms of the MIT license.
282
+ For a copy, see <https://opensource.org/licenses/MIT>.
283
+
284
+ @xmachines/play-vue - Vue renderer for XMachines Play architecture
285
+
286
+ ## Interfaces
287
+
288
+ - [PlayRendererProps](interfaces/PlayRendererProps.md)
289
+
290
+ ## Variables
291
+
292
+ - [PlayRenderer](variables/PlayRenderer.md)
@@ -0,0 +1,14 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-vue](../README.md) / PlayRendererProps
2
+
3
+ # Interface: PlayRendererProps
4
+
5
+ Defined in: [types.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-vue/src/types.ts#L17)
6
+
7
+ Props for PlayRenderer component
8
+
9
+ ## Properties
10
+
11
+ | Property | Type | Description | Defined in |
12
+ | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
13
+ | <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`AnyActorLogic`\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) | Actor instance with currentView signal (requires Viewable capability) | [types.ts:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-vue/src/types.ts#L19) |
14
+ | <a id="property-components"></a> `components` | `Record`\<`string`, `Component`\> | Map of component names to Vue components | [types.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-vue/src/types.ts#L22) |
@@ -0,0 +1,9 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-vue](../README.md) / PlayRenderer
2
+
3
+ # Variable: PlayRenderer
4
+
5
+ ```ts
6
+ const PlayRenderer: DefineComponent<{}, {}, unknown>;
7
+ ```
8
+
9
+ Defined in: [vue-shim.d.ts:3](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-vue/src/vue-shim.d.ts#L3)