@xmachines/docs 1.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/api/@xmachines/play/README.md +130 -0
  4. package/api/@xmachines/play/type-aliases/PlayEvent.md +81 -0
  5. package/api/@xmachines/play-actor/README.md +247 -0
  6. package/api/@xmachines/play-actor/classes/AbstractActor.md +520 -0
  7. package/api/@xmachines/play-actor/interfaces/Routable.md +29 -0
  8. package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +17 -0
  9. package/api/@xmachines/play-actor/interfaces/Viewable.md +12 -0
  10. package/api/@xmachines/play-catalog/README.md +331 -0
  11. package/api/@xmachines/play-catalog/functions/defineCatalog.md +98 -0
  12. package/api/@xmachines/play-catalog/functions/defineComponents.md +134 -0
  13. package/api/@xmachines/play-catalog/type-aliases/Catalog.md +48 -0
  14. package/api/@xmachines/play-catalog/type-aliases/ComponentsFor.md +20 -0
  15. package/api/@xmachines/play-catalog/type-aliases/InferComponentProps.md +65 -0
  16. package/api/@xmachines/play-catalog/type-aliases/NoExtraKeys.md +17 -0
  17. package/api/@xmachines/play-react/README.md +423 -0
  18. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +613 -0
  19. package/api/@xmachines/play-react/functions/useSignalEffect.md +68 -0
  20. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +15 -0
  21. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +14 -0
  22. package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +15 -0
  23. package/api/@xmachines/play-react/variables/PlayRenderer.md +64 -0
  24. package/api/@xmachines/play-react-router/README.md +198 -0
  25. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +321 -0
  26. package/api/@xmachines/play-react-router/classes/RouteMap.md +137 -0
  27. package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +19 -0
  28. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +35 -0
  29. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +119 -0
  30. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +14 -0
  31. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +17 -0
  32. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +104 -0
  33. package/api/@xmachines/play-react-router-demo/README.md +137 -0
  34. package/api/@xmachines/play-router/README.md +502 -0
  35. package/api/@xmachines/play-router/classes/BaseRouteMap.md +142 -0
  36. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +300 -0
  37. package/api/@xmachines/play-router/functions/buildRouteTree.md +27 -0
  38. package/api/@xmachines/play-router/functions/connectRouter.md +67 -0
  39. package/api/@xmachines/play-router/functions/crawlMachine.md +92 -0
  40. package/api/@xmachines/play-router/functions/createBrowserHistory.md +47 -0
  41. package/api/@xmachines/play-router/functions/createRouteMap.md +53 -0
  42. package/api/@xmachines/play-router/functions/createRouter.md +76 -0
  43. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +32 -0
  44. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +64 -0
  45. package/api/@xmachines/play-router/functions/extractRoute.md +45 -0
  46. package/api/@xmachines/play-router/functions/findRouteById.md +37 -0
  47. package/api/@xmachines/play-router/functions/findRouteByPath.md +39 -0
  48. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +35 -0
  49. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +39 -0
  50. package/api/@xmachines/play-router/functions/routeExists.md +26 -0
  51. package/api/@xmachines/play-router/functions/validateRouteFormat.md +29 -0
  52. package/api/@xmachines/play-router/functions/validateStateExists.md +29 -0
  53. package/api/@xmachines/play-router/interfaces/BaseRouteMapping.md +27 -0
  54. package/api/@xmachines/play-router/interfaces/BrowserHistory.md +172 -0
  55. package/api/@xmachines/play-router/interfaces/BrowserWindow.md +69 -0
  56. package/api/@xmachines/play-router/interfaces/ConnectRouterOptions.md +13 -0
  57. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +119 -0
  58. package/api/@xmachines/play-router/interfaces/RouteInfo.md +19 -0
  59. package/api/@xmachines/play-router/interfaces/RouteMap.md +56 -0
  60. package/api/@xmachines/play-router/interfaces/RouteNode.md +21 -0
  61. package/api/@xmachines/play-router/interfaces/RouteObject.md +21 -0
  62. package/api/@xmachines/play-router/interfaces/RouteTree.md +20 -0
  63. package/api/@xmachines/play-router/interfaces/RouterBridge.md +104 -0
  64. package/api/@xmachines/play-router/interfaces/StateVisit.md +15 -0
  65. package/api/@xmachines/play-router/interfaces/VanillaRouter.md +28 -0
  66. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +11 -0
  67. package/api/@xmachines/play-router-demo/README.md +137 -0
  68. package/api/@xmachines/play-signals/README.md +176 -0
  69. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +34 -0
  70. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +49 -0
  71. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +35 -0
  72. package/api/@xmachines/play-signals/interfaces/SignalState.md +68 -0
  73. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +97 -0
  74. package/api/@xmachines/play-signals/namespaces/Signal/README.md +22 -0
  75. package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +52 -0
  76. package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +72 -0
  77. package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +19 -0
  78. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/README.md +21 -0
  79. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +85 -0
  80. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +13 -0
  81. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +19 -0
  82. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +19 -0
  83. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +19 -0
  84. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +19 -0
  85. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +25 -0
  86. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +9 -0
  87. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +9 -0
  88. package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +19 -0
  89. package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +19 -0
  90. package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +19 -0
  91. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +32 -0
  92. package/api/@xmachines/play-solid/README.md +311 -0
  93. package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +15 -0
  94. package/api/@xmachines/play-solid/variables/PlayRenderer.md +70 -0
  95. package/api/@xmachines/play-solid-router/README.md +666 -0
  96. package/api/@xmachines/play-solid-router/classes/RouteMap.md +150 -0
  97. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +347 -0
  98. package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +19 -0
  99. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +32 -0
  100. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +486 -0
  101. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +119 -0
  102. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +14 -0
  103. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +14 -0
  104. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +104 -0
  105. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +9 -0
  106. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +51 -0
  107. package/api/@xmachines/play-solid-router-demo/README.md +127 -0
  108. package/api/@xmachines/play-tanstack-react-router/README.md +226 -0
  109. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +137 -0
  110. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +348 -0
  111. package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +19 -0
  112. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +53 -0
  113. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +35 -0
  114. package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +38 -0
  115. package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +33 -0
  116. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +119 -0
  117. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +14 -0
  118. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +17 -0
  119. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +26 -0
  120. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +104 -0
  121. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +9 -0
  122. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +78 -0
  123. package/api/@xmachines/play-tanstack-react-router/variables/extractMachineRoutes.md +64 -0
  124. package/api/@xmachines/play-tanstack-react-router-demo/README.md +126 -0
  125. package/api/@xmachines/play-tanstack-solid-router/README.md +285 -0
  126. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +150 -0
  127. package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +343 -0
  128. package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +19 -0
  129. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +32 -0
  130. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +119 -0
  131. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +14 -0
  132. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +23 -0
  133. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +104 -0
  134. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +9 -0
  135. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +9 -0
  136. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +78 -0
  137. package/api/@xmachines/play-tanstack-solid-router-demo/README.md +126 -0
  138. package/api/@xmachines/play-vue/README.md +292 -0
  139. package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +14 -0
  140. package/api/@xmachines/play-vue/variables/PlayRenderer.md +9 -0
  141. package/api/@xmachines/play-vue-router/README.md +604 -0
  142. package/api/@xmachines/play-vue-router/classes/RouteMap.md +209 -0
  143. package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +201 -0
  144. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +360 -0
  145. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +19 -0
  146. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +119 -0
  147. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +15 -0
  148. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +104 -0
  149. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +9 -0
  150. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +67 -0
  151. package/api/@xmachines/play-vue-router-demo/README.md +133 -0
  152. package/api/@xmachines/play-xstate/README.md +512 -0
  153. package/api/@xmachines/play-xstate/classes/PlayerActor.md +527 -0
  154. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +43 -0
  155. package/api/@xmachines/play-xstate/functions/composeGuards.md +79 -0
  156. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +67 -0
  157. package/api/@xmachines/play-xstate/functions/definePlayer.md +127 -0
  158. package/api/@xmachines/play-xstate/functions/deriveRoute.md +109 -0
  159. package/api/@xmachines/play-xstate/functions/eventMatches.md +40 -0
  160. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +54 -0
  161. package/api/@xmachines/play-xstate/functions/hasContext.md +42 -0
  162. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +41 -0
  163. package/api/@xmachines/play-xstate/functions/mergeViewProps.md +26 -0
  164. package/api/@xmachines/play-xstate/functions/negateGuard.md +61 -0
  165. package/api/@xmachines/play-xstate/functions/stateMatches.md +25 -0
  166. package/api/@xmachines/play-xstate/functions/validateComponentBinding.md +39 -0
  167. package/api/@xmachines/play-xstate/functions/validateViewProps.md +80 -0
  168. package/api/@xmachines/play-xstate/interfaces/CatalogEntry.md +16 -0
  169. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +24 -0
  170. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +26 -0
  171. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +22 -0
  172. package/api/@xmachines/play-xstate/type-aliases/Catalog.md +21 -0
  173. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +14 -0
  174. package/api/@xmachines/play-xstate/type-aliases/Guard.md +34 -0
  175. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +20 -0
  176. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +29 -0
  177. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +45 -0
  178. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +51 -0
  179. package/api/@xmachines/play-xstate/type-aliases/ValidationResult.md +17 -0
  180. package/api/@xmachines/play-xstate/type-aliases/ViewMergeContext.md +35 -0
  181. package/api/@xmachines/shared/README.md +379 -0
  182. package/api/@xmachines/shared/functions/defineXmVitestConfig.md +29 -0
  183. package/api/@xmachines/shared/functions/xmAliases.md +24 -0
  184. package/api/README.md +25 -0
  185. package/api/llms.txt +26 -0
  186. package/examples/README.md +63 -0
  187. package/examples/basic-state-machine.md +70 -0
  188. package/examples/form-validation.md +167 -0
  189. package/examples/multi-router-integration.md +277 -0
  190. package/examples/routing-patterns.md +260 -0
  191. package/examples/traffic-light.md +99 -0
  192. package/guides/README.md +29 -0
  193. package/guides/getting-started.md +223 -0
  194. package/guides/installation.md +323 -0
  195. package/index.d.ts +3 -0
  196. package/index.js +4 -0
  197. package/package.json +54 -0
