@xmachines/docs 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/README.md +11 -13
  2. package/api/@xmachines/play/README.md +58 -63
  3. package/api/@xmachines/play/classes/NonNullableError.md +7 -7
  4. package/api/@xmachines/play/classes/PlayError.md +25 -27
  5. package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
  6. package/api/@xmachines/play/type-aliases/PlayEvent.md +26 -25
  7. package/api/@xmachines/play-actor/README.md +72 -63
  8. package/api/@xmachines/play-actor/classes/AbstractActor.md +39 -39
  9. package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
  10. package/api/@xmachines/play-actor/functions/composePlayState.md +9 -8
  11. package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +5 -5
  12. package/api/@xmachines/play-actor/functions/guardContextWrites.md +27 -25
  13. package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +12 -11
  14. package/api/@xmachines/play-actor/functions/reuseComposedState.md +23 -22
  15. package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +6 -5
  16. package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
  17. package/api/@xmachines/play-actor/functions/typedSpec.md +12 -11
  18. package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
  19. package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
  20. package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -13
  21. package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +4 -4
  22. package/api/@xmachines/play-actor/interfaces/Routable.md +4 -4
  23. package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +11 -11
  24. package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +7 -7
  25. package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
  26. package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +5 -5
  27. package/api/@xmachines/play-dom/README.md +119 -85
  28. package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
  29. package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
  30. package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
  31. package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +8 -8
  32. package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
  33. package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +9 -9
  34. package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
  35. package/api/@xmachines/play-dom-router/README.md +66 -49
  36. package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
  37. package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
  38. package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
  39. package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
  40. package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
  41. package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
  42. package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +19 -18
  43. package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
  44. package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +39 -33
  45. package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
  46. package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
  47. package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
  48. package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
  49. package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
  50. package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
  51. package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
  52. package/api/@xmachines/play-react/README.md +63 -54
  53. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
  54. package/api/@xmachines/play-react/functions/useActor.md +1 -1
  55. package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
  56. package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
  57. package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
  58. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
  59. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
  60. package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
  61. package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
  62. package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
  63. package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
  64. package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
  65. package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
  66. package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
  67. package/api/@xmachines/play-react-router/README.md +37 -28
  68. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
  69. package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
  70. package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
  71. package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
  72. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
  73. package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
  74. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +39 -33
  75. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
  76. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
  77. package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
  78. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
  79. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
  80. package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  81. package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
  82. package/api/@xmachines/play-router/README.md +94 -82
  83. package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
  84. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
  85. package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
  86. package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
  87. package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
  88. package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
  89. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
  90. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
  91. package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
  92. package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
  93. package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
  94. package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
  95. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
  96. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
  97. package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
  98. package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
  99. package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
  100. package/api/@xmachines/play-router/functions/routeExists.md +8 -8
  101. package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
  102. package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
  103. package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
  104. package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
  105. package/api/@xmachines/play-router/interfaces/LocationLike.md +9 -9
  106. package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -7
  107. package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
  108. package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
  109. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +39 -33
  110. package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
  111. package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
  112. package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
  113. package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
  114. package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
  115. package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
  116. package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
  117. package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
  118. package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
  119. package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
  120. package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
  121. package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
  122. package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
  123. package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
  124. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
  125. package/api/@xmachines/play-signals/README.md +38 -36
  126. package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
  127. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
  128. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
  129. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
  130. package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
  131. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
  132. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
  133. package/api/@xmachines/play-solid/README.md +46 -42
  134. package/api/@xmachines/play-solid/functions/useActor.md +1 -1
  135. package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
  136. package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
  137. package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
  138. package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
  139. package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
  140. package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
  141. package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
  142. package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
  143. package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
  144. package/api/@xmachines/play-solid-router/README.md +34 -29
  145. package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
  146. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
  147. package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
  148. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
  149. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +39 -39
  150. package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
  151. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +39 -33
  152. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
  153. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
  154. package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
  155. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
  156. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
  157. package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
  158. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
  159. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
  160. package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
  161. package/api/@xmachines/play-svelte/README.md +40 -31
  162. package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
  163. package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
  164. package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
  165. package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
  166. package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
  167. package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
  168. package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
  169. package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
  170. package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
  171. package/api/@xmachines/play-svelte-spa-router/README.md +25 -25
  172. package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
  173. package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
  174. package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
  175. package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
  176. package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
  177. package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +39 -33
  178. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
  179. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
  180. package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
  181. package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
  182. package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
  183. package/api/@xmachines/play-sveltekit-router/README.md +38 -34
  184. package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
  185. package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
  186. package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
  187. package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
  188. package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
  189. package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +9 -9
  190. package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +39 -33
  191. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
  192. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
  193. package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
  194. package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
  195. package/api/@xmachines/play-tanstack-react-router/README.md +66 -48
  196. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
  197. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
  198. package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
  199. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
  200. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
  201. package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
  202. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
  203. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +39 -33
  204. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
  205. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
  206. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
  207. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
  208. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
  209. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
  210. package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  211. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
  212. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
  213. package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
  214. package/api/@xmachines/play-tanstack-router/README.md +37 -17
  215. package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
  216. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
  217. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
  218. package/api/@xmachines/play-tanstack-solid-router/README.md +71 -45
  219. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
  220. package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
  221. package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
  222. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
  223. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
  224. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +39 -33
  225. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
  226. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
  227. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
  228. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
  229. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
  230. package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  231. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
  232. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
  233. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
  234. package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
  235. package/api/@xmachines/play-vue/README.md +37 -35
  236. package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
  237. package/api/@xmachines/play-vue/functions/useActor.md +1 -1
  238. package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
  239. package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
  240. package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
  241. package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
  242. package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
  243. package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
  244. package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
  245. package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
  246. package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
  247. package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
  248. package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
  249. package/api/@xmachines/play-vue-router/README.md +65 -56
  250. package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
  251. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
  252. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
  253. package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
  254. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +39 -33
  255. package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
  256. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
  257. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
  258. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
  259. package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
  260. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
  261. package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
  262. package/api/@xmachines/play-xstate/README.md +72 -70
  263. package/api/@xmachines/play-xstate/classes/PlayerActor.md +123 -112
  264. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -16
  265. package/api/@xmachines/play-xstate/functions/composeGuards.md +25 -23
  266. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +20 -20
  267. package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +15 -15
  268. package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
  269. package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
  270. package/api/@xmachines/play-xstate/functions/eventMatches.md +8 -8
  271. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +16 -13
  272. package/api/@xmachines/play-xstate/functions/hasContext.md +8 -8
  273. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
  274. package/api/@xmachines/play-xstate/functions/negateGuard.md +19 -18
  275. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
  276. package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
  277. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -10
  278. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
  279. package/api/@xmachines/play-xstate/interfaces/RouteObject.md +2 -2
  280. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +5 -5
  281. package/api/@xmachines/play-xstate/type-aliases/Guard.md +9 -9
  282. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +4 -3
  283. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +7 -7
  284. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -12
  285. package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
  286. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -14
  287. package/api/@xmachines/shared/README.md +11 -13
  288. package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
  289. package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
  290. package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
  291. package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
  292. package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
  293. package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
  294. package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
  295. package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
  296. package/contributing/development.md +28 -0
  297. package/guides/inspector.md +1 -1
  298. package/package.json +1 -1
  299. package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
