@xmachines/docs 1.0.0-beta.10
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.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/api/@xmachines/play/README.md +130 -0
- package/api/@xmachines/play/type-aliases/PlayEvent.md +81 -0
- package/api/@xmachines/play-actor/README.md +247 -0
- package/api/@xmachines/play-actor/classes/AbstractActor.md +520 -0
- package/api/@xmachines/play-actor/interfaces/Routable.md +29 -0
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +17 -0
- package/api/@xmachines/play-actor/interfaces/Viewable.md +12 -0
- package/api/@xmachines/play-catalog/README.md +331 -0
- package/api/@xmachines/play-catalog/functions/defineCatalog.md +98 -0
- package/api/@xmachines/play-catalog/functions/defineComponents.md +134 -0
- package/api/@xmachines/play-catalog/type-aliases/Catalog.md +48 -0
- package/api/@xmachines/play-catalog/type-aliases/ComponentsFor.md +20 -0
- package/api/@xmachines/play-catalog/type-aliases/InferComponentProps.md +65 -0
- package/api/@xmachines/play-catalog/type-aliases/NoExtraKeys.md +17 -0
- package/api/@xmachines/play-react/README.md +423 -0
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +613 -0
- package/api/@xmachines/play-react/functions/useSignalEffect.md +68 -0
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +15 -0
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +14 -0
- package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +15 -0
- package/api/@xmachines/play-react/variables/PlayRenderer.md +64 -0
- package/api/@xmachines/play-react-router/README.md +198 -0
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +321 -0
- package/api/@xmachines/play-react-router/classes/RouteMap.md +137 -0
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +19 -0
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +35 -0
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +14 -0
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +17 -0
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-react-router-demo/README.md +137 -0
- package/api/@xmachines/play-router/README.md +502 -0
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +142 -0
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +300 -0
- package/api/@xmachines/play-router/functions/buildRouteTree.md +27 -0
- package/api/@xmachines/play-router/functions/connectRouter.md +67 -0
- package/api/@xmachines/play-router/functions/crawlMachine.md +92 -0
- package/api/@xmachines/play-router/functions/createBrowserHistory.md +47 -0
- package/api/@xmachines/play-router/functions/createRouteMap.md +53 -0
- package/api/@xmachines/play-router/functions/createRouter.md +76 -0
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +32 -0
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +64 -0
- package/api/@xmachines/play-router/functions/extractRoute.md +45 -0
- package/api/@xmachines/play-router/functions/findRouteById.md +37 -0
- package/api/@xmachines/play-router/functions/findRouteByPath.md +39 -0
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +35 -0
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +39 -0
- package/api/@xmachines/play-router/functions/routeExists.md +26 -0
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +29 -0
- package/api/@xmachines/play-router/functions/validateStateExists.md +29 -0
- package/api/@xmachines/play-router/interfaces/BaseRouteMapping.md +27 -0
- package/api/@xmachines/play-router/interfaces/BrowserHistory.md +172 -0
- package/api/@xmachines/play-router/interfaces/BrowserWindow.md +69 -0
- package/api/@xmachines/play-router/interfaces/ConnectRouterOptions.md +13 -0
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +19 -0
- package/api/@xmachines/play-router/interfaces/RouteMap.md +56 -0
- package/api/@xmachines/play-router/interfaces/RouteNode.md +21 -0
- package/api/@xmachines/play-router/interfaces/RouteObject.md +21 -0
- package/api/@xmachines/play-router/interfaces/RouteTree.md +20 -0
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-router/interfaces/StateVisit.md +15 -0
- package/api/@xmachines/play-router/interfaces/VanillaRouter.md +28 -0
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +11 -0
- package/api/@xmachines/play-router-demo/README.md +137 -0
- package/api/@xmachines/play-signals/README.md +176 -0
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +34 -0
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +49 -0
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +35 -0
- package/api/@xmachines/play-signals/interfaces/SignalState.md +68 -0
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +97 -0
- package/api/@xmachines/play-signals/namespaces/Signal/README.md +22 -0
- package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +52 -0
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +72 -0
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +19 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/README.md +21 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +85 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +13 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +19 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +19 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +19 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +19 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +25 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +9 -0
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +9 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +19 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +19 -0
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +19 -0
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +32 -0
- package/api/@xmachines/play-solid/README.md +311 -0
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +15 -0
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +70 -0
- package/api/@xmachines/play-solid-router/README.md +666 -0
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +150 -0
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +347 -0
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +19 -0
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +32 -0
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +486 -0
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +14 -0
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +14 -0
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +51 -0
- package/api/@xmachines/play-solid-router-demo/README.md +127 -0
- package/api/@xmachines/play-tanstack-react-router/README.md +226 -0
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +137 -0
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +348 -0
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +19 -0
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +53 -0
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +35 -0
- package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +38 -0
- package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +33 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +14 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +17 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +26 -0
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +9 -0
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +78 -0
- package/api/@xmachines/play-tanstack-react-router/variables/extractMachineRoutes.md +64 -0
- package/api/@xmachines/play-tanstack-react-router-demo/README.md +126 -0
- package/api/@xmachines/play-tanstack-solid-router/README.md +285 -0
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +150 -0
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +343 -0
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +19 -0
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +32 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +14 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +23 -0
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +9 -0
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +78 -0
- package/api/@xmachines/play-tanstack-solid-router-demo/README.md +126 -0
- package/api/@xmachines/play-vue/README.md +292 -0
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +14 -0
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +9 -0
- package/api/@xmachines/play-vue-router/README.md +604 -0
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +209 -0
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +201 -0
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +360 -0
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +19 -0
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +119 -0
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +15 -0
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +104 -0
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +9 -0
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +67 -0
- package/api/@xmachines/play-vue-router-demo/README.md +133 -0
- package/api/@xmachines/play-xstate/README.md +512 -0
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +527 -0
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +43 -0
- package/api/@xmachines/play-xstate/functions/composeGuards.md +79 -0
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +67 -0
- package/api/@xmachines/play-xstate/functions/definePlayer.md +127 -0
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +109 -0
- package/api/@xmachines/play-xstate/functions/eventMatches.md +40 -0
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +54 -0
- package/api/@xmachines/play-xstate/functions/hasContext.md +42 -0
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +41 -0
- package/api/@xmachines/play-xstate/functions/mergeViewProps.md +26 -0
- package/api/@xmachines/play-xstate/functions/negateGuard.md +61 -0
- package/api/@xmachines/play-xstate/functions/stateMatches.md +25 -0
- package/api/@xmachines/play-xstate/functions/validateComponentBinding.md +39 -0
- package/api/@xmachines/play-xstate/functions/validateViewProps.md +80 -0
- package/api/@xmachines/play-xstate/interfaces/CatalogEntry.md +16 -0
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +24 -0
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +26 -0
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +22 -0
- package/api/@xmachines/play-xstate/type-aliases/Catalog.md +21 -0
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +14 -0
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +34 -0
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +20 -0
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +29 -0
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +45 -0
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +51 -0
- package/api/@xmachines/play-xstate/type-aliases/ValidationResult.md +17 -0
- package/api/@xmachines/play-xstate/type-aliases/ViewMergeContext.md +35 -0
- package/api/@xmachines/shared/README.md +379 -0
- package/api/@xmachines/shared/functions/defineXmVitestConfig.md +29 -0
- package/api/@xmachines/shared/functions/xmAliases.md +24 -0
- package/api/README.md +25 -0
- package/api/llms.txt +26 -0
- package/examples/README.md +63 -0
- package/examples/basic-state-machine.md +70 -0
- package/examples/form-validation.md +167 -0
- package/examples/multi-router-integration.md +277 -0
- package/examples/routing-patterns.md +260 -0
- package/examples/traffic-light.md +99 -0
- package/guides/README.md +29 -0
- package/guides/getting-started.md +223 -0
- package/guides/installation.md +323 -0
- package/index.d.ts +3 -0
- package/index.js +4 -0
- package/package.json +54 -0
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-xstate](../README.md) / PlayerActor
|
|
2
|
+
|
|
3
|
+
# Class: PlayerActor\<TMachine\>
|
|
4
|
+
|
|
5
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:120](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L120)
|
|
6
|
+
|
|
7
|
+
Concrete XState actor implementing Play Architecture signal protocol
|
|
8
|
+
|
|
9
|
+
Extends [@xmachines/play-actor!AbstractActor](../../play-actor/classes/AbstractActor.md) to provide XState v5 integration
|
|
10
|
+
while maintaining ecosystem compatibility (XState inspection, devtools). This actor
|
|
11
|
+
wraps an internal XState actor and exposes TC39 Signal-based reactive state for
|
|
12
|
+
Infrastructure observation.
|
|
13
|
+
|
|
14
|
+
**Capabilities:** Implements both [@xmachines/play-actor!Routable](../../play-actor/interfaces/Routable.md) and
|
|
15
|
+
[@xmachines/play-actor!Viewable](../../play-actor/interfaces/Viewable.md) interfaces, providing routing and view
|
|
16
|
+
rendering support.
|
|
17
|
+
|
|
18
|
+
**Architectural Context:** Implements **Actor Authority (INV-01)** by ensuring the
|
|
19
|
+
XState machine's guards control all navigation decisions. Infrastructure observes
|
|
20
|
+
the actor's signals (`state`, `currentRoute`, `currentView`) but cannot directly
|
|
21
|
+
manipulate state—all mutations flow through the state machine's event handlers.
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
Basic actor creation and lifecycle
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { setup } from "xstate";
|
|
29
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
30
|
+
|
|
31
|
+
const machine = setup({}).createMachine({
|
|
32
|
+
initial: "idle",
|
|
33
|
+
states: {
|
|
34
|
+
idle: {
|
|
35
|
+
meta: { route: "/", view: { component: "HomePage" } },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const createPlayer = definePlayer({ machine });
|
|
41
|
+
const actor = createPlayer();
|
|
42
|
+
actor.start();
|
|
43
|
+
|
|
44
|
+
// Observe signals
|
|
45
|
+
console.log(actor.currentRoute.get()); // '/'
|
|
46
|
+
console.log(actor.currentView.get()); // { component: 'HomePage' }
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Signal lifecycle with watchers (microtask batching)
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { Signal } from "@xmachines/play-signals";
|
|
53
|
+
|
|
54
|
+
const watcher = new Signal.subtle.Watcher(() => {
|
|
55
|
+
queueMicrotask(() => {
|
|
56
|
+
const pending = watcher.getPending();
|
|
57
|
+
console.log("State changed:", actor.state.get());
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
watcher.watch(actor.state);
|
|
62
|
+
actor.send({ type: "play.route", to: "#about" });
|
|
63
|
+
// Watcher notification scheduled via microtask
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## See
|
|
67
|
+
|
|
68
|
+
- [RFC Play v1](https://gitlab.com/xmachin-es/rfc/-/blob/main/src/play-v1.md)
|
|
69
|
+
- [definePlayer](../functions/definePlayer.md) for factory creation
|
|
70
|
+
- [@xmachines/play-actor!AbstractActor](../../play-actor/classes/AbstractActor.md) for signal protocol
|
|
71
|
+
- [@xmachines/play-actor!Routable](../../play-actor/interfaces/Routable.md) for routing capability
|
|
72
|
+
- [@xmachines/play-actor!Viewable](../../play-actor/interfaces/Viewable.md) for view rendering capability
|
|
73
|
+
|
|
74
|
+
## Remarks
|
|
75
|
+
|
|
76
|
+
**Routing:** This actor supports both XState's `route: {}` config pattern
|
|
77
|
+
and `play.route` events with parameters. The `deriveRoute()` function checks
|
|
78
|
+
`meta.route` (Stately pattern) for URL templates with parameter substitution support.
|
|
79
|
+
|
|
80
|
+
**View Signal Pattern:** The `currentView` signal is a direct `Signal.State` (not
|
|
81
|
+
`Signal.Computed`) to ensure proper watcher propagation in PlayRenderer. Views are
|
|
82
|
+
cached and updated at state entry, not computed on every read.
|
|
83
|
+
|
|
84
|
+
## Extends
|
|
85
|
+
|
|
86
|
+
- [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`AnyActorLogic`\>
|
|
87
|
+
|
|
88
|
+
## Type Parameters
|
|
89
|
+
|
|
90
|
+
| Type Parameter | Description |
|
|
91
|
+
| -------------------------------------- | ---------------------------- |
|
|
92
|
+
| `TMachine` _extends_ `AnyStateMachine` | XState v5 state machine type |
|
|
93
|
+
|
|
94
|
+
## Implements
|
|
95
|
+
|
|
96
|
+
- [`Routable`](../../play-actor/interfaces/Routable.md)
|
|
97
|
+
- [`Viewable`](../../play-actor/interfaces/Viewable.md)
|
|
98
|
+
|
|
99
|
+
## Constructors
|
|
100
|
+
|
|
101
|
+
### Constructor
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
new PlayerActor<TMachine>(
|
|
105
|
+
machine,
|
|
106
|
+
catalog,
|
|
107
|
+
options,
|
|
108
|
+
input?): PlayerActor<TMachine>;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:142](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L142)
|
|
112
|
+
|
|
113
|
+
#### Parameters
|
|
114
|
+
|
|
115
|
+
| Parameter | Type |
|
|
116
|
+
| --------- | ---------------------------------------------------------------- |
|
|
117
|
+
| `machine` | `TMachine` |
|
|
118
|
+
| `catalog` | [`Catalog`](../type-aliases/Catalog.md) \| `null` \| `undefined` |
|
|
119
|
+
| `options` | [`PlayerOptions`](../interfaces/PlayerOptions.md)\<`TMachine`\> |
|
|
120
|
+
| `input?` | `InputFrom`\<`TMachine`\> |
|
|
121
|
+
|
|
122
|
+
#### Returns
|
|
123
|
+
|
|
124
|
+
`PlayerActor`\<`TMachine`\>
|
|
125
|
+
|
|
126
|
+
#### Overrides
|
|
127
|
+
|
|
128
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`constructor`](../../play-actor/classes/AbstractActor.md#constructor)
|
|
129
|
+
|
|
130
|
+
## Properties
|
|
131
|
+
|
|
132
|
+
| Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
|
|
133
|
+
| ------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
134
|
+
| <a id="property-_parent"></a> `_parent?` | `public` | `AnyActorRef` | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`_parent`](../../play-actor/classes/AbstractActor.md#property-_parent) | node_modules/xstate/dist/declarations/src/createActor.d.ts:33 |
|
|
135
|
+
| <a id="property-catalog"></a> `catalog` | `public` | [`Catalog`](../type-aliases/Catalog.md) | Component catalog for view resolution Maps component names to actual component implementations. Used by renderers to resolve view.component to actual UI components. | - | - | [packages/play-xstate/src/player-actor.ts:140](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L140) |
|
|
136
|
+
| <a id="property-clock"></a> `clock` | `public` | `Clock` | The clock that is responsible for setting and clearing timeouts, such as delayed events and transitions. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`clock`](../../play-actor/classes/AbstractActor.md#property-clock) | node_modules/xstate/dist/declarations/src/createActor.d.ts:25 |
|
|
137
|
+
| <a id="property-currentroute"></a> `currentRoute` | `public` | [`Computed`](../../play-signals/namespaces/Signal/classes/Computed.md)\<`string` \| `null`\> | Current route signal Computed signal derived from state machine. Infrastructure observes to sync browser URL. Invariant: Passive Infrastructure - Infrastructure reflects route, never decides. **Example** `const watcher = new Signal.subtle.Watcher(() => { const route = actor.currentRoute.get(); console.log('Route changed:', route); }); watcher.watch(actor.currentRoute);` | - | - | [packages/play-xstate/src/player-actor.ts:138](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L138) |
|
|
138
|
+
| <a id="property-currentview"></a> `currentView` | `public` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<[`ViewMetadata`](../../play-actor/interfaces/ViewMetadata.md) \| `null`\> | Current view signal State signal containing UI structure schema from meta.view. Infrastructure renders view. Invariant: Logic-Driven UI - View structure is defined by business logic, not JSX. **Example** `const watcher = new Signal.subtle.Watcher(() => { const view = actor.currentView.get(); console.log('View changed:', view); }); watcher.watch(actor.currentView);` | - | - | [packages/play-xstate/src/player-actor.ts:139](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L139) |
|
|
139
|
+
| <a id="property-id"></a> `id` | `public` | `string` | The unique identifier for this actor relative to its parent. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`id`](../../play-actor/classes/AbstractActor.md#property-id) | node_modules/xstate/dist/declarations/src/createActor.d.ts:28 |
|
|
140
|
+
| <a id="property-logic"></a> `logic` | `public` | `AnyActorLogic` | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`logic`](../../play-actor/classes/AbstractActor.md#property-logic) | node_modules/xstate/dist/declarations/src/createActor.d.ts:18 |
|
|
141
|
+
| <a id="property-options"></a> `options` | `public` | `Readonly`\<`ActorOptions`\<`TLogic`\>\> | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`options`](../../play-actor/classes/AbstractActor.md#property-options) | node_modules/xstate/dist/declarations/src/createActor.d.ts:26 |
|
|
142
|
+
| <a id="property-ref"></a> `ref` | `public` | `ActorRef`\<`any`, `any`, `any`\> | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`ref`](../../play-actor/classes/AbstractActor.md#property-ref) | node_modules/xstate/dist/declarations/src/createActor.d.ts:34 |
|
|
143
|
+
| <a id="property-sessionid"></a> `sessionId` | `public` | `string` | The globally unique process ID for this invocation. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`sessionId`](../../play-actor/classes/AbstractActor.md#property-sessionid) | node_modules/xstate/dist/declarations/src/createActor.d.ts:38 |
|
|
144
|
+
| <a id="property-src"></a> `src` | `public` | `string` \| `AnyActorLogic` | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`src`](../../play-actor/classes/AbstractActor.md#property-src) | node_modules/xstate/dist/declarations/src/createActor.d.ts:42 |
|
|
145
|
+
| <a id="property-state"></a> `state` | `public` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<`AnyMachineSnapshot`\> | Reactive snapshot of current actor state. Typed as `Signal.State<unknown>` at the abstract level; concrete implementations narrow this to the actual snapshot type (e.g., `Signal.State<AnyMachineSnapshot>` in `@xmachines/play-xstate`'s `PlayerActor`). Infrastructure observes this signal to react to state changes without directly coupling to the Actor's internal state machine implementation. **Example** `// Infrastructure observes state signal const watcher = new Signal.subtle.Watcher(() => { console.log('Actor state changed:', actor.state.get()); }); watcher.watch(actor.state);` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`state`](../../play-actor/classes/AbstractActor.md#property-state) | - | [packages/play-xstate/src/player-actor.ts:137](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L137) |
|
|
146
|
+
| <a id="property-system"></a> `system` | `public` | `AnyActorSystem` | The system to which this actor belongs. | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`system`](../../play-actor/classes/AbstractActor.md#property-system) | node_modules/xstate/dist/declarations/src/createActor.d.ts:40 |
|
|
147
|
+
| <a id="property-systemid"></a> `systemId` | `public` | `string` \| `undefined` | - | - | [`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`systemId`](../../play-actor/classes/AbstractActor.md#property-systemid) | node_modules/xstate/dist/declarations/src/createActor.d.ts:36 |
|
|
148
|
+
|
|
149
|
+
## Methods
|
|
150
|
+
|
|
151
|
+
### \[observable\]()
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
observable: InteropSubscribable<any>;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Defined in: node_modules/xstate/dist/declarations/src/createActor.d.ts:153
|
|
158
|
+
|
|
159
|
+
#### Returns
|
|
160
|
+
|
|
161
|
+
`InteropSubscribable`\<`any`\>
|
|
162
|
+
|
|
163
|
+
#### Inherited from
|
|
164
|
+
|
|
165
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`[observable]`](../../play-actor/classes/AbstractActor.md#observable)
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
### dispose()
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
dispose(): void;
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:434](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L434)
|
|
176
|
+
|
|
177
|
+
Convenience dispose method for cleanup
|
|
178
|
+
|
|
179
|
+
Per CONTEXT.md: "Both .dispose() convenience method and manual machine.stop()"
|
|
180
|
+
|
|
181
|
+
#### Returns
|
|
182
|
+
|
|
183
|
+
`void`
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
### getPersistedSnapshot()
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
getPersistedSnapshot(): Snapshot<unknown>;
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Defined in: node_modules/xstate/dist/declarations/src/createActor.d.ts:152
|
|
194
|
+
|
|
195
|
+
Obtain the internal state of the actor, which can be persisted.
|
|
196
|
+
|
|
197
|
+
#### Returns
|
|
198
|
+
|
|
199
|
+
`Snapshot`\<`unknown`\>
|
|
200
|
+
|
|
201
|
+
#### Remarks
|
|
202
|
+
|
|
203
|
+
The internal state can be persisted from any actor, not only machines.
|
|
204
|
+
|
|
205
|
+
Note that the persisted state is not the same as the snapshot from
|
|
206
|
+
[Actor.getSnapshot](../../play-actor/classes/AbstractActor.md#getsnapshot). Persisted state represents the internal state of
|
|
207
|
+
the actor, while snapshots represent the actor's last emitted value.
|
|
208
|
+
|
|
209
|
+
Can be restored with [ActorOptions.state](#)
|
|
210
|
+
|
|
211
|
+
#### See
|
|
212
|
+
|
|
213
|
+
https://stately.ai/docs/persistence
|
|
214
|
+
|
|
215
|
+
#### Inherited from
|
|
216
|
+
|
|
217
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`getPersistedSnapshot`](../../play-actor/classes/AbstractActor.md#getpersistedsnapshot)
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### getSnapshot()
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
getSnapshot(): SnapshotFrom<TMachine>;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:307](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L307)
|
|
228
|
+
|
|
229
|
+
Get current snapshot
|
|
230
|
+
|
|
231
|
+
#### Returns
|
|
232
|
+
|
|
233
|
+
`SnapshotFrom`\<`TMachine`\>
|
|
234
|
+
|
|
235
|
+
#### Overrides
|
|
236
|
+
|
|
237
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`getSnapshot`](../../play-actor/classes/AbstractActor.md#getsnapshot)
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
### on()
|
|
242
|
+
|
|
243
|
+
```ts
|
|
244
|
+
on<TType>(type, handler): Subscription;
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Defined in: node_modules/xstate/dist/declarations/src/createActor.d.ts:115
|
|
248
|
+
|
|
249
|
+
#### Type Parameters
|
|
250
|
+
|
|
251
|
+
| Type Parameter |
|
|
252
|
+
| ----------------------- |
|
|
253
|
+
| `TType` _extends_ `any` |
|
|
254
|
+
|
|
255
|
+
#### Parameters
|
|
256
|
+
|
|
257
|
+
| Parameter | Type |
|
|
258
|
+
| --------- | --------------------- |
|
|
259
|
+
| `type` | `TType` |
|
|
260
|
+
| `handler` | (`emitted`) => `void` |
|
|
261
|
+
|
|
262
|
+
#### Returns
|
|
263
|
+
|
|
264
|
+
`Subscription`
|
|
265
|
+
|
|
266
|
+
#### Inherited from
|
|
267
|
+
|
|
268
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`on`](../../play-actor/classes/AbstractActor.md#on)
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
### send()
|
|
273
|
+
|
|
274
|
+
```ts
|
|
275
|
+
send(event): void;
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:282](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L282)
|
|
279
|
+
|
|
280
|
+
Send event to actor
|
|
281
|
+
|
|
282
|
+
Forwards events to the underlying XState actor. The actor's state machine
|
|
283
|
+
guards determine whether each event is valid from the current state.
|
|
284
|
+
|
|
285
|
+
#### Parameters
|
|
286
|
+
|
|
287
|
+
| Parameter | Type | Description |
|
|
288
|
+
| --------- | --------------------------------------------------- | ------------------------------------- |
|
|
289
|
+
| `event` | [`PlayEvent`](../../play/type-aliases/PlayEvent.md) | Any event object with a type property |
|
|
290
|
+
|
|
291
|
+
#### Returns
|
|
292
|
+
|
|
293
|
+
`void`
|
|
294
|
+
|
|
295
|
+
#### Example
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
// Domain event
|
|
299
|
+
actor.send({ type: "auth.login", userId: "123" });
|
|
300
|
+
|
|
301
|
+
// Routing event
|
|
302
|
+
actor.send({ type: "play.route", to: "#home" });
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
#### Overrides
|
|
306
|
+
|
|
307
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`send`](../../play-actor/classes/AbstractActor.md#send)
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
### start()
|
|
312
|
+
|
|
313
|
+
```ts
|
|
314
|
+
start(): this;
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:239](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L239)
|
|
318
|
+
|
|
319
|
+
Start the actor
|
|
320
|
+
|
|
321
|
+
Per RESEARCH.md Pitfall 1: Always call start() after creation
|
|
322
|
+
|
|
323
|
+
#### Returns
|
|
324
|
+
|
|
325
|
+
`this`
|
|
326
|
+
|
|
327
|
+
#### Overrides
|
|
328
|
+
|
|
329
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`start`](../../play-actor/classes/AbstractActor.md#start)
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
### stop()
|
|
334
|
+
|
|
335
|
+
```ts
|
|
336
|
+
stop(): this;
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
Defined in: [packages/play-xstate/src/player-actor.ts:253](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/player-actor.ts#L253)
|
|
340
|
+
|
|
341
|
+
Stop the actor and cleanup
|
|
342
|
+
|
|
343
|
+
#### Returns
|
|
344
|
+
|
|
345
|
+
`this`
|
|
346
|
+
|
|
347
|
+
#### Overrides
|
|
348
|
+
|
|
349
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`stop`](../../play-actor/classes/AbstractActor.md#stop)
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
### subscribe()
|
|
354
|
+
|
|
355
|
+
#### Call Signature
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
subscribe(observer): Subscription;
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
Defined in: node_modules/xstate/dist/declarations/src/createActor.d.ts:113
|
|
362
|
+
|
|
363
|
+
Subscribe an observer to an actor’s snapshot values.
|
|
364
|
+
|
|
365
|
+
##### Parameters
|
|
366
|
+
|
|
367
|
+
| Parameter | Type | Description |
|
|
368
|
+
| ---------- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
369
|
+
| `observer` | `Observer`\<`any`\> | Either a plain function that receives the latest snapshot, or an observer object whose `.next(snapshot)` method receives the latest snapshot |
|
|
370
|
+
|
|
371
|
+
##### Returns
|
|
372
|
+
|
|
373
|
+
`Subscription`
|
|
374
|
+
|
|
375
|
+
##### Remarks
|
|
376
|
+
|
|
377
|
+
The observer will receive the actor’s snapshot value when it is emitted.
|
|
378
|
+
The observer can be:
|
|
379
|
+
|
|
380
|
+
- A plain function that receives the latest snapshot, or
|
|
381
|
+
- An observer object whose `.next(snapshot)` method receives the latest
|
|
382
|
+
snapshot
|
|
383
|
+
|
|
384
|
+
##### Examples
|
|
385
|
+
|
|
386
|
+
```ts
|
|
387
|
+
// Observer as a plain function
|
|
388
|
+
const subscription = actor.subscribe((snapshot) => {
|
|
389
|
+
console.log(snapshot);
|
|
390
|
+
});
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
```ts
|
|
394
|
+
// Observer as an object
|
|
395
|
+
const subscription = actor.subscribe({
|
|
396
|
+
next(snapshot) {
|
|
397
|
+
console.log(snapshot);
|
|
398
|
+
},
|
|
399
|
+
error(err) {
|
|
400
|
+
// ...
|
|
401
|
+
},
|
|
402
|
+
complete() {
|
|
403
|
+
// ...
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
The return value of `actor.subscribe(observer)` is a subscription object
|
|
409
|
+
that has an `.unsubscribe()` method. You can call
|
|
410
|
+
`subscription.unsubscribe()` to unsubscribe the observer:
|
|
411
|
+
|
|
412
|
+
```ts
|
|
413
|
+
const subscription = actor.subscribe((snapshot) => {
|
|
414
|
+
// ...
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
// Unsubscribe the observer
|
|
418
|
+
subscription.unsubscribe();
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
When the actor is stopped, all of its observers will automatically be
|
|
422
|
+
unsubscribed.
|
|
423
|
+
|
|
424
|
+
##### Inherited from
|
|
425
|
+
|
|
426
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`subscribe`](../../play-actor/classes/AbstractActor.md#subscribe)
|
|
427
|
+
|
|
428
|
+
#### Call Signature
|
|
429
|
+
|
|
430
|
+
```ts
|
|
431
|
+
subscribe(
|
|
432
|
+
nextListener?,
|
|
433
|
+
errorListener?,
|
|
434
|
+
completeListener?): Subscription;
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Defined in: node_modules/xstate/dist/declarations/src/createActor.d.ts:114
|
|
438
|
+
|
|
439
|
+
Subscribe an observer to an actor’s snapshot values.
|
|
440
|
+
|
|
441
|
+
##### Parameters
|
|
442
|
+
|
|
443
|
+
| Parameter | Type |
|
|
444
|
+
| ------------------- | ---------------------- |
|
|
445
|
+
| `nextListener?` | (`snapshot`) => `void` |
|
|
446
|
+
| `errorListener?` | (`error`) => `void` |
|
|
447
|
+
| `completeListener?` | () => `void` |
|
|
448
|
+
|
|
449
|
+
##### Returns
|
|
450
|
+
|
|
451
|
+
`Subscription`
|
|
452
|
+
|
|
453
|
+
##### Remarks
|
|
454
|
+
|
|
455
|
+
The observer will receive the actor’s snapshot value when it is emitted.
|
|
456
|
+
The observer can be:
|
|
457
|
+
|
|
458
|
+
- A plain function that receives the latest snapshot, or
|
|
459
|
+
- An observer object whose `.next(snapshot)` method receives the latest
|
|
460
|
+
snapshot
|
|
461
|
+
|
|
462
|
+
##### Examples
|
|
463
|
+
|
|
464
|
+
```ts
|
|
465
|
+
// Observer as a plain function
|
|
466
|
+
const subscription = actor.subscribe((snapshot) => {
|
|
467
|
+
console.log(snapshot);
|
|
468
|
+
});
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
```ts
|
|
472
|
+
// Observer as an object
|
|
473
|
+
const subscription = actor.subscribe({
|
|
474
|
+
next(snapshot) {
|
|
475
|
+
console.log(snapshot);
|
|
476
|
+
},
|
|
477
|
+
error(err) {
|
|
478
|
+
// ...
|
|
479
|
+
},
|
|
480
|
+
complete() {
|
|
481
|
+
// ...
|
|
482
|
+
},
|
|
483
|
+
});
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
The return value of `actor.subscribe(observer)` is a subscription object
|
|
487
|
+
that has an `.unsubscribe()` method. You can call
|
|
488
|
+
`subscription.unsubscribe()` to unsubscribe the observer:
|
|
489
|
+
|
|
490
|
+
```ts
|
|
491
|
+
const subscription = actor.subscribe((snapshot) => {
|
|
492
|
+
// ...
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
// Unsubscribe the observer
|
|
496
|
+
subscription.unsubscribe();
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
When the actor is stopped, all of its observers will automatically be
|
|
500
|
+
unsubscribed.
|
|
501
|
+
|
|
502
|
+
##### Inherited from
|
|
503
|
+
|
|
504
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`subscribe`](../../play-actor/classes/AbstractActor.md#subscribe)
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
### toJSON()
|
|
509
|
+
|
|
510
|
+
```ts
|
|
511
|
+
toJSON(): object;
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
Defined in: node_modules/xstate/dist/declarations/src/createActor.d.ts:135
|
|
515
|
+
|
|
516
|
+
#### Returns
|
|
517
|
+
|
|
518
|
+
`object`
|
|
519
|
+
|
|
520
|
+
| Name | Type | Defined in |
|
|
521
|
+
| -------------- | -------- | -------------------------------------------------------------- |
|
|
522
|
+
| `id` | `string` | node_modules/xstate/dist/declarations/src/createActor.d.ts:137 |
|
|
523
|
+
| `xstate$$type` | `number` | node_modules/xstate/dist/declarations/src/createActor.d.ts:136 |
|
|
524
|
+
|
|
525
|
+
#### Inherited from
|
|
526
|
+
|
|
527
|
+
[`AbstractActor`](../../play-actor/classes/AbstractActor.md).[`toJSON`](../../play-actor/classes/AbstractActor.md#tojson)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-xstate](../README.md) / buildRouteUrl
|
|
2
|
+
|
|
3
|
+
# Function: buildRouteUrl()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function buildRouteUrl(routeTemplate, context?): string;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-xstate/src/routing/build-url.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/routing/build-url.ts#L28)
|
|
10
|
+
|
|
11
|
+
Build full URL from route template and context
|
|
12
|
+
|
|
13
|
+
Per CONTEXT.md:
|
|
14
|
+
|
|
15
|
+
- "currentRoute derivation: Full URL generation including query params, hash, base path"
|
|
16
|
+
- "Parameters: String template syntax — /user/:id"
|
|
17
|
+
- "Inheritance: relative paths inherit parent route"
|
|
18
|
+
|
|
19
|
+
Per RESEARCH.md Pattern 3: Replace :param with context values
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
| Parameter | Type | Description |
|
|
24
|
+
| --------------- | ----------------------------------------------- | ------------------------------------------ |
|
|
25
|
+
| `routeTemplate` | `string` | Route path with :param placeholders |
|
|
26
|
+
| `context` | [`RouteContext`](../interfaces/RouteContext.md) | Route context with parameters, query, hash |
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`string`
|
|
31
|
+
|
|
32
|
+
Full URL string
|
|
33
|
+
|
|
34
|
+
## Example
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
const url = buildRouteUrl("/user/:id", {
|
|
38
|
+
id: "123",
|
|
39
|
+
query: { tab: "profile" },
|
|
40
|
+
hash: "section-1",
|
|
41
|
+
});
|
|
42
|
+
// Result: '/user/123?tab=profile#section-1'
|
|
43
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-xstate](../README.md) / composeGuards
|
|
2
|
+
|
|
3
|
+
# Function: composeGuards()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function composeGuards<TContext, TEvent>(guards): ComposedGuard;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-xstate/src/guards/compose.ts:72](https://gitlab.com/xmachin-es/xmachines-js/-/blob/00a28432ed57807112288436d1ae4387d9f06919/packages/play-xstate/src/guards/compose.ts#L72)
|
|
10
|
+
|
|
11
|
+
Compose guards with AND logic using XState's and() helper
|
|
12
|
+
|
|
13
|
+
Combines multiple guard predicates using AND semantics—all guards must pass for
|
|
14
|
+
the composition to succeed. Uses XState's built-in `and()` helper to ensure proper
|
|
15
|
+
type inference and machine serialization.
|
|
16
|
+
|
|
17
|
+
**Architectural Context:** Supports **Actor Authority (INV-01)** by enabling
|
|
18
|
+
declarative guard composition in state machine transitions. Guards enforce business
|
|
19
|
+
logic rules that determine whether navigation or actions are valid.
|
|
20
|
+
|
|
21
|
+
## Type Parameters
|
|
22
|
+
|
|
23
|
+
| Type Parameter | Default type | Description |
|
|
24
|
+
| -------------- | ------------ | -------------------------- |
|
|
25
|
+
| `TContext` | `any` | State machine context type |
|
|
26
|
+
| `TEvent` | `any` | Event type |
|
|
27
|
+
|
|
28
|
+
## Parameters
|
|
29
|
+
|
|
30
|
+
| Parameter | Type | Description |
|
|
31
|
+
| --------- | --------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
32
|
+
| `guards` | [`GuardArray`](../type-aliases/GuardArray.md)\<`TContext`, `TEvent`\> | Array of guard predicates or guard names (string references) |
|
|
33
|
+
|
|
34
|
+
## Returns
|
|
35
|
+
|
|
36
|
+
[`ComposedGuard`](../type-aliases/ComposedGuard.md)
|
|
37
|
+
|
|
38
|
+
XState and() guard composition
|
|
39
|
+
|
|
40
|
+
## Throws
|
|
41
|
+
|
|
42
|
+
If guards array is empty
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
AND composition with named guards
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { setup } from "xstate";
|
|
50
|
+
import { composeGuards } from "@xmachines/play-xstate";
|
|
51
|
+
|
|
52
|
+
const machine = setup({
|
|
53
|
+
guards: {
|
|
54
|
+
isLoggedIn: ({ context }) => !!context.userId,
|
|
55
|
+
hasPermission: ({ context }) => context.permissions.includes("admin"),
|
|
56
|
+
},
|
|
57
|
+
}).createMachine({
|
|
58
|
+
on: {
|
|
59
|
+
accessAdmin: {
|
|
60
|
+
// Both guards must pass
|
|
61
|
+
guard: composeGuards(["isLoggedIn", "hasPermission"]),
|
|
62
|
+
target: "adminPanel",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
AND composition with inline predicates
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { composeGuards } from "@xmachines/play-xstate";
|
|
72
|
+
|
|
73
|
+
guard: composeGuards([({ context }) => context.age >= 18, ({ context }) => context.verified]);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## See
|
|
77
|
+
|
|
78
|
+
- [composeGuardsOr](composeGuardsOr.md) for OR composition
|
|
79
|
+
- [negateGuard](negateGuard.md) for NOT logic
|