@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,11 +4,9 @@
4
4
 
5
5
  Route tree extraction from XState v5 state machines. Part of [@xmachines/play](../play/README.md) Universal Player 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-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-router)
8
8
 
9
- Graph-based route extraction and bidirectional lookup enabling Actor Authority over navigation.
10
-
11
- Part of the [xmachines-js monorepo](../../README.md).
9
+ This package extracts the routes from a machine graph and looks them up in both directions. The Actor therefore keeps the authority over the navigation.
12
10
 
13
11
  ## Installation
14
12
 
@@ -23,9 +21,9 @@ pnpm add @xmachines/play-router
23
21
 
24
22
  **URLPattern polyfill (Node.js < 24 / older browsers):**
25
23
 
26
- `@xmachines/play-router` uses the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) for dynamic route matching. URLPattern is available natively on Node.js 24+ and modern browsers (Chrome 95+, Firefox 117+, Safari 16.4+).
24
+ `@xmachines/play-router` matches each dynamic route with the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern). URLPattern is native in Node.js 24+ and in a modern browser (Chrome 95+, Firefox 117+, Safari 16.4+).
27
25
 
28
- On environments without native support, load a polyfill **before** importing this package:
26
+ In an environment without the native API, load a polyfill **before** you import this package:
29
27
 
30
28
  ```typescript
31
29
  // Entry point — must run before any @xmachines/play-router import
@@ -38,7 +36,7 @@ Install the polyfill:
38
36
  pnpm add urlpattern-polyfill
39
37
  ```
40
38
 
41
- `urlpattern-polyfill` is declared as an optional peer dependency. Package managers will not install it automatically consumers must install and load it when their runtime lacks native URLPattern support.
39
+ `urlpattern-polyfill` is an optional peer dependency. A package manager does not install it for you. Install it and load it yourself when your runtime has no native URLPattern.
42
40
 
43
41
  ## Usage
44
42
 
@@ -97,8 +95,13 @@ routeMap.getPathByStateId("profile"); // "/profile/:userId"
97
95
  ### Sending `play.route` events
98
96
 
99
97
  ```typescript
98
+ import { definePlayer } from "@xmachines/play-xstate";
100
99
  import type { PlayRouteEvent } from "@xmachines/play-router";
101
100
 
101
+ // machine: your routable machine (states carry meta.route)
102
+ const actor = definePlayer({ machine })();
103
+ actor.start();
104
+
102
105
  // Navigate to a state by ID
103
106
  const event: PlayRouteEvent = {
104
107
  type: "play.route",
@@ -122,14 +125,21 @@ actor.send({
122
125
  });
123
126
  ```
124
127
 
125
- ### Implementing a `RouterBridgeBase` adapter
128
+ ### How to write a `RouterBridgeBase` adapter
126
129
 
127
- Extend `RouterBridgeBase` and implement the three abstract methods for your framework:
130
+ Extend `RouterBridgeBase`, then implement the three abstract methods for your framework:
128
131
 
