xstate 5.0.0-beta.46 → 5.0.0-beta.47
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 +4 -3
- package/actions/dist/xstate-actions.cjs.mjs +3 -2
- package/actions/dist/xstate-actions.development.cjs.js +4 -3
- package/actions/dist/xstate-actions.development.cjs.mjs +3 -2
- 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 +1 -1
- package/actors/dist/xstate-actors.development.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.esm.js +1 -1
- package/actors/dist/xstate-actors.esm.js +1 -1
- package/dist/declarations/src/actions/{spawn.d.ts → spawnChild.d.ts} +1 -1
- package/dist/declarations/src/actions/{stop.d.ts → stopChild.d.ts} +8 -2
- package/dist/declarations/src/actions.d.ts +2 -2
- package/dist/{raise-fa23c2b9.development.esm.js → raise-156f5f68.development.esm.js} +25 -18
- package/dist/{raise-a1d3d7e9.cjs.js → raise-7af24c22.cjs.js} +26 -18
- package/dist/{raise-a9e7e31c.development.cjs.js → raise-7dc97582.development.cjs.js} +26 -18
- package/dist/{raise-1682abb7.esm.js → raise-91ec8b4f.esm.js} +25 -18
- package/dist/{send-2fa3a204.cjs.js → send-401f5c30.cjs.js} +1 -1
- package/dist/{send-9acdf858.development.esm.js → send-7489590c.development.esm.js} +1 -1
- package/dist/{send-5b256a89.development.cjs.js → send-bc0d3e22.development.cjs.js} +1 -1
- package/dist/{send-a237e4e8.esm.js → send-ed326064.esm.js} +1 -1
- package/dist/xstate.cjs.js +4 -3
- package/dist/xstate.cjs.mjs +2 -1
- package/dist/xstate.development.cjs.js +4 -3
- package/dist/xstate.development.cjs.mjs +2 -1
- 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/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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var guards_dist_xstateGuards = require('../../dist/raise-
|
|
5
|
+
var guards_dist_xstateGuards = require('../../dist/raise-7af24c22.cjs.js');
|
|
6
6
|
require('../../dev/dist/xstate-dev.cjs.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var guards_dist_xstateGuards = require('../../dist/raise-
|
|
5
|
+
var guards_dist_xstateGuards = require('../../dist/raise-7dc97582.development.cjs.js');
|
|
6
6
|
require('../../dev/dist/xstate-dev.development.cjs.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -25,5 +25,5 @@ type SpawnArguments<TContext extends MachineContext, TExpressionEvent extends Ev
|
|
|
25
25
|
syncSnapshot?: boolean;
|
|
26
26
|
}
|
|
27
27
|
];
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function spawnChild<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject, TActor extends ProvidedActor>(...[src, { id, systemId, input, syncSnapshot }]: SpawnArguments<TContext, TExpressionEvent, TEvent, TActor>): SpawnAction<TContext, TExpressionEvent, TParams, TEvent, TActor>;
|
|
29
29
|
export {};
|
|
@@ -4,9 +4,15 @@ export interface StopAction<TContext extends MachineContext, TExpressionEvent ex
|
|
|
4
4
|
(args: ActionArgs<TContext, TExpressionEvent, TEvent>, params: TParams): void;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
* Stops
|
|
7
|
+
* Stops a child actor.
|
|
8
8
|
*
|
|
9
9
|
* @param actorRef The actor to stop.
|
|
10
10
|
*/
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function stopChild<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject>(actorRef: ResolvableActorRef<TContext, TExpressionEvent, TParams, TEvent>): StopAction<TContext, TExpressionEvent, TParams, TEvent>;
|
|
12
|
+
/**
|
|
13
|
+
* Stops a child actor.
|
|
14
|
+
*
|
|
15
|
+
* @deprecated Use `stopChild(...)` instead
|
|
16
|
+
*/
|
|
17
|
+
export declare const stop: typeof stopChild;
|
|
12
18
|
export {};
|
|
@@ -5,5 +5,5 @@ export { log, type LogAction } from "./actions/log.js";
|
|
|
5
5
|
export { pure, type PureAction } from "./actions/pure.js";
|
|
6
6
|
export { raise, type RaiseAction } from "./actions/raise.js";
|
|
7
7
|
export { escalate, forwardTo, sendParent, sendTo, type SendToAction } from "./actions/send.js";
|
|
8
|
-
export { stop, type StopAction } from "./actions/
|
|
9
|
-
export {
|
|
8
|
+
export { stop, stopChild, type StopAction } from "./actions/stopChild.js";
|
|
9
|
+
export { spawnChild, type SpawnAction } from "./actions/spawnChild.js";
|
|
@@ -956,26 +956,26 @@ function executeSpawn(actorScope, {
|
|
|
956
956
|
}
|
|
957
957
|
});
|
|
958
958
|
}
|
|
959
|
-
function
|
|
959
|
+
function spawnChild(...[src, {
|
|
960
960
|
id,
|
|
961
961
|
systemId,
|
|
962
962
|
input,
|
|
963
963
|
syncSnapshot = false
|
|
964
964
|
} = {}]) {
|
|
965
|
-
function
|
|
965
|
+
function spawnChild(args, params) {
|
|
966
966
|
{
|
|
967
967
|
throw new Error(`This isn't supposed to be called`);
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
return
|
|
970
|
+
spawnChild.type = 'xstate.spawnChild';
|
|
971
|
+
spawnChild.id = id;
|
|
972
|
+
spawnChild.systemId = systemId;
|
|
973
|
+
spawnChild.src = src;
|
|
974
|
+
spawnChild.input = input;
|
|
975
|
+
spawnChild.syncSnapshot = syncSnapshot;
|
|
976
|
+
spawnChild.resolve = resolveSpawn;
|
|
977
|
+
spawnChild.execute = executeSpawn;
|
|
978
|
+
return spawnChild;
|
|
979
979
|
}
|
|
980
980
|
|
|
981
981
|
function resolveStop(_, state, args, actionParams, {
|
|
@@ -1019,23 +1019,30 @@ function executeStop(actorScope, actorRef) {
|
|
|
1019
1019
|
});
|
|
1020
1020
|
}
|
|
1021
1021
|
/**
|
|
1022
|
-
* Stops
|
|
1022
|
+
* Stops a child actor.
|
|
1023
1023
|
*
|
|
1024
1024
|
* @param actorRef The actor to stop.
|
|
1025
1025
|
*/
|
|
1026
|
-
function
|
|
1026
|
+
function stopChild(actorRef) {
|
|
1027
1027
|
function stop(args, params) {
|
|
1028
1028
|
{
|
|
1029
1029
|
throw new Error(`This isn't supposed to be called`);
|
|
1030
1030
|
}
|
|
1031
1031
|
}
|
|
1032
|
-
stop.type = 'xstate.
|
|
1032
|
+
stop.type = 'xstate.stopChild';
|
|
1033
1033
|
stop.actorRef = actorRef;
|
|
1034
1034
|
stop.resolve = resolveStop;
|
|
1035
1035
|
stop.execute = executeStop;
|
|
1036
1036
|
return stop;
|
|
1037
1037
|
}
|
|
1038
1038
|
|
|
1039
|
+
/**
|
|
1040
|
+
* Stops a child actor.
|
|
1041
|
+
*
|
|
1042
|
+
* @deprecated Use `stopChild(...)` instead
|
|
1043
|
+
*/
|
|
1044
|
+
const stop = stopChild;
|
|
1045
|
+
|
|
1039
1046
|
function checkStateIn(state, _, {
|
|
1040
1047
|
stateValue
|
|
1041
1048
|
}) {
|
|
@@ -1783,7 +1790,7 @@ function enterStates(currentState, event, actorScope, filteredTransitions, mutSt
|
|
|
1783
1790
|
// Add entry actions
|
|
1784
1791
|
actions.push(...stateNodeToEnter.entry);
|
|
1785
1792
|
for (const invokeDef of stateNodeToEnter.invoke) {
|
|
1786
|
-
actions.push(
|
|
1793
|
+
actions.push(spawnChild(invokeDef.src, {
|
|
1787
1794
|
...invokeDef,
|
|
1788
1795
|
syncSnapshot: !!invokeDef.onSnapshot
|
|
1789
1796
|
}));
|
|
@@ -1934,7 +1941,7 @@ function exitStates(currentState, event, actorScope, transitions, mutStateNodeSe
|
|
|
1934
1941
|
}
|
|
1935
1942
|
}
|
|
1936
1943
|
for (const s of statesToExit) {
|
|
1937
|
-
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def =>
|
|
1944
|
+
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def => stopChild(def.id))], internalQueue);
|
|
1938
1945
|
mutStateNodeSet.delete(s);
|
|
1939
1946
|
}
|
|
1940
1947
|
return [nextState, changedHistory || historyValue];
|
|
@@ -2060,7 +2067,7 @@ function macrostep(state, event, actorScope, internalQueue = []) {
|
|
|
2060
2067
|
};
|
|
2061
2068
|
}
|
|
2062
2069
|
function stopChildren(nextState, event, actorScope) {
|
|
2063
|
-
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child =>
|
|
2070
|
+
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child => stopChild(child)), []);
|
|
2064
2071
|
}
|
|
2065
2072
|
function selectTransitions(event, nextState) {
|
|
2066
2073
|
return nextState.machine.getTransitionData(nextState, event);
|
|
@@ -2279,4 +2286,4 @@ function raise(eventOrExpr, options) {
|
|
|
2279
2286
|
return raise;
|
|
2280
2287
|
}
|
|
2281
2288
|
|
|
2282
|
-
export { $$ACTOR_TYPE as $, getPersistedState as A, resolveReferencedActor as B, createActor as C, Actor as D, interpret as E, isMachineSnapshot as F, matchesState as G, pathToStateValue as H, toObserver as I, and as J, not as K, or as L, stateIn as M, NULL_EVENT as N, cancel as O, raise as P, stop as Q,
|
|
2289
|
+
export { $$ACTOR_TYPE as $, getPersistedState as A, resolveReferencedActor as B, createActor as C, Actor as D, interpret as E, isMachineSnapshot as F, matchesState as G, pathToStateValue as H, toObserver as I, and as J, not as K, or as L, stateIn as M, NULL_EVENT as N, cancel as O, raise as P, stop as Q, stopChild as R, STATE_DELIMITER as S, spawnChild as T, ProcessingStatus as U, createErrorActorEvent as V, XSTATE_ERROR as W, XSTATE_STOP as X, toTransitionConfigArray as a, formatTransition as b, createInvokeId as c, formatInitialTransition as d, evaluateGuard as e, formatTransitions as f, getDelayedTransitions as g, getCandidates as h, getAllStateNodes as i, getStateNodes as j, createMachineSnapshot as k, isInFinalState as l, mapValues as m, isErrorActorEvent as n, getAllOwnEventDescriptors as o, cloneMachineSnapshot as p, macrostep as q, resolveStateValue as r, transitionNode as s, toArray as t, resolveActionsAndContext as u, createInitEvent as v, microstep as w, getInitialStateNodes as x, isStateId as y, getStateNodeByPath as z };
|
|
@@ -941,23 +941,23 @@ function executeSpawn(actorScope, {
|
|
|
941
941
|
}
|
|
942
942
|
});
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function spawnChild(...[src, {
|
|
945
945
|
id,
|
|
946
946
|
systemId,
|
|
947
947
|
input,
|
|
948
948
|
syncSnapshot = false
|
|
949
949
|
} = {}]) {
|
|
950
|
-
function
|
|
950
|
+
function spawnChild(args, params) {
|
|
951
951
|
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
return
|
|
952
|
+
spawnChild.type = 'xstate.spawnChild';
|
|
953
|
+
spawnChild.id = id;
|
|
954
|
+
spawnChild.systemId = systemId;
|
|
955
|
+
spawnChild.src = src;
|
|
956
|
+
spawnChild.input = input;
|
|
957
|
+
spawnChild.syncSnapshot = syncSnapshot;
|
|
958
|
+
spawnChild.resolve = resolveSpawn;
|
|
959
|
+
spawnChild.execute = executeSpawn;
|
|
960
|
+
return spawnChild;
|
|
961
961
|
}
|
|
962
962
|
|
|
963
963
|
function resolveStop(_, state, args, actionParams, {
|
|
@@ -1001,20 +1001,27 @@ function executeStop(actorScope, actorRef) {
|
|
|
1001
1001
|
});
|
|
1002
1002
|
}
|
|
1003
1003
|
/**
|
|
1004
|
-
* Stops
|
|
1004
|
+
* Stops a child actor.
|
|
1005
1005
|
*
|
|
1006
1006
|
* @param actorRef The actor to stop.
|
|
1007
1007
|
*/
|
|
1008
|
-
function
|
|
1008
|
+
function stopChild(actorRef) {
|
|
1009
1009
|
function stop(args, params) {
|
|
1010
1010
|
}
|
|
1011
|
-
stop.type = 'xstate.
|
|
1011
|
+
stop.type = 'xstate.stopChild';
|
|
1012
1012
|
stop.actorRef = actorRef;
|
|
1013
1013
|
stop.resolve = resolveStop;
|
|
1014
1014
|
stop.execute = executeStop;
|
|
1015
1015
|
return stop;
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* Stops a child actor.
|
|
1020
|
+
*
|
|
1021
|
+
* @deprecated Use `stopChild(...)` instead
|
|
1022
|
+
*/
|
|
1023
|
+
const stop = stopChild;
|
|
1024
|
+
|
|
1018
1025
|
function checkStateIn(state, _, {
|
|
1019
1026
|
stateValue
|
|
1020
1027
|
}) {
|
|
@@ -1743,7 +1750,7 @@ function enterStates(currentState, event, actorScope, filteredTransitions, mutSt
|
|
|
1743
1750
|
// Add entry actions
|
|
1744
1751
|
actions.push(...stateNodeToEnter.entry);
|
|
1745
1752
|
for (const invokeDef of stateNodeToEnter.invoke) {
|
|
1746
|
-
actions.push(
|
|
1753
|
+
actions.push(spawnChild(invokeDef.src, {
|
|
1747
1754
|
...invokeDef,
|
|
1748
1755
|
syncSnapshot: !!invokeDef.onSnapshot
|
|
1749
1756
|
}));
|
|
@@ -1894,7 +1901,7 @@ function exitStates(currentState, event, actorScope, transitions, mutStateNodeSe
|
|
|
1894
1901
|
}
|
|
1895
1902
|
}
|
|
1896
1903
|
for (const s of statesToExit) {
|
|
1897
|
-
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def =>
|
|
1904
|
+
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def => stopChild(def.id))], internalQueue);
|
|
1898
1905
|
mutStateNodeSet.delete(s);
|
|
1899
1906
|
}
|
|
1900
1907
|
return [nextState, changedHistory || historyValue];
|
|
@@ -2017,7 +2024,7 @@ function macrostep(state, event, actorScope, internalQueue = []) {
|
|
|
2017
2024
|
};
|
|
2018
2025
|
}
|
|
2019
2026
|
function stopChildren(nextState, event, actorScope) {
|
|
2020
|
-
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child =>
|
|
2027
|
+
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child => stopChild(child)), []);
|
|
2021
2028
|
}
|
|
2022
2029
|
function selectTransitions(event, nextState) {
|
|
2023
2030
|
return nextState.machine.getTransitionData(nextState, event);
|
|
@@ -2270,9 +2277,10 @@ exports.raise = raise;
|
|
|
2270
2277
|
exports.resolveActionsAndContext = resolveActionsAndContext;
|
|
2271
2278
|
exports.resolveReferencedActor = resolveReferencedActor;
|
|
2272
2279
|
exports.resolveStateValue = resolveStateValue;
|
|
2273
|
-
exports.
|
|
2280
|
+
exports.spawnChild = spawnChild;
|
|
2274
2281
|
exports.stateIn = stateIn;
|
|
2275
2282
|
exports.stop = stop;
|
|
2283
|
+
exports.stopChild = stopChild;
|
|
2276
2284
|
exports.toArray = toArray;
|
|
2277
2285
|
exports.toObserver = toObserver;
|
|
2278
2286
|
exports.toTransitionConfigArray = toTransitionConfigArray;
|
|
@@ -958,26 +958,26 @@ function executeSpawn(actorScope, {
|
|
|
958
958
|
}
|
|
959
959
|
});
|
|
960
960
|
}
|
|
961
|
-
function
|
|
961
|
+
function spawnChild(...[src, {
|
|
962
962
|
id,
|
|
963
963
|
systemId,
|
|
964
964
|
input,
|
|
965
965
|
syncSnapshot = false
|
|
966
966
|
} = {}]) {
|
|
967
|
-
function
|
|
967
|
+
function spawnChild(args, params) {
|
|
968
968
|
{
|
|
969
969
|
throw new Error(`This isn't supposed to be called`);
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
return
|
|
972
|
+
spawnChild.type = 'xstate.spawnChild';
|
|
973
|
+
spawnChild.id = id;
|
|
974
|
+
spawnChild.systemId = systemId;
|
|
975
|
+
spawnChild.src = src;
|
|
976
|
+
spawnChild.input = input;
|
|
977
|
+
spawnChild.syncSnapshot = syncSnapshot;
|
|
978
|
+
spawnChild.resolve = resolveSpawn;
|
|
979
|
+
spawnChild.execute = executeSpawn;
|
|
980
|
+
return spawnChild;
|
|
981
981
|
}
|
|
982
982
|
|
|
983
983
|
function resolveStop(_, state, args, actionParams, {
|
|
@@ -1021,23 +1021,30 @@ function executeStop(actorScope, actorRef) {
|
|
|
1021
1021
|
});
|
|
1022
1022
|
}
|
|
1023
1023
|
/**
|
|
1024
|
-
* Stops
|
|
1024
|
+
* Stops a child actor.
|
|
1025
1025
|
*
|
|
1026
1026
|
* @param actorRef The actor to stop.
|
|
1027
1027
|
*/
|
|
1028
|
-
function
|
|
1028
|
+
function stopChild(actorRef) {
|
|
1029
1029
|
function stop(args, params) {
|
|
1030
1030
|
{
|
|
1031
1031
|
throw new Error(`This isn't supposed to be called`);
|
|
1032
1032
|
}
|
|
1033
1033
|
}
|
|
1034
|
-
stop.type = 'xstate.
|
|
1034
|
+
stop.type = 'xstate.stopChild';
|
|
1035
1035
|
stop.actorRef = actorRef;
|
|
1036
1036
|
stop.resolve = resolveStop;
|
|
1037
1037
|
stop.execute = executeStop;
|
|
1038
1038
|
return stop;
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
|
+
/**
|
|
1042
|
+
* Stops a child actor.
|
|
1043
|
+
*
|
|
1044
|
+
* @deprecated Use `stopChild(...)` instead
|
|
1045
|
+
*/
|
|
1046
|
+
const stop = stopChild;
|
|
1047
|
+
|
|
1041
1048
|
function checkStateIn(state, _, {
|
|
1042
1049
|
stateValue
|
|
1043
1050
|
}) {
|
|
@@ -1785,7 +1792,7 @@ function enterStates(currentState, event, actorScope, filteredTransitions, mutSt
|
|
|
1785
1792
|
// Add entry actions
|
|
1786
1793
|
actions.push(...stateNodeToEnter.entry);
|
|
1787
1794
|
for (const invokeDef of stateNodeToEnter.invoke) {
|
|
1788
|
-
actions.push(
|
|
1795
|
+
actions.push(spawnChild(invokeDef.src, {
|
|
1789
1796
|
...invokeDef,
|
|
1790
1797
|
syncSnapshot: !!invokeDef.onSnapshot
|
|
1791
1798
|
}));
|
|
@@ -1936,7 +1943,7 @@ function exitStates(currentState, event, actorScope, transitions, mutStateNodeSe
|
|
|
1936
1943
|
}
|
|
1937
1944
|
}
|
|
1938
1945
|
for (const s of statesToExit) {
|
|
1939
|
-
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def =>
|
|
1946
|
+
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def => stopChild(def.id))], internalQueue);
|
|
1940
1947
|
mutStateNodeSet.delete(s);
|
|
1941
1948
|
}
|
|
1942
1949
|
return [nextState, changedHistory || historyValue];
|
|
@@ -2062,7 +2069,7 @@ function macrostep(state, event, actorScope, internalQueue = []) {
|
|
|
2062
2069
|
};
|
|
2063
2070
|
}
|
|
2064
2071
|
function stopChildren(nextState, event, actorScope) {
|
|
2065
|
-
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child =>
|
|
2072
|
+
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child => stopChild(child)), []);
|
|
2066
2073
|
}
|
|
2067
2074
|
function selectTransitions(event, nextState) {
|
|
2068
2075
|
return nextState.machine.getTransitionData(nextState, event);
|
|
@@ -2324,9 +2331,10 @@ exports.raise = raise;
|
|
|
2324
2331
|
exports.resolveActionsAndContext = resolveActionsAndContext;
|
|
2325
2332
|
exports.resolveReferencedActor = resolveReferencedActor;
|
|
2326
2333
|
exports.resolveStateValue = resolveStateValue;
|
|
2327
|
-
exports.
|
|
2334
|
+
exports.spawnChild = spawnChild;
|
|
2328
2335
|
exports.stateIn = stateIn;
|
|
2329
2336
|
exports.stop = stop;
|
|
2337
|
+
exports.stopChild = stopChild;
|
|
2330
2338
|
exports.toArray = toArray;
|
|
2331
2339
|
exports.toObserver = toObserver;
|
|
2332
2340
|
exports.toTransitionConfigArray = toTransitionConfigArray;
|
|
@@ -939,23 +939,23 @@ function executeSpawn(actorScope, {
|
|
|
939
939
|
}
|
|
940
940
|
});
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function spawnChild(...[src, {
|
|
943
943
|
id,
|
|
944
944
|
systemId,
|
|
945
945
|
input,
|
|
946
946
|
syncSnapshot = false
|
|
947
947
|
} = {}]) {
|
|
948
|
-
function
|
|
948
|
+
function spawnChild(args, params) {
|
|
949
949
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
return
|
|
950
|
+
spawnChild.type = 'xstate.spawnChild';
|
|
951
|
+
spawnChild.id = id;
|
|
952
|
+
spawnChild.systemId = systemId;
|
|
953
|
+
spawnChild.src = src;
|
|
954
|
+
spawnChild.input = input;
|
|
955
|
+
spawnChild.syncSnapshot = syncSnapshot;
|
|
956
|
+
spawnChild.resolve = resolveSpawn;
|
|
957
|
+
spawnChild.execute = executeSpawn;
|
|
958
|
+
return spawnChild;
|
|
959
959
|
}
|
|
960
960
|
|
|
961
961
|
function resolveStop(_, state, args, actionParams, {
|
|
@@ -999,20 +999,27 @@ function executeStop(actorScope, actorRef) {
|
|
|
999
999
|
});
|
|
1000
1000
|
}
|
|
1001
1001
|
/**
|
|
1002
|
-
* Stops
|
|
1002
|
+
* Stops a child actor.
|
|
1003
1003
|
*
|
|
1004
1004
|
* @param actorRef The actor to stop.
|
|
1005
1005
|
*/
|
|
1006
|
-
function
|
|
1006
|
+
function stopChild(actorRef) {
|
|
1007
1007
|
function stop(args, params) {
|
|
1008
1008
|
}
|
|
1009
|
-
stop.type = 'xstate.
|
|
1009
|
+
stop.type = 'xstate.stopChild';
|
|
1010
1010
|
stop.actorRef = actorRef;
|
|
1011
1011
|
stop.resolve = resolveStop;
|
|
1012
1012
|
stop.execute = executeStop;
|
|
1013
1013
|
return stop;
|
|
1014
1014
|
}
|
|
1015
1015
|
|
|
1016
|
+
/**
|
|
1017
|
+
* Stops a child actor.
|
|
1018
|
+
*
|
|
1019
|
+
* @deprecated Use `stopChild(...)` instead
|
|
1020
|
+
*/
|
|
1021
|
+
const stop = stopChild;
|
|
1022
|
+
|
|
1016
1023
|
function checkStateIn(state, _, {
|
|
1017
1024
|
stateValue
|
|
1018
1025
|
}) {
|
|
@@ -1741,7 +1748,7 @@ function enterStates(currentState, event, actorScope, filteredTransitions, mutSt
|
|
|
1741
1748
|
// Add entry actions
|
|
1742
1749
|
actions.push(...stateNodeToEnter.entry);
|
|
1743
1750
|
for (const invokeDef of stateNodeToEnter.invoke) {
|
|
1744
|
-
actions.push(
|
|
1751
|
+
actions.push(spawnChild(invokeDef.src, {
|
|
1745
1752
|
...invokeDef,
|
|
1746
1753
|
syncSnapshot: !!invokeDef.onSnapshot
|
|
1747
1754
|
}));
|
|
@@ -1892,7 +1899,7 @@ function exitStates(currentState, event, actorScope, transitions, mutStateNodeSe
|
|
|
1892
1899
|
}
|
|
1893
1900
|
}
|
|
1894
1901
|
for (const s of statesToExit) {
|
|
1895
|
-
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def =>
|
|
1902
|
+
nextState = resolveActionsAndContext(nextState, event, actorScope, [...s.exit, ...s.invoke.map(def => stopChild(def.id))], internalQueue);
|
|
1896
1903
|
mutStateNodeSet.delete(s);
|
|
1897
1904
|
}
|
|
1898
1905
|
return [nextState, changedHistory || historyValue];
|
|
@@ -2015,7 +2022,7 @@ function macrostep(state, event, actorScope, internalQueue = []) {
|
|
|
2015
2022
|
};
|
|
2016
2023
|
}
|
|
2017
2024
|
function stopChildren(nextState, event, actorScope) {
|
|
2018
|
-
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child =>
|
|
2025
|
+
return resolveActionsAndContext(nextState, event, actorScope, Object.values(nextState.children).map(child => stopChild(child)), []);
|
|
2019
2026
|
}
|
|
2020
2027
|
function selectTransitions(event, nextState) {
|
|
2021
2028
|
return nextState.machine.getTransitionData(nextState, event);
|
|
@@ -2225,4 +2232,4 @@ function raise(eventOrExpr, options) {
|
|
|
2225
2232
|
return raise;
|
|
2226
2233
|
}
|
|
2227
2234
|
|
|
2228
|
-
export { $$ACTOR_TYPE as $, getPersistedState as A, resolveReferencedActor as B, createActor as C, Actor as D, interpret as E, isMachineSnapshot as F, matchesState as G, pathToStateValue as H, toObserver as I, and as J, not as K, or as L, stateIn as M, NULL_EVENT as N, cancel as O, raise as P, stop as Q,
|
|
2235
|
+
export { $$ACTOR_TYPE as $, getPersistedState as A, resolveReferencedActor as B, createActor as C, Actor as D, interpret as E, isMachineSnapshot as F, matchesState as G, pathToStateValue as H, toObserver as I, and as J, not as K, or as L, stateIn as M, NULL_EVENT as N, cancel as O, raise as P, stop as Q, stopChild as R, STATE_DELIMITER as S, spawnChild as T, ProcessingStatus as U, createErrorActorEvent as V, XSTATE_ERROR as W, XSTATE_STOP as X, toTransitionConfigArray as a, formatTransition as b, createInvokeId as c, formatInitialTransition as d, evaluateGuard as e, formatTransitions as f, getDelayedTransitions as g, getCandidates as h, getAllStateNodes as i, getStateNodes as j, createMachineSnapshot as k, isInFinalState as l, mapValues as m, isErrorActorEvent as n, getAllOwnEventDescriptors as o, cloneMachineSnapshot as p, macrostep as q, resolveStateValue as r, transitionNode as s, toArray as t, resolveActionsAndContext as u, createInitEvent as v, microstep as w, getInitialStateNodes as x, isStateId as y, getStateNodeByPath as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as ProcessingStatus, V as createErrorActorEvent, B as resolveReferencedActor, C as createActor, p as cloneMachineSnapshot, e as evaluateGuard, t as toArray, W as XSTATE_ERROR } from './raise-156f5f68.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as ProcessingStatus, V as createErrorActorEvent, B as resolveReferencedActor, C as createActor, p as cloneMachineSnapshot, e as evaluateGuard, t as toArray, W as XSTATE_ERROR } from './raise-91ec8b4f.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
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 send = require('./send-
|
|
6
|
+
var guards_dist_xstateGuards = require('./raise-7af24c22.cjs.js');
|
|
7
|
+
var send = require('./send-401f5c30.cjs.js');
|
|
8
8
|
require('../dev/dist/xstate-dev.cjs.js');
|
|
9
9
|
|
|
10
10
|
class SimulatedClock {
|
|
@@ -720,9 +720,10 @@ exports.not = guards_dist_xstateGuards.not;
|
|
|
720
720
|
exports.or = guards_dist_xstateGuards.or;
|
|
721
721
|
exports.pathToStateValue = guards_dist_xstateGuards.pathToStateValue;
|
|
722
722
|
exports.raise = guards_dist_xstateGuards.raise;
|
|
723
|
-
exports.
|
|
723
|
+
exports.spawnChild = guards_dist_xstateGuards.spawnChild;
|
|
724
724
|
exports.stateIn = guards_dist_xstateGuards.stateIn;
|
|
725
725
|
exports.stop = guards_dist_xstateGuards.stop;
|
|
726
|
+
exports.stopChild = guards_dist_xstateGuards.stopChild;
|
|
726
727
|
exports.toObserver = guards_dist_xstateGuards.toObserver;
|
|
727
728
|
exports.SpecialTargets = send.SpecialTargets;
|
|
728
729
|
exports.assign = send.assign;
|
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 send = require('./send-
|
|
6
|
+
var guards_dist_xstateGuards = require('./raise-7dc97582.development.cjs.js');
|
|
7
|
+
var send = require('./send-bc0d3e22.development.cjs.js');
|
|
8
8
|
require('../dev/dist/xstate-dev.development.cjs.js');
|
|
9
9
|
|
|
10
10
|
class SimulatedClock {
|
|
@@ -726,9 +726,10 @@ exports.not = guards_dist_xstateGuards.not;
|
|
|
726
726
|
exports.or = guards_dist_xstateGuards.or;
|
|
727
727
|
exports.pathToStateValue = guards_dist_xstateGuards.pathToStateValue;
|
|
728
728
|
exports.raise = guards_dist_xstateGuards.raise;
|
|
729
|
-
exports.
|
|
729
|
+
exports.spawnChild = guards_dist_xstateGuards.spawnChild;
|
|
730
730
|
exports.stateIn = guards_dist_xstateGuards.stateIn;
|
|
731
731
|
exports.stop = guards_dist_xstateGuards.stop;
|
|
732
|
+
exports.stopChild = guards_dist_xstateGuards.stopChild;
|
|
732
733
|
exports.toObserver = guards_dist_xstateGuards.toObserver;
|
|
733
734
|
exports.SpecialTargets = send.SpecialTargets;
|
|
734
735
|
exports.assign = send.assign;
|
|
@@ -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 isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-
|
|
3
|
-
export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise,
|
|
4
|
-
import { a as assign } from './send-
|
|
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, b as sendTo } from './send-
|
|
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 isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-156f5f68.development.esm.js';
|
|
3
|
+
export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise, T as spawnChild, M as stateIn, Q as stop, R as stopChild, I as toObserver } from './raise-156f5f68.development.esm.js';
|
|
4
|
+
import { a as assign } from './send-7489590c.development.esm.js';
|
|
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, b as sendTo } from './send-7489590c.development.esm.js';
|
|
6
6
|
import '../dev/dist/xstate-dev.development.esm.js';
|
|
7
7
|
|
|
8
8
|
class SimulatedClock {
|
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 isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-
|
|
3
|
-
export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise,
|
|
4
|
-
import { a as assign } from './send-
|
|
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, b as sendTo } from './send-
|
|
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 isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-91ec8b4f.esm.js';
|
|
3
|
+
export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise, T as spawnChild, M as stateIn, Q as stop, R as stopChild, I as toObserver } from './raise-91ec8b4f.esm.js';
|
|
4
|
+
import { a as assign } from './send-ed326064.esm.js';
|
|
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, b as sendTo } from './send-ed326064.esm.js';
|
|
6
6
|
import '../dev/dist/xstate-dev.esm.js';
|
|
7
7
|
|
|
8
8
|
class SimulatedClock {
|