@xmachines/docs 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/README.md +11 -13
  2. package/api/@xmachines/play/README.md +58 -63
  3. package/api/@xmachines/play/classes/NonNullableError.md +7 -7
  4. package/api/@xmachines/play/classes/PlayError.md +25 -27
  5. package/api/@xmachines/play/functions/assertNonNullable.md +17 -17
  6. package/api/@xmachines/play/type-aliases/PlayEvent.md +26 -25
  7. package/api/@xmachines/play-actor/README.md +72 -63
  8. package/api/@xmachines/play-actor/classes/AbstractActor.md +39 -39
  9. package/api/@xmachines/play-actor/functions/attachRenderErrorHandler.md +19 -18
  10. package/api/@xmachines/play-actor/functions/composePlayState.md +9 -8
  11. package/api/@xmachines/play-actor/functions/createViewStoreLifecycle.md +5 -5
  12. package/api/@xmachines/play-actor/functions/guardContextWrites.md +27 -25
  13. package/api/@xmachines/play-actor/functions/refreshContextSubtree.md +12 -11
  14. package/api/@xmachines/play-actor/functions/reuseComposedState.md +23 -22
  15. package/api/@xmachines/play-actor/functions/shallowEqualExcept.md +6 -5
  16. package/api/@xmachines/play-actor/functions/toAtomState.md +16 -14
  17. package/api/@xmachines/play-actor/functions/typedSpec.md +12 -11
  18. package/api/@xmachines/play-actor/interfaces/BaseActorProviderProps.md +17 -15
  19. package/api/@xmachines/play-actor/interfaces/BaseViewContextValue.md +15 -14
  20. package/api/@xmachines/play-actor/interfaces/PlaySpec.md +13 -13
  21. package/api/@xmachines/play-actor/interfaces/ResolveViewStoreOptions.md +4 -4
  22. package/api/@xmachines/play-actor/interfaces/Routable.md +4 -4
  23. package/api/@xmachines/play-actor/interfaces/ViewStoreLifecycle.md +11 -11
  24. package/api/@xmachines/play-actor/interfaces/ViewStoreResolution.md +7 -7
  25. package/api/@xmachines/play-actor/interfaces/Viewable.md +9 -9
  26. package/api/@xmachines/play-actor/variables/CONTEXT_STATE_KEY.md +5 -5
  27. package/api/@xmachines/play-dom/README.md +119 -85
  28. package/api/@xmachines/play-dom/classes/PlayRenderer.md +34 -32
  29. package/api/@xmachines/play-dom/functions/createPlayUI.md +10 -10
  30. package/api/@xmachines/play-dom/functions/createRenderer.md +21 -17
  31. package/api/@xmachines/play-dom/interfaces/CreatePlayUIOptions.md +8 -8
  32. package/api/@xmachines/play-dom/interfaces/MountOptions.md +9 -9
  33. package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +9 -9
  34. package/api/@xmachines/play-dom/type-aliases/MountFn.md +5 -5
  35. package/api/@xmachines/play-dom-router/README.md +66 -49
  36. package/api/@xmachines/play-dom-router/classes/DomRouterBridge.md +116 -0
  37. package/api/@xmachines/play-dom-router/functions/connectRouter.md +4 -3
  38. package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +16 -14
  39. package/api/@xmachines/play-dom-router/functions/createRouteMap.md +12 -11
  40. package/api/@xmachines/play-dom-router/functions/createRouter.md +14 -14
  41. package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +25 -26
  42. package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +19 -18
  43. package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +7 -7
  44. package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +39 -33
  45. package/api/@xmachines/play-dom-router/interfaces/RoutableActor.md +18 -17
  46. package/api/@xmachines/play-dom-router/interfaces/RouteLookupContract.md +9 -9
  47. package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +39 -38
  48. package/api/@xmachines/play-dom-router/interfaces/RouteMapOptions.md +5 -5
  49. package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +11 -10
  50. package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +27 -24
  51. package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +7 -7
  52. package/api/@xmachines/play-react/README.md +63 -54
  53. package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +14 -13
  54. package/api/@xmachines/play-react/functions/useActor.md +1 -1
  55. package/api/@xmachines/play-react/functions/usePlayView.md +4 -4
  56. package/api/@xmachines/play-react/functions/useSignalEffect.md +39 -39
  57. package/api/@xmachines/play-react/interfaces/ActorProviderProps.md +11 -11
  58. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +7 -7
  59. package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +4 -4
  60. package/api/@xmachines/play-react/interfaces/PlayUIProviderProps.md +14 -14
  61. package/api/@xmachines/play-react/interfaces/ViewContextValue.md +8 -8
  62. package/api/@xmachines/play-react/type-aliases/AnyPlayActor.md +2 -2
  63. package/api/@xmachines/play-react/type-aliases/PlayRendererProps.md +13 -0
  64. package/api/@xmachines/play-react/variables/ActorProvider.md +9 -8
  65. package/api/@xmachines/play-react/variables/PlayRenderer.md +5 -4
  66. package/api/@xmachines/play-react/variables/PlayUIProvider.md +6 -6
  67. package/api/@xmachines/play-react-router/README.md +37 -28
  68. package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +22 -19
  69. package/api/@xmachines/play-react-router/classes/RouteMap.md +50 -48
  70. package/api/@xmachines/play-react-router/functions/createPlayRouterProvider.md +16 -14
  71. package/api/@xmachines/play-react-router/functions/createRouteMap.md +12 -11
  72. package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +18 -18
  73. package/api/@xmachines/play-react-router/interfaces/PlayActor.md +22 -20
  74. package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +39 -33
  75. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
  76. package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +11 -11
  77. package/api/@xmachines/play-react-router/interfaces/RouteMapOptions.md +5 -5
  78. package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +11 -10
  79. package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +27 -24
  80. package/api/@xmachines/play-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  81. package/api/@xmachines/play-react-router/variables/PlayRouterProvider.md +7 -6
  82. package/api/@xmachines/play-router/README.md +94 -82
  83. package/api/@xmachines/play-router/classes/RouteMap.md +50 -48
  84. package/api/@xmachines/play-router/classes/RouterBridgeBase.md +29 -23
  85. package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +6 -5
  86. package/api/@xmachines/play-router/functions/buildRouteTree.md +16 -15
  87. package/api/@xmachines/play-router/functions/createRouteMap.md +12 -11
  88. package/api/@xmachines/play-router/functions/createRouteMapFromTree.md +18 -18
  89. package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +18 -17
  90. package/api/@xmachines/play-router/functions/extractMachineRoutes.md +11 -10
  91. package/api/@xmachines/play-router/functions/extractQuery.md +3 -3
  92. package/api/@xmachines/play-router/functions/extractRouteParams.md +22 -19
  93. package/api/@xmachines/play-router/functions/findRouteById.md +10 -9
  94. package/api/@xmachines/play-router/functions/findRouteByPath.md +14 -12
  95. package/api/@xmachines/play-router/functions/getNavigableRoutes.md +9 -9
  96. package/api/@xmachines/play-router/functions/getRoutableRoutes.md +9 -9
  97. package/api/@xmachines/play-router/functions/getTransitionReachableRoutes.md +16 -15
  98. package/api/@xmachines/play-router/functions/isRouteReachable.md +12 -11
  99. package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
  100. package/api/@xmachines/play-router/functions/routeExists.md +8 -8
  101. package/api/@xmachines/play-router/functions/sanitizePathname.md +15 -13
  102. package/api/@xmachines/play-router/functions/validateRouteFormat.md +10 -10
  103. package/api/@xmachines/play-router/functions/validateStateExists.md +9 -9
  104. package/api/@xmachines/play-router/interfaces/BuildPlayRouteEventOptions.md +4 -4
  105. package/api/@xmachines/play-router/interfaces/LocationLike.md +9 -9
  106. package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +7 -7
  107. package/api/@xmachines/play-router/interfaces/MachineNodeData.md +9 -9
  108. package/api/@xmachines/play-router/interfaces/PlayActor.md +22 -20
  109. package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +39 -33
  110. package/api/@xmachines/play-router/interfaces/ResolvedRoutePath.md +7 -7
  111. package/api/@xmachines/play-router/interfaces/RoutableActor.md +18 -17
  112. package/api/@xmachines/play-router/interfaces/RouteInfo.md +11 -11
  113. package/api/@xmachines/play-router/interfaces/RouteMapOptions.md +5 -5
  114. package/api/@xmachines/play-router/interfaces/RouteMapping.md +11 -10
  115. package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
  116. package/api/@xmachines/play-router/interfaces/RouteNode.md +13 -13
  117. package/api/@xmachines/play-router/interfaces/RouteObject.md +6 -6
  118. package/api/@xmachines/play-router/interfaces/RouteTree.md +11 -11
  119. package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +13 -13
  120. package/api/@xmachines/play-router/interfaces/RouterBridge.md +27 -24
  121. package/api/@xmachines/play-router/interfaces/WindowLike.md +10 -10
  122. package/api/@xmachines/play-router/type-aliases/BaseRouteMapping.md +13 -0
  123. package/api/@xmachines/play-router/type-aliases/MachineGraph.md +4 -3
  124. package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +2 -2
  125. package/api/@xmachines/play-signals/README.md +38 -36
  126. package/api/@xmachines/play-signals/functions/watchSignal.md +15 -15
  127. package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +6 -6
  128. package/api/@xmachines/play-signals/interfaces/SignalComputed.md +10 -10
  129. package/api/@xmachines/play-signals/interfaces/SignalOptions.md +6 -6
  130. package/api/@xmachines/play-signals/interfaces/SignalState.md +13 -13
  131. package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +18 -18
  132. package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +6 -5
  133. package/api/@xmachines/play-solid/README.md +46 -42
  134. package/api/@xmachines/play-solid/functions/useActor.md +1 -1
  135. package/api/@xmachines/play-solid/functions/usePlayView.md +3 -3
  136. package/api/@xmachines/play-solid/interfaces/ActorProviderProps.md +13 -13
  137. package/api/@xmachines/play-solid/interfaces/PlayUIProviderProps.md +14 -14
  138. package/api/@xmachines/play-solid/interfaces/ViewContextValue.md +9 -9
  139. package/api/@xmachines/play-solid/type-aliases/AnyPlayActor.md +2 -2
  140. package/api/@xmachines/play-solid/variables/ActorContext.md +5 -4
  141. package/api/@xmachines/play-solid/variables/ActorProvider.md +8 -7
  142. package/api/@xmachines/play-solid/variables/PlayRenderer.md +6 -4
  143. package/api/@xmachines/play-solid/variables/PlayUIProvider.md +7 -7
  144. package/api/@xmachines/play-solid-router/README.md +34 -29
  145. package/api/@xmachines/play-solid-router/classes/RouteMap.md +50 -48
  146. package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +43 -34
  147. package/api/@xmachines/play-solid-router/functions/createPlayRouterProvider.md +15 -13
  148. package/api/@xmachines/play-solid-router/functions/createRouteMap.md +12 -11
  149. package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +39 -39
  150. package/api/@xmachines/play-solid-router/interfaces/PlayActor.md +22 -20
  151. package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +39 -33
  152. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderBaseProps.md +10 -10
  153. package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +11 -11
  154. package/api/@xmachines/play-solid-router/interfaces/RouteMapOptions.md +5 -5
  155. package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +11 -10
  156. package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +27 -24
  157. package/api/@xmachines/play-solid-router/type-aliases/PlayRouterBridgeConstructor.md +5 -5
  158. package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +2 -2
  159. package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +11 -11
  160. package/api/@xmachines/play-solid-router/variables/PlayRouterProvider.md +9 -8
  161. package/api/@xmachines/play-svelte/README.md +40 -31
  162. package/api/@xmachines/play-svelte/functions/defineRegistry.md +9 -8
  163. package/api/@xmachines/play-svelte/functions/getActorContext.md +5 -4
  164. package/api/@xmachines/play-svelte/functions/getPlayViewContext.md +3 -3
  165. package/api/@xmachines/play-svelte/functions/setActorContext.md +1 -1
  166. package/api/@xmachines/play-svelte/interfaces/ActorProviderProps.md +17 -15
  167. package/api/@xmachines/play-svelte/interfaces/DefineRegistryOptions.md +9 -9
  168. package/api/@xmachines/play-svelte/interfaces/PlayUIProviderProps.md +20 -18
  169. package/api/@xmachines/play-svelte/interfaces/ViewContextValue.md +12 -11
  170. package/api/@xmachines/play-svelte/type-aliases/AnyPlayActor.md +2 -2
  171. package/api/@xmachines/play-svelte-spa-router/README.md +25 -25
  172. package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +50 -48
  173. package/api/@xmachines/play-svelte-spa-router/classes/SvelteSpaRouterBridge.md +133 -0
  174. package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +3 -3
  175. package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +12 -11
  176. package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +7 -7
  177. package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +39 -33
  178. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapOptions.md +5 -5
  179. package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +11 -10
  180. package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +27 -24
  181. package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +10 -10
  182. package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
  183. package/api/@xmachines/play-sveltekit-router/README.md +38 -34
  184. package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +50 -48
  185. package/api/@xmachines/play-sveltekit-router/classes/SvelteKitRouterBridge.md +132 -0
  186. package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +3 -3
  187. package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +12 -11
  188. package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +6 -6
  189. package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +9 -9
  190. package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +39 -33
  191. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapOptions.md +5 -5
  192. package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +11 -10
  193. package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +27 -24
  194. package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
  195. package/api/@xmachines/play-tanstack-react-router/README.md +66 -48
  196. package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +50 -48
  197. package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +43 -38
  198. package/api/@xmachines/play-tanstack-react-router/functions/createPlayRouterProvider.md +16 -14
  199. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +12 -11
  200. package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +18 -18
  201. package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +11 -10
  202. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayActor.md +22 -20
  203. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +39 -33
  204. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderBaseProps.md +12 -12
  205. package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +11 -11
  206. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapOptions.md +5 -5
  207. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +11 -10
  208. package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +16 -11
  209. package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +27 -24
  210. package/api/@xmachines/play-tanstack-react-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  211. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
  212. package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +15 -13
  213. package/api/@xmachines/play-tanstack-react-router/variables/PlayRouterProvider.md +9 -8
  214. package/api/@xmachines/play-tanstack-router/README.md +37 -17
  215. package/api/@xmachines/play-tanstack-router/classes/TanStackRouterBridgeBase.md +43 -38
  216. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouteMapLike.md +9 -9
  217. package/api/@xmachines/play-tanstack-router/type-aliases/TanStackRouterLike.md +15 -13
  218. package/api/@xmachines/play-tanstack-solid-router/README.md +71 -45
  219. package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +50 -48
  220. package/api/@xmachines/play-tanstack-solid-router/classes/TanStackSolidRouterBridge.md +38 -30
  221. package/api/@xmachines/play-tanstack-solid-router/functions/createPlayRouterProvider.md +15 -13
  222. package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +12 -11
  223. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayActor.md +22 -20
  224. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +39 -33
  225. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderBaseProps.md +11 -11
  226. package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +9 -9
  227. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapOptions.md +5 -5
  228. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +11 -10
  229. package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +27 -24
  230. package/api/@xmachines/play-tanstack-solid-router/type-aliases/PlayRouterBridgeConstructor.md +2 -2
  231. package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +2 -2
  232. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
  233. package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +15 -13
  234. package/api/@xmachines/play-tanstack-solid-router/variables/PlayRouterProvider.md +7 -7
  235. package/api/@xmachines/play-vue/README.md +37 -35
  236. package/api/@xmachines/play-vue/functions/defineRegistry.md +10 -9
  237. package/api/@xmachines/play-vue/functions/useActor.md +1 -1
  238. package/api/@xmachines/play-vue/functions/usePlayView.md +28 -0
  239. package/api/@xmachines/play-vue/interfaces/ActorProviderProps.md +10 -9
  240. package/api/@xmachines/play-vue/interfaces/PlayUIProviderProps.md +13 -12
  241. package/api/@xmachines/play-vue/interfaces/ViewContextValue.md +10 -9
  242. package/api/@xmachines/play-vue/interfaces/VisibilityProviderProps.md +6 -2
  243. package/api/@xmachines/play-vue/type-aliases/AnyPlayActor.md +2 -2
  244. package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
  245. package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
  246. package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +2 -2
  247. package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
  248. package/api/@xmachines/play-vue/variables/getPlayViewContext.md +34 -0
  249. package/api/@xmachines/play-vue-router/README.md +65 -56
  250. package/api/@xmachines/play-vue-router/classes/RouteMap.md +50 -48
  251. package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +26 -19
  252. package/api/@xmachines/play-vue-router/functions/createRouteMap.md +12 -11
  253. package/api/@xmachines/play-vue-router/interfaces/PlayActor.md +22 -20
  254. package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +39 -33
  255. package/api/@xmachines/play-vue-router/interfaces/RouteMapOptions.md +5 -5
  256. package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +11 -10
  257. package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +27 -24
  258. package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +2 -2
  259. package/api/@xmachines/play-vue-router/type-aliases/VueRouteMap.md +13 -0
  260. package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +5 -5
  261. package/api/@xmachines/play-vue-router/variables/VueRouteMap.md +13 -0
  262. package/api/@xmachines/play-xstate/README.md +72 -70
  263. package/api/@xmachines/play-xstate/classes/PlayerActor.md +123 -112
  264. package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +19 -16
  265. package/api/@xmachines/play-xstate/functions/composeGuards.md +25 -23
  266. package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +20 -20
  267. package/api/@xmachines/play-xstate/functions/contextFieldMatches.md +15 -15
  268. package/api/@xmachines/play-xstate/functions/definePlayer.md +19 -19
  269. package/api/@xmachines/play-xstate/functions/deriveRoute.md +26 -25
  270. package/api/@xmachines/play-xstate/functions/eventMatches.md +8 -8
  271. package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +16 -13
  272. package/api/@xmachines/play-xstate/functions/hasContext.md +8 -8
  273. package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +10 -10
  274. package/api/@xmachines/play-xstate/functions/negateGuard.md +19 -18
  275. package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +6 -6
  276. package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +7 -7
  277. package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +10 -10
  278. package/api/@xmachines/play-xstate/interfaces/RouteContext.md +15 -14
  279. package/api/@xmachines/play-xstate/interfaces/RouteObject.md +2 -2
  280. package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +5 -5
  281. package/api/@xmachines/play-xstate/type-aliases/Guard.md +9 -9
  282. package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +4 -3
  283. package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +7 -7
  284. package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +12 -12
  285. package/api/@xmachines/play-xstate/type-aliases/RouteMetadata.md +1 -1
  286. package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +15 -14
  287. package/api/@xmachines/shared/README.md +11 -13
  288. package/api/@xmachines/shared/vite-aliases/functions/xmAliases.md +1 -1
  289. package/api/@xmachines/shared/vite-aliases/functions/xmCacheDir.md +1 -1
  290. package/api/@xmachines/shared/vite-aliases/functions/xmOptimizeDeps.md +1 -1
  291. package/api/@xmachines/shared/vite-aliases/functions/xmResolve.md +1 -1
  292. package/api/@xmachines/shared/vite-aliases/functions/xmSvelteRunes.md +2 -2
  293. package/api/@xmachines/shared/vitest/functions/defineXmBrowserConfig.md +1 -1
  294. package/api/@xmachines/shared/vitest/functions/defineXmVitestConfig.md +1 -1
  295. package/api/@xmachines/shared/vitest/interfaces/XmBrowserConfigOptions.md +4 -4
  296. package/contributing/development.md +28 -0
  297. package/guides/inspector.md +1 -1
  298. package/package.json +1 -1
  299. package/api/@xmachines/play-vue/functions/getPlayViewContext.md +0 -28
