@xmachines/docs 1.0.0-beta.26 → 1.0.0-beta.28

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 (309) hide show
  1. package/api/@xmachines/play/classes/PlayError.md +4 -10
  2. package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
  3. package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -25
  4. package/api/@xmachines/play-actor/functions/typedSpec.md +1 -1
  5. package/api/@xmachines/play-actor/interfaces/PlaySpec.md +2 -2
  6. package/api/@xmachines/play-actor/interfaces/Routable.md +3 -3
  7. package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +3 -3
  8. package/api/@xmachines/play-actor/interfaces/Viewable.md +2 -2
  9. package/api/@xmachines/play-actor-shared/README.md +155 -0
  10. package/api/@xmachines/play-actor-shared/interfaces/AuthContext.md +14 -0
  11. package/api/@xmachines/play-actor-shared/type-aliases/AuthActor.md +27 -0
  12. package/api/@xmachines/play-actor-shared/type-aliases/AuthCatalog.md +16 -0
  13. package/api/@xmachines/play-actor-shared/type-aliases/AuthEvents.md +17 -0
  14. package/api/@xmachines/play-actor-shared/type-aliases/AuthInput.md +9 -0
  15. package/api/@xmachines/play-actor-shared/type-aliases/AuthSnapshot.md +11 -0
  16. package/api/@xmachines/play-actor-shared/type-aliases/CatalogProps.md +187 -0
  17. package/api/@xmachines/play-actor-shared/type-aliases/InferProps.md +17 -0
  18. package/api/@xmachines/play-actor-shared/variables/authCatalog.md +173 -0
  19. package/api/@xmachines/play-actor-shared/variables/authMachine.md +189 -0
  20. package/api/@xmachines/play-actor-shared/variables/authSetup.md +22 -0
  21. package/api/@xmachines/play-dom/README.md +74 -8
  22. package/api/@xmachines/play-dom/classes/PlayRenderer.md +4 -4
  23. package/api/@xmachines/play-dom/functions/connectRenderer.md +1 -1
  24. package/api/@xmachines/play-dom/functions/defineRegistry.md +61 -0
  25. package/api/@xmachines/play-dom/functions/renderSpec.md +29 -12
  26. package/api/@xmachines/play-dom/interfaces/ComponentContext.md +62 -0
  27. package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +9 -9
  28. package/api/@xmachines/play-dom/interfaces/DefineRegistryOptions.md +25 -0
  29. package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +18 -0
  30. package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +13 -10
  31. package/api/@xmachines/play-dom/interfaces/EventHandle.md +29 -0
  32. package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +5 -5
  33. package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +53 -0
  34. package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +21 -0
  35. package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +16 -3
  36. package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +5 -2
  37. package/api/@xmachines/play-dom-demo/README.md +145 -0
  38. package/api/@xmachines/play-dom-demo/functions/initShell.md +20 -0
  39. package/api/@xmachines/play-dom-demo/variables/About.md +9 -0
  40. package/api/@xmachines/play-dom-demo/variables/Contact.md +9 -0
  41. package/api/@xmachines/play-dom-demo/variables/Dashboard.md +9 -0
  42. package/api/@xmachines/play-dom-demo/variables/Home.md +9 -0
  43. package/api/@xmachines/play-dom-demo/variables/Login.md +9 -0
  44. package/api/@xmachines/play-dom-demo/variables/Navigation.md +9 -0
  45. package/api/@xmachines/play-dom-demo/variables/Overview.md +9 -0
  46. package/api/@xmachines/play-dom-demo/variables/Profile.md +9 -0
  47. package/api/@xmachines/play-dom-demo/variables/Settings.md +9 -0
  48. package/api/@xmachines/play-dom-demo/variables/Stats.md +9 -0
  49. package/api/@xmachines/play-dom-router/functions/connectRouter.md +1 -1
  50. package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
  51. package/api/@xmachines/play-dom-router/functions/createRouteMap.md +1 -1
  52. package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
  53. package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +14 -14
  54. package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
  55. package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +4 -4
  56. package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +6 -6
  57. package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +3 -3
  58. package/api/@xmachines/play-dom-router/interfaces/RouteMapLike.md +3 -3
  59. package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
  60. package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
  61. package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +4 -4
  62. package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +1 -1
  63. package/api/@xmachines/play-dom-router-demo/README.md +56 -61
  64. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +5 -31
  65. package/api/@xmachines/play-react/functions/defineRegistry.md +0 -2
  66. package/api/@xmachines/play-react/functions/useActor.md +1 -1
  67. package/api/@xmachines/play-react/functions/useBoundProp.md +0 -2
  68. package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
  69. package/api/@xmachines/play-react/functions/useStateBinding.md +0 -2
  70. package/api/@xmachines/play-react/interfaces/ComponentContext.md +0 -2
  71. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
  72. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
  73. package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +7 -7
  74. package/api/@xmachines/play-react/type-aliases/ComponentFn.md +0 -2
  75. package/api/@xmachines/play-react/type-aliases/PlayActor.md +1 -1
  76. package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
  77. package/api/@xmachines/play-react-demo/README.md +173 -0
  78. package/api/@xmachines/play-react-demo/functions/App.md +13 -0
  79. package/api/@xmachines/play-react-demo/functions/DebugPanel.md +20 -0
  80. package/api/@xmachines/play-react-demo/functions/HeaderNav.md +20 -0
  81. package/api/@xmachines/play-react-demo/functions/Shell.md +22 -0
  82. package/api/@xmachines/play-react-demo/variables/About.md +9 -0
  83. package/api/@xmachines/play-react-demo/variables/Contact.md +9 -0
  84. package/api/@xmachines/play-react-demo/variables/Dashboard.md +9 -0
  85. package/api/@xmachines/play-react-demo/variables/Home.md +9 -0
  86. package/api/@xmachines/play-react-demo/variables/Login.md +9 -0
  87. package/api/@xmachines/play-react-demo/variables/Navigation.md +9 -0
  88. package/api/@xmachines/play-react-demo/variables/Overview.md +9 -0
  89. package/api/@xmachines/play-react-demo/variables/Profile.md +9 -0
  90. package/api/@xmachines/play-react-demo/variables/Settings.md +9 -0
  91. package/api/@xmachines/play-react-demo/variables/Stats.md +9 -0
  92. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +23 -23
  93. package/api/@xmachines/play-react-router/classes/RouteMap.md +4 -4
  94. package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +1 -1
  95. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
  96. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +6 -6
  97. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +5 -5
  98. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
  99. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
  100. package/api/@xmachines/play-react-router-demo/README.md +10 -10
  101. package/api/@xmachines/play-router/README.md +1 -1
  102. package/api/@xmachines/play-router/classes/BaseRouteMap.md +4 -4
  103. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +23 -23
  104. package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
  105. package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
  106. package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
  107. package/api/@xmachines/play-router/functions/createRouteMapFromMachine.md +1 -1
  108. package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +1 -1
  109. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
  110. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
  111. package/api/@xmachines/play-router/functions/extractQuery.md +1 -1
  112. package/api/@xmachines/play-router/functions/extractRouteParams.md +1 -1
  113. package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
  114. package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
  115. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
  116. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
  117. package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +1 -1
  118. package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
  119. package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
  120. package/api/@xmachines/play-router/functions/routeExists.md +1 -1
  121. package/api/@xmachines/play-router/functions/sanitizePathname.md +1 -1
  122. package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
  123. package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
  124. package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
  125. package/api/@xmachines/play-router/interfaces/LocationLike.md +3 -3
  126. package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +3 -3
  127. package/api/@xmachines/play-router/interfaces/MachineNodeData.md +5 -5
  128. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +6 -6
  129. package/api/@xmachines/play-router/interfaces/RouteInfo.md +8 -8
  130. package/api/@xmachines/play-router/interfaces/RouteMap.md +4 -4
  131. package/api/@xmachines/play-router/interfaces/RouteMapping.md +3 -3
  132. package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
  133. package/api/@xmachines/play-router/interfaces/RouteNode.md +10 -10
  134. package/api/@xmachines/play-router/interfaces/RouteObject.md +2 -2
  135. package/api/@xmachines/play-router/interfaces/RouteTree.md +5 -5
  136. package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
  137. package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
  138. package/api/@xmachines/play-router/interfaces/WindowLike.md +3 -3
  139. package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
  140. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
  141. package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
  142. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
  143. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
  144. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
  145. package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
  146. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
  147. package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +0 -6
  148. package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +0 -8
  149. package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +0 -2
  150. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +0 -10
  151. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +0 -2
  152. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +0 -2
  153. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +0 -2
  154. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +0 -2
  155. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +0 -2
  156. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +0 -2
  157. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +0 -2
  158. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +0 -2
  159. package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +0 -2
  160. package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +0 -2
  161. package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +0 -2
  162. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
  163. package/api/@xmachines/play-solid/functions/defineRegistry.md +0 -2
  164. package/api/@xmachines/play-solid/functions/useActor.md +1 -1
  165. package/api/@xmachines/play-solid/functions/useStateBinding.md +0 -2
  166. package/api/@xmachines/play-solid/interfaces/ComponentContext.md +0 -2
  167. package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +7 -7
  168. package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +0 -2
  169. package/api/@xmachines/play-solid/type-aliases/PlayActor.md +1 -1
  170. package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
  171. package/api/@xmachines/play-solid-demo/README.md +159 -0
  172. package/api/@xmachines/play-solid-demo/functions/App.md +13 -0
  173. package/api/@xmachines/play-solid-demo/functions/DebugPanel.md +20 -0
  174. package/api/@xmachines/play-solid-demo/functions/HeaderNav.md +20 -0
  175. package/api/@xmachines/play-solid-demo/functions/Shell.md +22 -0
  176. package/api/@xmachines/play-solid-demo/variables/About.md +9 -0
  177. package/api/@xmachines/play-solid-demo/variables/Contact.md +9 -0
  178. package/api/@xmachines/play-solid-demo/variables/Dashboard.md +9 -0
  179. package/api/@xmachines/play-solid-demo/variables/Home.md +9 -0
  180. package/api/@xmachines/play-solid-demo/variables/Login.md +9 -0
  181. package/api/@xmachines/play-solid-demo/variables/Navigation.md +9 -0
  182. package/api/@xmachines/play-solid-demo/variables/Overview.md +9 -0
  183. package/api/@xmachines/play-solid-demo/variables/Profile.md +9 -0
  184. package/api/@xmachines/play-solid-demo/variables/Settings.md +9 -0
  185. package/api/@xmachines/play-solid-demo/variables/Stats.md +9 -0
  186. package/api/@xmachines/play-solid-router/classes/RouteMap.md +4 -4
  187. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +24 -24
  188. package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +1 -1
  189. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
  190. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +3 -23
  191. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +6 -6
  192. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
  193. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
  194. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
  195. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +1 -1
  196. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
  197. package/api/@xmachines/play-solid-router-demo/README.md +25 -28
  198. package/api/@xmachines/play-svelte/functions/defineRegistry.md +0 -2
  199. package/api/@xmachines/play-svelte/interfaces/BaseComponentProps.md +0 -2
  200. package/api/@xmachines/play-svelte/interfaces/ComponentContext.md +0 -2
  201. package/api/@xmachines/play-svelte/interfaces/PlayRendererProps.md +7 -7
  202. package/api/@xmachines/play-svelte/type-aliases/ComponentFn.md +0 -2
  203. package/api/@xmachines/play-svelte/type-aliases/PlayRenderer.md +0 -2
  204. package/api/@xmachines/play-svelte/variables/PlayRenderer.md +0 -2
  205. package/api/@xmachines/play-svelte-demo/README.md +127 -0
  206. package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +4 -4
  207. package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +1 -1
  208. package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +1 -1
  209. package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +4 -4
  210. package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +6 -6
  211. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
  212. package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
  213. package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
  214. package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
  215. package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +4 -4
  216. package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +1 -1
  217. package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +1 -1
  218. package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +4 -4
  219. package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
  220. package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +6 -6
  221. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
  222. package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
  223. package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
  224. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +4 -4
  225. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +23 -23
  226. package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +1 -1
  227. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
  228. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +1 -1
  229. package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
  230. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +6 -6
  231. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +5 -5
  232. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
  233. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
  234. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
  235. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
  236. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +17 -3
  237. package/api/@xmachines/play-tanstack-react-router-demo/README.md +23 -29
  238. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +4 -4
  239. package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +24 -24
  240. package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +1 -1
  241. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
  242. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +6 -6
  243. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
  244. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
  245. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
  246. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +1 -1
  247. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
  248. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +3 -3
  249. package/api/@xmachines/play-tanstack-solid-router-demo/README.md +25 -26
  250. package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
  251. package/api/@xmachines/play-vue/functions/useActor.md +1 -1
  252. package/api/@xmachines/play-vue/functions/useStateBinding.md +0 -2
  253. package/api/@xmachines/play-vue/interfaces/ComponentContext.md +0 -2
  254. package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +5 -5
  255. package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
  256. package/api/@xmachines/play-vue/type-aliases/ComponentFn.md +0 -2
  257. package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
  258. package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +4 -3
  259. package/api/@xmachines/play-vue/type-aliases/PlayActor.md +1 -1
  260. package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
  261. package/api/@xmachines/play-vue-demo/README.md +145 -0
  262. package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
  263. package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +4 -4
  264. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +24 -24
  265. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
  266. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +6 -6
  267. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +3 -3
  268. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
  269. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +1 -1
  270. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +1 -1
  271. package/api/@xmachines/play-vue-router-demo/README.md +48 -41
  272. package/api/@xmachines/play-xstate/classes/PlayerActor.md +11 -25
  273. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +1 -1
  274. package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
  275. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
  276. package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +1 -1
  277. package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
  278. package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
  279. package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
  280. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +1 -1
  281. package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
  282. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
  283. package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
  284. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +3 -3
  285. package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
  286. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +6 -6
  287. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +5 -5
  288. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
  289. package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
  290. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
  291. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +1 -1
  292. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
  293. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
  294. package/api/@xmachines/shared/functions/defineXmVitestConfig.md +3 -7
  295. package/api/@xmachines/shared/functions/xmAliases.md +1 -1
  296. package/api/README.md +6 -2
  297. package/api/llms.txt +0 -3
  298. package/examples/README.md +48 -35
  299. package/examples/basic-state-machine.md +75 -31
  300. package/examples/form-validation.md +199 -127
  301. package/examples/multi-router-integration.md +312 -230
  302. package/examples/routing-patterns.md +243 -189
  303. package/examples/traffic-light.md +114 -65
  304. package/guides/README.md +29 -15
  305. package/guides/getting-started.md +224 -144
  306. package/guides/installation.md +153 -213
  307. package/package.json +2 -2
  308. package/api/@xmachines/play-svelte-spa-router-demo/README.md +0 -23
  309. package/api/@xmachines/play-sveltekit-router-demo/README.md +0 -23
