@xmachines/play-xstate 2.2.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +158 -54
  2. package/dist/capabilities.d.ts +92 -0
  3. package/dist/capabilities.d.ts.map +1 -0
  4. package/dist/capabilities.js +4 -0
  5. package/dist/capabilities.js.map +1 -0
  6. package/dist/define-player.d.ts +7 -1
  7. package/dist/define-player.d.ts.map +1 -1
  8. package/dist/define-player.js +9 -60
  9. package/dist/define-player.js.map +1 -1
  10. package/dist/errors.d.ts +29 -26
  11. package/dist/errors.d.ts.map +1 -1
  12. package/dist/errors.js +53 -35
  13. package/dist/errors.js.map +1 -1
  14. package/dist/index.d.ts +3 -4
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +14 -4
  17. package/dist/index.js.map +1 -1
  18. package/dist/player-actor.d.ts +74 -114
  19. package/dist/player-actor.d.ts.map +1 -1
  20. package/dist/player-actor.js +94 -223
  21. package/dist/player-actor.js.map +1 -1
  22. package/dist/routing/derive-current-route.d.ts +1 -36
  23. package/dist/routing/derive-current-route.d.ts.map +1 -1
  24. package/dist/routing/derive-current-route.js +2 -76
  25. package/dist/routing/derive-current-route.js.map +1 -1
  26. package/dist/routing/derive-initial-route.d.ts.map +1 -1
  27. package/dist/routing/derive-initial-route.js +11 -0
  28. package/dist/routing/derive-initial-route.js.map +1 -1
  29. package/dist/routing/derive-route.d.ts +81 -2
  30. package/dist/routing/derive-route.d.ts.map +1 -1
  31. package/dist/routing/derive-route.js +97 -3
  32. package/dist/routing/derive-route.js.map +1 -1
  33. package/dist/routing/format-play-route-transitions.d.ts +8 -2
  34. package/dist/routing/format-play-route-transitions.d.ts.map +1 -1
  35. package/dist/routing/format-play-route-transitions.js +170 -43
  36. package/dist/routing/format-play-route-transitions.js.map +1 -1
  37. package/dist/routing/index.d.ts +1 -1
  38. package/dist/routing/index.d.ts.map +1 -1
  39. package/dist/routing/types.d.ts +9 -5
  40. package/dist/routing/types.d.ts.map +1 -1
  41. package/dist/state-meta.d.ts +52 -0
  42. package/dist/state-meta.d.ts.map +1 -0
  43. package/dist/state-meta.js +77 -0
  44. package/dist/state-meta.js.map +1 -0
  45. package/dist/types.d.ts +18 -3
  46. package/dist/types.d.ts.map +1 -1
  47. package/dist/view/derive-current-view.d.ts +1 -1
  48. package/dist/view/derive-current-view.d.ts.map +1 -1
  49. package/dist/view/derive-current-view.js +35 -17
  50. package/dist/view/derive-current-view.js.map +1 -1
  51. package/dist/with-routing.d.ts +45 -0
  52. package/dist/with-routing.d.ts.map +1 -0
  53. package/dist/with-routing.js +78 -0
  54. package/dist/with-routing.js.map +1 -0
  55. package/dist/with-view.d.ts +42 -0
  56. package/dist/with-view.d.ts.map +1 -0
  57. package/dist/with-view.js +150 -0
  58. package/dist/with-view.js.map +1 -0
  59. package/package.json +39 -18
  60. package/dist/guards/compose.d.ts +0 -158
  61. package/dist/guards/compose.d.ts.map +0 -1
  62. package/dist/guards/compose.js +0 -188
  63. package/dist/guards/compose.js.map +0 -1
  64. package/dist/guards/helpers.d.ts +0 -62
  65. package/dist/guards/helpers.d.ts.map +0 -1
  66. package/dist/guards/helpers.js +0 -85
  67. package/dist/guards/helpers.js.map +0 -1
  68. package/dist/guards/index.d.ts +0 -20
  69. package/dist/guards/index.d.ts.map +0 -1
  70. package/dist/guards/index.js +0 -18
  71. package/dist/guards/index.js.map +0 -1
  72. package/dist/guards/types.d.ts +0 -22
  73. package/dist/guards/types.d.ts.map +0 -1
  74. package/dist/guards/types.js +0 -2
  75. package/dist/guards/types.js.map +0 -1
@@ -1,9 +1,7 @@
1
1
  import { Actor, } from "xstate";
2
- import { AbstractActor, reuseComposedState, shallowEqualExcept, } from "@xmachines/play-actor";
2
+ import { DISPOSE } from "@xmachines/play";
3
3
  import { Signal } from "@xmachines/play-signals";
