@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,32 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / detectDuplicateRoutes
2
+
3
+ # Function: detectDuplicateRoutes()
4
+
5
+ ```ts
6
+ function detectDuplicateRoutes(routes): void;
7
+ ```
8
+
9
+ Defined in: [validate-routes.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/validate-routes.ts#L51)
10
+
11
+ Detect duplicate route paths
12
+
13
+ THROWS ERROR when multiple states share the same route path.
14
+
15
+ Rationale: URL-based routing requires one-to-one mapping between URLs and states.
16
+ Multiple states at the same path creates ambiguity for browser navigation (back button,
17
+ direct URL access). Use different paths for different states, or single state with
18
+ conditional rendering.
19
+
20
+ ## Parameters
21
+
22
+ | Parameter | Type | Description |
23
+ | --------- | ------------------------------------------- | ------------------------------------ |
24
+ | `routes` | [`RouteInfo`](../interfaces/RouteInfo.md)[] | Array of extracted RouteInfo objects |
25
+
26
+ ## Returns
27
+
28
+ `void`
29
+
30
+ ## Throws
31
+
32
+ If duplicate route paths are detected
@@ -0,0 +1,64 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / extractMachineRoutes
2
+
3
+ # Function: extractMachineRoutes()
4
+
5
+ ```ts
6
+ function extractMachineRoutes(machine): RouteTree;
7
+ ```
8
+
9
+ Defined in: [extract-routes.ts:45](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/extract-routes.ts#L45)
10
+
11
+ Extract complete route tree from state machine graph
12
+
13
+ Crawls machine starting from root, visits all state nodes (including nested
14
+ and parallel), extracts meta.route metadata, validates route references,
15
+ and builds hierarchical tree.
16
+
17
+ ## Parameters
18
+
19
+ | Parameter | Type | Description |
20
+ | --------- | ----------------- | ----------------------- |
21
+ | `machine` | `AnyStateMachine` | XState v5 state machine |
22
+
23
+ ## Returns
24
+
25
+ [`RouteTree`](../interfaces/RouteTree.md)
26
+
27
+ Route tree with root, byStateId map, and byPath map
28
+
29
+ ## Throws
30
+
31
+ If route references non-existent state
32
+
33
+ ## Throws
34
+
35
+ If route path is malformed (doesn't start with /)
36
+
37
+ ## Throws
38
+
39
+ If parallel states define conflicting routes
40
+
41
+ ## Example
42
+
43
+ ```typescript
44
+ import { createMachine } from "xstate";
45
+ import { extractMachineRoutes } from "@xmachines/play-router";
46
+
47
+ const machine = createMachine({
48
+ initial: "home",
49
+ states: {
50
+ home: { id: "home", meta: { route: "/" } },
51
+ dashboard: {
52
+ id: "dashboard",
53
+ meta: { route: "/dashboard" },
54
+ initial: "overview",
55
+ states: {
56
+ overview: { id: "overview", meta: { route: "/overview" } },
57
+ },
58
+ },
59
+ },
60
+ });
61
+
62
+ const tree = extractMachineRoutes(machine);
63
+ console.log(tree.byPath.get("/dashboard/overview"));
64
+ ```
@@ -0,0 +1,45 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / extractRoute
2
+
3
+ # Function: extractRoute()
4
+
5
+ ```ts
6
+ function extractRoute(node, path, stateMap): RouteInfo | null;
7
+ ```
8
+
9
+ Defined in: [extract-route.ts:26](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/extract-route.ts#L26)
10
+
11
+ Extract route information from state node with validation
12
+
13
+ States with meta.route are "routable" - they can receive play.route events
14
+ (when machine is wrapped with formatPlayRouteTransitions).
15
+
16
+ ## Parameters
17
+
18
+ | Parameter | Type | Description |
19
+ | ---------- | ----------------------------------------------------------------- | ------------------------------------------------- |
20
+ | `node` | `StateNode` | XState StateNode to extract route from |
21
+ | `path` | `string`[] | State path segments from root |
22
+ | `stateMap` | `Map`\<`string`, `StateNode`\<`MachineContext`, `EventObject`\>\> | Map of all state IDs to StateNodes for validation |
23
+
24
+ ## Returns
25
+
26
+ [`RouteInfo`](../interfaces/RouteInfo.md) \| `null`
27
+
28
+ RouteInfo if state has meta.route, null otherwise
29
+
30
+ ## Throws
31
+
32
+ If route path is malformed (missing leading /)
33
+
34
+ ## Throws
35
+
36
+ If route references non-existent state
37
+
38
+ ## Example
39
+
40
+ ```typescript
41
+ const node = {
42
+ id: "dashboard",
43
+ meta: { route: "/dashboard" },
44
+ };
45
+ ```
@@ -0,0 +1,37 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / findRouteById
2
+
3
+ # Function: findRouteById()
4
+
5
+ ```ts
6
+ function findRouteById(tree, id): RouteNode | undefined;
7
+ ```
8
+
9
+ Defined in: [index.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/index.ts#L65)
10
+
11
+ Find route node by state ID
12
+
13
+ Looks up route node using the state's ID property. Used to get URL path
14
+ from state ID for browser URL sync after play.route transitions.
15
+
16
+ ## Parameters
17
+
18
+ | Parameter | Type | Description |
19
+ | --------- | ----------------------------------------- | ------------------------------------------------ |
20
+ | `tree` | [`RouteTree`](../interfaces/RouteTree.md) | Route tree from extractMachineRoutes |
21
+ | `id` | `string` | State ID (e.g., 'dashboard', 'settings.profile') |
22
+
23
+ ## Returns
24
+
25
+ [`RouteNode`](../interfaces/RouteNode.md) \| `undefined`
26
+
27
+ Route node if found, undefined otherwise
28
+
29
+ ## Example
30
+
31
+ ```typescript
32
+ const tree = extractMachineRoutes(machine);
33
+ const node = findRouteById(tree, "dashboard");
34
+ if (node) {
35
+ console.log(node.fullPath); // '/dashboard'
36
+ }
37
+ ```
@@ -0,0 +1,39 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / findRouteByPath
2
+
3
+ # Function: findRouteByPath()
4
+
5
+ ```ts
6
+ function findRouteByPath(tree, path): RouteNode | undefined;
7
+ ```
8
+
9
+ Defined in: [index.ts:157](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/index.ts#L157)
10
+
11
+ Find route node by URL path
12
+
13
+ Looks up route node using the URL path. Used to get state ID from browser
14
+ URL for sending play.route events on navigation.
15
+
16
+ When multiple states share the same path (e.g., root and a state both at "/"),
17
+ prefers routable nodes (with meta.route) over non-routable nodes.
18
+
19
+ Supports pattern matching for dynamic routes (e.g., '/settings/:section?').
20
+
21
+ ## Parameters
22
+
23
+ | Parameter | Type | Description |
24
+ | --------- | ----------------------------------------- | -------------------------------------------------- |
25
+ | `tree` | [`RouteTree`](../interfaces/RouteTree.md) | Route tree from extractMachineRoutes |
26
+ | `path` | `string` | URL path (e.g., '/dashboard', '/settings/profile') |
27
+
28
+ ## Returns
29
+
30
+ [`RouteNode`](../interfaces/RouteNode.md) \| `undefined`
31
+
32
+ Route node if found, undefined otherwise
33
+
34
+ ## Example
35
+
36
+ ```typescript
37
+ const tree = extractMachineRoutes(machine);
38
+ const node = findRouteByPath(tree, "/dashboard");
39
+ ```
@@ -0,0 +1,35 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / getNavigableRoutes
2
+
3
+ # Function: getNavigableRoutes()
4
+
5
+ ```ts
6
+ function getNavigableRoutes(tree, stateId): RouteNode[];
7
+ ```
8
+
9
+ Defined in: [query.ts:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/query.ts#L20)
10
+
11
+ Get all routes navigable from given state
12
+
13
+ Returns child routes of the specified state. Future enhancement will
14
+ include sibling routes reachable via transitions.
15
+
16
+ ## Parameters
17
+
18
+ | Parameter | Type | Description |
19
+ | --------- | ----------------------------------------- | -------------------------------------- |
20
+ | `tree` | [`RouteTree`](../interfaces/RouteTree.md) | Route tree from extractMachineRoutes() |
21
+ | `stateId` | `string` | Current state ID |
22
+
23
+ ## Returns
24
+
25
+ [`RouteNode`](../interfaces/RouteNode.md)[]
26
+
27
+ Array of route nodes reachable from state
28
+
29
+ ## Example
30
+
31
+ ```typescript
32
+ const tree = extractMachineRoutes(machine);
33
+ const routes = getNavigableRoutes(tree, "dashboard");
34
+ // [{ id: 'overview', path: '/overview', ... }, { id: 'settings', ... }]
35
+ ```
@@ -0,0 +1,39 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / getRoutableRoutes
2
+
3
+ # Function: getRoutableRoutes()
4
+
5
+ ```ts
6
+ function getRoutableRoutes(tree): RouteNode[];
7
+ ```
8
+
9
+ Defined in: [query.ts:50](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/query.ts#L50)
10
+
11
+ Get all routable routes from tree as flat array
12
+
13
+ Returns all routes that have meta.route defined, excluding non-routable
14
+ states and the synthetic root node. Useful for dynamically generating
15
+ router configurations in framework adapters.
16
+
17
+ ## Parameters
18
+
19
+ | Parameter | Type | Description |
20
+ | --------- | ----------------------------------------- | -------------------------------------- |
21
+ | `tree` | [`RouteTree`](../interfaces/RouteTree.md) | Route tree from extractMachineRoutes() |
22
+
23
+ ## Returns
24
+
25
+ [`RouteNode`](../interfaces/RouteNode.md)[]
26
+
27
+ Array of routable route nodes with path and stateId
28
+
29
+ ## Example
30
+
31
+ ```typescript
32
+ const tree = extractMachineRoutes(machine);
33
+ const routes = getRoutableRoutes(tree);
34
+ // [
35
+ // { path: '/', stateId: '#home', ... },
36
+ // { path: '/about', stateId: '#about', ... },
37
+ // { path: '/profile/:userId', stateId: '#profile', ... }
38
+ // ]
39
+ ```
@@ -0,0 +1,26 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / routeExists
2
+
3
+ # Function: routeExists()
4
+
5
+ ```ts
6
+ function routeExists(tree, path): boolean;
7
+ ```
8
+
9
+ Defined in: [query.ts:72](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/query.ts#L72)
10
+
11
+ Validate route path exists in tree
12
+
13
+ Checks if path has corresponding state with meta.route.
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --------- | ----------------------------------------- | --------------------------------------------- |
19
+ | `tree` | [`RouteTree`](../interfaces/RouteTree.md) | Route tree from extractMachineRoutes() |
20
+ | `path` | `string` | Full route path (e.g., '/dashboard/settings') |
21
+
22
+ ## Returns
23
+
24
+ `boolean`
25
+
26
+ true if path exists, false otherwise
@@ -0,0 +1,29 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / validateRouteFormat
2
+
3
+ # Function: validateRouteFormat()
4
+
5
+ ```ts
6
+ function validateRouteFormat(routePath, stateId): void;
7
+ ```
8
+
9
+ Defined in: [validate-routes.ts:14](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/validate-routes.ts#L14)
10
+
11
+ Validate route path format
12
+
13
+ Ensures route paths start with "/" (absolute or relative).
14
+ Per Route Protocol spec, all routes must have explicit path structure.
15
+
16
+ ## Parameters
17
+
18
+ | Parameter | Type | Description |
19
+ | ----------- | -------- | ----------------------------------- |
20
+ | `routePath` | `string` | Route path to validate |
21
+ | `stateId` | `string` | State identifier for error messages |
22
+
23
+ ## Returns
24
+
25
+ `void`
26
+
27
+ ## Throws
28
+
29
+ If route path doesn't start with /
@@ -0,0 +1,29 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / validateStateExists
2
+
3
+ # Function: validateStateExists()
4
+
5
+ ```ts
6
+ function validateStateExists(stateId, stateMap): void;
7
+ ```
8
+
9
+ Defined in: [validate-routes.ts:32](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/validate-routes.ts#L32)
10
+
11
+ Validate state exists in state map
12
+
13
+ Ensures referenced state IDs exist in the machine graph.
14
+ Build-time validation prevents broken route references.
15
+
16
+ ## Parameters
17
+
18
+ | Parameter | Type | Description |
19
+ | ---------- | ----------------------------------------------------------------- | ---------------------------------- |
20
+ | `stateId` | `string` | State identifier to validate |
21
+ | `stateMap` | `Map`\<`string`, `StateNode`\<`MachineContext`, `EventObject`\>\> | Map of all state IDs to StateNodes |
22
+
23
+ ## Returns
24
+
25
+ `void`
26
+
27
+ ## Throws
28
+
29
+ If state ID doesn't exist in map
@@ -0,0 +1,27 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / BaseRouteMapping
2
+
3
+ # Interface: BaseRouteMapping
4
+
5
+ Defined in: [base-route-map.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/base-route-map.ts#L28)
6
+
7
+ A single state ID ↔ path mapping entry.
8
+
9
+ Both fields are `readonly` — mappings are immutable once passed to `BaseRouteMap`.
10
+ Adapter packages re-export a structurally compatible `RouteMapping` type under
11
+ their own name. This type is published from `@xmachines/play-router` as
12
+ `BaseRouteMapping` to avoid name collisions with those adapter-local types.
13
+
14
+ ## Example
15
+
16
+ ```typescript
17
+ const mapping: BaseRouteMapping = { stateId: "home", path: "/" };
18
+ const paramMapping: BaseRouteMapping = { stateId: "profile", path: "/profile/:userId" };
19
+ const optionalMapping: BaseRouteMapping = { stateId: "settings", path: "/settings/:section?" };
20
+ ```
21
+
22
+ ## Properties
23
+
24
+ | Property | Modifier | Type | Description | Defined in |
25
+ | --------------------------------------- | ---------- | -------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
+ | <a id="property-path"></a> `path` | `readonly` | `string` | URL path pattern (e.g., `"/"`, `"/profile/:userId"`, `"/settings/:section?"`) | [base-route-map.ts:32](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/base-route-map.ts#L32) |
27
+ | <a id="property-stateid"></a> `stateId` | `readonly` | `string` | State machine state ID (e.g., `"home"`, `"#profile"`) | [base-route-map.ts:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/base-route-map.ts#L30) |
@@ -0,0 +1,172 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / BrowserHistory
2
+
3
+ # Interface: BrowserHistory
4
+
5
+ Defined in: [create-browser-history.ts:1](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L1)
6
+
7
+ ## Properties
8
+
9
+ | Property | Modifier | Type | Description | Defined in |
10
+ | ----------------------------------------- | ---------- | --------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | <a id="property-location"></a> `location` | `readonly` | `object` | Get current location state | [create-browser-history.ts:5](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L5) |
12
+ | `location.hash` | `public` | `string` | - | [create-browser-history.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L8) |
13
+ | `location.pathname` | `public` | `string` | - | [create-browser-history.ts:6](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L6) |
14
+ | `location.search` | `public` | `string` | - | [create-browser-history.ts:7](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L7) |
15
+ | `location.state` | `public` | `unknown` | - | [create-browser-history.ts:9](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L9) |
16
+
17
+ ## Methods
18
+
19
+ ### back()
20
+
21
+ ```ts
22
+ back(): void;
23
+ ```
24
+
25
+ Defined in: [create-browser-history.ts:26](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L26)
26
+
27
+ #### Returns
28
+
29
+ `void`
30
+
31
+ ---
32
+
33
+ ### createHref()
34
+
35
+ ```ts
36
+ createHref(path): string;
37
+ ```
38
+
39
+ Defined in: [create-browser-history.ts:38](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L38)
40
+
41
+ Create href from path
42
+
43
+ #### Parameters
44
+
45
+ | Parameter | Type |
46
+ | --------- | -------- |
47
+ | `path` | `string` |
48
+
49
+ #### Returns
50
+
51
+ `string`
52
+
53
+ ---
54
+
55
+ ### destroy()
56
+
57
+ ```ts
58
+ destroy(): void;
59
+ ```
60
+
61
+ Defined in: [create-browser-history.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L43)
62
+
63
+ Cleanup
64
+
65
+ #### Returns
66
+
67
+ `void`
68
+
69
+ ---
70
+
71
+ ### forward()
72
+
73
+ ```ts
74
+ forward(): void;
75
+ ```
76
+
77
+ Defined in: [create-browser-history.ts:27](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L27)
78
+
79
+ #### Returns
80
+
81
+ `void`
82
+
83
+ ---
84
+
85
+ ### go()
86
+
87
+ ```ts
88
+ go(delta): void;
89
+ ```
90
+
91
+ Defined in: [create-browser-history.ts:25](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L25)
92
+
93
+ Go back/forward
94
+
95
+ #### Parameters
96
+
97
+ | Parameter | Type |
98
+ | --------- | -------- |
99
+ | `delta` | `number` |
100
+
101
+ #### Returns
102
+
103
+ `void`
104
+
105
+ ---
106
+
107
+ ### push()
108
+
109
+ ```ts
110
+ push(path, state?): void;
111
+ ```
112
+
113
+ Defined in: [create-browser-history.ts:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L15)
114
+
115
+ Push new URL to history
116
+
117
+ #### Parameters
118
+
119
+ | Parameter | Type |
120
+ | --------- | --------- |
121
+ | `path` | `string` |
122
+ | `state?` | `unknown` |
123
+
124
+ #### Returns
125
+
126
+ `void`
127
+
128
+ ---
129
+
130
+ ### replace()
131
+
132
+ ```ts
133
+ replace(path, state?): void;
134
+ ```
135
+
136
+ Defined in: [create-browser-history.ts:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L20)
137
+
138
+ Replace current URL in history
139
+
140
+ #### Parameters
141
+
142
+ | Parameter | Type |
143
+ | --------- | --------- |
144
+ | `path` | `string` |
145
+ | `state?` | `unknown` |
146
+
147
+ #### Returns
148
+
149
+ `void`
150
+
151
+ ---
152
+
153
+ ### subscribe()
154
+
155
+ ```ts
156
+ subscribe(listener): () => void;
157
+ ```
158
+
159
+ Defined in: [create-browser-history.ts:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L33)
160
+
161
+ Subscribe to history changes
162
+ Returns unsubscribe function
163
+
164
+ #### Parameters
165
+
166
+ | Parameter | Type |
167
+ | ---------- | ---------------------- |
168
+ | `listener` | (`location`) => `void` |
169
+
170
+ #### Returns
171
+
172
+ () => `void`
@@ -0,0 +1,69 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / BrowserWindow
2
+
3
+ # Interface: BrowserWindow
4
+
5
+ Defined in: [create-browser-history.ts:55](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L55)
6
+
7
+ Minimal window interface for createBrowserHistory
8
+
9
+ Structural interface covering only the properties actually used.
10
+ Accepts Window, JSDOM window, or any compatible test double.
11
+ Avoids coupling to `Window & typeof globalThis` which varies across environments.
12
+
13
+ ## Properties
14
+
15
+ | Property | Modifier | Type | Defined in |
16
+ | ----------------------------------------- | ---------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | <a id="property-history"></a> `history` | `public` | `object` | [create-browser-history.ts:56](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L56) |
18
+ | `history.state` | `readonly` | `unknown` | [create-browser-history.ts:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L57) |
19
+ | `history.back` | `public` | `void` | [create-browser-history.ts:61](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L61) |
20
+ | `history.forward` | `public` | `void` | [create-browser-history.ts:62](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L62) |
21
+ | `history.go` | `public` | `void` | [create-browser-history.ts:60](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L60) |
22
+ | `history.pushState` | `public` | `void` | [create-browser-history.ts:58](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L58) |
23
+ | `history.replaceState` | `public` | `void` | [create-browser-history.ts:59](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L59) |
24
+ | <a id="property-location"></a> `location` | `public` | `object` | [create-browser-history.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L64) |
25
+ | `location.hash` | `readonly` | `string` | [create-browser-history.ts:67](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L67) |
26
+ | `location.pathname` | `readonly` | `string` | [create-browser-history.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L65) |
27
+ | `location.search` | `readonly` | `string` | [create-browser-history.ts:66](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L66) |
28
+
29
+ ## Methods
30
+
31
+ ### addEventListener()
32
+
33
+ ```ts
34
+ addEventListener(type, listener): void;
35
+ ```
36
+
37
+ Defined in: [create-browser-history.ts:69](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L69)
38
+
39
+ #### Parameters
40
+
41
+ | Parameter | Type |
42
+ | ---------- | ------------ |
43
+ | `type` | `"popstate"` |
44
+ | `listener` | () => `void` |
45
+
46
+ #### Returns
47
+
48
+ `void`
49
+
50
+ ---
51
+
52
+ ### removeEventListener()
53
+
54
+ ```ts
55
+ removeEventListener(type, listener): void;
56
+ ```
57
+
58
+ Defined in: [create-browser-history.ts:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/create-browser-history.ts#L70)
59
+
60
+ #### Parameters
61
+
62
+ | Parameter | Type |
63
+ | ---------- | ------------ |
64
+ | `type` | `"popstate"` |
65
+ | `listener` | () => `void` |
66
+
67
+ #### Returns
68
+
69
+ `void`
@@ -0,0 +1,13 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-router](../README.md) / ConnectRouterOptions
2
+
3
+ # Interface: ConnectRouterOptions
4
+
5
+ Defined in: [connect-router.ts:7](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/connect-router.ts#L7)
6
+
7
+ ## Properties
8
+
9
+ | Property | Type | Defined in |
10
+ | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`AnyActorLogic`\> & [`Routable`](../../play-actor/interfaces/Routable.md) | [connect-router.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/connect-router.ts#L8) |
12
+ | <a id="property-routemap"></a> `routeMap` | [`RouteMap`](RouteMap.md) | [connect-router.ts:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/connect-router.ts#L10) |
13
+ | <a id="property-router"></a> `router` | [`VanillaRouter`](VanillaRouter.md) | [connect-router.ts:9](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-router/src/connect-router.ts#L9) |