package/README.md CHANGED
@@ -2,13 +2,11 @@
2
2
 
3
3
  > Documentation, guides, RFCs, and generated API reference for XMachines.
4
4
 
5
- Part of the `XMachines Play monorepo`.
6
-
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.0.0-blue)](https://www.npmjs.com/package/@xmachines/docs)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.1.0-blue)](https://www.npmjs.com/package/@xmachines/docs)
8
6
 
9
7
  ## Overview
10
8
 
11
- `@xmachines/docs` is the documentation package for the XMachines Play monorepo. It ships five categories of content:
9
+ `@xmachines/docs` is the documentation package of the XMachines Play monorepo. It ships five categories of content:
12
10
 
13
11
  | Location | Contents |
14
12
  | --------------- | ---------------------------------------------------------------- |
@@ -16,7 +14,7 @@ Part of the `XMachines Play monorepo`.
16
14
  | `guides/` | Concept guides, tutorials, and getting-started docs |
17
15
  | `contributing/` | Operational docs for contributors and maintainers |
18
16
  | `examples/` | Runnable code examples and demo application references |
19
- | `api/` | TypeDoc-generated API reference for all public packages |
17
+ | `api/` | The API reference for every public package, generated by TypeDoc |
20
18
 
21
19
  ## Installation
22
20
 
@@ -28,7 +26,7 @@ pnpm add @xmachines/docs
28
26
 
29
27
  ### Import the package URL
30
28
 
31
- The package default export is its own module URL useful for resolving doc assets at runtime:
29
+ The default export of the package is its own module URL. Use it to resolve documentation assets at run time:
32
30
 
33
31
  ```typescript
34
32
  import docsUrl from "@xmachines/docs";
@@ -37,7 +35,7 @@ import docsUrl from "@xmachines/docs";
37
35
 
38
36
  ### Access documentation files directly
39
37
 
40
- All documentation directories are exposed as package exports:
38
+ The package exports every documentation directory:
41
39
 
42
40
  ```typescript
43
41
  // Access RFC files
@@ -62,7 +60,7 @@ Architectural specifications that define the XMachines system:
62
60
  | File | Title | Description |
63
61
  | ---------------------------------- | ------- | -------------------------------------------------------------------- |
64
62
  | [`rfc/play.md`](rfc/play.md) | Play | Universal Player Architecture — core protocol, roles, and invariants |
65
- | [`rfc/streams.md`](rfc/streams.md) | Streams | WHATWG Streams as integration boundary |
63
+ | [`rfc/streams.md`](rfc/streams.md) | Streams | WHATWG Streams as the integration boundary |
66
64
  | [`rfc/broker.md`](rfc/broker.md) | Broker | Event broker specification |
67
65
  | [`rfc/git.md`](rfc/git.md) | Git | Git-compatible ID and history model |
68
66
  | [`rfc/run.md`](rfc/run.md) | Run | Runtime execution model |
@@ -74,7 +72,7 @@ Architectural specifications that define the XMachines system:
74
72
 
75
73
  ### Guides
76
74
 
77
- Concept guides and tutorials for working with XMachines:
75
+ Concept guides and tutorials that show how to use XMachines:
78
76
 
79
77
  **Learning:**
80
78
 
@@ -99,7 +97,7 @@ Reference documentation for contributors and maintainers:
99
97
 
100
98
  ### Examples
101
99
 
102
- Practical code examples demonstrating XMachines patterns:
100
+ Practical code examples that show the XMachines patterns:
103
101
 
104
102
  - **[Basic State Machine](examples/basic-state-machine.md)** — `setup().createMachine()` + `definePlayer()` + TC39 Signals
105
103
  - **[Traffic Light](examples/traffic-light.md)** — Multi-state machine with `meta.route` and `formatPlayRouteTransitions`
@@ -109,9 +107,9 @@ Practical code examples demonstrating XMachines patterns:
109
107
 
110
108
  ### API Reference
111
109
 
112
- TypeDoc-generated API reference for all public packages see [`api/README.md`](api/README.md).
110
+ TypeDoc generates the API reference for every public package. See [`api/README.md`](api/README.md).
113
111
 
114
- Packages documented:
112
+ The documented packages:
115
113
 
116
114
  - [`@xmachines/play`](../play/README.md) — Core protocols (`PlayEvent`, `PlayError`)
117
115
  - [`@xmachines/play-actor`](../play-actor/README.md) — `AbstractActor`, `Routable`, `Viewable`
@@ -135,7 +133,7 @@ pnpm test
135
133
 
136
134
  ## Regenerating API Docs
137
135
 
138
- The `api/` directory is auto-generated by TypeDoc and must not be edited directly. Regenerate it from the monorepo root:
136
+ TypeDoc generates the `api/` directory. Never edit it by hand. Generate it again from the monorepo root:
139
137
 
140
138
  ```bash
141
139
  pnpm run docs
@@ -2,11 +2,9 @@
2
2
 
3
3
  # `@xmachines/play`
4
4
 
5
- > Core protocol layer for the Universal Player Architecture defines `PlayEvent`, `PlayError`, and architectural contracts enabling loose coupling between business logic and runtime adapters.
5
+ > Core protocol layer for the Universal Player Architecture. It defines `PlayEvent`, `PlayError`, and the contracts that keep the business logic loosely coupled to the runtime adapters.
6
6
 
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.0.0-blue)](https://www.npmjs.com/package/@xmachines/play)
8
-
9
- Part of the [XMachines JS monorepo](../../README.md).
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.1.0-blue)](https://www.npmjs.com/package/@xmachines/play)
10
8
 
11
9
  ---
12
10
 
@@ -16,27 +14,27 @@ Part of the [XMachines JS monorepo](../../README.md).
16
14
  pnpm add @xmachines/play
17
15
  ```
18
16
 
19
- > **Node.js `>= 22.0.0` required.** All packages are ES modules (`"type": "module"`).
17
+ > **This package requires Node.js `>= 22.0.0`.** Every package is an ES module (`"type": "module"`).
20
18
 
21
19
  ---
22
20
 
23
21
  ## Overview
24
22
 
25
- `@xmachines/play` is the foundational package in the XMachines ecosystem. It defines the minimal set of types and utilities that all other `@xmachines/*` packages build upon:
23
+ `@xmachines/play` is the base package of the XMachines ecosystem. It defines the smallest set of types and utilities that every other `@xmachines/*` package builds on:
26
24
 
27
25
  - **`PlayEvent<TPayload>`** — the universal event contract for Actor ↔ Infrastructure communication
28
26
  - **`PlayError`** — the typed base class for all `@xmachines/*` runtime errors
29
- - **`NonNullableError`** — thrown when a required value is `null` or `undefined`
30
- - **`assertNonNullable()`** — assertion utility that narrows `T | null | undefined` to `T`
27
+ - **`NonNullableError`** — the error that a package throws when a required value is `null` or `undefined`
28
+ - **`assertNonNullable()`** — the assertion utility that narrows `T | null | undefined` to `T`
31
29
 
32
- These protocols implement the architectural invariants defined in the Play RFC:
30
+ These protocols implement the architectural invariants that the Play RFC defines:
33
31
 
34
- | # | Invariant | Description |
35
- | ------ | -------------------------- | ------------------------------------------------------------------ |
36
- | INV-01 | **Actor Authority** | The Actor is the final authority; guards decide all transitions |
37
- | INV-02 | **Strict Separation** | Business logic never imports UI frameworks or routing libraries |
38
- | INV-04 | **Passive Infrastructure** | Infrastructure observes Actor signals; it never enforces guards |
39
- | INV-05 | **Signal-Only Reactivity** | TC39 Signals are the exclusive cross-boundary communication medium |
32
+ | # | Invariant | Description |
33
+ | ------ | -------------------------- | ------------------------------------------------------------------------ |
34
+ | INV-01 | **Actor Authority** | The Actor is the final authority. Guards decide all transitions |
35
+ | INV-02 | **Strict Separation** | The business logic never imports a UI framework or a routing library |
36
+ | INV-04 | **Passive Infrastructure** | The infrastructure observes the Actor signals. It never enforces a guard |
37
+ | INV-05 | **Signal-Only Reactivity** | TC39 Signals are the only medium that crosses a boundary |
40
38
 
41
39
  ---
42
40
 
@@ -44,7 +42,7 @@ These protocols implement the architectural invariants defined in the Play RFC:
44
42
 
45
43
  ### `PlayEvent<TPayload>`
46
44
 
47
- The minimal event contract: any object with a `type: string` property. Framework-agnostic works with XState, Robot, and any other state machine library.
45
+ The minimal event contract is any object with a `type: string` property. The contract is framework-agnostic. It works with XState, with Robot, and with every other state machine library.
48
46
 
49
47
  ```typescript
50
48
  import type { PlayEvent } from "@xmachines/play";
@@ -67,14 +65,14 @@ const invalid: LoginEvent = { type: "auth.login" }; // Error!
67
65
 
68
66
  ### `PlayError`
69
67
 
70
- Base class for all `@xmachines/*` runtime errors. Every error has a stable `scope` (throwing class/module) and `code` (machine-readable identifier). Always branch on `.code` or subclass never on `.message`.
68
+ Base class for every `@xmachines/*` runtime error. Each error has a stable `scope` (the class or the module that throws it) and a stable `code` (a machine-readable identifier). Always branch on `.code` or on the subclass. Never branch on `.message`.
71
69
 
72
70
  ```typescript
73
- import { PlayError } from "@xmachines/play";
71
+ import { PlayError, assertNonNullable } from "@xmachines/play";
74
72
  import { NonNullableError } from "@xmachines/play/errors";
75
73
 
76
74
  try {
77
- bridge.connect();
75
+ assertNonNullable(document.getElementById("app"), "#app");
78
76
  } catch (err) {
79
77
  if (err instanceof NonNullableError) {
80
78
  // err.scope === "assertNonNullable"
@@ -104,15 +102,12 @@ export class MyPackageError extends PlayError {
104
102
 
105
103
  ### `assertNonNullable(value, name?)`
106
104
 
107
- Assertion utility that returns `value` typed as `NonNullable<V>` or throws `NonNullableError`. Eliminates unsafe `!` non-null assertions.
105
+ The assertion utility returns `value` with the type `NonNullable<V>`, or it throws `NonNullableError`. It removes the unsafe `!` non-null assertion.
108
106
 
109
107
  ```typescript
110
108
  import { assertNonNullable } from "@xmachines/play";
111
109
 
112
- // Inject + assert in one line — no intermediate variable or `!` needed:
113
- const actor = assertNonNullable(inject<AuthActor>("actor"), "actor");
114
-
115
- // DOM element lookup:
110
+ // DOM element lookup — no intermediate variable or `!` needed:
116
111
  const el = assertNonNullable(document.getElementById("app"), "#app");
117
112
  ```
118
113
 
@@ -122,18 +117,18 @@ const el = assertNonNullable(document.getElementById("app"), "#app");
122
117
 
123
118
  ### Exported from `@xmachines/play`
124
119
 
125
- | Export | Kind | Description |
126
- | --------------------- | ---------- | ---------------------------------------------------------------- |
127
- | `PlayEvent<TPayload>` | `type` | Universal event contract — `{ type: string } & TPayload` |
128
- | `PlayError` | `class` | Base class for all `@xmachines/*` typed errors |
129
- | `NonNullableError` | `class` | Thrown by `assertNonNullable` when a value is `null`/`undefined` |
130
- | `assertNonNullable` | `function` | Asserts non-null, returns narrowed value |
120
+ | Export | Kind | Description |
121
+ | --------------------- | ---------- | ------------------------------------------------------------------- |
122
+ | `PlayEvent<TPayload>` | `type` | Universal event contract — `{ type: string } & TPayload` |
123
+ | `PlayError` | `class` | Base class for all `@xmachines/*` typed errors |
124
+ | `NonNullableError` | `class` | `assertNonNullable` throws it when a value is `null` or `undefined` |
125
+ | `assertNonNullable` | `function` | Asserts that the value is not null. It returns the narrowed value |
131
126
 
132
127
  ### Exported from `@xmachines/play/errors`
133
128
 
134
129
  | Export | Kind | Description |
135
130
  | ------------------ | ------- | --------------------------------------------------------- |
136
- | `PlayError` | `class` | Re-exported base error class |
131
+ | `PlayError` | `class` | The base error class, re-exported |
137
132
  | `NonNullableError` | `class` | `scope: "assertNonNullable"`, `code: "PLAY_NON_NULLABLE"` |
138
133
 
139
134
  ---
@@ -144,15 +139,13 @@ const el = assertNonNullable(document.getElementById("app"), "#app");
144
139
  | ------------------- | ------------------ | ---------------------------------------------------- |
145
140
  | `PLAY_NON_NULLABLE` | `NonNullableError` | `assertNonNullable()` receives `null` or `undefined` |
146
141
 
147
- Other `@xmachines/*` packages export their own error subclasses from their respective `./errors` subpath:
142
+ Every other `@xmachines/*` package exports its own error subclasses from its `./errors` subpath:
148
143
 
149
144
  | Package | Import path |
150
145
  | ---------------------------- | ----------------------------------- |
151
146
  | `@xmachines/play` | `@xmachines/play/errors` |
152
147
  | `@xmachines/play-router` | `@xmachines/play-router/errors` |
153
148
  | `@xmachines/play-xstate` | `@xmachines/play-xstate/errors` |
154
- | `@xmachines/play-react` | `@xmachines/play-react/errors` |
155
- | `@xmachines/play-solid` | `@xmachines/play-solid/errors` |
156
149
  | `@xmachines/play-vue-router` | `@xmachines/play-vue-router/errors` |
157
150
 
158
151
  ---
@@ -181,59 +174,61 @@ MIT © [Mikael Karon](mailto:mikael@karon.se)
181
174
 
182
175
  See [LICENSE](./LICENSE) for details.
183
176
 
184
- @xmachines/play - Core Protocol Layer
177
+ @xmachines/play - the core protocol layer
185
178
 
186
- Defines architectural contracts enabling Actor Infrastructure communication
187
- without direct dependencies. Per RFC section 5.2, these protocols establish
188
- the foundation for loose coupling between business logic and runtime adapters.
179
+ This package defines the architectural contracts that carry the communication
180
+ between the Actor and the infrastructure, with no direct dependency between them.
181
+ RFC section 5.2 gives these protocols. They are the base of the loose coupling
182
+ between the business logic and the runtime adapters.
189
183
 
190
- ## Exports
184
+ ## The exports
191
185
 
192
- **PlayEvent<TPayload>** - Generic event type for Actor communication
186
+ **PlayEvent<TPayload>** - the generic event type of the Actor communication
193
187
 
194
- - Any object with a `type: string` property
195
- - Generic `TPayload` parameter for type-safe event shapes (optional)
196
- - Defaults to `Record<string, unknown>` for maximum flexibility
197
- - Framework-agnostic (not tied to XState or any specific library)
188
+ - It is every object with a `type: string` property
189
+ - The generic `TPayload` parameter gives a type-safe event shape, and it is optional
190
+ - The default is `Record<string, unknown>`, which accepts each shape
191
+ - It is framework-agnostic, and it is not bound to XState or to another library
198
192
 
199
- **Usage:**
193
+ **Use:**
200
194
 
201
195
  ```typescript
202
- // Flexible (default):
196
+ // Flexible, the default:
203
197
  const event: PlayEvent = { type: "auth.login", userId: "123" };
204
198
 
205
- // Type-safe (with generic):
199
+ // Type-safe, with the generic parameter:
206
200
  type LoginEvent = PlayEvent<{ userId: string }>;
207
201
  const event: LoginEvent = { type: "auth.login", userId: "123" };
208
202
  ```
209
203
 
210
- **Common Event Patterns:**
204
+ **The common event patterns:**
211
205
 
212
- - Domain events: `{ type: 'auth.login', userId: '123' }`
213
- - Custom events: `{ type: 'form.submit', data: {...} }`
206
+ - A domain event: `{ type: 'auth.login', userId: '123' }`
207
+ - Your own event: `{ type: 'form.submit', data: {...} }`
214
208
 
215
- **Routing Events** are provided by @xmachines/play-router:
209
+ **The routing events** come from @xmachines/play-router:
216
210
 
217
- - PlayRouteEvent: Enhanced routing with parameters and state ID targeting
218
- - RouterBridge: Protocol for router adapters to connect with actors
211
+ - PlayRouteEvent: the routing event with the parameters and the target state ID
212
+ - RouterBridge: the protocol that connects a router adapter to an actor
219
213
 
220
- **Browser Navigation:** Browser back/forward buttons are handled by router adapters
221
- via the `popstate` event. When users press back/forward, the router detects the URL
222
- change and sends a PlayRouteEvent to the actor for validation.
214
+ **The browser navigation:** a router adapter handles the browser BACK and FORWARD
215
+ buttons, through the `popstate` event. The user presses BACK or FORWARD, the
216
+ router detects the new URL, and it sends a PlayRouteEvent to the actor. The actor
217
+ then checks the event.
223
218
 
224
219
  ```typescript
225
220
  import type { PlayRouteEvent, RouterBridge } from "@xmachines/play-router";
226
221
  ```
227
222
 
228
- ## Architectural Invariants
223
+ ## The architectural invariants
229
224
 
230
- These protocols enforce the following invariants:
225
+ These protocols enforce the invariants below:
231
226
 
232
- 1. **Actor Authority**: Infrastructure proposes intents, Actor decides validity
233
- 2. **Strict Separation**: No direct dependencies between layers
234
- 3. **Passive Infrastructure**: Infrastructure observes Actor signals, never controls
235
- 4. **Signal-Only Reactivity**: All state changes flow through TC39 Signals
236
- 5. **State-Driven Reset**: Navigation follows state machine transition rules
227
+ 1. **Actor Authority**: the infrastructure makes a request, and the Actor decides the validity
228
+ 2. **Strict Separation**: no layer depends on another layer directly
229
+ 3. **Passive Infrastructure**: the infrastructure observes the Actor signals. It never controls them
230
+ 4. **Signal-Only Reactivity**: every state change goes through a TC39 Signal
231
+ 5. **State-Driven Reset**: each navigation follows the transition rules of the state machine
237
232
 
238
233
  ## Classes
239
234
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  # Class: NonNullableError
4
4
 
5
- Defined in: [packages/play/src/errors.ts:111](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L111)
5
+ Defined in: [packages/play/src/errors.ts:110](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L110)
6
6
 
7
- Thrown by [assertNonNullable](../functions/assertNonNullable.md) when a value is `null` or `undefined`.
7
+ [assertNonNullable](../functions/assertNonNullable.md) throws this error when a value is `null` or `undefined`.
8
8
 
9
- Catch this specifically to distinguish a missing-value assertion failure from
10
- other runtime errors:
9
+ Catch it to separate a failed assertion of a missing value from every other
10
+ runtime error:
11
11
 
12
12
  ```ts
13
13
  import { NonNullableError } from "@xmachines/play/errors";
@@ -35,7 +35,7 @@ try {
35
35
  new NonNullableError(message, options?): NonNullableError;
36
36
  ```
37
37
 
38
- Defined in: [packages/play/src/errors.ts:112](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L112)
38
+ Defined in: [packages/play/src/errors.ts:111](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L111)
39
39
 
40
40
  #### Parameters
41
41
 
@@ -57,10 +57,10 @@ Defined in: [packages/play/src/errors.ts:112](https://gitlab.com/xmachin-es/xmac
57
57
  | Property | Modifier | Type | Description | Inherited from | Defined in |
58
58
  | ------------------------------------------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
59
59
  | <a id="property-cause"></a> `cause?` | `public` | `unknown` | - | [`PlayError`](PlayError.md).[`cause`](PlayError.md#property-cause) | - |
60
- | <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable error identifier. Error codes follow the `PLAY_<PACKAGE>_<DESCRIPTION>` naming convention and are guaranteed stable across patch and minor releases within a major version. Never match on `.message` always match on `.code` or the subclass. | [`PlayError`](PlayError.md).[`code`](PlayError.md#property-code) | [packages/play/src/errors.ts:75](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L75) |
60
+ | <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable identifier of the error. An error code follows the naming convention `PLAY_<PACKAGE>_<DESCRIPTION>`. It stays the same across each patch release and each minor release of one major version. Never match on `.message`. Always match on `.code`, or on the subclass. | [`PlayError`](PlayError.md).[`code`](PlayError.md#property-code) | [packages/play/src/errors.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L74) |
61
61
  | <a id="property-message"></a> `message` | `public` | `string` | - | [`PlayError`](PlayError.md).[`message`](PlayError.md#property-message) | - |
62
62
  | <a id="property-name"></a> `name` | `public` | `string` | - | [`PlayError`](PlayError.md).[`name`](PlayError.md#property-name) | - |
63
- | <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or module that threw this error (e.g. `"RouterBridgeBase"`). | [`PlayError`](PlayError.md).[`scope`](PlayError.md#property-scope) | [packages/play/src/errors.ts:66](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L66) |
63
+ | <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or the module that threw this error, for example `"RouterBridgeBase"`. | [`PlayError`](PlayError.md).[`scope`](PlayError.md#property-scope) | [packages/play/src/errors.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L64) |
64
64
  | <a id="property-stack"></a> `stack?` | `public` | `string` | - | [`PlayError`](PlayError.md).[`stack`](PlayError.md#property-stack) | - |
65
65
  | <a id="property-stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | [`PlayError`](PlayError.md).[`stackTraceLimit`](PlayError.md#property-stacktracelimit) | - |
66
66
 
@@ -2,21 +2,21 @@
2
2
 
3
3
  # Class: PlayError
4
4
 
5
- Defined in: [packages/play/src/errors.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L64)
5
+ Defined in: [packages/play/src/errors.ts:62](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L62)
6
6
 
7
- Base class for all typed runtime errors thrown by `@xmachines/*` packages.
7
+ The base class of every typed runtime error of an `@xmachines/*` package.
8
8
 
9
- `PlayError` gives every error two structured fields:
9
+ `PlayError` gives each error two structured fields:
10
10
 
11
- - `scope` — the class or module that threw (e.g. `"RouterBridgeBase"`)
12
- - `code` — a stable, machine-readable identifier (e.g. `"PLAY_ROUTER_SYNC_FAILED"`)
11
+ - `scope` — the class or the module that threw the error, for example `"RouterBridgeBase"`
12
+ - `code` — a stable, machine-readable identifier, for example `"PLAY_ROUTER_SYNC_FAILED"`
13
13
 
14
- These fields let application code branch on error type without parsing `.message`
15
- strings, which change across releases.
14
+ Your application code therefore branches on the type of an error, and it does not
15
+ parse the `.message` string. A message changes between releases.
16
16
 
17
- ## Error codes
17
+ ## The error codes
18
18
 
19
- Each `@xmachines/*` package exports its own typed subclasses from an
19
+ An `@xmachines/*` package that defines typed subclasses exports them from an
20
20
  `"./errors"` subpath:
21
21
 
22
22
  | Package | Import |
@@ -25,13 +25,11 @@ Each `@xmachines/*` package exports its own typed subclasses from an
25
25
  | `@xmachines/play-router` | `@xmachines/play-router/errors` |
26
26
  | `@xmachines/play-vue-router` | `@xmachines/play-vue-router/errors` |
27
27
  | `@xmachines/play-xstate` | `@xmachines/play-xstate/errors` |
28
- | `@xmachines/play-react` | `@xmachines/play-react/errors` |
29
- | `@xmachines/play-solid` | `@xmachines/play-solid/errors` |
30
28
 
31
- `PlayError` itself is exported from the root `@xmachines/play` and is the base
32
- for all of those subclasses.
29
+ The root `@xmachines/play` exports `PlayError` itself, and it is the base of every
30
+ subclass above.
33
31
 
34
- ## Catching errors by type
32
+ ## How to catch an error by its type
35
33
 
36
34
  ```typescript
37
35
  import { PlayError } from "@xmachines/play";
@@ -43,18 +41,18 @@ try {
43
41
  if (err instanceof RouterSyncError) {
44
42
  // err.scope === "RouterBridgeBase"
45
43
  // err.code === "PLAY_ROUTER_SYNC_FAILED"
46
- // err.cause — the original error that triggered the sync failure
44
+ // err.cause — the original error of the failed synchronization
47
45
  reportToMonitoring(err);
48
46
  } else if (err instanceof PlayError) {
49
- // Any other @xmachines/* error
47
+ // Every other @xmachines/* error
50
48
  console.error(`[${err.scope}:${err.code}] ${err.message}`);
51
49
  } else {
52
- throw err; // Re-throw unknown errors
50
+ throw err; // Throw an unknown error again
53
51
  }
54
52
  }
55
53
  ```
56
54
 
57
- ## Extending PlayError
55
+ ## How to extend PlayError
58
56
 
59
57
  ```typescript
60
58
  import { PlayError } from "@xmachines/play";
@@ -87,16 +85,16 @@ new PlayError(
87
85
  options?): PlayError;
88
86
  ```
89
87
 
90
- Defined in: [packages/play/src/errors.ts:83](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L83)
88
+ Defined in: [packages/play/src/errors.ts:82](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L82)
91
89
 
92
90
  #### Parameters
93
91
 
94
- | Parameter | Type | Description |
95
- | ---------- | -------------- | ------------------------------------------------------------------------- |
96
- | `scope` | `string` | The class or module throwing this error. |
97
- | `code` | `string` | Machine-readable error identifier (e.g. `"PLAY_ROUTER_SYNC_FAILED"`). |
98
- | `message` | `string` | Human-readable description. Do not match on this in code. |
99
- | `options?` | `ErrorOptions` | Standard `ErrorOptions`; pass `{ cause: originalError }` to chain errors. |
92
+ | Parameter | Type | Description |
93
+ | ---------- | -------------- | --------------------------------------------------------------------------------------- |
94
+ | `scope` | `string` | The class or the module that throws this error. |
95
+ | `code` | `string` | The machine-readable identifier of the error, for example `"PLAY_ROUTER_SYNC_FAILED"`. |
96
+ | `message` | `string` | The description for a person. Never match on it in your code. |
97
+ | `options?` | `ErrorOptions` | The standard `ErrorOptions`. Give `{ cause: originalError }` to make a chain of errors. |
100
98
 
101
99
  #### Returns
102
100
 
@@ -113,10 +111,10 @@ Error.constructor;
113
111
  | Property | Modifier | Type | Description | Inherited from | Defined in |
114
112
  | ------------------------------------------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- |
115
113
  | <a id="property-cause"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | - |
116
- | <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable error identifier. Error codes follow the `PLAY_<PACKAGE>_<DESCRIPTION>` naming convention and are guaranteed stable across patch and minor releases within a major version. Never match on `.message` always match on `.code` or the subclass. | - | [packages/play/src/errors.ts:75](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L75) |
114
+ | <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable identifier of the error. An error code follows the naming convention `PLAY_<PACKAGE>_<DESCRIPTION>`. It stays the same across each patch release and each minor release of one major version. Never match on `.message`. Always match on `.code`, or on the subclass. | - | [packages/play/src/errors.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L74) |
117
115
  | <a id="property-message"></a> `message` | `public` | `string` | - | `Error.message` | - |
118
116
  | <a id="property-name"></a> `name` | `public` | `string` | - | `Error.name` | - |
119
- | <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or module that threw this error (e.g. `"RouterBridgeBase"`). | - | [packages/play/src/errors.ts:66](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/errors.ts#L66) |
117
+ | <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or the module that threw this error, for example `"RouterBridgeBase"`. | - | [packages/play/src/errors.ts:64](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/errors.ts#L64) |
120
118
  | <a id="property-stack"></a> `stack?` | `public` | `string` | - | `Error.stack` | - |
121
119
  | <a id="property-stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | - |
122
120
 
@@ -6,19 +6,19 @@
6
6
  function assertNonNullable<V>(value, name?): NonNullable<V>;
7
7
  ```
8
8
 
9
- Defined in: [packages/play/src/utils.ts:39](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.0.0/packages/play/src/utils.ts#L39)
9
+ Defined in: [packages/play/src/utils.ts:39](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v2.1.0/packages/play/src/utils.ts#L39)
10
10
 
11
- Assert that `value` is neither `null` nor `undefined`, and return it typed
12
- as `NonNullable<V>` combining the guard and the narrowed value in a single
13
- expression.
11
+ Asserts that `value` is not `null` and not `undefined`, then returns it with the
12
+ type `NonNullable<V>`. One expression therefore holds the guard and the narrowed
13
+ value.
14
14
 
15
- Unlike a non-null assertion (`value!`), this throws a descriptive error at
16
- the point of failure rather than producing `undefined`-is-not-an-object`
17
- crashes somewhere downstream.
15
+ A non-null assertion (`value!`) is different: it produces `undefined`, and your
16
+ code then fails later with a message such as "undefined is not an object". This
17
+ function throws a clear error at the point of the failure.
18
18
 
19
- Unlike an `asserts value is T` assertion function, this returns the narrowed
20
- value directly, so no separate variable or `as` cast is required at the call
21
- site.
19
+ An assertion function of the form `asserts value is T` is also different: this
20
+ function returns the narrowed value directly. Therefore the call site needs no
21
+ second variable and no `as` cast.
22
22
 
23
23
  ## Type Parameters
24
24
 
@@ -28,16 +28,16 @@ site.
28
28
 
29
29
  ## Parameters
30
30
 
31
- | Parameter | Type | Description |
32
- | --------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
33
- | `value` | `V` | The value to check. |
34
- | `name?` | `string` | Optional name included in the error message to identify the missing value (e.g. the variable or injection key name). |
31
+ | Parameter | Type | Description |
32
+ | --------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
33
+ | `value` | `V` | The value to check. |
34
+ | `name?` | `string` | The optional name in the error message. It identifies the missing value, for example the name of the variable or of the injection key. |
35
35
 
36
36
  ## Returns
37
37
 
38
38
  `NonNullable`\<`V`\>
39
39
 
40
- `value` typed as `NonNullable<V>` `null` and `undefined` removed.
40
+ `value` with the type `NonNullable<V>`, without `null` and without `undefined`.
41
41
 
42
42
  ## Throws
43
43
 
@@ -48,9 +48,9 @@ When `value` is `null` or `undefined`.
48
48
  ```ts
49
49
  import { assertNonNullable } from "@xmachines/play";
50
50
 
51
- // inject() + assertNonNullable in one line no `!` or intermediate variable:
51
+ // inject() and assertNonNullable in one line, with no `!` and no second variable:
52
52
  const actor = assertNonNullable(inject<AuthActor>("actor"), "actor");
53
53
 
54
- // Element lookup:
54
+ // A lookup of an element:
55
55
  const el = assertNonNullable(document.getElementById("app"), "#app");
56
56
  ```