@xmachines/docs 1.0.0-beta.9 → 1.0.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 (544) hide show
  1. package/README.md +137 -7
  2. package/api/@xmachines/play/README.md +160 -38
  3. package/api/@xmachines/play/classes/NonNullableError.md +189 -0
  4. package/api/@xmachines/play/classes/PlayError.md +251 -0
  5. package/api/@xmachines/play/functions/assertNonNullable.md +56 -0
  6. package/api/@xmachines/play/type-aliases/PlayEvent.md +6 -6
  7. package/api/@xmachines/play-actor/README.md +141 -160
  8. package/api/@xmachines/play-actor/classes/AbstractActor.md +91 -122
  9. package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +40 -0
  10. package/api/@xmachines/play-actor/functions/toAtomState.md +33 -0
  11. package/api/@xmachines/play-actor/functions/typedSpec.md +54 -0
  12. package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +46 -0
  13. package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +33 -0
  14. package/api/@xmachines/play-actor/interfaces/PlaySpec.md +28 -0
  15. package/api/@xmachines/play-actor/interfaces/Routable.md +6 -21
  16. package/api/@xmachines/play-actor/interfaces/Viewable.md +12 -6
  17. package/api/@xmachines/play-dom/README.md +384 -0
  18. package/api/@xmachines/play-dom/classes/PlayRenderer.md +115 -0
  19. package/api/@xmachines/play-dom/functions/createPlayUI.md +28 -0
  20. package/api/@xmachines/play-dom/functions/createRenderer.md +44 -0
  21. package/api/@xmachines/play-dom/functions/defineRegistry.md +26 -0
  22. package/api/@xmachines/play-dom/functions/renderSpec.md +67 -0
  23. package/api/@xmachines/play-dom/interfaces/ComponentContext.md +23 -0
  24. package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +34 -0
  25. package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +17 -0
  26. package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +28 -0
  27. package/api/@xmachines/play-dom/interfaces/EventHandle.md +15 -0
  28. package/api/@xmachines/play-dom/interfaces/MountOptions.md +18 -0
  29. package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +30 -0
  30. package/api/@xmachines/play-dom/interfaces/RenderSpecOptions.md +26 -0
  31. package/api/@xmachines/play-dom/interfaces/UIProviderOptions.md +32 -0
  32. package/api/@xmachines/play-dom/type-aliases/ActionFn.md +46 -0
  33. package/api/@xmachines/play-dom/type-aliases/Actions.md +18 -0
  34. package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +114 -0
  35. package/api/@xmachines/play-dom/type-aliases/CatalogHasActions.md +25 -0
  36. package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +26 -0
  37. package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +15 -0
  38. package/api/@xmachines/play-dom/type-aliases/ConfirmHandler.md +44 -0
  39. package/api/@xmachines/play-dom/type-aliases/DefineRegistryOptions.md +39 -0
  40. package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +20 -0
  41. package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +9 -0
  42. package/api/@xmachines/play-dom/type-aliases/DomSchema.md +9 -0
  43. package/api/@xmachines/play-dom/type-aliases/MountFn.md +27 -0
  44. package/api/@xmachines/play-dom/type-aliases/RenderErrorHandler.md +23 -0
  45. package/api/@xmachines/play-dom/type-aliases/SetState.md +30 -0
  46. package/api/@xmachines/play-dom/variables/schema.md +62 -0
  47. package/api/@xmachines/play-dom-router/README.md +271 -0
  48. package/api/@xmachines/play-dom-router/functions/connectRouter.md +43 -0
  49. package/api/@xmachines/{play-router → play-dom-router}/functions/createBrowserHistory.md +10 -2
  50. package/api/@xmachines/play-dom-router/functions/createRouteMap.md +39 -0
  51. package/api/@xmachines/play-dom-router/functions/createRouter.md +54 -0
  52. package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +176 -0
  53. package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +69 -0
  54. package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +15 -0
  55. package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +129 -0
  56. package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +68 -0
  57. package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +54 -0
  58. package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +121 -0
  59. package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +13 -0
  60. package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +27 -0
  61. package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +104 -0
  62. package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +28 -0
  63. package/api/@xmachines/play-react/README.md +185 -334
  64. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +46 -42
  65. package/api/@xmachines/play-react/functions/ActionProvider.md +21 -0
  66. package/api/@xmachines/play-react/functions/JSONUIProvider.md +21 -0
  67. package/api/@xmachines/play-react/functions/Renderer.md +21 -0
  68. package/api/@xmachines/play-react/functions/StateProvider.md +27 -0
  69. package/api/@xmachines/play-react/functions/ValidationProvider.md +21 -0
  70. package/api/@xmachines/play-react/functions/VisibilityProvider.md +21 -0
  71. package/api/@xmachines/play-react/functions/defineRegistry.md +49 -0
  72. package/api/@xmachines/play-react/functions/useActor.md +13 -0
  73. package/api/@xmachines/play-react/functions/useBoundProp.md +45 -0
  74. package/api/@xmachines/play-react/functions/usePlayView.md +32 -0
  75. package/api/@xmachines/play-react/functions/useSignalEffect.md +29 -20
  76. package/api/@xmachines/play-react/interfaces/ActionProviderProps.md +15 -0
  77. package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +27 -0
  78. package/api/@xmachines/play-react/interfaces/ComponentContext.md +37 -0
  79. package/api/@xmachines/play-react/interfaces/JSONUIProviderProps.md +22 -0
  80. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
  81. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +6 -6
  82. package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +26 -0
  83. package/api/@xmachines/play-react/interfaces/RendererProps.md +17 -0
  84. package/api/@xmachines/play-react/interfaces/StateProviderProps.md +16 -0
  85. package/api/@xmachines/play-react/interfaces/ValidationProviderProps.md +14 -0
  86. package/api/@xmachines/play-react/interfaces/ViewContextValue.md +20 -0
  87. package/api/@xmachines/play-react/interfaces/VisibilityProviderProps.md +13 -0
  88. package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +11 -0
  89. package/api/@xmachines/play-react/type-aliases/ComponentFn.md +36 -0
  90. package/api/@xmachines/play-react/type-aliases/RenderErrorHandler.md +23 -0
  91. package/api/@xmachines/play-react/variables/ActorProvider.md +33 -0
  92. package/api/@xmachines/play-react/variables/PlayRenderer.md +6 -56
  93. package/api/@xmachines/play-react/variables/PlayUIProvider.md +43 -0
  94. package/api/@xmachines/play-react-router/README.md +130 -114
  95. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +19 -242
  96. package/api/@xmachines/play-react-router/classes/RouteMap.md +48 -36
  97. package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +45 -0
  98. package/api/@xmachines/play-react-router/functions/createRouteMap.md +39 -0
  99. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +23 -12
  100. package/api/@xmachines/play-react-router/interfaces/PlayActor.md +68 -0
  101. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +22 -12
  102. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +32 -0
  103. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +25 -9
  104. package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +13 -0
  105. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +19 -9
  106. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +8 -8
  107. package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
  108. package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +32 -0
  109. package/api/@xmachines/play-router/README.md +275 -353
  110. package/api/@xmachines/play-router/classes/RouteMap.md +149 -0
  111. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +21 -221
  112. package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +32 -0
  113. package/api/@xmachines/play-router/functions/buildRouteTree.md +12 -2
  114. package/api/@xmachines/play-router/functions/createRouteMap.md +22 -36
  115. package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +46 -0
  116. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +14 -7
  117. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +10 -46
  118. package/api/@xmachines/play-router/functions/extractQuery.md +22 -0
  119. package/api/@xmachines/play-router/functions/extractRouteParams.md +54 -0
  120. package/api/@xmachines/play-router/functions/findRouteById.md +2 -2
  121. package/api/@xmachines/play-router/functions/findRouteByPath.md +2 -2
  122. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +2 -2
  123. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +2 -2
  124. package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +43 -0
  125. package/api/@xmachines/play-router/functions/isRouteReachable.md +38 -0
  126. package/api/@xmachines/play-router/functions/machineToGraph.md +19 -0
  127. package/api/@xmachines/play-router/functions/routeExists.md +2 -2
  128. package/api/@xmachines/play-router/functions/sanitizePathname.md +40 -0
  129. package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -9
  130. package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
  131. package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +13 -0
  132. package/api/@xmachines/play-router/interfaces/LocationLike.md +27 -0
  133. package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +15 -0
  134. package/api/@xmachines/play-router/interfaces/MachineNodeData.md +17 -0
  135. package/api/@xmachines/play-router/interfaces/PlayActor.md +68 -0
  136. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +22 -12
  137. package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +17 -0
  138. package/api/@xmachines/play-router/interfaces/RoutableActor.md +64 -0
  139. package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
  140. package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +13 -0
  141. package/api/@xmachines/play-router/interfaces/RouteMapping.md +27 -0
  142. package/api/@xmachines/play-router/interfaces/RouteMatch.md +12 -0
  143. package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
  144. package/api/@xmachines/play-router/interfaces/RouteObject.md +5 -5
  145. package/api/@xmachines/play-router/interfaces/RouteTree.md +8 -7
  146. package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +55 -0
  147. package/api/@xmachines/play-router/interfaces/RouterBridge.md +8 -8
  148. package/api/@xmachines/play-router/interfaces/WindowLike.md +65 -0
  149. package/api/@xmachines/play-router/type-aliases/MachineGraph.md +20 -0
  150. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
  151. package/api/@xmachines/play-signals/README.md +116 -65
  152. package/api/@xmachines/play-signals/functions/watchSignal.md +42 -0
  153. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +7 -5
  154. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +3 -3
  155. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +7 -5
  156. package/api/@xmachines/play-signals/interfaces/SignalState.md +4 -4
  157. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +5 -5
  158. package/api/@xmachines/play-signals/namespaces/Signal/README.md +1 -1
  159. package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +7 -7
  160. package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +8 -8
  161. package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +7 -7
  162. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/README.md +1 -1
  163. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +9 -9
  164. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +2 -2
  165. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +2 -2
  166. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +2 -2
  167. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +2 -2
  168. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +2 -2
  169. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +2 -2
  170. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +2 -2
  171. package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +2 -2
  172. package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +2 -2
  173. package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +2 -2
  174. package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +2 -2
  175. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +2 -2
  176. package/api/@xmachines/play-solid/README.md +196 -234
  177. package/api/@xmachines/play-solid/functions/ActionProvider.md +19 -0
  178. package/api/@xmachines/play-solid/functions/JSONUIProvider.md +21 -0
  179. package/api/@xmachines/play-solid/functions/Renderer.md +21 -0
  180. package/api/@xmachines/play-solid/functions/StateProvider.md +19 -0
  181. package/api/@xmachines/play-solid/functions/ValidationProvider.md +19 -0
  182. package/api/@xmachines/play-solid/functions/VisibilityProvider.md +20 -0
  183. package/api/@xmachines/play-solid/functions/defineRegistry.md +49 -0
  184. package/api/@xmachines/play-solid/functions/useAction.md +24 -0
  185. package/api/@xmachines/play-solid/functions/useActions.md +13 -0
  186. package/api/@xmachines/play-solid/functions/useActor.md +13 -0
  187. package/api/@xmachines/play-solid/functions/useBoundProp.md +45 -0
  188. package/api/@xmachines/play-solid/functions/useFieldValidation.md +29 -0
  189. package/api/@xmachines/play-solid/functions/useIsVisible.md +19 -0
  190. package/api/@xmachines/play-solid/functions/useOptionalValidation.md +13 -0
  191. package/api/@xmachines/play-solid/functions/usePlayView.md +30 -0
  192. package/api/@xmachines/play-solid/functions/useStateBinding.md +25 -0
  193. package/api/@xmachines/play-solid/functions/useStateStore.md +13 -0
  194. package/api/@xmachines/play-solid/functions/useStateValue.md +25 -0
  195. package/api/@xmachines/play-solid/functions/useVisibility.md +13 -0
  196. package/api/@xmachines/play-solid/interfaces/ActionProviderProps.md +12 -0
  197. package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +30 -0
  198. package/api/@xmachines/play-solid/interfaces/ComponentContext.md +37 -0
  199. package/api/@xmachines/play-solid/interfaces/DefineRegistryResult.md +15 -0
  200. package/api/@xmachines/play-solid/interfaces/JSONUIProviderProps.md +22 -0
  201. package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +26 -0
  202. package/api/@xmachines/play-solid/interfaces/RendererProps.md +17 -0
  203. package/api/@xmachines/play-solid/interfaces/StateProviderProps.md +13 -0
  204. package/api/@xmachines/play-solid/interfaces/ValidationProviderProps.md +11 -0
  205. package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +21 -0
  206. package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +11 -0
  207. package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +36 -0
  208. package/api/@xmachines/play-solid/type-aliases/ComponentRegistry.md +11 -0
  209. package/api/@xmachines/play-solid/type-aliases/RenderErrorHandler.md +23 -0
  210. package/api/@xmachines/play-solid/type-aliases/SetState.md +21 -0
  211. package/api/@xmachines/play-solid/type-aliases/VisibilityProviderProps.md +9 -0
  212. package/api/@xmachines/play-solid/variables/ActorContext.md +13 -0
  213. package/api/@xmachines/play-solid/variables/ActorProvider.md +27 -0
  214. package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -62
  215. package/api/@xmachines/play-solid/variables/PlayUIProvider.md +26 -0
  216. package/api/@xmachines/play-solid-router/README.md +151 -560
  217. package/api/@xmachines/play-solid-router/classes/RouteMap.md +31 -32
  218. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +27 -242
  219. package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +44 -0
  220. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +18 -11
  221. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +84 -115
  222. package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +68 -0
  223. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +22 -12
  224. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +30 -0
  225. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +25 -9
  226. package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +13 -0
  227. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +20 -7
  228. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +8 -8
  229. package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +34 -0
  230. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +8 -4
  231. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +22 -19
  232. package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +52 -0
  233. package/api/@xmachines/play-svelte/README.md +269 -0
  234. package/api/@xmachines/play-svelte/functions/defineRegistry.md +31 -0
  235. package/api/@xmachines/play-svelte/functions/getActorContext.md +21 -0
  236. package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +19 -0
  237. package/api/@xmachines/play-svelte/functions/setActorContext.md +19 -0
  238. package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +44 -0
  239. package/api/@xmachines/play-svelte/interfaces/BaseComponentProps.md +29 -0
  240. package/api/@xmachines/play-svelte/interfaces/ComponentContext.md +29 -0
  241. package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +24 -0
  242. package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +43 -0
  243. package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +24 -0
  244. package/api/@xmachines/play-svelte/type-aliases/ActionFn.md +30 -0
  245. package/api/@xmachines/play-svelte/type-aliases/Actions.md +17 -0
  246. package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -0
  247. package/api/@xmachines/play-svelte/type-aliases/ComponentFn.md +18 -0
  248. package/api/@xmachines/play-svelte/type-aliases/JSONUIProviderProps.md +7 -0
  249. package/api/@xmachines/play-svelte/type-aliases/PlayRenderer.md +9 -0
  250. package/api/@xmachines/play-svelte/type-aliases/RenderErrorHandler.md +23 -0
  251. package/api/@xmachines/play-svelte/type-aliases/SetState.md +21 -0
  252. package/api/@xmachines/play-svelte/variables/PlayRenderer.md +9 -0
  253. package/api/@xmachines/play-svelte-spa-router/README.md +199 -0
  254. package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +149 -0
  255. package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +32 -0
  256. package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +39 -0
  257. package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +17 -0
  258. package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +129 -0
  259. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +13 -0
  260. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +27 -0
  261. package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +104 -0
  262. package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +65 -0
  263. package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +9 -0
  264. package/api/@xmachines/play-sveltekit-router/README.md +211 -0
  265. package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +149 -0
  266. package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +32 -0
  267. package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +39 -0
  268. package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +13 -0
  269. package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +27 -0
  270. package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +129 -0
  271. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +13 -0
  272. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +27 -0
  273. package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +104 -0
  274. package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +9 -0
  275. package/api/@xmachines/play-tanstack-react-router/README.md +155 -126
  276. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +48 -36
  277. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +31 -252
  278. package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +45 -0
  279. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +22 -36
  280. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +23 -12
  281. package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +28 -0
  282. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +68 -0
  283. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +22 -12
  284. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +32 -0
  285. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +25 -9
  286. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +13 -0
  287. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +19 -9
  288. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +6 -6
  289. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +8 -8
  290. package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
  291. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +2 -2
  292. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +40 -18
  293. package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +34 -0
  294. package/api/@xmachines/play-tanstack-router/README.md +58 -0
  295. package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +131 -0
  296. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +57 -0
  297. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +100 -0
  298. package/api/@xmachines/play-tanstack-solid-router/README.md +215 -175
  299. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +31 -32
  300. package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +121 -0
  301. package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +44 -0
  302. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +18 -11
  303. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +68 -0
  304. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +22 -12
  305. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +31 -0
  306. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +23 -9
  307. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +13 -0
  308. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +14 -10
  309. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +8 -8
  310. package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +30 -0
  311. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +8 -4
  312. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +3 -3
  313. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +40 -18
  314. package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +33 -0
  315. package/api/@xmachines/play-vue/README.md +192 -210
  316. package/api/@xmachines/play-vue/functions/defineRegistry.md +32 -0
  317. package/api/@xmachines/play-vue/functions/getPlayViewContext.md +28 -0
  318. package/api/@xmachines/play-vue/functions/useActor.md +13 -0
  319. package/api/@xmachines/play-vue/functions/useBoundProp.md +45 -0
  320. package/api/@xmachines/play-vue/interfaces/ActionProviderProps.md +12 -0
  321. package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +25 -0
  322. package/api/@xmachines/play-vue/interfaces/ComponentContext.md +37 -0
  323. package/api/@xmachines/play-vue/interfaces/DefineRegistryResult.md +15 -0
  324. package/api/@xmachines/play-vue/interfaces/JSONUIProviderProps.md +21 -0
  325. package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +24 -0
  326. package/api/@xmachines/play-vue/interfaces/RendererProps.md +17 -0
  327. package/api/@xmachines/play-vue/interfaces/StateProviderProps.md +15 -0
  328. package/api/@xmachines/play-vue/interfaces/ValidationProviderProps.md +11 -0
  329. package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +21 -0
  330. package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +5 -0
  331. package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -0
  332. package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +16 -0
  333. package/api/@xmachines/play-vue/type-aliases/ComponentFn.md +35 -0
  334. package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +15 -0
  335. package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +22 -0
  336. package/api/@xmachines/play-vue/type-aliases/RenderErrorHandler.md +23 -0
  337. package/api/@xmachines/play-vue/variables/ActionProvider.md +64 -0
  338. package/api/@xmachines/play-vue/variables/JSONUIProvider.md +105 -0
  339. package/api/@xmachines/play-vue/variables/PlayRenderer.md +2 -2
  340. package/api/@xmachines/play-vue/variables/Renderer.md +88 -0
  341. package/api/@xmachines/play-vue/variables/StateProvider.md +79 -0
  342. package/api/@xmachines/play-vue/variables/ValidationProvider.md +55 -0
  343. package/api/@xmachines/play-vue/variables/VisibilityProvider.md +40 -0
  344. package/api/@xmachines/play-vue-router/README.md +173 -487
  345. package/api/@xmachines/play-vue-router/classes/RouteMap.md +56 -116
  346. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +23 -271
  347. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +26 -6
  348. package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +68 -0
  349. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +22 -12
  350. package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +13 -0
  351. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +20 -8
  352. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +8 -8
  353. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +8 -4
  354. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +12 -6
  355. package/api/@xmachines/play-xstate/README.md +178 -347
  356. package/api/@xmachines/play-xstate/classes/PlayerActor.md +161 -191
  357. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +31 -20
  358. package/api/@xmachines/play-xstate/functions/composeGuards.md +2 -2
  359. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +2 -2
  360. package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +38 -0
  361. package/api/@xmachines/play-xstate/functions/definePlayer.md +14 -63
  362. package/api/@xmachines/play-xstate/functions/deriveRoute.md +3 -3
  363. package/api/@xmachines/play-xstate/functions/eventMatches.md +2 -2
  364. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +3 -3
  365. package/api/@xmachines/play-xstate/functions/hasContext.md +2 -2
  366. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +2 -2
  367. package/api/@xmachines/play-xstate/functions/negateGuard.md +2 -2
  368. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +10 -14
  369. package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +22 -0
  370. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +12 -13
  371. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -13
  372. package/api/@xmachines/play-xstate/interfaces/RouteObject.md +17 -0
  373. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +2 -2
  374. package/api/@xmachines/play-xstate/type-aliases/Guard.md +2 -2
  375. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +3 -3
  376. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +10 -9
  377. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +15 -5
  378. package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +9 -0
  379. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +22 -6
  380. package/api/@xmachines/shared/README.md +95 -295
  381. package/api/@xmachines/shared/vite-aliases/README.md +11 -0
  382. package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +38 -0
  383. package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +27 -0
  384. package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +30 -0
  385. package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +42 -0
  386. package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +33 -0
  387. package/api/@xmachines/shared/vitest/README.md +12 -0
  388. package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +42 -0
  389. package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +34 -0
  390. package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +16 -0
  391. package/api/README.md +6 -7
  392. package/api/llms.txt +72 -23
  393. package/contributing/README.md +10 -0
  394. package/contributing/architecture.md +599 -0
  395. package/contributing/configuration.md +368 -0
  396. package/contributing/deployment.md +312 -0
  397. package/contributing/development.md +464 -0
  398. package/contributing/testing.md +453 -0
  399. package/examples/@xmachines/play-dom-demo/README.md +181 -0
  400. package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +24 -0
  401. package/examples/@xmachines/play-dom-demo/functions/initShell.md +24 -0
  402. package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +9 -0
  403. package/examples/@xmachines/play-dom-demo/variables/About.md +12 -0
  404. package/examples/@xmachines/play-dom-demo/variables/Contact.md +12 -0
  405. package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +13 -0
  406. package/examples/@xmachines/play-dom-demo/variables/Home.md +13 -0
  407. package/examples/@xmachines/play-dom-demo/variables/Login.md +13 -0
  408. package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +16 -0
  409. package/examples/@xmachines/play-dom-demo/variables/Navigation.md +13 -0
  410. package/examples/@xmachines/play-dom-demo/variables/Overview.md +13 -0
  411. package/examples/@xmachines/play-dom-demo/variables/Profile.md +13 -0
  412. package/examples/@xmachines/play-dom-demo/variables/Settings.md +13 -0
  413. package/examples/@xmachines/play-dom-demo/variables/Stats.md +13 -0
  414. package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +172 -0
  415. package/examples/@xmachines/play-dom-router-demo/README.md +145 -0
  416. package/examples/@xmachines/play-react-demo/README.md +187 -0
  417. package/examples/@xmachines/play-react-demo/functions/App.md +13 -0
  418. package/examples/@xmachines/play-react-demo/functions/DebugPanel.md +20 -0
  419. package/examples/@xmachines/play-react-demo/functions/HeaderNav.md +20 -0
  420. package/examples/@xmachines/play-react-demo/functions/Shell.md +22 -0
  421. package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +9 -0
  422. package/examples/@xmachines/play-react-demo/variables/About.md +14 -0
  423. package/examples/@xmachines/play-react-demo/variables/Contact.md +14 -0
  424. package/examples/@xmachines/play-react-demo/variables/Dashboard.md +15 -0
  425. package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +15 -0
  426. package/examples/@xmachines/play-react-demo/variables/Home.md +14 -0
  427. package/examples/@xmachines/play-react-demo/variables/Login.md +16 -0
  428. package/examples/@xmachines/play-react-demo/variables/NavBar.md +16 -0
  429. package/examples/@xmachines/play-react-demo/variables/NavBarView.md +15 -0
  430. package/examples/@xmachines/play-react-demo/variables/Navigation.md +14 -0
  431. package/examples/@xmachines/play-react-demo/variables/Overview.md +14 -0
  432. package/examples/@xmachines/play-react-demo/variables/Profile.md +14 -0
  433. package/examples/@xmachines/play-react-demo/variables/Settings.md +14 -0
  434. package/examples/@xmachines/play-react-demo/variables/Shell.md +18 -0
  435. package/examples/@xmachines/play-react-demo/variables/Stats.md +14 -0
  436. package/examples/@xmachines/play-react-demo/variables/authCatalog.md +172 -0
  437. package/examples/@xmachines/play-react-router-demo/README.md +151 -0
  438. package/examples/@xmachines/play-solid-demo/README.md +187 -0
  439. package/examples/@xmachines/play-solid-demo/functions/App.md +13 -0
  440. package/examples/@xmachines/play-solid-demo/functions/DebugPanel.md +20 -0
  441. package/examples/@xmachines/play-solid-demo/functions/HeaderNav.md +20 -0
  442. package/examples/@xmachines/play-solid-demo/functions/Shell.md +22 -0
  443. package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +9 -0
  444. package/examples/@xmachines/play-solid-demo/variables/About.md +9 -0
  445. package/examples/@xmachines/play-solid-demo/variables/Contact.md +9 -0
  446. package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +9 -0
  447. package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +15 -0
  448. package/examples/@xmachines/play-solid-demo/variables/Home.md +9 -0
  449. package/examples/@xmachines/play-solid-demo/variables/Login.md +9 -0
  450. package/examples/@xmachines/play-solid-demo/variables/NavBar.md +11 -0
  451. package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +15 -0
  452. package/examples/@xmachines/play-solid-demo/variables/Navigation.md +9 -0
  453. package/examples/@xmachines/play-solid-demo/variables/Overview.md +9 -0
  454. package/examples/@xmachines/play-solid-demo/variables/Profile.md +9 -0
  455. package/examples/@xmachines/play-solid-demo/variables/Settings.md +9 -0
  456. package/examples/@xmachines/play-solid-demo/variables/Shell.md +17 -0
  457. package/examples/@xmachines/play-solid-demo/variables/Stats.md +9 -0
  458. package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +172 -0
  459. package/examples/@xmachines/play-solid-router-demo/README.md +137 -0
  460. package/examples/@xmachines/play-svelte-demo/README.md +143 -0
  461. package/examples/@xmachines/play-svelte-demo/type-aliases/App.md +9 -0
  462. package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +9 -0
  463. package/examples/@xmachines/play-svelte-demo/variables/App.md +9 -0
  464. package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +172 -0
  465. package/examples/@xmachines/play-svelte-spa-router-demo/README.md +129 -0
  466. package/examples/@xmachines/play-sveltekit-router-demo/README.md +133 -0
  467. package/examples/@xmachines/play-tanstack-react-router-demo/README.md +156 -0
  468. package/examples/@xmachines/play-tanstack-solid-router-demo/README.md +139 -0
  469. package/examples/@xmachines/play-vue-demo/README.md +183 -0
  470. package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +9 -0
  471. package/examples/@xmachines/play-vue-demo/variables/App.md +9 -0
  472. package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +172 -0
  473. package/examples/@xmachines/play-vue-router-demo/README.md +139 -0
  474. package/examples/README.md +78 -30
  475. package/examples/basic-state-machine.md +75 -31
  476. package/examples/form-validation.md +261 -118
  477. package/examples/multi-router-integration.md +314 -194
  478. package/examples/routing-patterns.md +230 -189
  479. package/examples/traffic-light.md +114 -65
  480. package/guides/README.md +9 -21
  481. package/guides/actor-model.md +180 -0
  482. package/guides/getting-started.md +619 -137
  483. package/guides/signals.md +166 -0
  484. package/guides/state-machines.md +284 -0
  485. package/package.json +18 -7
  486. package/rfc/broker.md +100 -0
  487. package/rfc/browser.md +44 -0
  488. package/rfc/cli.md +118 -0
  489. package/rfc/git.md +61 -0
  490. package/rfc/mcp.md +43 -0
  491. package/rfc/node.md +36 -0
  492. package/rfc/play.md +472 -0
  493. package/rfc/rest.md +102 -0
  494. package/rfc/run.md +159 -0
  495. package/rfc/streams.md +168 -0
  496. package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +0 -17
  497. package/api/@xmachines/play-catalog/README.md +0 -331
  498. package/api/@xmachines/play-catalog/functions/defineCatalog.md +0 -98
  499. package/api/@xmachines/play-catalog/functions/defineComponents.md +0 -134
  500. package/api/@xmachines/play-catalog/type-aliases/Catalog.md +0 -48
  501. package/api/@xmachines/play-catalog/type-aliases/ComponentsFor.md +0 -20
  502. package/api/@xmachines/play-catalog/type-aliases/InferComponentProps.md +0 -65
  503. package/api/@xmachines/play-catalog/type-aliases/NoExtraKeys.md +0 -17
  504. package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +0 -15
  505. package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +0 -19
  506. package/api/@xmachines/play-react-router-demo/README.md +0 -137
  507. package/api/@xmachines/play-router/classes/BaseRouteMap.md +0 -142
  508. package/api/@xmachines/play-router/functions/connectRouter.md +0 -67
  509. package/api/@xmachines/play-router/functions/crawlMachine.md +0 -92
  510. package/api/@xmachines/play-router/functions/createRouter.md +0 -76
  511. package/api/@xmachines/play-router/functions/extractRoute.md +0 -45
  512. package/api/@xmachines/play-router/interfaces/BaseRouteMapping.md +0 -27
  513. package/api/@xmachines/play-router/interfaces/BrowserHistory.md +0 -172
  514. package/api/@xmachines/play-router/interfaces/BrowserWindow.md +0 -69
  515. package/api/@xmachines/play-router/interfaces/ConnectRouterOptions.md +0 -13
  516. package/api/@xmachines/play-router/interfaces/RouteMap.md +0 -56
  517. package/api/@xmachines/play-router/interfaces/StateVisit.md +0 -15
  518. package/api/@xmachines/play-router/interfaces/VanillaRouter.md +0 -28
  519. package/api/@xmachines/play-router-demo/README.md +0 -137
  520. package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +0 -15
  521. package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +0 -19
  522. package/api/@xmachines/play-solid-router-demo/README.md +0 -127
  523. package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +0 -19
  524. package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +0 -38
  525. package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +0 -33
  526. package/api/@xmachines/play-tanstack-react-router/variables/extractMachineRoutes.md +0 -64
  527. package/api/@xmachines/play-tanstack-react-router-demo/README.md +0 -126
  528. package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +0 -343
  529. package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +0 -19
  530. package/api/@xmachines/play-tanstack-solid-router-demo/README.md +0 -126
  531. package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +0 -14
  532. package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +0 -201
  533. package/api/@xmachines/play-vue-router-demo/README.md +0 -133
  534. package/api/@xmachines/play-xstate/functions/mergeViewProps.md +0 -26
  535. package/api/@xmachines/play-xstate/functions/stateMatches.md +0 -25
  536. package/api/@xmachines/play-xstate/functions/validateComponentBinding.md +0 -39
  537. package/api/@xmachines/play-xstate/functions/validateViewProps.md +0 -80
  538. package/api/@xmachines/play-xstate/interfaces/CatalogEntry.md +0 -16
  539. package/api/@xmachines/play-xstate/type-aliases/Catalog.md +0 -21
  540. package/api/@xmachines/play-xstate/type-aliases/ValidationResult.md +0 -17
  541. package/api/@xmachines/play-xstate/type-aliases/ViewMergeContext.md +0 -35
  542. package/api/@xmachines/shared/functions/defineXmVitestConfig.md +0 -29
  543. package/api/@xmachines/shared/functions/xmAliases.md +0 -24
  544. package/guides/installation.md +0 -323