@@ -6,7 +6,7 @@
6
6
  type PlayerFactory<TMachine> = (input?, options?) => PlayerActor<TMachine>;
7
7
  ```
8
8
 
9
- Defined in: [packages/play-xstate/src/types.ts:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/types.ts#L57)
9
+ Defined in: [packages/play-xstate/src/types.ts:57](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/types.ts#L57)
10
10
 
11
11
  Factory function returned by definePlayer()
12
12
 
@@ -6,7 +6,7 @@
6
6
  type RouteMachineConfig = object;
7
7
  ```
8
8
 
9
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:48](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L48)
9
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:48](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L48)
10
10
 
11
11
  Minimal structural constraint for machine configs accepted by
12
12
  `formatPlayRouteTransitions`.
@@ -32,7 +32,7 @@ through the transform, so the return value remains directly usable by
32
32
  optional context?: unknown;
33
33
  ```
34
34
 
35
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:49](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L49)
35
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:49](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L49)
36
36
 
37
37
  ---
38
38
 
@@ -42,7 +42,7 @@ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:4
42
42
  optional on?: Record<string, unknown>;
43
43
  ```
44
44
 
45
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L51)
45
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L51)
46
46
 
47
47
  ---
48
48
 
@@ -52,4 +52,4 @@ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:5
52
52
  optional states?: Record<string, unknown>;
