@xmachines/docs 1.0.0-beta.51 → 1.0.0-beta.53

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 (364) hide show
  1. package/README.md +13 -11
  2. package/api/@xmachines/play/README.md +6 -5
  3. package/api/@xmachines/play/classes/NonNullableError.md +4 -4
  4. package/api/@xmachines/play/classes/PlayError.md +4 -4
  5. package/api/@xmachines/play/functions/assertNonNullable.md +1 -1
  6. package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
  7. package/api/@xmachines/play-actor/README.md +2 -2
  8. package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -3
  9. package/api/@xmachines/play-actor/functions/typedSpec.md +1 -1
  10. package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +5 -5
  11. package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +5 -5
  12. package/api/@xmachines/play-actor/interfaces/PlaySpec.md +2 -2
  13. package/api/@xmachines/play-actor/interfaces/Routable.md +3 -3
  14. package/api/@xmachines/play-actor/interfaces/Viewable.md +2 -2
  15. package/api/@xmachines/play-dom/README.md +125 -47
  16. package/api/@xmachines/play-dom/classes/PlayRenderer.md +20 -10
  17. package/api/@xmachines/play-dom/functions/createPlayUI.md +9 -9
  18. package/api/@xmachines/play-dom/functions/createRenderer.md +3 -2
  19. package/api/@xmachines/play-dom/functions/defineRegistry.md +1 -1
  20. package/api/@xmachines/play-dom/functions/renderSpec.md +17 -13
  21. package/api/@xmachines/play-dom/interfaces/ComponentContext.md +7 -7
  22. package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +15 -12
  23. package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +4 -4
  24. package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +17 -14
  25. package/api/@xmachines/play-dom/interfaces/EventHandle.md +4 -4
  26. package/api/@xmachines/play-dom/interfaces/MountOptions.md +10 -6
  27. package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +20 -8
  28. package/api/@xmachines/play-dom/interfaces/UIProviderOptions.md +13 -10
  29. package/api/@xmachines/play-dom/type-aliases/ActionFn.md +1 -1
  30. package/api/@xmachines/play-dom/type-aliases/Actions.md +1 -1
  31. package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +7 -7
  32. package/api/@xmachines/play-dom/type-aliases/CatalogHasActions.md +1 -1
  33. package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +1 -1
  34. package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +1 -1
  35. package/api/@xmachines/play-dom/type-aliases/DefineRegistryOptions.md +2 -2
  36. package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +1 -1
  37. package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +1 -1
  38. package/api/@xmachines/play-dom/type-aliases/DomSchema.md +1 -1
  39. package/api/@xmachines/play-dom/type-aliases/MountFn.md +6 -4
  40. package/api/@xmachines/play-dom/type-aliases/SetState.md +1 -1
  41. package/api/@xmachines/play-dom/variables/schema.md +1 -1
  42. package/api/@xmachines/play-dom-router/README.md +23 -25
  43. package/api/@xmachines/play-dom-router/functions/connectRouter.md +1 -1
  44. package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
  45. package/api/@xmachines/play-dom-router/functions/createRouteMap.md +1 -1
  46. package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
  47. package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +14 -14
  48. package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
  49. package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +6 -6
  50. package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +6 -6
  51. package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +68 -0
  52. package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +3 -3
  53. package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +3 -3
  54. package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +2 -2
  55. package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
  56. package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
  57. package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +4 -4
  58. package/api/@xmachines/play-react/README.md +3 -3
  59. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +5 -5
  60. package/api/@xmachines/play-react/functions/useActor.md +3 -3
  61. package/api/@xmachines/play-react/functions/usePlayView.md +1 -1
  62. package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
  63. package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +8 -8
  64. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
  65. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
  66. package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +8 -8
  67. package/api/@xmachines/play-react/interfaces/ViewContextValue.md +5 -5
  68. package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +11 -0
  69. package/api/@xmachines/play-react/variables/ActorProvider.md +1 -1
  70. package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
  71. package/api/@xmachines/play-react/variables/PlayUIProvider.md +1 -1
  72. package/api/@xmachines/play-react-router/README.md +16 -1
  73. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +85 -41
  74. package/api/@xmachines/play-react-router/classes/RouteMap.md +4 -4
  75. package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +4 -4
  76. package/api/@xmachines/play-react-router/functions/createRouteMap.md +1 -1
  77. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
  78. package/api/@xmachines/play-react-router/interfaces/PlayActor.md +68 -0
  79. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +6 -6
  80. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +8 -8
  81. package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +2 -2
  82. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
  83. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
  84. package/api/@xmachines/play-router/README.md +21 -18
  85. package/api/@xmachines/play-router/classes/RouteMap.md +4 -4
  86. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +83 -43
  87. package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
  88. package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
  89. package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
  90. package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +1 -1
  91. package/api/@xmachines/play-router/functions/createRouteMatcher.md +1 -1
  92. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
  93. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
  94. package/api/@xmachines/play-router/functions/extractQuery.md +1 -1
  95. package/api/@xmachines/play-router/functions/extractRouteParams.md +1 -1
  96. package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
  97. package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
  98. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
  99. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
  100. package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +1 -1
  101. package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
  102. package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
  103. package/api/@xmachines/play-router/functions/routeExists.md +1 -1
  104. package/api/@xmachines/play-router/functions/sanitizePathname.md +1 -1
  105. package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
  106. package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
  107. package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
  108. package/api/@xmachines/play-router/interfaces/LocationLike.md +3 -3
  109. package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +3 -3
  110. package/api/@xmachines/play-router/interfaces/MachineNodeData.md +5 -5
  111. package/api/@xmachines/play-router/interfaces/PlayActor.md +68 -0
  112. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +6 -6
  113. package/api/@xmachines/play-router/interfaces/RoutableActor.md +64 -0
  114. package/api/@xmachines/play-router/interfaces/RouteInfo.md +8 -8
  115. package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +2 -2
  116. package/api/@xmachines/play-router/interfaces/RouteMapping.md +3 -3
  117. package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
  118. package/api/@xmachines/play-router/interfaces/RouteMatcher.md +4 -4
  119. package/api/@xmachines/play-router/interfaces/RouteNode.md +10 -10
  120. package/api/@xmachines/play-router/interfaces/RouteObject.md +2 -2
  121. package/api/@xmachines/play-router/interfaces/RouteTree.md +5 -5
  122. package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
  123. package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
  124. package/api/@xmachines/play-router/interfaces/WindowLike.md +3 -3
  125. package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
  126. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
  127. package/api/@xmachines/play-signals/README.md +4 -3
  128. package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
  129. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
  130. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
  131. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
  132. package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
  133. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
  134. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
  135. package/api/@xmachines/play-solid/README.md +18 -20
  136. package/api/@xmachines/play-solid/functions/useActor.md +3 -3
  137. package/api/@xmachines/play-solid/functions/usePlayView.md +1 -1
  138. package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +8 -8
  139. package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +8 -8
  140. package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +5 -5
  141. package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +11 -0
  142. package/api/@xmachines/play-solid/variables/ActorContext.md +2 -2
  143. package/api/@xmachines/play-solid/variables/ActorProvider.md +1 -1
  144. package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
  145. package/api/@xmachines/play-solid/variables/PlayUIProvider.md +1 -1
  146. package/api/@xmachines/play-solid-router/README.md +77 -10
  147. package/api/@xmachines/play-solid-router/classes/RouteMap.md +4 -4
  148. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +83 -35
  149. package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +4 -4
  150. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
  151. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +3 -3
  152. package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +68 -0
  153. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +6 -6
  154. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +8 -8
  155. package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +2 -2
  156. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
  157. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
  158. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +6 -4
  159. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
  160. package/api/@xmachines/play-svelte/README.md +23 -14
  161. package/api/@xmachines/play-svelte/functions/defineRegistry.md +1 -1
  162. package/api/@xmachines/play-svelte/functions/getActorContext.md +3 -3
  163. package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +1 -1
  164. package/api/@xmachines/play-svelte/functions/setActorContext.md +4 -4
  165. package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +8 -8
  166. package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +4 -4
  167. package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +11 -11
  168. package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +5 -5
  169. package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -0
  170. package/api/@xmachines/play-svelte-spa-router/README.md +13 -13
  171. package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +4 -4
  172. package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +1 -1
  173. package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +1 -1
  174. package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +6 -6
  175. package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +6 -6
  176. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +2 -2
  177. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
  178. package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
  179. package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
  180. package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
  181. package/api/@xmachines/play-sveltekit-router/README.md +20 -20
  182. package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +4 -4
  183. package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +1 -1
  184. package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +1 -1
  185. package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
  186. package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
  187. package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +6 -6
  188. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +2 -2
  189. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
  190. package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
  191. package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
  192. package/api/@xmachines/play-tanstack-react-router/README.md +3 -6
  193. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +4 -4
  194. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +80 -35
  195. package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +4 -4
  196. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
  197. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +1 -1
  198. package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
  199. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +68 -0
  200. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +6 -6
  201. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +8 -8
  202. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +2 -2
  203. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
  204. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
  205. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
  206. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
  207. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +4 -4
  208. package/api/@xmachines/play-tanstack-solid-router/README.md +23 -17
  209. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +4 -4
  210. package/api/@xmachines/play-tanstack-solid-router/classes/{SolidRouterBridge.md → TanStackSolidRouterBridge.md} +86 -38
  211. package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +4 -4
  212. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
  213. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +68 -0
  214. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +6 -6
  215. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +8 -8
  216. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +2 -2
  217. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
  218. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
  219. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +6 -4
  220. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +2 -2
  221. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +3 -3
  222. package/api/@xmachines/play-vue/README.md +3 -3
  223. package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
  224. package/api/@xmachines/play-vue/functions/getPlayViewContext.md +1 -1
  225. package/api/@xmachines/play-vue/functions/useActor.md +3 -3
  226. package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +5 -5
  227. package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +8 -8
  228. package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +5 -5
  229. package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +1 -1
  230. package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -0
  231. package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
  232. package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
  233. package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
  234. package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
  235. package/api/@xmachines/play-vue-router/README.md +27 -17
  236. package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
  237. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +81 -33
  238. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
  239. package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +68 -0
  240. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +6 -6
  241. package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +2 -2
  242. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +3 -3
  243. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
  244. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +6 -4
  245. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +3 -3
  246. package/api/@xmachines/play-xstate/README.md +7 -3
  247. package/api/@xmachines/play-xstate/classes/PlayerActor.md +12 -12
  248. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +1 -1
  249. package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
  250. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
  251. package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +1 -1
  252. package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
  253. package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
  254. package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
  255. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +1 -1
  256. package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
  257. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
  258. package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
  259. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +3 -3
  260. package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
  261. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +6 -6
  262. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +5 -5
  263. package/api/@xmachines/play-xstate/interfaces/RouteObject.md +17 -0
  264. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
  265. package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
  266. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
  267. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +1 -1
  268. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
  269. package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +9 -0
  270. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
  271. package/api/@xmachines/shared/README.md +25 -12
  272. package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
  273. package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
  274. package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
  275. package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
  276. package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
  277. package/contributing/architecture.md +599 -0
  278. package/contributing/configuration.md +262 -419
  279. package/contributing/development.md +300 -453
  280. package/contributing/testing.md +165 -172
  281. package/examples/@xmachines/play-dom-demo/README.md +30 -21
  282. package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +1 -1
  283. package/examples/@xmachines/play-dom-demo/functions/initShell.md +1 -1
  284. package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +1 -1
  285. package/examples/@xmachines/play-dom-demo/variables/About.md +1 -1
  286. package/examples/@xmachines/play-dom-demo/variables/Contact.md +1 -1
  287. package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +1 -1
  288. package/examples/@xmachines/play-dom-demo/variables/Home.md +1 -1
  289. package/examples/@xmachines/play-dom-demo/variables/Login.md +1 -1
  290. package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +1 -1
  291. package/examples/@xmachines/play-dom-demo/variables/Navigation.md +1 -1
  292. package/examples/@xmachines/play-dom-demo/variables/Overview.md +1 -1
  293. package/examples/@xmachines/play-dom-demo/variables/Profile.md +1 -1
  294. package/examples/@xmachines/play-dom-demo/variables/Settings.md +1 -1
  295. package/examples/@xmachines/play-dom-demo/variables/Stats.md +1 -1
  296. package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +1 -1
  297. package/examples/@xmachines/play-dom-router-demo/README.md +23 -18
  298. package/examples/@xmachines/play-react-demo/README.md +38 -37
  299. package/examples/@xmachines/play-react-demo/functions/App.md +1 -1
  300. package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +1 -1
  301. package/examples/@xmachines/play-react-demo/variables/About.md +1 -1
  302. package/examples/@xmachines/play-react-demo/variables/Contact.md +1 -1
  303. package/examples/@xmachines/play-react-demo/variables/Dashboard.md +1 -1
  304. package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +1 -1
  305. package/examples/@xmachines/play-react-demo/variables/Home.md +1 -1
  306. package/examples/@xmachines/play-react-demo/variables/Login.md +1 -1
  307. package/examples/@xmachines/play-react-demo/variables/NavBar.md +1 -1
  308. package/examples/@xmachines/play-react-demo/variables/NavBarView.md +1 -1
  309. package/examples/@xmachines/play-react-demo/variables/Navigation.md +1 -1
  310. package/examples/@xmachines/play-react-demo/variables/Overview.md +1 -1
  311. package/examples/@xmachines/play-react-demo/variables/Profile.md +1 -1
  312. package/examples/@xmachines/play-react-demo/variables/Settings.md +1 -1
  313. package/examples/@xmachines/play-react-demo/variables/Shell.md +1 -1
  314. package/examples/@xmachines/play-react-demo/variables/Stats.md +1 -1
  315. package/examples/@xmachines/play-react-demo/variables/authCatalog.md +1 -1
  316. package/examples/@xmachines/play-react-router-demo/README.md +37 -33
  317. package/examples/@xmachines/play-solid-demo/README.md +5 -2
  318. package/examples/@xmachines/play-solid-demo/functions/App.md +1 -1
  319. package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +1 -1
  320. package/examples/@xmachines/play-solid-demo/variables/About.md +1 -1
  321. package/examples/@xmachines/play-solid-demo/variables/Contact.md +1 -1
  322. package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +1 -1
  323. package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +1 -1
  324. package/examples/@xmachines/play-solid-demo/variables/Home.md +1 -1
  325. package/examples/@xmachines/play-solid-demo/variables/Login.md +1 -1
  326. package/examples/@xmachines/play-solid-demo/variables/NavBar.md +1 -1
  327. package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +1 -1
  328. package/examples/@xmachines/play-solid-demo/variables/Navigation.md +1 -1
  329. package/examples/@xmachines/play-solid-demo/variables/Overview.md +1 -1
  330. package/examples/@xmachines/play-solid-demo/variables/Profile.md +1 -1
  331. package/examples/@xmachines/play-solid-demo/variables/Settings.md +1 -1
  332. package/examples/@xmachines/play-solid-demo/variables/Shell.md +1 -1
  333. package/examples/@xmachines/play-solid-demo/variables/Stats.md +1 -1
  334. package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +1 -1
  335. package/examples/@xmachines/play-solid-router-demo/README.md +38 -25
  336. package/examples/@xmachines/play-svelte-demo/README.md +8 -5
  337. package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +1 -1
  338. package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +1 -1
  339. package/examples/@xmachines/play-svelte-spa-router-demo/README.md +11 -9
  340. package/examples/@xmachines/play-sveltekit-router-demo/README.md +14 -9
  341. package/examples/@xmachines/play-tanstack-react-router-demo/README.md +39 -13
  342. package/examples/@xmachines/play-tanstack-solid-router-demo/README.md +27 -13
  343. package/examples/@xmachines/play-vue-demo/README.md +35 -24
  344. package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +1 -1
  345. package/examples/@xmachines/play-vue-demo/variables/App.md +1 -1
  346. package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +1 -1
  347. package/examples/@xmachines/play-vue-router-demo/README.md +2 -0
  348. package/examples/README.md +7 -7
  349. package/examples/multi-router-integration.md +13 -16
  350. package/examples/routing-patterns.md +2 -2
  351. package/guides/README.md +1 -1
  352. package/guides/actor-model.md +2 -2
  353. package/guides/getting-started.md +303 -110
  354. package/guides/signals.md +1 -1
  355. package/guides/state-machines.md +1 -1
  356. package/package.json +2 -2
  357. package/api/@xmachines/play-dom/functions/connectRenderer.md +0 -70
  358. package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +0 -28
  359. package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +0 -9
  360. package/api/@xmachines/play-react/type-aliases/PlayActor.md +0 -9
  361. package/api/@xmachines/play-solid/type-aliases/PlayActor.md +0 -9
  362. package/api/@xmachines/play-svelte/type-aliases/PlayActor.md +0 -9
  363. package/api/@xmachines/play-vue/type-aliases/PlayActor.md +0 -9
  364. package/guides/architecture.md +0 -500
