@xmachines/docs 2.0.0-alpha.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (388) hide show
  1. package/README.md +16 -17
  2. package/api/@xmachines/play/README.md +58 -66
  3. package/api/@xmachines/play/classes/NonNullableError.md +14 -14
  4. package/api/@xmachines/play/classes/PlayError.md +32 -34
  5. package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
  6. package/api/@xmachines/play/type-aliases/PlayEvent.md +28 -27
  7. package/api/@xmachines/play-actor/README.md +114 -50
  8. package/api/@xmachines/play-actor/classes/AbstractActor.md +45 -30
  9. package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
  10. package/api/@xmachines/play-actor/functions/composePlayState.md +27 -0
  11. package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +21 -0
  12. package/api/@xmachines/play-actor/functions/guardContextWrites.md +43 -0
  13. package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +28 -0
  14. package/api/@xmachines/play-actor/functions/reuseComposedState.md +42 -0
  15. package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +29 -0
  16. package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
  17. package/api/@xmachines/play-actor/functions/typedSpec.md +25 -27
  18. package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
  19. package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
  20. package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -15
  21. package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +11 -0
  22. package/api/@xmachines/play-actor/interfaces/Routable.md +6 -6
  23. package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +50 -0
  24. package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +15 -0
  25. package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
  26. package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +15 -0
  27. package/api/@xmachines/play-dom/README.md +123 -86
  28. package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
  29. package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
  30. package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
  31. package/api/@xmachines/play-dom/functions/createValidationRegistry.md +22 -0
  32. package/api/@xmachines/play-dom/functions/defineRegistry.md +5 -5
  33. package/api/@xmachines/play-dom/interfaces/ComponentContext.md +9 -8
  34. package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +16 -16
  35. package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +2 -0
  36. package/api/@xmachines/play-dom/interfaces/FieldValidationState.md +16 -0
  37. package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
  38. package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +17 -17
  39. package/api/@xmachines/play-dom/interfaces/RenderSpecOptions.md +2 -0
  40. package/api/@xmachines/play-dom/interfaces/ValidationRegistry.md +21 -0
  41. package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +10 -0
  42. package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
  43. package/api/@xmachines/play-dom/variables/schema.md +35 -45
  44. package/api/@xmachines/play-dom-router/README.md +68 -51
  45. package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
  46. package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
  47. package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
  48. package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
  49. package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
  50. package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
  51. package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +21 -20
  52. package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
  53. package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +41 -35
  54. package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
  55. package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
  56. package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
  57. package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
  58. package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
  59. package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
  60. package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
  61. package/api/@xmachines/play-react/README.md +65 -55
  62. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
  63. package/api/@xmachines/play-react/functions/defineRegistry.md +5 -5
  64. package/api/@xmachines/play-react/functions/useActor.md +1 -1
  65. package/api/@xmachines/play-react/functions/useFieldValidation.md +31 -0
  66. package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
  67. package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
  68. package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
  69. package/api/@xmachines/play-react/interfaces/ComponentContext.md +9 -8
  70. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
  71. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -6
  72. package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
  73. package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
  74. package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
  75. package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
  76. package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
  77. package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
  78. package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
  79. package/api/@xmachines/play-react-router/README.md +38 -31
  80. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
  81. package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
  82. package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
  83. package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
  84. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
  85. package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
  86. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +41 -35
  87. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
  88. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
  89. package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
  90. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
  91. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
  92. package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  93. package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
  94. package/api/@xmachines/play-router/README.md +99 -95
  95. package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
  96. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
  97. package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
  98. package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
  99. package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
  100. package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
  101. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
  102. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
  103. package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
  104. package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
  105. package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
  106. package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
  107. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
  108. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
  109. package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
  110. package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
  111. package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
  112. package/api/@xmachines/play-router/functions/routeExists.md +8 -8
  113. package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
  114. package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
  115. package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
  116. package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +6 -6
  117. package/api/@xmachines/play-router/interfaces/LocationLike.md +11 -11
  118. package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -9
  119. package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
  120. package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
  121. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +41 -35
  122. package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
  123. package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
  124. package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
  125. package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
  126. package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
  127. package/api/@xmachines/play-router/interfaces/RouteMatch.md +5 -5
  128. package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
  129. package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
  130. package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
  131. package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
  132. package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
  133. package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
  134. package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
  135. package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
  136. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
  137. package/api/@xmachines/play-signals/README.md +38 -36
  138. package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
  139. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
  140. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
  141. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
  142. package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
  143. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
  144. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
  145. package/api/@xmachines/play-solid/README.md +46 -42
  146. package/api/@xmachines/play-solid/functions/useActor.md +1 -1
  147. package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
  148. package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
  149. package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
  150. package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
  151. package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
  152. package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
  153. package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
  154. package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
  155. package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
  156. package/api/@xmachines/play-solid-router/README.md +39 -34
  157. package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
  158. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
  159. package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
  160. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
  161. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +45 -30
  162. package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
  163. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +41 -35
  164. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
  165. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
  166. package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
  167. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
  168. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
  169. package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
  170. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
  171. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
  172. package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
  173. package/api/@xmachines/play-svelte/README.md +60 -33
  174. package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
  175. package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
  176. package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
  177. package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
  178. package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
  179. package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
  180. package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
  181. package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
  182. package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
  183. package/api/@xmachines/play-svelte-spa-router/README.md +43 -52
  184. package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
  185. package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
  186. package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
  187. package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
  188. package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
  189. package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +41 -35
  190. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
  191. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
  192. package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
  193. package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
  194. package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
  195. package/api/@xmachines/play-sveltekit-router/README.md +43 -39
  196. package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
  197. package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
  198. package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
  199. package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
  200. package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
  201. package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +11 -11
  202. package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +41 -35
  203. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
  204. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
  205. package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
  206. package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
  207. package/api/@xmachines/play-tanstack-react-router/README.md +67 -49
  208. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
  209. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
  210. package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
  211. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
  212. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
  213. package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
  214. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
  215. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +41 -35
  216. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
  217. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
  218. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
  219. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
  220. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
  221. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
  222. package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  223. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
  224. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
  225. package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
  226. package/api/@xmachines/play-tanstack-router/README.md +38 -16
  227. package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
  228. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
  229. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
  230. package/api/@xmachines/play-tanstack-solid-router/README.md +76 -50
  231. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
  232. package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
  233. package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
  234. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
  235. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
  236. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +41 -35
  237. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
  238. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
  239. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
  240. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
  241. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
  242. package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  243. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
  244. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
  245. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
  246. package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
  247. package/api/@xmachines/play-vue/README.md +39 -39
  248. package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
  249. package/api/@xmachines/play-vue/functions/useActor.md +1 -1
  250. package/api/@xmachines/play-vue/functions/useFieldValidation.md +31 -0
  251. package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
  252. package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
  253. package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
  254. package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
  255. package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
  256. package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
  257. package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
  258. package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
  259. package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +4 -4
  260. package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
  261. package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
  262. package/api/@xmachines/play-vue-router/README.md +66 -57
  263. package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
  264. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
  265. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
  266. package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
  267. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +41 -35
  268. package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
  269. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
  270. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
  271. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
  272. package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
  273. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
  274. package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
  275. package/api/@xmachines/play-xstate/README.md +129 -138
  276. package/api/@xmachines/play-xstate/classes/PlayerActor.md +148 -114
  277. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -23
  278. package/api/@xmachines/play-xstate/functions/composeGuards.md +34 -33
  279. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +27 -22
  280. package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +19 -14
  281. package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
  282. package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
  283. package/api/@xmachines/play-xstate/functions/eventMatches.md +12 -7
  284. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +17 -48
  285. package/api/@xmachines/play-xstate/functions/hasContext.md +12 -9
  286. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
  287. package/api/@xmachines/play-xstate/functions/negateGuard.md +26 -20
  288. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
  289. package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
  290. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -11
  291. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
  292. package/api/@xmachines/play-xstate/interfaces/RouteObject.md +4 -4
  293. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +9 -25
  294. package/api/@xmachines/play-xstate/type-aliases/Guard.md +13 -11
  295. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +8 -5
  296. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +11 -15
  297. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -19
  298. package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
  299. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -26
  300. package/api/@xmachines/shared/README.md +12 -14
  301. package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
  302. package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
  303. package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +12 -7
  304. package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
  305. package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +9 -4
  306. package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
  307. package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
  308. package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +6 -6
  309. package/contributing/architecture.md +27 -28
  310. package/contributing/configuration.md +10 -10
  311. package/contributing/deployment.md +51 -30
  312. package/contributing/development.md +90 -21
  313. package/contributing/testing.md +36 -14
  314. package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +1 -1
  315. package/examples/@xmachines/play-dom-demo/functions/initShell.md +1 -1
  316. package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +1 -1
  317. package/examples/@xmachines/play-dom-demo/variables/About.md +1 -1
  318. package/examples/@xmachines/play-dom-demo/variables/Contact.md +1 -1
  319. package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +1 -1
  320. package/examples/@xmachines/play-dom-demo/variables/Home.md +1 -1
  321. package/examples/@xmachines/play-dom-demo/variables/Login.md +1 -1
  322. package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +1 -1
  323. package/examples/@xmachines/play-dom-demo/variables/Navigation.md +1 -1
  324. package/examples/@xmachines/play-dom-demo/variables/Overview.md +1 -1
  325. package/examples/@xmachines/play-dom-demo/variables/Profile.md +1 -1
  326. package/examples/@xmachines/play-dom-demo/variables/Settings.md +1 -1
  327. package/examples/@xmachines/play-dom-demo/variables/Stats.md +1 -1
  328. package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +1 -1
  329. package/examples/@xmachines/play-react-demo/functions/App.md +1 -1
  330. package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +1 -1
  331. package/examples/@xmachines/play-react-demo/variables/About.md +1 -1
  332. package/examples/@xmachines/play-react-demo/variables/Contact.md +1 -1
  333. package/examples/@xmachines/play-react-demo/variables/Dashboard.md +1 -1
  334. package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +1 -1
  335. package/examples/@xmachines/play-react-demo/variables/Home.md +1 -1
  336. package/examples/@xmachines/play-react-demo/variables/Login.md +1 -1
  337. package/examples/@xmachines/play-react-demo/variables/NavBar.md +1 -1
  338. package/examples/@xmachines/play-react-demo/variables/NavBarView.md +1 -1
  339. package/examples/@xmachines/play-react-demo/variables/Navigation.md +1 -1
  340. package/examples/@xmachines/play-react-demo/variables/Overview.md +1 -1
  341. package/examples/@xmachines/play-react-demo/variables/Profile.md +1 -1
  342. package/examples/@xmachines/play-react-demo/variables/Settings.md +1 -1
  343. package/examples/@xmachines/play-react-demo/variables/Shell.md +1 -1
  344. package/examples/@xmachines/play-react-demo/variables/Stats.md +1 -1
  345. package/examples/@xmachines/play-react-demo/variables/authCatalog.md +1 -1
  346. package/examples/@xmachines/play-solid-demo/functions/App.md +1 -1
  347. package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +1 -1
  348. package/examples/@xmachines/play-solid-demo/variables/About.md +1 -1
  349. package/examples/@xmachines/play-solid-demo/variables/Contact.md +1 -1
  350. package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +1 -1
  351. package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +1 -1
  352. package/examples/@xmachines/play-solid-demo/variables/Home.md +1 -1
  353. package/examples/@xmachines/play-solid-demo/variables/Login.md +1 -1
  354. package/examples/@xmachines/play-solid-demo/variables/NavBar.md +1 -1
  355. package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +1 -1
  356. package/examples/@xmachines/play-solid-demo/variables/Navigation.md +1 -1
  357. package/examples/@xmachines/play-solid-demo/variables/Overview.md +1 -1
  358. package/examples/@xmachines/play-solid-demo/variables/Profile.md +1 -1
  359. package/examples/@xmachines/play-solid-demo/variables/Settings.md +1 -1
  360. package/examples/@xmachines/play-solid-demo/variables/Shell.md +1 -1
  361. package/examples/@xmachines/play-solid-demo/variables/Stats.md +1 -1
  362. package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +1 -1
  363. package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +1 -1
  364. package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +1 -1
  365. package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +1 -1
  366. package/examples/@xmachines/play-vue-demo/variables/App.md +1 -1
  367. package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +1 -1
  368. package/examples/README.md +4 -1
  369. package/examples/basic-state-machine.md +24 -24
  370. package/examples/form-validation.md +110 -121
  371. package/examples/multi-router-integration.md +0 -2
  372. package/examples/routing-patterns.md +60 -94
  373. package/examples/traffic-light.md +57 -48
  374. package/guides/README.md +6 -2
  375. package/guides/actor-model.md +1 -1
  376. package/guides/getting-started.md +89 -90
  377. package/guides/inspector.md +197 -0
  378. package/guides/state-machines.md +55 -69
  379. package/package.json +10 -7
  380. package/rfc/play.md +15 -6
  381. package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
  382. package/api/@xmachines/play-xstate/functions/createRoutedMachine.md +0 -87
  383. package/api/@xmachines/play-xstate/type-aliases/PlayRoutePayload.md +0 -30
  384. package/api/@xmachines/play-xstate/type-aliases/SetupLike.md +0 -33
  385. package/api/@xmachines/play-xstate/type-aliases/WithOptional.md +0 -31
  386. package/api/@xmachines/play-xstate/variables/emptyEventSchema.md +0 -37
  387. package/api/@xmachines/play-xstate/variables/playMetaSchema.md +0 -40
  388. package/api/@xmachines/play-xstate/variables/playRouteEventSchema.md +0 -9
