xstate 5.31.0 → 5.32.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 (104) hide show
  1. package/actions/package.json +3 -3
  2. package/actors/package.json +3 -3
  3. package/dev/package.json +3 -3
  4. package/dist/{StateMachine-b9937861.esm.js → StateMachine-45e79c35.esm.js} +2 -2
  5. package/dist/{StateMachine-a2514a01.development.cjs.js → StateMachine-be2e51a3.development.cjs.js} +39 -39
  6. package/dist/{StateMachine-880c1b22.development.esm.js → StateMachine-e0178d48.development.esm.js} +2 -2
  7. package/dist/{StateMachine-37420c93.cjs.js → StateMachine-e6732977.cjs.js} +39 -39
  8. package/dist/{assign-c15c199c.esm.js → assign-2aa58daa.esm.js} +1 -1
  9. package/dist/{assign-6da0bff4.development.cjs.js → assign-927227d6.development.cjs.js} +7 -7
  10. package/dist/{assign-53a98e5d.cjs.js → assign-e8f2bd75.cjs.js} +6 -6
  11. package/dist/{assign-4f7ce317.development.esm.js → assign-f338cee3.development.esm.js} +1 -1
  12. package/dist/declarations/src/index.d.ts +1 -1
  13. package/dist/declarations/src/inspection.d.ts +6 -1
  14. package/dist/{log-8ca142b5.development.cjs.js → log-029f180b.development.cjs.js} +10 -10
  15. package/dist/{log-3e4dba89.development.esm.js → log-5a37e0ee.development.esm.js} +2 -2
  16. package/dist/{log-ce7cb9aa.esm.js → log-605ef461.esm.js} +2 -2
  17. package/dist/{log-279b177f.cjs.js → log-fedf0966.cjs.js} +8 -8
  18. package/dist/{raise-b724c245.development.esm.js → raise-74097812.development.esm.js} +5 -14
  19. package/dist/{raise-69f5aed0.cjs.js → raise-7c948725.cjs.js} +6 -15
  20. package/dist/{raise-6e65c93f.development.cjs.js → raise-964cd4e9.development.cjs.js} +6 -15
  21. package/dist/{raise-56f87e05.esm.js → raise-e974d1c9.esm.js} +5 -14
  22. package/dist/xstate-actions.cjs.d.mts +2 -0
  23. package/dist/xstate-actions.cjs.d.ts +2 -0
  24. package/dist/xstate-actions.cjs.js +23 -0
  25. package/dist/xstate-actions.development.cjs.js +23 -0
  26. package/dist/xstate-actions.development.esm.js +4 -0
  27. package/dist/xstate-actions.esm.js +4 -0
  28. package/dist/xstate-actions.umd.min.js.map +1 -0
  29. package/dist/xstate-actors.cjs.d.mts +2 -0
  30. package/dist/xstate-actors.cjs.d.ts +2 -0
  31. package/{actors/dist → dist}/xstate-actors.cjs.js +7 -7
  32. package/{actors/dist → dist}/xstate-actors.development.cjs.js +7 -7
  33. package/{actors/dist → dist}/xstate-actors.development.esm.js +2 -2
  34. package/{actors/dist → dist}/xstate-actors.esm.js +2 -2
  35. package/dist/xstate-actors.umd.min.js.map +1 -0
  36. package/dist/xstate-dev.cjs.d.mts +2 -0
  37. package/dist/xstate-dev.cjs.d.ts +2 -0
  38. package/dist/xstate-dev.umd.min.js.map +1 -0
  39. package/dist/xstate-graph.cjs.d.mts +2 -0
  40. package/dist/xstate-graph.cjs.d.ts +2 -0
  41. package/{graph/dist/xstate-graph.development.cjs.js → dist/xstate-graph.cjs.js} +9 -9
  42. package/{graph/dist/xstate-graph.cjs.js → dist/xstate-graph.development.cjs.js} +9 -9
  43. package/{graph/dist → dist}/xstate-graph.development.esm.js +5 -5
  44. package/{graph/dist → dist}/xstate-graph.esm.js +5 -5
  45. package/dist/xstate-graph.umd.min.js +2 -0
  46. package/dist/xstate-graph.umd.min.js.map +1 -0
  47. package/dist/xstate-guards.cjs.d.mts +2 -0
  48. package/dist/xstate-guards.cjs.d.ts +2 -0
  49. package/dist/xstate-guards.cjs.js +14 -0
  50. package/dist/xstate-guards.development.cjs.js +14 -0
  51. package/dist/xstate-guards.development.esm.js +2 -0
  52. package/dist/xstate-guards.esm.js +2 -0
  53. package/dist/xstate-guards.umd.min.js.map +1 -0
  54. package/dist/xstate.cjs.js +44 -44
  55. package/dist/xstate.development.cjs.js +44 -44
  56. package/dist/xstate.development.esm.js +10 -10
  57. package/dist/xstate.esm.js +10 -10
  58. package/dist/xstate.umd.min.js +1 -1
  59. package/dist/xstate.umd.min.js.map +1 -1
  60. package/graph/package.json +3 -3
  61. package/guards/package.json +3 -3
  62. package/package.json +41 -41
  63. package/actions/dist/xstate-actions.cjs.d.mts +0 -2
  64. package/actions/dist/xstate-actions.cjs.d.ts +0 -2
  65. package/actions/dist/xstate-actions.cjs.js +0 -23
  66. package/actions/dist/xstate-actions.development.cjs.js +0 -23
  67. package/actions/dist/xstate-actions.development.esm.js +0 -4
  68. package/actions/dist/xstate-actions.esm.js +0 -4
  69. package/actions/dist/xstate-actions.umd.min.js.map +0 -1
  70. package/actors/dist/xstate-actors.cjs.d.mts +0 -2
  71. package/actors/dist/xstate-actors.cjs.d.ts +0 -2
  72. package/actors/dist/xstate-actors.umd.min.js.map +0 -1
  73. package/dev/dist/xstate-dev.cjs.d.mts +0 -2
  74. package/dev/dist/xstate-dev.cjs.d.ts +0 -2
  75. package/dev/dist/xstate-dev.umd.min.js.map +0 -1
  76. package/graph/dist/xstate-graph.cjs.d.mts +0 -2
  77. package/graph/dist/xstate-graph.cjs.d.ts +0 -2
  78. package/graph/dist/xstate-graph.umd.min.js +0 -2
  79. package/graph/dist/xstate-graph.umd.min.js.map +0 -1
  80. package/guards/dist/xstate-guards.cjs.d.mts +0 -2
  81. package/guards/dist/xstate-guards.cjs.d.ts +0 -2
  82. package/guards/dist/xstate-guards.cjs.js +0 -14
  83. package/guards/dist/xstate-guards.development.cjs.js +0 -14
  84. package/guards/dist/xstate-guards.development.esm.js +0 -2
  85. package/guards/dist/xstate-guards.esm.js +0 -2
  86. package/guards/dist/xstate-guards.umd.min.js.map +0 -1
  87. /package/{actions/dist → dist}/xstate-actions.cjs.mjs +0 -0
  88. /package/{actions/dist → dist}/xstate-actions.development.cjs.mjs +0 -0
  89. /package/{actions/dist → dist}/xstate-actions.umd.min.js +0 -0
  90. /package/{actors/dist → dist}/xstate-actors.cjs.mjs +0 -0
  91. /package/{actors/dist → dist}/xstate-actors.development.cjs.mjs +0 -0
  92. /package/{actors/dist → dist}/xstate-actors.umd.min.js +0 -0
  93. /package/{dev/dist → dist}/xstate-dev.cjs.js +0 -0
  94. /package/{dev/dist → dist}/xstate-dev.cjs.mjs +0 -0
  95. /package/{dev/dist → dist}/xstate-dev.development.cjs.js +0 -0
  96. /package/{dev/dist → dist}/xstate-dev.development.cjs.mjs +0 -0
  97. /package/{dev/dist → dist}/xstate-dev.development.esm.js +0 -0
  98. /package/{dev/dist → dist}/xstate-dev.esm.js +0 -0
  99. /package/{dev/dist → dist}/xstate-dev.umd.min.js +0 -0
  100. /package/{graph/dist → dist}/xstate-graph.cjs.mjs +0 -0
  101. /package/{graph/dist → dist}/xstate-graph.development.cjs.mjs +0 -0
  102. /package/{guards/dist → dist}/xstate-guards.cjs.mjs +0 -0
  103. /package/{guards/dist → dist}/xstate-guards.development.cjs.mjs +0 -0
  104. /package/{guards/dist → dist}/xstate-guards.umd.min.js +0 -0
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-69f5aed0.cjs.js');
3
+ var dist_xstateGuards = require('./raise-7c948725.cjs.js');
4
4
 