4
4
  import { ActorThrewNonErrorError, InvalidEventError, InvalidMachineError } from "./errors.js";
5
- import { deriveCurrentRoute, deriveInitialRoute } from "./routing/index.js";
6
- import { deriveCurrentView } from "./view/derive-current-view.js";
7
5
  /**
8
6
  * Tells you if a value is an `Error`, by its identity or by its brand: `instanceof`
9
7
  * misses an error from another realm, such as an iframe or `node:vm`. The function
@@ -24,13 +22,15 @@ const isRealError = (value) => {
24
22
  /**
25
23
  * Normalizes a failure of the actor for `onError`.
26
24
  *
25
+ * @internal
26
+ *
27
27
  * The function gives an `Error` to the handler without a change. The error of the
28
28
  * machine therefore keeps its identity: an `instanceof` test of a consumer still
29
29
  * works, and the path without an `onError` throws that same object again. Every
30
30
  * other value is ours to build, and it becomes a `PlayError` with a code. That
31
31
  * error carries the value from the throw as its `cause`.
32
32
  */
33
- const toError = (value) => {
33
+ export const toError = (value) => {
34
34
  try {
35
35
  if (isRealError(value)) {
36
36
  return value;
@@ -43,48 +43,6 @@ const toError = (value) => {
43
43
  }
44
44
  return new ActorThrewNonErrorError(value);
45
45
  };
46
- /**
47
- * The structural equality of two derived view specs, with a limit on its depth.
48
- *
49
- * The function walks exactly the shape that `deriveCurrentView` builds: the spec
50
- * fields, then `elements`, then the `props` object of each element. It compares
51
- * each leaf with `Object.is`. It never enters the VALUE of a prop: a new reference
52
- * therefore emits the view again, also when the contents are equal. This design
53
- * keeps two things correct: a prop of a container (a Map, a Set, or an instance of a
54
- * class, which a structural comparison cannot see), and a cyclic value, which gives
55
- * a structural comparison a recursion without an end.
56
- */
57
- const viewSpecsEquivalent = (a, b) => {
58
- if (a === b)
59
- return true;
60
- if (!a || !b)
61
- return false;
62
- if (!shallowEqualExcept(a, b, "elements"))
63
- return false;
64
- const aElements = a.elements ?? {};
65
- const bElements = b.elements ?? {};
66
- // A derived spec spreads the same static meta.view. Therefore the elements
67
- // usually have the same reference, and the walk over each element is then not
68
- // necessary.
69
- if (aElements === bElements)
70
- return true;
71
- const elementKeys = Object.keys(aElements);
72
- if (elementKeys.length !== Object.keys(bElements).length)
73
- return false;
74
- for (const key of elementKeys) {
75
- const aElement = aElements[key]; // nosemgrep: gitlab.eslint.detect-object-injection
76
- const bElement = bElements[key]; // nosemgrep: gitlab.eslint.detect-object-injection
77
- if (aElement === bElement)
78
- continue;
79
- if (!aElement || !bElement)
80
- return false;
81
- if (!shallowEqualExcept(aElement, bElement, "props"))
82
- return false;
83
- if (!shallowEqualExcept(aElement.props ?? {}, bElement.props ?? {}))
84
- return false;
85
- }
86
- return true;
87
- };
88
46
  /**
89
47
  * Tells you if a snapshot is worth a propagation to the signals: an active
90
48
  * snapshot, or a "done" snapshot, which means that the machine reached a final state
@@ -96,8 +54,8 @@ const isObservableSnapshot = (snapshot) => snapshot.status === "active" || snaps
96
54
  /**
97
55
  * The concrete XState actor. It implements the signal protocol of the Play Architecture
98
56
  *
99
- * The class extends {@link @xmachines/play-actor!AbstractActor}, and therefore the
100
- * `Actor` class of XState. It gives you the XState v5 integration, and it keeps the
57
+ * The class extends the `Actor` class of XState directly, and it implements
58
+ * {@link @xmachines/play-actor!PlayActor}. It gives you the XState v5 integration, and it keeps the
101
59
  * compatibility with the ecosystem, such as the XState inspection and the devtools.
102
60
  * The constructor of the base class receives the machine. Therefore a `PlayerActor`
103
61
  * **is** the XState actor, and it is no wrapper around one: every member of the
@@ -105,8 +63,8 @@ const isObservableSnapshot = (snapshot) => snapshot.status === "active" || snaps
105
63
  * reactive state on the TC39 Signals for the observation by the infrastructure.
106
64
  *
107
65
  * **Capabilities:** the class implements both the
108
- * {@link @xmachines/play-actor!Routable} interface and the
109
- * {@link @xmachines/play-actor!Viewable} interface. It therefore supports the
66
+ * {@link @xmachines/play-router!index.Routable} interface and the
67
+ * {@link @xmachines/play-view!index.Viewable} interface. It therefore supports the
110
68
  * routing and the view rendering.
111
69
  *
112
70
  * **Architectural context:** the class implements **Actor Authority (INV-01)**,
@@ -121,7 +79,7 @@ const isObservableSnapshot = (snapshot) => snapshot.status === "active" || snaps
121
79
  * The creation of an actor, and its lifecycle
122
80
  * ```typescript
123
81
  * import { setup } from "xstate";
124
- * import { definePlayer } from "@xmachines/play-xstate";
82
+ * import { definePlayer, compose, PlayerActor } from "@xmachines/play-xstate";
125
83
  *
126
84
  * const machine = setup({}).createMachine({
127
85
  * initial: 'idle',
@@ -167,9 +125,9 @@ const isObservableSnapshot = (snapshot) => snapshot.status === "active" || snaps
167
125
  *
168
126
  * @see [Play RFC](../../docs/rfc/play.md)
169
127
  * @see {@link definePlayer} for the creation through a factory
170
- * @see {@link @xmachines/play-actor!AbstractActor} for the signal protocol
171
- * @see {@link @xmachines/play-actor!Routable} for the routing capability
172
- * @see {@link @xmachines/play-actor!Viewable} for the view rendering capability
128
+ * @see {@link @xmachines/play-actor!PlayActor} for the signal protocol
129
+ * @see {@link @xmachines/play-router!index.Routable} for the routing capability
130
+ * @see {@link @xmachines/play-view!index.Viewable} for the view rendering capability
173
131
  *
174
132
  * @remarks
175
133
  * **The routing:** this actor supports the `route: {}` config pattern of XState and
@@ -182,8 +140,21 @@ const isObservableSnapshot = (snapshot) => snapshot.status === "active" || snaps
182
140
  * PlayRenderer is therefore correct. The class derives each view at the entry of a
183
141
  * state and keeps it, and it computes no view on a read.
184
142
  */
185
- export class PlayerActor extends AbstractActor {
143
+ export class PlayerActor extends Actor {
186
144
  playerOptions;
145
+ /**
146
+ * The three inputs of the constructor that a CAPABILITY needs.
147
+ *
148
+ * A mixin over a generic base cannot declare a constructor: TypeScript then demands the
149
+ * signature `...args: any[]` (TS2545), which this workspace does not write. A field
150
+ * initializer of a subclass runs after `super()` instead, and it reads these. The
151
+ * routing capability derives `initialRoute` from all three.
152
+ */
153
+ playerMachine;
154
+ /** @see {@link playerMachine} */
155
+ playerInput;
156
+ /** @see {@link playerMachine} */
157
+ playerRestoredSnapshot;
187
158
  /**
188
159
  * The live options object of the caller, or an empty object during the construction.
189
160
  *
@@ -203,16 +174,7 @@ export class PlayerActor extends AbstractActor {
203
174
  get hooks() {
204
175
  return this.playerOptions ?? {};
205
176
  }
206
- /**
207
- * The last snapshot of the view pipeline. XState notifies each observer on EVERY
208
- * event that it processes, and an event that it ignores delivers the identical
209
- * snapshot again. deriveCurrentView is pure in the snapshot. Therefore an identical
210
- * reference can change no result. The first value is undefined, and never a
211
- * snapshot: the snapshot of the construction has the same reference as the snapshot
212
- * that start() replays, and that value therefore stops the first view.
213
- */
214
- lastViewSnapshot = undefined;
215
- // The requirements of the AbstractActor protocol
177
+ // The requirements of the PlayActor contract
216
178
  state;
217
179
  /**
218
180
  * Tells you if the current state of the actor accepts the given event.
@@ -227,84 +189,25 @@ export class PlayerActor extends AbstractActor {
227
189
  */
228
190
  can(event) {
229
191
  // A read of the signal keeps can() reactive: a Signal.Computed over the signal
230
- // computes its value again on each transition. Two states have no answer: the
231
- // construction window, where the code can read no snapshot, and an actor with a
232
- // failed initialization, where XState parks an error snapshot. That snapshot is
233
- // a truthy object, and it has no `can` method.
192
+ // computes its value again on each transition.
234
193
  const snapshot = this.state?.get();
235
- return typeof snapshot?.can === "function" ? snapshot.can(event) : false;
194
+ // The STATUS decides first, and the presence of the method decides second.
195
+ //
196
+ // An actor answers an event only while it is active. XState 5.32 made that test
197
+ // unnecessary by accident — the error snapshot of a failed initialization carried no
198
+ // `can` method, so a test of the method alone answered `false` for it — and 5.33
199
+ // gives that snapshot a working `can`, which then answered `true` for an actor that
200
+ // processes an event never. The status is what the question is really about, and a
201
+ // `done` actor answers `false` for the same reason.
202
+ //
203
+ // A STOPPED actor is the exception, and it is deliberate: the subscription below
204
+ // updates this signal on a stable state alone, so the signal keeps the last ACTIVE
205
+ // snapshot after a teardown rather than freezing on an artifact of it. `can()`
206
+ // therefore answers for the last live state of a stopped actor.
207
+ if (snapshot?.status !== "active")
208
+ return false;
209
+ return typeof snapshot.can === "function" ? snapshot.can(event) : false;
236
210
  }
237
- /**
238
- * A TC39 `Signal.Computed`. It derives the current URL path from the `meta.route`
239
- * template of the active machine state and from the context of the actor.
240
- *
241
- * It returns `null` when the current state has no `meta.route` field, and also when
242
- * it cannot resolve the complete route template. A necessary `:param` that the
243
- * context does not hold is caught inside the signal, and a
244
- * `MissingRouteParamError` therefore never leaves `get()`: that condition is
245
- * temporary during a transition, and the signal computes the value again on the next
246
- * snapshot.
247
- *
248
- * @example
249
- * ```typescript
250
- * // It returns "/profile/alice" when context.params.userId === "alice",
251
- * // and null while the param is still absent.
252
- * const route = actor.currentRoute.get();
253
- * ```
254
- */
255
- currentRoute;
256
- /**
257
- * The route of the initial state of the machine. The constructor fixes it, and it
258
- * never changes, also when the code restores the actor from a snapshot.
259
- *
260
- * A router bridge compares it with the browser URL, and it therefore separates a
261
- * deep link (a URL that is not the initial one → the router wins) from a restore
262
- * (the initial URL, and the actor at a different route from the restore → the actor
263
- * wins).
264
- *
265
- * `deriveInitialRoute` derives the value statically from the machine definition,
266
- * with the pure `initialTransition` helper of XState: the chain of the initial states
267
- * and their `meta.route` templates are fixed at the moment of the machine
268
- * definition, and the substitution of a `:param` uses the real initial context of
269
- * the machine for the `input` of this actor. The code makes no second actor, and a
270
- * snapshot of a restore changes the value never: it is always the **default**
271
- * initial route of the machine.
272
- */
273
- initialRoute;
274
- /**
275
- * The reactive signal of the current view spec. The signal derives the spec from
276
- * the `meta.view` metadata of the active state.
277
- *
278
- * It emits a **new object reference** on each real change of the view on the
279
- * screen: the view of a different state, or a change of a param or of the context
280
- * that changes the resolved spec. A re-entry with `reenter: true` and new params
281
- * also changes the spec. A snapshot that changes no view on the screen, such as an
282
- * assign of the context alone, keeps the previous reference. A provider below the
283
- * signal therefore mounts the UI again not on every event.
284
- *
285
- * The `PlaySpec` of the emission carries the context of the machine in its composed
286
- * `state` field, under the read-only `/context` subtree. A spec therefore reads the
287
- * context, and also each URL param, through the ordinary state grammar
288
- * (`{ $state: "/context/params/section" }`). The context-projection module of
289
- * `@xmachines/play-actor` holds the complete contract.
290
- *
291
- * The signal returns `null` when the current state has no `meta.view` metadata.
292
- *
293
- * Two states can declare two separate `meta.view` literals with an identical
294
- * structure. A transition between those two states then emits two different
295
- * references, and a provider mounts the UI again. Move the shared literal into one
296
- * `typedSpec` constant, and the identity then removes the duplicate.
297
- *
298
- * @example
299
- * ```typescript
300
- * const view = actor.currentView.get();
301
- * if (view) {
302
- * console.log(view.root); // for example "root"
303
- * console.log(view.elements); // the Spec elements of @xmachines/json-render-core
304
- * }
305
- * ```
306
- */
307
- currentView = new Signal.State(null);
308
211
  constructor(machine, options, input, restoredSnapshot) {
309
212
  // A defensive check before super(): a machine that is not an object fails deep
310
213
  // inside the constructor of XState, with an opaque TypeError, and not with a coded
@@ -328,30 +231,15 @@ export class PlayerActor extends AbstractActor {
328
231
  snapshot: restoredSnapshot,
329
232
  inspect: options?.inspect,
330
233
  });
331
- // Derive the initial route of the machine, for the detection of a restore or a
332
- // deep link. The value is always the DEFAULT initial route of the machine, and
333
- // never the route of the restored state. Without a snapshot of a restore, the
334
- // pre-start snapshot of this actor IS that default initial state, and the code
335
- // derives the route from it directly. A restore alone needs the pure
336
- // `initialTransition` helper of XState. The inert actor scope of that helper runs
337
- // the initial transition of the machine two more times, and one of them has an
338
- // undefined `input`. This is a quirk of XState, and it costs too much for each
339
- // other case.
340
- this.initialRoute =
341
- restoredSnapshot === undefined
342
- ? deriveCurrentRoute(this.getSnapshot())
343
- : deriveInitialRoute(machine, input);
234
+ this.playerMachine = machine;
235
+ this.playerInput = input;
236
+ this.playerRestoredSnapshot = restoredSnapshot;
344
237
  this.playerOptions = options || {};
345
238
  // Initialize the state signal. Each update is synchronous, with no batching in a
346
239
  // microtask: XState groups the transitions of one send() call into one
347
240
  // subscription callback already, and a synchronous update shows each guard
348
241
  // redirect to a router bridge at once.
349
242
  this.state = new Signal.State(this.getSnapshot());
350
- // Initialize the currentRoute computed signal
351
- this.currentRoute = new Signal.Computed(() => {
352
- const snapshot = this.state.get();
353
- return deriveCurrentRoute(snapshot);
354
- });
355
243
  // Observe the transitions of this actor. The code uses `super`, and not `this`, so
356
244
  // that the bookkeeping of the next-only subscriptions in the subscribe override
357
245
  // stays about the subscriptions of the user code.
@@ -363,14 +251,16 @@ export class PlayerActor extends AbstractActor {
363
251
  if (isObservableSnapshot(snapshot)) {
364
252
  // Each state update is synchronous. Therefore a router bridge sees a guard redirect at once.
365
253
  this.state.set(snapshot);
366
- // Check the view and keep it after state and currentRoute hold their new values,
367
- // and before the hooks.
368
- // The order of the hooks is deliberate:
369
- // 1. state and currentRoute receive their new values
370
- // 2. currentView holds the new view
254
+ // Every capability derives here, and the ORDER is the composition order:
255
+ // `compose(PlayerActor, withRouting, withView)` makes `withView` the outermost
256
+ // class, so its override runs `super.onSnapshot()` first and the routing
257
+ // capability therefore holds its new value before the view derives from it.
258
+ // The whole order of one transition:
259
+ // 1. state receives its new value, and each Computed over it follows
260
+ // 2. onSnapshot runs each capability, in the composition order
371
261
  // 3. the onStateChange hook runs
372
262
  // 4. send() then calls onTransition
373
- this.validateAndCacheView(snapshot);
263
+ this.onSnapshot(snapshot);
374
264
  // Call the onStateChange hook
375
265
  const onStateChange = this.hooks.onStateChange;
376
266
  if (onStateChange) {
@@ -495,7 +385,7 @@ export class PlayerActor extends AbstractActor {
495
385
  // must still run for it, with the correct snapshot from before the send.
496
386
  const prevSnapshot = this.getSnapshot();
497
387
  // Send the event to the XState actor.
498
- // `AbstractActor` declares send() as abstract for one reason only, to narrow the
388
+ // The class declares send() to narrow the
499
389
  // event type, and TypeScript forbids a super call to an abstract member.
500
390
  // Therefore the code reaches the implementation of XState directly. `this` IS the
501
391
  // actor. This call is therefore exactly the call of `super.send(event)`: the relay
@@ -509,12 +399,6 @@ export class PlayerActor extends AbstractActor {
509
399
  onTransition(this, prevSnapshot, nextSnapshot);
510
400
  }
511
401
  }
512
- /**
513
- * Returns the current snapshot
514
- */
515
- getSnapshot() {
516
- return super.getSnapshot();
517
- }
518
402
  subscribe(nextListenerOrObserver, errorListener, completeListener) {
519
403
  // The subscribe() method of XState accepts a function and also an observer, and it
520
404
  // normalizes them internally. The cast joins the two overload signatures only.
@@ -541,16 +425,6 @@ export class PlayerActor extends AbstractActor {
541
425
  },
542
426
  };
543
427
  }
544
- /**
545
- * Listens for the events that this actor emits with the `emit` action.
546
- *
547
- * @param type - The type of the emitted event to listen for, or `"*"` for every event.
548
- * @param handler - The actor calls it with each emitted event that matches.
549
- * @returns The subscription, with an `unsubscribe()` method.
550
- */
551
- on(type, handler) {
552
- return super.on(type, handler);
553
- }
554
428
  /**
555
429
  * Returns the persisted snapshot of this actor.
556
430
  *
@@ -562,53 +436,50 @@ export class PlayerActor extends AbstractActor {
562
436
  return forward.call(this, options);
563
437
  }
564
438
  /**
565
- * Derives the view at the entry of a state, and keeps it. This happens one time for
566
- * each transition. The signal holds the view, and the code computes it not on each
567
- * read.
439
+ * The point where a capability derives its own signals from a new snapshot.
440
+ *
441
+ * The base derives nothing: `PlayActor` asks for `state` and `send`, and this class
442
+ * gives exactly those. A capability is a mixin that overrides this method, calls
443
+ * `super.onSnapshot(snapshot)` FIRST, and then writes its own signal.
444
+ *
445
+ * That one rule fixes the order, and the order is load-bearing. The view of a state
446
+ * reads the route and the state that the same transition produced, and a router bridge
447
+ * must see a guard redirect synchronously. `compose(PlayerActor, withRouting, withView)`
448
+ * therefore derives the route before the view, because `withView` wraps the class that
449
+ * `withRouting` returned.
450
+ *
451
+ * The method runs after `state` holds the new snapshot and before the `onStateChange`
452
+ * hook of the options.
568
453
  *
569
- * @param snapshot - The current XState snapshot
454
+ * @param snapshot - The stable snapshot of this transition.
570
455
  */
571
- validateAndCacheView(snapshot) {
572
- if (snapshot === this.lastViewSnapshot) {
573
- return;
574
- }
575
- this.lastViewSnapshot = snapshot;
576
- try {
577
- const view = deriveCurrentView(snapshot);
578
- // Emit only after a real change of the view on the screen: deriveCurrentView
579
- // returns a fresh object on each call, and the identity of the reference therefore
580
- // tells nothing. A new reference for a snapshot that changes the view not, for
581
- // example a context-only assign, makes a provider below mount the UI again, and
582
- // that removes the state of the view. A deep equality test is deliberately NOT
583
- // here: it sees nothing inside a Map or a Set, and it therefore stops a real
584
- // change, and it recurses without an end on a cyclic prop. The last spec of an
585
- // emission IS the current value of the signal. Read it without a track, so that
586
- // the gate registers currentView never as a dependency of a computation around
587
- // it.
588
- const lastEmittedView = Signal.subtle.untrack(() => this.currentView.get());
589
- // Use the reference of the previous composed state again when the value of the
590
- // /context projection did not change. A context-only assign that changes no
591
- // projected value therefore changes the identity of the state not.
592
- const nextView = reuseComposedState(lastEmittedView, view);
593
- if (viewSpecsEquivalent(lastEmittedView, nextView)) {
594
- return;
595
- }
596
- this.currentView.set(nextView);
597
- }
598
- catch (error) {
599
- const onError = this.hooks.onError;
600
- if (onError) {
601
- onError(this, toError(error));
602
- }
603
- // On an error: keep the last valid view, and clear it not
604
- }
456
+ onSnapshot(snapshot) {
457
+ // The base class holds no capability. A mixin overrides this method.
458
+ void snapshot;
605
459
  }
606
460
  /**
607
- * The dispose method, for the cleanup. It is the alias of {@link stop}.
461
+ * Stops the actor when the scope of a `using` declaration ends.
462
+ *
463
+ * The actor is a `Disposable`, so a scope that owns one writes no teardown:
464
+ *
465
+ * ```ts
466
+ * {
467
+ * using actor = definePlayer({ machine })();
468
+ * actor.start();
469
+ * actor.send({ type: "go" });
470
+ * // stop() runs here, and it runs even when send() throws
471
+ * }
472
+ * ```
473
+ *
474
+ * The release is {@link stop}, which is synchronous and idempotent. `Disposable` and
475
+ * not `AsyncDisposable`: a `Disposable` serves `using` AND `await using`, while an
476
+ * `AsyncDisposable` raises a TypeError under a plain `using`.
608
477
  *
609
- * @deprecated Use {@link stop}. Will be removed in the next major.
478
+ * The key is `DISPOSE` of `@xmachines/play` and not a bare `Symbol.dispose`, so that
479
+ * the method still answers a `using` that a bundler downlevelled for a target without
480
+ * the well-known symbol.
610
481
  */
611
- dispose() {
482
+ [DISPOSE]() {
612
483
  this.stop();
613
484
  }
614
485
  }
@@ -1 +1 @@
1
- {"version":3,"file":"player-actor.js","sourceRoot":"","sources":["../src/player-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,GAYL,MAAM,QAAQ,CAAC;AAChB,OAAO,EACN,aA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,MAAM,OAAO,GAAG,KAAK,CAAC,oBAAgE,CAAC;QACvF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpC,CAAC;IACD;;;;;;;;;;;;;;;;;OAiBG;IACO,UAAU,CAAC,QAA4B;QAChD,qEAAqE;QACrE,KAAK,QAAQ,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,CAAC,OAAO,CAAC;QACR,IAAI,CAAC,IAAI,EAAE,CAAC;IACb,CAAC;CACD"}
@@ -1,40 +1,5 @@
1
1
  import type { AnyMachineSnapshot } from "xstate";
2
- /**
3
- * Collects the `meta` object of the active state nodes of a SINGLE branch, from the
4
- * root to a leaf. The key of each entry is the state id, and the order is the
5
- * ancestors first. {@link deriveRoute} folds this shape.
6
- *
7
- * `snapshot.getMeta()` returns a FLAT record of the meta object of every active
8
- * state. For a machine that is not parallel, that record is one chain of ancestors
9
- * already. For a PARALLEL machine, it mixes the entries of every active region. A
10
- * blind fold therefore joins a relative route of one region to an absolute route of
11
- * a sibling region, and the URL belongs to the tree of neither region. The flat
12
- * record also cannot go back into a hierarchy: when a state declares an explicit
13
- * `id`, for example a child with `id: "dashboard-overview"` under `id: "dashboard"`,
14
- * the meta keys are those ids, and they carry no information about the ancestry.
15
- *
16
- * Therefore this function walks `snapshot.value`, which holds the real hierarchy of
17
- * the active states by the state key, against the node tree of the machine. It
18
- * follows the FIRST active child at each level. This gives one deterministic branch,
19
- * which matches the historical behavior of "the first that it finds" for a parallel
20
- * machine. It also works with an explicit id, because each node carries its own `id`
21
- * and its own `meta`.
22
- *
23
- * The function returns `null` when the snapshot exposes no machine and no value to
24
- * walk. This is a defensive measure, because a real XState snapshot always exposes
25
- * them. The caller then uses `getMeta()`, as before.
26
- */
27
- export declare const firstActiveBranchMeta: (snapshot: AnyMachineSnapshot) => Record<string, unknown> | null;
28
- /**
29
- * Resolves the meta record that the route derivation and the view derivation fold:
30
- * the single active branch that {@link firstActiveBranchMeta} walks, which is
31
- * correct for a parallel machine and for an explicit id, or the flat `getMeta()`
32
- * record when the snapshot has no machine tree to walk. `deriveCurrentRoute` and
33
- * `deriveCurrentView` share this function. Therefore the two sides cannot move apart
34
- * on the selection of the branch, and they cannot move apart on their tolerance of a
35
- * degenerate snapshot.
36
- */
37
- export declare const activeStateMeta: (snapshot: AnyMachineSnapshot) => Record<string, unknown> | null;
2
+ export { activeStateMeta, firstActiveBranchMeta } from "../state-meta.js";
38
3
  /**
39
4
  * Derives the current URL of the actor from the state metadata and the context.
40
5
  *
@@ -1 +1 @@
1
- {"version":3,"file":"derive-current-route.d.ts","sourceRoot":"","sources":["../../src/routing/derive-current-route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAOjD;;;;;;;;;;;;;;;;;;;;;;;;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;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,kBAAkB,KAAG,MAAM,GAAG,IA8B1E,CAAC"}
1
+ {"version":3,"file":"derive-current-route.d.ts","sourceRoot":"","sources":["../../src/routing/derive-current-route.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAQjD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,kBAAkB,KAAG,MAAM,GAAG,IA8B1E,CAAC"}
@@ -1,82 +1,8 @@
1
1
  import { MissingRouteParamError } from "../errors.js";
2
2
  import { deriveRoute } from "./derive-route.js";
3
3
  import { buildRouteUrl } from "./build-url.js";
4
- /**
5
- * Collects the `meta` object of the active state nodes of a SINGLE branch, from the
6
- * root to a leaf. The key of each entry is the state id, and the order is the
7
- * ancestors first. {@link deriveRoute} folds this shape.
8
- *
9
- * `snapshot.getMeta()` returns a FLAT record of the meta object of every active
10
- * state. For a machine that is not parallel, that record is one chain of ancestors
11
- * already. For a PARALLEL machine, it mixes the entries of every active region. A
12
- * blind fold therefore joins a relative route of one region to an absolute route of
13
- * a sibling region, and the URL belongs to the tree of neither region. The flat
14
- * record also cannot go back into a hierarchy: when a state declares an explicit
15
- * `id`, for example a child with `id: "dashboard-overview"` under `id: "dashboard"`,
16
- * the meta keys are those ids, and they carry no information about the ancestry.
17
- *
18
- * Therefore this function walks `snapshot.value`, which holds the real hierarchy of
19
- * the active states by the state key, against the node tree of the machine. It
20
- * follows the FIRST active child at each level. This gives one deterministic branch,
21
- * which matches the historical behavior of "the first that it finds" for a parallel
22
- * machine. It also works with an explicit id, because each node carries its own `id`
23
- * and its own `meta`.
24
- *
25
- * The function returns `null` when the snapshot exposes no machine and no value to
26
- * walk. This is a defensive measure, because a real XState snapshot always exposes
27
- * them. The caller then uses `getMeta()`, as before.
28
- */
29
- export const firstActiveBranchMeta = (snapshot) => {
30
- const root = snapshot.machine?.root;
31
- if (!root)
32
- return null;
33
- const ordered = {};
34
- let node = root;
35
- let value = snapshot.value;
36
- while (node) {
37
- if (node.meta && typeof node.meta === "object") {
38
- ordered[node.id] = node.meta; // nosemgrep: gitlab.eslint.detect-object-injection
39
- }
40
- // Find the key of the active child at this level. A string value is the name of an
41
- // atomic active leaf. An object value is a compound node, with one key, or a
42
- // parallel node, with many keys: take the first key, for one deterministic
43
- // branch.
44
- let key;
45
- if (typeof value === "string") {
46
- key = value;
47
- }
48
- else if (value && typeof value === "object") {
49
- key = Object.keys(value)[0];
50
- }
51
- if (key === undefined)
52
- break;
53
- const child = node.states?.[key]; // nosemgrep: gitlab.eslint.detect-object-injection
54
- if (!child)
55
- break;
56
- value =
57
- typeof value === "object" && value !== null
58
- ? value[key] // nosemgrep: gitlab.eslint.detect-object-injection
59
- : {};
60
- node = child;
61
- }
62
- return ordered;
63
- };
64
- /**
65
- * Resolves the meta record that the route derivation and the view derivation fold:
66
- * the single active branch that {@link firstActiveBranchMeta} walks, which is
67
- * correct for a parallel machine and for an explicit id, or the flat `getMeta()`
68
- * record when the snapshot has no machine tree to walk. `deriveCurrentRoute` and
69
- * `deriveCurrentView` share this function. Therefore the two sides cannot move apart
70
- * on the selection of the branch, and they cannot move apart on their tolerance of a
71
- * degenerate snapshot.
72
- */
73
- export const activeStateMeta = (snapshot) => {
74
- if (!snapshot || typeof snapshot.getMeta !== "function") {
75
- return null;
76
- }
77
- const meta = firstActiveBranchMeta(snapshot) ?? snapshot.getMeta();
78
- return meta && typeof meta === "object" ? meta : null;
79
- };
4
+ import { activeStateMeta } from "../state-meta.js";
5
+ export { activeStateMeta, firstActiveBranchMeta } from "../state-meta.js";
80
6
  /**
81
7
  * Derives the current URL of the actor from the state metadata and the context.
82
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"derive-current-route.js","sourceRoot":"","sources":["../../src/routing/derive-current-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI,CAAC;IAEvB,MAAM,OAAO,GAA4B,EAAE,CAAC;IAC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ACD,MAAM,IAAI,GAAG,qBAAqB,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;IACnE,OAAO,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAE,IAAgC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpF,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAA4B,EAAiB,EAAE;IACjF,MAAM,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,aAAa,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAI,CAAC;QACJ,OAAO,aAAa,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAiB,CAAC,CAAC;IAC/E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,gFAAgF;QAChF,oFAAoF;QACpF,gFAAgF;QAChF,iFAAiF;QACjF,yBAAyB;QACzB,0FAA0F;QAC1F,uFAAuF;QACvF,iFAAiF;QACjF,0EAA0E;QAC1E,oCAAoC;QACpC,IAAI,KAAK,YAAY,sBAAsB,EAAE,CAAC;YAC7C,OAAO,IAAI,CAAC;QACb,CAAC;QACD,6DAA6D;QAC7D,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC,CAAC"}
1
+ {"version":3,"file":"derive-current-route.js","sourceRoot":"","sources":["../../src/routing/derive-current-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,C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
+ {"version":3,"file":"derive-initial-route.d.ts","sourceRoot":"","sources":["../../src/routing/derive-initial-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,eAAe,EAAE,MAAM,QAAQ,CAAC;AAI1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,eAAe,EAAE,QAAQ,OAAO,KAAG,MAAM,GAAG,IAwBvF,CAAC"}