@@ -1,15 +1,10 @@
1
1
  [API](../../README.md) / @xmachines/play-xstate
2
2
 
3
- <!-- generated-by: gsd-doc-writer -->
4
-
5
3
  # @xmachines/play-xstate
6
4
 
7
- > XState v6 adapter for the XMachines Play Architecture bind state machines to the actor base with signal-driven reactivity and router integration.
8
-
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
- [![Version](https://img.shields.io/badge/version-1.0.0--beta.51-blue)](https://www.npmjs.com/package/@xmachines/play-xstate)
5
+ > XState v5 adapter for the XMachines Play Architecture. It binds a state machine to the actor base, with signal-driven reactivity and a router integration.
11
6
 
12
- Part of the [XMachines Play](../../README.md) monorepo.
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.1.0-blue)](https://www.npmjs.com/package/@xmachines/play-xstate)
13
8
 
14
9
  ---
15
10
 
@@ -19,7 +14,7 @@ Part of the [XMachines Play](../../README.md) monorepo.
19
14
  pnpm add @xmachines/play-xstate xstate
20
15
  ```
21
16
 
22
- `xstate ^6.0.0-alpha.19` is a peer dependency and must be installed alongside this package.
17
+ `xstate ^5.31.0` is a peer dependency. Install it with this package.
23
18
 
24
19
  ---
25
20
 
@@ -27,18 +22,13 @@ pnpm add @xmachines/play-xstate xstate
27
22
 
28
23
  ```typescript
29
24
  import { setup } from "xstate";
30
- import { definePlayer, emptyEventSchema, playMetaSchema } from "@xmachines/play-xstate";
25
+ import { definePlayer } from "@xmachines/play-xstate";
31
26
 
32
- // 1. Define your XState v6 machine
33
- const machine = setup({
34
- schemas: {
35
- events: { activate: emptyEventSchema },
36
- meta: playMetaSchema, // types meta.route / meta.view on state nodes
37
- },
38
- }).createMachine({
27
+ // 1. Define your XState v5 machine
28
+ const machine = setup({}).createMachine({
39
29
  initial: "idle",
40
30
  states: {
41
- idle: { meta: { route: "/" }, on: { activate: { target: "active" } } },
31
+ idle: { meta: { route: "/" }, on: { activate: "active" } },
42
32
  active: { meta: { route: "/active" } },
43
33
  },
44
34
  });
@@ -66,16 +56,16 @@ actor.stop();
66
56
 
67
57
  ### `definePlayer(config)`
68
58
 
69
- Creates a `PlayerFactory` from an XState v6 machine. The factory pattern enables multiple independent actor instances from a single configuration useful for multi-user scenarios, SSR, or testing.
59
+ This function creates a `PlayerFactory` from an XState v5 machine. One configuration can therefore make more than one independent actor instance. This helps with a multi-user application, with SSR, and with a test.
70
60
 
71
61
  ```typescript
72
- import { setup, types } from "xstate";
62
+ import { setup } from "xstate";
73
63
  import { definePlayer } from "@xmachines/play-xstate";
74
64
 
75
65
  const machine = setup({
76
- schemas: {
77
- context: types<{ userId: string }>(),
78
- input: types<{ userId: string }>(),
66
+ types: {
67
+ context: {} as { userId: string },
68
+ input: {} as { userId: string },
79
69
  },
80
70
  }).createMachine({
81
71
  context: ({ input }) => ({ userId: input.userId }),
@@ -91,6 +81,7 @@ const createPlayer = definePlayer({
91
81
  onTransition: (actor, prev, next) => console.log("transitioned"),
92
82
  onStateChange: (actor, state) => console.log("state changed"),
93
83
  onError: (actor, err) => console.error(err),
84
+ inspect: (event) => console.log(event.type), // handed to XState's actor constructor — enables @statelyai/inspect
94
85
  },
95
86
  });
96
87
 
@@ -101,17 +92,27 @@ const bob = createPlayer({ userId: "bob" });
101
92
 
102
93
  #### `PlayerFactory` signature
103
94
 
95
+ The `input` argument follows the rule of `createActor` in XState. If the input type of a
96
+ machine cannot be `undefined`, the first argument of the factory is necessary. An absent
97
+ input is then a compile error, not an actor that stops in an error status.
98
+
104
99
  ```typescript
105
- type PlayerFactory<TMachine> = (
106
- input?: InputFrom<TMachine>,
107
- options?: PlayerFactoryResumeOptions<TMachine>,
108
- ) => PlayerActor<TMachine>;
100
+ type PlayerFactory<TMachine> =
101
+ undefined extends InputFrom<TMachine>
102
+ ? (
103
+ input?: InputFrom<TMachine>,
104
+ options?: PlayerFactoryResumeOptions<TMachine>,
105
+ ) => PlayerActor<TMachine>
106
+ : (
107
+ input: InputFrom<TMachine>,
108
+ options?: PlayerFactoryResumeOptions<TMachine>,
109
+ ) => PlayerActor<TMachine>;
109
110
  ```
110
111
 
111
112
  #### Restoring from a snapshot
112
113
 
113
114
  ```typescript
114
- const snapshot = actor.getSnapshot();
115
+ const snapshot = actor.getPersistedSnapshot();
115
116
  actor.stop();
116
117
 
117
118
  // Restore to the exact saved state
@@ -120,31 +121,35 @@ restored.start();
120
121
  console.log(restored.currentRoute.get()); // same route as when saved
121
122
  ```
122
123
 
124
+ > **Note:** persist the state with `getPersistedSnapshot()`, not with
125
+ > `getSnapshot()`. `createActor` accepts that form only, and it is the only form
126
+ > that restores a machine with an invoked child or a spawned child.
127
+
123
128
  ---
124
129
 
125
130
  ### `PlayerActor<TMachine>`
126
131
 
127
- Concrete actor class that wraps an XState v6 actor and exposes TC39 Signal-based reactive signals. Implements both `Routable` and `Viewable` interfaces from `@xmachines/play-actor`.
132
+ This concrete actor class is an XState v5 actor that also exposes reactive TC39 Signals. It implements both the `Routable` interface and the `Viewable` interface from `@xmachines/play-actor`.
128
133
 
129
134
  #### Signals
130
135
 
131
- | Signal | Type | Description |
132
- | -------------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
133
- | `state` | `Signal.State<SnapshotFrom<TMachine>>` | Current XState snapshot; updated on every active transition |
134
- | `currentRoute` | `Signal.Computed<string \| null>` | Derived URL from active state's `meta.route` template and context |
135
- | `currentView` | `Signal.State<PlaySpec \| null>` | View spec from active state's `meta.view` metadata; enriched with context params |
136
- | `initialRoute` | `readonly string \| null` | Machine's initial-state route (fixed at construction; used by router bridges for deep-link vs restore detection) |
136
+ | Signal | Type | Description |
137
+ | -------------- | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
138
+ | `state` | `Signal.State<SnapshotFrom<TMachine>>` | The current XState snapshot. The actor updates it on every active transition |
139
+ | `currentRoute` | `Signal.Computed<string \| null>` | The URL that comes from the `meta.route` template of the active state and from the context |
140
+ | `currentView` | `Signal.State<PlaySpec \| null>` | The view spec from the `meta.view` metadata of the active state, with the context params added |
141
+ | `initialRoute` | `readonly string \| null` | The route of the initial state of the machine. The constructor fixes it, and a router bridge uses it to detect a deep link or a restore |
137
142
 
138
143
  #### Methods
139
144
 
140
- | Method | Description |
141
- | --------------- | -------------------------------------------------------------- |
142
- | `start()` | Start the actor and fire `onStart` hook |
143
- | `stop()` | Stop the actor, clean up subscriptions, fire `onStop` hook |
144
- | `send(event)` | Send a typed event to the machine; fires `onTransition` hook |
145
- | `can(event)` | Returns `true` if the current state can accept the given event |
146
- | `getSnapshot()` | Returns the current XState snapshot |
147
- | `dispose()` | Alias for `stop()` |
145
+ | Method | Description |
146
+ | --------------- | ------------------------------------------------------------------------- |
147
+ | `start()` | Starts the actor and calls the `onStart` hook |
148
+ | `stop()` | Stops the actor, cleans up the subscriptions, and calls the `onStop` hook |
149
+ | `send(event)` | Sends a typed event to the machine and calls the `onTransition` hook |
150
+ | `can(event)` | Returns `true` when the current state accepts the given event |
151
+ | `getSnapshot()` | Returns the current XState snapshot |
152
+ | `dispose()` | The alias of `stop()` |
148
153
 
149
154
  #### Signal usage example
150
155
 
@@ -165,7 +170,12 @@ actor.start();
165
170
 
166
171
  ### Guard utilities
167
172
 
168
- Composable guard helpers that combine predicates with AND, OR, and NOT logic. Each helper returns a plain predicate — call it inside a transition function with the transition arguments and return early to block the transition. String guard names are resolved against the named guards declared in `setup({ guards })`.
173
+ > **Deprecated:** these guard helpers wrap the `and()`, `or()`, and `not()`
174
+ > combinators of XState, but they do not compose with a guard slot that
175
+ > `setup()` types. Use the combinators of XState directly. The next major
176
+ > version removes this module.
177
+
178
+ These composable guard helpers wrap the `and()`, `or()`, and `not()` functions of XState. Use them in a machine `setup({ guards })` definition.
169
179
 
170
180
  ```typescript
171
181
  import { setup } from "xstate";
@@ -178,24 +188,20 @@ import {
178
188
  contextFieldMatches, // guard: context field equals a value
179
189
  } from "@xmachines/play-xstate";
180
190
 
181
- const canAccessAdmin = composeGuards(["isLoggedIn", "hasAdminRole"]);
182
- const isAuthenticated = negateGuard("isGuest");
183
-
184
191
  const machine = setup({
185
192
  guards: {
186
193
  isLoggedIn: ({ context }) => !!context.userId,
187
194
  hasAdminRole: ({ context }) => context.role === "admin",
188
- isGuest: ({ context }) => !context.userId,
189
195
  },
190
196
  }).createMachine({
191
197
  on: {
192
- accessAdmin: (args) => {
193
- if (!canAccessAdmin(args)) return;
194
- return { target: "adminPanel" };
198
+ accessAdmin: {
199
+ guard: composeGuards(["isLoggedIn", "hasAdminRole"]),
200
+ target: "adminPanel",
195
201
  },
196
- accessDashboard: (args) => {
197
- if (!isAuthenticated(args)) return;
198
- return { target: "dashboard" };
202
+ accessLogin: {
203
+ guard: negateGuard("isLoggedIn"),
204
+ target: "login",
199
205
  },
200
206
  },
201
207
  // ...
@@ -206,19 +212,17 @@ const machine = setup({
206
212
 
207
213
  ### Routing utilities
208
214
 
209
- Helper functions for declarative route configuration in XState machines.
215
+ These helper functions configure the routes of an XState machine declaratively.
210
216
 
211
- #### `createRoutedMachine(setup)`
217
+ #### `formatPlayRouteTransitions(machineConfig)`
212
218
 
213
- The recommended entry point: returns a `createMachine` with the same signature as the setup's own full contextual typing for the config that wires routing up at runtime.
219
+ This function reads each machine state that has a `meta.route` field. It then generates the `play.route` event handlers at the root level. You therefore write no repetitive routing transition.
214
220
 
215
221
  ```typescript
216
222
  import { setup } from "xstate";
217
- import { createRoutedMachine } from "@xmachines/play-xstate";
218
-
219
- const appSetup = setup({/* schemas, guards, ... */});
223
+ import { formatPlayRouteTransitions } from "@xmachines/play-xstate";
220
224
 
221
- const machine = createRoutedMachine(appSetup)({
225
+ const config = formatPlayRouteTransitions({
222
226
  id: "app",
223
227
  states: {
224
228
  home: {
@@ -231,61 +235,58 @@ const machine = createRoutedMachine(appSetup)({
231
235
  },
232
236
  },
233
237
  });
238
+
239
+ // config now includes auto-generated play.route handlers:
240
+ // on: { "play.route": [ { target: ".home", guard: e => e.to === "#home" }, ... ] }
241
+ const machine = setup({}).createMachine(config);
234
242
  ```
235
243
 
236
- #### `formatPlayRouteTransitions(machineConfig)`
244
+ > **Note:** every state with a `meta.route` field must also have an explicit `id` field. A state without an `id` field throws `MissingStateIdError` when you define the machine.
237
245
 
238
- The underlying transform. Crawls machine states with `meta.route` and wires them to XState v6's native routing: each routed state gets a native `route: {}` config (targetable via the built-in `xstate.route` event and visible to graph tooling), and one root `play.route` forwarder navigates those targets in a single atomic transition — patching `params`/`query` into context — while re-raising `xstate.route` only for states that declare their own `route` config. Unknown targets fall through to user-defined `play.route` fallbacks (e.g. a 404 route); one `play.route` send is one atomic transition, so exit actions see the old `params` and entry actions the new ones.
246
+ #### Other routing exports
239
247
 
240
- ```typescript
241
- import { setup } from "xstate";
242
- import {
243
- formatPlayRouteTransitions,
244
- playMetaSchema,
245
- playRouteEventSchema,
246
- } from "@xmachines/play-xstate";
248
+ | Export | Description |
249
+ | ---------------------------------- | --------------------------------------------------------------------------- |
250
+ | `deriveRoute(meta)` | Reads the route template string from the metadata object of a state |
251
+ | `isAbsoluteRoute(route)` | Returns `true` when the route string is an absolute URL path |
252
+ | `buildRouteUrl(template, context)` | Replaces each `:param` placeholder of a route template with a context value |
247
253
 
248
- const config = formatPlayRouteTransitions({
249
- id: "app",
250
- states: {
251
- home: {
252
- id: "home",
253
- meta: { route: "/home" },
254
- },
255
- profile: {
256
- id: "profile",
257
- meta: { route: "/users/:userId" },
258
- },
259
- },
260
- });
254
+ ---
261
255
 
262
- // config now carries native route configs plus the play.route forwarder:
263
- // states: { home: { ..., route: {} }, profile: { ..., route: {} } }
264
- // on: { "play.route": [forwarder, ...userFallbacks] }
265
- // The forwarder navigates injected-route targets directly (atomically);
266
- // xstate.route is raised only for states declaring their own route config.
267
- const machine = setup({
268
- schemas: {
269
- events: { "play.route": playRouteEventSchema },
270
- meta: playMetaSchema,
271
- },
272
- }).createMachine(config);
256
+ ## Inspection
257
+
258
+ The factory gives `options.inspect` to `createActor` of XState without a change.
259
+ Therefore every XState inspection tool works with a `PlayerActor`, and this
260
+ includes [`@statelyai/inspect`](https://stately.ai/docs/inspector):
261
+
262
+ ```typescript
263
+ import { createBrowserInspector } from "@statelyai/inspect";
264
+
265
+ const { inspect } = createBrowserInspector();
266
+ const createPlayer = definePlayer({ machine, options: { inspect } });
273
267
  ```
274
268
 
275
- Because the injected `route` configs are static, route transitions keep statically-known targets — `machineToGraph()` sees real edges to every routed state, so reachability queries work.
269
+ Three points are important:
276
270
 
277
- > **Note:** Every state with `meta.route` must also have an explicit `id` field; omitting it throws `MissingStateIdError` at machine-definition time.
271
+ - **`inspect` is an option of the factory, not of one instance.** Every actor of a
272
+ factory reports to the same observer. Separate the actors by root:
273
+ `event.rootId === actor.sessionId` covers the complete tree of an actor, with its
274
+ children.
275
+ - **`inspect` is the only path that sees the construction.** `actor.system.inspect(fn)`
276
+ attaches later, and it sees only the events after that moment. It therefore misses the
277
+ `@xstate.actor` registration, and an inspector needs that registration to draw the
278
+ machine.
279
+ - **A `PlayerActor` is the actor.** Its own events carry `actorRef === playerActor`, so
280
+ you can recognize a player by its identity. Note one point: `@xstate.actor` fires from
281
+ inside the constructor, and `state`, `currentRoute`, `currentView`, and `initialRoute`
282
+ do not exist yet. A read of one of them there throws.
278
283
 
279
- #### Other routing exports
284
+ For an inspector that you create after the factory, such as a dev-tools switch, give the
285
+ factory a function that forwards each event: `inspect: (event) => currentInspector?.(event)`.
280
286
 
281
- | Export | Description |
282
- | ---------------------------------- | ------------------------------------------------------------------------- |
283
- | `playMetaSchema` | Shared `schemas.meta` declaration for `meta.route` / `meta.view` metadata |
284
- | `playRouteEventSchema` | Shared `schemas.events` entry for the `play.route` event payload |
285
- | `emptyEventSchema` | Shared `schemas.events` entry for events that carry no payload |
286
- | `deriveRoute(meta)` | Extract the route template string from a state's metadata object |
287
- | `isAbsoluteRoute(route)` | Returns `true` if the route string is an absolute URL path |
288
- | `buildRouteUrl(template, context)` | Substitute `:param` placeholders in a route template using context values |
287
+ The [inspector guide](../../../guides/inspector.md) gives the complete procedure: a late
288
+ attachment with a replay, a WebSocket inspection without a browser, and the points to
289
+ consider in production.
289
290
 
290
291
  ---
291
292
 
@@ -294,12 +295,12 @@ Because the injected `route` configs are static, route transitions keep statical
294
295
  ```typescript
295
296
  import type {
296
297
  PlayerConfig, // definePlayer() config argument shape
297
- PlayerOptions, // Lifecycle hooks (onStart, onStop, onTransition, onStateChange, onError)
298
+ PlayerOptions, // Lifecycle hooks (onStart, onStop, onTransition, onStateChange, onError) + inspect
298
299
  PlayerFactory, // Factory function returned by definePlayer()
299
300
  PlayerFactoryResumeOptions, // { snapshot? } for restoring actor state
300
- Guard, // Single XState guard predicate
301
- GuardArray, // Array of guards for compose helpers
302
- ComposedGuard, // Return type of composeGuards / composeGuardsOr / negateGuard
301
+ Guard, // deprecated with the guard utilities — removed in the next major
302
+ GuardArray, // deprecated with the guard utilities — removed in the next major
303
+ ComposedGuard, // deprecated with the guard utilities removed in the next major
303
304
  RouteMachineConfig, // Minimal machine config accepted by formatPlayRouteTransitions
304
305
  RouteStateNode, // Single state node shape used during route crawling
305
306
  RouteContext, // Context shape expected by buildRouteUrl ({ params?, query?, basePath?, hash? })
@@ -312,23 +313,22 @@ import type {
312
313
 
313
314
  ## Error Classes
314
315
 
315
- Error classes are exported from the `@xmachines/play-xstate/errors` sub-path to keep the main bundle lean.
316
+ The `@xmachines/play-xstate/errors` subpath exports the error classes. The main bundle therefore stays small.
316
317
 
317
318
  ```typescript
318
319
  import {
319
320
  MissingRouteParamError, // Required :param absent from context when resolving currentRoute
320
- MissingQueryContextError, // context.params present but context.query missing
321
+ MissingQueryContextError, // deprecated: no longer thrown
321
322
  MissingStateIdError, // meta.route declared without a state id field
322
323
  InvalidMachineError, // PlayerActor constructed with a non-object machine
323
324
  InvalidEventError, // actor.send() called with null/undefined/non-object
325
+ ActorThrewNonErrorError, // actor failed with a thrown value that is not an Error
324
326
  InvalidRouteMetadataError, // meta.route is neither a string nor { path: string }
325
327
  EmptyGuardArrayError, // composeGuards/composeGuardsOr called with empty array
326
- UnresolvableGuardNameError, // string guard name could not be resolved at call time
327
- InvalidGuardEntryError, // guard entry was neither a predicate nor a name (e.g. undefined)
328
328
  } from "@xmachines/play-xstate/errors";
329
329
  ```
330
330
 
331
- All error classes extend `PlayError` from `@xmachines/play` and carry typed detail fields (`param`, `template`, `combinator`, etc.) for programmatic inspection without message parsing.
331
+ Every error class extends `PlayError` from `@xmachines/play`. Each class also carries typed detail fields, such as `param`, `template`, and `combinator`. Your code therefore reads the details of an error, and it does not parse the message.
332
332
 
333
333
  ---
334
334
 
@@ -342,7 +342,7 @@ pnpm --filter @xmachines/play-xstate test
342
342
  pnpm --filter @xmachines/play-xstate run test:watch
343
343
  ```
344
344
 
345
- Tests use [Vitest](https://vitest.dev/) and live in `packages/play-xstate/test/`.
345
+ The tests use [Vitest](https://vitest.dev/). They are in `packages/play-xstate/test/`.
346
346
 
347
347
  ---
348
348
 
@@ -350,13 +350,14 @@ Tests use [Vitest](https://vitest.dev/) and live in `packages/play-xstate/test/`
350
350
 
351
351
  MIT — see [LICENSE](LICENSE) for details.
352
352
 
353
- @xmachines/play-xstate - XState v6 adapter for Play Architecture
353
+ @xmachines/play-xstate - the XState v5 adapter of the Play Architecture
354
354
 
355
- Provides definePlayer() API for binding XState state machines to the
356
- actor base with signal lifecycle and DevTools integration.
355
+ This package gives you the definePlayer() API. That function binds an XState state
356
+ machine to the actor base, with the signal lifecycle and the DevTools
357
+ integration.
357
358
 
358
- Per the Play RFC, this package implements the Logic Layer adapter that
359
- transforms declarative machine definitions into live actors with signal-driven
359
+ The Play RFC gives this package as the adapter of the logic layer. It converts a
360
+ declarative machine definition into a live actor with a signal-driven
360
361
  reactivity.
361
362
 
362
363
  ## Classes
@@ -373,34 +374,24 @@ reactivity.
373
374
 
374
375
  ## Type Aliases
375
376
 
376
- - [ComposedGuard](type-aliases/ComposedGuard.md)
377
- - [Guard](type-aliases/Guard.md)
378
- - [GuardArray](type-aliases/GuardArray.md)
377
+ - [~~ComposedGuard~~](type-aliases/ComposedGuard.md)
378
+ - [~~Guard~~](type-aliases/Guard.md)
379
+ - [~~GuardArray~~](type-aliases/GuardArray.md)
379
380
  - [PlayerFactory](type-aliases/PlayerFactory.md)
380
- - [PlayRoutePayload](type-aliases/PlayRoutePayload.md)
381
381
  - [RouteMachineConfig](type-aliases/RouteMachineConfig.md)
382
382
  - [RouteMetadata](type-aliases/RouteMetadata.md)
383
383
  - [RouteStateNode](type-aliases/RouteStateNode.md)
384
- - [SetupLike](type-aliases/SetupLike.md)
385
- - [WithOptional](type-aliases/WithOptional.md)
386
-
387
- ## Variables
388
-
389
- - [emptyEventSchema](variables/emptyEventSchema.md)
390
- - [playMetaSchema](variables/playMetaSchema.md)
391
- - [playRouteEventSchema](variables/playRouteEventSchema.md)
392
384
 
393
385
  ## Functions
394
386
 
395
387
  - [buildRouteUrl](functions/buildRouteUrl.md)
396
- - [composeGuards](functions/composeGuards.md)
397
- - [composeGuardsOr](functions/composeGuardsOr.md)
398
- - [contextFieldMatches](functions/contextFieldMatches.md)
399
- - [createRoutedMachine](functions/createRoutedMachine.md)
388
+ - [~~composeGuards~~](functions/composeGuards.md)
389
+ - [~~composeGuardsOr~~](functions/composeGuardsOr.md)
390
+ - [~~contextFieldMatches~~](functions/contextFieldMatches.md)
400
391
  - [definePlayer](functions/definePlayer.md)
401
392
  - [deriveRoute](functions/deriveRoute.md)
402
- - [eventMatches](functions/eventMatches.md)
393
+ - [~~eventMatches~~](functions/eventMatches.md)
403
394
  - [formatPlayRouteTransitions](functions/formatPlayRouteTransitions.md)
404
- - [hasContext](functions/hasContext.md)
395
+ - [~~hasContext~~](functions/hasContext.md)
405
396
  - [isAbsoluteRoute](functions/isAbsoluteRoute.md)
406
- - [negateGuard](functions/negateGuard.md)
397
+ - [~~negateGuard~~](functions/negateGuard.md)