129
132
  ```typescript
130
- import { RouterBridgeBase } from "@xmachines/play-router";
133
+ import { RouterBridgeBase, createRouteMap } from "@xmachines/play-router";
131
134
  import type { RoutableActor } from "@xmachines/play-router";
132
135
 
136
+ // Shape of your framework's router — adjust to its real API
137
+ type MyRouter = {
138
+ navigate(path: string): void;
139
+ subscribe(handler: (location: { pathname: string; search: string }) => void): () => void;
140
+ state: { location: { pathname: string } };
141
+ };
142
+
133
143
  export class MyRouterBridge extends RouterBridgeBase {
134
144
  private unsubscribe: (() => void) | null = null;
135
145
 
@@ -165,7 +175,8 @@ export class MyRouterBridge extends RouterBridgeBase {
165
175
  }
166
176
  }
167
177
 
168
- // Usage
178
+ // Usage — myRouter: your framework's router instance;
179
+ // machine/actor: your routable machine and its started actor
169
180
  const routeMap = createRouteMap(machine);
170
181
  const bridge = new MyRouterBridge(myRouter, actor, routeMap);
171
182
  bridge.connect();
@@ -177,79 +188,79 @@ bridge.disconnect();
177
188
 
178
189
  ### Route Extraction
179
190
 
180
- | Export | Description |
181
- | ---------------------------------------- | ---------------------------------------------------------------------------------- |
182
- | `extractMachineRoutes(machine)` | Convert an XState machine to a `RouteTree` with bidirectional state ID ↔ path maps |
183
- | `createRouteMap(machine, options?)` | Build a `RouteMap` directly from a machine (preferred form for adapters) |
184
- | `createRouteMapFromTree(tree, options?)` | Build a `RouteMap` from an already-extracted `RouteTree` |
185
- | `buildRouteTree(routes)` | Build a `RouteTree` from an array of `RouteInfo` objects |
186
- | `machineToGraph(machine)` | Convert a machine to a typed `@statelyai/graph` `Graph` for graph algorithm access |
191
+ | Export | Description |
192
+ | ---------------------------------------- | --------------------------------------------------------------------------------- |
193
+ | `extractMachineRoutes(machine)` | Converts an XState machine into a `RouteTree` with the state ID ↔ path maps |
194
+ | `createRouteMap(machine, options?)` | Builds a `RouteMap` directly from a machine. An adapter uses this form |
195
+ | `createRouteMapFromTree(tree, options?)` | Builds a `RouteMap` from a `RouteTree` that you extracted before |
196
+ | `buildRouteTree(routes)` | Builds a `RouteTree` from an array of `RouteInfo` objects |
197
+ | `machineToGraph(machine)` | Converts a machine into a typed `@statelyai/graph` `Graph`, for a graph algorithm |
187
198
 
188
199
  ### Route Matching
189
200
 
190
- | Export | Description |
191
- | ----------------------------- | ------------------------------------------------------------------------------------------ |
192
- | `RouteMap` | Bidirectional `stateId ↔ path` lookup class; supports O(1) exact and O(k) pattern matching |
193
- | `findRouteById(tree, id)` | Look up a `RouteNode` by state ID |
194
- | `findRouteByPath(tree, path)` | Look up a `RouteNode` by URL path (supports dynamic patterns) |
201
+ | Export | Description |
202
+ | ----------------------------- | ------------------------------------------------------------------------------------------------------------- |
203
+ | `RouteMap` | The `stateId ↔ path` lookup class for both directions. It matches an exact path in O(1) and a pattern in O(k) |
204
+ | `findRouteById(tree, id)` | Finds a `RouteNode` by its state ID |
205
+ | `findRouteByPath(tree, path)` | Finds a `RouteNode` by its URL path. It also matches a dynamic pattern |
195
206
 
196
207
  ### Query Utilities
197
208
 
198
- | Export | Description |
199
- | ------------------------------------------------- | ------------------------------------------------------------------------- |
200
- | `getRoutableRoutes(tree)` | All routable `RouteNode`s as a flat array |
201
- | `getNavigableRoutes(tree, stateId)` | Child routes reachable from a state (hierarchical + transition-reachable) |
202
- | `routeExists(tree, path)` | Check whether a path is registered in the tree |
203
- | `getTransitionReachableRoutes(graph, stateId)` | Route paths reachable via XState transitions from a state |
204
- | `isRouteReachable(graph, fromStateId, toStateId)` | Check whether a transition path exists between two states |
209
+ | Export | Description |
210
+ | ------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
211
+ | `getRoutableRoutes(tree)` | Returns every routable `RouteNode` in one flat array |
212
+ | `getNavigableRoutes(tree, stateId)` | Returns the child routes that a state can reach, through the hierarchy and through a transition |
213
+ | `routeExists(tree, path)` | Tells you if the tree holds a path |
214
+ | `getTransitionReachableRoutes(graph, stateId)` | Returns the route paths that a state can reach through an XState transition |
215
+ | `isRouteReachable(graph, fromStateId, toStateId)` | Tells you if a transition path is present between two states |
205
216
 
206
217
  ### Router Bridge
207
218
 
208
- | Export | Description |
209
- | --------------------------------------- | ------------------------------------------------------------------------------------- |
210
- | `RouterBridgeBase` | Abstract base class for framework router adapters; implements `RouterBridge` protocol |
211
- | `sanitizePathname(path)` | Normalize a raw pathname; returns `null` for paths > 2048 chars or malformed input |
212
- | `buildPlayRouteEvent(options)` | Build a `PlayRouteEvent` from a pathname + route-map match result |
213
- | `extractRouteParams(pathname, pattern)` | Extract path parameters from a URL using URLPattern |
214
- | `extractQuery(search)` | Extract query parameters from a URL search string |
219
+ | Export | Description |
220
+ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
221
+ | `RouterBridgeBase` | The abstract base class of each framework router adapter. It implements the `RouterBridge` protocol |
222
+ | `sanitizePathname(path)` | Normalizes a raw pathname. It returns `null` for a path of more than 2048 characters, and for malformed input |
223
+ | `buildPlayRouteEvent(options)` | Builds a `PlayRouteEvent` from a pathname and a route-map match result |
224
+ | `extractRouteParams(pathname, pattern)` | Reads the path parameters of a URL with URLPattern |
225
+ | `extractQuery(search)` | Reads the query parameters of a URL search string |
215
226
 
216
227
  ### Validation
217
228
 
218
- | Export | Description |
219
- | ---------------------------------------- | ----------------------------------------------------- |
220
- | `validateRouteFormat(route, stateId)` | Assert route path is non-empty |
221
- | `validateStateExists(stateId, stateIds)` | Assert a state ID is present in the machine graph |
222
- | `detectDuplicateRoutes(routes)` | Throw if any two states resolve to the same full path |
229
+ | Export | Description |
230
+ | ---------------------------------------- | ---------------------------------------------------- |
231
+ | `validateRouteFormat(route, stateId)` | Asserts that the route path is not empty |
232
+ | `validateStateExists(stateId, stateIds)` | Asserts that the machine graph holds the state ID |
233
+ | `detectDuplicateRoutes(routes)` | Throws when two states resolve to the same full path |
223
234
 
224
235
  ### Key Types
225
236
 
226
- | Export | Description |
227
- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
228
- | `RouterBridge` | Interface for `connect()` / `disconnect()` lifecycle |
229
- | `RouteTree` | Hierarchical tree with `root`, `byStateId`, `byPath`, and optional `graph` |
230
- | `RouteNode` | Single node in the tree with `id`, `path`, `fullPath`, `stateId`, `children`, `parent` |
231
- | `RouteInfo` | Flat route descriptor extracted from a state node |
232
- | `PlayRouteEvent` | Routing event `{ type: "play.route", to, params?, query? }` |
233
- | `RoutableActor` | Minimal actor interface required by `RouterBridgeBase` `currentRoute`, `initialRoute`, and `send(PlayRouteEvent)` |
234
- | `PlayActor` | Full actor interface used by `PlayRouterProvider` extends `RoutableActor` with `currentView` (`Routable + Viewable`) |
235
- | `RouteMapping` | `{ stateId, path }` pair used to build a `RouteMap` |
236
- | `RouteMapping as BaseRouteMapping` | Alias for `RouteMapping` (backwards-compat re-export) |
237
- | `MachineGraph` | Typed `@statelyai/graph` Graph with `MachineNodeData` / `MachineEdgeData` |
238
- | `WindowLike` | Injectable minimal `window` interface for SSR / testing |
239
- | `LocationLike` | Injectable minimal `location` interface for SSR / testing |
237
+ | Export | Description |
238
+ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
239
+ | `RouterBridge` | The interface of the `connect()` and `disconnect()` lifecycle |
240
+ | `RouteTree` | The hierarchical tree, with `root`, `byStateId`, `byPath`, and an optional `graph` |
241
+ | `RouteNode` | One node of the tree, with `id`, `path`, `fullPath`, `stateId`, `children`, and `parent` |
242
+ | `RouteInfo` | The flat route descriptor that comes from a state node |
243
+ | `PlayRouteEvent` | Routing event `{ type: "play.route", to, params?, query? }` |
244
+ | `RoutableActor` | The minimal actor interface that `RouterBridgeBase` requires: `currentRoute`, `initialRoute`, and `send(PlayRouteEvent)` |
245
+ | `PlayActor` | The complete actor interface that `PlayRouterProvider` uses. It extends `RoutableActor` with `currentView` (`Routable + Viewable`) |
246
+ | `RouteMapping` | The `{ stateId, path }` pair that builds a `RouteMap` |
247
+ | `RouteMapping as BaseRouteMapping` | The alias of `RouteMapping`, for compatibility with an earlier version |
248
+ | `MachineGraph` | The typed `@statelyai/graph` Graph, with `MachineNodeData` and `MachineEdgeData` |
249
+ | `WindowLike` | The minimal `window` interface that you can inject for SSR and for a test |
250
+ | `LocationLike` | The minimal `location` interface that you can inject for SSR and for a test |
240
251
 
241
252
  ### Errors (subpath `@xmachines/play-router/errors`)
242
253
 
243
- | Class | Code | When thrown |
244
- | ---------------------------- | --------------------------------------- | ----------------------------------------------------------------- |
245
- | `RouterSyncError` | `PLAY_ROUTER_SYNC_FAILED` | `syncActorFromRouter()` fails to send a `play.route` event |
246
- | `DuplicateBridgeError` | `PLAY_ROUTER_DUPLICATE_BRIDGE` | A second bridge tries to connect to an actor that already has one |
247
- | `URLPatternUnavailableError` | `PLAY_ROUTE_MAP_URLPATTERN_UNAVAILABLE` | URLPattern API is absent and no polyfill is loaded |
248
- | `InvalidRoutePatternError` | `PLAY_ROUTE_MAP_INVALID_PATTERN` | A route pattern string is rejected by the URLPattern constructor |
249
- | `EmptyRoutePathError` | `PLAY_ROUTE_EMPTY_PATH` | A state declares `meta.route: ""` |
250
- | `InvalidStateIdError` | `PLAY_ROUTE_INVALID_STATE_ID` | A route references a state ID not in the machine graph |
251
- | `DuplicateRoutePathError` | `PLAY_ROUTE_DUPLICATE_PATH` | Two or more states share the same URL path |
252
- | `UnknownStateTypeError` | `PLAY_ROUTE_UNKNOWN_STATE_TYPE` | A state node has an unrecognised XState `.type` value |
254
+ | Class | Code | When thrown |
255
+ | ---------------------------- | --------------------------------------- | ----------------------------------------------------------------------- |
256
+ | `RouterSyncError` | `PLAY_ROUTER_SYNC_FAILED` | `syncActorFromRouter()` cannot send a `play.route` event |
257
+ | `DuplicateBridgeError` | `PLAY_ROUTER_DUPLICATE_BRIDGE` | A second bridge tries to connect to an actor that already has one |
258
+ | `URLPatternUnavailableError` | `PLAY_ROUTE_MAP_URLPATTERN_UNAVAILABLE` | The URLPattern API is absent, and no polyfill is loaded |
259
+ | `InvalidRoutePatternError` | `PLAY_ROUTE_MAP_INVALID_PATTERN` | The URLPattern constructor refuses a route pattern string |
260
+ | `EmptyRoutePathError` | `PLAY_ROUTE_EMPTY_PATH` | A state declares `meta.route: ""` |
261
+ | `InvalidStateIdError` | `PLAY_ROUTE_INVALID_STATE_ID` | A route names a state ID that the machine graph does not hold |
262
+ | `DuplicateRoutePathError` | `PLAY_ROUTE_DUPLICATE_PATH` | Two or more states share the same URL path |
263
+ | `UnknownStateTypeError` | `PLAY_ROUTE_UNKNOWN_STATE_TYPE` | A state node has an XState `.type` value that the package does not know |
253
264
 
254
265
  ```typescript
