@xmachines/docs 1.0.0-beta.50 → 1.0.0-beta.52

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 (364) hide show
  1. package/README.md +13 -11
  2. package/api/@xmachines/play/README.md +6 -5
  3. package/api/@xmachines/play/classes/NonNullableError.md +4 -4
  4. package/api/@xmachines/play/classes/PlayError.md +4 -4
  5. package/api/@xmachines/play/functions/assertNonNullable.md +1 -1
  6. package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
  7. package/api/@xmachines/play-actor/README.md +2 -2
  8. package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -3
  9. package/api/@xmachines/play-actor/functions/typedSpec.md +1 -1
  10. package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +5 -5
  11. package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +5 -5
  12. package/api/@xmachines/play-actor/interfaces/PlaySpec.md +2 -2
  13. package/api/@xmachines/play-actor/interfaces/Routable.md +3 -3
  14. package/api/@xmachines/play-actor/interfaces/Viewable.md +2 -2
  15. package/api/@xmachines/play-dom/README.md +125 -47
  16. package/api/@xmachines/play-dom/classes/PlayRenderer.md +20 -10
  17. package/api/@xmachines/play-dom/functions/createPlayUI.md +9 -9
  18. package/api/@xmachines/play-dom/functions/createRenderer.md +3 -2
  19. package/api/@xmachines/play-dom/functions/defineRegistry.md +1 -1
  20. package/api/@xmachines/play-dom/functions/renderSpec.md +17 -13
  21. package/api/@xmachines/play-dom/interfaces/ComponentContext.md +7 -7
  22. package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +15 -12
  23. package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +4 -4
  24. package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +17 -14
  25. package/api/@xmachines/play-dom/interfaces/EventHandle.md +4 -4
  26. package/api/@xmachines/play-dom/interfaces/MountOptions.md +10 -6
  27. package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +20 -8
  28. package/api/@xmachines/play-dom/interfaces/UIProviderOptions.md +13 -10
  29. package/api/@xmachines/play-dom/type-aliases/ActionFn.md +1 -1
  30. package/api/@xmachines/play-dom/type-aliases/Actions.md +1 -1
  31. package/api/@xmachines/play-dom/type-aliases/BaseComponentProps.md +7 -7
  32. package/api/@xmachines/play-dom/type-aliases/CatalogHasActions.md +1 -1
  33. package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +1 -1
  34. package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +1 -1
  35. package/api/@xmachines/play-dom/type-aliases/DefineRegistryOptions.md +2 -2
  36. package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +1 -1
  37. package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +1 -1
  38. package/api/@xmachines/play-dom/type-aliases/DomSchema.md +1 -1
  39. package/api/@xmachines/play-dom/type-aliases/MountFn.md +6 -4
  40. package/api/@xmachines/play-dom/type-aliases/SetState.md +1 -1
  41. package/api/@xmachines/play-dom/variables/schema.md +1 -1
  42. package/api/@xmachines/play-dom-router/README.md +23 -25
  43. package/api/@xmachines/play-dom-router/functions/connectRouter.md +1 -1
  44. package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
  45. package/api/@xmachines/play-dom-router/functions/createRouteMap.md +1 -1
  46. package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
  47. package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +14 -14
  48. package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
  49. package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +6 -6
  50. package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +6 -6
  51. package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +68 -0
  52. package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +3 -3
  53. package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +3 -3
  54. package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +2 -2
  55. package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
  56. package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
  57. package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +4 -4
  58. package/api/@xmachines/play-react/README.md +3 -3
  59. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +5 -5
  60. package/api/@xmachines/play-react/functions/useActor.md +3 -3
  61. package/api/@xmachines/play-react/functions/usePlayView.md +1 -1
  62. package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
  63. package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +8 -8
  64. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
  65. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
  66. package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +8 -8
  67. package/api/@xmachines/play-react/interfaces/ViewContextValue.md +5 -5
  68. package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +11 -0
  69. package/api/@xmachines/play-react/variables/ActorProvider.md +1 -1
  70. package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
  71. package/api/@xmachines/play-react/variables/PlayUIProvider.md +1 -1
  72. package/api/@xmachines/play-react-router/README.md +16 -1
  73. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +85 -41
  74. package/api/@xmachines/play-react-router/classes/RouteMap.md +4 -4
  75. package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +4 -4
  76. package/api/@xmachines/play-react-router/functions/createRouteMap.md +1 -1
  77. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
  78. package/api/@xmachines/play-react-router/interfaces/PlayActor.md +68 -0
  79. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +6 -6
  80. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +8 -8
  81. package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +2 -2
  82. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
  83. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
  84. package/api/@xmachines/play-router/README.md +21 -18
  85. package/api/@xmachines/play-router/classes/RouteMap.md +4 -4
  86. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +83 -43
  87. package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
  88. package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
  89. package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
  90. package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +1 -1
  91. package/api/@xmachines/play-router/functions/createRouteMatcher.md +1 -1
  92. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
  93. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
  94. package/api/@xmachines/play-router/functions/extractQuery.md +1 -1
  95. package/api/@xmachines/play-router/functions/extractRouteParams.md +1 -1
  96. package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
  97. package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
  98. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
  99. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
  100. package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +1 -1
  101. package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
  102. package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
  103. package/api/@xmachines/play-router/functions/routeExists.md +1 -1
  104. package/api/@xmachines/play-router/functions/sanitizePathname.md +1 -1
  105. package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
  106. package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
  107. package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
  108. package/api/@xmachines/play-router/interfaces/LocationLike.md +3 -3
  109. package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +3 -3
  110. package/api/@xmachines/play-router/interfaces/MachineNodeData.md +5 -5
  111. package/api/@xmachines/play-router/interfaces/PlayActor.md +68 -0
  112. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +6 -6
  113. package/api/@xmachines/play-router/interfaces/RoutableActor.md +64 -0
  114. package/api/@xmachines/play-router/interfaces/RouteInfo.md +8 -8
  115. package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +2 -2
  116. package/api/@xmachines/play-router/interfaces/RouteMapping.md +3 -3
  117. package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
  118. package/api/@xmachines/play-router/interfaces/RouteMatcher.md +4 -4
  119. package/api/@xmachines/play-router/interfaces/RouteNode.md +10 -10
  120. package/api/@xmachines/play-router/interfaces/RouteObject.md +2 -2
  121. package/api/@xmachines/play-router/interfaces/RouteTree.md +5 -5
  122. package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
  123. package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
  124. package/api/@xmachines/play-router/interfaces/WindowLike.md +3 -3
  125. package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
  126. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
  127. package/api/@xmachines/play-signals/README.md +4 -3
  128. package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
  129. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
  130. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
  131. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
  132. package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
  133. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
  134. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
  135. package/api/@xmachines/play-solid/README.md +18 -20
  136. package/api/@xmachines/play-solid/functions/useActor.md +3 -3
  137. package/api/@xmachines/play-solid/functions/usePlayView.md +1 -1
  138. package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +8 -8
  139. package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +8 -8
  140. package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +5 -5
  141. package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +11 -0
  142. package/api/@xmachines/play-solid/variables/ActorContext.md +2 -2
  143. package/api/@xmachines/play-solid/variables/ActorProvider.md +1 -1
  144. package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
  145. package/api/@xmachines/play-solid/variables/PlayUIProvider.md +1 -1
  146. package/api/@xmachines/play-solid-router/README.md +77 -10
  147. package/api/@xmachines/play-solid-router/classes/RouteMap.md +4 -4
  148. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +83 -35
  149. package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +4 -4
  150. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
  151. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +3 -3
  152. package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +68 -0
  153. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +6 -6
  154. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +8 -8
  155. package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +2 -2
  156. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
  157. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
  158. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +6 -4
  159. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
  160. package/api/@xmachines/play-svelte/README.md +23 -14
  161. package/api/@xmachines/play-svelte/functions/defineRegistry.md +1 -1
  162. package/api/@xmachines/play-svelte/functions/getActorContext.md +3 -3
  163. package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +1 -1
  164. package/api/@xmachines/play-svelte/functions/setActorContext.md +4 -4
  165. package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +8 -8
  166. package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +4 -4
  167. package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +11 -11
  168. package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +5 -5
  169. package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +11 -0
  170. package/api/@xmachines/play-svelte-spa-router/README.md +13 -13
  171. package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +4 -4
  172. package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +1 -1
  173. package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +1 -1
  174. package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +6 -6
  175. package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +6 -6
  176. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +2 -2
  177. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
  178. package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
  179. package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
  180. package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
  181. package/api/@xmachines/play-sveltekit-router/README.md +20 -20
  182. package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +4 -4
  183. package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +1 -1
  184. package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +1 -1
  185. package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
  186. package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
  187. package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +6 -6
  188. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +2 -2
  189. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
  190. package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
  191. package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
  192. package/api/@xmachines/play-tanstack-react-router/README.md +3 -6
  193. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +4 -4
  194. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +80 -35
  195. package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +4 -4
  196. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
  197. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +1 -1
  198. package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
  199. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +68 -0
  200. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +6 -6
  201. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +8 -8
  202. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +2 -2
  203. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
  204. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
  205. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +3 -3
  206. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
  207. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +4 -4
  208. package/api/@xmachines/play-tanstack-solid-router/README.md +23 -17
  209. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +4 -4
  210. package/api/@xmachines/play-tanstack-solid-router/classes/{SolidRouterBridge.md → TanStackSolidRouterBridge.md} +86 -38
  211. package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +4 -4
  212. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
  213. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +68 -0
  214. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +6 -6
  215. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +8 -8
  216. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +2 -2
  217. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
  218. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
  219. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +6 -4
  220. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +2 -2
  221. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +3 -3
  222. package/api/@xmachines/play-vue/README.md +3 -3
  223. package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
  224. package/api/@xmachines/play-vue/functions/getPlayViewContext.md +1 -1
  225. package/api/@xmachines/play-vue/functions/useActor.md +3 -3
  226. package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +5 -5
  227. package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +8 -8
  228. package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +5 -5
  229. package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +1 -1
  230. package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +11 -0
  231. package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
  232. package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
  233. package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
  234. package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
  235. package/api/@xmachines/play-vue-router/README.md +27 -17
  236. package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
  237. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +81 -33
  238. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
  239. package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +68 -0
  240. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +6 -6
  241. package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +2 -2
  242. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +3 -3
  243. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
  244. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +6 -4
  245. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +3 -3
  246. package/api/@xmachines/play-xstate/README.md +7 -3
  247. package/api/@xmachines/play-xstate/classes/PlayerActor.md +12 -12
  248. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +1 -1
  249. package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
  250. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
  251. package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +1 -1
  252. package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
  253. package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
  254. package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
  255. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +1 -1
  256. package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
  257. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
  258. package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
  259. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +3 -3
  260. package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
  261. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +6 -6
  262. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +5 -5
  263. package/api/@xmachines/play-xstate/interfaces/RouteObject.md +17 -0
  264. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
  265. package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
  266. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
  267. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +1 -1
  268. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
  269. package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +9 -0
  270. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
  271. package/api/@xmachines/shared/README.md +25 -12
  272. package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
  273. package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
  274. package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
  275. package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
  276. package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
  277. package/contributing/architecture.md +599 -0
  278. package/contributing/configuration.md +262 -419
  279. package/contributing/development.md +300 -453
  280. package/contributing/testing.md +165 -172
  281. package/examples/@xmachines/play-dom-demo/README.md +30 -21
  282. package/examples/@xmachines/play-dom-demo/functions/createNavBar.md +1 -1
  283. package/examples/@xmachines/play-dom-demo/functions/initShell.md +1 -1
  284. package/examples/@xmachines/play-dom-demo/type-aliases/AuthCatalog.md +1 -1
  285. package/examples/@xmachines/play-dom-demo/variables/About.md +1 -1
  286. package/examples/@xmachines/play-dom-demo/variables/Contact.md +1 -1
  287. package/examples/@xmachines/play-dom-demo/variables/Dashboard.md +1 -1
  288. package/examples/@xmachines/play-dom-demo/variables/Home.md +1 -1
  289. package/examples/@xmachines/play-dom-demo/variables/Login.md +1 -1
  290. package/examples/@xmachines/play-dom-demo/variables/NavBarView.md +1 -1
  291. package/examples/@xmachines/play-dom-demo/variables/Navigation.md +1 -1
  292. package/examples/@xmachines/play-dom-demo/variables/Overview.md +1 -1
  293. package/examples/@xmachines/play-dom-demo/variables/Profile.md +1 -1
  294. package/examples/@xmachines/play-dom-demo/variables/Settings.md +1 -1
  295. package/examples/@xmachines/play-dom-demo/variables/Stats.md +1 -1
  296. package/examples/@xmachines/play-dom-demo/variables/authCatalog.md +1 -1
  297. package/examples/@xmachines/play-dom-router-demo/README.md +23 -18
  298. package/examples/@xmachines/play-react-demo/README.md +38 -37
  299. package/examples/@xmachines/play-react-demo/functions/App.md +1 -1
  300. package/examples/@xmachines/play-react-demo/type-aliases/AuthCatalog.md +1 -1
  301. package/examples/@xmachines/play-react-demo/variables/About.md +1 -1
  302. package/examples/@xmachines/play-react-demo/variables/Contact.md +1 -1
  303. package/examples/@xmachines/play-react-demo/variables/Dashboard.md +1 -1
  304. package/examples/@xmachines/play-react-demo/variables/DebugPanel.md +1 -1
  305. package/examples/@xmachines/play-react-demo/variables/Home.md +1 -1
  306. package/examples/@xmachines/play-react-demo/variables/Login.md +1 -1
  307. package/examples/@xmachines/play-react-demo/variables/NavBar.md +1 -1
  308. package/examples/@xmachines/play-react-demo/variables/NavBarView.md +1 -1
  309. package/examples/@xmachines/play-react-demo/variables/Navigation.md +1 -1
  310. package/examples/@xmachines/play-react-demo/variables/Overview.md +1 -1
  311. package/examples/@xmachines/play-react-demo/variables/Profile.md +1 -1
  312. package/examples/@xmachines/play-react-demo/variables/Settings.md +1 -1
  313. package/examples/@xmachines/play-react-demo/variables/Shell.md +1 -1
  314. package/examples/@xmachines/play-react-demo/variables/Stats.md +1 -1
  315. package/examples/@xmachines/play-react-demo/variables/authCatalog.md +1 -1
  316. package/examples/@xmachines/play-react-router-demo/README.md +37 -33
  317. package/examples/@xmachines/play-solid-demo/README.md +5 -2
  318. package/examples/@xmachines/play-solid-demo/functions/App.md +1 -1
  319. package/examples/@xmachines/play-solid-demo/type-aliases/AuthCatalog.md +1 -1
  320. package/examples/@xmachines/play-solid-demo/variables/About.md +1 -1
  321. package/examples/@xmachines/play-solid-demo/variables/Contact.md +1 -1
  322. package/examples/@xmachines/play-solid-demo/variables/Dashboard.md +1 -1
  323. package/examples/@xmachines/play-solid-demo/variables/DebugPanel.md +1 -1
  324. package/examples/@xmachines/play-solid-demo/variables/Home.md +1 -1
  325. package/examples/@xmachines/play-solid-demo/variables/Login.md +1 -1
  326. package/examples/@xmachines/play-solid-demo/variables/NavBar.md +1 -1
  327. package/examples/@xmachines/play-solid-demo/variables/NavBarView.md +1 -1
  328. package/examples/@xmachines/play-solid-demo/variables/Navigation.md +1 -1
  329. package/examples/@xmachines/play-solid-demo/variables/Overview.md +1 -1
  330. package/examples/@xmachines/play-solid-demo/variables/Profile.md +1 -1
  331. package/examples/@xmachines/play-solid-demo/variables/Settings.md +1 -1
  332. package/examples/@xmachines/play-solid-demo/variables/Shell.md +1 -1
  333. package/examples/@xmachines/play-solid-demo/variables/Stats.md +1 -1
  334. package/examples/@xmachines/play-solid-demo/variables/authCatalog.md +1 -1
  335. package/examples/@xmachines/play-solid-router-demo/README.md +38 -25
  336. package/examples/@xmachines/play-svelte-demo/README.md +8 -5
  337. package/examples/@xmachines/play-svelte-demo/type-aliases/AuthCatalog.md +1 -1
  338. package/examples/@xmachines/play-svelte-demo/variables/authCatalog.md +1 -1
  339. package/examples/@xmachines/play-svelte-spa-router-demo/README.md +11 -9
  340. package/examples/@xmachines/play-sveltekit-router-demo/README.md +14 -9
  341. package/examples/@xmachines/play-tanstack-react-router-demo/README.md +39 -13
  342. package/examples/@xmachines/play-tanstack-solid-router-demo/README.md +27 -13
  343. package/examples/@xmachines/play-vue-demo/README.md +35 -24
  344. package/examples/@xmachines/play-vue-demo/type-aliases/AuthCatalog.md +1 -1
  345. package/examples/@xmachines/play-vue-demo/variables/App.md +1 -1
  346. package/examples/@xmachines/play-vue-demo/variables/authCatalog.md +1 -1
  347. package/examples/@xmachines/play-vue-router-demo/README.md +2 -0
  348. package/examples/README.md +7 -7
  349. package/examples/multi-router-integration.md +13 -16
  350. package/examples/routing-patterns.md +2 -2
  351. package/guides/README.md +1 -1
  352. package/guides/actor-model.md +2 -2
  353. package/guides/getting-started.md +325 -132
  354. package/guides/signals.md +1 -1
  355. package/guides/state-machines.md +1 -1
  356. package/package.json +2 -2
  357. package/api/@xmachines/play-dom/functions/connectRenderer.md +0 -70
  358. package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +0 -28
  359. package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +0 -9
  360. package/api/@xmachines/play-react/type-aliases/PlayActor.md +0 -9
  361. package/api/@xmachines/play-solid/type-aliases/PlayActor.md +0 -9
  362. package/api/@xmachines/play-svelte/type-aliases/PlayActor.md +0 -9
  363. package/api/@xmachines/play-vue/type-aliases/PlayActor.md +0 -9
  364. package/guides/architecture.md +0 -500