53
53
  ```
54
54
 
55
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:50](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L50)
55
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:50](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L50)
@@ -6,7 +6,7 @@
6
6
  type RouteStateNode = object;
7
7
  ```
8
8
 
9
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L13)
9
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:13](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L13)
10
10
 
11
11
  Minimal structural shape of a single XState state node as read by
12
12
  `formatPlayRouteTransitions` when crawling the machine config.
@@ -29,7 +29,7 @@ the index signature.
29
29
  optional id?: string;
30
30
  ```
31
31
 
32
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L15)
32
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L15)
33
33
 
34
34
  Optional explicit state ID (e.g. `"home"`, `"settings"`). Used as the `#id` target in `play.route` events.
35
35
 
@@ -41,7 +41,7 @@ Optional explicit state ID (e.g. `"home"`, `"settings"`). Used as the `#id` targ
41
41
  optional meta?: object;
42
42
  ```
43
43
 
44
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L17)
44
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L17)
45
45
 
46
46
  State metadata — `meta.route` marks the state as routable.
47
47
 
@@ -61,6 +61,6 @@ URL path template (e.g. `"/profile/:username"`, `"/settings/:section?"`).
61
61
  optional states?: Record<string, RouteStateNode>;
62
62
  ```
63
63
 
64
- Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/play-xstate/src/routing/format-play-route-transitions.ts#L22)
64
+ Defined in: [packages/play-xstate/src/routing/format-play-route-transitions.ts:22](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/play-xstate/src/routing/format-play-route-transitions.ts#L22)
65
65
 
66
66
  Nested child states, recursively crawled for additional route declarations.
@@ -3,10 +3,10 @@
3
3
  # Function: defineXmVitestConfig()
4
4
 
5
5
  ```ts
6
- function defineXmVitestConfig(importMetaUrl, overrides): object;
6
+ function defineXmVitestConfig(importMetaUrl, overrides): UserConfig;
7
7
  ```
8
8
 
9
- Defined in: [src/index.ts:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/shared/src/index.ts#L10)
9
+ Defined in: [index.ts:10](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/shared/src/index.ts#L10)
10
10
 
11
11
  Create a Vitest config with XMachines workspace defaults.
12
12
 
@@ -22,8 +22,4 @@ render it under `@xmachines/shared` instead of nested module pages.
22
22
 
23
23
  ## Returns
24
24
 
25
- `object`
26
-
27
- | Name | Type | Defined in |
28
- | ------ | ----- | ---------------------------------------------------------------------------------------------------------------------------- |
29
- | `test` | `any` | [config/vitest.ts:82](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/shared/config/vitest.ts#L82) |
25
+ `UserConfig`
@@ -6,7 +6,7 @@
6
6
  function xmAliases(importMetaUrl): Record<string, string>;
7
7
  ```
8
8
 
9
- Defined in: [src/index.ts:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.26/packages/shared/src/index.ts#L20)
9
+ Defined in: [index.ts:20](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.28/packages/shared/src/index.ts#L20)
10
10
 
11
11
  Build Vite/Vitest alias entries for all `@xmachines/*` workspace packages.
12
12
 
package/api/README.md CHANGED
@@ -32,27 +32,31 @@ Generated API documentation for the XMachines JavaScript/TypeScript packages.
32
32
 
33
33
  - [@xmachines/play](@xmachines/play/README.md)
34
34
  - [@xmachines/play-actor](@xmachines/play-actor/README.md)
35
+ - [@xmachines/play-actor-shared](@xmachines/play-actor-shared/README.md)
35
36
  - [@xmachines/play-dom](@xmachines/play-dom/README.md)
37
+ - [@xmachines/play-dom-demo](@xmachines/play-dom-demo/README.md)
36
38
  - [@xmachines/play-dom-router](@xmachines/play-dom-router/README.md)
37
39
  - [@xmachines/play-dom-router-demo](@xmachines/play-dom-router-demo/README.md)
38
40
  - [@xmachines/play-react](@xmachines/play-react/README.md)
41
+ - [@xmachines/play-react-demo](@xmachines/play-react-demo/README.md)
39
42
  - [@xmachines/play-react-router](@xmachines/play-react-router/README.md)
40
43
  - [@xmachines/play-react-router-demo](@xmachines/play-react-router-demo/README.md)
41
44
  - [@xmachines/play-router](@xmachines/play-router/README.md)
42
45
  - [@xmachines/play-signals](@xmachines/play-signals/README.md)
43
46
  - [@xmachines/play-solid](@xmachines/play-solid/README.md)
47
+ - [@xmachines/play-solid-demo](@xmachines/play-solid-demo/README.md)
44
48
  - [@xmachines/play-solid-router](@xmachines/play-solid-router/README.md)
45
49
  - [@xmachines/play-solid-router-demo](@xmachines/play-solid-router-demo/README.md)
46
50
  - [@xmachines/play-svelte](@xmachines/play-svelte/README.md)
51
+ - [@xmachines/play-svelte-demo](@xmachines/play-svelte-demo/README.md)
47
52
  - [@xmachines/play-svelte-spa-router](@xmachines/play-svelte-spa-router/README.md)
48
- - [@xmachines/play-svelte-spa-router-demo](@xmachines/play-svelte-spa-router-demo/README.md)
49
53
  - [@xmachines/play-sveltekit-router](@xmachines/play-sveltekit-router/README.md)
50
- - [@xmachines/play-sveltekit-router-demo](@xmachines/play-sveltekit-router-demo/README.md)
51
54
  - [@xmachines/play-tanstack-react-router](@xmachines/play-tanstack-react-router/README.md)
52
55
  - [@xmachines/play-tanstack-react-router-demo](@xmachines/play-tanstack-react-router-demo/README.md)
53
56
  - [@xmachines/play-tanstack-solid-router](@xmachines/play-tanstack-solid-router/README.md)
54
57
  - [@xmachines/play-tanstack-solid-router-demo](@xmachines/play-tanstack-solid-router-demo/README.md)
55
58
  - [@xmachines/play-vue](@xmachines/play-vue/README.md)
59
+ - [@xmachines/play-vue-demo](@xmachines/play-vue-demo/README.md)
56
60
  - [@xmachines/play-vue-router](@xmachines/play-vue-router/README.md)
57
61
  - [@xmachines/play-vue-router-demo](@xmachines/play-vue-router-demo/README.md)
58
62
  - [@xmachines/play-xstate](@xmachines/play-xstate/README.md)
package/api/llms.txt CHANGED
@@ -32,14 +32,11 @@
32
32
  - [@xmachines/play-xstate](@xmachines/play-xstate/README.md): XState-backed player and actor integration
33
33
  - [@xmachines/play-react](@xmachines/play-react/README.md): React renderer for Viewable actors
34
34
  - [@xmachines/play-solid](@xmachines/play-solid/README.md): Solid renderer for Viewable actors
35
- - [@xmachines/play-svelte](@xmachines/play-svelte/README.md): Svelte 5 renderer for Viewable actors
36
35
  - [@xmachines/play-vue](@xmachines/play-vue/README.md): Vue renderer for Viewable actors
37
36
  - [@xmachines/play-react-router](@xmachines/play-react-router/README.md): React Router bridge and provider for actor-driven navigation
38
37
  - [@xmachines/play-tanstack-react-router](@xmachines/play-tanstack-react-router/README.md): TanStack React Router bridge and provider
39
38
  - [@xmachines/play-solid-router](@xmachines/play-solid-router/README.md): Solid Router bridge and provider
40
39
  - [@xmachines/play-tanstack-solid-router](@xmachines/play-tanstack-solid-router/README.md): TanStack Solid Router bridge and provider
41
- - [@xmachines/play-sveltekit-router](@xmachines/play-sveltekit-router/README.md): SvelteKit router adapter for actor-driven navigation
42
- - [@xmachines/play-svelte-spa-router](@xmachines/play-svelte-spa-router/README.md): Svelte SPA (hash) router adapter for actor-driven navigation
43
40
  - [@xmachines/play-vue-router](@xmachines/play-vue-router/README.md): Vue Router bridge and provider
44
41
  - [@xmachines/shared](@xmachines/shared/README.md): Shared TypeScript, oxlint, and formatting configuration
45
42
 
@@ -1,81 +1,94 @@
1
+ <!-- generated-by: gsd-doc-writer -->
2
+
1
3
  # XMachines Examples
2
4
 
3
- Practical code examples demonstrating common XMachines patterns and use cases.
5
+ Practical code examples demonstrating current XMachines Play patterns and use cases.
4
6
 
5
7
  ## Learning Path
6
8
 
7
9
  ### Level 1: Basic Concepts
8
10
 
9
- Start with fundamental state machine concepts:
11
+ Start with the fundamental machine + actor pattern:
10
12
 
11
- - **[Basic State Machine](basic-state-machine.md)** - Simple two-state toggle machine
12
- - **[Traffic Light](traffic-light.md)** - Multi-state machine with cyclic transitions
13
- - **[Form Validation](form-validation.md)** - Validation with guards and conditional logic
13
+ - **[Basic State Machine](basic-state-machine.md)** `setup().createMachine()` + `definePlayer()` + TC39 Signals
14
+ - **[Traffic Light](traffic-light.md)** Multi-state machine with `meta.route` and `formatPlayRouteTransitions`
15
+ - **[Form Validation](form-validation.md)** Typed context mutations with `setup.assign`, guards, and `$bindState`
14
16
 
15
17
  ### Level 2: Routing Patterns
16
18
 
17
19
  Learn how state machines control navigation:
18
20
 
19
- - **[Routing Patterns](routing-patterns.md)** - State-driven routing and navigation guards
20
- - **[Multi-Router Integration](multi-router-integration.md)** - Framework-agnostic routing architecture
21
+ - **[Routing Patterns](routing-patterns.md)** `meta.route`, `play.route` events, `always` auth guards, and parameter routes
22
+ - **[Multi-Router Integration](multi-router-integration.md)** All 8 router adapters: provider pattern vs `connectRouter` pattern
21
23
 
22
24
  ### Level 3: Full Applications
23
25
 
24
- See complete working implementations demonstrating the current router integrations and all architectural invariants.
25
-
26
- ## Complete Examples
26
+ Complete working implementations of actor-authoritative routing with all architectural invariants enforced.
27
27
 
28
- Complete working applications demonstrating actor-authoritative routing, shared auth flows, and framework-specific rendering patterns:
28
+ ## Complete Demo Applications
29
29
 
30
30
  ### Framework-Agnostic Baseline
31
31
 
32
- - **[Vanilla JavaScript Router Demo](../api/@xmachines/play-dom-router-demo/README.md)** - Pure browser integration with the History API and DOM rendering; the lowest-level reference implementation for the router demos
32
+ - **[Vanilla JavaScript Router Demo](../api/@xmachines/play-dom-router-demo/README.md)** Pure browser integration: `connectRouter` + `connectRenderer` + DOM components. The lowest-level reference implementation.
33
33
 
34
34
  ### React Integrations
35
35
 
36
- - **[TanStack React Router Demo](../api/@xmachines/play-tanstack-react-router-demo/README.md)** - Canonical reference implementation showing all 5 invariants, comprehensive routing, authentication guards, and browser tests
37
- - **[React Router Demo](../api/@xmachines/play-react-router-demo/README.md)** - React Router v7 data-router integration using the same actor and shell patterns
36
+ - **[TanStack React Router Demo](../api/@xmachines/play-tanstack-react-router-demo/README.md)** Canonical reference implementation with all 5 invariants, comprehensive routing, authentication guards, and browser tests.
37
+ - **[React Router Demo](../api/@xmachines/play-react-router-demo/README.md)** React Router v7 data-router integration using a catch-all route and `ReactRouterBridge`.
38
38
 
39
39
  ### Vue Integration
40
40
 
41
- - **[Vue Router Demo](../api/@xmachines/play-vue-router-demo/README.md)** - Vue Composition API integration with the same shared auth and routing patterns
41
+ - **[Vue Router Demo](../api/@xmachines/play-vue-router-demo/README.md)** Vue Composition API integration with `PlayRouterProvider` and the shared `authMachine`.
42
42
 
43
43
  ### Svelte Integrations
44
44
 
45
- - **[SvelteKit Router Demo](../api/@xmachines/play-sveltekit-router-demo/README.md)** - SvelteKit-style routing with `afterNavigate`/`goto` and Svelte 5 runes
46
- - **[Svelte SPA Router Demo](../api/@xmachines/play-svelte-spa-router-demo/README.md)** - Hash-based SPA routing using `svelte-spa-router` with the same actor-authoritative flow
45
+ - **[SvelteKit Router Demo](../api/@xmachines/play-sveltekit-router-demo/README.md)** SvelteKit-style routing with `connectRouter` + `afterNavigate`/`goto` and Svelte 5 runes.
46
+ - **[Svelte SPA Router Demo](../api/@xmachines/play-svelte-spa-router-demo/README.md)** Hash-based SPA routing using `svelte-spa-router` with the same actor-authoritative flow.
47
47
 
48
- ### Solid Integrations
48
+ ### SolidJS Integrations
49
49
 
50
- - **[Solid Router Demo](../api/@xmachines/play-solid-router-demo/README.md)** - Solid fine-grained reactivity with `@solidjs/router` and provider-based routing
51
- - **[TanStack Solid Router Demo](../api/@xmachines/play-tanstack-solid-router-demo/README.md)** - Solid + TanStack router integration with the same actor-authoritative flow
50
+ - **[Solid Router Demo](../api/@xmachines/play-solid-router-demo/README.md)** `@solidjs/router` integration with `PlayRouterProvider` and SolidJS fine-grained reactivity.
51
+ - **[TanStack Solid Router Demo](../api/@xmachines/play-tanstack-solid-router-demo/README.md)** TanStack Router for Solid with dynamic route creation from the machine's route tree.
52
52
 
53
- ## Running Examples
53
+ ## Running the Code Examples
54
54
 
55
- All examples are written in TypeScript and can be run in:
56
-
57
- **Node.js:**
55
+ The conceptual examples in this directory are TypeScript snippets. To run them:
58
56
 
59
57
  ```bash
60
- npm install @xmachines/play
61
- npx tsx example.ts
62
- ```
58
+ # Install dependencies (from the monorepo root)
59
+ npm install @xmachines/play-xstate @xmachines/play-actor @xmachines/play-signals xstate
63
60
 
64
- **Browser:**
65
- Include via bundler (Vite, Webpack) or use browser platform package.
61
+ # Run with tsx
62
+ npx tsx my-example.ts
63
+ ```
66
64
 
67
- **Deno:**
65
+ To run a complete demo application, `cd` into the relevant package and start its dev server:
68
66
 
69
67
  ```bash
70
- deno run --allow-net example.ts
68
+ # Example: vanilla DOM router demo
69
+ cd packages/play-dom-router/examples/demo
70
+ npm install
71
+ npm run dev
71
72
  ```
72
73
 
74
+ ## Key Packages
75
+
76
+ | Package | Role |
77
+ | ------------------------- | ----------------------------------------------------------- |
78
+ | `@xmachines/play-xstate` | `definePlayer`, `formatPlayRouteTransitions`, `PlayerActor` |
79
+ | `@xmachines/play-actor` | `AbstractActor`, `typedSpec` |
80
+ | `@xmachines/play-signals` | TC39 Signals polyfill, `watchSignal` |
81
+ | `@xmachines/play-router` | `extractMachineRoutes`, `getRoutableRoutes` |
82
+ | `@xmachines/play-dom` | `connectRenderer`, `defineRegistry` (vanilla) |
83
+ | `@xmachines/play-react` | `PlayRenderer`, `defineRegistry` (React) |
84
+
73
85
  ## Related Documentation
74
86
 
75
- - **[Getting Started Guide](../guides/getting-started.md)** - First steps with XMachines
76
- - **[API Reference](../api/README.md)** - Complete API documentation
87
+ - **[Getting Started Guide](../guides/getting-started.md)** First steps with XMachines
88
+ - **[Installation Guide](../guides/installation.md)** Package installation and TypeScript setup
89
+ - **[API Reference](../api/README.md)** — Generated API docs for all public packages
90
+ - **[Play RFC](../rfc/play.md)** — Complete architectural specification
77
91
 
78
92
  ---
79
93
 
80
- **Contributing Examples:**
81
- Have a useful example to share? See the repository contribution guidelines.
94
+ **Contributing Examples:** Have a useful example to share? See the repository contribution guidelines.
@@ -1,70 +1,114 @@
1
+ <!-- generated-by: gsd-doc-writer -->
2
+
1
3
  # Basic State Machine
2
4
 
3
- Learn how to create a simple state machine with two states.
5
+ Learn how to define a simple toggle machine using the current XState v5 + XMachines `setup().createMachine()` + `definePlayer()` pattern.
4
6
 
5
7
  ## Use Case
6
8
 
7
- This example demonstrates a toggle switch or on/off button - the foundation for understanding state transitions in XMachines. It's the simplest possible state machine with just two states and one event type.
9
+ This example demonstrates a toggle switch the foundation for understanding state machines in XMachines. It is the simplest possible machine: two states, one event type, no router, no catalog.
8
10
 
9
11
  ## Complete Code
10
12
 
11
13
  ```typescript
12
- import { createMachine } from "xstate";
13
-
14
- // Define states
15
- type ToggleState = "off" | "on";
16
-
17
- // Define events
18
- type ToggleEvent = { type: "TOGGLE" };
14
+ import { setup } from "xstate";
15
+ import { definePlayer } from "@xmachines/play-xstate";
16
+
17
+ // 1. Declare types for context, events, and input via setup()
18
+ const toggleSetup = setup({
19
+ types: {
20
+ context: {} as { toggleCount: number },
21
+ events: {} as { type: "toggle" },
22
+ input: {} as { toggleCount?: number } | undefined,
23
+ },
24
+ });
19
25
 
20
- // Create machine
21
- const toggleMachine = createMachine<ToggleState, ToggleEvent>({
26
+ // 2. Create the machine using setup().createMachine()
27
+ const toggleMachine = toggleSetup.createMachine({
22
28
  id: "toggle",
23
29
  initial: "off",
30
+ context: ({ input }) => ({
31
+ toggleCount: input?.toggleCount ?? 0,
32
+ }),
24
33
  states: {
25
34
  off: {
26
35
  on: {
27
- TOGGLE: "on",
36
+ toggle: {
37
+ target: "on",
38
+ actions: toggleSetup.assign({
39
+ toggleCount: ({ context }) => context.toggleCount + 1,
40
+ }),
41
+ },
28
42
  },
29
43
  },
30
44
  on: {
31
45
  on: {
32
- TOGGLE: "off",
46
+ toggle: {
47
+ target: "off",
48
+ actions: toggleSetup.assign({
49
+ toggleCount: ({ context }) => context.toggleCount + 1,
50
+ }),
51
+ },
33
52
  },
34
53
  },
35
54
  },
36
55
  });
37
56
 
38
- // Usage
39
- let state = toggleMachine.initialState;
40
- console.log(state); // 'off'
57
+ // 3. Create a player factory
58
+ const createPlayer = definePlayer({ machine: toggleMachine });
59
+
60
+ // 4. Create and start an actor
61
+ const actor = createPlayer();
62
+ actor.start();
63
+
64
+ // 5. Read initial state via getSnapshot()
65
+ console.log(actor.getSnapshot().value); // "off"
66
+ console.log(actor.getSnapshot().context.toggleCount); // 0
41
67
 
42
- state = toggleMachine.transition(state, { type: "TOGGLE" });
43
- console.log(state); // 'on'
68
+ // 6. Read state via TC39 Signal
69
+ console.log(actor.state.get().value); // "off"
44
70
 
45
- state = toggleMachine.transition(state, { type: "TOGGLE" });
46
- console.log(state); // 'off'
71
+ // 7. Send events
72
+ actor.send({ type: "toggle" });
73
+ console.log(actor.getSnapshot().value); // "on"
74
+ console.log(actor.getSnapshot().context.toggleCount); // 1
75
+
76
+ actor.send({ type: "toggle" });
77
+ console.log(actor.getSnapshot().value); // "off"
78
+ console.log(actor.getSnapshot().context.toggleCount); // 2
79
+
80
+ // 8. Cleanup
81
+ actor.stop();
47
82
  ```
48
83
 
49
84
  ## Code Explanation
50
85
 
51
- 1. **Define TypeScript types** - Create union types for states (`'off' | 'on'`) and events (`{ type: 'TOGGLE' }`) to get type safety throughout your application.
86
+ 1. **`setup({ types })`** Declares TypeScript types for `context`, `events`, and `input` before the machine is created. This is the XState v5 typed entry point. Never pass type parameters directly to `createMachine`.
87
+
88
+ 2. **`toggleSetup.createMachine(...)`** — Creates the state machine. Using the scoped `toggleSetup.createMachine` (instead of the bare `createMachine` from xstate) ensures that guards and actions are type-checked against the declared types.
89
+
90
+ 3. **`toggleSetup.assign(...)`** — Assigns context mutations using the typed setup's `assign` helper. This provides full inference from the declared context type — no manual type assertions needed.
91
+
92
+ 4. **`definePlayer({ machine })`** — Wraps the machine in a factory. Calling `createPlayer()` returns a `PlayerActor` — XMachines' actor type that extends XState's actor with TC39 Signal reactivity and Play Architecture hooks.
93
+
94
+ 5. **`actor.start()`** — Activates the machine. Always call `start()` before sending events.
52
95
 
53
- 2. **Create machine with initial state** - Use `createMachine` with an `initial` property to specify which state the machine starts in.
96
+ 6. **`actor.getSnapshot()`** Returns the current XState snapshot synchronously. `.value` is the state name; `.context` is the typed context object.
54
97
 
55
- 3. **Define state transitions** - In the `states` config, each state has an `on` object mapping event types to target states.
98
+ 7. **`actor.state.get()`** TC39 Signal access to the current snapshot. Useful when wiring infrastructure that observes signals (renderers, router bridges). Equivalent to `actor.getSnapshot()` for one-time reads.
56
99
 
57
- 4. **Use the machine** - Call `transition(currentState, event)` to compute the next state based on the current state and incoming event.
100
+ 8. **Event types use dot-separated lowercase** `"toggle"` not `"TOGGLE"`. This matches the XMachines convention used throughout the codebase (e.g. `"auth.login"`, `"auth.logout"`, `"play.route"`).
58
101
 
59
102
  ## Key Concepts
60
103
 
61
- - **State**: The current mode or condition of the machine (`'off'` or `'on'`)
62
- - **Event**: A trigger that causes a state change (`{ type: 'TOGGLE' }`)
63
- - **Transition**: A rule defining how the machine moves from one state to another
64
- - **Type Safety**: TypeScript ensures you only use valid states and events, catching errors at compile time
104
+ - **`setup({ types })`**: The XState v5 typed entry point. Declares context, event, and input shapes before machine creation.
105
+ - **`definePlayer({ machine })`**: Creates a factory function that returns `PlayerActor` instances.
106
+ - **`actor.state`**: A `Signal.State<Snapshot>` TC39 Signals-based reactive handle on the machine snapshot.
107
+ - **`actor.getSnapshot()`**: Synchronous snapshot access use for one-time reads and TypeScript-typed context inspection.
108
+ - **Typed `assign`**: Always call `setup.assign(...)` (not the bare `assign` from xstate) for context mutations.
65
109
 
66
110
  ## Next Steps
67
111
 
68
- - **[Traffic Light Example](traffic-light.md)** - See how to handle multiple states with cyclic transitions
69
- - **[Form Validation Example](form-validation.md)** - Learn about guards and conditional transitions
70
- - **[API Documentation](../api/@xmachines/play/README.md)** - Explore the complete API reference
112
+ - **[Traffic Light Example](traffic-light.md)** — Multi-state machine with `meta.route` and `formatPlayRouteTransitions`
113
+ - **[Form Validation Example](form-validation.md)** Typed context mutations with `setup.assign` and guards
114
+ - **[Routing Patterns](routing-patterns.md)** Adding `meta.route` to states and using `play.route` events