@@ -1,500 +0,0 @@
1
- <!-- generated-by: gsd-doc-writer -->
2
-
3
- # Architecture
4
-
5
- ## System Overview
6
-
7
- XMachines JS is the JavaScript/TypeScript reference implementation of the **Universal Player Architecture** (Play RFC). It is a monorepo of modular packages that strictly separates **business logic (the Actor)** from **infrastructure (router adapters and view renderers)**. An XState v5 state machine is the single source of truth; it owns all state, guards, and route validity. Infrastructure is passive: it observes TC39 Signals emitted by the Actor and proposes state changes via typed events. The Actor's guards make every navigation and transition decision. Communication across the boundary is exclusively through TC39 Signals — never subscriptions, callbacks, or direct state mutation. Five architectural invariants (documented in [`rfc/play.md`](../rfc/play.md)) enforce this contract across the entire package graph.
8
-
9
- **Architectural invariants:**
10
-
11
- | ID | Name | Rule |
12
- | ------ | ---------------------- | ----------------------------------------------------------------- |
13
- | INV-01 | Actor Authority | Infrastructure proposes intents; Actor decides via guards |
14
- | INV-02 | Strict Separation | No direct dependencies between Actor and Infrastructure layers |
15
- | INV-03 | Passive Infrastructure | Infrastructure observes Actor signals, never controls state |
16
- | INV-04 | Signal-Only Reactivity | All state changes flow through TC39 Signals |
17
- | INV-05 | State-Driven Reset | Invalid external navigation is overwritten by Actor-derived state |
18
-
19
- ---
20
-
21
- ## Component Diagram
22
-
23
- ```mermaid
24
- graph TD
25
- subgraph Layer0["Layer 0 — Protocol / Primitives"]
26
- play["@xmachines/play<br/>(PlayEvent, PlayError)"]
27
- signals["@xmachines/play-signals<br/>(TC39 Signal, watchSignal)"]
28
- shared["@xmachines/shared<br/>(tsconfig, oxlint, oxfmt)"]
29
- end
30
-
31
- subgraph Layer1["Layer 1 — Abstract Actor Base"]
32
- actor["@xmachines/play-actor<br/>(AbstractActor, Routable, Viewable, PlaySpec)"]
33
- end
34
-
35
- subgraph Layer2["Layer 2 — Concrete Implementations"]
36
- xstate["@xmachines/play-xstate<br/>(PlayerActor, definePlayer, guards, routing)"]
37
- router["@xmachines/play-router<br/>(RouterBridgeBase, RouteMap, extractMachineRoutes)"]
38
-
39
- subgraph Views["View Renderers"]
40
- react["@xmachines/play-react"]
41
- vue["@xmachines/play-vue"]
42
- solid["@xmachines/play-solid"]
43
- svelte["@xmachines/play-svelte"]
44
- dom["@xmachines/play-dom"]
45
- end
46
-
47
- subgraph RouterAdapters["Router Adapters"]
48
- tsr["@xmachines/play-tanstack-react-router"]
49
- rr["@xmachines/play-react-router"]
50
- vr["@xmachines/play-vue-router"]
51
- sr["@xmachines/play-solid-router"]
52
- tss["@xmachines/play-tanstack-solid-router"]
53
- sk["@xmachines/play-sveltekit-router"]
54
- ssr["@xmachines/play-svelte-spa-router"]
55
- dr["@xmachines/play-dom-router"]
56
- end
57
- end
58
-
59
- play --> actor
60
- signals --> actor
61
- actor --> xstate
62
- actor --> router
63
- actor --> Views
64
- signals --> xstate
65
- signals --> router
66
- play --> xstate
67
- play --> router
68
- router --> RouterAdapters
69
- xstate -.->|"play.route events"| router
70
- ```
71
-
72
- ---
73
-
74
- ## Data Flow
75
-
76
- ### Actor State Change → UI Render
77
-
78
- ```mermaid
79
- flowchart TD
80
- A["XState machine transition"]
81
- B["PlayerActor._xstateActor.subscribe(snapshot)"]
82
- C["StateSignalManager.scheduleUpdate(snapshot)\nactor.state Signal.State updated — synchronous"]
83
- D["actor.currentRoute Signal.Computed recomputes\nderives URL from meta.route + context.params"]
84
- E["_validateAndCacheView(snapshot)\nactor.currentView Signal.State updated"]
85
- F["Framework signal watcher fires\nmicrotask"]
86
- G["ActorProvider reads actor.currentView.get()"]
87
- H["PlayRenderer renders via @json-render/* Renderer"]
88
-
89
- A --> B --> C --> D --> E --> F --> G --> H
90
- ```
91
-
92
- ### User Navigation (Browser URL → Actor)
93
-
94
- ```mermaid
95
- flowchart TD
96
- A["Browser popstate / router navigation event"]
97
- B["Router adapter watchRouterChanges() handler fires"]
98
- C["RouterBridgeBase.syncActorFromRouter(pathname, search)"]
99
- D["sanitizePathname(pathname)\nlength/content guard"]
100
- E["buildPlayRouteEvent(path, routeMap)\nresolves stateId from URL via URLPattern"]
101
- F["actor.send({ type: 'play.route', to: '#stateId', params, query })"]
102
- G["XState machine guard evaluates transition"]
103
- H["machine transitions → signals update\n→ URL bar updated"]
104
- I["guard blocks → machine stays\n→ router re-syncs to actor's current route"]
105
-
106
- A --> B --> C --> D --> E --> F --> G
107
- G -->|valid| H
108
- G -->|invalid| I
109
- ```
110
-
111
- ### Actor State Change → Router URL Sync
112
-
113
- ```mermaid
114
- flowchart TD
115
- A["actor.currentRoute Signal.Computed changes"]
116
- B["RouterBridgeBase routeWatcher\nTC39 Signal.subtle.Watcher fires"]
117
- C["watchSignal microtask queued\nneedsEnqueue dedup guard"]
118
- D["syncRouterFromActor(route) called"]
119
- E["lastSyncedPath set\necho suppression — prevents circular callback"]
120
- F["navigateRouter(path)\ncalls framework router's navigate API"]
121
- G["Router updates URL bar"]
122
-
123
- A --> B --> C --> D --> E --> F --> G
124
- ```
125
-
126
- ### Initial Connection (deep-link vs. restore detection)
127
-
128
- ```mermaid
129
- flowchart TD
130
- A["bridge.connect()"]
131
- B["routeWatcher armed on actor.currentRoute"]
132
- C["watchRouterChanges() subscribed"]
133
- D["getInitialRouterPath() reads current browser URL"]
134
- E["resolves sanitized URL path → stateId via routeMap"]
135
- F{"Compare stateId vs actor.initialRoute"}
136
- G["syncActorFromRouter()\nrouter wins — deep-link"]
137
- H["navigateRouter()\nactor wins — restore"]
138
-
139
- A --> B --> C --> D --> E --> F
140
- F -->|"URL ≠ machine initial state"| G
141
- F -->|"URL = machine initial state"| H
142
- ```
143
-
144
- ### View Prop Enrichment
145
-
146
- ```mermaid
147
- flowchart TD
148
- A["XState snapshot.getMeta()"]
149
- B["resolveViewMeta(meta)\nfinds first meta.view with root + elements"]
150
- C["Extract context.params\nURL path params set by formatPlayRouteTransitions assign"]
151
- D["Extract contextProps allowlist\nexplicit opt-in from PlaySpec.contextProps"]
152
- E["mergeRouteParamsIntoProps()\npriority: spec prop > URL param > contextProps value"]
153
- F["Enriched PlaySpec set on currentView signal"]
154
-
155
- A --> B --> C --> D --> E --> F
156
- ```
157
-
158
- ---
159
-
160
- ## Key Abstractions
161
-
162
- ### [`PlayEvent<TPayload>`](../api/@xmachines/play/type-aliases/PlayEvent.md)
163
-
164
- The minimal event contract for Actor communication: any object with a `readonly type: string` property. `TPayload` extends `Record<string, unknown>` for additional fields. Framework-agnostic; used directly by XState, router adapters, and domain logic. Part of [`@xmachines/play`](../api/@xmachines/play/README.md).
165
-
166
- ```typescript
167
- import type { PlayEvent } from "@xmachines/play";
168
-
169
- type LoginEvent = PlayEvent<{ userId: string; timestamp: number }>;
170
- ```
171
-
172
- ### [`PlayError`](../api/@xmachines/play/classes/PlayError.md)
173
-
174
- Base class for all `@xmachines/*` typed runtime errors. Carries `scope` (throwing class/module) and `code` (stable machine-readable identifier, e.g. `"PLAY_ROUTER_SYNC_FAILED"`). Subclassed per package, exported from each package's `./errors` subpath. Never match on `.message` — always match on `.code` or the subclass.
175
-
176
- ```typescript
177
- import { PlayError } from "@xmachines/play";
178
- import { RouterSyncError } from "@xmachines/play-router/errors";
179
-
180
- if (err instanceof RouterSyncError) {
181
- /* err.scope, err.code, err.cause */
182
- }
183
- ```
184
-
185
- ### [`AbstractActor<TLogic, TEvent>`](../api/@xmachines/play-actor/classes/AbstractActor.md)
186
-
187
- Abstract base class extending XState `Actor`. Declares `public abstract state: Signal.State<unknown>` and `public abstract override send(event: TEvent): void`. Maintains XState ecosystem compatibility (devtools, inspection) while enforcing the signal protocol. Concrete implementations extend this (e.g. [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md)).
188
-
189
- ### [`Routable`](../api/@xmachines/play-actor/interfaces/Routable.md)
190
-
191
- Optional capability interface. Exposes `currentRoute: Signal.Computed<string | null>` (derived URL path) and `readonly initialRoute: string | null` (machine's initial route, fixed at definition time). Router bridges consume this interface directly — they never depend on the concrete [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md).
192
-
193
- ### [`Viewable`](../api/@xmachines/play-actor/interfaces/Viewable.md)
194
-
195
- Optional capability interface. Exposes `currentView: Signal.State<PlaySpec | null>`. View renderers (`PlayRenderer`) consume this contract to resolve the current view description into UI without coupling to the framework or actor implementation.
196
-
197
- ### [`PlaySpec`](../api/@xmachines/play-actor/interfaces/PlaySpec.md)
198
-
199
- Extends `@json-render/core` `Spec` with `readonly contextProps?: readonly string[]` — an explicit allowlist of machine context fields that `deriveCurrentView` merges into element props. Only fields named here are ever exposed to components. `typedSpec<TContext>()` provides compile-time validation of `contextProps` entries against the machine's context type.
200
-
201
- ### [`PlayerActor<TMachine>`](../api/@xmachines/play-xstate/classes/PlayerActor.md)
202
-
203
- Concrete XState v5 actor implementing the full signal protocol. Extends [`AbstractActor`](../api/@xmachines/play-actor/classes/AbstractActor.md); implements both [`Routable`](../api/@xmachines/play-actor/interfaces/Routable.md) and [`Viewable`](../api/@xmachines/play-actor/interfaces/Viewable.md). Wraps an internal `xstate.Actor` and bridges its subscription to TC39 Signals via `StateSignalManager`. Exposes: `state`, `currentRoute`, `currentView`, `initialRoute`, `send()`, `start()`, `stop()`, `can()`, `dispose()`.
204
-
205
- ### [`definePlayer(config)`](../api/@xmachines/play-xstate/functions/definePlayer.md)
206
-
207
- Factory creator. Pre-computes `initialRoute` once from the machine's initial state (zero extra actor instantiation per factory call). Returns [`PlayerFactory<TMachine>`](../api/@xmachines/play-xstate/type-aliases/PlayerFactory.md): `(input?, restore?) => PlayerActor<TMachine>`.
208
-
209
- ```typescript
210
- import { definePlayer } from "@xmachines/play-xstate";
211
- const createPlayer = definePlayer({ machine, options });
212
- const actor = createPlayer(); // or createPlayer(input) or createPlayer(undefined, { snapshot })
213
- actor.start();
214
- ```
215
-
216
- ### [`RouterBridgeBase`](../api/@xmachines/play-router/classes/RouterBridgeBase.md)
217
-
218
- Abstract base class capturing 100% of the shared router bridge logic. Template Method pattern: subclasses implement exactly three abstract methods — `navigateRouter(path)`, `watchRouterChanges()`, `unwatchRouterChanges()`. Manages `isConnected`, `lastSyncedPath` (echo suppression), `isProcessingNavigation` (re-entrant guard redirect prevention), and `routeWatcher` lifecycle. Enforces one-bridge-per-actor via a module-level `WeakMap`.
219
-
220
- ### [`RouteMap`](../api/@xmachines/play-router/classes/RouteMap.md) / [`createRouteMap`](../api/@xmachines/play-router/functions/createRouteMap.md)
221
-
222
- Bidirectional `stateId ↔ URL path` lookup. [`createRouteMap(machine)`](../api/@xmachines/play-router/functions/createRouteMap.md) → [`RouteMap`](../api/@xmachines/play-router/classes/RouteMap.md). [`createRouteMapFromTree(routeTree)`](../api/@xmachines/play-router/functions/createRouteMapFromTree.md) takes the output of [`extractMachineRoutes(machine)`](../api/@xmachines/play-router/functions/extractMachineRoutes.md) directly. Internally uses `URLPattern` for parameterized route matching (e.g. `/profile/:userId`).
223
-
224
- ### [`PlayRouteEvent`](../api/@xmachines/play-router/interfaces/PlayRouteEvent.md)
225
-
226
- Unified routing event sent by router adapters to the Actor.
227
-
228
- ```typescript
229
- interface PlayRouteEvent {
230
- readonly type: "play.route";
231
- readonly to: string; // e.g. "#home", "#profile"
232
- readonly params?: Record<string, string>; // URL path params, e.g. { userId: "123" }
233
- readonly query?: Record<string, string>; // Query string params
234
- readonly match?: unknown; // URLPatternResult (optional, for debugging)
235
- }
236
- ```
237
-
238
- ### [`watchSignal(signal, callback)`](../api/@xmachines/play-signals/functions/watchSignal.md)
239
-
240
- Subscribe to a single TC39 signal with microtask batching and memory-safe cleanup. Uses a one-shot `Signal.subtle.Watcher` lifecycle — re-arms after each notification. `disposed` flag guards post-cleanup callbacks; `needsEnqueue` deduplicates rapid synchronous signal changes. Returns a `() => void` cleanup function.
241
-
242
- ### [`formatPlayRouteTransitions(machineConfig)`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md)
243
-
244
- Crawls machine state configs looking for states with `meta.route` and auto-generates `play.route` transition handlers at the root machine level. Each generated transition: targets the matching state, guards on `event.to === "#stateId"`, and assigns `event.params` and `event.query` to context. Returns the same config type `T` — directly usable by `setup().createMachine()`.
245
-
246
- ---
247
-
248
- ## Directory Structure Rationale
249
-
250
- ```
251
- /workspace/
252
- ├── packages/ # All npm workspace packages
253
- │ ├── shared/ # Shared tooling configs (tsconfig, oxlint, oxfmt, vitest setup)
254
- │ │ └── config/ # Not a runtime package — devDependency only
255
- │ │
256
- │ ├── play/ # Layer 0: Protocol contracts
257
- │ │ └── src/ # PlayEvent, PlayError, NonNullableError, assertNonNullable
258
- │ │
259
- │ ├── play-signals/ # Layer 0: TC39 Signals isolation layer
260
- │ │ └── src/ # Re-exports signal-polyfill; watchSignal utility
261
- │ │
262
- │ ├── play-actor/ # Layer 1: Abstract actor + capability interfaces
263
- │ │ └── src/ # AbstractActor, Routable, Viewable, PlaySpec, typedSpec
264
- │ │
265
- │ ├── play-xstate/ # Layer 2: XState v5 adapter
266
- │ │ └── src/
267
- │ │ ├── player-actor.ts # PlayerActor — concrete actor
268
- │ │ ├── define-player.ts # definePlayer factory
269
- │ │ ├── guards/ # composeGuards, composeGuardsOr, negateGuard, hasContext...
270
- │ │ ├── routing/ # deriveRoute, buildRouteUrl, formatPlayRouteTransitions
271
- │ │ └── signals/ # StateSignalManager (XState → TC39 Signal bridge)
272
- │ │
273
- │ ├── play-router/ # Layer 2: Route extraction, bidirectional mapping, bridge base
274
- │ │ └── src/
275
- │ │ ├── router-bridge-base.ts # RouterBridgeBase (Template Method for all adapters)
276
- │ │ ├── extract-routes.ts # extractMachineRoutes → RouteTree
277
- │ │ ├── base-route-map.ts # RouteMap (bidirectional stateId ↔ path)
278
- │ │ ├── create-route-map.ts # createRouteMap factory (URLPattern-based)
279
- │ │ ├── router-sync.ts # buildPlayRouteEvent, extractRouteParams, sanitizePathname
280
- │ │ └── types.ts # PlayRouteEvent, RouterBridge, RouteTree, WindowLike...
281
- │ │
282
- │ ├── play-react/ # Layer 2: React view renderer
283
- │ ├── play-vue/ # Layer 2: Vue 3 view renderer
284
- │ ├── play-solid/ # Layer 2: SolidJS view renderer
285
- │ ├── play-svelte/ # Layer 2: Svelte 5 view renderer
286
- │ ├── play-dom/ # Layer 2: Vanilla DOM renderer
287
- │ │
288
- │ ├── play-tanstack-react-router/ # Router adapter: TanStack Router (React)
289
- │ ├── play-react-router/ # Router adapter: React Router v7
290
- │ ├── play-vue-router/ # Router adapter: Vue Router
291
- │ ├── play-solid-router/ # Router adapter: SolidJS Router
292
- │ ├── play-tanstack-solid-router/ # Router adapter: TanStack Router (SolidJS)
293
- │ ├── play-sveltekit-router/ # Router adapter: SvelteKit
294
- │ ├── play-svelte-spa-router/ # Router adapter: Svelte SPA Router
295
- │ ├── play-dom-router/ # Router adapter: Vanilla DOM (History API)
296
- │ │
297
- │ └── docs/ # @xmachines/docs — API docs + RFCs
298
- │ └── rfc/ # Living RFC documents (play.md, streams.md, etc.)
299
-
300
- ├── tsconfig.json # Root TypeScript project reference coordinator
301
- │ # Lists all packages in build-order (leaves first)
302
- │ # Does not compile anything itself
303
- └── package.json # npm workspaces root
304
- ```
305
-
306
- ---
307
-
308
- ## TypeScript Build Graph
309
-
310
- The monorepo uses **TypeScript project references** (`"composite": true` per package) for a correct, incremental, dependency-ordered build. The root `tsconfig.json` lists all packages in layer order — leaves first, dependents last. `tsc --build` at the root resolves the full dependency graph automatically.
311
-
312
- **Build layer order (as declared in `tsconfig.json`):**
313
-
314
- ```mermaid
315
- flowchart LR
316
- subgraph L0["Layer 0 — no internal deps"]
317
- ps[play-signals]
318
- p[play]
319
- d[docs]
320
- end
321
- subgraph L1["Layer 1 — depends on L0"]
322
- pa[play-actor]
323
- end
324
- subgraph L2["Layer 2 — depends on L0 + L1"]
325
- pr[play-router]
326
- pdr[play-dom-router]
327
- psk[play-sveltekit-router]
328
- px[play-xstate]
329
- prea[play-react]
330
- pv[play-vue]
331
- pso[play-solid]
332
- psv[play-svelte]
333
- pdo[play-dom]
334
- ptsr[play-tanstack-react-router]
335
- pvr[play-vue-router]
336
- psor[play-solid-router]
337
- pssr[play-svelte-spa-router]
338
- ptss[play-tanstack-solid-router]
339
- end
340
- subgraph L3["Layer 3 — examples / demos"]
341
- ex[play-react-router\nplay-*/examples/demo]
342
- end
343
-
344
- L0 --> L1 --> L2 --> L3
345
- ```
346
-
347
- With `declarationMap: true` in the base tsconfig (from `@xmachines/shared/tsconfig`), IDE "Go to Definition" jumps to TypeScript source files rather than compiled `.d.ts` files, and refactoring works correctly across package boundaries without requiring a build step.
348
-
349
- ---
350
-
351
- ## View Renderer Pattern
352
-
353
- All five view renderer packages follow an identical structural pattern:
354
-
355
- | Component | Role |
356
- | ---------------- | -------------------------------------------------------------------------------------- |
357
- | `ActorProvider` | Subscribes to `actor.currentView` signal; owns signal lifecycle; provides view context |
358
- | `PlayUIProvider` | Convenience wrapper combining `ActorProvider` + framework's `JSONUIProvider` |
359
- | `PlayRenderer` | Zero-prop leaf component; reads from context; delegates to `@json-render/*` `Renderer` |
360
- | `useActor()` | Hook/composable for accessing the raw actor in consuming components |
361
-
362
- **Framework-specific signal bridging:**
363
-
364
- | Package | Signal → Render mechanism |
365
- | ------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
366
- | [`@xmachines/play-react`](../api/@xmachines/play-react/README.md) | `useSignalEffect` → `useReducer` force-update |
367
- | [`@xmachines/play-vue`](../api/@xmachines/play-vue/README.md) | Vue reactivity bridge via `watchEffect` equivalent |
368
- | [`@xmachines/play-solid`](../api/@xmachines/play-solid/README.md) | SolidJS native reactive integration |
369
- | [`@xmachines/play-svelte`](../api/@xmachines/play-svelte/README.md) | Svelte 5 runes (`$effect`) via `actor-context.svelte.ts` |
370
- | [`@xmachines/play-dom`](../api/@xmachines/play-dom/README.md) | Manual DOM updates via [`connectRenderer`](../api/@xmachines/play-dom/functions/connectRenderer.md) / [`createPlayUI`](../api/@xmachines/play-dom/functions/createPlayUI.md) |
371
-
372
- Per-view component state is managed by `@xstate/store`: a fresh store atom is created per [`PlaySpec`](../api/@xmachines/play-actor/interfaces/PlaySpec.md) transition (uncontrolled mode), or an external `store` prop is passed via `ActorProvider`/`PlayUIProvider` (controlled mode).
373
-
374
- ---
375
-
376
- ## Router Adapter Pattern
377
-
378
- All eight router adapter packages follow the Template Method pattern via [`RouterBridgeBase`](../api/@xmachines/play-router/classes/RouterBridgeBase.md). Each adapter implements exactly three abstract methods:
379
-
380
- ```typescript
381
- // How to tell the framework router to change URL
382
- protected abstract navigateRouter(path: string): void;
383
-
384
- // How to subscribe to router location change events
385
- protected abstract watchRouterChanges(): void;
386
-
387
- // How to unsubscribe from router location change events
388
- protected abstract unwatchRouterChanges(): void;
389
- ```
390
-
391
- | Package | Bridge class |
392
- | ------------------------------------------------------------------------------------------------- | -------------------------------------- |
393
- | [`@xmachines/play-tanstack-react-router`](../api/@xmachines/play-tanstack-react-router/README.md) | `TanStackReactRouterBridge` |
394
- | [`@xmachines/play-react-router`](../api/@xmachines/play-react-router/README.md) | `ReactRouterBridge` |
395
- | [`@xmachines/play-vue-router`](../api/@xmachines/play-vue-router/README.md) | `VueRouterBridge` |
396
- | [`@xmachines/play-solid-router`](../api/@xmachines/play-solid-router/README.md) | `SolidRouterBridge` |
397
- | [`@xmachines/play-tanstack-solid-router`](../api/@xmachines/play-tanstack-solid-router/README.md) | `SolidRouterBridge` (TanStack variant) |
398
- | [`@xmachines/play-sveltekit-router`](../api/@xmachines/play-sveltekit-router/README.md) | `SvelteKitRouterBridge` |
399
- | [`@xmachines/play-svelte-spa-router`](../api/@xmachines/play-svelte-spa-router/README.md) | `SvelteSpaRouterBridge` |
400
- | [`@xmachines/play-dom-router`](../api/@xmachines/play-dom-router/README.md) | `DomRouterBridge` |
401
-
402
- Each adapter also exports a framework-integrated provider component (e.g. `PlayRouterProvider`) and a `createRouteMapFrom*` factory appropriate for its router's route definition format.
403
-
404
- ---
405
-
406
- ## Error Handling
407
-
408
- All `@xmachines/*` errors extend [`PlayError`](../api/@xmachines/play/classes/PlayError.md) and carry two stable fields:
409
-
410
- - `scope` — the class or module that threw (e.g. `"RouterBridgeBase"`)
411
- - `code` — a stable machine-readable identifier (e.g. `"PLAY_ROUTER_SYNC_FAILED"`)
412
-
413
- **Error hierarchy:**
414
-
415
- ```mermaid
416
- flowchart TD
417
- PE["PlayError\n@xmachines/play"]
418
- PE --> NNE["NonNullableError\nPLAY_NON_NULLABLE"]
419
- PE --> RSE["RouterSyncError\nPLAY_ROUTER_SYNC_FAILED"]
420
- PE --> UPE["URLPatternUnavailableError\nPLAY_URL_PATTERN_UNAVAILABLE"]
421
- PE --> DBE["DuplicateBridgeError\nPLAY_DUPLICATE_BRIDGE"]
422
- PE --> IEE["InvalidEventError\nPLAY_INVALID_EVENT"]
423
- PE --> IME["InvalidMachineError\nPLAY_INVALID_MACHINE"]
424
- PE --> MRP["MissingRouteParamError\nPLAY_MISSING_ROUTE_PARAM"]
425
- PE --> MSI["MissingStateIdError\nPLAY_MISSING_STATE_ID"]
426
- ```
427
-
428
- Package-specific errors are exported from `./errors` subpath imports:
429
-
430
- ```typescript
431
- import { PlayError } from "@xmachines/play";
432
- import { RouterSyncError } from "@xmachines/play-router/errors";
433
- import { InvalidEventError } from "@xmachines/play-xstate/errors";
434
- ```
435
-
436
- ---
437
-
438
- ## Cross-Cutting Concerns
439
-
440
- **Circular update prevention:** `lastSyncedPath` in [`RouterBridgeBase`](../api/@xmachines/play-router/classes/RouterBridgeBase.md) provides echo suppression for the actor→router direction; `isProcessingNavigation` flag guards against re-entrant guard-redirect loops in `syncActorFromRouter`. `needsEnqueue` in [`watchSignal`](../api/@xmachines/play-signals/functions/watchSignal.md) deduplicates rapid synchronous signal changes via microtask batching.
441
-
442
- **SSR / test injection:** [`WindowLike`](../api/@xmachines/play-router/interfaces/WindowLike.md) and [`LocationLike`](../api/@xmachines/play-router/interfaces/LocationLike.md) structural interfaces in [`@xmachines/play-router`](../api/@xmachines/play-router/README.md) allow injecting mock objects in router adapters, enabling testing without a real browser environment.
443
-
444
- **Logging:** None built-in. [`PlayerOptions`](../api/@xmachines/play-xstate/interfaces/PlayerOptions.md) exposes lifecycle hooks — `onStart`, `onStop`, `onTransition`, `onStateChange`, `onError` — as observability extension points.
445
-
446
- **Authentication:** Not in scope. Authentication is enforced by XState machine guards. Infrastructure proposes navigation via `play.route` events; guards decide whether the transition is allowed from the current state.
447
-
448
- **TC39 Signal isolation:** All signal imports go through [`@xmachines/play-signals`](../api/@xmachines/play-signals/README.md), which re-exports the `signal-polyfill` reference implementation. This isolates the codebase from Stage-1 API churn — a polyfill version upgrade or API change requires editing only one package.
449
-
450
- ---
451
-
452
- ## Application Bootstrap (typical React example)
453
-
454
- ```typescript
455
- import { setup } from "xstate";
456
- import { definePlayer, formatPlayRouteTransitions } from "@xmachines/play-xstate";
457
- import { extractMachineRoutes } from "@xmachines/play-router";
458
- import { createRouteMapFromTree, PlayRouterProvider } from "@xmachines/play-tanstack-react-router";
459
- import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-react";
460
-
461
- // 1. Define machine — meta.route declares virtual routes; meta.view declares UI specs
462
- const machineConfig = formatPlayRouteTransitions({
463
- id: "app",
464
- initial: "home",
465
- context: { params: {}, query: {} },
466
- states: {
467
- home: { id: "home", meta: { route: "/", view: { root: "home", elements: { home: { type: "HomePage", props: {}, children: [] } } } } },
468
- profile: { id: "profile", meta: { route: "/profile/:userId", view: { root: "profile", elements: { profile: { type: "ProfilePage", props: { userId: undefined }, children: [] } } } } },
469
- },
470
- });
471
-
472
- const machine = setup({}).createMachine(machineConfig);
473
-
474
- // 2. Build route map from machine definition (done once at startup)
475
- const routeTree = extractMachineRoutes(machine);
476
- const routeMap = createRouteMapFromTree(routeTree);
477
-
478
- // 3. Create player factory and start actor
479
- const createPlayer = definePlayer({ machine });
480
- const actor = createPlayer();
481
- actor.start();
482
-
483
- // 4. Define component registry for json-render
484
- const registryResult = defineRegistry({ /* components */ });
485
-
486
- // 5. Render — framework providers wire actor → router → view
487
- function App() {
488
- return (
489
- <PlayRouterProvider actor={actor} router={router} routeMap={routeMap}>
490
- <PlayUIProvider actor={actor} registryResult={registryResult}>
491
- <PlayRenderer />
492
- </PlayUIProvider>
493
- </PlayRouterProvider>
494
- );
495
- }
496
- ```
497
-
498
- ---
499
-
500
- _For the living RFC specification, see [`rfc/play.md`](../rfc/play.md)._