xstate 6.0.0-alpha.31 → 6.0.0-alpha.32
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/dist/{StateMachine-54d3cf7a.development.esm.js → StateMachine-33eec203.development.esm.js} +16 -7
- package/dist/{StateMachine-cc0c34dd.esm.js → StateMachine-d073209c.esm.js} +16 -7
- package/dist/{StateMachine-73b20de0.development.cjs.js → StateMachine-d3243bd1.development.cjs.js} +16 -7
- package/dist/{StateMachine-4e86e818.cjs.js → StateMachine-ff580dd5.cjs.js} +16 -7
- package/dist/declarations/src/StateMachine.d.ts +2 -1
- package/dist/declarations/src/StateNode.d.ts +1 -0
- package/dist/declarations/src/stateUtils.d.ts +9 -2
- package/dist/declarations/src/types.d.ts +1 -1
- package/dist/{index-0317dbd5.development.cjs.js → index-691f27b9.development.cjs.js} +160 -97
- package/dist/{index-fbe9e986.development.esm.js → index-92227865.development.esm.js} +161 -98
- package/dist/{index-85c48a0a.cjs.js → index-9939f02a.cjs.js} +160 -97
- package/dist/{index-2b16671f.esm.js → index-ab93831d.esm.js} +161 -98
- package/dist/xstate-actors.cjs.js +1 -1
- package/dist/xstate-actors.development.cjs.js +1 -1
- package/dist/xstate-actors.development.esm.js +1 -1
- package/dist/xstate-actors.esm.js +1 -1
- package/dist/xstate-actors.umd.min.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +2 -2
- package/dist/xstate-graph.development.cjs.js +2 -2
- package/dist/xstate-graph.development.esm.js +2 -2
- package/dist/xstate-graph.esm.js +2 -2
- package/dist/xstate-graph.umd.min.js +1 -1
- package/dist/xstate-graph.umd.min.js.map +1 -1
- package/dist/xstate.cjs.js +2 -2
- package/dist/xstate.development.cjs.js +2 -2
- package/dist/xstate.development.esm.js +4 -4
- package/dist/xstate.esm.js +4 -4
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/{StateMachine-54d3cf7a.development.esm.js → StateMachine-33eec203.development.esm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as setSnapshotActorRef, N as getSnapshotActorRef, O as createSnapshotSystem, q as isMachineSnapshot, h as createActor, S as STATE_DELIMITER, P as mapValues, t as toArray, Q as createInvokeId, R as getDelayedTransitions, U as getEventDescriptorKey, V as
|
|
1
|
+
import { M as setSnapshotActorRef, N as getSnapshotActorRef, O as createSnapshotSystem, q as isMachineSnapshot, h as createActor, S as STATE_DELIMITER, P as mapValues, t as toArray, Q as createInvokeId, R as getDelayedTransitions, U as getEventDescriptorKey, V as getCandidates, W as evaluateCandidate, Y as formatTransition, Z as NULL_EVENT, _ as toTransitionConfigArray, $ as createInvokeTimeoutEventId, a0 as matchesActorSession, a1 as formatRouteTransitions, a2 as resolveStateValue, a3 as getAllStateNodes, s as getStateNodes, a4 as createMachineSnapshot, a5 as isInFinalState, a6 as assertValid, j as macrostep, a7 as cloneMachineSnapshot, a8 as transitionNode, e as XSTATE_TIMER, m as matchesEventDescriptor, a9 as getTransitionResult, aa as hasEffect, ab as createErrorPlatformEvent, r as resolveActionsWithContext, k as createInitEvent, l as createSpawnEffect, n as initialMicrostep, ac as toStatePath, ad as isStateId, ae as getStateNodeByPath, af as getPersistedSnapshot, ag as resolveReferencedActor, ah as createInvokeTimeoutEvent, ai as $$ACTOR_TYPE } from './index-92227865.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, actors, spawnedChildren) {
|
|
4
4
|
return (src, options) => {
|
|
@@ -203,6 +203,7 @@ class StateNode {
|
|
|
203
203
|
this.after = void 0;
|
|
204
204
|
this.events = void 0;
|
|
205
205
|
this.ownEvents = void 0;
|
|
206
|
+
this._candidateCache = void 0;
|
|
206
207
|
this.parent = options._parent;
|
|
207
208
|
this.key = options._key;
|
|
208
209
|
this.machine = options._machine;
|
|
@@ -303,10 +304,15 @@ class StateNode {
|
|
|
303
304
|
}
|
|
304
305
|
|
|
305
306
|
/** @internal */
|
|
306
|
-
next(snapshot, event, self) {
|
|
307
|
-
const
|
|
307
|
+
next(snapshot, event, self, selectionResults) {
|
|
308
|
+
const descriptorKey = getEventDescriptorKey(event);
|
|
309
|
+
let candidates = this._candidateCache?.get(descriptorKey);
|
|
310
|
+
if (!candidates) {
|
|
311
|
+
candidates = getCandidates(this, event);
|
|
312
|
+
(this._candidateCache ??= new Map()).set(descriptorKey, candidates);
|
|
313
|
+
}
|
|
308
314
|
for (const candidate of candidates) {
|
|
309
|
-
const guardPassed = evaluateCandidate(candidate, event, snapshot, this, self);
|
|
315
|
+
const guardPassed = evaluateCandidate(candidate, event, snapshot, this, self, selectionResults);
|
|
310
316
|
if (guardPassed) {
|
|
311
317
|
return [candidate];
|
|
312
318
|
}
|
|
@@ -563,6 +569,8 @@ class StateMachine {
|
|
|
563
569
|
this.states = void 0;
|
|
564
570
|
this.events = void 0;
|
|
565
571
|
this.internalEventDescriptors = void 0;
|
|
572
|
+
/** @internal Skips eventless-selection scans for machines without `always`. */
|
|
573
|
+
this._hasEventlessTransitions = void 0;
|
|
566
574
|
/**
|
|
567
575
|
* The original JSON definition this machine was created from (set by
|
|
568
576
|
* `createMachineFromConfig`), if any. Used by `serializeMachine` for lossless
|
|
@@ -610,6 +618,7 @@ class StateMachine {
|
|
|
610
618
|
this.root._initialize();
|
|
611
619
|
formatRouteTransitions(this.root);
|
|
612
620
|
this.root._refreshEventMetadata();
|
|
621
|
+
this._hasEventlessTransitions = Array.from(this.idMap.values()).some(stateNode => !!stateNode.always?.length);
|
|
613
622
|
this.states = this.root.states; // TODO: remove!
|
|
614
623
|
this.events = this.root.events;
|
|
615
624
|
}
|
|
@@ -787,8 +796,8 @@ class StateMachine {
|
|
|
787
796
|
}
|
|
788
797
|
return snapshots;
|
|
789
798
|
}
|
|
790
|
-
getTransitionData(snapshot, event, self) {
|
|
791
|
-
return transitionNode(this.root, snapshot.value, snapshot, event, self) || [];
|
|
799
|
+
getTransitionData(snapshot, event, self, selectionResults) {
|
|
800
|
+
return transitionNode(this.root, snapshot.value, snapshot, event, self, selectionResults) || [];
|
|
792
801
|
}
|
|
793
802
|
isInternalEventType(eventType) {
|
|
794
803
|
if (eventType === XSTATE_TIMER) {
|
|
@@ -860,7 +869,7 @@ class StateMachine {
|
|
|
860
869
|
_nodes: [this.root],
|
|
861
870
|
children: {},
|
|
862
871
|
status: 'active'
|
|
863
|
-
}, this
|
|
872
|
+
}, this);
|
|
864
873
|
if (typeof context === 'function') {
|
|
865
874
|
const children = {};
|
|
866
875
|
const spawn = createSpawner(actorScope, this.sources.actors, children);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as setSnapshotActorRef, N as getSnapshotActorRef, O as createSnapshotSystem, q as isMachineSnapshot, h as createActor, S as STATE_DELIMITER, P as mapValues, t as toArray, Q as createInvokeId, R as getDelayedTransitions, U as getEventDescriptorKey, V as
|
|
1
|
+
import { M as setSnapshotActorRef, N as getSnapshotActorRef, O as createSnapshotSystem, q as isMachineSnapshot, h as createActor, S as STATE_DELIMITER, P as mapValues, t as toArray, Q as createInvokeId, R as getDelayedTransitions, U as getEventDescriptorKey, V as getCandidates, W as evaluateCandidate, Y as formatTransition, Z as NULL_EVENT, _ as toTransitionConfigArray, $ as createInvokeTimeoutEventId, a0 as matchesActorSession, a1 as formatRouteTransitions, a2 as resolveStateValue, a3 as getAllStateNodes, s as getStateNodes, a4 as createMachineSnapshot, a5 as isInFinalState, a6 as assertValid, j as macrostep, a7 as cloneMachineSnapshot, a8 as transitionNode, e as XSTATE_TIMER, m as matchesEventDescriptor, a9 as getTransitionResult, aa as hasEffect, ab as createErrorPlatformEvent, r as resolveActionsWithContext, k as createInitEvent, l as createSpawnEffect, n as initialMicrostep, ac as toStatePath, ad as isStateId, ae as getStateNodeByPath, af as getPersistedSnapshot, ag as resolveReferencedActor, ah as createInvokeTimeoutEvent, ai as $$ACTOR_TYPE } from './index-ab93831d.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, actors, spawnedChildren) {
|
|
4
4
|
return (src, options) => {
|
|
@@ -202,6 +202,7 @@ class StateNode {
|
|
|
202
202
|
this.after = void 0;
|
|
203
203
|
this.events = void 0;
|
|
204
204
|
this.ownEvents = void 0;
|
|
205
|
+
this._candidateCache = void 0;
|
|
205
206
|
this.parent = options._parent;
|
|
206
207
|
this.key = options._key;
|
|
207
208
|
this.machine = options._machine;
|
|
@@ -302,10 +303,15 @@ class StateNode {
|
|
|
302
303
|
}
|
|
303
304
|
|
|
304
305
|
/** @internal */
|
|
305
|
-
next(snapshot, event, self) {
|
|
306
|
-
const
|
|
306
|
+
next(snapshot, event, self, selectionResults) {
|
|
307
|
+
const descriptorKey = getEventDescriptorKey(event);
|
|
308
|
+
let candidates = this._candidateCache?.get(descriptorKey);
|
|
309
|
+
if (!candidates) {
|
|
310
|
+
candidates = getCandidates(this, event);
|
|
311
|
+
(this._candidateCache ??= new Map()).set(descriptorKey, candidates);
|
|
312
|
+
}
|
|
307
313
|
for (const candidate of candidates) {
|
|
308
|
-
const guardPassed = evaluateCandidate(candidate, event, snapshot, this, self);
|
|
314
|
+
const guardPassed = evaluateCandidate(candidate, event, snapshot, this, self, selectionResults);
|
|
309
315
|
if (guardPassed) {
|
|
310
316
|
return [candidate];
|
|
311
317
|
}
|
|
@@ -545,6 +551,8 @@ class StateMachine {
|
|
|
545
551
|
this.states = void 0;
|
|
546
552
|
this.events = void 0;
|
|
547
553
|
this.internalEventDescriptors = void 0;
|
|
554
|
+
/** @internal Skips eventless-selection scans for machines without `always`. */
|
|
555
|
+
this._hasEventlessTransitions = void 0;
|
|
548
556
|
/**
|
|
549
557
|
* The original JSON definition this machine was created from (set by
|
|
550
558
|
* `createMachineFromConfig`), if any. Used by `serializeMachine` for lossless
|
|
@@ -581,6 +589,7 @@ class StateMachine {
|
|
|
581
589
|
this.root._initialize();
|
|
582
590
|
formatRouteTransitions(this.root);
|
|
583
591
|
this.root._refreshEventMetadata();
|
|
592
|
+
this._hasEventlessTransitions = Array.from(this.idMap.values()).some(stateNode => !!stateNode.always?.length);
|
|
584
593
|
this.states = this.root.states; // TODO: remove!
|
|
585
594
|
this.events = this.root.events;
|
|
586
595
|
}
|
|
@@ -758,8 +767,8 @@ class StateMachine {
|
|
|
758
767
|
}
|
|
759
768
|
return snapshots;
|
|
760
769
|
}
|
|
761
|
-
getTransitionData(snapshot, event, self) {
|
|
762
|
-
return transitionNode(this.root, snapshot.value, snapshot, event, self) || [];
|
|
770
|
+
getTransitionData(snapshot, event, self, selectionResults) {
|
|
771
|
+
return transitionNode(this.root, snapshot.value, snapshot, event, self, selectionResults) || [];
|
|
763
772
|
}
|
|
764
773
|
isInternalEventType(eventType) {
|
|
765
774
|
if (eventType === XSTATE_TIMER) {
|
|
@@ -831,7 +840,7 @@ class StateMachine {
|
|
|
831
840
|
_nodes: [this.root],
|
|
832
841
|
children: {},
|
|
833
842
|
status: 'active'
|
|
834
|
-
}, this
|
|
843
|
+
}, this);
|
|
835
844
|
if (typeof context === 'function') {
|
|
836
845
|
const children = {};
|
|
837
846
|
const spawn = createSpawner(actorScope, this.sources.actors, children);
|
package/dist/{StateMachine-73b20de0.development.cjs.js → StateMachine-d3243bd1.development.cjs.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dist_xstateActors = require('./index-
|
|
3
|
+
var dist_xstateActors = require('./index-691f27b9.development.cjs.js');
|
|
4
4
|
|
|
5
5
|
function createSpawner(actorScope, actors, spawnedChildren) {
|
|
6
6
|
return (src, options) => {
|
|
@@ -205,6 +205,7 @@ class StateNode {
|
|
|
205
205
|
this.after = void 0;
|
|
206
206
|
this.events = void 0;
|
|
207
207
|
this.ownEvents = void 0;
|
|
208
|
+
this._candidateCache = void 0;
|
|
208
209
|
this.parent = options._parent;
|
|
209
210
|
this.key = options._key;
|
|
210
211
|
this.machine = options._machine;
|
|
@@ -305,10 +306,15 @@ class StateNode {
|
|
|
305
306
|
}
|
|
306
307
|
|
|
307
308
|
/** @internal */
|
|
308
|
-
next(snapshot, event, self) {
|
|
309
|
-
const
|
|
309
|
+
next(snapshot, event, self, selectionResults) {
|
|
310
|
+
const descriptorKey = dist_xstateActors.getEventDescriptorKey(event);
|
|
311
|
+
let candidates = this._candidateCache?.get(descriptorKey);
|
|
312
|
+
if (!candidates) {
|
|
313
|
+
candidates = dist_xstateActors.getCandidates(this, event);
|
|
314
|
+
(this._candidateCache ??= new Map()).set(descriptorKey, candidates);
|
|
315
|
+
}
|
|
310
316
|
for (const candidate of candidates) {
|
|
311
|
-
const guardPassed = dist_xstateActors.evaluateCandidate(candidate, event, snapshot, this, self);
|
|
317
|
+
const guardPassed = dist_xstateActors.evaluateCandidate(candidate, event, snapshot, this, self, selectionResults);
|
|
312
318
|
if (guardPassed) {
|
|
313
319
|
return [candidate];
|
|
314
320
|
}
|
|
@@ -565,6 +571,8 @@ class StateMachine {
|
|
|
565
571
|
this.states = void 0;
|
|
566
572
|
this.events = void 0;
|
|
567
573
|
this.internalEventDescriptors = void 0;
|
|
574
|
+
/** @internal Skips eventless-selection scans for machines without `always`. */
|
|
575
|
+
this._hasEventlessTransitions = void 0;
|
|
568
576
|
/**
|
|
569
577
|
* The original JSON definition this machine was created from (set by
|
|
570
578
|
* `createMachineFromConfig`), if any. Used by `serializeMachine` for lossless
|
|
@@ -612,6 +620,7 @@ class StateMachine {
|
|
|
612
620
|
this.root._initialize();
|
|
613
621
|
dist_xstateActors.formatRouteTransitions(this.root);
|
|
614
622
|
this.root._refreshEventMetadata();
|
|
623
|
+
this._hasEventlessTransitions = Array.from(this.idMap.values()).some(stateNode => !!stateNode.always?.length);
|
|
615
624
|
this.states = this.root.states; // TODO: remove!
|
|
616
625
|
this.events = this.root.events;
|
|
617
626
|
}
|
|
@@ -789,8 +798,8 @@ class StateMachine {
|
|
|
789
798
|
}
|
|
790
799
|
return snapshots;
|
|
791
800
|
}
|
|
792
|
-
getTransitionData(snapshot, event, self) {
|
|
793
|
-
return dist_xstateActors.transitionNode(this.root, snapshot.value, snapshot, event, self) || [];
|
|
801
|
+
getTransitionData(snapshot, event, self, selectionResults) {
|
|
802
|
+
return dist_xstateActors.transitionNode(this.root, snapshot.value, snapshot, event, self, selectionResults) || [];
|
|
794
803
|
}
|
|
795
804
|
isInternalEventType(eventType) {
|
|
796
805
|
if (eventType === dist_xstateActors.XSTATE_TIMER) {
|
|
@@ -862,7 +871,7 @@ class StateMachine {
|
|
|
862
871
|
_nodes: [this.root],
|
|
863
872
|
children: {},
|
|
864
873
|
status: 'active'
|
|
865
|
-
}, this
|
|
874
|
+
}, this);
|
|
866
875
|
if (typeof context === 'function') {
|
|
867
876
|
const children = {};
|
|
868
877
|
const spawn = createSpawner(actorScope, this.sources.actors, children);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var dist_xstateActors = require('./index-
|
|
3
|
+
var dist_xstateActors = require('./index-9939f02a.cjs.js');
|
|
4
4
|
|
|
5
5
|
function createSpawner(actorScope, actors, spawnedChildren) {
|
|
6
6
|
return (src, options) => {
|
|
@@ -204,6 +204,7 @@ class StateNode {
|
|
|
204
204
|
this.after = void 0;
|
|
205
205
|
this.events = void 0;
|
|
206
206
|
this.ownEvents = void 0;
|
|
207
|
+
this._candidateCache = void 0;
|
|
207
208
|
this.parent = options._parent;
|
|
208
209
|
this.key = options._key;
|
|
209
210
|
this.machine = options._machine;
|
|
@@ -304,10 +305,15 @@ class StateNode {
|
|
|
304
305
|
}
|
|
305
306
|
|
|
306
307
|
/** @internal */
|
|
307
|
-
next(snapshot, event, self) {
|
|
308
|
-
const
|
|
308
|
+
next(snapshot, event, self, selectionResults) {
|
|
309
|
+
const descriptorKey = dist_xstateActors.getEventDescriptorKey(event);
|
|
310
|
+
let candidates = this._candidateCache?.get(descriptorKey);
|
|
311
|
+
if (!candidates) {
|
|
312
|
+
candidates = dist_xstateActors.getCandidates(this, event);
|
|
313
|
+
(this._candidateCache ??= new Map()).set(descriptorKey, candidates);
|
|
314
|
+
}
|
|
309
315
|
for (const candidate of candidates) {
|
|
310
|
-
const guardPassed = dist_xstateActors.evaluateCandidate(candidate, event, snapshot, this, self);
|
|
316
|
+
const guardPassed = dist_xstateActors.evaluateCandidate(candidate, event, snapshot, this, self, selectionResults);
|
|
311
317
|
if (guardPassed) {
|
|
312
318
|
return [candidate];
|
|
313
319
|
}
|
|
@@ -547,6 +553,8 @@ class StateMachine {
|
|
|
547
553
|
this.states = void 0;
|
|
548
554
|
this.events = void 0;
|
|
549
555
|
this.internalEventDescriptors = void 0;
|
|
556
|
+
/** @internal Skips eventless-selection scans for machines without `always`. */
|
|
557
|
+
this._hasEventlessTransitions = void 0;
|
|
550
558
|
/**
|
|
551
559
|
* The original JSON definition this machine was created from (set by
|
|
552
560
|
* `createMachineFromConfig`), if any. Used by `serializeMachine` for lossless
|
|
@@ -583,6 +591,7 @@ class StateMachine {
|
|
|
583
591
|
this.root._initialize();
|
|
584
592
|
dist_xstateActors.formatRouteTransitions(this.root);
|
|
585
593
|
this.root._refreshEventMetadata();
|
|
594
|
+
this._hasEventlessTransitions = Array.from(this.idMap.values()).some(stateNode => !!stateNode.always?.length);
|
|
586
595
|
this.states = this.root.states; // TODO: remove!
|
|
587
596
|
this.events = this.root.events;
|
|
588
597
|
}
|
|
@@ -760,8 +769,8 @@ class StateMachine {
|
|
|
760
769
|
}
|
|
761
770
|
return snapshots;
|
|
762
771
|
}
|
|
763
|
-
getTransitionData(snapshot, event, self) {
|
|
764
|
-
return dist_xstateActors.transitionNode(this.root, snapshot.value, snapshot, event, self) || [];
|
|
772
|
+
getTransitionData(snapshot, event, self, selectionResults) {
|
|
773
|
+
return dist_xstateActors.transitionNode(this.root, snapshot.value, snapshot, event, self, selectionResults) || [];
|
|
765
774
|
}
|
|
766
775
|
isInternalEventType(eventType) {
|
|
767
776
|
if (eventType === dist_xstateActors.XSTATE_TIMER) {
|
|
@@ -833,7 +842,7 @@ class StateMachine {
|
|
|
833
842
|
_nodes: [this.root],
|
|
834
843
|
children: {},
|
|
835
844
|
status: 'active'
|
|
836
|
-
}, this
|
|
845
|
+
}, this);
|
|
837
846
|
if (typeof context === 'function') {
|
|
838
847
|
const children = {};
|
|
839
848
|
const spawn = createSpawner(actorScope, this.sources.actors, children);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MachineSnapshot } from "./State.js";
|
|
2
2
|
import { StateNode } from "./StateNode.js";
|
|
3
|
+
import { type TransitionSelectionResults } from "./stateUtils.js";
|
|
3
4
|
import { AnyActorSystem } from "./system.js";
|
|
4
5
|
import type { ActorLogic, ActorLogicTransitionResult, ActorScope, AnyActor, AnyActorLogic, AnyActorRef, AnyActorScope, AnyTransitionDefinition, Equals, EventDescriptor, EmittedFrom, EventObject, EventFromLogic, ExecutableActionObjectFromLogic, HistoryValue, InputFrom, IsAny, MachineContext, MetaObject, OutputFrom, Snapshot, SnapshotFrom, StateValue, StateSchema, SnapshotStatus } from "./types.js";
|
|
5
6
|
import { AnyMachineSchemas, Sources, Next_MachineConfig, MachineOptions } from "./types.v6.js";
|
|
@@ -76,7 +77,7 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
|
|
|
76
77
|
* @param event The received event
|
|
77
78
|
*/
|
|
78
79
|
microstep(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent, actorScope: AnyActorScope): Array<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>>;
|
|
79
|
-
getTransitionData(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent, self: AnyActor): Array<AnyTransitionDefinition>;
|
|
80
|
+
getTransitionData(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, event: TEvent, self: AnyActor, selectionResults?: TransitionSelectionResults): Array<AnyTransitionDefinition>;
|
|
80
81
|
isInternalEventType(eventType: string): boolean;
|
|
81
82
|
/**
|
|
82
83
|
* Returns the initial `State` instance, with reference to `self` as an
|
|
@@ -70,6 +70,7 @@ export declare class StateNode<TContext extends MachineContext = MachineContext,
|
|
|
70
70
|
after: Array<DelayedTransitionDefinition<any, any>>;
|
|
71
71
|
events: Array<EventDescriptor<any>>;
|
|
72
72
|
ownEvents: Array<EventDescriptor<any>>;
|
|
73
|
+
private _candidateCache?;
|
|
73
74
|
constructor(
|
|
74
75
|
/** The raw config used to create the machine. */
|
|
75
76
|
config: AnyStateNodeConfig, options: StateNodeOptions<TContext, TEvent>);
|
|
@@ -31,7 +31,13 @@ export declare function getStateNodeByPath(stateNode: AnyStateNode, statePath: s
|
|
|
31
31
|
* @param stateValue The state value or State instance
|
|
32
32
|
*/
|
|
33
33
|
export declare function getStateNodes(stateNode: AnyStateNode, stateValue: StateValue): Array<AnyStateNode>;
|
|
34
|
-
export
|
|
34
|
+
export type TransitionSelectionResult = {
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
result: unknown;
|
|
37
|
+
reusable: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type TransitionSelectionResults = Map<AnyTransitionDefinition, TransitionSelectionResult>;
|
|
40
|
+
export declare function transitionNode<TContext extends MachineContext, TEvent extends EventObject>(stateNode: AnyStateNode, stateValue: StateValue, snapshot: MachineSnapshot<TContext, TEvent, any, any, any, any, any, any>, event: TEvent, self: AnyActor, selectionResults?: TransitionSelectionResults): Array<TransitionDefinition<TContext, TEvent>> | undefined;
|
|
35
41
|
type Microstep = readonly [AnyMachineSnapshot, ExecutableActionObject[]];
|
|
36
42
|
export declare function initialMicrostep(root: AnyStateNode, preInitialState: AnyMachineSnapshot, actorScope: AnyActorScope, initEvent: AnyEventObject, internalQueue: AnyEventObject[]): Microstep;
|
|
37
43
|
/**
|
|
@@ -44,6 +50,7 @@ export declare function getTransitionResult(transition: Pick<AnyTransitionDefini
|
|
|
44
50
|
context?: AnyTransitionDefinition['context'];
|
|
45
51
|
}, snapshot: AnyMachineSnapshot, event: AnyEventObject, actorScope: AnyActorScope, options?: {
|
|
46
52
|
resolveActions?: boolean;
|
|
53
|
+
selectionResult?: TransitionSelectionResult;
|
|
47
54
|
}): {
|
|
48
55
|
targets: Readonly<AnyStateNode[]> | undefined;
|
|
49
56
|
context: MachineContext | undefined;
|
|
@@ -64,5 +71,5 @@ export declare function macrostep(snapshot: AnyMachineSnapshot, event: EventObje
|
|
|
64
71
|
*/
|
|
65
72
|
export declare function resolveStateValue(rootNode: AnyStateNode, stateValue: StateValue): StateValue;
|
|
66
73
|
export declare function hasEffect(transition: AnyTransitionDefinition, context: MachineContext, event: EventObject, snapshot: AnyMachineSnapshot, self: AnyActor): boolean;
|
|
67
|
-
export declare function evaluateCandidate(candidate: AnyTransitionDefinition, event: EventObject, snapshot: AnyMachineSnapshot, stateNode: AnyStateNode, self: AnyActor): boolean;
|
|
74
|
+
export declare function evaluateCandidate(candidate: AnyTransitionDefinition, event: EventObject, snapshot: AnyMachineSnapshot, stateNode: AnyStateNode, self: AnyActor, selectionResults?: TransitionSelectionResults): boolean;
|
|
68
75
|
export {};
|
|
@@ -351,7 +351,7 @@ export interface AnyStateMachine extends AnyActorLogic {
|
|
|
351
351
|
schemas?: import("./types.v6.js").AnyMachineSchemas;
|
|
352
352
|
provide(sources: any): AnyStateMachine;
|
|
353
353
|
resolveState(config: any): any;
|
|
354
|
-
getTransitionData(snapshot: any, event: any, actor: AnyActorRef): AnyTransitionDefinition[];
|
|
354
|
+
getTransitionData(snapshot: any, event: any, actor: AnyActorRef, selectionResults?: Map<AnyTransitionDefinition, unknown>): AnyTransitionDefinition[];
|
|
355
355
|
getStateNodeById(stateId: string): AnyStateNode;
|
|
356
356
|
getPersistedSnapshot(snapshot: any, options?: unknown): Snapshot<unknown>;
|
|
357
357
|
}
|