@xmachines/play-xstate 6.0.0 → 6.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.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > XState v5 adapter for the XMachines Play Architecture. It binds a state machine to the actor base, with atom-driven reactivity and a router integration.
4
4
 
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-6.0.0-blue)](https://www.npmjs.com/package/@xmachines/play-xstate)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-6.1.0-blue)](https://www.npmjs.com/package/@xmachines/play-xstate)
6
6
 
7
7
  ---
8
8
 
@@ -196,7 +196,7 @@ const createRouted = definePlayer({ machine, actor: compose(PlayerActor, withRou
196
196
  const createBare = definePlayer({ machine });
197
197
  ```
198
198
 
199
- **The composition ORDER decides nothing.** `currentRoute` and `currentView` are computed atoms over `state`, and neither reads the other, so one write for each transition reaches both and the engine evaluates them in topological order. A router bridge therefore sees a guard redirect and a renderer sees the view of the same snapshot, whatever order `compose` applied. A release before this one wrote `currentView` from an `onSnapshot` override, and the order was load-bearing there.
199
+ **The composition ORDER decides nothing.** `currentRoute` and `currentView` are computed atoms over `state`, and neither reads the other, so one write for each transition reaches both and the engine evaluates them in topological order. A router bridge therefore sees a guard redirect and a renderer sees the view of the same snapshot, whatever order `compose` applied.
200
200
 
201
201
  **A lifecycle hook receives the bare actor.** `PlayerOptions` is typed before the class is composed, so it cannot name the capabilities, and a narrower hook parameter is refused under `strictFunctionTypes`. A hook that reads `currentRoute` or `currentView` reads them through a binding of the composed type:
202
202
 
@@ -213,9 +213,9 @@ composed = actor;
213
213
 
214
214
  | Atom | Type | Capability | Description |
215
215
  | -------------- | -------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
216
- | `currentRoute` | `ReadonlyAtom<string \| null>` | routing | The URL that comes from the `meta.route` template of the active state and from the context |
216
+ | `currentRoute` | `ReadonlyAtom<string \| null>` | routing | The URL from the `meta.route` template of the active state and from the context. A parallel machine uses its first routed region |
217
217
  | `initialRoute` | `readonly string \| null` | routing | The route of the initial state of the machine. The construction fixes it, and a router bridge uses it to detect a deep link or a restore |
218
- | `currentView` | `ReadonlyAtom<PlaySpec \| null>` | view | The view spec from the `meta.view` metadata of the active state, with the context params added |
218
+ | `currentView` | `ReadonlyAtom<PlaySpec \| null>` | view | The `meta.view` of the deepest active state, or the composed view of a state that declares `outlets`, with the context under `/context` |
219
219
 
220
220
  `state` is the ONE atom that the actor writes. `currentRoute` and `currentView` are
221
221
  COMPUTED over it, so one write for each transition reaches both in one propagation and no
@@ -223,6 +223,13 @@ observer reads the new state beside an old derivation. Each derivation reports a
223
223
  through the `onError` option and keeps its last good value; it throws never, because it
224
224
  runs inside the write.
225
225
 
226
+ **A parent view with `outlets` shares the screen with its substates.** The derivation then
227
+ walks the active states from the root, puts the view of each active child into its outlet,
228
+ and keeps the `viewKey` of the outermost composing view, so a change of the page keeps the
229
+ store of the layout. A machine that declares no `outlets` keeps the rule that the deepest
230
+ view wins. The [State Machines guide](../docs/guides/state-machines.md#a-layout-and-its-pages-outlets)
231
+ shows a complete machine.
232
+
226
233
  **`currentRoute` notifies on every transition, and `currentView` notifies on a change of
227
234
  the view alone.** The two atoms answer two different questions. A router bridge needs the
228
235
  answer of the actor to each event that it proposed, and a guard that refuses an inbound
@@ -414,7 +421,7 @@ import type {
414
421
  `RouteObject`, `RouteMetadata`, `RouteData`, and `RouteDataResolver` have one
415
422
  definition, and it lives in [`@xmachines/play-router`](../play-router/README.md). `@xmachines/play-xstate/routing`
416
423
  re-exports them, so either import path gives you the same type. The MAIN entry point of
417
- this package re-exports them no longer: it would name an optional peer in the types of
424
+ this package does not re-export them: it would name an optional peer in the types of
418
425
  every consumer, including one that composes no routing.
419
426
 
420
427
  ### The object form of `meta.route`
@@ -429,12 +436,13 @@ meta: {
429
436
  // Where the generated transition sits. The default is "root", which is what
430
437
  // XState does: every route transition sits on the root of the machine.
431
438
  // "root" — one transition on the root. A route from any state arrives.
432
- // "local" — one transition on the PARENT. The parent keeps its entry action,
433
- // and a route from outside the parent arrives NOWHERE.
434
- // "both" — one in each place. The parent keeps its entry action, and a route
435
- // from outside the parent still arrives.
439
+ // "local" — one transition on the PARENT. The parent keeps its entry action
440
+ // under `reenter: false`, and a route from outside the parent
441
+ // arrives NOWHERE.
442
+ // "both" — one in each place. The parent keeps its entry action under
443
+ // `reenter: false`, and a route from outside the parent still arrives.
436
444
  handler: "both",
437
- // Whether the transition re-enters its OWN DOMAIN. The default is false, which
445
+ // Whether the transition re-enters its DOMAIN. The default is false, which
438
446
  // is the default of XState. Under `handler: "root"` the domain is the root of
439
447
  // the machine, so `false` spares the root alone: each ancestor between the root
440
448
  // and the target still runs its exit and its entry actions. `handler` is the
@@ -449,13 +457,12 @@ meta: {
449
457
 
450
458
  An unknown `handler` value throws `InvalidRouteHandlerError` at the format time.
451
459
 
452
- > **Upgrading from 3.x: the `reenter` default changed, and a machine that relies on it
453
- > goes quiet.** An earlier release wrote `reenter: true` on EVERY generated transition,
454
- > so every routed state re-entered its own domain on each navigation and ran its `entry`
455
- > actions again. The flag is now what `meta.route` declares, and the default is `false` —
456
- > which is the default of XState. A state whose `entry` action must run on each
457
- > navigation has to declare `reenter: true` for itself. Nothing throws, and the action
458
- > simply stops running.
460
+ > **The `reenter` flag re-enters the domain, and not the target.** The target state runs
461
+ > its own `exit` and `entry` actions on each navigation to it, under both values. A state
462
+ > that declares `reenter: true` also re-enters the domain of its transition: the root
463
+ > under `handler: "root"`, and the parent under `"local"` and `"both"` while the parent is
464
+ > active. A route to the ROOT of the machine is the one exception: the root is then the
465
+ > target and the domain, so the root runs those actions only under `reenter: true`.
459
466
 
460
467
  The `data` field follows the `WithDynamicParams` shape of XState, so the function form
461
468
  reads the context and the event:
@@ -9,8 +9,8 @@
9
9
  * {@link compose} applies each capability from left to right, so the LAST one is the
10
10
  * outermost class. The ORDER decides no value: a capability that publishes one derives it
11
11
  * with a computed atom over `state`, and the engine evaluates every derivation from the
12
- * one write of a transition, in topological order. `onSnapshot` remains for a capability
13
- * that must run an EFFECT, and an override of it still calls `super.onSnapshot()` first.
12
+ * one write of a transition, in topological order. A capability that must run an EFFECT
13
+ * overrides `onSnapshot`, and the override calls `super.onSnapshot()` first.
14
14
  *
15
15
  * ## Why the types read this way
16
16
  *
@@ -243,8 +243,8 @@ export class PlayerActor extends Actor {
243
243
  // state beside an old derivation, and the composition order of the capabilities
244
244
  // decides nothing.
245
245
  //
246
- // `onSnapshot` remains for a capability that must run an EFFECT on a
247
- // transition. A capability that publishes a value derives it instead.
246
+ // A capability that must run an EFFECT on a transition overrides
247
+ // `onSnapshot`. A capability that publishes a value derives it instead.
248
248
  //
249
249
  // The whole order of one transition:
250
250
  // 1. state receives its new value, and every computed atom over it follows
@@ -1 +1 @@
1
- {"version":3,"file":"player-actor.js","sourceRoot":"","sources":["../src/player-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,GAWL,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG9F;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAc,EAAS,EAAE;IAChD,IAAI,CAAC;QACJ,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACpB,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;IAAC,MAAM,CAAC;QACR,6EAA6E;QAC7E,kFAAkF;QAClF,aAAa;IACd,CAAC;IACD,OAAO,IAAI,uBAAuB,CAAC,KAAK,CAAC,C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AChD,qEAAqE;QACrE,KAAK,QAAQ,CAAC;IACf,CAAC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"format-play-route-transitions.d.ts","sourceRoot":"","sources":["../../src/routing/format-play-route-transitions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,YAAY,CAAC;AAgB7D;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,IAAI,CAAC,EAAE;QACN;;;;;WAKG;QACH,KAAK,CAAC,EAAE,aAAa,CAAC;KACtB,CAAC;IACF,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxC;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC;AAiHF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,kBAAkB,EAAE,aAAa,EAAE,CAAC,GAAG,CAAC,CA2L5F"}
1
+ {"version":3,"file":"format-play-route-transitions.d.ts","sourceRoot":"","sources":["../../src/routing/format-play-route-transitions.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,YAAY,CAAC;AAgB7D;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,IAAI,CAAC,EAAE;QACN;;;;;WAKG;QACH,KAAK,CAAC,EAAE,aAAa,CAAC;KACtB,CAAC;IACF,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxC;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC;AAiHF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACzC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,SAAS,kBAAkB,EAAE,aAAa,EAAE,CAAC,GAAG,CAAC,CA4L5F"}
@@ -176,8 +176,8 @@ export function formatPlayRouteTransitions(machineConfig) {
176
176
  // The LOCAL transition. It sits on the PARENT of this state, and it targets
177
177
  // this state relatively. XState offers the transitions of the deepest active
178
178
  // state node first, so this transition answers the event while the parent is
179
- // active, and the parent therefore runs its exit and its entry actions NOT
180
- // again.
179
+ // active. The parent therefore runs its exit and its entry actions again only
180
+ // where the state declares `reenter: true`.
181
181
  //
182
182
  // Under `"local"` this is the ONLY transition of the state, so a route that
183
183
  // arrives while the parent is inactive matches nothing and the actor does not
@@ -213,12 +213,13 @@ export function formatPlayRouteTransitions(machineConfig) {
213
213
  const walk = machineStates ? collectRoutes(machineStates) : undefined;
214
214
  // The ROOT of the machine can declare a route of its own, which a chart does when
215
215
  // its whole document owns a path prefix, for example `/doc` with `/doc/a` under it.
216
- // `collectRoutes` walks `states` only, so the root got no transition, and a URL for
217
- // the root moved the machine nowhere: a press on BACK to `/doc` left the actor on
218
- // the child it already held, and the URL and the actor diverged.
216
+ // `collectRoutes` walks `states` only, so without this block the root gets no
217
+ // transition, and a URL for the root moves the machine nowhere: a press on BACK to
218
+ // `/doc` leaves the actor on the child it already holds, and the URL and the actor
219
+ // diverge.
219
220
  //
220
221
  // The transition targets the root by its ID. XState enters the `initial` child of
221
- // an ID target, which is the state that a URL for the root means. The `reenter`
222
+ // a compound target, which is the state that a URL for the root means. The `reenter`
222
223
  // flag does NOT decide that: a route to the root lands on the initial child of the
223
224
  // root under `false` and under `true`. The flag decides only whether the root runs
224
225
  // its own `exit` and `entry` actions again. The root therefore reads the flag from
@@ -1 +1 @@
1
- {"version":3,"file":"format-play-route-transitions.js","sourceRoot":"","sources":["../../src/routing/format-play-route-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG1F;;;;;;;;;;GAUG;AACH,MAAM,kBAAkB,GAAG,CAAoC,IAAmB,EAAE,IAAO,EAAK,EAAE,CACjG,IAAI,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAmCpE;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,KAAc,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;IACpF,gFAAgF;IAChF,yEAAyE;IACzE,cAAc;IACd,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACrD,OAAO,aAAa,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,GAA4B;QACrC,GAAG,aAAa;QAChB,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC;IAEF,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC;QAE1C,iFAAiF;QACjF,8EAA8E;QAC9E,kFAAkF;QAClF,0EAA0E;QAC1E,IAAI,CAAC,IAAI,CAAC,GAAG;YACZ,GAAG,UAAU;YACb,YAAY,EAAE,CAAC,GAAG,gBAAgB,EAAE,GAAG,iBAAiB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;SACnF,CAAC;IACH,CAAC;IAED,OAAO,IAAS,CAAC;AAClB,CAAC"}
1
+ {"version":3,"file":"format-play-route-transitions.js","sourceRoot":"","sources":["../../src/routing/format-play-route-transitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG1F;;;;;;;;;;GAUG;AACH,MAAM,kBAAkB,GAAG,CAAoC,IAAmB,EAAE,IAAO,EAAK,EAAE,CACjG,IAAI,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,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CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAE7C,oFAAoF;IACpF,gFAAgF;IAChF,yEAAyE;IACzE,cAAc;IACd,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;QACrD,OAAO,aAAa,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,GAA4B;QACrC,GAAG,aAAa;QAChB,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC;IAEF,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC;QAE1C,iFAAiF;QACjF,8EAA8E;QAC9E,kFAAkF;QAClF,0EAA0E;QAC1E,IAAI,CAAC,IAAI,CAAC,GAAG;YACZ,GAAG,UAAU;YACb,YAAY,EAAE,CAAC,GAAG,gBAAgB,EAAE,GAAG,iBAAiB,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;SACnF,CAAC;IACH,CAAC;IAED,OAAO,IAAS,CAAC;AAClB,CAAC"}
@@ -13,6 +13,31 @@
13
13
  * entry point.
14
14
  */
15
15
  import type { AnyMachineSnapshot } from "xstate";
16
+ /** The part of an XState state node that the walks of this module read. */
17
+ export interface BranchNode {
18
+ id: string;
19
+ meta?: unknown;
20
+ states?: Record<string, BranchNode>;
21
+ }
22
+ /**
23
+ * The keys of the active children of a node, from its part of `snapshot.value`: one key
24
+ * for a compound node, one for each region of a parallel node, in the order of the
25
+ * machine, and none for an atomic node.
26
+ */
27
+ export declare const activeChildKeys: (value: unknown) => string[];
28
+ /** The part of `snapshot.value` that belongs to the active child `key`. */
29
+ export declare const activeChildValue: (value: unknown, key: string) => unknown;
30
+ /**
31
+ * The keys of the active children of a node, in the order that a branch walk tries
32
+ * them: the first region whose active subtree declares a `meta.route` comes first, and
33
+ * the others keep the order of the machine.
34
+ *
35
+ * A parallel machine often holds its routes in ONE region, and that region need not be
36
+ * the first one: a menu or a session region can come before it. The route derivation
37
+ * and the view derivation both follow this order, so the URL comes from the routed
38
+ * region, and the view without outlets belongs to the region of the URL.
39
+ */
40
+ export declare const branchOrder: (node: BranchNode, value: unknown) => string[];
16
41
  /**
17
42
  * Collects the `meta` object of the active state nodes of a SINGLE branch, from the
18
43
  * root to a leaf. The key of each entry is the state id, and the order is the
@@ -28,11 +53,11 @@ import type { AnyMachineSnapshot } from "xstate";
28
53
  * the meta keys are those ids, and they carry no information about the ancestry.
29
54
  *
30
55
  * Therefore this function walks `snapshot.value`, which holds the real hierarchy of
31
- * the active states by the state key, against the node tree of the machine. It
32
- * follows the FIRST active child at each level. This gives one deterministic branch,
33
- * which matches the historical behavior of "the first that it finds" for a parallel
34
- * machine. It also works with an explicit id, because each node carries its own `id`
35
- * and its own `meta`.
56
+ * the active states by the state key, against the node tree of the machine. At each
57
+ * level it follows the first key of {@link branchOrder}: for a parallel node, that is
58
+ * the first region whose active subtree declares a route, or the first region when no
59
+ * region does. This gives one deterministic branch. It also works with an explicit id,
60
+ * because each node carries its own `id` and its own `meta`.
36
61
  *
37
62
  * The function returns `null` when the snapshot exposes no machine and no value to
38
63
  * walk. This is a defensive measure, because a real XState snapshot always exposes
@@ -1 +1 @@
1
- {"version":3,"file":"state-meta.d.ts","sourceRoot":"","sources":["../src/state-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,qBAAqB,GACjC,UAAU,kBAAkB,KAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAqC5B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAMxF,CAAC"}
1
+ {"version":3,"file":"state-meta.d.ts","sourceRoot":"","sources":["../src/state-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,2EAA2E;AAC3E,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,MAAM,EAKhD,CAAC;AAER,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,GAAI,OAAO,OAAO,EAAE,KAAK,MAAM,KAAG,OAGlD,CAAC;AAiBd;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,UAAU,EAAE,OAAO,OAAO,KAAG,MAAM,EAUpE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,qBAAqB,GACjC,UAAU,kBAAkB,KAC1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAyB5B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAMxF,CAAC"}
@@ -1,3 +1,53 @@
1
+ /**
2
+ * The keys of the active children of a node, from its part of `snapshot.value`: one key
3
+ * for a compound node, one for each region of a parallel node, in the order of the
4
+ * machine, and none for an atomic node.
5
+ */
6
+ export const activeChildKeys = (value) => typeof value === "string"
7
+ ? [value]
8
+ : value !== null && typeof value === "object"
9
+ ? Object.keys(value)
10
+ : [];
11
+ /** The part of `snapshot.value` that belongs to the active child `key`. */
12
+ export const activeChildValue = (value, key) => value !== null && typeof value === "object"
13
+ ? value[key] // nosemgrep: gitlab.eslint.detect-object-injection
14
+ : undefined;
15
+ const declaresRoute = (node) => node.meta !== null &&
16
+ typeof node.meta === "object" &&
17
+ node.meta.route !== undefined;
18
+ /** `true` when a state of the active subtree of `node` declares a `meta.route`. */
19
+ const routeBelow = (node, value) => {
20
+ if (declaresRoute(node))
21
+ return true;
22
+ for (const key of activeChildKeys(value)) {
23
+ const child = node.states?.[key]; // nosemgrep: gitlab.eslint.detect-object-injection
24
+ if (child && routeBelow(child, activeChildValue(value, key)))
25
+ return true;
26
+ }
27
+ return false;
28
+ };
29
+ /**
30
+ * The keys of the active children of a node, in the order that a branch walk tries
31
+ * them: the first region whose active subtree declares a `meta.route` comes first, and
32
+ * the others keep the order of the machine.
33
+ *
34
+ * A parallel machine often holds its routes in ONE region, and that region need not be
35
+ * the first one: a menu or a session region can come before it. The route derivation
36
+ * and the view derivation both follow this order, so the URL comes from the routed
37
+ * region, and the view without outlets belongs to the region of the URL.
38
+ */
39
+ export const branchOrder = (node, value) => {
40
+ const keys = activeChildKeys(value);
41
+ if (keys.length < 2)
42
+ return keys;
43
+ const routed = keys.find((key) => {
44
+ const child = node.states?.[key]; // nosemgrep: gitlab.eslint.detect-object-injection
45
+ return child !== undefined && routeBelow(child, activeChildValue(value, key));
46
+ });
47
+ return routed === undefined || routed === keys[0]
48
+ ? keys
49
+ : [routed, ...keys.filter((key) => key !== routed)];
50
+ };
1
51
  /**
2
52
  * Collects the `meta` object of the active state nodes of a SINGLE branch, from the
3
53
  * root to a leaf. The key of each entry is the state id, and the order is the
@@ -13,11 +63,11 @@
13
63
  * the meta keys are those ids, and they carry no information about the ancestry.
14
64
  *
15
65
  * Therefore this function walks `snapshot.value`, which holds the real hierarchy of
16
- * the active states by the state key, against the node tree of the machine. It
17
- * follows the FIRST active child at each level. This gives one deterministic branch,
18
- * which matches the historical behavior of "the first that it finds" for a parallel
19
- * machine. It also works with an explicit id, because each node carries its own `id`
20
- * and its own `meta`.
66
+ * the active states by the state key, against the node tree of the machine. At each
67
+ * level it follows the first key of {@link branchOrder}: for a parallel node, that is
68
+ * the first region whose active subtree declares a route, or the first region when no
69
+ * region does. This gives one deterministic branch. It also works with an explicit id,
70
+ * because each node carries its own `id` and its own `meta`.
21
71
  *
22
72
  * The function returns `null` when the snapshot exposes no machine and no value to
23
73
  * walk. This is a defensive measure, because a real XState snapshot always exposes
@@ -34,26 +84,15 @@ export const firstActiveBranchMeta = (snapshot) => {
34
84
  if (node.meta && typeof node.meta === "object") {
35
85
  ordered[node.id] = node.meta; // nosemgrep: gitlab.eslint.detect-object-injection
36
86
  }
37
- // Find the key of the active child at this level. A string value is the name of an
38
- // atomic active leaf. An object value is a compound node, with one key, or a
39
- // parallel node, with many keys: take the first key, for one deterministic
40
- // branch.
41
- let key;
42
- if (typeof value === "string") {
43
- key = value;
44
- }
45
- else if (value && typeof value === "object") {
46
- key = Object.keys(value)[0];
47
- }
87
+ // The key of the active child at this level: the name of an atomic active leaf, the
88
+ // one key of a compound node, or the routed region of a parallel node.
89
+ const key = branchOrder(node, value)[0];
48
90
  if (key === undefined)
49
91
  break;
50
92
  const child = node.states?.[key]; // nosemgrep: gitlab.eslint.detect-object-injection
51
93
  if (!child)
52
94
  break;
53
- value =
54
- typeof value === "object" && value !== null
55
- ? value[key] // nosemgrep: gitlab.eslint.detect-object-injection
56
- : {};
95
+ value = activeChildValue(value, key);
57
96
  node = child;
58
97
  }
59
98
  return ordered;
@@ -1 +1 @@
1
- {"version":3,"file":"state-meta.js","sourceRoot":"","sources":["../src/state-meta.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACpC,QAA4B,EACK,EAAE;IACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,IAEnB,CAAC;IACb,IAAI,CAAC,IAAI;QAAE,OAAO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.ts","sourceRoot":"","sources":["../../src/view/derive-current-view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAyEpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,kBAAkB,KAAG,QAAQ,GAAG,IA4C3E,CAAC"}
1
+ {"version":3,"file":"derive-current-view.d.ts","sourceRoot":"","sources":["../../src/view/derive-current-view.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAIN,KAAK,QAAQ,EAGb,MAAM,sBAAsB,CAAC;AAkL9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,kBAAkB,KAAG,QAAQ,GAAG,IA2D3E,CAAC"}
@@ -1,6 +1,6 @@
1
- import { composePlayState, toAtomState } from "@xmachines/play-view";
1
+ import { composePlayState, composeViews, toAtomState, } from "@xmachines/play-view";
2
2
  import { createWarnOnce } from "@xmachines/core/utils";
3
- import { activeStateMeta } from "../state-meta.js";
3
+ import { activeChildKeys, activeChildValue, activeStateMeta, branchOrder, } from "../state-meta.js";
4
4
  /**
5
5
  * The migration warning of the `contextProps` field, which 1.x removed. The code
6
6
  * writes it one time for each spec. A meta.view object from a person passes around
@@ -15,7 +15,7 @@ const warnRemovedContextProps = (viewMeta) => {
15
15
  warnOnce(viewMeta, "[play-xstate] meta.view.contextProps has been removed: the whole machine context " +
16
16
  "is always projected under /context. Delete the field — it no longer filters anything.");
17
17
  };
18
- /** Reads the `view` of one meta entry, when the entry holds a whole PlaySpec. */
18
+ /** Reads the `view` of one meta entry, when the entry holds a whole spec. */
19
19
  const viewOfEntry = (stateMeta) => {
20
20
  const maybeView = stateMeta && typeof stateMeta === "object"
21
21
  ? stateMeta.view
@@ -53,6 +53,92 @@ const resolveViewMeta = (meta) => {
53
53
  }
54
54
  return null;
55
55
  };
56
+ /**
57
+ * Resolves the view of one active state node and its active descendants.
58
+ *
59
+ * A node whose view declares `outlets` composes: the tree holds the resolved view of
60
+ * each active child. Any other node keeps the rule of a view without outlets: the
61
+ * deepest view below it wins, and a parallel node follows the region of the URL when
62
+ * that region resolves to a view, and its first region that resolves to one otherwise.
63
+ */
64
+ const resolveViewTree = (node, value) => {
65
+ const view = viewOfEntry(node.meta);
66
+ if (view && "contextProps" in view) {
67
+ warnRemovedContextProps(view);
68
+ }
69
+ // A view with outlets places its children in the order of the machine. Any other
70
+ // node tries the routed region first, so its view belongs to the region of the URL.
71
+ const keys = view?.outlets ? activeChildKeys(value) : branchOrder(node, value);
72
+ const children = [];
73
+ for (const key of keys) {
74
+ const child = node.states?.[key]; // nosemgrep: gitlab.eslint.detect-object-injection
75
+ if (!child)
76
+ continue;
77
+ const resolved = resolveViewTree(child, activeChildValue(value, key));
78
+ if (resolved)
79
+ children.push({ key, resolved });
80
+ // Without outlets, only the first child that resolves counts.
81
+ if (resolved && !view?.outlets)
82
+ break;
83
+ }
84
+ if (view?.outlets) {
85
+ return {
86
+ tree: {
87
+ id: node.id,
88
+ view,
89
+ children: children.map(({ key, resolved }) => ({ key, tree: resolved.tree })),
90
+ },
91
+ composes: true,
92
+ };
93
+ }
94
+ const deeper = children[0]?.resolved;
95
+ if (deeper)
96
+ return deeper;
97
+ return view ? { tree: { id: node.id, view, children: [] }, composes: false } : null;
98
+ };
99
+ // Whether any state node of a machine declares `outlets`, for each root node. A
100
+ // machine without outlets skips the walk of the view tree on every snapshot.
101
+ const outletsByMachine = new WeakMap();
102
+ const declaresOutlets = (node) => Boolean(viewOfEntry(node.meta)?.outlets) ||
103
+ Object.values(node.states ?? {}).some(declaresOutlets);
104
+ const machineDeclaresOutlets = (root) => {
105
+ let declares = outletsByMachine.get(root);
106
+ if (declares === undefined) {
107
+ declares = declaresOutlets(root);
108
+ outletsByMachine.set(root, declares);
109
+ }
110
+ return declares;
111
+ };
112
+ /**
113
+ * Derives the view of a machine that declares `outlets` somewhere. The walk of the view
114
+ * tree alone decides that view: a composed view, the plain view that the walk resolved,
115
+ * or `null` when no active state holds a view.
116
+ *
117
+ * The function returns `undefined` for a machine that declares no `outlets`. The caller
118
+ * then derives the view as before, which keeps every such machine on the exact rule that
119
+ * it had, the flat fallback of a parallel machine included.
120
+ */
121
+ const deriveTreeView = (snapshot) => {
122
+ const root = snapshot?.machine?.root;
123
+ if (!root || !machineDeclaresOutlets(root))
124
+ return undefined;
125
+ const resolved = resolveViewTree(root, snapshot.value);
126
+ if (!resolved)
127
+ return null;
128
+ // A tree that does not compose is a view without outlets.
129
+ if (!resolved.composes)
130
+ return { viewKey: resolved.tree.id, view: resolved.tree.view };
131
+ const composed = composeViews(resolved.tree);
132
+ return {
133
+ viewKey: resolved.tree.id,
134
+ view: {
135
+ root: composed.root,
136
+ elements: composed.elements,
137
+ ...(composed.state !== undefined && { state: composed.state }),
138
+ viewParts: composed.viewParts,
139
+ },
140
+ };
141
+ };
56
142
  /**
57
143
  * Derives the current view of the actor from the state metadata.
58
144
  *
@@ -94,6 +180,22 @@ const resolveViewMeta = (meta) => {
94
180
  * @returns The derived `PlaySpec`, or `null` when the current state has no view metadata.
95
181
  */
96
182
  export const deriveCurrentView = (snapshot) => {
183
+ const slice = snapshot?.context !== null && typeof snapshot?.context === "object"
184
+ ? snapshot.context
185
+ : undefined;
186
+ // A parent view with `outlets` shares the screen with the views of its substates.
187
+ const treeView = deriveTreeView(snapshot);
188
+ if (treeView !== undefined) {
189
+ if (treeView === null)
190
+ return null;
191
+ const authoredState = treeView.view.state !== undefined ? toAtomState(treeView.view.state) : undefined;
192
+ const state = composePlayState(authoredState, slice);
193
+ return {
194
+ ...treeView.view,
195
+ viewKey: treeView.viewKey,
196
+ ...(state !== undefined && { state }),
197
+ };
198
+ }
97
199
  // Follow the SAME single active branch as the route derivation. Therefore the view
98
200
  // on the screen of a parallel machine belongs to the region of the URL, when that
99
201
  // region declares a view.
@@ -122,9 +224,6 @@ export const deriveCurrentView = (snapshot) => {
122
224
  // Project the complete context under /context. composePlayState skips the
123
225
  // projection, the authored state wins, and the code writes a warning in development,
124
226
  // when spec.state declares a top-level "context" key already.
125
- const slice = snapshot.context !== null && typeof snapshot.context === "object"
126
- ? snapshot.context
127
- : undefined;
128
227
  const authoredState = viewMeta.state !== undefined ? toAtomState(viewMeta.state) : undefined;
129
228
  const state = composePlayState(authoredState, slice);
130
229
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"derive-current-view.js","sourceRoot":"","sources":["../../src/view/derive-current-view.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAiB,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AASnD;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;AAClC,MAAM,uBAAuB,GAAG,CAAC,QAAgB,EAAQ,EAAE;IAC1D,QAAQ,CACP,QAAQ,EACR,mFAAmF;QAClF,uFAAuF,CACxF,CAAC;AACH,CAAC,CAAC;AAEF,iFAAiF;AACjF,MAAM,WAAW,GAAG,CAAC,SAAkB,EAAmB,EAAE;IAC3D,MAAM,SAAS,GACd,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;QACzC,CAAC,CAAE,SAAgC,CAAC,IAAI;QACxC,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO,SAAS;QACf,OAAO,SAAS,KAAK,QAAQ;QAC7B,MAAM,IAAK,SAAoB;QAC/B,UAAU,IAAK,SAAoB;QACnC,CAAC,CAAE,SAAsB;QACzB,CAAC,CAAC,IAAI,CAAC;AACT,CAAC,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AK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;KACrC,CAAC;AACH,CAAC,CAAC"}
@@ -46,9 +46,7 @@ import type { PlayerConstructor } from "./capabilities.js";
46
46
  *
47
47
  * The ORDER of the composition does not matter. `currentView` and `currentRoute` are two
48
48
  * computed atoms over `state`, and neither reads the other, so the engine evaluates both
49
- * from one write in topological order. An earlier release wrote `currentView` from an
50
- * `onSnapshot` override, and the order then decided which capability held its new value
51
- * first.
49
+ * from one write in topological order.
52
50
  *
53
51
  * @param Base - The actor class to extend, normally `PlayerActor` or the result of
54
52
  * another capability.
@@ -1 +1 @@
1
- {"version":3,"file":"with-view.d.ts","sourceRoot":"","sources":["../src/with-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAI9C,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAsC3D;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,eAAe,EACxD,IAAI,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAC/B,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAuFvC"}
1
+ {"version":3,"file":"with-view.d.ts","sourceRoot":"","sources":["../src/with-view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAI9C,OAAO,EAAqC,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGxF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAsC3D;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,eAAe,EACxD,IAAI,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GAC/B,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAyFvC"}
package/dist/with-view.js CHANGED
@@ -64,9 +64,7 @@ const viewSpecsEquivalent = (a, b) => {
64
64
  *
65
65
  * The ORDER of the composition does not matter. `currentView` and `currentRoute` are two
66
66
  * computed atoms over `state`, and neither reads the other, so the engine evaluates both
67
- * from one write in topological order. An earlier release wrote `currentView` from an
68
- * `onSnapshot` override, and the order then decided which capability held its new value
69
- * first.
67
+ * from one write in topological order.
70
68
  *
71
69
  * @param Base - The actor class to extend, normally `PlayerActor` or the result of
72
70
  * another capability.
@@ -79,10 +77,9 @@ export function withView(Base) {
79
77
  *
80
78
  * It emits a **new object reference** on each real change of the view on the screen:
81
79
  * the view of a different state, or a change of a param or of the context that changes
82
- * the resolved spec. A re-entry with `reenter: true` and new params also changes the
83
- * spec. A snapshot that changes no view on the screen, such as an assign of the
84
- * context alone, keeps the previous reference. A provider below the atom therefore
85
- * mounts the UI again not on every event.
80
+ * the resolved spec. A snapshot that changes no view on the screen, such as an
81
+ * assign of the context alone, keeps the previous reference. A provider below the
82
+ * atom therefore mounts the UI again not on every event.
86
83
  *
87
84
  * The `PlaySpec` of the emission carries the context of the machine in its composed
88
85
  * `state` field, under the read-only `/context` subtree. A spec therefore reads the
@@ -92,10 +89,13 @@ export function withView(Base) {
92
89
  *
93
90
  * The atom returns `null` when the current state has no `meta.view` metadata.
94
91
  *
95
- * Two states can declare two separate `meta.view` literals with an identical
96
- * structure. A transition between those two states then emits two different
97
- * references, and a provider mounts the UI again. Move the shared literal into one
98
- * `typedSpec` constant, and the identity then removes the duplicate.
92
+ * Two states that each declare a `meta.view` emit two different `viewKey` values,
93
+ * also when the two specs are one `typedSpec` constant: the key is the id of the
94
+ * state node that declares the view. A transition between those two states therefore
95
+ * emits again, and a provider seeds a new store, which removes the ephemeral state.
96
+ * The ephemeral state survives a move between the children when the parent holds
97
+ * the key: declare the view on the parent and none on the children, or declare
98
+ * `outlets` on the parent, which keeps its id as the `viewKey` of the composed view.
99
99
  *
100
100
  * It is a COMPUTED atom over `state`, and not a written one. One write for each
101
101
  * transition therefore reaches the whole actor — `state.set(snapshot)` — and the
@@ -1 +1 @@
1
- {"version":3,"file":"with-view.js","sourceRoot":"","sources":["../src/with-view.ts"],"names":[],"mappings":"AA2BA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAgC,MAAM,sBAAsB,CAAC;AAExF,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE;;;;;;;;;;GAUG;AACH,MAAM,mBAAmB,GAAG,CAAC,CAAkB,EAAE,CAAkB,EAAW,EAAE;IAC/E,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC;QAAE,OAAO,KAAK,CAAC;IAExD,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC;IACnC,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC;IACnC,2EAA2E;IAC3E,8EAA8E;IAC9E,aAAa;IACb,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,WAAW,CAAC,MAAM,KAAK,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACvE,KAAK,MAAM,G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AAC;gBACD,OAAO,eAAe,CAAC;YACxB,CAAC;QACF,CAAC,CACD,CAAC;KACF;IAED,OAAO,aAAa,CAAC;AACtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-xstate",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "XState v5 adapter for Play Architecture",
5
5
  "keywords": [
6
6
  "actor-model",
@@ -57,18 +57,18 @@
57
57
  "test:coverage": "vitest run --coverage"
58
58
  },
59
59
  "dependencies": {
60
- "@xmachines/play-actor": "6.0.0",
61
- "@xmachines/play-pattern": "6.0.0"
60
+ "@xmachines/play-actor": "6.1.0",
61
+ "@xmachines/play-pattern": "6.1.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@testing-library/jest-dom": "^7.0.1",
65
65
  "@types/node": "^26.6.2",
66
- "@xmachines/core": "6.0.0",
67
- "@xmachines/json-render-core": "^0.21.0-xm.1",
68
- "@xmachines/play": "6.0.0",
69
- "@xmachines/play-atom": "6.0.0",
70
- "@xmachines/play-router": "6.0.0",
71
- "@xmachines/play-view": "6.0.0",
66
+ "@xmachines/core": "6.1.0",
67
+ "@xmachines/json-render-core": "^0.21.0-xm.2",
68
+ "@xmachines/play": "6.1.0",
69
+ "@xmachines/play-atom": "6.1.0",
70
+ "@xmachines/play-router": "6.1.0",
71
+ "@xmachines/play-view": "6.1.0",
72
72
  "oxfmt": "^0.70.0",
73
73
  "oxlint": "^1.85.0",
74
74
  "typescript": "^5.9.3 || ^6.0.3",
@@ -77,11 +77,11 @@
77
77
  "xstate": "^5.33.0"
78
78
  },
79
79
  "peerDependencies": {
80
- "@xmachines/core": "6.0.0",
81
- "@xmachines/play": "6.0.0",
82
- "@xmachines/play-atom": "6.0.0",
83
- "@xmachines/play-router": "6.0.0",
84
- "@xmachines/play-view": "6.0.0",
80
+ "@xmachines/core": "6.1.0",
81
+ "@xmachines/play": "6.1.0",
82
+ "@xmachines/play-atom": "6.1.0",
83
+ "@xmachines/play-router": "6.1.0",
84
+ "@xmachines/play-view": "6.1.0",
85
85
  "xstate": "^5.33.0"
86
86
  },
87
87
  "peerDependenciesMeta": {