255
266
  import {
@@ -258,6 +269,7 @@ import {
258
269
  URLPatternUnavailableError,
259
270
  } from "@xmachines/play-router/errors";
260
271
 
272
+ // bridge from the adapter example above
261
273
  try {
262
274
  bridge.connect();
263
275
  } catch (err) {
@@ -273,7 +285,7 @@ try {
273
285
 
274
286
  ### `meta.route` patterns
275
287
 
276
- Routes are declared on XState state nodes via the `meta.route` field:
288
+ Declare the route of an XState state node in its `meta.route` field:
277
289
 
278
290
  ```typescript
279
291
  states: {
@@ -298,7 +310,7 @@ states: {
298
310
 
299
311
  ### Relative vs absolute paths
300
312
 
301
- Child routes with a leading `/` are absolute (do not inherit the parent path). Without a leading `/`, they resolve relative to their nearest routable ancestor:
313
+ A child route that starts with `/` is absolute, and it does not inherit the path of its parent. A child route without the first `/` is relative to its nearest routable ancestor:
302
314
 
303
315
  ```typescript
304
316
  states: {
@@ -319,7 +331,7 @@ states: {
319
331
  }
320
332
  ```
321
333
 
322
- Always use `node.fullPath` (never `node.path`) for browser URL matching and route map construction.
334
+ Always use `node.fullPath` to match a browser URL and to build a route map. Never use `node.path` for this.
323
335
 
324
336
  ## Testing
325
337
 
@@ -331,10 +343,11 @@ pnpm --filter @xmachines/play-router test
331
343
  pnpm --filter @xmachines/play-router run test:watch
332
344
  ```
333
345
 
334
- A router bridge contract test suite for adapter authors lives in
335
- `@xmachines/play-router-shared` (it drives a real actor, so it sits one layer
336
- above this package to keep `@xmachines/play-router` free of an actor-runtime
337
- dependency):
346
+ `@xmachines/play-router-shared` holds a contract test suite of the router bridge, for the
347
+ author of an adapter. That suite drives a real actor. Therefore it is one layer above this
348
+ package, and `@xmachines/play-router` keeps no dependency on an actor runtime.
349
+ `@xmachines/play-router-shared` is a private workspace package. Thus only an adapter author
350
+ in this repository can use the suite:
338
351
 
339
352
  ```typescript
340
353
  import { runBridgeContractTests } from "@xmachines/play-router-shared/test/router-bridge-contract.js";
@@ -344,15 +357,19 @@ runBridgeContractTests({
344
357
  createHarness(initialPath) {
345
358
  // return ContractHarness with bridge, actor, simulateNavigation, getLastNavigatedPath
346
359
  },
360
+ createRestoredHarness(routedPath) {
361
+ // return ContractHarness whose actor is restored to routedPath
362
+ // while the mock router starts at the machine's initial route
363
+ },
347
364
  });
348
365
  ```
349
366
 
350
367
  ## Related Packages
351
368
 
352
369
  - **[@xmachines/play](../play/README.md)** — Core protocol types (`PlayEvent`, `PlayError`)
353
- - **[@xmachines/play-actor](../play-actor/README.md)** — Abstract actor base class (`AbstractActor`, `Routable`); all `AbstractActor` subclasses satisfy `RoutableActor` structurally
354
- - **[@xmachines/play-signals](../play-signals/README.md)** — TC39 Signals polyfill used for actor route observation
355
- - **[@xmachines/play-xstate](../play-xstate/README.md)** — XState v5 logic adapter that integrates with route trees
370
+ - **[@xmachines/play-actor](../play-actor/README.md)** — the abstract actor base class (`AbstractActor`, `Routable`). Every `AbstractActor` subclass satisfies `RoutableActor` structurally
371
+ - **[@xmachines/play-signals](../play-signals/README.md)** — the TC39 Signals polyfill that observes the actor route
372
+ - **[@xmachines/play-xstate](../play-xstate/README.md)** — the XState v5 logic adapter, which works with a route tree
356
373
  - **[@xmachines/play-tanstack-router](../play-tanstack-router/README.md)** — Shared TanStack Router bridge base (framework-agnostic)
357
374
  - **[@xmachines/play-tanstack-react-router](../play-tanstack-react-router/README.md)** — TanStack Router adapter (React)
358
375
  - **[@xmachines/play-tanstack-solid-router](../play-tanstack-solid-router/README.md)** — TanStack Router adapter (SolidJS)
@@ -392,6 +409,7 @@ MIT — see [LICENSE](LICENSE).
392
409
 
393
410
  ## Type Aliases
394
411
 
412
+ - [~~BaseRouteMapping~~](type-aliases/BaseRouteMapping.md)
395
413
  - [MachineGraph](type-aliases/MachineGraph.md)
396
414
  - [RouteMetadata](type-aliases/RouteMetadata.md)
397
415
 
@@ -416,9 +434,3 @@ MIT — see [LICENSE](LICENSE).
416
434
  - [sanitizePathname](functions/sanitizePathname.md)
417
435
  - [validateRouteFormat](functions/validateRouteFormat.md)
418
436
  - [validateStateExists](functions/validateStateExists.md)
419
-
420
- ## References
421
-
422
- ### BaseRouteMapping
423
-
424
- Renames and re-exports [RouteMapping](interfaces/RouteMapping.md)
@@ -2,32 +2,33 @@
2
2
 
3
3
  # Class: RouteMap
4
4
 
5
- Defined in: [base-route-map.ts:101](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/base-route-map.ts#L101)
5
+ Defined in: [base-route-map.ts:105](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L105)
6
6
 
7
- Shared bidirectional route map base class.
7
+ The shared base class of the route map for both directions.
8
8
 
9
- All framework adapters use this class as their route map they add no logic of their
10
- own and inherit the full public API from here.
9
+ Every framework adapter uses this class as its route map. An adapter adds no logic
10
+ of its own, and it inherits the complete public API from here.
11
11
 
12
- **Lookup strategy:**
12
+ **The strategy of a lookup:**
13
13
 
14
- - Static paths (no `:param`)O(1) `Map` lookup
15
- - Dynamic paths → O(k) bucket-indexed scan using `URLPattern`, where `k` is the number
16
- of routes sharing the same first path segment
17
- - Results are cached after the first match in an LRU cache (default 500 entries,
18
- configurable via the `cacheSize` constructor option)
14
+ - A static path, without a `:param` → a `Map` lookup in O(1)
15
+ - A dynamic path a scan of the bucket index in O(k), with `URLPattern`, where
16
+ `k` is the number of the routes with the same first path segment
17
+ - The class keeps each result of a first match in an LRU cache. The default size
18
+ is 500 entries, and the `cacheSize` constructor option changes it
19
19
 
20
- **Pattern syntax** (`:param` / `:param?` / `*`):
20
+ **The syntax of a pattern** (`:param`, `:param?`, and `*`):
21
21
 
22
- - `:param` — required segment, matches exactly one non-`/` segment
23
- - `:param?` — optional segment, matches zero or one non-`/` segment
24
- - `*` — wildcard, matches any number of segments (URLPattern semantics)
22
+ - `:param` — a necessary segment. It matches exactly one segment without a `/`
23
+ - `:param?` — an optional segment. It matches zero segments or one segment without a `/`
24
+ - `*` — a wildcard. It matches each number of segments, as URLPattern defines
25
25
 
26
- **StateId forms:** stateIds may be registered and looked up in either
27
- `"#stateId"` or `"stateId"` form — `RouteMap` canonicalizes internally.
28
- `getStateIdByPath` returns the stateId exactly as registered;
29
- `getPathByStateId` accepts both forms. Registering the same stateId in both
30
- forms refers to one entry (the later registration wins for reverse lookup).
26
+ **The forms of a stateId:** you can register a stateId, and you can look one up,
27
+ in the form `"#stateId"` or in the form `"stateId"`. `RouteMap` makes the
28
+ canonical form itself. `getStateIdByPath` returns the stateId exactly as you
29
+ registered it, and `getPathByStateId` accepts both forms. A registration of the
30
+ same stateId in both forms gives one entry, and the later registration wins for
31
+ the lookup in the other direction.
31
32
 
32
33
  ## Example
33
34
 
@@ -57,21 +58,22 @@ map.getPathByStateId("missing"); // null
57
58
  new RouteMap(mappings, options?): RouteMap;
58
59
  ```
59
60
 
60
- Defined in: [base-route-map.ts:127](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/base-route-map.ts#L127)
61
+ Defined in: [base-route-map.ts:133](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L133)
61
62
 
62
- Build a route map from an array of state ID path mappings.
63
+ Builds a route map from an array of the mappings between a state ID and a path.
63
64
 
64
- Static paths (no `:param`) are indexed in an O(1) `Map`.
65
- Parameterized paths are compiled to `URLPattern` and grouped into first-segment
66
- buckets for efficient candidate selection.
65
+ The constructor puts each static path, which holds no `:param`, into a `Map` for a
66
+ lookup in O(1). It compiles each parameterized path to a `URLPattern`, and it
67
+ groups the patterns into the buckets of the first segment. The selection of the
68
+ candidates is therefore efficient.
67
69
 
68
70
  #### Parameters
69
71
 
70
- | Parameter | Type | Description |
71
- | -------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
72
- | `mappings` | [`RouteMapping`](../interfaces/RouteMapping.md)[] | Array of `{ stateId, path }` entries. Order determines priority when multiple patterns could match the same path. |
73
- | `options` | \{ `cacheSize?`: `number`; \} | Optional configuration. `options.cacheSize`: Maximum number of resolved parameterized path lookups to cache. Defaults to `500`. Increase for applications with many unique parameterized URL values (e.g. user profile pages with thousands of distinct IDs). After eviction the path falls back to the O(k) bucket pattern scan correct but slower. Minimum effective value is `1` (QuickLRU constraint). |
74
- | `options.cacheSize?` | `number` | - |
72
+ | Parameter | Type | Description |
73
+ | -------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
74
+ | `mappings` | [`RouteMapping`](../interfaces/RouteMapping.md)[] | The array of the `{ stateId, path }` entries. The order gives the priority when more than one pattern can match the same path. |
75
+ | `options` | \{ `cacheSize?`: `number`; \} | The optional configuration. `options.cacheSize`: the maximum number of the resolved parameterized path lookups in the cache. The default is `500`. Raise it for an application with many different values in a parameterized URL, for example a page of a user profile with thousands of different IDs. After an eviction, the path goes to the bucket pattern scan in O(k) again, which is correct but slower. The smallest effective value is `1`, because QuickLRU requires it. |
76
+ | `options.cacheSize?` | `number` | - |
75
77
 
76
78
  #### Returns
77
79
 
@@ -85,31 +87,31 @@ buckets for efficient candidate selection.
85
87
  getPathByStateId(stateId): string | null;
86
88
  ```
87
89
 
88
- Defined in: [base-route-map.ts:218](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/base-route-map.ts#L218)
90
+ Defined in: [base-route-map.ts:225](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L225)
89
91
 
90
- Look up the path pattern registered for a state ID.
92
+ Returns the path pattern of a state ID.
91
93
 
92
- Accepts the stateId in either `"#stateId"` or `"stateId"` form regardless of
93
- which form was used at registration lookups are canonicalized internally,
94
- so consumers never need to try both forms.
94
+ The method accepts the stateId in the form `"#stateId"` and in the form
95
+ `"stateId"`, and the form of the registration has no effect. The method makes the
96
+ canonical form itself. Therefore a consumer tries never both forms.
95
97
 
96
98
  #### Parameters
97
99
 
98
- | Parameter | Type | Description |
99
- | --------- | -------- | --------------------------------------------------------- |
100
- | `stateId` | `string` | State machine state ID (e.g., `"profile"`, `"#settings"`) |
100
+ | Parameter | Type | Description |
101
+ | --------- | -------- | --------------------------------------------------------------------------- |
102
+ | `stateId` | `string` | The state ID of the state machine, for example `"profile"` or `"#settings"` |
101
103
 
102
104
  #### Returns
103
105
 
104
106
  `string` \| `null`
105
107
 
106
- The registered path pattern, or `null` if the state ID is unknown
108
+ The registered path pattern, or `null` when the state ID is unknown
107
109
 
108
110
  #### Example
109
111
 
110
112
  ```typescript
111
113
  map.getPathByStateId("profile"); // "/profile/:userId"
112
- map.getPathByStateId("#profile"); // "/profile/:userId" (same entry)
114
+ map.getPathByStateId("#profile"); // "/profile/:userId" — the same entry
113
115
  map.getPathByStateId("missing"); // null
114
116
  ```
115
117
 
@@ -121,25 +123,25 @@ map.getPathByStateId("missing"); // null
121
123
  getStateIdByPath(path): string | null;
122
124
  ```
123
125
 
124
- Defined in: [base-route-map.ts:178](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/base-route-map.ts#L178)
126
+ Defined in: [base-route-map.ts:185](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/base-route-map.ts#L185)
125
127
 
126
- Resolve a URL path to its mapped state ID.
128
+ Resolves a URL path to its state ID.
127
129
 
128
- Strips query strings and hash fragments before matching. Tries an O(1) exact
129
- lookup first, then falls back to bucket-indexed pattern matching. Results are
130
- cached after the first pattern match.
130
+ The method removes the query string and the hash fragment before the match. It
131
+ tries an exact lookup in O(1) first, then it uses the pattern match on the bucket
132
+ index. It keeps each result of a first pattern match in the cache.
131
133
 
132
134
  #### Parameters
133
135
 
134
- | Parameter | Type | Description |
135
- | --------- | -------- | ------------------------------------------------------------------------------ |
136
- | `path` | `string` | URL pathname, optionally including query/hash (e.g., `"/profile/123?ref=nav"`) |
136
+ | Parameter | Type | Description |
137
+ | --------- | -------- | -------------------------------------------------------------------------------------- |
138
+ | `path` | `string` | The URL pathname. It can hold a query and a hash, for example `"/profile/123?ref=nav"` |
137
139
 
138
140
  #### Returns
139
141
 
140
142
  `string` \| `null`
141
143
 
142
- The mapped state ID, or `null` if no route matches
144
+ The state ID of the path, or `null` when no route matches
143
145
 
144
146
  #### Example
145
147
 
@@ -2,19 +2,22 @@
2
2
 
3
3
  # Abstract Class: RouterBridgeBase
4
4
 
5
- Defined in: [router-bridge-base.ts:96](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/router-bridge-base.ts#L96)
5
+ Defined in: [router-bridge-base.ts:99](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-bridge-base.ts#L99)
6
6
 
7
- Abstract base class for all `@xmachines` router adapter bridges.
7
+ The abstract base class of every router adapter bridge of `@xmachines`.
8
8
 
9
- Implements RouterBridge protocol and contains all common bridge logic.
10
- Subclasses only need to implement the 3 abstract methods that differ
11
- between frameworks.
9
+ The class implements the RouterBridge protocol, and it holds every part of the
10
+ bridge logic that the adapters share. A subclass implements the 3 abstract methods
11
+ that are different in each framework, and it implements nothing more.
12
12
 
13
13
  ## Extended by
14
14
 
15
+ - [`DomRouterBridge`](../../play-dom-router/classes/DomRouterBridge.md)
15
16
  - [`ReactRouterBridge`](../../play-react-router/classes/ReactRouterBridge.md)
16
17
  - [`TanStackRouterBridgeBase`](../../play-tanstack-router/classes/TanStackRouterBridgeBase.md)
17
18
  - [`SolidRouterBridge`](../../play-solid-router/classes/SolidRouterBridge.md)
19
+ - [`SvelteKitRouterBridge`](../../play-sveltekit-router/classes/SvelteKitRouterBridge.md)
20
+ - [`SvelteSpaRouterBridge`](../../play-svelte-spa-router/classes/SvelteSpaRouterBridge.md)
18
21
  - [`TanStackReactRouterBridge`](../../play-tanstack-react-router/classes/TanStackReactRouterBridge.md)
19
22
  - [`VueRouterBridge`](../../play-vue-router/classes/VueRouterBridge.md)
20
23
 
@@ -30,14 +33,14 @@ between frameworks.
30
33
  new RouterBridgeBase(actor, routeMap): RouterBridgeBase;
31
34
  ```
32
35
 
33
- Defined in: [router-bridge-base.ts:123](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/router-bridge-base.ts#L123)
36
+ Defined in: [router-bridge-base.ts:127](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play-router/src/router-bridge-base.ts#L127)
34
37
 
35
38
  #### Parameters
36
39
 
37
- | Parameter | Type | Description |
38
- | --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
39
- | `actor` | [`RoutableActor`](../interfaces/RoutableActor.md) | A `RoutableActor` exposing `currentRoute`, `initialRoute`, and `send`. |
40
- | `routeMap` | \{ `getPathByStateId`: `string` \| `null` \| `undefined`; `getStateIdByPath`: `string` \| `null` \| `undefined`; \} | Bidirectional route map for `stateId path` resolution. Provide `getStateIdByPath` and `getPathByStateId`. Framework adapters typically wrap the result of `createRouteMap(machine)` or an equivalent. `getPathByStateId` may be keyed on either the `"#stateId"` or the bare `"stateId"` form both forms are tried automatically by the bridge, so custom implementations (e.g. plain test objects) need only handle one. |
40
+ | Parameter | Type | Description |
41
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
42
+ | `actor` | [`RoutableActor`](../interfaces/RoutableActor.md) | A `RoutableActor`, with `currentRoute`, `initialRoute`, and `send`. |
43
+ | `routeMap` | \{ `getPathByStateId`: `string` \| `null` \| `undefined`; `getStateIdByPath`: `string` \| `null` \| `undefined`; \} | The route map of both directions, for the resolution between a `stateId` and a `path`. Give `getStateIdByPath` and `getPathByStateId`. A framework adapter usually wraps the result of `createRouteMap(machine)`, or an equivalent value. The key of `getPathByStateId` is the form `"#stateId"` or the bare form `"stateId"`. The bridge tries both forms. Therefore an implementation of your own, for example a plain test object, handles one form only. |
41
44
  | `routeMap.getPathByStateId` | - |
42
45
  | `routeMap.getStateIdByPath` | - |
43
46
 
@@ -53,21 +56,23 @@ Defined in: [router-bridge-base.ts:123](https://gitlab.com/xmachin-es/xmachines-
53
56
  connect(): void;
54
57
  ```
55
58
 
56
- Defined in: [router-bridge-base.ts:151](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/router-bridge-base.ts#L151)
59
+ Defined in: [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)
57
60
 
58
- Connect the router bridge to the Actor.
61
+ Connects the router bridge to the Actor.
59
62
 
60
- Sets up the TC39 Signal watcher for actor router direction and
61
- starts watching router changes (framework-specific).
63
+ The method installs the TC39 Signal watcher of the direction from the actor to the
64
+ router. It then starts the watch of the router changes, which each framework does
65
+ in its own way.
62
66
 
63
- Ordering here is part of the bridge contract:
67
+ The order of these steps is part of the contract of the bridge:
64
68
 
65
- - `lastSyncedPath` is seeded in the constructor from `actor.currentRoute`
66
- - the actor watcher is installed before adapter router subscriptions
67
- - initial sync then resolves deep-link vs restore using `actor.initialRoute`
69
+ - The constructor seeds `lastSyncedPath` from `actor.currentRoute`
70
+ - The method installs the actor watcher before the router subscriptions of the adapter
71
+ - The first synchronization then separates a deep link from a restore, with `actor.initialRoute`
68
72
 
69
- Adapters that need custom initial-sync behavior should override
70
- `getInitialRouterPath()` rather than reordering `connect()` steps.
73
+ An adapter that needs a different behavior of the first synchronization overrides
74
+ `getInitialRouterPath()`. It does not change the order of the steps of
75
+ `connect()`.
71
76
 
72
77
  #### Returns
73
78
 
@@ -85,11 +90,12 @@ Adapters that need custom initial-sync behavior should override
85
90
  disconnect(): void;
86
91
  ```
87
92
 
88
- Defined in: [router-bridge-base.ts:256](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play-router/src/router-bridge-base.ts#L256)
93
+ Defined in: [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)
89
94
 
90
- Disconnect the router bridge from the Actor.
95
+ Disconnects the router bridge from the Actor.
91
96
 
92
- Stops signal watching and unregisters framework-specific router listener.
97
+ The method stops the watch of the signal, and it removes the router listener of the
98
+ framework.
93
99
 
94
100
  #### Returns
95
101