xstate 5.0.0-beta.49 → 5.0.0-beta.51
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/actions/dist/xstate-actions.cjs.js +11 -10
- package/actions/dist/xstate-actions.cjs.mjs +1 -0
- package/actions/dist/xstate-actions.development.cjs.js +11 -10
- package/actions/dist/xstate-actions.development.cjs.mjs +1 -0
- package/actions/dist/xstate-actions.development.esm.js +2 -2
- package/actions/dist/xstate-actions.esm.js +2 -2
- package/actions/dist/xstate-actions.umd.min.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actors/dist/xstate-actors.cjs.js +2 -4
- package/actors/dist/xstate-actors.development.cjs.js +2 -4
- package/actors/dist/xstate-actors.development.esm.js +2 -4
- package/actors/dist/xstate-actors.esm.js +2 -4
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/declarations/src/actions/enqueueActions.d.ts +32 -0
- package/dist/declarations/src/actions/pure.d.ts +7 -10
- package/dist/declarations/src/actions.d.ts +3 -2
- package/dist/declarations/src/actors/callback.d.ts +5 -5
- package/dist/declarations/src/actors/observable.d.ts +5 -5
- package/dist/declarations/src/actors/promise.d.ts +2 -2
- package/dist/declarations/src/actors/transition.d.ts +3 -3
- package/dist/declarations/src/interpreter.d.ts +1 -0
- package/dist/declarations/src/setup.d.ts +2 -2
- package/dist/declarations/src/types.d.ts +5 -3
- package/dist/declarations/src/utils.d.ts +1 -20
- package/dist/{send-0a381ca2.development.esm.js → pure-296f8ebd.development.esm.js} +114 -77
- package/dist/{send-8d30b415.development.cjs.js → pure-a0f16134.development.cjs.js} +114 -76
- package/dist/{send-22880315.esm.js → pure-aefddc19.esm.js} +108 -71
- package/dist/{send-8ed5c8b2.cjs.js → pure-c5f1b46c.cjs.js} +108 -70
- package/dist/{raise-e4cc6d4f.esm.js → raise-4742bf04.esm.js} +98 -38
- package/dist/{raise-495f4b9f.development.cjs.js → raise-528386de.development.cjs.js} +97 -38
- package/dist/{raise-1873c645.development.esm.js → raise-acaa3884.development.esm.js} +98 -38
- package/dist/{raise-8f9c4a5a.cjs.js → raise-d5633a02.cjs.js} +97 -38
- package/dist/xstate.cjs.js +14 -23
- package/dist/xstate.cjs.mjs +1 -0
- package/dist/xstate.development.cjs.js +14 -23
- package/dist/xstate.development.cjs.mjs +1 -0
- package/dist/xstate.development.esm.js +5 -15
- package/dist/xstate.esm.js +5 -15
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.esm.js +1 -1
- package/guards/dist/xstate-guards.esm.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -205,14 +205,10 @@ function matchesState(parentStateId, childStateId) {
|
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
function toStatePath(stateId) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return stateId;
|
|
211
|
-
}
|
|
212
|
-
return stateId.split(STATE_DELIMITER);
|
|
213
|
-
} catch (e) {
|
|
214
|
-
throw new Error(`'${stateId}' is not a valid state path.`);
|
|
208
|
+
if (isArray(stateId)) {
|
|
209
|
+
return stateId;
|
|
215
210
|
}
|
|
211
|
+
return stateId.split(STATE_DELIMITER);
|
|
216
212
|
}
|
|
217
213
|
function toStateValue(stateValue) {
|
|
218
214
|
if (isMachineSnapshot(stateValue)) {
|
|
@@ -451,7 +447,18 @@ class Actor {
|
|
|
451
447
|
}
|
|
452
448
|
}
|
|
453
449
|
_initState(persistedState) {
|
|
454
|
-
|
|
450
|
+
try {
|
|
451
|
+
this._state = persistedState ? this.logic.restoreState ? this.logic.restoreState(persistedState, this._actorScope) : persistedState : this.logic.getInitialState(this._actorScope, this.options?.input);
|
|
452
|
+
} catch (err) {
|
|
453
|
+
// if we get here then it means that we assign a value to this._state that is not of the correct type
|
|
454
|
+
// we can't get the true `TSnapshot & { status: 'error'; }`, it's impossible
|
|
455
|
+
// so right now this is a lie of sorts
|
|
456
|
+
this._state = {
|
|
457
|
+
status: 'error',
|
|
458
|
+
output: undefined,
|
|
459
|
+
error: err
|
|
460
|
+
};
|
|
461
|
+
}
|
|
455
462
|
}
|
|
456
463
|
update(snapshot, event) {
|
|
457
464
|
// Update state
|
|
@@ -460,17 +467,46 @@ class Actor {
|
|
|
460
467
|
// Execute deferred effects
|
|
461
468
|
let deferredFn;
|
|
462
469
|
while (deferredFn = this._deferred.shift()) {
|
|
463
|
-
deferredFn();
|
|
464
|
-
}
|
|
465
|
-
for (const observer of this.observers) {
|
|
466
470
|
try {
|
|
467
|
-
|
|
471
|
+
deferredFn();
|
|
468
472
|
} catch (err) {
|
|
469
|
-
|
|
473
|
+
// this error can only be caught when executing *initial* actions
|
|
474
|
+
// it's the only time when we call actions provided by the user through those deferreds
|
|
475
|
+
// when the actor is already running we always execute them synchronously while transitioning
|
|
476
|
+
// no "builtin deferred" should actually throw an error since they are either safe
|
|
477
|
+
// or the control flow is passed through the mailbox and errors should be caught by the `_process` used by the mailbox
|
|
478
|
+
this._deferred.length = 0;
|
|
479
|
+
this._state = {
|
|
480
|
+
...snapshot,
|
|
481
|
+
status: 'error',
|
|
482
|
+
error: err
|
|
483
|
+
};
|
|
470
484
|
}
|
|
471
485
|
}
|
|
472
486
|
switch (this._state.status) {
|
|
487
|
+
case 'active':
|
|
488
|
+
for (const observer of this.observers) {
|
|
489
|
+
try {
|
|
490
|
+
observer.next?.(snapshot);
|
|
491
|
+
} catch (err) {
|
|
492
|
+
reportUnhandledError(err);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
break;
|
|
473
496
|
case 'done':
|
|
497
|
+
// next observers are meant to be notified about done snapshots
|
|
498
|
+
// this can be seen as something that is different from how observable work
|
|
499
|
+
// but with observables `complete` callback is called without any arguments
|
|
500
|
+
// it's more ergonomic for XState to treat a done snapshot as a "next" value
|
|
501
|
+
// and the completion event as something that is separate,
|
|
502
|
+
// something that merely follows emitting that done snapshot
|
|
503
|
+
for (const observer of this.observers) {
|
|
504
|
+
try {
|
|
505
|
+
observer.next?.(snapshot);
|
|
506
|
+
} catch (err) {
|
|
507
|
+
reportUnhandledError(err);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
474
510
|
this._stopProcedure();
|
|
475
511
|
this._complete();
|
|
476
512
|
this._doneEvent = createDoneActorEvent(this.id, this._state.output);
|
|
@@ -479,11 +515,7 @@ class Actor {
|
|
|
479
515
|
}
|
|
480
516
|
break;
|
|
481
517
|
case 'error':
|
|
482
|
-
this._stopProcedure();
|
|
483
518
|
this._error(this._state.error);
|
|
484
|
-
if (this._parent) {
|
|
485
|
-
this.system._relay(this, this._parent, createErrorActorEvent(this.id, this._state.error));
|
|
486
|
-
}
|
|
487
519
|
break;
|
|
488
520
|
}
|
|
489
521
|
this.system._sendInspectionEvent({
|
|
@@ -573,7 +605,7 @@ class Actor {
|
|
|
573
605
|
this.subscribe({
|
|
574
606
|
next: snapshot => {
|
|
575
607
|
if (snapshot.status === 'active') {
|
|
576
|
-
this.
|
|
608
|
+
this.system._relay(this, this._parent, {
|
|
577
609
|
type: `xstate.snapshot.${this.id}`,
|
|
578
610
|
snapshot
|
|
579
611
|
});
|
|
@@ -602,18 +634,22 @@ class Actor {
|
|
|
602
634
|
// a state machine can be "done" upon initialization (it could reach a final state using initial microsteps)
|
|
603
635
|
// we still need to complete observers, flush deferreds etc
|
|
604
636
|
this.update(this._state, initEvent);
|
|
605
|
-
// fallthrough
|
|
606
|
-
case 'error':
|
|
607
637
|
// TODO: rethink cleanup of observers, mailbox, etc
|
|
608
638
|
return this;
|
|
639
|
+
case 'error':
|
|
640
|
+
this._error(this._state.error);
|
|
641
|
+
return this;
|
|
609
642
|
}
|
|
610
643
|
if (this.logic.start) {
|
|
611
644
|
try {
|
|
612
645
|
this.logic.start(this._state, this._actorScope);
|
|
613
646
|
} catch (err) {
|
|
614
|
-
this.
|
|
647
|
+
this._state = {
|
|
648
|
+
...this._state,
|
|
649
|
+
status: 'error',
|
|
650
|
+
error: err
|
|
651
|
+
};
|
|
615
652
|
this._error(err);
|
|
616
|
-
this._parent?.send(createErrorActorEvent(this.id, err));
|
|
617
653
|
return this;
|
|
618
654
|
}
|
|
619
655
|
}
|
|
@@ -629,7 +665,6 @@ class Actor {
|
|
|
629
665
|
return this;
|
|
630
666
|
}
|
|
631
667
|
_process(event) {
|
|
632
|
-
// TODO: reexamine what happens when an action (or a guard or smth) throws
|
|
633
668
|
let nextState;
|
|
634
669
|
let caughtError;
|
|
635
670
|
try {
|
|
@@ -644,9 +679,12 @@ class Actor {
|
|
|
644
679
|
const {
|
|
645
680
|
err
|
|
646
681
|
} = caughtError;
|
|
647
|
-
this.
|
|
682
|
+
this._state = {
|
|
683
|
+
...this._state,
|
|
684
|
+
status: 'error',
|
|
685
|
+
error: err
|
|
686
|
+
};
|
|
648
687
|
this._error(err);
|
|
649
|
-
this._parent?.send(createErrorActorEvent(this.id, err));
|
|
650
688
|
return;
|
|
651
689
|
}
|
|
652
690
|
this.update(nextState, event);
|
|
@@ -689,7 +727,7 @@ class Actor {
|
|
|
689
727
|
}
|
|
690
728
|
this.observers.clear();
|
|
691
729
|
}
|
|
692
|
-
|
|
730
|
+
_reportError(err) {
|
|
693
731
|
if (!this.observers.size) {
|
|
694
732
|
if (!this._parent) {
|
|
695
733
|
reportUnhandledError(err);
|
|
@@ -711,6 +749,18 @@ class Actor {
|
|
|
711
749
|
reportUnhandledError(err);
|
|
712
750
|
}
|
|
713
751
|
}
|
|
752
|
+
_error(err) {
|
|
753
|
+
this._stopProcedure();
|
|
754
|
+
this._reportError(err);
|
|
755
|
+
if (this._parent) {
|
|
756
|
+
this.system._relay(this, this._parent, createErrorActorEvent(this.id, err));
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
// TODO: atm children don't belong entirely to the actor so
|
|
760
|
+
// in a way - it's not even super aware of them
|
|
761
|
+
// so we can't stop them from here but we really should!
|
|
762
|
+
// right now, they are being stopped within the machine's transition
|
|
763
|
+
// but that could throw and leave us with "orphaned" active actors
|
|
714
764
|
_stopProcedure() {
|
|
715
765
|
if (this._processingStatus !== ProcessingStatus.Running) {
|
|
716
766
|
// Actor already stopped; do nothing
|
|
@@ -956,12 +1006,7 @@ function executeSpawn(actorScope, {
|
|
|
956
1006
|
if (actorRef._processingStatus === ProcessingStatus.Stopped) {
|
|
957
1007
|
return;
|
|
958
1008
|
}
|
|
959
|
-
|
|
960
|
-
actorRef.start?.();
|
|
961
|
-
} catch (err) {
|
|
962
|
-
actorScope.self.send(createErrorActorEvent(id, err));
|
|
963
|
-
return;
|
|
964
|
-
}
|
|
1009
|
+
actorRef.start();
|
|
965
1010
|
});
|
|
966
1011
|
}
|
|
967
1012
|
function spawnChild(...[src, {
|
|
@@ -1285,8 +1330,7 @@ function getDelayedTransitions(stateNode) {
|
|
|
1285
1330
|
return [];
|
|
1286
1331
|
}
|
|
1287
1332
|
const mutateEntryExit = (delay, i) => {
|
|
1288
|
-
const
|
|
1289
|
-
const afterEvent = createAfterEvent(delayRef, stateNode.id);
|
|
1333
|
+
const afterEvent = createAfterEvent(delay, stateNode.id);
|
|
1290
1334
|
const eventType = afterEvent.type;
|
|
1291
1335
|
stateNode.entry.push(raise(afterEvent, {
|
|
1292
1336
|
id: eventType,
|
|
@@ -1300,8 +1344,8 @@ function getDelayedTransitions(stateNode) {
|
|
|
1300
1344
|
const resolvedTransition = typeof configTransition === 'string' ? {
|
|
1301
1345
|
target: configTransition
|
|
1302
1346
|
} : configTransition;
|
|
1303
|
-
const resolvedDelay =
|
|
1304
|
-
const eventType = mutateEntryExit(resolvedDelay
|
|
1347
|
+
const resolvedDelay = Number.isNaN(+delay) ? delay : +delay;
|
|
1348
|
+
const eventType = mutateEntryExit(resolvedDelay);
|
|
1305
1349
|
return toArray(resolvedTransition).map(transition => ({
|
|
1306
1350
|
...transition,
|
|
1307
1351
|
event: eventType,
|
|
@@ -2016,7 +2060,23 @@ function macrostep(state, event, actorScope, internalQueue = []) {
|
|
|
2016
2060
|
// Assume the state is at rest (no raised events)
|
|
2017
2061
|
// Determine the next state based on the next microstep
|
|
2018
2062
|
if (nextEvent.type !== XSTATE_INIT) {
|
|
2019
|
-
const
|
|
2063
|
+
const currentEvent = nextEvent;
|
|
2064
|
+
const isErr = isErrorActorEvent(currentEvent);
|
|
2065
|
+
const transitions = selectTransitions(currentEvent, nextState);
|
|
2066
|
+
if (isErr && !transitions.length) {
|
|
2067
|
+
// TODO: we should likely only allow transitions selected by very explicit descriptors
|
|
2068
|
+
// `*` shouldn't be matched, likely `xstate.error.*` shouldnt be either
|
|
2069
|
+
// similarly `xstate.error.actor.*` and `xstate.error.actor.todo.*` have to be considered too
|
|
2070
|
+
nextState = cloneMachineSnapshot(state, {
|
|
2071
|
+
status: 'error',
|
|
2072
|
+
error: currentEvent.data
|
|
2073
|
+
});
|
|
2074
|
+
states.push(nextState);
|
|
2075
|
+
return {
|
|
2076
|
+
state: nextState,
|
|
2077
|
+
microstates: states
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2020
2080
|
nextState = microstep(transitions, state, actorScope, nextEvent, false, internalQueue);
|
|
2021
2081
|
states.push(nextState);
|
|
2022
2082
|
}
|
|
@@ -2284,7 +2344,6 @@ exports.getPersistedState = getPersistedState;
|
|
|
2284
2344
|
exports.getStateNodeByPath = getStateNodeByPath;
|
|
2285
2345
|
exports.getStateNodes = getStateNodes;
|
|
2286
2346
|
exports.interpret = interpret;
|
|
2287
|
-
exports.isErrorActorEvent = isErrorActorEvent;
|
|
2288
2347
|
exports.isInFinalState = isInFinalState;
|
|
2289
2348
|
exports.isMachineSnapshot = isMachineSnapshot;
|
|
2290
2349
|
exports.isStateId = isStateId;
|
package/dist/xstate.cjs.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var actors_dist_xstateActors = require('../actors/dist/xstate-actors.cjs.js');
|
|
6
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
7
|
-
var
|
|
6
|
+
var guards_dist_xstateGuards = require('./raise-d5633a02.cjs.js');
|
|
7
|
+
var pure = require('./pure-c5f1b46c.cjs.js');
|
|
8
8
|
require('../dev/dist/xstate-dev.cjs.js');
|
|
9
9
|
|
|
10
10
|
class SimulatedClock {
|
|
@@ -458,17 +458,7 @@ class StateMachine {
|
|
|
458
458
|
* @param event The received event
|
|
459
459
|
*/
|
|
460
460
|
transition(snapshot, event, actorScope) {
|
|
461
|
-
|
|
462
|
-
if (guards_dist_xstateGuards.isErrorActorEvent(event) && !guards_dist_xstateGuards.getAllOwnEventDescriptors(snapshot).some(nextEvent => nextEvent === event.type)) {
|
|
463
|
-
return guards_dist_xstateGuards.cloneMachineSnapshot(snapshot, {
|
|
464
|
-
status: 'error',
|
|
465
|
-
error: event.data
|
|
466
|
-
});
|
|
467
|
-
}
|
|
468
|
-
const {
|
|
469
|
-
state: nextState
|
|
470
|
-
} = guards_dist_xstateGuards.macrostep(snapshot, event, actorScope);
|
|
471
|
-
return nextState;
|
|
461
|
+
return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).state;
|
|
472
462
|
}
|
|
473
463
|
|
|
474
464
|
/**
|
|
@@ -507,7 +497,7 @@ class StateMachine {
|
|
|
507
497
|
spawn,
|
|
508
498
|
input: event.input
|
|
509
499
|
});
|
|
510
|
-
return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [
|
|
500
|
+
return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [pure.assign(assignment)], internalQueue);
|
|
511
501
|
}
|
|
512
502
|
return preInitial;
|
|
513
503
|
}
|
|
@@ -726,15 +716,16 @@ exports.stateIn = guards_dist_xstateGuards.stateIn;
|
|
|
726
716
|
exports.stop = guards_dist_xstateGuards.stop;
|
|
727
717
|
exports.stopChild = guards_dist_xstateGuards.stopChild;
|
|
728
718
|
exports.toObserver = guards_dist_xstateGuards.toObserver;
|
|
729
|
-
exports.SpecialTargets =
|
|
730
|
-
exports.assign =
|
|
731
|
-
exports.choose =
|
|
732
|
-
exports.
|
|
733
|
-
exports.
|
|
734
|
-
exports.
|
|
735
|
-
exports.
|
|
736
|
-
exports.
|
|
737
|
-
exports.
|
|
719
|
+
exports.SpecialTargets = pure.SpecialTargets;
|
|
720
|
+
exports.assign = pure.assign;
|
|
721
|
+
exports.choose = pure.choose;
|
|
722
|
+
exports.enqueueActions = pure.enqueueActions;
|
|
723
|
+
exports.escalate = pure.escalate;
|
|
724
|
+
exports.forwardTo = pure.forwardTo;
|
|
725
|
+
exports.log = pure.log;
|
|
726
|
+
exports.pure = pure.pure;
|
|
727
|
+
exports.sendParent = pure.sendParent;
|
|
728
|
+
exports.sendTo = pure.sendTo;
|
|
738
729
|
exports.SimulatedClock = SimulatedClock;
|
|
739
730
|
exports.StateMachine = StateMachine;
|
|
740
731
|
exports.StateNode = StateNode;
|
package/dist/xstate.cjs.mjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var actors_dist_xstateActors = require('../actors/dist/xstate-actors.development.cjs.js');
|
|
6
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
7
|
-
var
|
|
6
|
+
var guards_dist_xstateGuards = require('./raise-528386de.development.cjs.js');
|
|
7
|
+
var pure = require('./pure-a0f16134.development.cjs.js');
|
|
8
8
|
require('../dev/dist/xstate-dev.development.cjs.js');
|
|
9
9
|
|
|
10
10
|
class SimulatedClock {
|
|
@@ -461,17 +461,7 @@ class StateMachine {
|
|
|
461
461
|
* @param event The received event
|
|
462
462
|
*/
|
|
463
463
|
transition(snapshot, event, actorScope) {
|
|
464
|
-
|
|
465
|
-
if (guards_dist_xstateGuards.isErrorActorEvent(event) && !guards_dist_xstateGuards.getAllOwnEventDescriptors(snapshot).some(nextEvent => nextEvent === event.type)) {
|
|
466
|
-
return guards_dist_xstateGuards.cloneMachineSnapshot(snapshot, {
|
|
467
|
-
status: 'error',
|
|
468
|
-
error: event.data
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
const {
|
|
472
|
-
state: nextState
|
|
473
|
-
} = guards_dist_xstateGuards.macrostep(snapshot, event, actorScope);
|
|
474
|
-
return nextState;
|
|
464
|
+
return guards_dist_xstateGuards.macrostep(snapshot, event, actorScope).state;
|
|
475
465
|
}
|
|
476
466
|
|
|
477
467
|
/**
|
|
@@ -510,7 +500,7 @@ class StateMachine {
|
|
|
510
500
|
spawn,
|
|
511
501
|
input: event.input
|
|
512
502
|
});
|
|
513
|
-
return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [
|
|
503
|
+
return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [pure.assign(assignment)], internalQueue);
|
|
514
504
|
}
|
|
515
505
|
return preInitial;
|
|
516
506
|
}
|
|
@@ -732,15 +722,16 @@ exports.stateIn = guards_dist_xstateGuards.stateIn;
|
|
|
732
722
|
exports.stop = guards_dist_xstateGuards.stop;
|
|
733
723
|
exports.stopChild = guards_dist_xstateGuards.stopChild;
|
|
734
724
|
exports.toObserver = guards_dist_xstateGuards.toObserver;
|
|
735
|
-
exports.SpecialTargets =
|
|
736
|
-
exports.assign =
|
|
737
|
-
exports.choose =
|
|
738
|
-
exports.
|
|
739
|
-
exports.
|
|
740
|
-
exports.
|
|
741
|
-
exports.
|
|
742
|
-
exports.
|
|
743
|
-
exports.
|
|
725
|
+
exports.SpecialTargets = pure.SpecialTargets;
|
|
726
|
+
exports.assign = pure.assign;
|
|
727
|
+
exports.choose = pure.choose;
|
|
728
|
+
exports.enqueueActions = pure.enqueueActions;
|
|
729
|
+
exports.escalate = pure.escalate;
|
|
730
|
+
exports.forwardTo = pure.forwardTo;
|
|
731
|
+
exports.log = pure.log;
|
|
732
|
+
exports.pure = pure.pure;
|
|
733
|
+
exports.sendParent = pure.sendParent;
|
|
734
|
+
exports.sendTo = pure.sendTo;
|
|
744
735
|
exports.SimulatedClock = SimulatedClock;
|
|
745
736
|
exports.StateMachine = StateMachine;
|
|
746
737
|
exports.StateNode = StateNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.development.esm.js';
|
|
2
|
-
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as
|
|
3
|
-
export {
|
|
4
|
-
import { a as assign } from './
|
|
5
|
-
export { S as SpecialTargets, a as assign, c as choose, e as escalate, f as forwardTo, l as log, p as pure, s as sendParent,
|
|
2
|
+
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as isStateId, w as getStateNodeByPath, x as getPersistedState, y as resolveReferencedActor, z as createActor, $ as $$ACTOR_TYPE } from './raise-acaa3884.development.esm.js';
|
|
3
|
+
export { A as Actor, G as __unsafe_getAllOwnEventDescriptors, H as and, L as cancel, z as createActor, j as getStateNodes, B as interpret, C as isMachineSnapshot, D as matchesState, I as not, J as or, E as pathToStateValue, M as raise, O as spawnChild, K as stateIn, P as stop, Q as stopChild, F as toObserver } from './raise-acaa3884.development.esm.js';
|
|
4
|
+
import { a as assign } from './pure-296f8ebd.development.esm.js';
|
|
5
|
+
export { S as SpecialTargets, a as assign, c as choose, e as enqueueActions, b as escalate, f as forwardTo, l as log, p as pure, s as sendParent, d as sendTo } from './pure-296f8ebd.development.esm.js';
|
|
6
6
|
import '../dev/dist/xstate-dev.development.esm.js';
|
|
7
7
|
|
|
8
8
|
class SimulatedClock {
|
|
@@ -459,17 +459,7 @@ class StateMachine {
|
|
|
459
459
|
* @param event The received event
|
|
460
460
|
*/
|
|
461
461
|
transition(snapshot, event, actorScope) {
|
|
462
|
-
|
|
463
|
-
if (isErrorActorEvent(event) && !getAllOwnEventDescriptors(snapshot).some(nextEvent => nextEvent === event.type)) {
|
|
464
|
-
return cloneMachineSnapshot(snapshot, {
|
|
465
|
-
status: 'error',
|
|
466
|
-
error: event.data
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
const {
|
|
470
|
-
state: nextState
|
|
471
|
-
} = macrostep(snapshot, event, actorScope);
|
|
472
|
-
return nextState;
|
|
462
|
+
return macrostep(snapshot, event, actorScope).state;
|
|
473
463
|
}
|
|
474
464
|
|
|
475
465
|
/**
|
package/dist/xstate.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.esm.js';
|
|
2
|
-
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as
|
|
3
|
-
export {
|
|
4
|
-
import { a as assign } from './
|
|
5
|
-
export { S as SpecialTargets, a as assign, c as choose, e as escalate, f as forwardTo, l as log, p as pure, s as sendParent,
|
|
2
|
+
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as isStateId, w as getStateNodeByPath, x as getPersistedState, y as resolveReferencedActor, z as createActor, $ as $$ACTOR_TYPE } from './raise-4742bf04.esm.js';
|
|
3
|
+
export { A as Actor, G as __unsafe_getAllOwnEventDescriptors, H as and, L as cancel, z as createActor, j as getStateNodes, B as interpret, C as isMachineSnapshot, D as matchesState, I as not, J as or, E as pathToStateValue, M as raise, O as spawnChild, K as stateIn, P as stop, Q as stopChild, F as toObserver } from './raise-4742bf04.esm.js';
|
|
4
|
+
import { a as assign } from './pure-aefddc19.esm.js';
|
|
5
|
+
export { S as SpecialTargets, a as assign, c as choose, e as enqueueActions, b as escalate, f as forwardTo, l as log, p as pure, s as sendParent, d as sendTo } from './pure-aefddc19.esm.js';
|
|
6
6
|
import '../dev/dist/xstate-dev.esm.js';
|
|
7
7
|
|
|
8
8
|
class SimulatedClock {
|
|
@@ -456,17 +456,7 @@ class StateMachine {
|
|
|
456
456
|
* @param event The received event
|
|
457
457
|
*/
|
|
458
458
|
transition(snapshot, event, actorScope) {
|
|
459
|
-
|
|
460
|
-
if (isErrorActorEvent(event) && !getAllOwnEventDescriptors(snapshot).some(nextEvent => nextEvent === event.type)) {
|
|
461
|
-
return cloneMachineSnapshot(snapshot, {
|
|
462
|
-
status: 'error',
|
|
463
|
-
error: event.data
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
const {
|
|
467
|
-
state: nextState
|
|
468
|
-
} = macrostep(snapshot, event, actorScope);
|
|
469
|
-
return nextState;
|
|
459
|
+
return macrostep(snapshot, event, actorScope).state;
|
|
470
460
|
}
|
|
471
461
|
|
|
472
462
|
/**
|