@@ -4,9 +4,9 @@
4
4
 
5
5
  **Vanilla DOM router (Browser History API) for XMachines Play Architecture.**
6
6
 
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.0.0-blue)](https://www.npmjs.com/package/@xmachines/play-dom-router)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.1.0-blue)](https://www.npmjs.com/package/@xmachines/play-dom-router)
8
8
 
9
- Framework-agnostic router integration that synchronizes a Play actor's `currentRoute` TC39 Signal with the browser's `window.history` API no framework required. Implements the same [`RouterBridgeBase`](../play-router/README.md) pattern as all other router adapters in the XMachines ecosystem.
9
+ This framework-agnostic router integration keeps the `currentRoute` TC39 Signal of a Play actor and the `window.history` API of the browser in step. It needs no framework. It implements the same [`RouterBridgeBase`](../play-router/README.md) pattern as every other router adapter in the XMachines ecosystem.
10
10
 
11
11
  ## Installation
12
12
 
@@ -24,19 +24,20 @@ pnpm add xstate@^5.31.0
24
24
 
25
25
  [`@xmachines/play-dom-router`](README.md) connects a Play actor to the browser URL through the `DomRouterBridge` (extends `RouterBridgeBase` from [`@xmachines/play-router`](../play-router/README.md)):
26
26
 
27
- - Actor route signal (`actor.currentRoute`) drives `history.push()` actor is authoritative.
28
- - Browser navigation events (`popstate`, `pushState`, `replaceState`) send `play.route` intents back to the actor.
29
- - Guarded state transitions remain actor-owned (Actor Authority).
30
- - Circular update prevention via `isProcessingNavigation` flag inherited from `RouterBridgeBase`.
27
+ - The actor route signal (`actor.currentRoute`) drives `history.push()`. The actor is the authority.
28
+ - Each browser navigation event (`popstate`, `pushState`, `replaceState`) sends a `play.route` intent to the actor.
29
+ - The actor keeps the ownership of each guarded state transition (Actor Authority).
30
+ - The `isProcessingNavigation` flag stops a circular update. The bridge inherits the flag from `RouterBridgeBase`.
31
31
 
32
32
  ## Key Exports
33
33
 
34
34
  | Export | Description |
35
35
  | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
36
36
  | `createBrowserHistory(options)` | Wraps `window.history` with a subscribable `BrowserHistory` interface |
37
- | `createRouter(options)` | Creates a `VanillaRouter` combining `BrowserHistory` and `RouteTree` |
37
+ | `createRouter(options)` | Creates a `VanillaRouter` from a `BrowserHistory` and a `RouteTree` |
38
38
  | `connectRouter(options)` | Connects a `VanillaRouter` to a `Routable` actor — returns a `disconnect` cleanup function |
39
- | `createRouteMap` | Re-exported from `@xmachines/play-router` builds bidirectional path state ID map |
39
+ | `DomRouterBridge` | The low-level bridge class. It extends `RouterBridgeBase`. Use it directly for full lifecycle control |
40
+ | `createRouteMap` | It comes from `@xmachines/play-router`. It builds the bidirectional path ↔ state ID map |
40
41
  | `BrowserHistory` | Interface for the history wrapper |
41
42
  | `BrowserWindow` | Structural window interface (accepts `Window`, JSDOM, or any test double) |
42
43
  | `VanillaRouter` | Interface for the router wrapper |
@@ -49,6 +50,8 @@ pnpm add xstate@^5.31.0
49
50
  ## Quick Start
50
51
 
51
52
  ```typescript
53
+ import { createMachine } from "xstate";
54
+ import { definePlayer, formatPlayRouteTransitions } from "@xmachines/play-xstate";
52
55
  import {
53
56
  createBrowserHistory,
54
57
  createRouter,
@@ -57,18 +60,30 @@ import {
57
60
  } from "@xmachines/play-dom-router";
58
61
  import { extractMachineRoutes } from "@xmachines/play-router";
59
62
 
60
- // 1. Extract route tree and build route map from your XState machine
63
+ // 1. Define a routable machine states carry meta.route
64
+ const machine = createMachine(
65
+ formatPlayRouteTransitions({
66
+ id: "app",
67
+ initial: "home",
68
+ states: {
69
+ home: { id: "home", meta: { route: "/" } },
70
+ about: { id: "about", meta: { route: "/about" } },
71
+ },
72
+ }),
73
+ );
74
+
75
+ // 2. Extract route tree and build route map from the machine
61
76
  const routeTree = extractMachineRoutes(machine);
62
77
  const routeMap = createRouteMap(machine);
63
78
 
64
- // 2. Create browser history wrapper (accepts window or any BrowserWindow-compatible object)
79
+ // 3. Create browser history wrapper (accepts window or any BrowserWindow-compatible object)
65
80
  const history = createBrowserHistory({ window });
66
81
 
67
- // 3. Create router
82
+ // 4. Create router
68
83
  const router = createRouter({ routeTree, history });
69
84
 
70
- // 4. Start actor and connect
71
- const actor = definePlayer({ machine, catalog })();
85
+ // 5. Start actor and connect
86
+ const actor = definePlayer({ machine })();
72
87
  actor.start();
73
88
 
74
89
  const disconnect = connectRouter({ actor, router, routeMap });
@@ -84,7 +99,7 @@ window.addEventListener("beforeunload", () => {
84
99
 
85
100
  ### `createBrowserHistory(options)`
86
101
 
87
- Wraps `window.history` to provide a subscribable history interface. Patches `pushState`/`replaceState` to detect programmatic navigations in addition to `popstate` events for back/forward.
102
+ This function wraps `window.history`, and it gives you a history interface with a subscription. It patches `pushState` and `replaceState`. Therefore the wrapper also detects a navigation from the code, not only a `popstate` event from the BACK or FORWARD button.
88
103
 
89
104
  ```typescript
90
105
  const history = createBrowserHistory({ window });
@@ -106,27 +121,28 @@ history.destroy();
106
121
 
107
122
  **`BrowserHistory` interface:**
108
123
 
109
- | Method | Description |
110
- | ----------------------- | -------------------------------------------------------------------------- |
111
- | `location` | Read-only `{ pathname, search, hash, state }` |
112
- | `push(path, state?)` | Push a new entry to history |
113
- | `replace(path, state?)` | Replace the current history entry |
114
- | `go(delta)` | Navigate relative to current position |
115
- | `back()` | Navigate backward |
116
- | `forward()` | Navigate forward |
117
- | `subscribe(listener)` | Subscribe to location changes — returns unsubscribe function |
118
- | `createHref(path)` | Create an href from a path |
119
- | `destroy()` | Cleanup removes listeners and restores patched methods when last wrapper |
124
+ | Method | Description |
125
+ | ----------------------- | ---------------------------------------------------------------------------------------------------- |
126
+ | `location` | Read-only `{ pathname, search, hash, state }` |
127
+ | `push(path, state?)` | Push a new entry to history |
128
+ | `replace(path, state?)` | Replace the current history entry |
129
+ | `go(delta)` | Navigate relative to current position |
130
+ | `back()` | Navigate backward |
131
+ | `forward()` | Navigate forward |
132
+ | `subscribe(listener)` | Subscribe to location changes — returns unsubscribe function |
133
+ | `createHref(path)` | Create an href from a path |
134
+ | `destroy()` | Cleans up. It removes the listeners, and it restores the patched methods when it is the last wrapper |
120
135
 
121
136
  **`BrowserWindow` interface:**
122
137
 
123
- Accepts `window`, a JSDOM window, or any object implementing the structural interface. Covers only properties actually used avoids coupling to `Window & typeof globalThis`.
138
+ The interface accepts `window`, a JSDOM window, or every other object that implements it. It holds only the properties that the package uses. Therefore the package does not depend on `Window & typeof globalThis`.
124
139
 
125
140
  ### `createRouter(options)`
126
141
 
127
- Creates a `VanillaRouter` wrapping `history` and `routeTree`. Designed for parity with TanStack Router's setup flow.
142
+ This function creates a `VanillaRouter` around a `history` and a `routeTree`. Its setup flow is the same as the setup flow of TanStack Router.
128
143
 
129
144
  ```typescript
145
+ // routeTree and history from the Quick Start above
130
146
  const router = createRouter({ routeTree, history });
131
147
  // router.history — the BrowserHistory instance
132
148
  // router.routeTree — for structure reference
@@ -135,10 +151,10 @@ const router = createRouter({ routeTree, history });
135
151
 
136
152
  ### `connectRouter(options)`
137
153
 
138
- Connects a `VanillaRouter` to a `Routable` actor. Handles all bidirectional synchronization:
154
+ This function connects a `VanillaRouter` to a `Routable` actor. It does all the work in both directions:
139
155
 
140
- - On connect: syncs initial URL actor or actor route browser (restore vs. deep-link detection).
141
- - While connected: actor route changes push to history; browser navigations send `play.route` events.
156
+ - On connect: it sets the actor state from the initial URL, or it writes the actor route to the browser. The bridge detects a restore and a deep link.
157
+ - While it is connected: each actor route change goes to the history, and each browser navigation sends a `play.route` event.
142
158
  - Returns a cleanup function that disconnects the bridge.
143
159
 
144
160
  ```typescript
@@ -154,11 +170,11 @@ disconnect();
154
170
 
155
171
  **`ConnectRouterOptions`:**
156
172
 
157
- | Option | Type | Description |
158
- | ---------- | --------------------- | ----------------------------------------- |
159
- | `actor` | `RoutableActor` | Actor to synchronize with the browser URL |
160
- | `router` | `VanillaRouter` | Router from `createRouter()` |
161
- | `routeMap` | `RouteLookupContract` | Bidirectional path ↔ state ID lookup |
173
+ | Option | Type | Description |
174
+ | ---------- | --------------------- | ---------------------------------------------- |
175
+ | `actor` | `RoutableActor` | The actor to keep in step with the browser URL |
176
+ | `router` | `VanillaRouter` | Router from `createRouter()` |
177
+ | `routeMap` | `RouteLookupContract` | Bidirectional path ↔ state ID lookup |
162
178
 
163
179
  **`RouteLookupContract`:**
164
180
 
@@ -169,15 +185,16 @@ interface RouteLookupContract {
169
185
  }
170
186
  ```
171
187
 
172
- Any object satisfying this structural interface is accepted — including `RouteMap` instances from `@xmachines/play-router`, subclasses, or test doubles.
188
+ The bridge accepts every object that implements this structural interface. A `RouteMap` instance from `@xmachines/play-router`, a subclass, and a test double all work.
173
189
 
174
190
  ### `createRouteMap` (re-export)
175
191
 
176
- Re-exported from `@xmachines/play-router`. Builds a bidirectional `RouteMap` from an XState machine:
192
+ This function comes from `@xmachines/play-router`. It builds a bidirectional `RouteMap` from an XState machine:
177
193
 
178
194
  ```typescript
179
195
  import { createRouteMap } from "@xmachines/play-dom-router";
180
196
 
197
+ // machine from the Quick Start above (states carry meta.route)
181
198
  const routeMap = createRouteMap(machine);
182
199
  routeMap.getStateIdByPath("/dashboard"); // "dashboard"
183
200
  routeMap.getPathByStateId("dashboard"); // "/dashboard"
@@ -185,7 +202,7 @@ routeMap.getPathByStateId("dashboard"); // "/dashboard"
185
202
 
186
203
  ## URLPattern Support
187
204
 
188
- This package uses the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) for route pattern matching via [`@xmachines/play-router`](../play-router/README.md). URLPattern is available natively on Node.js 24+ and modern browsers (Chrome 95+, Firefox 117+, Safari 16.4+). On older environments, load a polyfill **before** importing this package see [`@xmachines/play-router`](../play-router/README.md) for details.
205
+ This package matches each route pattern with the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern), through [`@xmachines/play-router`](../play-router/README.md). URLPattern is native in Node.js 24+ and in a modern browser (Chrome 95+, Firefox 117+, Safari 16.4+). In an older environment, load a polyfill **before** you import this package. See [`@xmachines/play-router`](../play-router/README.md) for the details.
189
206
 