@@ -0,0 +1,166 @@
1
+ # Understanding TC39 Signals in XMachines
2
+
3
+ TC39 Signals are the reactive substrate connecting actors to the outside world in XMachines. This page explains what they are, why XMachines uses them instead of observables or callbacks, and how the three Signal primitives map to distinct roles in the architecture.
4
+
5
+ After reading this, you will understand why infrastructure never reads state directly from an actor — and what it does instead.
6
+
7
+ ---
8
+
9
+ ## What problem Signals solve
10
+
11
+ When a state machine transitions, several things may need to react: the URL bar might update, a router might navigate, a renderer might swap views. The naive approach is to let each of those consumers call `actor.getSnapshot()` whenever they feel like it — or to have the actor call back into each consumer via callbacks.
12
+
13
+ Both approaches break down:
14
+
15
+ - **Polling** (`getSnapshot()` on a timer or event) is racy: consumers can observe inconsistent intermediate states during a transition sequence.
16
+ - **Callbacks** create direct dependencies between the actor and infrastructure, violating the architectural invariant that business logic must not depend on runtime APIs.
17
+
18
+ TC39 Signals solve this with a **push–pull model**:
19
+
20
+ - The actor **pushes** state changes into signals synchronously on every transition.
21
+ - Consumers **pull** computed values lazily from signals — only when they actually need the value.
22
+ - Changes propagate **atomically**, so no consumer ever sees a half-updated state.
23
+
24
+ This model is sometimes called _glitch-free reactivity_: intermediate invalid states never escape to the environment.
25
+
26
+ ---
27
+
28
+ ## The three Signal primitives
29
+
30
+ XMachines uses three primitives from the [TC39 Signals proposal](https://github.com/tc39/proposal-signals), accessed via [`@xmachines/play-signals`](../api/@xmachines/play-signals/README.md):
31
+
32
+ ### `Signal.State` — writable values
33
+
34
+ `Signal.State<T>` holds a single mutable value. Only the actor (or code it explicitly delegates to) writes to it. Everything else reads from it.
35
+
36
+ ```typescript
37
+ import { Signal } from "@xmachines/play-signals";
38
+
39
+ const count = new Signal.State(0);
40
+
41
+ count.set(1); // write
42
+ count.get(); // read → 1
43
+ ```
44
+
45
+ In XMachines, `actor.state` is a `Signal.State<Snapshot>`. The actor updates it on every XState transition. Infrastructure reads it — never writes it.
46
+
47
+ ### `Signal.Computed` — derived values
48
+
49
+ `Signal.Computed<T>` derives a value from one or more other signals. It recomputes only when its dependencies change — and only when something reads it (lazy evaluation).
50
+
51
+ ```typescript
52
+ const route = new Signal.Computed(() => {
53
+ const snapshot = actor.state.get();
54
+ return snapshot.getMeta()?.route ?? null;
55
+ });
56
+ ```
57
+
58
+ In XMachines, `actor.currentRoute` is a `Signal.Computed<string | null>`. Router adapters read it to know which URL to push — they do not compute the route themselves. Route derivation stays in the actor where the business logic lives.
59
+
60
+ ### `Signal.subtle.Watcher` — reactive observation
61
+
62
+ `Signal.subtle.Watcher` is the low-level primitive for reacting to signal changes. When a watched signal's value changes, the watcher's `notify` callback fires synchronously. You then schedule the actual work with `queueMicrotask` to avoid re-entrant signal reads.
63
+
64
+ ```typescript
65
+ const watcher = new Signal.subtle.Watcher(() => {
66
+ queueMicrotask(() => {
67
+ const pending = watcher.getPending();
68
+ for (const signal of pending) {
69
+ signal.get(); // re-read to flush
70
+ }
71
+ watcher.watch(...pending); // re-arm for next change
72
+ });
73
+ });
74
+
75
+ watcher.watch(actor.currentRoute);
76
+ actor.currentRoute.get(); // initial read required to arm the watcher
77
+ ```
78
+
79
+ Watcher notifications are **one-shot**: if you do not call `watch()` again after draining pending signals, you will miss subsequent changes.
80
+
81
+ Router bridges and renderers use `Signal.subtle.Watcher` internally. For most application code, the [`watchSignal()`](../api/@xmachines/play-signals/functions/watchSignal.md) helper covers the common case.
82
+
83
+ ---
84
+
85
+ ## [`watchSignal()`](../api/@xmachines/play-signals/functions/watchSignal.md) — the safe helper
86
+
87
+ [`@xmachines/play-signals`](../api/@xmachines/play-signals/README.md) exports [`watchSignal(signal, onValue)`](../api/@xmachines/play-signals/functions/watchSignal.md) as a lifecycle-safe wrapper around the raw watcher pattern. It returns a cleanup function:
88
+
89
+ ```typescript
90
+ import { watchSignal } from "@xmachines/play-signals";
91
+
92
+ const stop = watchSignal(actor.currentRoute, (route) => {
93
+ console.log("Route is now:", route);
94
+ });
95
+
96
+ // Later — stops observing and prevents use-after-free
97
+ stop();
98
+ ```
99
+
100
+ [`watchSignal()`](../api/@xmachines/play-signals/functions/watchSignal.md) handles three subtle correctness concerns for you:
101
+
102
+ | Concern | What happens without it | How [`watchSignal`](../api/@xmachines/play-signals/functions/watchSignal.md) handles it |
103
+ | ---------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------- |
104
+ | **Use-after-free** | Callback fires after component unmounts | `disposed` flag checked before invoking callback |
105
+ | **Coalescing** | Rapid synchronous changes cause multiple callbacks | `needsEnqueue` guard — only one microtask queued per synchronous burst |
106
+ | **Idempotent cleanup** | Calling the cleanup twice throws | Safe to call multiple times |
107
+
108
+ Use [`watchSignal()`](../api/@xmachines/play-signals/functions/watchSignal.md) in framework adapters and application code. Use the raw `Signal.subtle.Watcher` only when building infrastructure that needs to watch multiple signals independently.
109
+
110
+ ---
111
+
112
+ ## Why not observables (RxJS) or event emitters?
113
+
114
+ The XMachines architecture chose TC39 Signals over observable libraries and event emitters for three reasons:
115
+
116
+ **1. Standardization.** Signals are a Stage 1 TC39 proposal. They are not tied to any library, bundler, or framework. Isolating the polyfill behind [`@xmachines/play-signals`](../api/@xmachines/play-signals/README.md) means the entire ecosystem can migrate to native signals when the proposal lands, with a single package update.
117
+
118
+ **2. Synchronous atomic propagation.** RxJS streams are asynchronous by default. Event emitters fire immediately but serially — a listener registered halfway through a sequence can see inconsistent state. Signals propagate atomically: all computeds update before any watcher fires.
119
+
120
+ **3. Pull-based evaluation.** Observables push values to every subscriber immediately. Signals are lazy: `Signal.Computed` does not recompute until something reads it. An adapter that is not currently mounted does not pay the cost of computing derived values.
121
+
122
+ ---
123
+
124
+ ## The five Signal invariants in XMachines
125
+
126
+ The Play RFC defines five invariants that govern how signals are used:
127
+
128
+ | Invariant | What it means in practice |
129
+ | ---------------------------------- | ----------------------------------------------------------------------------------------------------------- |
130
+ | **INV-01: Actor Authority** | Only actor code writes to `actor.state`. Never write to it from infrastructure. |
131
+ | **INV-04: Passive Infrastructure** | Routers and renderers read signals and forward events. They never decide state transitions. |
132
+ | **INV-05: Signal-Only Reactivity** | Cross-boundary communication uses signals. Infrastructure does not poll `getSnapshot()`. |
133
+ | **INV-03: No Direct Queries** | Infrastructure reads from signals, not from snapshot methods, outside of actor code. |
134
+ | **INV-02: Strict Separation** | Business logic (`machine` definition) never imports browser APIs, routing libraries, or framework packages. |
135
+
136
+ ---
137
+
138
+ ## Cleanup is mandatory
139
+
140
+ Signals do not clean themselves up when they go out of scope. Every watcher you create must be explicitly disposed when the consuming component or adapter unmounts.
141
+
142
+ - Framework lifecycle hooks (`useEffect` cleanup in React, `onUnmounted` in Vue, `onCleanup` in Solid) must call `unwatch()` or the cleanup returned by [`watchSignal()`](../api/@xmachines/play-signals/functions/watchSignal.md).
143
+ - Router bridge `disconnect()` methods must unwatch all signal subscriptions.
144
+ - If you use the raw `Signal.subtle.Watcher` API, pair every `watch()` call with `unwatch()` in teardown.
145
+
146
+ Failing to clean up watchers causes memory leaks and stale callbacks firing after the consumer is gone.
147
+
148
+ ---
149
+
150
+ ## Summary
151
+
152
+ | Primitive | Role in XMachines | Who uses it |
153
+ | -------------------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------- |
154
+ | `Signal.State` | Actor output: writable snapshot and view state | Actor writes; infrastructure reads |
155
+ | `Signal.Computed` | Lazy derivations: routes, view specs | Actor defines; adapters read |
156
+ | `Signal.subtle.Watcher` | Low-level reactive observation | Framework adapters, router bridges |
157
+ | [`watchSignal()`](../api/@xmachines/play-signals/functions/watchSignal.md) | Lifecycle-safe single-signal subscription | Application code, adapter code |
158
+
159
+ ## See also
160
+
161
+ - [Understanding the Actor Model](actor-model.md) — why the actor owns all signal writes
162
+ - [Understanding State Machines](state-machines.md) — how state nodes produce the metadata that signals derive
163
+ - [Getting Started](getting-started.md) — hands-on walkthrough using signals to observe an actor
164
+ - [@xmachines/play-signals](../api/@xmachines/play-signals/README.md) — API reference
165
+ - [Play RFC](../rfc/play.md) — architectural specification
166
+ - [TC39 Signals proposal](https://github.com/tc39/proposal-signals) — upstream proposal
@@ -0,0 +1,284 @@
1
+ # Understanding State Machines in XMachines
2
+
3
+ XMachines uses XState v5 as its state machine engine. This page explains what finite state machines are, how XMachines extends them with routing and view metadata, and why this design eliminates an entire category of bugs common in traditional frontend architecture.
4
+
5
+ After reading this, you will understand what a machine definition actually encodes — and why state machines are a better unit of business logic than component-level state or ad-hoc if/else trees.
6
+
7
+ ---
8
+
9
+ ## What a finite state machine is
10
+
11
+ A finite state machine (FSM) is a model of computation with three properties:
12
+
13
+ 1. **It is always in exactly one state** from a finite set of possible states.
14
+ 2. **It transitions between states only in response to events**.
15
+ 3. **The same event in different states can produce different outcomes** (or no transition at all).
16
+
17
+ These three properties, taken together, make behavior _deterministic and exhaustive_. You cannot end up in an unlisted state. You cannot receive an event that produces an unspecified outcome — unhandled events are simply ignored.
18
+
19
+ In traditional component-level state (e.g., boolean flags, `useState` combinations), you typically end up managing _n_ booleans for _n_ conditions. With _n_ booleans, you have 2^n possible combinations — and only a handful of them are actually valid. State machines force you to enumerate only the valid states.
20
+
21
+ **Example:** A login flow with two booleans (`isLoading`, `isError`) has four combinations: `{false,false}`, `{true,false}`, `{false,true}`, `{true,true}`. The last one — loading and error simultaneously — is impossible in practice, but the code has no way to rule it out. A state machine with states `idle | loading | success | error` makes the impossible unrepresentable.
22
+
23
+ ---
24
+
25
+ ## How XMachines uses XState v5
26
+
27
+ XMachines wraps XState v5 via [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md). You define machines using XState's `setup().createMachine()` API:
28
+
29
+ ```typescript
30
+ import { setup } from "xstate";
31
+
32
+ const authSetup = setup({
33
+ types: {
34
+ context: {} as { username: string | null },
35
+ events: {} as { type: "auth.login"; username: string } | { type: "auth.logout" },
36
+ input: {} as undefined,
37
+ },
38
+ });
39
+
40
+ const authMachine = authSetup.createMachine({
41
+ id: "auth",
42
+ initial: "unauthenticated",
43
+ context: { username: null },
44
+ states: {
45
+ unauthenticated: {
46
+ on: {
47
+ "auth.login": {
48
+ target: "authenticated",
49
+ actions: authSetup.assign({
50
+ username: ({ event }) => event.username,
51
+ }),
52
+ },
53
+ },
54
+ },
55
+ authenticated: {
56
+ on: {
57
+ "auth.logout": {
58
+ target: "unauthenticated",
59
+ actions: authSetup.assign({ username: null }),
60
+ },
61
+ },
62
+ },
63
+ },
64
+ });
65
+ ```
66
+
67
+ Key patterns:
68
+
69
+ - **Always use `setup({ types })`** before `createMachine`. The type declarations let TypeScript check that your events, context fields, and actions are consistent throughout the machine.
70
+ - **Use `setup.assign()`**, not the bare `assign` from xstate. This keeps the type checker aware of which context fields the action touches.
71
+ - **Event names use lowercase dot-separated namespaces**: `"auth.login"`, `"play.route"`, `"form.submit"`. This convention makes the event log readable and avoids collisions.
72
+
73
+ ---
74
+
75
+ ## State node metadata: routing and views
76
+
77
+ XMachines extends XState's `meta` field on each state node. This is where routing intent and view structure live:
78
+
79
+ ```typescript
80
+ import { typedSpec } from "@xmachines/play-actor";
81
+
82
+ const appMachine = setup({/* ... */}).createMachine({
83
+ id: "app",
84
+ initial: "home",
85
+ states: {
86
+ home: {
87
+ meta: {
88
+ route: "/",
89
+ view: typedSpec({
90
+ root: "root",
91
+ elements: {
92
+ root: { type: "HomePage", props: { title: "Welcome" }, children: [] },
93
+ },
94
+ }),
95
+ },
96
+ },
97
+ login: {
98
+ meta: {
99
+ route: "/login",
100
+ view: typedSpec({
101
+ root: "root",
102
+ elements: {
103
+ root: { type: "LoginPage", props: { title: "Sign in" }, children: [] },
104
+ },
105
+ }),
106
+ },
107
+ },
108
+ dashboard: {
109
+ meta: {
110
+ route: "/dashboard",
111
+ view: typedSpec({
112
+ root: "root",
113
+ elements: {
114
+ root: { type: "DashboardPage", props: { title: "Overview" }, children: [] },
115
+ },
116
+ }),
117
+ },
118
+ },
119
+ },
120
+ });
121
+ ```
122
+
123
+ `meta.route` is a string path. When the machine enters a state, `actor.currentRoute` (a `Signal.Computed`) derives this path and emits it. The router bridge reads it and updates the URL.
124
+
125
+ `meta.view` is a [`PlaySpec`](../api/@xmachines/play-actor/interfaces/PlaySpec.md) — a `@xmachines/json-render-core` spec object describing what to render. Use `typedSpec<TContext>(...)` from [`@xmachines/play-actor`](../api/@xmachines/play-actor/README.md) to validate `contextProps` entries at compile time. When the machine enters a state, `actor.currentView` is updated with this spec. The renderer reads it and projects it through framework components.
126
+
127
+ **The machine is the single source of truth for both routing and views.** There is no separate route configuration file. There is no switch statement in a component deciding what to render based on the URL. The state machine encodes all of that.
128
+
129
+ ---
130
+
131
+ ## [`formatPlayRouteTransitions`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md) — automatic route event wiring
132
+
133
+ For routing to work, the machine must respond to `play.route` events (sent by router bridges when the user navigates). Writing these transitions by hand is mechanical:
134
+
135
+ ```typescript
136
+ // Without formatPlayRouteTransitions — verbose and repetitive
137
+ states: {
138
+ home: {
139
+ on: {
140
+ "play.route": [
141
+ { guard: ({ event }) => event.to === "#login", target: "login" },
142
+ { guard: ({ event }) => event.to === "#dashboard", target: "dashboard" },
143
+ ],
144
+ },
145
+ meta: { route: "/" },
146
+ },
147
+ // ... repeated for every state
148
+ }
149
+ ```
150
+
151
+ [`formatPlayRouteTransitions`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md) from [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) generates these transitions automatically from the `id` and `meta.route` fields you already have:
152
+
153
+ ```typescript
154
+ import { formatPlayRouteTransitions } from "@xmachines/play-xstate";
155
+
156
+ const appMachine = setup({/* ... */}).createMachine(
157
+ formatPlayRouteTransitions({
158
+ id: "app",
159
+ initial: "home",
160
+ states: {
161
+ home: { id: "home", meta: { route: "/" } },
162
+ login: { id: "login", meta: { route: "/login" } },
163
+ dashboard: { id: "dashboard", meta: { route: "/dashboard" } },
164
+ },
165
+ }),
166
+ );
167
+ ```
168
+
169
+ [`formatPlayRouteTransitions`](../api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md) inspects all state nodes with a `meta.route` and generates the corresponding `play.route` guard transitions. The machine's context must include `params` and `query` fields (populated by the router bridge when params or query strings are present):
170
+
171
+ ```typescript
172
+ types: {
173
+ context: {} as {
174
+ params: Record<string, string>;
175
+ query: Record<string, string>;
176
+ // ... other context fields
177
+ },
178
+ events: {} as PlayRouteEvent | OtherEvents,
179
+ }
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Guards — the actor's authority
185
+
186
+ Guards are the mechanism by which the actor controls whether a transition occurs. They are pure functions of `{ context, event }` that return a boolean.
187
+
188
+ ```typescript
189
+ const authSetup = setup({
190
+ guards: {
191
+ isAuthenticated: ({ context }) => context.isAuthenticated,
192
+ isAdmin: ({ context }) => context.role === "admin",
193
+ },
194
+ });
195
+ ```
196
+
197
+ Guards are evaluated by XState before a transition fires. If the guard returns `false`, the transition does not occur — the machine stays in its current state and the `play.route` event is discarded. The router bridge then sees that `actor.currentRoute` has not changed and corrects the URL back to the current valid route.
198
+
199
+ This is the **Actor Authority** invariant in practice: the machine decides, infrastructure adjusts.
200
+
201
+ XMachines provides guard combinators in [`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md) for composing complex conditions:
202
+
203
+ | Function | What it does |
204
+ | --------------------------------------------------------------------------------------------------- | --------------------------------------- |
205
+ | [`composeGuards(...guards)`](../api/@xmachines/play-xstate/functions/composeGuards.md) | AND — all guards must pass |
206
+ | [`composeGuardsOr(...guards)`](../api/@xmachines/play-xstate/functions/composeGuardsOr.md) | OR — any guard must pass |
207
+ | [`negateGuard(guard)`](../api/@xmachines/play-xstate/functions/negateGuard.md) | NOT — inverts the guard result |
208
+ | [`hasContext(key)`](../api/@xmachines/play-xstate/functions/hasContext.md) | Checks that a context field is non-null |
209
+ | [`contextFieldMatches(key, value)`](../api/@xmachines/play-xstate/functions/contextFieldMatches.md) | Checks a context field against a value |
210
+ | [`eventMatches(type)`](../api/@xmachines/play-xstate/functions/eventMatches.md) | Checks the event type |
211
+
212
+ ---
213
+
214
+ ## Context — persistent state across transitions
215
+
216
+ Context is the machine's persistent data store. It survives transitions and can be read and updated by actions:
217
+
218
+ ```typescript
219
+ // Context is defined in setup({ types })
220
+ types: {
221
+ context: {} as {
222
+ isAuthenticated: boolean;
223
+ username: string | null;
224
+ loginAttempts: number;
225
+ },
226
+ },
227
+
228
+ // Actions mutate context via assign
229
+ actions: {
230
+ recordLoginFailure: assign({
231
+ loginAttempts: ({ context }) => context.loginAttempts + 1,
232
+ }),
233
+ },
234
+ ```
235
+
236
+ Context is accessed in guards, actions, and when computing routes or views. It is not directly observable from outside the actor via signals — only the derived signals (`state`, `currentRoute`, `currentView`) are public. If you need to expose a context field reactively, add a `Signal.Computed` to the actor that derives from `actor.state`.
237
+
238
+ ---
239
+
240
+ ## Snapshots and restoration
241
+
242
+ A snapshot is a point-in-time serialisation of the machine's current state and context. XState produces snapshots in a JSON-compatible format:
243
+
244
+ ```typescript
245
+ const snapshot = actor.getSnapshot();
246
+ // snapshot.value → current state node name, e.g. "dashboard"
247
+ // snapshot.context → current context object
248
+
249
+ // Stop and serialize
250
+ actor.stop();
251
+ const saved = JSON.stringify(snapshot);
252
+
253
+ // Restore
254
+ const restored = JSON.parse(saved);
255
+ const actor = createPlayer(undefined, { snapshot: restored });
256
+ actor.start();
257
+ // Actor resumes from where it left off
258
+ ```
259
+
260
+ [`definePlayer`](../api/@xmachines/play-xstate/functions/definePlayer.md) accepts an optional `restore` argument for this purpose. Restoration is useful for server-side rendering (hydrate with the server's snapshot), session persistence (resume after page reload), and testing (start from a known mid-flow state).
261
+
262
+ ---
263
+
264
+ ## What state machines replace
265
+
266
+ | Traditional pattern | State machine equivalent | Why the machine version is better |
267
+ | ----------------------------------------------------- | -------------------------------------------- | ----------------------------------------------------------- |
268
+ | Boolean flags (`isLoading`, `isError`) | Explicit states (`idle \| loading \| error`) | Impossible state combinations are unrepresentable |
269
+ | Switch on URL path in component | `meta.route` on state nodes | Routing intent lives with the state that owns it |
270
+ | `if (user.role === "admin")` scattered in components | Guards on transitions | Auth logic is co-located with the transitions it governs |
271
+ | `useEffect` on route changes to decide what to render | `meta.view` on state nodes | View structure is declared alongside the state that owns it |
272
+ | Shared mutable state across components | Context + signals | Mutations are explicit, traceable, and test-covered |
273
+
274
+ ---
275
+
276
+ ## See also
277
+
278
+ - [Understanding the Actor Model](actor-model.md) — how the machine definition becomes a live actor
279
+ - [Understanding TC39 Signals](signals.md) — how the actor's state is observed by infrastructure
280
+ - [Getting Started](getting-started.md) — step-by-step walkthrough building your first machine and actor
281
+ - [Routing Patterns](../examples/routing-patterns.md) — worked examples of `meta.route` and guards
282
+ - [@xmachines/play-xstate](../api/@xmachines/play-xstate/README.md) — full API reference for [`definePlayer`](../api/@xmachines/play-xstate/functions/definePlayer.md), [`PlayerActor`](../api/@xmachines/play-xstate/classes/PlayerActor.md), guard combinators
283
+ - [XState v5 documentation](https://stately.ai/docs/xstate) — upstream state machine library documentation
284
+ - [Play RFC](../rfc/play.md) — complete architectural specification
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/docs",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.0",
4
4
  "description": "Documentation for XMachines",
5
5
  "keywords": [
6
6
  "documentation",
@@ -15,13 +15,15 @@
15
15
  "author": "Mikael Karon <mikael@karon.se>",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "https://gitlab.com/xmachin-es/xmachines-js.git",
18
+ "url": "git+ssh://git@gitlab.com/xmachin-es/xmachines-js.git",
19
19
  "directory": "packages/docs"
20
20
  },
21
21
  "files": [
22
22
  "api",
23
+ "contributing",
23
24
  "examples",
24
25
  "guides",
26
+ "rfc",
25
27
  "index.js",
26
28
  "index.d.ts"
27
29
  ],
@@ -32,8 +34,10 @@
32
34
  "import": "./index.js"
33
35
  },
34
36
  "./api/*": "./api/*",
37
+ "./contributing/*": "./contributing/*",
35
38
  "./examples/*": "./examples/*",
36
- "./guides/*": "./guides/*"
39
+ "./guides/*": "./guides/*",
40
+ "./rfc/*": "./rfc/*"
37
41
  },
38
42
  "publishConfig": {
39
43
  "access": "public"
@@ -43,12 +47,19 @@
43
47
  "lint:fix": "oxlint --fix .",
44
48
  "format": "oxfmt .",
45
49
  "format:check": "oxfmt --check .",
46
- "typedoc": "typedoc"
50
+ "typedoc": "typedoc",
51
+ "test": "vitest run",
52
+ "clean": "rm -rf coverage node_modules/.vite*"
47
53
  },
48
54
  "devDependencies": {
49
- "@xmachines/shared": "^1.0.0-beta.9",
50
- "typedoc": "^0.28.17",
55
+ "@testing-library/jest-dom": "^6.9.1",
56
+ "@types/node": "^26.1.1",
57
+ "@xmachines/shared": "1.0.0",
58
+ "oxfmt": "^0.58.0",
59
+ "oxlint": "^1.73.0",
60
+ "typedoc": "^0.28.19",
51
61
  "typedoc-plugin-llms-txt": "^0.1.2",
52
- "typedoc-plugin-markdown": "^4.11.0"
62
+ "typedoc-plugin-markdown": "^4.11.0",
63
+ "vitest": "^4.1.10"
53
64
  }
54
65
  }