@@ -2,38 +2,17 @@
2
2
 
3
3
  # Testing
4
4
 
5
- This document describes the test framework, test organization, how to run tests, and patterns used across the XMachines JS monorepo.
5
+ This document describes the test framework, conventions, and CI integration for the XMachines JS monorepo.
6
6
 
7
7
  ## Test Framework and Setup
8
8
 
9
- **Runner:** [Vitest](https://vitest.dev/) `^4.1.4`
9
+ The monorepo uses **[Vitest](https://vitest.dev/) `^4.1.5`** as its test framework, with **@vitest/coverage-v8** for coverage reporting and **@vitest/browser-playwright** (Playwright/Chromium) for browser-mode tests.
10
10
 
11
- **Assertion library:** Vitest built-in `expect` + `@testing-library/jest-dom` matchers (auto-injected via shared setup)
11
+ All packages extend the shared Vitest configuration helper `defineXmVitestConfig` (from `@xmachines/shared/vitest`) which automatically applies:
12
12
 
13
- **Coverage provider:** `@vitest/coverage-v8`
14
-
15
- All packages use [`defineXmVitestConfig`](../api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md) from [`@xmachines/shared/vitest`](../api/@xmachines/shared/vitest/README.md)a factory that wraps `mergeConfig` and automatically injects shared setup files:
16
-
17
- ```typescript
18
- // packages/<name>/vitest.config.ts
19
- import { defineXmVitestConfig } from "@xmachines/shared/vitest";
20
-
21
- export default defineXmVitestConfig(import.meta.url, {
22
- test: {
23
- environment: "node", // or "jsdom" for UI renderer packages
24
- include: ["test/**/*.spec.ts", "test/**/*.test.ts"],
25
- exclude: ["node_modules/**"],
26
- coverage: {
27
- provider: "v8",
28
- reporter: ["text", "html", "json-summary"],
29
- include: ["src/**/*.ts"],
30
- exclude: ["test/**/*", "**/*.test.ts", "**/*.d.ts", "dist/**/*"],
31
- all: true,
32
- thresholds: { lines: 90, functions: 90, branches: 85, statements: 90 },
33
- },
34
- },
35
- });
36
- ```
13
+ - `@xmachines/*` source aliases so imports resolve to source during test runs
14
+ - `@xmachines/shared/vitest-setup` — extends Vitest matchers with `@testing-library/jest-dom`
15
+ - `@xmachines/shared/vitest-node-setup` — enforces Node.js 22 on non-browser projects
37
16
 
38
17
  **Auto-injected setup files:**
39
18
 
@@ -42,23 +21,21 @@ export default defineXmVitestConfig(import.meta.url, {
42
21
  | `packages/shared/config/vitest.node.setup.ts` | All non-browser projects | Validates Node.js ≥ 22 runtime; throws if wrong runtime |
43
22
  | `packages/shared/config/vitest.setup.ts` | All projects | Imports `@testing-library/jest-dom/vitest` matchers |
44
23
 
45
- **Test environments by package type:**
24
+ Before running any tests, ensure all dependencies are installed:
46
25
 
47
- | Environment | Packages |
48
- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
49
- | `node` | Core logic: [`@xmachines/play`](../api/@xmachines/play/README.md), `play-actor`, `play-signals`, `play-xstate`, `play-router`, router adapters |
50
- | `jsdom` | UI renderers: [`@xmachines/play-react`](../api/@xmachines/play-react/README.md), `play-vue`, `play-solid`, `play-svelte`, `play-dom` |
51
- | Browser (Playwright/Chromium) | Browser-specific and E2E demo tests |
26
+ ```bash
27
+ npm ci
28
+ ```
52
29
 
53
30
  ## Running Tests
54
31
 
55
- ### All unit tests (node + jsdom)
32
+ ### Full test suite (Node environments)
56
33
 
57
34
  ```bash
58
35
  npm test
59
36
  ```
60
37
 
61
- Runs `vitest run` across all 30+ package-level projects defined in `vitest.config.ts`.
38
+ Runs `vitest run` across all 30 package-level projects defined in the root `vitest.config.ts`. Uses the `forks` pool (up to 4 workers) with process-level isolation between test files.
62
39
 
63
40
  ### Watch mode (development)
64
41
 
@@ -66,39 +43,48 @@ Runs `vitest run` across all 30+ package-level projects defined in `vitest.confi
66
43
  npm run test:watch
67
44
  ```
68
45
 
69
- Runs `vitest` in interactive watch mode. Re-runs affected test files on save.
46
+ Runs `vitest` in interactive watch mode. Re-runs affected tests on file change.
70
47
 
71
- ### Browser tests (Playwright/Chromium)
48
+ ### Browser tests (Playwright / Chromium)
72
49
 
73
50
  ```bash
74
51
  npm run test:browser
75
52
  ```
76
53
 
77
- Runs `vitest run --config vitest.browser.config.ts`. Executes all `*.browser.test.ts(x)` files in real Chromium via `@vitest/browser-playwright`. Covers browser-specific APIs (history, URLPattern, DOM events, real microtask timing) and full-application E2E flows in demo packages.
54
+ Runs `vitest run --config vitest.browser.config.ts`. Launches all browser-mode projects using headless Chromium via Playwright. Includes both package-level browser unit tests and full demo-app integration flows. The browser global setup (`vitest.browser.global-setup.ts`) raises `process.setMaxListeners` to 32 before workers spawn to prevent false-positive `MaxListenersExceededWarning` with multiple parallel browser projects.
78
55
 
79
- ### Coverage
56
+ ### With coverage
80
57
 
81
58
  ```bash
82
- npm run test:coverage # Run all tests with coverage (text + html + json-summary)
83
- npm run coverage:report # HTML coverage report
84
- npm run coverage:summary # JSON summary for CI
59
+ npm run test:coverage
85
60
  ```
86
61
 
87
- ### Type-checking test files
62
+ Produces coverage output in `text`, `html`, and `json-summary` formats.
63
+
64
+ ```bash
65
+ npm run coverage:report # HTML report
66
+ npm run coverage:summary # JSON summary only
67
+ ```
68
+
69
+ ### Verify TypeScript test graph compiles
88
70
 
89
71
  ```bash
90
72
  npm run test:build
91
73
  ```
92
74
 
93
- Runs `tsc --build tsconfig.test.json` compiles test files (including `.typecheck.ts` files in `src/`) without executing them. This is the mechanism for catching compile-time type safety failures.
75
+ Runs `tsc --build tsconfig.test.json`. This validates that all test TypeScript files across the monorepo type-check correctly without running the tests themselves. Also compiles `.typecheck.ts` files in `src/` directories.
76
+
77
+ ### Running tests for a single package
94
78
 
95
- ### Per-package tests (workspace)
79
+ From the monorepo root:
96
80
 
97
81
  ```bash
98
- npm test -w packages/play-xstate
82
+ npm test -w packages/play
99
83
  npm run test:coverage -w packages/play-react
100
84
  ```
101
85
 
86
+ Or from within a package directory, run `npx vitest run` directly after building the workspace.
87
+
102
88
  ## Test File Organization
103
89
 
104
90
  Tests live in a separate `test/` directory within each package — never co-located with source files.
@@ -117,7 +103,7 @@ packages/<name>/
117
103
  └── tsconfig.json # Test-specific tsconfig (extends shared/tsconfig-test)
118
104
  ```
119
105
 
120
- **File naming conventions:**
106
+ ### File naming conventions
121
107
 
122
108
  | Extension | Purpose |
123
109
  | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
@@ -127,13 +113,46 @@ packages/<name>/
127
113
  | `.typecheck.ts` (in `src/`) | Compile-time-only type assertion files; not Vitest test files; validated by `npm run test:build` |
128
114
  | `router-bridge-contract.ts` | Shared contract test runner; not a test file itself; imported by adapter test files |
129
115
 
116
+ ### Test environments
117
+
118
+ | Environment | Packages |
119
+ | ----------------------------- | ---------------------------------------------------------------------------------------------------------- |
120
+ | `node` | Core logic: `@xmachines/play`, `play-actor`, `play-signals`, `play-xstate`, `play-router`, router adapters |
121
+ | `jsdom` | UI renderers: `@xmachines/play-react`, `play-vue`, `play-solid`, `play-svelte`, `play-dom` |
122
+ | Browser (Playwright/Chromium) | Browser-specific and E2E demo tests |
123
+
124
+ ### Test helpers and shared setup
125
+
126
+ - **`@xmachines/shared/vitest-setup`** — Injects `@testing-library/jest-dom` matchers. Applied automatically by `defineXmVitestConfig`.
127
+ - **`@xmachines/shared/vitest-node-setup`** — Enforces Node ≥ 22 at runtime. Auto-injected for non-browser configs.
128
+ - **`@xmachines/shared/vitest-urlpattern-setup`** — Polyfills `URLPattern` for packages that need it (e.g. `@xmachines/play-router`). Must be declared explicitly in `setupFiles`.
129
+ - **`packages/play-react/test/test-utils.ts`** — React-specific test utilities for the `play-react` package.
130
+ - **`packages/play-router/examples/shared/`** and **`packages/play-actor/examples/shared/`** — Shared test fixtures for router and actor integration tests.
131
+
130
132
  ## Writing New Tests
131
133
 
132
- ### Unit and integration tests
134
+ ### Adding a new package test config
135
+
136
+ 1. Place test files under `packages/<pkg>/test/`.
137
+ 2. Name them following the convention above.
138
+ 3. Import `defineXmVitestConfig` in the package's `vitest.config.ts`:
139
+
140
+ ```typescript
141
+ import { defineXmVitestConfig } from "@xmachines/shared/vitest";
142
+
143
+ export default defineXmVitestConfig(import.meta.url, {
144
+ test: {
145
+ environment: "node",
146
+ include: ["test/**/*.test.ts"],
147
+ exclude: ["node_modules/**"],
148
+ },
149
+ });
150
+ ```
133
151
 
134
- Place new test files in the package's `test/` directory. Use `.test.ts` for standard tests and `.spec.ts` for protocol/type-safety tests in core packages.
152
+ 4. Register the new config in the root `vitest.config.ts` `projects` array.
153
+ 5. Add the package's `tsconfig.test.json` to `tsconfig.test.json` references in the root.
135
154
 
136
- **Basic test structure:**
155
+ ### Basic test structure
137
156
 
138
157
  ```typescript
139
158
  import { describe, it, test, expect, vi, beforeEach, afterEach } from "vitest";
@@ -161,12 +180,6 @@ import { AbstractActor } from "../src/abstract-actor.js";
161
180
  import { Signal } from "@xmachines/play-signals";
162
181
  ```
163
182
 
164
- **`it` vs `test`:** Both are interchangeable. Some files alias one to the other for consistency within a file:
165
-
166
- ```typescript
167
- import { it as test } from "vitest";
168
- ```
169
-
170
183
  ### Lifecycle hooks
171
184
 
172
185
  ```typescript
@@ -180,57 +193,43 @@ afterEach(() => {
180
193
  });
181
194
  ```
182
195
 
183
- ### Mocking
196
+ ### What to mock / what not to mock
184
197
 
185
- **Module mocking with `vi.hoisted` (required when mocks are referenced before module evaluation):**
198
+ **Mock these:**
186
199
 
187
- ```typescript
188
- const mocks = vi.hoisted(() => ({
189
- machineToGraph: vi.fn(),
190
- buildRouteTree: vi.fn(),
191
- }));
192
-
193
- vi.mock("../src/machine-to-graph.js", () => ({
194
- machineToGraph: mocks.machineToGraph,
195
- }));
196
- ```
200
+ - **Framework router objects** (TanStack Router, Vue Router, React Router, SolidJS Router) — mock with typed `vi.fn()` interfaces because they are external framework dependencies and carry significant setup complexity:
197
201
 
198
- **Function mocks:**
202
+ ```typescript
203
+ const mocks = vi.hoisted(() => ({
204
+ machineToGraph: vi.fn(),
205
+ buildRouteTree: vi.fn(),
206
+ }));
199
207
 
200
- ```typescript
201
- const sendSpy = vi.fn();
202
- const navigate = vi.fn(({ to }: { to: string }) => {
203
- /* side effect */
204
- });
205
- const mockReturnValue = vi.fn().mockReturnValue(stubValue);
206
- const asyncMock = vi.fn().mockResolvedValue(undefined);
207
- const failingMock = vi.fn().mockRejectedValue(new Error("fail"));
208
- ```
208
+ vi.mock("../src/machine-to-graph.js", () => ({
209
+ machineToGraph: mocks.machineToGraph,
210
+ }));
211
+ ```
209
212
 
210
- **Spy pattern for console suppression:**
213
+ - **`console.warn` / `console.error`** when testing code that legitimately emits warnings — mock to suppress noise and assert call counts:
211
214
 
212
- ```typescript
213
- const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
214
- // ... test ...
215
- expect(warnSpy).toHaveBeenCalled();
216
- vi.restoreAllMocks(); // in afterEach
217
- ```
218
-
219
- **What to mock:**
215
+ ```typescript
216
+ const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
217
+ // ... test ...
218
+ expect(warnSpy).toHaveBeenCalled();
219
+ vi.restoreAllMocks(); // in afterEach
220
+ ```
220
221
 
221
- - Framework router objects (TanStack, Vue Router, React Router) — mock with typed `vi.fn()` interfaces
222
- - `console.warn` / `console.error` when testing code that legitimately logs warnings
223
- - External module collaborators when testing a unit in isolation
222
+ - **External module collaborators** when testing a unit in isolation.
224
223
 
225
- **What NOT to mock:**
224
+ **Never mock these:**
226
225
 
227
- - Signals (`Signal.State`, `Signal.Computed`, `Signal.subtle.Watcher`) — use real implementations
228
- - Internal `@xmachines/*` packages — resolved to source via [`xmAliases`](../api/@xmachines/shared/vite-aliases/functions/xmAliases.md) in Vitest config
229
- - XState — use real `setup()` / `createMachine()` / `createActor()`
226
+ - **TC39 Signals** (`Signal.State`, `Signal.Computed`, `Signal.subtle.Watcher`) — always use real implementations from `@xmachines/play-signals`. Signals have precise reactive semantics (synchronous propagation, lazy computation) that mocks cannot replicate accurately.
227
+ - **Internal `@xmachines/*` packages**these are resolved directly to source via the `xmAliases` Vite plugin in the Vitest config. Mocking them would hide integration bugs and defeat the purpose of cross-package testing.
228
+ - **XState**always use real `setup()` / `createMachine()` / `createActor()`. XState's actor lifecycle (start, stop, snapshot, subscription) is a behavioral contract that mocks cannot reliably emulate.
230
229
 
231
230
  ### Test actor patterns
232
231
 
233
- **Preferred: extend [`AbstractActor`](../api/@xmachines/play-actor/classes/AbstractActor.md) for full type safety:**
232
+ **Preferred: extend `AbstractActor` for full type safety:**
234
233
 
235
234
  ```typescript
236
235
  import { AbstractActor } from "@xmachines/play-actor";
@@ -274,34 +273,6 @@ function createMockActor(initialView: PlaySpec | null = null) {
274
273
  }
275
274
  ```
276
275
 
277
- ### Compile-time type tests
278
-
279
- For type-only assertions, use `@ts-expect-error` in `.spec.ts` files:
280
-
281
- ```typescript
282
- const bad: PlaySpec = typedSpec<MyCtx>({
283
- root: "root",
284
- // @ts-expect-error "typo" is not a key of MyCtx — typedSpec enforces this
285
- contextProps: ["typo"],
286
- elements: {},
287
- });
288
- // At runtime the object exists; only the compile-time error is being tested
289
- expect(bad.contextProps).toEqual(["typo"]);
290
- ```
291
-
292
- For purely structural type assertions with no runtime test needed, use `.typecheck.ts` files in `src/`:
293
-
294
- ```typescript
295
- // packages/play-xstate/src/define-player.typecheck.ts
296
- type IsAny<T> = 0 extends 1 & T ? true : false;
297
- type AssertFalse<T extends false> = T;
298
-
299
- const actorNotAny: AssertFalse<IsAny<typeof actor>> = false;
300
- void actorNotAny;
301
- ```
302
-
303
- These files are validated by `npm run test:build` (`tsc --build tsconfig.test.json`) — never executed by Vitest.
304
-
305
276
  ### Async and signal patterns
306
277
 
307
278
  **Flushing the microtask queue (required for Signal propagation):**
@@ -333,7 +304,35 @@ expect(notified).toBe(true);
333
304
  watcher.unwatch(actor.currentRoute); // Always clean up
334
305
  ```
335
306
 
336
- **Error testing:**
307
+ ### Compile-time type tests
308
+
309
+ For type-only assertions, use `@ts-expect-error` in `.spec.ts` files:
310
+
311
+ ```typescript
312
+ const bad: PlaySpec = typedSpec<MyCtx>({
313
+ root: "root",
314
+ // @ts-expect-error "typo" is not a key of MyCtx — typedSpec enforces this
315
+ contextProps: ["typo"],
316
+ elements: {},
317
+ });
318
+ // At runtime the object exists; only the compile-time error is being tested
319
+ expect(bad.contextProps).toEqual(["typo"]);
320
+ ```
321
+
322
+ For purely structural type assertions with no runtime test needed, use `.typecheck.ts` files in `src/`:
323
+
324
+ ```typescript
325
+ // packages/play-xstate/src/define-player.typecheck.ts
326
+ type IsAny<T> = 0 extends 1 & T ? true : false;
327
+ type AssertFalse<T extends false> = T;
328
+
329
+ const actorNotAny: AssertFalse<IsAny<typeof actor>> = false;
330
+ void actorNotAny;
331
+ ```
332
+
333
+ These files are validated by `npm run test:build` (`tsc --build tsconfig.test.json`) — never executed by Vitest.
334
+
335
+ ### Error testing
337
336
 
338
337
  ```typescript
339
338
  // Synchronous throws
@@ -352,34 +351,9 @@ try {
352
351
  }
353
352
  ```
354
353
 
355
- **Testing-library pattern (React/Vue/Solid/Svelte):**
356
-
357
- ```typescript
358
- // React
359
- const { getByTestId } = render(withRenderer({ actor, registryResult }));
360
- expect(getByTestId("fallback")).toBeTruthy();
361
- await waitFor(() => expect(screen.getByRole("heading")).toBeInTheDocument());
362
-
363
- // Vue
364
- const wrapper = mount(ActorProvider, { props: { actor, registryResult }, slots: { ... } });
365
- await flushPromises();
366
- expect(wrapper.find("[data-testid='message']").text()).toBe("Hello");
367
- ```
368
-
369
- **Performance/timing assertions:**
370
-
371
- ```typescript
372
- const start = performance.now();
373
- for (let i = 0; i < iterations; i++) {
374
- actor.send({ type: "play.route", to: `#route${i}` });
375
- }
376
- const duration = performance.now() - start;
377
- expect(duration / iterations).toBeLessThan(2.5); // ms per operation
378
- ```
379
-
380
354
  ## Contract Tests
381
355
 
382
- The [`@xmachines/play-router`](../api/@xmachines/play-router/README.md) package exports a shared behavioral contract suite that all router bridge adapters must satisfy:
356
+ The `@xmachines/play-router` package exports a shared behavioral contract suite that all router bridge adapters must satisfy:
383
357
 
384
358
  ```typescript
385
359
  // packages/play-router/test/router-bridge-contract.ts
@@ -401,7 +375,7 @@ runBridgeContractTests({
401
375
 
402
376
  The contract covers: deep-link sync on connect, router→actor navigation sync, actor→router sync, guard redirect flows, duplicate event deduplication, and restore-from-snapshot behavior.
403
377
 
404
- **Used by:** [`@xmachines/play-router`](../api/@xmachines/play-router/README.md), `play-tanstack-react-router`, `play-vue-router`, `play-solid-router`, `play-react-router`, and other adapter packages.
378
+ **Used by:** `@xmachines/play-router`, `play-tanstack-react-router`, `play-vue-router`, `play-solid-router`, `play-react-router`, and other adapter packages.
405
379
 
406
380
  **Compile-time bridge contract verification:**
407
381
 
@@ -414,38 +388,57 @@ assertImplementsRouterBridge<MyRouterBridge>(); // Zero runtime cost
414
388
 
415
389
  ## Coverage Requirements
416
390
 
417
- **Provider:** `@vitest/coverage-v8`
391
+ Coverage is collected using the **v8** provider. The root `vitest.config.ts` defines monorepo-wide regression thresholds:
418
392
 
419
- **Reporters:** `text`, `html`, `json-summary`
393
+ | Type | Monorepo threshold |
394
+ | ---------- | ------------------ |
395
+ | Lines | 80% |
396
+ | Functions | 80% |
397
+ | Branches | 75% |
398
+ | Statements | 80% |
420
399
 
421
- **Aggregate thresholds** (root `vitest.config.ts` — regression gate for full monorepo run):
400
+ Individual packages enforce their own (typically stricter) thresholds inside their `vitest.config.ts`:
422
401
 
423
- | Type | Threshold |
424
- | ---------- | --------- |
425
- | Lines | 80% |
426
- | Functions | 80% |
427
- | Branches | 75% |
428
- | Statements | 80% |
402
+ | Package tier | Lines | Functions | Branches | Statements |
403
+ | -------------------------------------------------------------------------- | ----- | --------- | -------- | ---------- |
404
+ | Core packages (`@xmachines/play`, `@xmachines/play-actor`) | 90% | 90% | 85% | 90% |
405
+ | Complex logic (`@xmachines/play-xstate`, `@xmachines/play-router`) | 85% | 85% | 80% | 85% |
406
+ | Integration packages (e.g. `@xmachines/play-react`, `@xmachines/play-dom`) | 80% | 80% | 80% | 80% |
429
407
 
430
- **Per-package thresholds** (enforced by each package's `vitest.config.ts`):
408
+ Coverage includes: `src/**/*.ts`, `src/**/*.tsx`, `src/**/*.vue`, `src/**/*.svelte`
431
409
 
432
- | Package category | Lines | Functions | Branches | Statements |
433
- | ------------------------------------------------------------------------------------------------------------------ | ----- | --------- | -------- | ---------- |
434
- | Core packages ([`@xmachines/play`](../api/@xmachines/play/README.md), `play-actor`) | 90% | 90% | 85% | 90% |
435
- | Complex logic ([`@xmachines/play-xstate`](../api/@xmachines/play-xstate/README.md), `play-router`) | 85% | 85% | 80% | 85% |
436
- | Integration/adapter packages ([`@xmachines/play-react`](../api/@xmachines/play-react/README.md), `play-vue`, etc.) | 80% | 80% | 80% | 80% |
410
+ Coverage is excluded for: `test/**/*`, `**/*.test.ts`, `**/*.test.tsx`, `**/*.d.ts`, `dist/**/*`.
437
411
 
438
- **Coverage includes:** `src/**/*.ts`, `src/**/*.tsx`, `src/**/*.vue`, `src/**/*.svelte`
412
+ ## CI Integration
439
413
 
440
- **Coverage excludes:** `test/**/*`, `**/*.test.ts`, `**/*.d.ts`, `dist/**/*`
414
+ Tests run in GitLab CI using the `to-be-continuous/node` pipeline component (version `5.1.2`).
441
415
 
442
- ## CI Integration
416
+ **Workflow:** The pipeline runs on:
417
+
418
+ - Tag pushes (`$CI_COMMIT_TAG`)
419
+ - Pushes to the default branch (`$CI_DEFAULT_BRANCH`)
420
+ - Merge requests (`$CI_MERGE_REQUEST_IID`)
421
+
422
+ **CI test command** (from `.gitlab-ci.yml`):
423
+
424
+ ```bash
425
+ npm run test:coverage -- \
426
+ --coverage.reporter=text \
427
+ --coverage.reporter=cobertura \
428
+ --coverage.reportsDirectory=reports/coverage \
429
+ --reporter=default \
430
+ --reporter=junit \
431
+ --outputFile.junit=reports/junit.xml
432
+ ```
433
+
434
+ **Artifacts:** The CI job (`node-build`) publishes:
443
435
 
444
- Tests are expected to run in CI against Node.js ≥ 22. The `vitest.node.setup.ts` setup file enforces this at runtime — tests will fail immediately with a descriptive error if run on an older Node version.
436
+ - JUnit XML report at `reports/junit.xml` (surfaced in GitLab's test results panel)
437
+ - Cobertura coverage XML at `reports/coverage/cobertura-coverage.xml` (used for GitLab's coverage percentage badge — extracted from the `All files` line)
445
438
 
446
- The `npm run format:check` and `npm run lint` commands enforce code style and are run separately from tests.
439
+ Coverage and test results are always uploaded (`when: always`) so failures are visible even when the job itself fails.
447
440
 
448
- Browser tests (`npm run test:browser`) require Playwright/Chromium and are run via `vitest.browser.config.ts`. The browser global setup (`vitest.browser.global-setup.ts`) raises `process.setMaxListeners` to 32 before workers spawn to prevent false-positive `MaxListenersExceededWarning` with multiple parallel browser projects.
441
+ The `npm run format:check` and `npm run lint` commands enforce code style and are run separately from tests (via the `lint-enabled: true` input to the pipeline component).
449
442
 
450
443
  ## Test Types Reference
451
444
 
@@ -1,13 +1,15 @@
1
1
  [Examples](../../README.md) / @xmachines/play-dom-demo
2
2
 
3
+ <!-- generated-by: gsd-doc-writer -->
4
+
3
5
  # @xmachines/play-dom-demo
4
6
 
5
- Vanilla DOM renderer demo for [`@xmachines/play-dom`](../../../api/@xmachines/play-dom/README.md) — actor + `connectRenderer` without a router.
7
+ Vanilla DOM renderer demo for [`@xmachines/play-dom`](../../../api/@xmachines/play-dom/README.md) — actor + `createPlayUI` without a router.
6
8
 
7
9
  ## What This Demonstrates
8
10
 
9
11
  - Shared auth machine reused without framework-specific business logic
10
- - `connectRenderer` wiring `PlayRenderer`-equivalent DOM rendering without a framework
12
+ - `createPlayUI` wiring `PlayRenderer`-equivalent DOM rendering without a framework
11
13
  - Auth machine states (home → login → dashboard) drive DOM updates via TC39 Signal watchers
12
14
  - `watchSignal` for reactive nav visibility and debug panel updates
13
15
  - Non-browser invariant tests plus browser renderer coverage
@@ -28,23 +30,27 @@ Then open `http://localhost:5173`.
28
30
  Use this order to understand the implementation:
29
31
 
30
32
  1. `src/main.ts` calls `definePlayer({ machine: authMachine })` and starts the actor.
31
- 2. `initShell(actor, app)` from `src/shell.ts` builds the HTML scaffold, mounts a reactive `NavBar`, and wires the debug panel.
33
+ 2. `initShell(actor, app)` from `src/components/Shell.ts` builds the HTML scaffold, mounts a reactive `NavBar`, wires the debug panel, and returns a disconnect function.
32
34
  3. `defineRegistry(authCatalog, { components, actions })` builds the typed `registryResult` — real async action handlers dispatching to `actor.send()`.
33
- 4. `connectRenderer({ actor, registry, container, registryResult })` wires the registry to the actor — view switches happen automatically when `actor.currentView` changes.
34
- 5. `watchSignal(actor.state, ...)` and `watchSignal(actor.currentRoute, ...)` drive the debug panel updates.
35
- 6. Browser tests in `test/browser/` validate startup rendering and auth interactions.
35
+ 4. `createPlayUI(registryResult)` produces a `mount` function; `mount(actor, container)` wires the registry to the actor — view switches happen automatically when `actor.currentView` changes.
36
+ 5. `createNavBar(actor, headerEl)` in `src/components/NavBar.ts` uses `watchSignal(actor.state, ...)` to update nav button visibility based on auth state.
37
+ 6. `createDebugPanel(actor, shell)` in `src/components/DebugPanel.ts` uses `watchSignal(actor.state, ...)` and `watchSignal(actor.currentRoute, ...)` to drive live debug panel updates.
38
+ 7. Browser tests in `test/browser/` validate startup rendering and auth interactions.
36
39
 
37
40
  ```ts
38
41
  // src/main.ts (shape)
39
- const actor = definePlayer({ machine: authMachine })();
42
+ const createPlayer = definePlayer({ machine: authMachine });
43
+ const actor = createPlayer();
40
44
  actor.start();
41
45
 
42
46
  const app = document.getElementById("app");
43
- if (app) initShell(actor, app);
47
+ if (!app) throw new Error("Root element not found");
48
+
49
+ initShell(actor, app);
44
50
  ```
45
51
 
46
52
  ```ts
47
- // src/shell.ts (shape)
53
+ // src/components/Shell.ts (shape)
48
54
  const registryResult = defineRegistry(authCatalog, {
49
55
  components: {
50
56
  Home,
@@ -77,21 +83,24 @@ const registryResult = defineRegistry(authCatalog, {
77
83
  },
78
84
  });
79
85
 
80
- const disconnectRenderer = connectRenderer({
81
- actor,
82
- registry: registryResult.registry,
83
- container: viewContent,
84
- registryResult,
85
- });
86
+ const disconnectNavBar = createNavBar(actor, headerEl);
87
+ const mount = createPlayUI(registryResult);
88
+ const disconnectRenderer = mount(actor, viewContent);
89
+ const disconnectDebugPanel = createDebugPanel(actor, shell);
86
90
 
87
- const unwatchState = watchSignal(actor.state, () => updateDebugPanel(actor));
88
- const unwatchRoute = watchSignal(actor.currentRoute, () => updateDebugPanel(actor));
91
+ return () => {
92
+ disconnectNavBar();
93
+ disconnectRenderer();
94
+ disconnectDebugPanel();
95
+ };
89
96
  ```
90
97
 
91
98
  ## Key Files
92
99
 
93
100
  - `src/main.ts` - actor creation and shell bootstrap
94
- - `src/shell.ts` - DOM scaffold, `DomRegistry` construction, `connectRenderer` wiring, and `watchSignal` for reactive nav and debug panel
101
+ - `src/components/Shell.ts` - DOM scaffold, `DomRegistry` construction, `createPlayUI` wiring, `createNavBar`, and `createDebugPanel`
102
+ - `src/components/NavBar.ts` - reactive nav bar using `watchSignal(actor.state, ...)` for auth-driven button visibility
103
+ - `src/components/DebugPanel.ts` - live debug footer using `watchSignal` on both `actor.state` and `actor.currentRoute`
95
104
  - `test/library-pattern.test.ts` - architecture boundary and invariant assertions
96
105
  - `test/browser/renderer-demo.browser.test.ts` - browser-mode renderer coverage
97
106
 
@@ -100,7 +109,7 @@ const unwatchRoute = watchSignal(actor.currentRoute, () => updateDebugPanel(acto
100
109
  The demo utilizes XMachines architectural invariants:
101
110
 
102
111
  1. **Actor Authority:** Navigation buttons dispatch `play.route` events to the actor. The actor evaluates guards and transitions to the correct state — the DOM never decides which view to show.
103
- 2. **Passive Infrastructure:** `connectRenderer` and `watchSignal` only react to actor signals. They do not hold business state or make routing decisions.
112
+ 2. **Passive Infrastructure:** `createPlayUI` and `watchSignal` only react to actor signals. They do not hold business state or make routing decisions.
104
113
  3. **Signal-Only Reactivity:** `watchSignal` (from [`@xmachines/play-signals`](../../../api/@xmachines/play-signals/README.md)) wraps the canonical TC39 Signals watcher lifecycle, keeping all reactivity in the actor signal layer rather than in ad-hoc DOM event listeners.
105
114
 
106
115
  ## Watcher Lifecycle and Cleanup Contract
@@ -113,11 +122,11 @@ This demo follows the canonical watcher lifecycle:
113
122
  4. Read actor signals and project DOM state
114
123
  5. Re-arm with `watch()`/`watch(...signals)`
115
124
 
116
- Watcher notifications are one-shot. Cleanup is explicit: both `disconnectRenderer()` and `unwatchState()` must be called to avoid memory leaks. In this demo, cleanup is returned from `initShell` and called on `beforeunload`.
125
+ Watcher notifications are one-shot. Cleanup is explicit: `disconnectNavBar()`, `disconnectRenderer()`, and `disconnectDebugPanel()` are all called from the disconnect function returned by `initShell`. In this demo, cleanup is called on `beforeunload` via `actor.stop()`.
117
126
 
118
127
  ## Adapter Boundaries
119
128
 
120
- `connectRenderer` (from [`@xmachines/play-dom`](../../../api/@xmachines/play-dom/README.md)) is passive infrastructure. It translates actor view signals into DOM mutations but holds no business logic. The `DomRegistry` maps catalog component keys to factory functions — the actor owns which key is active.
129
+ `createPlayUI` (from [`@xmachines/play-dom`](../../../api/@xmachines/play-dom/README.md)) is passive infrastructure. It translates actor view signals into DOM mutations but holds no business logic. The `DomRegistry` maps catalog component keys to factory functions — the actor owns which key is active.
121
130
 
122
131
  ## Available Scripts
123
132
 
@@ -6,7 +6,7 @@
6
6
  function createNavBar(actor, container): () => void;
7
7
  ```
8
8
 
9
- Defined in: [play-dom/examples/demo/src/components/NavBar.ts:9](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/examples/demo/src/components/NavBar.ts#L9)
9
+ Defined in: [play-dom/examples/demo/src/components/NavBar.ts:9](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.52/packages/play-dom/examples/demo/src/components/NavBar.ts#L9)
10
10
 
11
11
  NavBar — App-shell navigation factory. Mounts a reactive nav into
12
12
  `container`, observes actor.state via watchSignal, and updates button
@@ -6,7 +6,7 @@
6
6
  function initShell(actor, appElement): () => void;
7
7
  ```
8
8
 
9
- Defined in: [play-dom/examples/demo/src/components/Shell.ts:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/examples/demo/src/components/Shell.ts#L24)
9
+ Defined in: [play-dom/examples/demo/src/components/Shell.ts:24](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.52/packages/play-dom/examples/demo/src/components/Shell.ts#L24)
10
10
 
11
11
  Shell — DOM shell layout factory. Renders demo chrome (header + main +
12
12
  debug panel), mounts NavBar, connects DOM renderer, and wires DebugPanel.
@@ -6,4 +6,4 @@
6
6
  type AuthCatalog = typeof authCatalog;
7
7
  ```
8
8
 
9
- Defined in: [play-dom/examples/demo/src/catalog.ts:6](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/examples/demo/src/catalog.ts#L6)
9
+ Defined in: [play-dom/examples/demo/src/catalog.ts:6](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.52/packages/play-dom/examples/demo/src/catalog.ts#L6)
@@ -6,7 +6,7 @@
6
6
  const About: ComponentFn<AuthCatalog, "About">;
7
7
  ```
8
8
 
9
- Defined in: [play-dom/examples/demo/src/components/About.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/examples/demo/src/components/About.ts#L8)
9
+ Defined in: [play-dom/examples/demo/src/components/About.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.52/packages/play-dom/examples/demo/src/components/About.ts#L8)
10
10
 
11
11
  About — Public information page. Catalog-typed DOM component
12
12
  (ComponentFn<AuthCatalog, 'About'>). Renders static content from props.
@@ -6,7 +6,7 @@
6
6
  const Contact: ComponentFn<AuthCatalog, "Contact">;
7
7
  ```
8
8
 
9
- Defined in: [play-dom/examples/demo/src/components/Contact.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.50/packages/play-dom/examples/demo/src/components/Contact.ts#L8)
9
+ Defined in: [play-dom/examples/demo/src/components/Contact.ts:8](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.52/packages/play-dom/examples/demo/src/components/Contact.ts#L8)
10
10
 
11
11
  Contact — Public contact page. Catalog-typed DOM component
12
12
  (ComponentFn<AuthCatalog, 'Contact'>). Renders static content from props.