xstate 5.0.0-beta.40 → 5.0.0-beta.42
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 +3 -3
- package/actions/dist/xstate-actions.development.cjs.js +3 -3
- package/actions/dist/xstate-actions.development.esm.js +3 -3
- package/actions/dist/xstate-actions.esm.js +3 -3
- 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/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/declarations/src/State.d.ts +36 -43
- package/dist/declarations/src/StateMachine.d.ts +13 -30
- package/dist/declarations/src/StateNode.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +4 -5
- package/dist/declarations/src/interpreter.d.ts +14 -10
- package/dist/declarations/src/stateUtils.d.ts +7 -8
- package/dist/declarations/src/types.d.ts +114 -22
- package/dist/{interpreter-bae5c279.development.cjs.js → interpreter-23e4041c.development.cjs.js} +49 -42
- package/dist/{interpreter-ed0fac7e.esm.js → interpreter-3d0c0ff2.esm.js} +49 -40
- package/dist/{interpreter-586abde4.cjs.js → interpreter-b6bdd134.cjs.js} +49 -42
- package/dist/{interpreter-410d7ca9.development.esm.js → interpreter-f2620ea7.development.esm.js} +49 -40
- package/dist/{raise-37f9f3b8.development.esm.js → raise-51ae36e5.development.esm.js} +84 -183
- package/dist/{raise-27909189.cjs.js → raise-6b64c553.cjs.js} +81 -181
- package/dist/{raise-8325e2df.development.cjs.js → raise-8f482ce9.development.cjs.js} +85 -185
- package/dist/{raise-2b2fdec3.esm.js → raise-d2084327.esm.js} +80 -179
- package/dist/{send-59f66c58.esm.js → send-4e732fa5.esm.js} +7 -6
- package/dist/{send-f6b49072.development.esm.js → send-7a350091.development.esm.js} +7 -6
- package/dist/{send-4fdf275e.cjs.js → send-85b562d8.cjs.js} +7 -6
- package/dist/{send-c45d0d2c.development.cjs.js → send-cc8f864e.development.cjs.js} +7 -6
- package/dist/xstate.cjs.js +27 -56
- package/dist/xstate.cjs.mjs +0 -4
- package/dist/xstate.development.cjs.js +27 -56
- package/dist/xstate.development.cjs.mjs +0 -4
- package/dist/xstate.development.esm.js +31 -56
- package/dist/xstate.esm.js +31 -56
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.esm.js +2 -2
- package/guards/dist/xstate-guards.esm.js +2 -2
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/declarations/src/mapState.d.ts +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveReferencedActor, d as createActor,
|
|
1
|
+
import { r as resolveReferencedActor, d as createActor, P as ProcessingStatus, h as createErrorActorEvent, j as STATE_IDENTIFIER, n as normalizeTarget, t as toArray, N as NULL_EVENT, a as toTransitionConfigArray, S as STATE_DELIMITER, k as toStatePath, l as createDoneStateEvent, o as resolveOutput, X as XSTATE_STOP, q as XSTATE_INIT, W as WILDCARD, s as createAfterEvent, u as flatten, f as matchesState, $ as $$ACTOR_TYPE } from './interpreter-3d0c0ff2.esm.js';
|
|
2
2
|
|
|
3
3
|
const cache = new WeakMap();
|
|
4
4
|
function memo(object, key, fn) {
|
|
@@ -58,7 +58,7 @@ function resolveSpawn(actorScope, state, actionArgs, _actionParams, {
|
|
|
58
58
|
const configuredInput = input || referenced.input;
|
|
59
59
|
actorRef = createActor(referenced.src, {
|
|
60
60
|
id: resolvedId,
|
|
61
|
-
src
|
|
61
|
+
src,
|
|
62
62
|
parent: actorScope?.self,
|
|
63
63
|
systemId,
|
|
64
64
|
input: typeof configuredInput === 'function' ? configuredInput({
|
|
@@ -81,7 +81,7 @@ function resolveSpawn(actorScope, state, actionArgs, _actionParams, {
|
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
return [
|
|
84
|
+
return [cloneMachineSnapshot(state, {
|
|
85
85
|
children: {
|
|
86
86
|
...state.children,
|
|
87
87
|
[resolvedId]: actorRef
|
|
@@ -99,7 +99,7 @@ function executeSpawn(actorScope, {
|
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
101
|
actorScope.defer(() => {
|
|
102
|
-
if (actorRef.
|
|
102
|
+
if (actorRef._processingStatus === ProcessingStatus.Stopped) {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
try {
|
|
@@ -141,7 +141,7 @@ function resolveStop(_, state, args, actionParams, {
|
|
|
141
141
|
};
|
|
142
142
|
delete children[resolvedActorRef.id];
|
|
143
143
|
}
|
|
144
|
-
return [
|
|
144
|
+
return [cloneMachineSnapshot(state, {
|
|
145
145
|
children
|
|
146
146
|
}), resolvedActorRef];
|
|
147
147
|
}
|
|
@@ -157,7 +157,7 @@ function executeStop(actorScope, actorRef) {
|
|
|
157
157
|
|
|
158
158
|
// this allows us to prevent an actor from being started if it gets stopped within the same macrostep
|
|
159
159
|
// this can happen, for example, when the invoking state is being exited immediately by an always transition
|
|
160
|
-
if (actorRef.
|
|
160
|
+
if (actorRef._processingStatus !== ProcessingStatus.Running) {
|
|
161
161
|
actorScope.stopChild(actorRef);
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
@@ -652,10 +652,9 @@ function getStateNodeByPath(stateNode, statePath) {
|
|
|
652
652
|
/**
|
|
653
653
|
* Returns the state nodes represented by the current state value.
|
|
654
654
|
*
|
|
655
|
-
* @param
|
|
655
|
+
* @param stateValue The state value or State instance
|
|
656
656
|
*/
|
|
657
|
-
function getStateNodes(stateNode,
|
|
658
|
-
const stateValue = state instanceof State ? state.value : toStateValue(state);
|
|
657
|
+
function getStateNodes(stateNode, stateValue) {
|
|
659
658
|
if (typeof stateValue === 'string') {
|
|
660
659
|
return [stateNode, stateNode.states[stateValue]];
|
|
661
660
|
}
|
|
@@ -876,7 +875,7 @@ function microstep(transitions, currentState, actorScope, event, isInitial, inte
|
|
|
876
875
|
if (historyValue === currentState.historyValue && areConfigurationsEqual(currentState.configuration, mutConfiguration)) {
|
|
877
876
|
return nextState;
|
|
878
877
|
}
|
|
879
|
-
return
|
|
878
|
+
return cloneMachineSnapshot(nextState, {
|
|
880
879
|
configuration: nextConfiguration,
|
|
881
880
|
historyValue
|
|
882
881
|
});
|
|
@@ -940,9 +939,9 @@ function enterStates(currentState, event, actorScope, filteredTransitions, mutCo
|
|
|
940
939
|
if (ancestorMarker) {
|
|
941
940
|
continue;
|
|
942
941
|
}
|
|
943
|
-
nextState =
|
|
942
|
+
nextState = cloneMachineSnapshot(nextState, {
|
|
944
943
|
status: 'done',
|
|
945
|
-
output: getMachineOutput(nextState, event, actorScope,
|
|
944
|
+
output: getMachineOutput(nextState, event, actorScope, nextState.machine.root, rootCompletionNode)
|
|
946
945
|
});
|
|
947
946
|
}
|
|
948
947
|
}
|
|
@@ -1096,7 +1095,7 @@ function resolveActionsAndContextWorker(currentState, event, actorScope, actions
|
|
|
1096
1095
|
event
|
|
1097
1096
|
}) : action.params : undefined;
|
|
1098
1097
|
if (!('resolve' in resolvedAction)) {
|
|
1099
|
-
if (actorScope?.self.
|
|
1098
|
+
if (actorScope?.self._processingStatus === ProcessingStatus.Running) {
|
|
1100
1099
|
resolvedAction(actionArgs, actionParams);
|
|
1101
1100
|
} else {
|
|
1102
1101
|
actorScope?.defer(() => {
|
|
@@ -1114,7 +1113,7 @@ function resolveActionsAndContextWorker(currentState, event, actorScope, actions
|
|
|
1114
1113
|
retries?.push([builtinAction, params]);
|
|
1115
1114
|
}
|
|
1116
1115
|
if ('execute' in builtinAction) {
|
|
1117
|
-
if (actorScope?.self.
|
|
1116
|
+
if (actorScope?.self._processingStatus === ProcessingStatus.Running) {
|
|
1118
1117
|
builtinAction.execute(actorScope, params);
|
|
1119
1118
|
} else {
|
|
1120
1119
|
actorScope?.defer(builtinAction.execute.bind(null, actorScope, params));
|
|
@@ -1143,7 +1142,7 @@ function macrostep(state, event, actorScope, internalQueue = []) {
|
|
|
1143
1142
|
|
|
1144
1143
|
// Handle stop event
|
|
1145
1144
|
if (event.type === XSTATE_STOP) {
|
|
1146
|
-
nextState =
|
|
1145
|
+
nextState = cloneMachineSnapshot(stopChildren(nextState, event, actorScope), {
|
|
1147
1146
|
status: 'stopped'
|
|
1148
1147
|
});
|
|
1149
1148
|
states.push(nextState);
|
|
@@ -1221,188 +1220,90 @@ function resolveStateValue(rootNode, stateValue) {
|
|
|
1221
1220
|
const configuration = getConfiguration(getStateNodes(rootNode, stateValue));
|
|
1222
1221
|
return getStateValue(rootNode, [...configuration]);
|
|
1223
1222
|
}
|
|
1224
|
-
function getInitialConfiguration(rootNode) {
|
|
1225
|
-
const configuration = [];
|
|
1226
|
-
const initialTransition = rootNode.initial;
|
|
1227
|
-
const statesToEnter = new Set();
|
|
1228
|
-
const statesForDefaultEntry = new Set([rootNode]);
|
|
1229
|
-
computeEntrySet([initialTransition], {}, statesForDefaultEntry, statesToEnter);
|
|
1230
|
-
for (const stateNodeToEnter of [...statesToEnter].sort((a, b) => a.order - b.order)) {
|
|
1231
|
-
configuration.push(stateNodeToEnter);
|
|
1232
|
-
}
|
|
1233
|
-
return configuration;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
class State {
|
|
1237
|
-
/**
|
|
1238
|
-
* Indicates whether the state is a final state.
|
|
1239
|
-
*/
|
|
1240
|
-
|
|
1241
|
-
/**
|
|
1242
|
-
* The output data of the top-level finite state.
|
|
1243
|
-
*/
|
|
1244
|
-
|
|
1245
|
-
/**
|
|
1246
|
-
* The enabled state nodes representative of the state value.
|
|
1247
|
-
*/
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* An object mapping actor names to spawned/invoked actors.
|
|
1251
|
-
*/
|
|
1252
|
-
|
|
1253
|
-
/**
|
|
1254
|
-
* Creates a new State instance for the given `stateValue` and `context`.
|
|
1255
|
-
* @param stateValue
|
|
1256
|
-
* @param context
|
|
1257
|
-
*/
|
|
1258
|
-
static from(stateValue, context = {}, machine) {
|
|
1259
|
-
if (stateValue instanceof State) {
|
|
1260
|
-
if (stateValue.context !== context) {
|
|
1261
|
-
return new State({
|
|
1262
|
-
value: stateValue.value,
|
|
1263
|
-
context,
|
|
1264
|
-
meta: {},
|
|
1265
|
-
configuration: [],
|
|
1266
|
-
// TODO: fix,
|
|
1267
|
-
children: {},
|
|
1268
|
-
status: 'active'
|
|
1269
|
-
}, machine);
|
|
1270
|
-
}
|
|
1271
|
-
return stateValue;
|
|
1272
|
-
}
|
|
1273
|
-
const configuration = getConfiguration(getStateNodes(machine.root, stateValue));
|
|
1274
|
-
return new State({
|
|
1275
|
-
value: stateValue,
|
|
1276
|
-
context,
|
|
1277
|
-
meta: undefined,
|
|
1278
|
-
configuration: Array.from(configuration),
|
|
1279
|
-
children: {},
|
|
1280
|
-
status: 'active'
|
|
1281
|
-
}, machine);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Creates a new `State` instance that represents the current state of a running machine.
|
|
1286
|
-
*
|
|
1287
|
-
* @param config
|
|
1288
|
-
*/
|
|
1289
|
-
constructor(config, machine) {
|
|
1290
|
-
this.machine = machine;
|
|
1291
|
-
this.tags = void 0;
|
|
1292
|
-
this.value = void 0;
|
|
1293
|
-
this.status = void 0;
|
|
1294
|
-
this.error = void 0;
|
|
1295
|
-
this.context = void 0;
|
|
1296
|
-
this.historyValue = {};
|
|
1297
|
-
this.configuration = void 0;
|
|
1298
|
-
this.children = void 0;
|
|
1299
|
-
this.context = config.context;
|
|
1300
|
-
this.historyValue = config.historyValue || {};
|
|
1301
|
-
this.matches = this.matches.bind(this);
|
|
1302
|
-
this.toStrings = this.toStrings.bind(this);
|
|
1303
|
-
this.configuration = config.configuration ?? Array.from(getConfiguration(getStateNodes(machine.root, config.value)));
|
|
1304
|
-
this.children = config.children;
|
|
1305
|
-
this.value = getStateValue(machine.root, this.configuration);
|
|
1306
|
-
this.tags = new Set(flatten(this.configuration.map(sn => sn.tags)));
|
|
1307
|
-
this.status = config.status;
|
|
1308
|
-
this.output = config.output;
|
|
1309
|
-
this.error = config.error;
|
|
1310
|
-
}
|
|
1311
1223
|
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1224
|
+
function createMachineSnapshot(config, machine) {
|
|
1225
|
+
return {
|
|
1226
|
+
status: config.status,
|
|
1227
|
+
output: config.output,
|
|
1228
|
+
error: config.error,
|
|
1229
|
+
machine,
|
|
1230
|
+
context: config.context,
|
|
1231
|
+
configuration: config.configuration,
|
|
1232
|
+
value: getStateValue(machine.root, config.configuration),
|
|
1233
|
+
tags: new Set(flatten(config.configuration.map(sn => sn.tags))),
|
|
1234
|
+
children: config.children,
|
|
1235
|
+
historyValue: config.historyValue || {},
|
|
1236
|
+
matches(parentStateValue) {
|
|
1237
|
+
return matchesState(parentStateValue, this.value);
|
|
1238
|
+
},
|
|
1239
|
+
hasTag(tag) {
|
|
1240
|
+
return this.tags.has(tag);
|
|
1241
|
+
},
|
|
1242
|
+
can(event) {
|
|
1243
|
+
const transitionData = this.machine.getTransitionData(this, event);
|
|
1244
|
+
return !!transitionData?.length &&
|
|
1245
|
+
// Check that at least one transition is not forbidden
|
|
1246
|
+
transitionData.some(t => t.target !== undefined || t.actions.length);
|
|
1247
|
+
},
|
|
1248
|
+
get nextEvents() {
|
|
1249
|
+
return memo(this, 'nextEvents', () => {
|
|
1250
|
+
return [...new Set(flatten([...this.configuration.map(sn => sn.ownEvents)]))];
|
|
1251
|
+
});
|
|
1252
|
+
},
|
|
1253
|
+
get meta() {
|
|
1254
|
+
return this.configuration.reduce((acc, stateNode) => {
|
|
1255
|
+
if (stateNode.meta !== undefined) {
|
|
1256
|
+
acc[stateNode.id] = stateNode.meta;
|
|
1257
|
+
}
|
|
1258
|
+
return acc;
|
|
1259
|
+
}, {});
|
|
1260
|
+
},
|
|
1261
|
+
toJSON() {
|
|
1262
|
+
const {
|
|
1263
|
+
configuration,
|
|
1264
|
+
tags,
|
|
1265
|
+
machine,
|
|
1266
|
+
nextEvents,
|
|
1267
|
+
toJSON,
|
|
1268
|
+
can,
|
|
1269
|
+
hasTag,
|
|
1270
|
+
matches,
|
|
1271
|
+
...jsonValues
|
|
1272
|
+
} = this;
|
|
1273
|
+
return {
|
|
1274
|
+
...jsonValues,
|
|
1275
|
+
tags: Array.from(tags)
|
|
1276
|
+
};
|
|
1320
1277
|
}
|
|
1321
|
-
|
|
1322
|
-
return valueKeys.concat(...valueKeys.map(key => this.toStrings(stateValue[key]).map(s => key + STATE_DELIMITER + s)));
|
|
1323
|
-
}
|
|
1324
|
-
toJSON() {
|
|
1325
|
-
const {
|
|
1326
|
-
configuration,
|
|
1327
|
-
tags,
|
|
1328
|
-
machine,
|
|
1329
|
-
...jsonValues
|
|
1330
|
-
} = this;
|
|
1331
|
-
return {
|
|
1332
|
-
...jsonValues,
|
|
1333
|
-
tags: Array.from(tags),
|
|
1334
|
-
meta: this.meta
|
|
1335
|
-
};
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
/**
|
|
1339
|
-
* Whether the current state value is a subset of the given parent state value.
|
|
1340
|
-
* @param parentStateValue
|
|
1341
|
-
*/
|
|
1342
|
-
matches(parentStateValue) {
|
|
1343
|
-
return matchesState(parentStateValue, this.value);
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
/**
|
|
1347
|
-
* Whether the current state configuration has a state node with the specified `tag`.
|
|
1348
|
-
* @param tag
|
|
1349
|
-
*/
|
|
1350
|
-
hasTag(tag) {
|
|
1351
|
-
return this.tags.has(tag);
|
|
1352
|
-
}
|
|
1353
|
-
|
|
1354
|
-
/**
|
|
1355
|
-
* Determines whether sending the `event` will cause a non-forbidden transition
|
|
1356
|
-
* to be selected, even if the transitions have no actions nor
|
|
1357
|
-
* change the state value.
|
|
1358
|
-
*
|
|
1359
|
-
* @param event The event to test
|
|
1360
|
-
* @returns Whether the event will cause a transition
|
|
1361
|
-
*/
|
|
1362
|
-
can(event) {
|
|
1363
|
-
const transitionData = this.machine.getTransitionData(this, event);
|
|
1364
|
-
return !!transitionData?.length &&
|
|
1365
|
-
// Check that at least one transition is not forbidden
|
|
1366
|
-
transitionData.some(t => t.target !== undefined || t.actions.length);
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
/**
|
|
1370
|
-
* The next events that will cause a transition from the current state.
|
|
1371
|
-
*/
|
|
1372
|
-
get nextEvents() {
|
|
1373
|
-
return memo(this, 'nextEvents', () => {
|
|
1374
|
-
return [...new Set(flatten([...this.configuration.map(sn => sn.ownEvents)]))];
|
|
1375
|
-
});
|
|
1376
|
-
}
|
|
1377
|
-
get meta() {
|
|
1378
|
-
return this.configuration.reduce((acc, stateNode) => {
|
|
1379
|
-
if (stateNode.meta !== undefined) {
|
|
1380
|
-
acc[stateNode.id] = stateNode.meta;
|
|
1381
|
-
}
|
|
1382
|
-
return acc;
|
|
1383
|
-
}, {});
|
|
1384
|
-
}
|
|
1278
|
+
};
|
|
1385
1279
|
}
|
|
1386
|
-
function
|
|
1387
|
-
return
|
|
1280
|
+
function cloneMachineSnapshot(state, config = {}) {
|
|
1281
|
+
return createMachineSnapshot(
|
|
1282
|
+
// TODO: it's wasteful that this spread triggers getters
|
|
1283
|
+
{
|
|
1388
1284
|
...state,
|
|
1389
1285
|
...config
|
|
1390
1286
|
}, state.machine);
|
|
1391
1287
|
}
|
|
1392
|
-
function getPersistedState(state) {
|
|
1288
|
+
function getPersistedState(state, options) {
|
|
1393
1289
|
const {
|
|
1394
1290
|
configuration,
|
|
1395
1291
|
tags,
|
|
1396
1292
|
machine,
|
|
1397
1293
|
children,
|
|
1398
1294
|
context,
|
|
1295
|
+
can,
|
|
1296
|
+
hasTag,
|
|
1297
|
+
matches,
|
|
1298
|
+
toJSON,
|
|
1299
|
+
nextEvents,
|
|
1399
1300
|
...jsonValues
|
|
1400
1301
|
} = state;
|
|
1401
1302
|
const childrenJson = {};
|
|
1402
1303
|
for (const id in children) {
|
|
1403
1304
|
const child = children[id];
|
|
1404
1305
|
childrenJson[id] = {
|
|
1405
|
-
state: child.getPersistedState(),
|
|
1306
|
+
state: child.getPersistedState(options),
|
|
1406
1307
|
src: child.src,
|
|
1407
1308
|
systemId: child._systemId
|
|
1408
1309
|
};
|
|
@@ -1493,4 +1394,4 @@ function raise(eventOrExpr, options) {
|
|
|
1493
1394
|
return raise;
|
|
1494
1395
|
}
|
|
1495
1396
|
|
|
1496
|
-
export { raise as A, stop as B, spawn as C,
|
|
1397
|
+
export { raise as A, stop as B, spawn as C, formatTransition as a, formatInitialTransition as b, getCandidates as c, getConfiguration as d, evaluateGuard as e, formatTransitions as f, getDelayedTransitions as g, getStateNodes as h, createMachineSnapshot as i, isInFinalState as j, cloneMachineSnapshot as k, macrostep as l, memo as m, resolveActionsAndContext as n, microstep as o, getInitialStateNodes as p, isStateId as q, resolveStateValue as r, getStateNodeByPath as s, transitionNode as t, getPersistedState as u, and as v, not as w, or as x, stateIn as y, cancel as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { k as cloneMachineSnapshot, e as evaluateGuard } from './raise-d2084327.esm.js';
|
|
2
|
+
import { P as ProcessingStatus, h as createErrorActorEvent, r as resolveReferencedActor, d as createActor, t as toArray, v as XSTATE_ERROR } from './interpreter-3d0c0ff2.esm.js';
|
|
3
3
|
|
|
4
4
|
function createSpawner(actorScope, {
|
|
5
5
|
machine,
|
|
@@ -44,12 +44,11 @@ function createSpawner(actorScope, {
|
|
|
44
44
|
}
|
|
45
45
|
return actorRef;
|
|
46
46
|
} else {
|
|
47
|
-
// TODO: this should also receive `src`
|
|
48
47
|
const actorRef = createActor(src, {
|
|
49
48
|
id: options.id,
|
|
50
49
|
parent: actorScope.self,
|
|
51
50
|
input: options.input,
|
|
52
|
-
src
|
|
51
|
+
src,
|
|
53
52
|
systemId
|
|
54
53
|
});
|
|
55
54
|
if (options.syncSnapshot) {
|
|
@@ -73,7 +72,7 @@ function createSpawner(actorScope, {
|
|
|
73
72
|
const actorRef = spawn(src, options); // TODO: fix types
|
|
74
73
|
spawnedChildren[actorRef.id] = actorRef;
|
|
75
74
|
actorScope.defer(() => {
|
|
76
|
-
if (actorRef.
|
|
75
|
+
if (actorRef._processingStatus === ProcessingStatus.Stopped) {
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
try {
|
|
@@ -111,7 +110,7 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
const updatedContext = Object.assign({}, state.context, partialUpdate);
|
|
114
|
-
return [
|
|
113
|
+
return [cloneMachineSnapshot(state, {
|
|
115
114
|
context: updatedContext,
|
|
116
115
|
children: Object.keys(spawnedChildren).length ? {
|
|
117
116
|
...state.children,
|
|
@@ -246,6 +245,8 @@ function pure(getActions) {
|
|
|
246
245
|
|
|
247
246
|
// TODO: remove once TS fixes this type-widening issue
|
|
248
247
|
|
|
248
|
+
// TODO: replace with AnyMachineSnapshot
|
|
249
|
+
|
|
249
250
|
// TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
|
|
250
251
|
|
|
251
252
|
let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { k as cloneMachineSnapshot, e as evaluateGuard } from './raise-51ae36e5.development.esm.js';
|
|
2
|
+
import { P as ProcessingStatus, h as createErrorActorEvent, r as resolveReferencedActor, d as createActor, t as toArray, v as XSTATE_ERROR } from './interpreter-f2620ea7.development.esm.js';
|
|
3
3
|
|
|
4
4
|
function createSpawner(actorScope, {
|
|
5
5
|
machine,
|
|
@@ -44,12 +44,11 @@ function createSpawner(actorScope, {
|
|
|
44
44
|
}
|
|
45
45
|
return actorRef;
|
|
46
46
|
} else {
|
|
47
|
-
// TODO: this should also receive `src`
|
|
48
47
|
const actorRef = createActor(src, {
|
|
49
48
|
id: options.id,
|
|
50
49
|
parent: actorScope.self,
|
|
51
50
|
input: options.input,
|
|
52
|
-
src
|
|
51
|
+
src,
|
|
53
52
|
systemId
|
|
54
53
|
});
|
|
55
54
|
if (options.syncSnapshot) {
|
|
@@ -73,7 +72,7 @@ function createSpawner(actorScope, {
|
|
|
73
72
|
const actorRef = spawn(src, options); // TODO: fix types
|
|
74
73
|
spawnedChildren[actorRef.id] = actorRef;
|
|
75
74
|
actorScope.defer(() => {
|
|
76
|
-
if (actorRef.
|
|
75
|
+
if (actorRef._processingStatus === ProcessingStatus.Stopped) {
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
try {
|
|
@@ -111,7 +110,7 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
const updatedContext = Object.assign({}, state.context, partialUpdate);
|
|
114
|
-
return [
|
|
113
|
+
return [cloneMachineSnapshot(state, {
|
|
115
114
|
context: updatedContext,
|
|
116
115
|
children: Object.keys(spawnedChildren).length ? {
|
|
117
116
|
...state.children,
|
|
@@ -258,6 +257,8 @@ function pure(getActions) {
|
|
|
258
257
|
|
|
259
258
|
// TODO: remove once TS fixes this type-widening issue
|
|
260
259
|
|
|
260
|
+
// TODO: replace with AnyMachineSnapshot
|
|
261
|
+
|
|
261
262
|
// TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
|
|
262
263
|
|
|
263
264
|
let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
4
|
-
var interpreter = require('./interpreter-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-6b64c553.cjs.js');
|
|
4
|
+
var interpreter = require('./interpreter-b6bdd134.cjs.js');
|
|
5
5
|
|
|
6
6
|
function createSpawner(actorScope, {
|
|
7
7
|
machine,
|
|
@@ -46,12 +46,11 @@ function createSpawner(actorScope, {
|
|
|
46
46
|
}
|
|
47
47
|
return actorRef;
|
|
48
48
|
} else {
|
|
49
|
-
// TODO: this should also receive `src`
|
|
50
49
|
const actorRef = interpreter.createActor(src, {
|
|
51
50
|
id: options.id,
|
|
52
51
|
parent: actorScope.self,
|
|
53
52
|
input: options.input,
|
|
54
|
-
src
|
|
53
|
+
src,
|
|
55
54
|
systemId
|
|
56
55
|
});
|
|
57
56
|
if (options.syncSnapshot) {
|
|
@@ -75,7 +74,7 @@ function createSpawner(actorScope, {
|
|
|
75
74
|
const actorRef = spawn(src, options); // TODO: fix types
|
|
76
75
|
spawnedChildren[actorRef.id] = actorRef;
|
|
77
76
|
actorScope.defer(() => {
|
|
78
|
-
if (actorRef.
|
|
77
|
+
if (actorRef._processingStatus === interpreter.ProcessingStatus.Stopped) {
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
81
80
|
try {
|
|
@@ -113,7 +112,7 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
const updatedContext = Object.assign({}, state.context, partialUpdate);
|
|
116
|
-
return [guards_dist_xstateGuards.
|
|
115
|
+
return [guards_dist_xstateGuards.cloneMachineSnapshot(state, {
|
|
117
116
|
context: updatedContext,
|
|
118
117
|
children: Object.keys(spawnedChildren).length ? {
|
|
119
118
|
...state.children,
|
|
@@ -248,6 +247,8 @@ function pure(getActions) {
|
|
|
248
247
|
|
|
249
248
|
// TODO: remove once TS fixes this type-widening issue
|
|
250
249
|
|
|
250
|
+
// TODO: replace with AnyMachineSnapshot
|
|
251
|
+
|
|
251
252
|
// TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
|
|
252
253
|
|
|
253
254
|
let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
4
|
-
var interpreter = require('./interpreter-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-8f482ce9.development.cjs.js');
|
|
4
|
+
var interpreter = require('./interpreter-23e4041c.development.cjs.js');
|
|
5
5
|
|
|
6
6
|
function createSpawner(actorScope, {
|
|
7
7
|
machine,
|
|
@@ -46,12 +46,11 @@ function createSpawner(actorScope, {
|
|
|
46
46
|
}
|
|
47
47
|
return actorRef;
|
|
48
48
|
} else {
|
|
49
|
-
// TODO: this should also receive `src`
|
|
50
49
|
const actorRef = interpreter.createActor(src, {
|
|
51
50
|
id: options.id,
|
|
52
51
|
parent: actorScope.self,
|
|
53
52
|
input: options.input,
|
|
54
|
-
src
|
|
53
|
+
src,
|
|
55
54
|
systemId
|
|
56
55
|
});
|
|
57
56
|
if (options.syncSnapshot) {
|
|
@@ -75,7 +74,7 @@ function createSpawner(actorScope, {
|
|
|
75
74
|
const actorRef = spawn(src, options); // TODO: fix types
|
|
76
75
|
spawnedChildren[actorRef.id] = actorRef;
|
|
77
76
|
actorScope.defer(() => {
|
|
78
|
-
if (actorRef.
|
|
77
|
+
if (actorRef._processingStatus === interpreter.ProcessingStatus.Stopped) {
|
|
79
78
|
return;
|
|
80
79
|
}
|
|
81
80
|
try {
|
|
@@ -113,7 +112,7 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
const updatedContext = Object.assign({}, state.context, partialUpdate);
|
|
116
|
-
return [guards_dist_xstateGuards.
|
|
115
|
+
return [guards_dist_xstateGuards.cloneMachineSnapshot(state, {
|
|
117
116
|
context: updatedContext,
|
|
118
117
|
children: Object.keys(spawnedChildren).length ? {
|
|
119
118
|
...state.children,
|
|
@@ -260,6 +259,8 @@ function pure(getActions) {
|
|
|
260
259
|
|
|
261
260
|
// TODO: remove once TS fixes this type-widening issue
|
|
262
261
|
|
|
262
|
+
// TODO: replace with AnyMachineSnapshot
|
|
263
|
+
|
|
263
264
|
// TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
|
|
264
265
|
|
|
265
266
|
let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|