package/rfc/broker.md ADDED
@@ -0,0 +1,100 @@
1
+ # RFC: Broker
2
+
3
+ **Status:** Draft
4
+ **Version:** 1
5
+ **Scope:** Real-time event transport, consumer coordination, run execution bindings
6
+ **Non-goals:** Persistence formats, execution semantics
7
+
8
+ ---
9
+
10
+ ## 1. Purpose
11
+
12
+ This RFC defines how **XMachines runs** are driven by streaming broker backends.
13
+
14
+ Unlike **Git**, which solves for durability and offline distribution, **Broker** solves for:
15
+
16
+ - **Liveness:** pushing events to machines in real-time
17
+ - **Coordination:** managing concurrency via consumer groups
18
+ - **Transport:** bridging the gap between topics and run streams
19
+
20
+ ---
21
+
22
+ ## 2. Separation of Concerns
23
+
24
+ This RFC establishes **Broker** as orthogonal to **Git**.
25
+
26
+ | Feature | Git (Persistence) | Broker (Execution) |
27
+ | ---------------- | ------------------------------ | ------------------------------------- |
28
+ | Role | the ledger (storage) | the pipe (transport) |
29
+ | Model | pull (fetch/clone) | push (subscribe) |
30
+ | Concurrency | optimistic locking (branching) | pessimistic locking (consumer groups) |
31
+ | Latency | batch / high latency | streaming / sub-second |
32
+ | Primary Artifact | commit (immutable record) | message (trigger) |
33
+
34
+ A typical setup uses Broker for the **hot path** (real-time execution) and Git for the **cold path** (archival/audit).
35
+
36
+ ---
37
+
38
+ ## 3. Package Model
39
+
40
+ The Broker implementation follows the adapter pattern:
41
+
42
+ - **`@xmachines/broker`** — core interfaces for `BrokerConsumer` and `BrokerProducer`
43
+ - **`@xmachines/broker-kafka`** — Kafka adapter
44
+ - **`@xmachines/broker-redpanda`** — Redpanda adapter
45
+
46
+ ---
47
+
48
+ ## 4. Execution Model
49
+
50
+ The Broker acts as the **drive mechanism** for a run. It does not replace the run; it feeds it.
51
+
52
+ ### Consumer Binding
53
+
54
+ - The Broker subscribes to a topic
55
+ - It maps the partition key to a specific **run ID**
56
+ - It instantiates the run (if not already running)
57
+
58
+ ### Stream Piping
59
+
60
+ **Inbound:**
61
+ The Broker pipes the topic partition into the run's **in stream** (`WritableStream`)
62
+
63
+ **Outbound:**
64
+ The Broker pipes the run's **out stream** (`ReadableStream`) back to a result topic or dead-letter queue
65
+
66
+ ### Backpressure
67
+
68
+ Because XMachines uses **Web Streams**, backpressure propagates automatically.
69
+
70
+ If the run is slow to process, the Broker stops fetching from the partition.
71
+
72
+ ---
73
+
74
+ ## 5. Concurrency & Ordering
75
+
76
+ [Run RFC](run.md) mandates that a run is deterministic given an ordered sequence of events.
77
+
78
+ **Broker RFC** guarantees this via **partition leasing**:
79
+
80
+ - A specific run ID is pinned to a specific partition
81
+ - The Broker's consumer group protocol ensures only one worker node holds the lease at any time
82
+
83
+ This provides the **single writer guarantee** required by the run without needing a distributed lock manager.
84
+
85
+ ---
86
+
87
+ ## 6. Invariants
88
+
89
+ 1. Transport agnostic — the run does not know it is being driven by Kafka
90
+ 2. Ordering preserved — messages from a partition are delivered in strict order
91
+ 3. At-least-once — offsets are committed only after the run has successfully processed the event
92
+ 4. Partition alignment — a single run must never span multiple partitions
93
+
94
+ ---
95
+
96
+ ## 7. Lock statement
97
+
98
+ > The Broker is the active transport binding that drives XMachines runs from real-time streams.
99
+ > It handles coordination and delivery, delegating logic to the run and persistence to the configured durability backend.
100
+ > This is Broker.
package/rfc/browser.md ADDED
@@ -0,0 +1,44 @@
1
+ # RFC: Browser
2
+
3
+ **Status:** Draft
4
+ **Version:** 1
5
+ **Scope:** Browser-native interoperability
6
+ **Non-goals:** Execution, persistence, protocols
7
+
8
+ ---
9
+
10
+ ## 1. Purpose
11
+
12
+ Defines browser-specific adapters using Web Streams.
13
+
14
+ ---
15
+
16
+ ## 2. Package Model
17
+
18
+ Alias:
19
+
20
+ - `@xmachines/browser`
21
+
22
+ Implementations:
23
+
24
+ - `browser-dom`
25
+ - `browser-ws`
26
+ - `browser-worker`
27
+
28
+ Only non-isomorphic APIs receive browser packages.
29
+
30
+ ---
31
+
32
+ ## 3. Invariants
33
+
34
+ 1. Web Streams only
35
+ 2. Optional dependency
36
+ 3. No persistence
37
+ 4. No protocol semantics
38
+
39
+ ---
40
+
41
+ ## 4. Lock statement
42
+
43
+ > Browser interop is explicit and stream-based.
44
+ > This is Browser.