@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,137 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-react-router](../README.md) / RouteMap
2
+
3
+ # Class: RouteMap
4
+
5
+ Defined in: [play-react-router/src/route-map.ts:54](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/route-map.ts#L54)
6
+
7
+ Bidirectional route mapper for React Router.
8
+
9
+ Extends [BaseRouteMap](../../play-router/classes/BaseRouteMap.md) — all matching logic lives there.
10
+ This class exists to provide a React Router-specific type name and to allow
11
+ future adapter-specific extensions without breaking the shared base.
12
+
13
+ **Inherited API:**
14
+
15
+ - `getStateIdByPath(path): string | null` — path → state ID
16
+ - `getPathByStateId(stateId): string | null` — state ID → path pattern
17
+
18
+ ## Example
19
+
20
+ ```typescript
21
+ const routeMap = new RouteMap([
22
+ { stateId: "home", path: "/" },
23
+ { stateId: "profile", path: "/profile/:userId" },
24
+ { stateId: "settings", path: "/settings/:section?" },
25
+ ]);
26
+
27
+ routeMap.getStateIdByPath("/profile/123"); // "profile"
28
+ routeMap.getPathByStateId("home"); // "/"
29
+ ```
30
+
31
+ ## Extends
32
+
33
+ - [`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md)
34
+
35
+ ## Constructors
36
+
37
+ ### Constructor
38
+
39
+ ```ts
40
+ new RouteMap(mappings): RouteMap;
41
+ ```
42
+
43
+ Defined in: play-router/dist/base-route-map.d.ts:81
44
+
45
+ Build a route map from an array of state ID ↔ path mappings.
46
+
47
+ Static paths (no `:param`) are indexed in an O(1) `Map`.
48
+ Parameterized paths are compiled to `RegExp` and grouped into first-segment
49
+ buckets for efficient candidate selection.
50
+
51
+ #### Parameters
52
+
53
+ | Parameter | Type | Description |
54
+ | ---------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- |
55
+ | `mappings` | [`BaseRouteMapping`](../../play-router/interfaces/BaseRouteMapping.md)[] | Array of `{ stateId, path }` entries. Order determines priority when multiple patterns could match the same path. |
56
+
57
+ #### Returns
58
+
59
+ `RouteMap`
60
+
61
+ #### Inherited from
62
+
63
+ [`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`constructor`](../../play-router/classes/BaseRouteMap.md#constructor)
64
+
65
+ ## Methods
66
+
67
+ ### getPathByStateId()
68
+
69
+ ```ts
70
+ getPathByStateId(stateId): string | null;
71
+ ```
72
+
73
+ Defined in: play-router/dist/base-route-map.d.ts:111
74
+
75
+ Look up the path pattern registered for a state ID.
76
+
77
+ #### Parameters
78
+
79
+ | Parameter | Type | Description |
80
+ | --------- | -------- | --------------------------------------------------------- |
81
+ | `stateId` | `string` | State machine state ID (e.g., `"profile"`, `"#settings"`) |
82
+
83
+ #### Returns
84
+
85
+ `string` \| `null`
86
+
87
+ The registered path pattern, or `null` if the state ID is unknown
88
+
89
+ #### Example
90
+
91
+ ```typescript
92
+ map.getPathByStateId("profile"); // "/profile/:userId"
93
+ map.getPathByStateId("missing"); // null
94
+ ```
95
+
96
+ #### Inherited from
97
+
98
+ [`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`getPathByStateId`](../../play-router/classes/BaseRouteMap.md#getpathbystateid)
99
+
100
+ ---
101
+
102
+ ### getStateIdByPath()
103
+
104
+ ```ts
105
+ getStateIdByPath(path): string | null;
106
+ ```
107
+
108
+ Defined in: play-router/dist/base-route-map.d.ts:98
109
+
110
+ Resolve a URL path to its mapped state ID.
111
+
112
+ Strips query strings and hash fragments before matching. Tries an O(1) exact
113
+ lookup first, then falls back to bucket-indexed pattern matching. Results are
114
+ cached after the first pattern match.
115
+
116
+ #### Parameters
117
+
118
+ | Parameter | Type | Description |
119
+ | --------- | -------- | ------------------------------------------------------------------------------ |
120
+ | `path` | `string` | URL pathname, optionally including query/hash (e.g., `"/profile/123?ref=nav"`) |
121
+
122
+ #### Returns
123
+
124
+ `string` \| `null`
125
+
126
+ The mapped state ID, or `null` if no route matches
127
+
128
+ #### Example
129
+
130
+ ```typescript
131
+ map.getStateIdByPath("/profile/123"); // "profile"
132
+ map.getStateIdByPath("/unknown"); // null
133
+ ```
134
+
135
+ #### Inherited from
136
+
137
+ [`BaseRouteMap`](../../play-router/classes/BaseRouteMap.md).[`getStateIdByPath`](../../play-router/classes/BaseRouteMap.md#getstateidbypath)
@@ -0,0 +1,19 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-react-router](../README.md) / PlayRouterProvider
2
+
3
+ # Function: PlayRouterProvider()
4
+
5
+ ```ts
6
+ function PlayRouterProvider(__namedParameters): Element;
7
+ ```
8
+
9
+ Defined in: [play-react-router/src/play-router-provider.tsx:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/play-router-provider.tsx#L20)
10
+
11
+ ## Parameters
12
+
13
+ | Parameter | Type |
14
+ | ------------------- | --------------------------------------------------------------------- |
15
+ | `__namedParameters` | [`PlayRouterProviderProps`](../interfaces/PlayRouterProviderProps.md) |
16
+
17
+ ## Returns
18
+
19
+ `Element`
@@ -0,0 +1,35 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-react-router](../README.md) / createRouteMapFromTree
2
+
3
+ # Function: createRouteMapFromTree()
4
+
5
+ ```ts
6
+ function createRouteMapFromTree(routeTree): RouteMap;
7
+ ```
8
+
9
+ Defined in: [play-react-router/src/route-map.ts:73](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/route-map.ts#L73)
10
+
11
+ Create RouteMap from RouteTree
12
+
13
+ Converts XMachines route tree to RouteMap for use with router adapters.
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | ----------- | -------------------------------------------------------- | -------------------------------------- |
19
+ | `routeTree` | [`RouteTree`](../../play-router/interfaces/RouteTree.md) | Route tree from extractMachineRoutes() |
20
+
21
+ ## Returns
22
+
23
+ [`RouteMap`](../classes/RouteMap.md)
24
+
25
+ RouteMap instance
26
+
27
+ ## Example
28
+
29
+ ```typescript
30
+ import { extractMachineRoutes } from "@xmachines/play-router";
31
+ import { createRouteMapFromTree } from "@xmachines/play-react-router";
32
+
33
+ const routeTree = extractMachineRoutes(machine);
34
+ const routeMap = createRouteMapFromTree(routeTree);
35
+ ```
@@ -0,0 +1,119 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-react-router](../README.md) / PlayRouteEvent
2
+
3
+ # Interface: PlayRouteEvent
4
+
5
+ Defined in: play-router/dist/types.d.ts:182
6
+
7
+ Enhanced routing event with parameter and query support
8
+
9
+ Unified routing event used throughout the Play architecture. Supports parameter-aware
10
+ navigation patterns (e.g., `/profile/:userId`) for dynamic route segments.
11
+
12
+ **Architectural Context:** Implements **Passive Infrastructure (INV-04)** by representing
13
+ user navigation intent that the Actor evaluates through guards. Infrastructure proposes
14
+ via `play.route` events, Actor decides via state machine transitions.
15
+
16
+ **Browser Navigation Flow:**
17
+
18
+ 1. Browser fires `popstate`
19
+ 2. Router adapter resolves URL to route target
20
+ 3. Adapter sends `PlayRouteEvent` to Actor
21
+ 4. Actor validates transition via state machine guards
22
+
23
+ ## Param
24
+
25
+ Event discriminator (always "play.route")
26
+
27
+ ## Param
28
+
29
+ Target state ID with # prefix (e.g., '#home', '#profile')
30
+
31
+ ## Param
32
+
33
+ Merged path + query parameters (path parameters win conflicts)
34
+
35
+ ## Param
36
+
37
+ Query parameters only (isolated from path params)
38
+
39
+ ## Param
40
+
41
+ Full URLPattern match result for debugging/observability (optional)
42
+
43
+ ## Examples
44
+
45
+ Combining base and routing events
46
+
47
+ ```typescript
48
+ import type { PlayEvent } from "@xmachines/play";
49
+ import type { PlayRouteEvent } from "@xmachines/play-router";
50
+
51
+ type AppEvent = PlayEvent | PlayRouteEvent;
52
+ ```
53
+
54
+ Basic navigation to a route
55
+
56
+ ```typescript
57
+ import type { PlayRouteEvent } from "@xmachines/play-router";
58
+
59
+ const event: PlayRouteEvent = {
60
+ type: "play.route",
61
+ to: "#home",
62
+ };
63
+ actor.send(event);
64
+ ```
65
+
66
+ Navigation with route parameters
67
+
68
+ ```typescript
69
+ import type { PlayRouteEvent } from "@xmachines/play-router";
70
+
71
+ const event: PlayRouteEvent = {
72
+ type: "play.route",
73
+ to: "#profile",
74
+ params: { userId: "123" },
75
+ };
76
+ actor.send(event);
77
+ // Resolves to route: /profile/123
78
+ ```
79
+
80
+ Navigation with query parameters
81
+
82
+ ```typescript
83
+ import type { PlayRouteEvent } from "@xmachines/play-router";
84
+
85
+ const event: PlayRouteEvent = {
86
+ type: "play.route",
87
+ to: "#settings",
88
+ params: { section: "profile" }, // Merged: path + query
89
+ query: { tab: "security" }, // Query-only
90
+ };
91
+ actor.send(event);
92
+ // Resolves to route: /settings/profile?tab=security
93
+ ```
94
+
95
+ ## See
96
+
97
+ [RFC Play v1](https://gitlab.com/xmachin-es/rfc/-/blob/main/src/play-v1.md)
98
+
99
+ ## Remarks
100
+
101
+ Use `play.route` when you need parameter-aware navigation with the `route: {}`
102
+ config pattern on your state machine nodes. The `match` field exposes the full
103
+ URLPatternResult for advanced use cases (debugging, pattern analysis).
104
+
105
+ ## Indexable
106
+
107
+ ```ts
108
+ [key: string]: unknown
109
+ ```
110
+
111
+ ## Properties
112
+
113
+ | Property | Modifier | Type | Defined in |
114
+ | -------------------------------------- | ---------- | ------------------------------ | ------------------------------- |
115
+ | <a id="property-match"></a> `match?` | `readonly` | `unknown` | play-router/dist/types.d.ts:187 |
116
+ | <a id="property-params"></a> `params?` | `readonly` | `Record`\<`string`, `string`\> | play-router/dist/types.d.ts:185 |
117
+ | <a id="property-query"></a> `query?` | `readonly` | `Record`\<`string`, `string`\> | play-router/dist/types.d.ts:186 |
118
+ | <a id="property-to"></a> `to` | `readonly` | `string` | play-router/dist/types.d.ts:184 |
119
+ | <a id="property-type"></a> `type` | `readonly` | `"play.route"` | play-router/dist/types.d.ts:183 |
@@ -0,0 +1,14 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-react-router](../README.md) / PlayRouterProviderProps
2
+
3
+ # Interface: PlayRouterProviderProps
4
+
5
+ Defined in: [play-react-router/src/play-router-provider.tsx:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/play-router-provider.tsx#L10)
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) & [`Viewable`](../../play-actor/interfaces/Viewable.md) | [play-react-router/src/play-router-provider.tsx:11](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/play-router-provider.tsx#L11) |
12
+ | <a id="property-renderer"></a> `renderer` | (`actor`, `router`) => `ReactNode` | [play-react-router/src/play-router-provider.tsx:14](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/play-router-provider.tsx#L14) |
13
+ | <a id="property-routemap"></a> `routeMap` | [`RouteMap`](../classes/RouteMap.md) | [play-react-router/src/play-router-provider.tsx:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/play-router-provider.tsx#L13) |
14
+ | <a id="property-router"></a> `router` | `Router$1` | [play-react-router/src/play-router-provider.tsx:12](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/play-router-provider.tsx#L12) |
@@ -0,0 +1,17 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-react-router](../README.md) / RouteMapping
2
+
3
+ # Interface: RouteMapping
4
+
5
+ Defined in: [play-react-router/src/route-map.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/route-map.ts#L22)
6
+
7
+ Mapping between state machine state ID and router path.
8
+
9
+ Structurally compatible with `BaseRouteMapping` from `@xmachines/play-router`.
10
+ Fields are `readonly` — entries are immutable once passed to `RouteMap`.
11
+
12
+ ## Properties
13
+
14
+ | Property | Modifier | Type | Description | Defined in |
15
+ | --------------------------------------- | ---------- | -------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16
+ | <a id="property-path"></a> `path` | `readonly` | `string` | Router path with optional parameters (e.g., `"/settings/:section?"`) | [play-react-router/src/route-map.ts:26](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/route-map.ts#L26) |
17
+ | <a id="property-stateid"></a> `stateId` | `readonly` | `string` | State ID from state machine (e.g., `"home"`, `"settings.profile"`) | [play-react-router/src/route-map.ts:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-react-router/src/route-map.ts#L24) |
@@ -0,0 +1,104 @@
1
+ [Documentation](../../../README.md) / [@xmachines/play-react-router](../README.md) / RouterBridge
2
+
3
+ # Interface: RouterBridge
4
+
5
+ Defined in: play-router/dist/types.d.ts:229
6
+
7
+ RouterBridge interface for runtime infrastructure adapters
8
+
9
+ Defines the lifecycle connection between Infrastructure (e.g., TanStack Router) and
10
+ the Actor. Infrastructure "bridges" to the Actor by observing its signals and
11
+ managing its own lifecycle accordingly.
12
+
13
+ **Architectural Context:** Implements **Passive Infrastructure (INV-04)** by establishing
14
+ a unidirectional observation pattern. Infrastructure connects to observe Actor signals
15
+ (currentRoute, currentView, state) and reflects changes without making state decisions.
16
+
17
+ ## Example
18
+
19
+ TanStack Router bridge implementation
20
+
21
+ ```typescript
22
+ import type { RouterBridge } from "@xmachines/play-router";
23
+ import { Signal } from "@xmachines/play-signals";
24
+
25
+ class TanStackRouterBridge implements RouterBridge {
26
+ private watcher: Signal.Watcher | null = null;
27
+
28
+ async connect(): Promise<void> {
29
+ // Start observing actor.currentRoute signal
30
+ this.watcher = new Signal.subtle.Watcher(() => {
31
+ const route = actor.currentRoute.get();
32
+ if (route) router.navigate(route);
33
+ });
34
+ this.watcher.watch(actor.currentRoute);
35
+ }
36
+
37
+ async disconnect(): Promise<void> {
38
+ // Stop observing, cleanup watchers
39
+ this.watcher?.unwatch(actor.currentRoute);
40
+ this.watcher = null;
41
+ }
42
+ }
43
+ ```
44
+
45
+ ## See
46
+
47
+ [RFC Play v1 - Invariant INV-04](https://gitlab.com/xmachin-es/rfc/-/blob/main/src/play-v1.md)
48
+
49
+ ## Methods
50
+
51
+ ### connect()
52
+
53
+ ```ts
54
+ connect(): void | Promise<void>;
55
+ ```
56
+
57
+ Defined in: play-router/dist/types.d.ts:245
58
+
59
+ Connect the router bridge to the Actor
60
+
61
+ Called when Infrastructure should begin observing Actor signals and
62
+ synchronizing its state (e.g., browser URL) with Actor state.
63
+
64
+ #### Returns
65
+
66
+ `void` \| `Promise`\<`void`\>
67
+
68
+ Promise that resolves when connection is established, or void for synchronous connection
69
+
70
+ #### Example
71
+
72
+ ```typescript
73
+ const bridge: RouterBridge = createBridge(actor, router);
74
+ await bridge.connect();
75
+ // Bridge now observing actor.currentRoute signal
76
+ ```
77
+
78
+ ---
79
+
80
+ ### disconnect()
81
+
82
+ ```ts
83
+ disconnect(): void | Promise<void>;
84
+ ```
85
+
86
+ Defined in: play-router/dist/types.d.ts:260
87
+
88
+ Disconnect the router bridge from the Actor
89
+
90
+ Called when Infrastructure should stop observing and clean up resources
91
+ (e.g., signal watchers, event listeners).
92
+
93
+ #### Returns
94
+
95
+ `void` \| `Promise`\<`void`\>
96
+
97
+ Promise that resolves when disconnection is complete, or void for synchronous disconnection
98
+
99
+ #### Example
100
+
101
+ ```typescript
102
+ await bridge.disconnect();
103
+ // Bridge stopped observing, resources cleaned up
104
+ ```
@@ -0,0 +1,137 @@
1
+ [Documentation](../../README.md) / @xmachines/play-react-router-demo
2
+
3
+ # React Router Demo
4
+
5
+ React Router v7 integration demo for the XMachines Play architecture.
6
+
7
+ ## What This Demonstrates
8
+
9
+ - Shared auth machine reused without framework-specific business logic
10
+ - `PlayRouterProvider` renderer-based integration with React Router
11
+ - Shell-driven rendering via `PlayRenderer` with actor-authoritative navigation
12
+ - Canonical TC39 Signals lifecycle mapped to React's rendering loop
13
+ - Non-browser invariant tests plus browser E2E coverage
14
+
15
+ ## Running the Demo
16
+
17
+ From the repository root:
18
+
19
+ ```bash
20
+ npm install
21
+ npm run dev -w packages/play-react-router/examples/demo
22
+ ```
23
+
24
+ Then open `http://localhost:5173`.
25
+
26
+ ## Step-by-Step Code Flow
27
+
28
+ Use this order to understand the implementation:
29
+
30
+ 1. `src/main.tsx` mounts `<App />`.
31
+ 2. `src/App.tsx` creates/starts the actor from shared machine + catalog.
32
+ 3. Route metadata is extracted from the machine and converted into a route map.
33
+ 4. `PlayRouterProvider` wires `createBrowserRouter` and actor navigation in both directions.
34
+ 5. `Shell` (inside `App.tsx`) renders `PlayRenderer` and actor-driven navigation UI.
35
+ 6. Browser tests in `test/browser/` validate startup and auth navigation flow.
36
+
37
+ ```tsx
38
+ // src/main.tsx (shape)
39
+ createRoot(document.getElementById("root")!).render(
40
+ <StrictMode>
41
+ <App />
42
+ </StrictMode>,
43
+ );
44
+ ```
45
+
46
+ ```tsx
47
+ // src/App.tsx (shape)
48
+ const createPlayer = definePlayer({ machine: authMachine, catalog });
49
+ const actor = createPlayer();
50
+ actor.start();
51
+
52
+ const routeTree = extractMachineRoutes(authMachine);
53
+ const routeMap = createRouteMapFromTree(routeTree);
54
+
55
+ return (
56
+ <PlayRouterProvider
57
+ actor={actor}
58
+ router={router}
59
+ routeMap={routeMap}
60
+ renderer={(currentActor, currentRouter) => {
61
+ void currentActor;
62
+ return <RouterProvider router={currentRouter} />;
63
+ }}
64
+ />
65
+ );
66
+ ```
67
+
68
+ ```tsx
69
+ // src/components/Login.tsx (shape)
70
+ export function Login() {
71
+ return (
72
+ <button onClick={() => actor.send({ type: "auth.login", username, password })}>
73
+ Login
74
+ </button>
75
+ );
76
+ }
77
+ ```
78
+
79
+ ## Key Files
80
+
81
+ - `src/main.tsx` - React entry point that mounts `<App />`
82
+ - `src/App.tsx` - actor lifecycle, route extraction, provider wiring, and renderer composition
83
+ - `src/components/` - demo views bound to catalog component keys (Home, Login, Dashboard, Profile, etc.)
84
+ - `test/browser/startup.browser.test.tsx` - startup assertion for public home + login control
85
+ - `test/browser/auth-flow.browser.test.tsx` - end-to-end login -> dashboard -> profile -> logout flow
86
+
87
+ ## State Machine & Architecture Details
88
+
89
+ The demo utilizes XMachines architectural invariants:
90
+
91
+ 1. **Actor Authority:** Navigation triggers URL changes, which the `PlayRouterProvider` intercepts and converts into `play.route` events. The actor evaluates these events against its internal guards and transitions.
92
+ 2. **Passive Infrastructure:** The router does not execute business logic. The actor dictates whether navigation is permitted. The React application only triggers renders.
93
+ 3. **Signal-Only Reactivity:** The bridge leverages React's `useSyncExternalStore` (internally within the hooks) to react precisely when signals update, without polluting the React component tree with `useState` or `useEffect` for business logic.
94
+
95
+ ## Watcher Lifecycle and Cleanup Contract
96
+
97
+ This demo follows the same watcher lifecycle used across `@xmachines/play-signals` and framework adapters:
98
+
99
+ 1. `notify`
100
+ 2. `queueMicrotask`
101
+ 3. Drain pending work with `getPending()`
102
+ 4. Read actor signals and project framework-local state
103
+ 5. Re-arm via `watch()`/`watch(...signals)`
104
+
105
+ Watcher notifications are one-shot. Cleanup is explicit: bridge/provider teardown must call `disconnect`/`unwatch` paths, never rely on GC-only cleanup. The `PlayRouterProvider` handles this natively on component unmount.
106
+
107
+ ## Adapter Boundaries
108
+
109
+ `PlayRouterProvider` and the React Router bridge stay passive infrastructure. Business validity remains actor-owned, while `RouterBridgeBase` remains the shared policy layer and the concrete React adapter stays a thin port, delegating DOM synchronization to React Router.
110
+
111
+ ## Available Scripts
112
+
113
+ These commands are defined in `package.json`:
114
+
115
+ | Command | Description |
116
+ | ------------------------------------------------------------------ | -------------------------------- |
117
+ | `npm run dev -w packages/play-react-router/examples/demo` | Start Vite dev server |
118
+ | `npm run build -w packages/play-react-router/examples/demo` | Build production bundle |
119
+ | `npm run preview -w packages/play-react-router/examples/demo` | Preview built bundle |
120
+ | `npm run test -w packages/play-react-router/examples/demo` | Run Vitest test suite |
121
+ | `npm run test:browser -w packages/play-react-router/examples/demo` | Run browser-focused Vitest suite |
122
+
123
+ ## Verification
124
+
125
+ Use these checks to validate README claims against the current demo implementation:
126
+
127
+ ```bash
128
+ npm run test -w packages/play-react-router/examples/demo
129
+ npm run test:browser -w packages/play-react-router/examples/demo
130
+ ```
131
+
132
+ Expected result: tests pass for startup and auth-flow browser scenarios.
133
+
134
+ ## Learn More
135
+
136
+ - [React Router package README](../play-react-router/README.md)
137
+ - [React package README](../play-react/README.md)