@@ -0,0 +1,300 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / RouterBridgeBase
2
+
3
+ # Abstract Class: RouterBridgeBase
4
+
5
+ Defined in: [router-bridge-base.ts:56](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L56)
6
+
7
+ Abstract base class for all `@xmachines` router adapter bridges.
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.
12
+
13
+ ## Extended by
14
+
15
+ - [`ReactRouterBridge`](../../play-react-router/classes/ReactRouterBridge.md)
16
+ - [`SolidRouterBridge`](../../play-solid-router/classes/SolidRouterBridge.md)
17
+ - [`TanStackReactRouterBridge`](../../play-tanstack-react-router/classes/TanStackReactRouterBridge.md)
18
+ - [`SolidRouterBridge`](../../play-tanstack-solid-router/classes/SolidRouterBridge.md)
19
+ - [`VueRouterBridge`](../../play-vue-router/classes/VueRouterBridge.md)
20
+
21
+ ## Implements
22
+
23
+ - [`RouterBridge`](../interfaces/RouterBridge.md)
24
+
25
+ ## Constructors
26
+
27
+ ### Constructor
28
+
29
+ ```ts
30
+ new RouterBridgeBase(actor, routeMap): RouterBridgeBase;
31
+ ```
32
+
33
+ Defined in: [router-bridge-base.ts:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L70)
34
+
35
+ Constructor receives the 3 things all bridges need.
36
+
37
+ #### Parameters
38
+
39
+ | Parameter | Type | Description |
40
+ | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
41
+ | `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`AnyActorLogic`\> & [`Routable`](../../play-actor/interfaces/Routable.md) | Actor with currentRoute signal and send method |
42
+ | `routeMap` | \{ `getPathByStateId`: `string` \| `null` \| `undefined`; `getStateIdByPath`: `string` \| `null` \| `undefined`; \} | Bidirectional route map for stateId ↔ path resolution |
43
+ | `routeMap.getPathByStateId` | - |
44
+ | `routeMap.getStateIdByPath` | - |
45
+
46
+ #### Returns
47
+
48
+ `RouterBridgeBase`
49
+
50
+ ## Properties
51
+
52
+ | Property | Modifier | Type | Default value | Description | Defined in |
53
+ | --------------------------------------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | <a id="property-actor"></a> `actor` | `readonly` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`AnyActorLogic`\> & [`Routable`](../../play-actor/interfaces/Routable.md) | `undefined` | Actor with currentRoute signal and send method | [router-bridge-base.ts:71](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L71) |
55
+ | <a id="property-hasconnectedonce"></a> `hasConnectedOnce` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:59](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L59) |
56
+ | <a id="property-isconnected"></a> `isConnected` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:58](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L58) |
57
+ | <a id="property-isprocessingnavigation"></a> `isProcessingNavigation` | `protected` | `boolean` | `false` | - | [router-bridge-base.ts:61](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L61) |
58
+ | <a id="property-lastsyncedpath"></a> `lastSyncedPath` | `protected` | `string` | `""` | - | [router-bridge-base.ts:60](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L60) |
59
+ | <a id="property-routemap"></a> `routeMap` | `readonly` | `object` | `undefined` | Bidirectional route map for stateId ↔ path resolution | [router-bridge-base.ts:72](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L72) |
60
+ | `routeMap.getPathByStateId` | `public` | `string` \| `null` \| `undefined` | `undefined` | - | [router-bridge-base.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L74) |
61
+ | `routeMap.getStateIdByPath` | `public` | `string` \| `null` \| `undefined` | `undefined` | - | [router-bridge-base.ts:73](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L73) |
62
+ | <a id="property-routewatcher"></a> `routeWatcher` | `protected` | \| [`Watcher`](../../play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md) \| `null` | `null` | - | [router-bridge-base.ts:62](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L62) |
63
+
64
+ ## Methods
65
+
66
+ ### connect()
67
+
68
+ ```ts
69
+ connect(): void;
70
+ ```
71
+
72
+ Defined in: [router-bridge-base.ts:90](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L90)
73
+
74
+ Connect the router bridge to the Actor.
75
+
76
+ Sets up the TC39 Signal watcher for actor → router direction and
77
+ starts watching router changes (framework-specific).
78
+
79
+ #### Returns
80
+
81
+ `void`
82
+
83
+ #### Implementation of
84
+
85
+ [`RouterBridge`](../interfaces/RouterBridge.md).[`connect`](../interfaces/RouterBridge.md#connect)
86
+
87
+ ---
88
+
89
+ ### disconnect()
90
+
91
+ ```ts
92
+ disconnect(): void;
93
+ ```
94
+
95
+ Defined in: [router-bridge-base.ts:140](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L140)
96
+
97
+ Disconnect the router bridge from the Actor.
98
+
99
+ Stops signal watching and unregisters framework-specific router listener.
100
+
101
+ #### Returns
102
+
103
+ `void`
104
+
105
+ #### Implementation of
106
+
107
+ [`RouterBridge`](../interfaces/RouterBridge.md).[`disconnect`](../interfaces/RouterBridge.md#disconnect)
108
+
109
+ ---
110
+
111
+ ### extractParams()
112
+
113
+ ```ts
114
+ protected extractParams(pathname, stateId): Record<string, string>;
115
+ ```
116
+
117
+ Defined in: [router-bridge-base.ts:276](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L276)
118
+
119
+ Extract path parameters from URL using the URLPattern API.
120
+
121
+ Accesses `globalThis.URLPattern` at runtime — no polyfill is imported by this
122
+ library. If `URLPattern` is unavailable (Node.js < 24, older browsers without a
123
+ polyfill), this method returns `{}` silently (graceful degradation — routing still
124
+ works, params will be empty).
125
+
126
+ #### Parameters
127
+
128
+ | Parameter | Type | Description |
129
+ | ---------- | -------- | ------------------------------------------------- |
130
+ | `pathname` | `string` | The actual URL path (e.g., '/profile/john') |
131
+ | `stateId` | `string` | The matched state ID for looking up route pattern |
132
+
133
+ #### Returns
134
+
135
+ `Record`\<`string`, `string`\>
136
+
137
+ Extracted path parameters, or empty object if URLPattern is unavailable or no match
138
+
139
+ ---
140
+
141
+ ### extractQuery()
142
+
143
+ ```ts
144
+ protected extractQuery(search): Record<string, string>;
145
+ ```
146
+
147
+ Defined in: [router-bridge-base.ts:303](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L303)
148
+
149
+ Extract query parameters from URL search string.
150
+
151
+ #### Parameters
152
+
153
+ | Parameter | Type | Description |
154
+ | --------- | -------- | ------------------------------------------------ |
155
+ | `search` | `string` | URL search string (e.g., '?tab=security&page=1') |
156
+
157
+ #### Returns
158
+
159
+ `Record`\<`string`, `string`\>
160
+
161
+ Extracted query parameters or empty object
162
+
163
+ ---
164
+
165
+ ### getInitialRouterPath()
166
+
167
+ ```ts
168
+ protected getInitialRouterPath(): string | null;
169
+ ```
170
+
171
+ Defined in: [router-bridge-base.ts:353](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L353)
172
+
173
+ Return the router's current pathname at connect() time, or null if unavailable.
174
+
175
+ Called once during connect() to perform the initial URL → actor sync.
176
+ router.subscribe() only fires on _future_ navigation events; it does not
177
+ replay the already-loaded location. Subclasses that can read the router's
178
+ current location synchronously (e.g. `router.state.location.pathname`)
179
+ should override this method so that deep-link / direct-URL loads drive the
180
+ actor to the correct state instead of leaving it at its machine default.
181
+
182
+ The default returns null (no initial router → actor sync), preserving the
183
+ previous behaviour for bridges that have not yet implemented this hook.
184
+
185
+ #### Returns
186
+
187
+ `string` \| `null`
188
+
189
+ ---
190
+
191
+ ### navigateRouter()
192
+
193
+ ```ts
194
+ abstract protected navigateRouter(path): void;
195
+ ```
196
+
197
+ Defined in: [router-bridge-base.ts:323](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L323)
198
+
199
+ Navigate the framework router to the given path.
200
+
201
+ Called when actor's currentRoute signal changes to a new path.
202
+ Must trigger the framework router's navigation (e.g., router.navigate(path)).
203
+
204
+ #### Parameters
205
+
206
+ | Parameter | Type |
207
+ | --------- | -------- |
208
+ | `path` | `string` |
209
+
210
+ #### Returns
211
+
212
+ `void`
213
+
214
+ ---
215
+
216
+ ### syncActorFromRouter()
217
+
218
+ ```ts
219
+ protected syncActorFromRouter(pathname, search?): void;
220
+ ```
221
+
222
+ Defined in: [router-bridge-base.ts:187](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L187)
223
+
224
+ Sync actor state when router location changes.
225
+
226
+ Sends play.route event to actor with resolved stateId, params, and query.
227
+ Prevents circular updates via isProcessingNavigation flag.
228
+
229
+ #### Parameters
230
+
231
+ | Parameter | Type |
232
+ | ---------- | -------- |
233
+ | `pathname` | `string` |
234
+ | `search?` | `string` |
235
+
236
+ #### Returns
237
+
238
+ `void`
239
+
240
+ ---
241
+
242
+ ### syncRouterFromActor()
243
+
244
+ ```ts
245
+ protected syncRouterFromActor(route): void;
246
+ ```
247
+
248
+ Defined in: [router-bridge-base.ts:167](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L167)
249
+
250
+ Sync router location when actor route signal changes.
251
+
252
+ Calls navigateRouter() for framework-specific navigation.
253
+ Prevents circular updates via isProcessingNavigation flag.
254
+
255
+ #### Parameters
256
+
257
+ | Parameter | Type |
258
+ | --------- | --------- |
259
+ | `route` | `unknown` |
260
+
261
+ #### Returns
262
+
263
+ `void`
264
+
265
+ ---
266
+
267
+ ### unwatchRouterChanges()
268
+
269
+ ```ts
270
+ abstract protected unwatchRouterChanges(): void;
271
+ ```
272
+
273
+ Defined in: [router-bridge-base.ts:338](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L338)
274
+
275
+ Stop watching for router location changes.
276
+
277
+ Called by disconnect(). Should clean up the framework-specific subscription.
278
+
279
+ #### Returns
280
+
281
+ `void`
282
+
283
+ ---
284
+
285
+ ### watchRouterChanges()
286
+
287
+ ```ts
288
+ abstract protected watchRouterChanges(): void;
289
+ ```
290
+
291
+ Defined in: [router-bridge-base.ts:331](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/router-bridge-base.ts#L331)
292
+
293
+ Start watching for router location changes.
294
+
295
+ Called by connect(). Should set up the framework-specific subscription
296
+ for location changes and call syncActorFromRouter() on each change.
297
+
298
+ #### Returns
299
+
300
+ `void`
@@ -0,0 +1,27 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / buildRouteTree
2
+
3
+ # Function: buildRouteTree()
4
+
5
+ ```ts
6
+ function buildRouteTree(routes): RouteTree;
7
+ ```
8
+
9
+ Defined in: [build-tree.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/build-tree.ts#L13)
10
+
11
+ Build hierarchical route tree from flat route list
12
+
13
+ Constructs nested tree respecting parent-child state relationships.
14
+ Absolute routes become top-level, relative routes nest under parents.
15
+ Creates bidirectional maps for state ID ↔ path lookup.
16
+
17
+ ## Parameters
18
+
19
+ | Parameter | Type | Description |
20
+ | --------- | ------------------------------------------- | -------------------------------------- |
21
+ | `routes` | [`RouteInfo`](../interfaces/RouteInfo.md)[] | Flat list of RouteInfo from extraction |
22
+
23
+ ## Returns
24
+
25
+ [`RouteTree`](../interfaces/RouteTree.md)
26
+
27
+ RouteTree with root, byStateId map, and byPath map
@@ -0,0 +1,67 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / connectRouter
2
+
3
+ # Function: connectRouter()
4
+
5
+ ```ts
6
+ function connectRouter(options): () => void;
7
+ ```
8
+
9
+ Defined in: [connect-router.ts:58](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/connect-router.ts#L58)
10
+
11
+ Connect vanilla router to actor (pure browser integration).
12
+
13
+ This is the LOW-LEVEL API for maximum control. No JSX, no rendering,
14
+ just actor ↔ router synchronization.
15
+
16
+ Use this when:
17
+
18
+ - You want manual control over rendering
19
+ - Using non-JSX framework (jQuery, Alpine, HTMX, etc.)
20
+ - Building custom integration
21
+
22
+ For JSX frameworks, use framework adapters instead:
23
+
24
+ - @xmachines/play-react (React components)
25
+ - Future: @xmachines/play-preact, @xmachines/play-solid, @xmachines/play-vue
26
+
27
+ Architecture:
28
+
29
+ - Subscribes to history changes → sends play.route to actor
30
+ - Watches actor.currentRoute signal → updates browser URL
31
+ - Prevents circular updates (history change triggers actor, actor triggers history)
32
+ - Returns cleanup function
33
+
34
+ Usage:
35
+
36
+ ```typescript
37
+ import { createBrowserHistory, createRouter, connectRouter } from "@xmachines/play-router";
38
+
39
+ const history = createBrowserHistory({ window });
40
+ const router = createRouter({ routeTree, history });
41
+
42
+ // Connect router to actor
43
+ const disconnect = connectRouter({ actor, router, routeMap });
44
+
45
+ // User handles rendering (vanilla JS)
46
+ const watcher = new Signal.subtle.Watcher(() => {
47
+ queueMicrotask(() => {
48
+ const view = actor.currentView.get();
49
+ document.getElementById("app").innerHTML = render(view);
50
+ });
51
+ });
52
+ watcher.watch(actor.currentView);
53
+
54
+ // Later: cleanup
55
+ disconnect();
56
+ watcher.unwatch(actor.currentView);
57
+ ```
58
+
59
+ ## Parameters
60
+
61
+ | Parameter | Type |
62
+ | --------- | --------------------------------------------------------------- |
63
+ | `options` | [`ConnectRouterOptions`](../interfaces/ConnectRouterOptions.md) |
64
+
65
+ ## Returns
66
+
67
+ () => `void`
@@ -0,0 +1,92 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / crawlMachine
2
+
3
+ # Function: crawlMachine()
4
+
5
+ ```ts
6
+ function crawlMachine(machine): StateVisit[];
7
+ ```
8
+
9
+ Defined in: [crawl-machine.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/crawl-machine.ts#L74)
10
+
11
+ Crawl state machine graph using breadth-first traversal
12
+
13
+ Visits all state nodes in the machine, including deeply nested states, and returns
14
+ complete list of visits with path and parent information. This enables systematic
15
+ discovery of all states for route extraction and tree building.
16
+
17
+ **Architectural Context:** Implements **Actor Authority (INV-01)** by extracting
18
+ routing information from the state machine definition rather than external configuration.
19
+ The BFS traversal ensures all nested states are discovered, enabling the Actor to
20
+ define the complete navigation structure through its machine definition.
21
+
22
+ ## Parameters
23
+
24
+ | Parameter | Type | Description |
25
+ | --------- | ----------------- | -------------------------------- |
26
+ | `machine` | `AnyStateMachine` | XState v5 state machine to crawl |
27
+
28
+ ## Returns
29
+
30
+ [`StateVisit`](../interfaces/StateVisit.md)[]
31
+
32
+ Array of state visits in breadth-first order
33
+
34
+ ## Examples
35
+
36
+ Basic machine crawl
37
+
38
+ ```typescript
39
+ import { createMachine } from "xstate";
40
+ import { crawlMachine } from "@xmachines/play-router";
41
+
42
+ const machine = createMachine({
43
+ initial: "home",
44
+ states: {
45
+ home: {},
46
+ dashboard: {
47
+ initial: "overview",
48
+ states: {
49
+ overview: {},
50
+ settings: {},
51
+ },
52
+ },
53
+ },
54
+ });
55
+
56
+ const visits = crawlMachine(machine);
57
+ // Returns visits for: root, home, dashboard, dashboard.overview, dashboard.settings
58
+ console.log(visits.map((v) => v.path.join(".")));
59
+ // ['', 'home', 'dashboard', 'dashboard.overview', 'dashboard.settings']
60
+ ```
61
+
62
+ Extract state paths and parents
63
+
64
+ ```typescript
65
+ import { crawlMachine } from "@xmachines/play-router";
66
+
67
+ const visits = crawlMachine(machine);
68
+ visits.forEach((visit) => {
69
+ console.log({
70
+ path: visit.path.join(".") || "root",
71
+ hasParent: !!visit.parent,
72
+ hasChildren: Object.keys(visit.node.states).length > 0,
73
+ });
74
+ });
75
+ ```
76
+
77
+ ## See
78
+
79
+ - [RFC Play v1](https://gitlab.com/xmachin-es/rfc/-/blob/main/src/play-v1.md)
80
+ - [extractRoute](extractRoute.md) for extracting route from individual states
81
+ - [extractMachineRoutes](extractMachineRoutes.md) for complete route extraction
82
+ - [StateVisit](../interfaces/StateVisit.md) for visit structure
83
+
84
+ ## Remarks
85
+
86
+ **BFS Traversal:** Breadth-first search ensures systematic discovery of all states
87
+ at each nesting level before descending deeper. This produces a predictable ordering
88
+ useful for route tree construction and debugging.
89
+
90
+ **Path Format:** Paths use array notation (`['dashboard', 'settings']`) which can be
91
+ joined with dots for state IDs (`'dashboard.settings'`) matching XState's hierarchical
92
+ state naming convention.
@@ -0,0 +1,47 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / createBrowserHistory
2
+
3
+ # Function: createBrowserHistory()
4
+
5
+ ```ts
6
+ function createBrowserHistory(options): BrowserHistory;
7
+ ```
8
+
9
+ Defined in: [create-browser-history.ts:99](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L99)
10
+
11
+ Create browser history that wraps window.history
12
+
13
+ Aligned with TanStack Router's history interface for API parallelism.
14
+
15
+ Architecture:
16
+
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)
21
+
22
+ Usage:
23
+
24
+ ```typescript
25
+ const history = createBrowserHistory({ window });
26
+
27
+ const unsubscribe = history.subscribe((location) => {
28
+ console.log("URL changed:", location.pathname);
29
+ });
30
+
31
+ history.push("/new-path");
32
+
33
+ // Later:
34
+ unsubscribe();
35
+ history.destroy();
36
+ ```
37
+
38
+ ## Parameters
39
+
40
+ | Parameter | Type |
41
+ | ---------------- | ------------------------------------------------------------------ |
42
+ | `options` | \{ `window`: [`BrowserWindow`](../interfaces/BrowserWindow.md); \} |
43
+ | `options.window` | [`BrowserWindow`](../interfaces/BrowserWindow.md) |
44
+
45
+ ## Returns
46
+
47
+ [`BrowserHistory`](../interfaces/BrowserHistory.md)
@@ -0,0 +1,53 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / createRouteMap
2
+
3
+ # Function: createRouteMap()
4
+
5
+ ```ts
6
+ function createRouteMap(routeTree): RouteMap;
7
+ ```
8
+
9
+ Defined in: [create-route-map.ts:120](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-route-map.ts#L120)
10
+
11
+ Create a RouteMap from a RouteTree for efficient path lookups.
12
+
13
+ Architecture:
14
+
15
+ - Pure function - no side effects
16
+ - O(1) lookups for exact matches via Map
17
+ - O(k) bucket-indexed pattern matching with URLPattern, where k = routes in the
18
+ first-segment bucket (typically << total routes)
19
+ - Returns formatted state IDs (with # prefix)
20
+ - Extracts params from matched patterns
21
+
22
+ **URLPattern requirement:** Dynamic route pattern matching requires `URLPattern`
23
+ to be available on `globalThis`. On Node.js < 24 and older browsers, load a polyfill
24
+ before calling this function:
25
+
26
+ ```typescript
27
+ import "urlpattern-polyfill"; // before importing @xmachines/play-router
28
+ ```
29
+
30
+ If `URLPattern` is unavailable, parameterized routes will not match and a
31
+ `console.warn` is emitted. Static (exact) routes are unaffected.
32
+
33
+ Usage:
34
+
35
+ ```typescript
36
+ const routeTree = extractMachineRoutes(machine);
37
+ const routeMap = createRouteMap(routeTree);
38
+
39
+ const { to, params } = routeMap.resolve("/settings/account");
40
+ if (to) {
41
+ actor.send({ type: "play.route", to, params });
42
+ }
43
+ ```
44
+
45
+ ## Parameters
46
+
47
+ | Parameter | Type |
48
+ | ----------- | ----------------------------------------- |
49
+ | `routeTree` | [`RouteTree`](../interfaces/RouteTree.md) |
50
+
51
+ ## Returns
52
+
53
+ [`RouteMap`](../interfaces/RouteMap.md)
@@ -0,0 +1,76 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / createRouter
2
+
3
+ # Function: createRouter()
4
+
5
+ ```ts
6
+ function createRouter(options): VanillaRouter;
7
+ ```
8
+
9
+ Defined in: [create-router.ts:73](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-router.ts#L73)
10
+
11
+ Create vanilla router for framework-agnostic routing.
12
+
13
+ Architecture:
14
+
15
+ - Just wraps history and routeTree
16
+ - Does NOT embed routeMap (providers need it as prop)
17
+ - Framework-agnostic history management only
18
+
19
+ Why no routeMap:
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
24
+
25
+ Usage (parallel to TanStack mode):
26
+
27
+ ```typescript
28
+ // Both modes: identical setup
29
+ const routeTree = extractMachineRoutes(machine);
30
+ const routeMap = createRouteMap(routeTree);
31
+ const history = createBrowserHistory({ window });
32
+
33
+ // Vanilla router
34
+ const router = createRouter({ routeTree, history });
35
+
36
+ // Provider needs routeMap as prop (router doesn't have it)
37
+ <PlayRouterProvider
38
+ actor={actor}
39
+ router={router}
40
+ routeMap={routeMap} // ← Must pass separately
41
+ renderer={(currentActor, currentRouter) => {
42
+ void currentRouter;
43
+ return <Renderer actor={currentActor} components={components} />;
44
+ }}
45
+ />
46
+ ```
47
+
48
+ Compare to TanStack mode:
49
+
50
+ ```typescript
51
+ // TanStack router (external library)
52
+ const router = TanStackCreateRouter({ routeTree, history });
53
+
54
+ // Provider needs routeMap as prop (same as vanilla!)
55
+ <PlayRouterProvider
56
+ actor={actor}
57
+ router={router}
58
+ routeMap={routeMap} // ← Must pass separately
59
+ renderer={(currentActor, currentRouter) => {
60
+ void currentRouter;
61
+ return <Renderer actor={currentActor} components={components} />;
62
+ }}
63
+ />
64
+ ```
65
+
66
+ ## Parameters
67
+
68
+ | Parameter | Type |
69
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
70
+ | `options` | \{ `history`: [`BrowserHistory`](../interfaces/BrowserHistory.md); `routeTree`: [`RouteTree`](../interfaces/RouteTree.md); \} |
71
+ | `options.history` | [`BrowserHistory`](../interfaces/BrowserHistory.md) |
72
+ | `options.routeTree` | [`RouteTree`](../interfaces/RouteTree.md) |
73
+
74
+ ## Returns
75
+
76
+ [`VanillaRouter`](../interfaces/VanillaRouter.md)