5
5
  function createSpawner(actorScope, {
6
6
  machine,
@@ -8,11 +8,11 @@ function createSpawner(actorScope, {
8
8
  }, event, spawnedChildren) {
9
9
  const spawn = (src, options) => {
10
10
  if (typeof src === 'string') {
11
- const logic = guards_dist_xstateGuards.resolveReferencedActor(machine, src);
11
+ const logic = dist_xstateGuards.resolveReferencedActor(machine, src);
12
12
  if (!logic) {
13
13
  throw new Error(`Actor logic '${src}' not implemented in machine '${machine.id}'`);
14
14
  }
15
- const actorRef = guards_dist_xstateGuards.createActor(logic, {
15
+ const actorRef = dist_xstateGuards.createActor(logic, {
16
16
  id: options?.id,
17
17
  parent: actorScope.self,
18
18
  syncSnapshot: options?.syncSnapshot,
@@ -27,7 +27,7 @@ function createSpawner(actorScope, {
27
27
  spawnedChildren[actorRef.id] = actorRef;
28
28
  return actorRef;
29
29
  } else {
30
- const actorRef = guards_dist_xstateGuards.createActor(src, {
30
+ const actorRef = dist_xstateGuards.createActor(src, {
31
31
  id: options?.id,
32
32
  parent: actorScope.self,
33
33
  syncSnapshot: options?.syncSnapshot,
@@ -42,7 +42,7 @@ function createSpawner(actorScope, {
42
42
  const actorRef = spawn(src, options); // TODO: fix types
43
43
  spawnedChildren[actorRef.id] = actorRef;
44
44
  actorScope.defer(() => {
45
- if (actorRef._processingStatus === guards_dist_xstateGuards.ProcessingStatus.Stopped) {
45
+ if (actorRef._processingStatus === dist_xstateGuards.ProcessingStatus.Stopped) {
46
46
  return;
47
47
  }
48
48
  actorRef.start();
@@ -75,7 +75,7 @@ function resolveAssign(actorScope, snapshot, actionArgs, actionParams, {
75
75
  }
76
76
  }
77
77
  const updatedContext = Object.assign({}, snapshot.context, partialUpdate);
78
- return [guards_dist_xstateGuards.cloneMachineSnapshot(snapshot, {
78
+ return [dist_xstateGuards.cloneMachineSnapshot(snapshot, {
79
79
  context: updatedContext,
80
80
  children: Object.keys(spawnedChildren).length ? {
81
81
  ...snapshot.children,
@@ -1,4 +1,4 @@
1
- import { _ as ProcessingStatus, V as resolveReferencedActor, c as createActor, a0 as cloneMachineSnapshot, W as executingCustomAction } from './raise-b724c245.development.esm.js';
1
+ import { _ as ProcessingStatus, V as resolveReferencedActor, c as createActor, a0 as cloneMachineSnapshot, W as executingCustomAction } from './raise-74097812.development.esm.js';
2
2
 
3
3
  function createSpawner(actorScope, {
4
4
  machine,
@@ -7,7 +7,7 @@ export { mapState } from "./mapState.js";
7
7
  export { getInitialSnapshot, getNextSnapshot } from "./getNextSnapshot.js";
8
8
  export { and, not, or, stateIn } from "./guards.js";
9
9
  export type { GuardPredicate, GuardArgs } from "./guards.js";
10
- export type { InspectedActionEvent, InspectedActorEvent, InspectedEventEvent, InspectedMicrostepEvent, InspectedSnapshotEvent, InspectionEvent } from "./inspection.js";
10
+ export type { InspectedActionEvent, InspectedActorEvent, InspectedEventEvent, InspectedMicrostepEvent, InspectedSnapshotEvent, InspectedTransitionEvent, InspectionEvent } from "./inspection.js";
11
11
  export { setup, type SetupReturn } from "./setup.js";
12
12
  export { SimulatedClock } from "./SimulatedClock.js";
13
13
  export { type Spawner } from "./spawn.js";
@@ -1,5 +1,5 @@
1
1
  import { ActorRefLike, AnyEventObject, AnyTransitionDefinition, Snapshot } from "./types.js";
2
- export type InspectionEvent = InspectedSnapshotEvent | InspectedEventEvent | InspectedActorEvent | InspectedMicrostepEvent | InspectedActionEvent;
2
+ export type InspectionEvent = InspectedSnapshotEvent | InspectedEventEvent | InspectedActorEvent | InspectedTransitionEvent | InspectedMicrostepEvent | InspectedActionEvent;
3
3
  interface BaseInspectionEventProperties {
4
4
  rootId: string;
5
5
  /**
@@ -16,6 +16,11 @@ export interface InspectedSnapshotEvent extends BaseInspectionEventProperties {
16
16
  event: AnyEventObject;
17
17
  snapshot: Snapshot<unknown>;
18
18
  }
19
+ export interface InspectedTransitionEvent extends BaseInspectionEventProperties {
20
+ type: '@xstate.transition';
21
+ event: AnyEventObject;
22
+ snapshot: Snapshot<unknown>;
23
+ }
19
24
  export interface InspectedMicrostepEvent extends BaseInspectionEventProperties {
20
25
  type: '@xstate.microstep';
21
26
  event: AnyEventObject;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-6e65c93f.development.cjs.js');
4
- var assign = require('./assign-6da0bff4.development.cjs.js');
3
+ var dist_xstateGuards = require('./raise-964cd4e9.development.cjs.js');
4
+ var assign = require('./assign-927227d6.development.cjs.js');
5
5
 
6
6
  function resolveEmit(_, snapshot, args, actionParams, {
7
7
  event: eventOrExpr
@@ -54,7 +54,7 @@ function executeEmit(actorScope, {
54
54
  */
55
55
  function emit(/** The event to emit, or an expression that returns an event to emit. */
56
56
  eventOrExpr) {
57
- if (guards_dist_xstateGuards.executingCustomAction) {
57
+ if (dist_xstateGuards.executingCustomAction) {
58
58
  console.warn('Custom actions should not call `emit()` directly, as it is not imperative. See https://stately.ai/docs/actions#built-in-actions for more details.');
59
59
  }
60
60
  function emit(_args, _params) {
@@ -230,7 +230,7 @@ function executeSendTo(actorScope, params) {
230
230
  actorScope.system._relay(actorScope.self,
231
231
  // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
232
232
  // if it initially started as a string
233
- to, event.type === guards_dist_xstateGuards.XSTATE_ERROR ? guards_dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event);
233
+ to, event.type === dist_xstateGuards.XSTATE_ERROR ? dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event);
234
234
  });
235
235
  }
236
236
  /**
@@ -245,7 +245,7 @@ function executeSendTo(actorScope, params) {
245
245
  * - `delay` - The number of milliseconds to delay the sending of the event.
246
246
  */
247
247
  function sendTo(to, eventOrExpr, options) {
248
- if (guards_dist_xstateGuards.executingCustomAction) {
248
+ if (dist_xstateGuards.executingCustomAction) {
249
249
  console.warn('Custom actions should not call `sendTo()` directly, as it is not imperative. See https://stately.ai/docs/actions#built-in-actions for more details.');
250
250
  }
251
251
  function sendTo(_args, _params) {
@@ -306,12 +306,12 @@ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
306
306
  actions.push(assign.assign(...args));
307
307
  };
308
308
  enqueue.cancel = (...args) => {
309
- actions.push(guards_dist_xstateGuards.cancel(...args));
309
+ actions.push(dist_xstateGuards.cancel(...args));
310
310
  };
311
311
  enqueue.raise = (...args) => {
312
312
  // for some reason it fails to infer `TDelay` from `...args` here and picks its default (`never`)
313
313
  // then it fails to typecheck that because `...args` use `string` in place of `TDelay`
314
- actions.push(guards_dist_xstateGuards.raise(...args));
314
+ actions.push(dist_xstateGuards.raise(...args));
315
315
  };
316
316
  enqueue.sendTo = (...args) => {
317
317
  // for some reason it fails to infer `TDelay` from `...args` here and picks its default (`never`)
@@ -322,10 +322,10 @@ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
322
322
  actions.push(sendParent(...args));
323
323
  };
324
324
  enqueue.spawnChild = (...args) => {
325
- actions.push(guards_dist_xstateGuards.spawnChild(...args));
325
+ actions.push(dist_xstateGuards.spawnChild(...args));
326
326
  };
327
327
  enqueue.stopChild = (...args) => {
328
- actions.push(guards_dist_xstateGuards.stopChild(...args));
328
+ actions.push(dist_xstateGuards.stopChild(...args));
329
329
  };
330
330
  enqueue.emit = (...args) => {
331
331
  actions.push(emit(...args));
@@ -334,7 +334,7 @@ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
334
334
  context: args.context,
335
335
  event: args.event,
336
336
  enqueue,
337
- check: guard => guards_dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
337
+ check: guard => dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
338
338
  self: actorScope.self,
339
339
  system: actorScope.system
340
340
  }, actionParams);
@@ -1,5 +1,5 @@
1
- import { W as executingCustomAction, Y as XSTATE_ERROR, Z as createErrorActorEvent, D as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-b724c245.development.esm.js';
2
- import { a as assign } from './assign-4f7ce317.development.esm.js';
1
+ import { W as executingCustomAction, Y as XSTATE_ERROR, Z as createErrorActorEvent, D as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-74097812.development.esm.js';
2
+ import { a as assign } from './assign-f338cee3.development.esm.js';
3
3
 
4
4
  function resolveEmit(_, snapshot, args, actionParams, {
5
5
  event: eventOrExpr
@@ -1,5 +1,5 @@
1
- import { W as XSTATE_ERROR, Y as createErrorActorEvent, D as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-56f87e05.esm.js';
2
- import { a as assign } from './assign-c15c199c.esm.js';
1
+ import { W as XSTATE_ERROR, Y as createErrorActorEvent, D as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-e974d1c9.esm.js';
2
+ import { a as assign } from './assign-2aa58daa.esm.js';
3
3
 
4
4
  function resolveEmit(_, snapshot, args, actionParams, {
5
5
  event: eventOrExpr
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-69f5aed0.cjs.js');
4
- var assign = require('./assign-53a98e5d.cjs.js');
3
+ var dist_xstateGuards = require('./raise-7c948725.cjs.js');
4
+ var assign = require('./assign-e8f2bd75.cjs.js');
5
5
 
6
6
  function resolveEmit(_, snapshot, args, actionParams, {
7
7
  event: eventOrExpr
@@ -224,7 +224,7 @@ function executeSendTo(actorScope, params) {
224
224
  actorScope.system._relay(actorScope.self,
225
225
  // at this point, in a deferred task, it should already be mutated by retryResolveSendTo
226
226
  // if it initially started as a string
227
- to, event.type === guards_dist_xstateGuards.XSTATE_ERROR ? guards_dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event);
227
+ to, event.type === dist_xstateGuards.XSTATE_ERROR ? dist_xstateGuards.createErrorActorEvent(actorScope.self.id, event.data) : event);
228
228
  });
229
229
  }
230
230
  /**
@@ -284,12 +284,12 @@ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
284
284
  actions.push(assign.assign(...args));
285
285
  };
286
286
  enqueue.cancel = (...args) => {
287
- actions.push(guards_dist_xstateGuards.cancel(...args));
287
+ actions.push(dist_xstateGuards.cancel(...args));
288
288
  };
289
289
  enqueue.raise = (...args) => {
290
290
  // for some reason it fails to infer `TDelay` from `...args` here and picks its default (`never`)
291
291
  // then it fails to typecheck that because `...args` use `string` in place of `TDelay`
292
- actions.push(guards_dist_xstateGuards.raise(...args));
292
+ actions.push(dist_xstateGuards.raise(...args));
293
293
  };
294
294
  enqueue.sendTo = (...args) => {
295
295
  // for some reason it fails to infer `TDelay` from `...args` here and picks its default (`never`)
@@ -300,10 +300,10 @@ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
300
300
  actions.push(sendParent(...args));
301
301
  };
302
302
  enqueue.spawnChild = (...args) => {
303
- actions.push(guards_dist_xstateGuards.spawnChild(...args));
303
+ actions.push(dist_xstateGuards.spawnChild(...args));
304
304
  };
305
305
  enqueue.stopChild = (...args) => {
306
- actions.push(guards_dist_xstateGuards.stopChild(...args));
306
+ actions.push(dist_xstateGuards.stopChild(...args));
307
307
  };
308
308
  enqueue.emit = (...args) => {
309
309
  actions.push(emit(...args));
@@ -312,7 +312,7 @@ function resolveEnqueueActions(actorScope, snapshot, args, actionParams, {
312
312
  context: args.context,
313
313
  event: args.event,
314
314
  enqueue,
315
- check: guard => guards_dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
315
+ check: guard => dist_xstateGuards.evaluateGuard(guard, snapshot.context, args.event, snapshot),
316
316
  self: actorScope.self,
317
317
  system: actorScope.system
318
318
  }, actionParams);
@@ -1,4 +1,4 @@
1
- import { devToolsAdapter } from '../dev/dist/xstate-dev.development.esm.js';
1
+ import { devToolsAdapter } from './xstate-dev.development.esm.js';
2
2
 
3
3
  class Mailbox {
4
4
  constructor(_process) {
@@ -1818,21 +1818,12 @@ function formatRouteTransitions(rootStateNode) {
1818
1818
  if (sn.config.route && sn.config.id) {
1819
1819
  const routeId = sn.config.id;
1820
1820
  const userGuard = sn.config.route.guard;
1821
- const routeGuard = (args, params) => {
1822
- if (args.event.to !== `#${routeId}`) {
1823
- return false;
1824
- }
1825
- if (!userGuard) {
1826
- return true;
1827
- }
1828
- if (typeof userGuard === 'function') {
1829
- return userGuard(args, params);
1830
- }
1831
- return true;
1832
- };
1821
+ const routeMatches = ({
1822
+ event
1823
+ }) => event.to === `#${routeId}`;
1833
1824
  const transition = {
1834
1825
  ...sn.config.route,
1835
- guard: routeGuard,
1826
+ guard: userGuard ? and([routeMatches, userGuard]) : routeMatches,
1836
1827
  target: `#${routeId}`
1837
1828
  };
1838
1829
  routeTransitions.push(formatTransition(rootStateNode, 'xstate.route', transition));
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var dev_dist_xstateDev = require('../dev/dist/xstate-dev.cjs.js');
3
+ var dist_xstateDev = require('./xstate-dev.cjs.js');
4
4
 
5
5
  class Mailbox {
6
6
  constructor(_process) {
@@ -1058,7 +1058,7 @@ class Actor {
1058
1058
  devTools
1059
1059
  } = this.options;
1060
1060
  if (devTools) {
1061
- const resolvedDevToolsAdapter = typeof devTools === 'function' ? devTools : dev_dist_xstateDev.devToolsAdapter;
1061
+ const resolvedDevToolsAdapter = typeof devTools === 'function' ? devTools : dist_xstateDev.devToolsAdapter;
1062
1062
  resolvedDevToolsAdapter(this);
1063
1063
  }
1064
1064
  }
@@ -1773,21 +1773,12 @@ function formatRouteTransitions(rootStateNode) {
1773
1773
  if (sn.config.route && sn.config.id) {
1774
1774
  const routeId = sn.config.id;
1775
1775
  const userGuard = sn.config.route.guard;
1776
- const routeGuard = (args, params) => {
1777
- if (args.event.to !== `#${routeId}`) {
1778
- return false;
1779
- }
1780
- if (!userGuard) {
1781
- return true;
1782
- }
1783
- if (typeof userGuard === 'function') {
1784
- return userGuard(args, params);
1785
- }
1786
- return true;
1787
- };
1776
+ const routeMatches = ({
1777
+ event
1778
+ }) => event.to === `#${routeId}`;
1788
1779
  const transition = {
1789
1780
  ...sn.config.route,
1790
- guard: routeGuard,
1781
+ guard: userGuard ? and([routeMatches, userGuard]) : routeMatches,
1791
1782
  target: `#${routeId}`
1792
1783
  };
1793
1784
  routeTransitions.push(formatTransition(rootStateNode, 'xstate.route', transition));
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var dev_dist_xstateDev = require('../dev/dist/xstate-dev.development.cjs.js');
3
+ var dist_xstateDev = require('./xstate-dev.development.cjs.js');
4
4
 
5
5
  class Mailbox {
6
6
  constructor(_process) {
@@ -1075,7 +1075,7 @@ class Actor {
1075
1075
  devTools
1076
1076
  } = this.options;
1077
1077
  if (devTools) {
1078
- const resolvedDevToolsAdapter = typeof devTools === 'function' ? devTools : dev_dist_xstateDev.devToolsAdapter;
1078
+ const resolvedDevToolsAdapter = typeof devTools === 'function' ? devTools : dist_xstateDev.devToolsAdapter;
1079
1079
  resolvedDevToolsAdapter(this);
1080
1080
  }
1081
1081
  }
@@ -1820,21 +1820,12 @@ function formatRouteTransitions(rootStateNode) {
1820
1820
  if (sn.config.route && sn.config.id) {
1821
1821
  const routeId = sn.config.id;
1822
1822
  const userGuard = sn.config.route.guard;
1823
- const routeGuard = (args, params) => {
1824
- if (args.event.to !== `#${routeId}`) {
1825
- return false;
1826
- }
1827
- if (!userGuard) {
1828
- return true;
1829
- }
1830
- if (typeof userGuard === 'function') {
1831
- return userGuard(args, params);
1832
- }
1833
- return true;
1834
- };
1823
+ const routeMatches = ({
1824
+ event
1825
+ }) => event.to === `#${routeId}`;
1835
1826
  const transition = {
1836
1827
  ...sn.config.route,
1837
- guard: routeGuard,
1828
+ guard: userGuard ? and([routeMatches, userGuard]) : routeMatches,
1838
1829
  target: `#${routeId}`
1839
1830
  };
1840
1831
  routeTransitions.push(formatTransition(rootStateNode, 'xstate.route', transition));
@@ -1,4 +1,4 @@
1
- import { devToolsAdapter } from '../dev/dist/xstate-dev.esm.js';
1
+ import { devToolsAdapter } from './xstate-dev.esm.js';
2
2
 
3
3
  class Mailbox {
4
4
  constructor(_process) {
@@ -1771,21 +1771,12 @@ function formatRouteTransitions(rootStateNode) {
1771
1771
  if (sn.config.route && sn.config.id) {
1772
1772
  const routeId = sn.config.id;
1773
1773
  const userGuard = sn.config.route.guard;
1774
- const routeGuard = (args, params) => {
1775
- if (args.event.to !== `#${routeId}`) {
1776
- return false;
1777
- }
1778
- if (!userGuard) {
1779
- return true;
1780
- }
1781
- if (typeof userGuard === 'function') {
1782
- return userGuard(args, params);
1783
- }
1784
- return true;
1785
- };
1774
+ const routeMatches = ({
1775
+ event
1776
+ }) => event.to === `#${routeId}`;
1786
1777
  const transition = {
1787
1778
  ...sn.config.route,
1788
- guard: routeGuard,
1779
+ guard: userGuard ? and([routeMatches, userGuard]) : routeMatches,
1789
1780
  target: `#${routeId}`
1790
1781
  };
1791
1782
  routeTransitions.push(formatTransition(rootStateNode, 'xstate.route', transition));
@@ -0,0 +1,2 @@
1
+ export * from "./declarations/src/actions.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieHN0YXRlLWFjdGlvbnMuY2pzLmQubXRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2FjdGlvbnMuZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
@@ -0,0 +1,2 @@
1
+ export * from "./declarations/src/actions.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieHN0YXRlLWFjdGlvbnMuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvYWN0aW9ucy5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var assign = require('./assign-e8f2bd75.cjs.js');
6
+ var dist_xstateGuards = require('./raise-7c948725.cjs.js');
7
+ var log = require('./log-fedf0966.cjs.js');
8
+ require('./xstate-dev.cjs.js');
9
+
10
+
11
+
12
+ exports.assign = assign.assign;
13
+ exports.cancel = dist_xstateGuards.cancel;
14
+ exports.raise = dist_xstateGuards.raise;
15
+ exports.spawnChild = dist_xstateGuards.spawnChild;
16
+ exports.stop = dist_xstateGuards.stop;
17
+ exports.stopChild = dist_xstateGuards.stopChild;
18
+ exports.emit = log.emit;
19
+ exports.enqueueActions = log.enqueueActions;
20
+ exports.forwardTo = log.forwardTo;
21
+ exports.log = log.log;
22
+ exports.sendParent = log.sendParent;
23
+ exports.sendTo = log.sendTo;
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var assign = require('./assign-927227d6.development.cjs.js');
6
+ var dist_xstateGuards = require('./raise-964cd4e9.development.cjs.js');
7
+ var log = require('./log-029f180b.development.cjs.js');
8
+ require('./xstate-dev.development.cjs.js');
9
+
10
+
11
+
12
+ exports.assign = assign.assign;
13
+ exports.cancel = dist_xstateGuards.cancel;
14
+ exports.raise = dist_xstateGuards.raise;
15
+ exports.spawnChild = dist_xstateGuards.spawnChild;
16
+ exports.stop = dist_xstateGuards.stop;
17
+ exports.stopChild = dist_xstateGuards.stopChild;
18
+ exports.emit = log.emit;
19
+ exports.enqueueActions = log.enqueueActions;
20
+ exports.forwardTo = log.forwardTo;
21
+ exports.log = log.log;
22
+ exports.sendParent = log.sendParent;
23
+ exports.sendTo = log.sendTo;
@@ -0,0 +1,4 @@
1
+ export { a as assign } from './assign-f338cee3.development.esm.js';
2
+ export { a as cancel, r as raise, b as spawnChild, x as stop, s as stopChild } from './raise-74097812.development.esm.js';
3
+ export { a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-5a37e0ee.development.esm.js';
4
+ import './xstate-dev.development.esm.js';
@@ -0,0 +1,4 @@
1
+ export { a as assign } from './assign-2aa58daa.esm.js';
2
+ export { a as cancel, r as raise, b as spawnChild, x as stop, s as stopChild } from './raise-e974d1c9.esm.js';
3
+ export { a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-605ef461.esm.js';
4
+ import './xstate-dev.esm.js';