190
207
  ## Testing
191
208
 
@@ -197,7 +214,7 @@ pnpm test
197
214
  pnpm --filter @xmachines/play-dom-router test
198
215
  ```
199
216
 
200
- Tests run in Node.js environment with `URLPattern` polyfill setup. Browser-specific tests are in `test/browser/` and run separately via `vitest.browser.config.ts`.
217
+ The tests run in a Node.js environment with the `URLPattern` polyfill setup. The browser tests are in `test/browser/`. They run separately, through `vitest.browser.config.ts`.
201
218
 
202
219
  Coverage thresholds:
203
220
 
@@ -212,11 +229,11 @@ Coverage thresholds:
212
229
 
213
230
  The bridge-first data flow:
214
231
 
215
- 1. `connectRouter` instantiates `DomRouterBridge` (extends `RouterBridgeBase`) and calls `bridge.connect()`.
216
- 2. On connect, `RouterBridgeBase` performs initial sync: if browser URL differs from actor route, a `play.route` event is sent; if actor route differs and browser is at the machine's initial route (restore scenario), the actor wins and history is updated.
217
- 3. Actor route changes (via `currentRoute` Signal) trigger `history.push(path)`.
218
- 4. Browser URL changes (popstate, patched pushState/replaceState) call `syncActorFromRouter(pathname, search)`, which sends a `play.route` event.
219
- 5. Circular updates are prevented by the `isProcessingNavigation` flag in `RouterBridgeBase`.
232
+ 1. `connectRouter` creates a `DomRouterBridge`, which extends `RouterBridgeBase`, and calls `bridge.connect()`.
233
+ 2. On connect, `RouterBridgeBase` does the first synchronization. If the browser URL is different from the actor route, the bridge sends a `play.route` event. If the actor route is different and the browser is at the initial route of the machine (a restore), the actor wins, and the bridge updates the history.
234
+ 3. Each actor route change, through the `currentRoute` Signal, calls `history.push(path)`.
235
+ 4. Each browser URL change (a `popstate` event, or a patched `pushState` or `replaceState` call) calls `syncActorFromRouter(pathname, search)`, which sends a `play.route` event.
236
+ 5. The `isProcessingNavigation` flag in `RouterBridgeBase` stops a circular update.
220
237
 
221
238
  ```
222
239
  Browser URL
@@ -238,17 +255,17 @@ Browser URL
238
255
 
239
256
  - [@xmachines/play-router](../play-router/README.md) — `RouterBridgeBase`, `createRouteMap`, `extractMachineRoutes`
240
257
  - [@xmachines/play-actor](../play-actor/README.md) — `AbstractActor`, `Routable`, `Viewable`; all subclasses satisfy `RoutableActor` structurally
241
- - [@xmachines/play-dom](../play-dom/README.md) — Vanilla DOM renderer for view rendering alongside routing
258
+ - [@xmachines/play-dom](../play-dom/README.md) — the vanilla DOM renderer, for the view beside the routing
242
259
  - [@xmachines/play-xstate](../play-xstate/README.md) — `definePlayer`, `PlayerActor`
243
260
 
244
- ## Part of the XMachines monorepo
245
-
246
- This package is part of the [xmachines-js](../../README.md) monorepo.
247
-
248
261
  ## License
249
262
 
250
263
  MIT — see [LICENSE](LICENSE).
251
264
 
265
+ ## Classes
266
+
267
+ - [DomRouterBridge](classes/DomRouterBridge.md)
268
+
252
269
  ## Interfaces
253
270
 
254
271
  - [BrowserHistory](interfaces/BrowserHistory.md)
@@ -0,0 +1,116 @@
1
+ [API](../../../README.md) / [@xmachines/play-dom-router](../README.md) / DomRouterBridge
2
+
3
+ # Class: DomRouterBridge
4
+
5
+ Defined in: [play-dom-router/src/dom-router-bridge.ts:26](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/dom-router-bridge.ts#L26)
6
+
7
+ The DOM router bridge — it puts a BrowserHistory from `createBrowserHistory`
8
+ behind the `RouterBridgeBase` protocol.
9
+
10
+ It implements the three abstract methods:
11
+
12
+ - `navigateRouter` → `history.push(path)`
13
+ - `watchRouterChanges` → `history.subscribe(...)`, and it keeps the unsubscribe handle
14
+ - `unwatchRouterChanges` → it calls the handle that it kept
15
+
16
+ It overrides two optional hooks:
17
+
18
+ - `getInitialRouterPath` → `history.location.pathname`
19
+ - `getInitialRouterSearch` → `history.location.search`
20
+
21
+ The bridge inherits the prevention of a circular update, the
22
+ restore-or-deeplink detection, and the `lastSyncedPath` deduplication from
23
+ `RouterBridgeBase`.
24
+
25
+ Use `connectRouter` for the usual case. Use this class directly when you need
26
+ full control of the connection lifecycle.
27
+
28
+ ## Extends
29
+
30
+ - [`RouterBridgeBase`](../../play-router/classes/RouterBridgeBase.md)
31
+
32
+ ## Constructors
33
+
34
+ ### Constructor
35
+
36
+ ```ts
37
+ new DomRouterBridge(
38
+ actor,
39
+ routeMap,
40
+ history): DomRouterBridge;
41
+ ```
42
+
43
+ Defined in: [play-dom-router/src/dom-router-bridge.ts:34](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/dom-router-bridge.ts#L34)
44
+
45
+ #### Parameters
46
+
47
+ | Parameter | Type | Description |
48
+ | ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
49
+ | `actor` | [`RoutableActor`](../interfaces/RoutableActor.md) | A `Routable` actor with `currentRoute` and `send`. |
50
+ | `routeMap` | [`RouteLookupContract`](../interfaces/RouteLookupContract.md) | The route lookup for both directions. Every object that satisfies [RouteLookupContract](../interfaces/RouteLookupContract.md) works. |
51
+ | `history` | [`BrowserHistory`](../interfaces/BrowserHistory.md) | The BrowserHistory instance from `createBrowserHistory`. |
52
+
53
+ #### Returns
54
+
55
+ `DomRouterBridge`
56
+
57
+ #### Overrides
58
+
59
+ [`RouterBridgeBase`](../../play-router/classes/RouterBridgeBase.md).[`constructor`](../../play-router/classes/RouterBridgeBase.md#constructor)
60
+
61
+ ## Methods
62
+
63
+ ### connect()
64
+
65
+ ```ts
66
+ connect(): void;
67
+ ```
68
+
69
+ Defined in: [play-router/src/router-bridge-base.ts:158](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-bridge-base.ts#L158)
70
+
71
+ Connects the router bridge to the Actor.
72
+
73
+ The method installs the TC39 Signal watcher of the direction from the actor to the
74
+ router. It then starts the watch of the router changes, which each framework does
75
+ in its own way.
76
+
77
+ The order of these steps is part of the contract of the bridge:
78
+
79
+ - The constructor seeds `lastSyncedPath` from `actor.currentRoute`
80
+ - The method installs the actor watcher before the router subscriptions of the adapter
81
+ - The first synchronization then separates a deep link from a restore, with `actor.initialRoute`
82
+
83
+ An adapter that needs a different behavior of the first synchronization overrides
84
+ `getInitialRouterPath()`. It does not change the order of the steps of
85
+ `connect()`.
86
+
87
+ #### Returns
88
+
89
+ `void`
90
+
91
+ #### Inherited from
92
+
93
+ [`RouterBridgeBase`](../../play-router/classes/RouterBridgeBase.md).[`connect`](../../play-router/classes/RouterBridgeBase.md#connect)
94
+
95
+ ---
96
+
97
+ ### disconnect()
98
+
99
+ ```ts
100
+ disconnect(): void;
101
+ ```
102
+
103
+ Defined in: [play-router/src/router-bridge-base.ts:270](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-bridge-base.ts#L270)
104
+
105
+ Disconnects the router bridge from the Actor.
106
+
107
+ The method stops the watch of the signal, and it removes the router listener of the
108
+ framework.
109
+
110
+ #### Returns
111
+
112
+ `void`
113
+
114
+ #### Inherited from
115
+
116
+ [`RouterBridgeBase`](../../play-router/classes/RouterBridgeBase.md).[`disconnect`](../../play-router/classes/RouterBridgeBase.md#disconnect)
@@ -6,11 +6,12 @@
6
6
  function connectRouter(options): () => void;
7
7
  ```
8
8
 
9
- Defined in: [play-dom-router/src/connect-router.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-dom-router/src/connect-router.ts#L51)
9
+ Defined in: [play-dom-router/src/connect-router.ts:52](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/connect-router.ts#L52)
10
10
 
11
- Connect vanilla router to actor (pure browser integration).
11
+ Connects the vanilla router to an actor. This is a pure browser integration.
12
12
 
13
- Returns a cleanup function. Calls `bridge.disconnect()` to stop sync.
13
+ The function returns a cleanup function. That function calls
14
+ `bridge.disconnect()` to stop the synchronization.
14
15
 
15
16
  ## Parameters
16
17
 
@@ -6,20 +6,21 @@
6
6
  function createBrowserHistory(options): BrowserHistory;
7
7
  ```
8
8
 
9
- Defined in: [play-dom-router/src/create-browser-history.ts:120](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-dom-router/src/create-browser-history.ts#L120)
9
+ Defined in: [play-dom-router/src/create-browser-history.ts:122](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/create-browser-history.ts#L122)
10
10
 
11
- Create browser history that wraps window.history
11
+ Creates a browser history that wraps window.history
12
12
 
13
- Aligned with TanStack Router's history interface for API parallelism.
13
+ The interface is the same as the history interface of TanStack Router, so that
14
+ the two APIs stay parallel.
14
15
 
15
16
  Architecture:
16
17
 
17
- - Patches window.history.pushState/replaceState to detect changes
18
- - Listens to popstate for browser back/forward
19
- - Provides subscribe() for listeners (like PlayRouterProvider)
20
- - Testable (accepts window object)
18
+ - It patches window.history.pushState and window.history.replaceState, to detect a change
19
+ - It listens for popstate, for the browser BACK and FORWARD buttons
20
+ - It gives you subscribe() for a listener, such as PlayRouterProvider
21
+ - It accepts a window object, so a test can give a double
21
22
 
22
- Usage:
23
+ Use:
23
24
 
24
25
  ```typescript
25
26
  const history = createBrowserHistory({ window });
@@ -35,13 +36,14 @@ unsubscribe();
35
36
  history.destroy();
36
37
  ```
37
38
 
38
- `destroy()` is idempotent and cooperates with other wrappers created for the
39
- same `window` instance.
39
+ `destroy()` is idempotent, and it cooperates with each other wrapper of the same
40
+ `window` instance.
40
41
 
41
- **Warning**: `createBrowserHistory()` mutates global `window.history` methods
42
- (`pushState` and `replaceState`) and coordinates wrappers with shared ref-count state.
43
- To mitigate leakage, create one history wrapper per browser window at the application
44
- boundary and always pair it with `destroy()` during teardown.
42
+ **Warning**: `createBrowserHistory()` changes the global `window.history` methods
43
+ (`pushState` and `replaceState`), and it coordinates the wrappers with a shared
44
+ reference count. Therefore create one history wrapper for each browser window, at
45
+ the boundary of the application, and always call `destroy()` during the
46
+ teardown.
45
47
 
46
48
  ## Parameters
47
49
 
@@ -6,27 +6,28 @@
6
6
  function createRouteMap(machine, options?): RouteMap;
7
7
  ```
8
8
 
9
- Defined in: [play-router/src/create-route-map.ts:45](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/create-route-map.ts#L45)
9
+ Defined in: [play-router/src/create-route-map.ts:47](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/create-route-map.ts#L47)
10
10
 
11
- Create a `RouteMap` from an XState state machine.
11
+ Creates a `RouteMap` from an XState state machine.
12
12
 
13
- Extracts all routable states (those with `meta.route`) and builds a bidirectional
14
- path stateId lookup structure. The returned map is used by `RouterBridgeBase`
15
- subclasses to translate browser URL changes into `play.route` actor events and
16
- vice-versa.
13
+ The function reads every state with a route, which means each state with a
14
+ `meta.route` field. It then builds the lookup structure between a path and a
15
+ stateId, for both directions. A subclass of `RouterBridgeBase` uses the map: it
16
+ converts each change of the browser URL into a `play.route` actor event, and each
17
+ actor route into a URL.
17
18
 
18
19
  ## Parameters
19
20
 
20
- | Parameter | Type | Description |
21
- | ---------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
22
- | `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | XState v5 state machine with `meta.route` annotations on states. |
23
- | `options?` | [`RouteMapOptions`](../interfaces/RouteMapOptions.md) | Optional configuration. Pass `{ cacheSize }` to override the default LRU cache size for parameterized path lookups. |
21
+ | Parameter | Type | Description |
22
+ | ---------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
23
+ | `machine` | [`AnyStateMachine`](https://www.jsdocs.io/package/xstate#AnyStateMachine) | The XState v5 state machine, with a `meta.route` annotation on each state with a route. |
24
+ | `options?` | [`RouteMapOptions`](../interfaces/RouteMapOptions.md) | The optional configuration. Give `{ cacheSize }` to change the default size of the LRU cache of the parameterized path lookups. |
24
25
 
25
26
  ## Returns
26
27
 
27
28
  [`RouteMap`](../interfaces/RouteMap.md)
28
29
 
29
- A `RouteMap` for passing to any `RouterBridgeBase`-based adapter.
30
+ A `RouteMap` for each adapter on `RouterBridgeBase`.
30
31
 
31
32
  ## Example
32
33
 
@@ -6,37 +6,37 @@
6
6
  function createRouter(options): VanillaRouter;
7
7
  ```
8
8
 
9
- Defined in: [play-dom-router/src/create-router.ts:52](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-dom-router/src/create-router.ts#L52)
9
+ Defined in: [play-dom-router/src/create-router.ts:52](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-dom-router/src/create-router.ts#L52)
10
10
 
11
- Create vanilla router for framework-agnostic routing.
11
+ Creates the vanilla router for a framework-agnostic routing.
12
12
 
13
13
  Architecture:
14
14
 
15
- - Just wraps history and routeTree
16
- - Does NOT embed routeMap (providers need it as prop)
17
- - Framework-agnostic history management only
15
+ - The router wraps a history and a routeTree, and it does nothing more
16
+ - It does NOT hold the routeMap, because a provider needs the routeMap as a prop
17
+ - It manages the history only, and it knows no framework
18
18
 
19
- Why no routeMap:
19
+ The reason for no routeMap:
20
20
 
21
- - Router doesn't know about state IDs (that's Play-specific)
22
- - RouteMap is the bridge between router and actor
23
- - Provider receives routeMap as prop to do path state ID resolution
21
+ - The router knows nothing about a state ID, because a state ID belongs to Play
22
+ - The RouteMap is the bridge between the router and the actor
23
+ - The provider receives the routeMap as a prop, and it resolves a path to a state ID
24
24
 
25
- Usage (parallel to TanStack mode):
25
+ Use, parallel to the TanStack mode:
26
26
 
27
27
  ```typescript
28
- // Both modes: identical setup
28
+ // Both modes: the same setup
29
29
  const routeTree = extractMachineRoutes(machine);
30
30
  const routeMap = createRouteMapFromTree(routeTree);
31
31
  const history = createBrowserHistory({ window });
32
32
 
33
- // Vanilla router
33
+ // The vanilla router
34
34
  const router = createRouter({ routeTree, history });
35
35
 
36
- // Connect router to actor (handles all bidirectional sync)
36
+ // Connect the router to the actor. This does all the work in both directions
37
37
  const disconnect = connectRouter({ actor, router, routeMap });
38
38
 
39
- // Later: cleanup
39
+ // Later: clean up
40
40
  disconnect();
41
41
  router.destroy();
42
42
  ```