xstate 5.0.0-beta.51 → 5.0.0-beta.52
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 +9 -11
- package/actions/dist/xstate-actions.cjs.mjs +0 -2
- package/actions/dist/xstate-actions.development.cjs.js +9 -11
- package/actions/dist/xstate-actions.development.cjs.mjs +0 -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/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/declarations/src/StateMachine.d.ts +2 -2
- package/dist/declarations/src/StateNode.d.ts +3 -3
- package/dist/declarations/src/actions.d.ts +0 -2
- package/dist/declarations/src/actors/index.d.ts +1 -1
- package/dist/declarations/src/interpreter.d.ts +2 -2
- package/dist/declarations/src/types.d.ts +9 -9
- package/dist/{pure-a0f16134.development.cjs.js → log-3d815f5e.cjs.js} +1 -62
- package/dist/{pure-296f8ebd.development.esm.js → log-6bc0e1e7.esm.js} +2 -61
- package/dist/{pure-aefddc19.esm.js → log-826c9895.development.esm.js} +24 -36
- package/dist/{pure-c5f1b46c.cjs.js → log-d160285c.development.cjs.js} +23 -37
- package/dist/{raise-acaa3884.development.esm.js → raise-1caefe80.development.esm.js} +10 -10
- package/dist/{raise-d5633a02.cjs.js → raise-367eeb6f.cjs.js} +10 -10
- package/dist/{raise-528386de.development.cjs.js → raise-9dd3e757.development.cjs.js} +10 -10
- package/dist/{raise-4742bf04.esm.js → raise-f71460d6.esm.js} +10 -10
- package/dist/xstate.cjs.js +13 -15
- package/dist/xstate.cjs.mjs +0 -2
- package/dist/xstate.development.cjs.js +13 -15
- package/dist/xstate.development.cjs.mjs +0 -2
- package/dist/xstate.development.esm.js +6 -6
- package/dist/xstate.esm.js +6 -6
- 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/package.json +1 -1
- package/dist/declarations/src/actions/choose.d.ts +0 -9
- package/dist/declarations/src/actions/pure.d.ts +0 -10
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-367eeb6f.cjs.js');
|
|
4
4
|
|
|
5
5
|
function createSpawner(actorScope, {
|
|
6
6
|
machine,
|
|
@@ -94,9 +94,6 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
94
94
|
*/
|
|
95
95
|
function assign(assignment) {
|
|
96
96
|
function assign(args, params) {
|
|
97
|
-
{
|
|
98
|
-
throw new Error(`This isn't supposed to be called`);
|
|
99
|
-
}
|
|
100
97
|
}
|
|
101
98
|
assign.type = 'xstate.assign';
|
|
102
99
|
assign.assignment = assignment;
|
|
@@ -104,26 +101,6 @@ function assign(assignment) {
|
|
|
104
101
|
return assign;
|
|
105
102
|
}
|
|
106
103
|
|
|
107
|
-
function resolveChoose(_, state, actionArgs, _actionParams, {
|
|
108
|
-
branches
|
|
109
|
-
}) {
|
|
110
|
-
const matchedActions = branches.find(condition => {
|
|
111
|
-
return !condition.guard || guards_dist_xstateGuards.evaluateGuard(condition.guard, state.context, actionArgs.event, state);
|
|
112
|
-
})?.actions;
|
|
113
|
-
return [state, undefined, guards_dist_xstateGuards.toArray(matchedActions)];
|
|
114
|
-
}
|
|
115
|
-
function choose(branches) {
|
|
116
|
-
function choose(args, params) {
|
|
117
|
-
{
|
|
118
|
-
throw new Error(`This isn't supposed to be called`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
choose.type = 'xstate.choose';
|
|
122
|
-
choose.branches = branches;
|
|
123
|
-
choose.resolve = resolveChoose;
|
|
124
|
-
return choose;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
104
|
/**
|
|
128
105
|
*
|
|
129
106
|
* @remarks
|
|
@@ -265,9 +242,6 @@ function executeSendTo(actorScope, params) {
|
|
|
265
242
|
*/
|
|
266
243
|
function sendTo(to, eventOrExpr, options) {
|
|
267
244
|
function sendTo(args, params) {
|
|
268
|
-
{
|
|
269
|
-
throw new Error(`This isn't supposed to be called`);
|
|
270
|
-
}
|
|
271
245
|
}
|
|
272
246
|
sendTo.type = 'xstate.sendTo';
|
|
273
247
|
sendTo.to = to;
|
|
@@ -296,16 +270,6 @@ function sendParent(event, options) {
|
|
|
296
270
|
* @param options Options to pass into the send action creator.
|
|
297
271
|
*/
|
|
298
272
|
function forwardTo(target, options) {
|
|
299
|
-
if ((!target || typeof target === 'function')) {
|
|
300
|
-
const originalTarget = target;
|
|
301
|
-
target = (...args) => {
|
|
302
|
-
const resolvedTarget = typeof originalTarget === 'function' ? originalTarget(...args) : originalTarget;
|
|
303
|
-
if (!resolvedTarget) {
|
|
304
|
-
throw new Error(`Attempted to forward event to undefined actor. This risks an infinite loop in the sender.`);
|
|
305
|
-
}
|
|
306
|
-
return resolvedTarget;
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
273
|
return sendTo(target, ({
|
|
310
274
|
event
|
|
311
275
|
}) => event, options);
|
|
@@ -362,9 +326,6 @@ function resolveEnqueueActions(_, state, args, _actionParams, {
|
|
|
362
326
|
}
|
|
363
327
|
function enqueueActions(collect) {
|
|
364
328
|
function enqueueActions(args, params) {
|
|
365
|
-
{
|
|
366
|
-
throw new Error(`This isn't supposed to be called`);
|
|
367
|
-
}
|
|
368
329
|
}
|
|
369
330
|
enqueueActions.type = 'xstate.enqueueActions';
|
|
370
331
|
enqueueActions.collect = collect;
|
|
@@ -409,9 +370,6 @@ function log(value = ({
|
|
|
409
370
|
event
|
|
410
371
|
}), label) {
|
|
411
372
|
function log(args, params) {
|
|
412
|
-
{
|
|
413
|
-
throw new Error(`This isn't supposed to be called`);
|
|
414
|
-
}
|
|
415
373
|
}
|
|
416
374
|
log.type = 'xstate.log';
|
|
417
375
|
log.value = value;
|
|
@@ -421,30 +379,11 @@ function log(value = ({
|
|
|
421
379
|
return log;
|
|
422
380
|
}
|
|
423
381
|
|
|
424
|
-
/**
|
|
425
|
-
*
|
|
426
|
-
* @deprecated Use `enqueueActions(...)` instead
|
|
427
|
-
*/
|
|
428
|
-
function pure(getActions) {
|
|
429
|
-
return enqueueActions(({
|
|
430
|
-
context,
|
|
431
|
-
event,
|
|
432
|
-
enqueue
|
|
433
|
-
}) => {
|
|
434
|
-
guards_dist_xstateGuards.toArray(getActions({
|
|
435
|
-
context,
|
|
436
|
-
event
|
|
437
|
-
})).forEach(enqueue);
|
|
438
|
-
});
|
|
439
|
-
}
|
|
440
|
-
|
|
441
382
|
exports.SpecialTargets = SpecialTargets;
|
|
442
383
|
exports.assign = assign;
|
|
443
|
-
exports.choose = choose;
|
|
444
384
|
exports.enqueueActions = enqueueActions;
|
|
445
385
|
exports.escalate = escalate;
|
|
446
386
|
exports.forwardTo = forwardTo;
|
|
447
387
|
exports.log = log;
|
|
448
|
-
exports.pure = pure;
|
|
449
388
|
exports.sendParent = sendParent;
|
|
450
389
|
exports.sendTo = sendTo;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ProcessingStatus, y as resolveReferencedActor, z as createActor, T as cloneMachineSnapshot,
|
|
1
|
+
import { R as ProcessingStatus, y as resolveReferencedActor, z as createActor, T as cloneMachineSnapshot, U as XSTATE_ERROR, V as createErrorActorEvent, e as evaluateGuard, L as cancel, M as raise, O as spawnChild, Q as stopChild } from './raise-f71460d6.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
|
@@ -92,9 +92,6 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
92
92
|
*/
|
|
93
93
|
function assign(assignment) {
|
|
94
94
|
function assign(args, params) {
|
|
95
|
-
{
|
|
96
|
-
throw new Error(`This isn't supposed to be called`);
|
|
97
|
-
}
|
|
98
95
|
}
|
|
99
96
|
assign.type = 'xstate.assign';
|
|
100
97
|
assign.assignment = assignment;
|
|
@@ -102,26 +99,6 @@ function assign(assignment) {
|
|
|
102
99
|
return assign;
|
|
103
100
|
}
|
|
104
101
|
|
|
105
|
-
function resolveChoose(_, state, actionArgs, _actionParams, {
|
|
106
|
-
branches
|
|
107
|
-
}) {
|
|
108
|
-
const matchedActions = branches.find(condition => {
|
|
109
|
-
return !condition.guard || evaluateGuard(condition.guard, state.context, actionArgs.event, state);
|
|
110
|
-
})?.actions;
|
|
111
|
-
return [state, undefined, toArray(matchedActions)];
|
|
112
|
-
}
|
|
113
|
-
function choose(branches) {
|
|
114
|
-
function choose(args, params) {
|
|
115
|
-
{
|
|
116
|
-
throw new Error(`This isn't supposed to be called`);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
choose.type = 'xstate.choose';
|
|
120
|
-
choose.branches = branches;
|
|
121
|
-
choose.resolve = resolveChoose;
|
|
122
|
-
return choose;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
102
|
/**
|
|
126
103
|
*
|
|
127
104
|
* @remarks
|
|
@@ -263,9 +240,6 @@ function executeSendTo(actorScope, params) {
|
|
|
263
240
|
*/
|
|
264
241
|
function sendTo(to, eventOrExpr, options) {
|
|
265
242
|
function sendTo(args, params) {
|
|
266
|
-
{
|
|
267
|
-
throw new Error(`This isn't supposed to be called`);
|
|
268
|
-
}
|
|
269
243
|
}
|
|
270
244
|
sendTo.type = 'xstate.sendTo';
|
|
271
245
|
sendTo.to = to;
|
|
@@ -294,16 +268,6 @@ function sendParent(event, options) {
|
|
|
294
268
|
* @param options Options to pass into the send action creator.
|
|
295
269
|
*/
|
|
296
270
|
function forwardTo(target, options) {
|
|
297
|
-
if ((!target || typeof target === 'function')) {
|
|
298
|
-
const originalTarget = target;
|
|
299
|
-
target = (...args) => {
|
|
300
|
-
const resolvedTarget = typeof originalTarget === 'function' ? originalTarget(...args) : originalTarget;
|
|
301
|
-
if (!resolvedTarget) {
|
|
302
|
-
throw new Error(`Attempted to forward event to undefined actor. This risks an infinite loop in the sender.`);
|
|
303
|
-
}
|
|
304
|
-
return resolvedTarget;
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
271
|
return sendTo(target, ({
|
|
308
272
|
event
|
|
309
273
|
}) => event, options);
|
|
@@ -360,9 +324,6 @@ function resolveEnqueueActions(_, state, args, _actionParams, {
|
|
|
360
324
|
}
|
|
361
325
|
function enqueueActions(collect) {
|
|
362
326
|
function enqueueActions(args, params) {
|
|
363
|
-
{
|
|
364
|
-
throw new Error(`This isn't supposed to be called`);
|
|
365
|
-
}
|
|
366
327
|
}
|
|
367
328
|
enqueueActions.type = 'xstate.enqueueActions';
|
|
368
329
|
enqueueActions.collect = collect;
|
|
@@ -407,9 +368,6 @@ function log(value = ({
|
|
|
407
368
|
event
|
|
408
369
|
}), label) {
|
|
409
370
|
function log(args, params) {
|
|
410
|
-
{
|
|
411
|
-
throw new Error(`This isn't supposed to be called`);
|
|
412
|
-
}
|
|
413
371
|
}
|
|
414
372
|
log.type = 'xstate.log';
|
|
415
373
|
log.value = value;
|
|
@@ -419,21 +377,4 @@ function log(value = ({
|
|
|
419
377
|
return log;
|
|
420
378
|
}
|
|
421
379
|
|
|
422
|
-
|
|
423
|
-
*
|
|
424
|
-
* @deprecated Use `enqueueActions(...)` instead
|
|
425
|
-
*/
|
|
426
|
-
function pure(getActions) {
|
|
427
|
-
return enqueueActions(({
|
|
428
|
-
context,
|
|
429
|
-
event,
|
|
430
|
-
enqueue
|
|
431
|
-
}) => {
|
|
432
|
-
toArray(getActions({
|
|
433
|
-
context,
|
|
434
|
-
event
|
|
435
|
-
})).forEach(enqueue);
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
export { SpecialTargets as S, assign as a, escalate as b, choose as c, sendTo as d, enqueueActions as e, forwardTo as f, log as l, pure as p, sendParent as s };
|
|
380
|
+
export { SpecialTargets as S, assign as a, escalate as b, sendTo as c, enqueueActions as e, forwardTo as f, log as l, sendParent as s };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as ProcessingStatus, y as resolveReferencedActor, z as createActor, T as cloneMachineSnapshot,
|
|
1
|
+
import { R as ProcessingStatus, y as resolveReferencedActor, z as createActor, T as cloneMachineSnapshot, U as XSTATE_ERROR, V as createErrorActorEvent, e as evaluateGuard, L as cancel, M as raise, O as spawnChild, Q as stopChild } from './raise-1caefe80.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
|
@@ -92,6 +92,9 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
92
92
|
*/
|
|
93
93
|
function assign(assignment) {
|
|
94
94
|
function assign(args, params) {
|
|
95
|
+
{
|
|
96
|
+
throw new Error(`This isn't supposed to be called`);
|
|
97
|
+
}
|
|
95
98
|
}
|
|
96
99
|
assign.type = 'xstate.assign';
|
|
97
100
|
assign.assignment = assignment;
|
|
@@ -99,23 +102,6 @@ function assign(assignment) {
|
|
|
99
102
|
return assign;
|
|
100
103
|
}
|
|
101
104
|
|
|
102
|
-
function resolveChoose(_, state, actionArgs, _actionParams, {
|
|
103
|
-
branches
|
|
104
|
-
}) {
|
|
105
|
-
const matchedActions = branches.find(condition => {
|
|
106
|
-
return !condition.guard || evaluateGuard(condition.guard, state.context, actionArgs.event, state);
|
|
107
|
-
})?.actions;
|
|
108
|
-
return [state, undefined, toArray(matchedActions)];
|
|
109
|
-
}
|
|
110
|
-
function choose(branches) {
|
|
111
|
-
function choose(args, params) {
|
|
112
|
-
}
|
|
113
|
-
choose.type = 'xstate.choose';
|
|
114
|
-
choose.branches = branches;
|
|
115
|
-
choose.resolve = resolveChoose;
|
|
116
|
-
return choose;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
105
|
/**
|
|
120
106
|
*
|
|
121
107
|
* @remarks
|
|
@@ -257,6 +243,9 @@ function executeSendTo(actorScope, params) {
|
|
|
257
243
|
*/
|
|
258
244
|
function sendTo(to, eventOrExpr, options) {
|
|
259
245
|
function sendTo(args, params) {
|
|
246
|
+
{
|
|
247
|
+
throw new Error(`This isn't supposed to be called`);
|
|
248
|
+
}
|
|
260
249
|
}
|
|
261
250
|
sendTo.type = 'xstate.sendTo';
|
|
262
251
|
sendTo.to = to;
|
|
@@ -285,6 +274,16 @@ function sendParent(event, options) {
|
|
|
285
274
|
* @param options Options to pass into the send action creator.
|
|
286
275
|
*/
|
|
287
276
|
function forwardTo(target, options) {
|
|
277
|
+
if ((!target || typeof target === 'function')) {
|
|
278
|
+
const originalTarget = target;
|
|
279
|
+
target = (...args) => {
|
|
280
|
+
const resolvedTarget = typeof originalTarget === 'function' ? originalTarget(...args) : originalTarget;
|
|
281
|
+
if (!resolvedTarget) {
|
|
282
|
+
throw new Error(`Attempted to forward event to undefined actor. This risks an infinite loop in the sender.`);
|
|
283
|
+
}
|
|
284
|
+
return resolvedTarget;
|
|
285
|
+
};
|
|
286
|
+
}
|
|
288
287
|
return sendTo(target, ({
|
|
289
288
|
event
|
|
290
289
|
}) => event, options);
|
|
@@ -341,6 +340,9 @@ function resolveEnqueueActions(_, state, args, _actionParams, {
|
|
|
341
340
|
}
|
|
342
341
|
function enqueueActions(collect) {
|
|
343
342
|
function enqueueActions(args, params) {
|
|
343
|
+
{
|
|
344
|
+
throw new Error(`This isn't supposed to be called`);
|
|
345
|
+
}
|
|
344
346
|
}
|
|
345
347
|
enqueueActions.type = 'xstate.enqueueActions';
|
|
346
348
|
enqueueActions.collect = collect;
|
|
@@ -385,6 +387,9 @@ function log(value = ({
|
|
|
385
387
|
event
|
|
386
388
|
}), label) {
|
|
387
389
|
function log(args, params) {
|
|
390
|
+
{
|
|
391
|
+
throw new Error(`This isn't supposed to be called`);
|
|
392
|
+
}
|
|
388
393
|
}
|
|
389
394
|
log.type = 'xstate.log';
|
|
390
395
|
log.value = value;
|
|
@@ -394,21 +399,4 @@ function log(value = ({
|
|
|
394
399
|
return log;
|
|
395
400
|
}
|
|
396
401
|
|
|
397
|
-
|
|
398
|
-
*
|
|
399
|
-
* @deprecated Use `enqueueActions(...)` instead
|
|
400
|
-
*/
|
|
401
|
-
function pure(getActions) {
|
|
402
|
-
return enqueueActions(({
|
|
403
|
-
context,
|
|
404
|
-
event,
|
|
405
|
-
enqueue
|
|
406
|
-
}) => {
|
|
407
|
-
toArray(getActions({
|
|
408
|
-
context,
|
|
409
|
-
event
|
|
410
|
-
})).forEach(enqueue);
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
export { SpecialTargets as S, assign as a, escalate as b, choose as c, sendTo as d, enqueueActions as e, forwardTo as f, log as l, pure as p, sendParent as s };
|
|
402
|
+
export { SpecialTargets as S, assign as a, escalate as b, sendTo as c, enqueueActions as e, forwardTo as f, log as l, sendParent as s };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-9dd3e757.development.cjs.js');
|
|
4
4
|
|
|
5
5
|
function createSpawner(actorScope, {
|
|
6
6
|
machine,
|
|
@@ -94,6 +94,9 @@ function resolveAssign(actorScope, state, actionArgs, actionParams, {
|
|
|
94
94
|
*/
|
|
95
95
|
function assign(assignment) {
|
|
96
96
|
function assign(args, params) {
|
|
97
|
+
{
|
|
98
|
+
throw new Error(`This isn't supposed to be called`);
|
|
99
|
+
}
|
|
97
100
|
}
|
|
98
101
|
assign.type = 'xstate.assign';
|
|
99
102
|
assign.assignment = assignment;
|
|
@@ -101,23 +104,6 @@ function assign(assignment) {
|
|
|
101
104
|
return assign;
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
function resolveChoose(_, state, actionArgs, _actionParams, {
|
|
105
|
-
branches
|
|
106
|
-
}) {
|
|
107
|
-
const matchedActions = branches.find(condition => {
|
|
108
|
-
return !condition.guard || guards_dist_xstateGuards.evaluateGuard(condition.guard, state.context, actionArgs.event, state);
|
|
109
|
-
})?.actions;
|
|
110
|
-
return [state, undefined, guards_dist_xstateGuards.toArray(matchedActions)];
|
|
111
|
-
}
|
|
112
|
-
function choose(branches) {
|
|
113
|
-
function choose(args, params) {
|
|
114
|
-
}
|
|
115
|
-
choose.type = 'xstate.choose';
|
|
116
|
-
choose.branches = branches;
|
|
117
|
-
choose.resolve = resolveChoose;
|
|
118
|
-
return choose;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
107
|
/**
|
|
122
108
|
*
|
|
123
109
|
* @remarks
|
|
@@ -259,6 +245,9 @@ function executeSendTo(actorScope, params) {
|
|
|
259
245
|
*/
|
|
260
246
|
function sendTo(to, eventOrExpr, options) {
|
|
261
247
|
function sendTo(args, params) {
|
|
248
|
+
{
|
|
249
|
+
throw new Error(`This isn't supposed to be called`);
|
|
250
|
+
}
|
|
262
251
|
}
|
|
263
252
|
sendTo.type = 'xstate.sendTo';
|
|
264
253
|
sendTo.to = to;
|
|
@@ -287,6 +276,16 @@ function sendParent(event, options) {
|
|
|
287
276
|
* @param options Options to pass into the send action creator.
|
|
288
277
|
*/
|
|
289
278
|
function forwardTo(target, options) {
|
|
279
|
+
if ((!target || typeof target === 'function')) {
|
|
280
|
+
const originalTarget = target;
|
|
281
|
+
target = (...args) => {
|
|
282
|
+
const resolvedTarget = typeof originalTarget === 'function' ? originalTarget(...args) : originalTarget;
|
|
283
|
+
if (!resolvedTarget) {
|
|
284
|
+
throw new Error(`Attempted to forward event to undefined actor. This risks an infinite loop in the sender.`);
|
|
285
|
+
}
|
|
286
|
+
return resolvedTarget;
|
|
287
|
+
};
|
|
288
|
+
}
|
|
290
289
|
return sendTo(target, ({
|
|
291
290
|
event
|
|
292
291
|
}) => event, options);
|
|
@@ -343,6 +342,9 @@ function resolveEnqueueActions(_, state, args, _actionParams, {
|
|
|
343
342
|
}
|
|
344
343
|
function enqueueActions(collect) {
|
|
345
344
|
function enqueueActions(args, params) {
|
|
345
|
+
{
|
|
346
|
+
throw new Error(`This isn't supposed to be called`);
|
|
347
|
+
}
|
|
346
348
|
}
|
|
347
349
|
enqueueActions.type = 'xstate.enqueueActions';
|
|
348
350
|
enqueueActions.collect = collect;
|
|
@@ -387,6 +389,9 @@ function log(value = ({
|
|
|
387
389
|
event
|
|
388
390
|
}), label) {
|
|
389
391
|
function log(args, params) {
|
|
392
|
+
{
|
|
393
|
+
throw new Error(`This isn't supposed to be called`);
|
|
394
|
+
}
|
|
390
395
|
}
|
|
391
396
|
log.type = 'xstate.log';
|
|
392
397
|
log.value = value;
|
|
@@ -396,30 +401,11 @@ function log(value = ({
|
|
|
396
401
|
return log;
|
|
397
402
|
}
|
|
398
403
|
|
|
399
|
-
/**
|
|
400
|
-
*
|
|
401
|
-
* @deprecated Use `enqueueActions(...)` instead
|
|
402
|
-
*/
|
|
403
|
-
function pure(getActions) {
|
|
404
|
-
return enqueueActions(({
|
|
405
|
-
context,
|
|
406
|
-
event,
|
|
407
|
-
enqueue
|
|
408
|
-
}) => {
|
|
409
|
-
guards_dist_xstateGuards.toArray(getActions({
|
|
410
|
-
context,
|
|
411
|
-
event
|
|
412
|
-
})).forEach(enqueue);
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
|
|
416
404
|
exports.SpecialTargets = SpecialTargets;
|
|
417
405
|
exports.assign = assign;
|
|
418
|
-
exports.choose = choose;
|
|
419
406
|
exports.enqueueActions = enqueueActions;
|
|
420
407
|
exports.escalate = escalate;
|
|
421
408
|
exports.forwardTo = forwardTo;
|
|
422
409
|
exports.log = log;
|
|
423
|
-
exports.pure = pure;
|
|
424
410
|
exports.sendParent = sendParent;
|
|
425
411
|
exports.sendTo = sendTo;
|
|
@@ -64,9 +64,8 @@ const XSTATE_STOP = 'xstate.stop';
|
|
|
64
64
|
* @param id The state node ID where this event is handled
|
|
65
65
|
*/
|
|
66
66
|
function createAfterEvent(delayRef, id) {
|
|
67
|
-
const idSuffix = id ? `#${id}` : '';
|
|
68
67
|
return {
|
|
69
|
-
type: `xstate.after
|
|
68
|
+
type: `xstate.after.${delayRef}.${id}`
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
71
|
|
|
@@ -301,16 +300,17 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
301
300
|
};
|
|
302
301
|
}
|
|
303
302
|
function createInvokeId(stateNodeId, index) {
|
|
304
|
-
return `${
|
|
303
|
+
return `${index}.${stateNodeId}`;
|
|
305
304
|
}
|
|
306
305
|
function resolveReferencedActor(machine, src) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
306
|
+
const match = src.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
307
|
+
if (!match) {
|
|
308
|
+
return machine.implementations.actors[src];
|
|
309
|
+
}
|
|
310
|
+
const [, indexStr, nodeId] = match;
|
|
311
|
+
const node = machine.getStateNodeById(nodeId);
|
|
312
|
+
const invokeConfig = node.config.invoke;
|
|
313
|
+
return (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src;
|
|
314
314
|
}
|
|
315
315
|
function getAllOwnEventDescriptors(snapshot) {
|
|
316
316
|
return [...new Set([...snapshot._nodes.flatMap(sn => sn.ownEvents)])];
|
|
@@ -66,9 +66,8 @@ const XSTATE_STOP = 'xstate.stop';
|
|
|
66
66
|
* @param id The state node ID where this event is handled
|
|
67
67
|
*/
|
|
68
68
|
function createAfterEvent(delayRef, id) {
|
|
69
|
-
const idSuffix = id ? `#${id}` : '';
|
|
70
69
|
return {
|
|
71
|
-
type: `xstate.after
|
|
70
|
+
type: `xstate.after.${delayRef}.${id}`
|
|
72
71
|
};
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -300,16 +299,17 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
300
299
|
};
|
|
301
300
|
}
|
|
302
301
|
function createInvokeId(stateNodeId, index) {
|
|
303
|
-
return `${
|
|
302
|
+
return `${index}.${stateNodeId}`;
|
|
304
303
|
}
|
|
305
304
|
function resolveReferencedActor(machine, src) {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
305
|
+
const match = src.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
306
|
+
if (!match) {
|
|
307
|
+
return machine.implementations.actors[src];
|
|
308
|
+
}
|
|
309
|
+
const [, indexStr, nodeId] = match;
|
|
310
|
+
const node = machine.getStateNodeById(nodeId);
|
|
311
|
+
const invokeConfig = node.config.invoke;
|
|
312
|
+
return (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src;
|
|
313
313
|
}
|
|
314
314
|
function getAllOwnEventDescriptors(snapshot) {
|
|
315
315
|
return [...new Set([...snapshot._nodes.flatMap(sn => sn.ownEvents)])];
|
|
@@ -66,9 +66,8 @@ const XSTATE_STOP = 'xstate.stop';
|
|
|
66
66
|
* @param id The state node ID where this event is handled
|
|
67
67
|
*/
|
|
68
68
|
function createAfterEvent(delayRef, id) {
|
|
69
|
-
const idSuffix = id ? `#${id}` : '';
|
|
70
69
|
return {
|
|
71
|
-
type: `xstate.after
|
|
70
|
+
type: `xstate.after.${delayRef}.${id}`
|
|
72
71
|
};
|
|
73
72
|
}
|
|
74
73
|
|
|
@@ -303,16 +302,17 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
303
302
|
};
|
|
304
303
|
}
|
|
305
304
|
function createInvokeId(stateNodeId, index) {
|
|
306
|
-
return `${
|
|
305
|
+
return `${index}.${stateNodeId}`;
|
|
307
306
|
}
|
|
308
307
|
function resolveReferencedActor(machine, src) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
308
|
+
const match = src.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
309
|
+
if (!match) {
|
|
310
|
+
return machine.implementations.actors[src];
|
|
311
|
+
}
|
|
312
|
+
const [, indexStr, nodeId] = match;
|
|
313
|
+
const node = machine.getStateNodeById(nodeId);
|
|
314
|
+
const invokeConfig = node.config.invoke;
|
|
315
|
+
return (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src;
|
|
316
316
|
}
|
|
317
317
|
function getAllOwnEventDescriptors(snapshot) {
|
|
318
318
|
return [...new Set([...snapshot._nodes.flatMap(sn => sn.ownEvents)])];
|
|
@@ -64,9 +64,8 @@ const XSTATE_STOP = 'xstate.stop';
|
|
|
64
64
|
* @param id The state node ID where this event is handled
|
|
65
65
|
*/
|
|
66
66
|
function createAfterEvent(delayRef, id) {
|
|
67
|
-
const idSuffix = id ? `#${id}` : '';
|
|
68
67
|
return {
|
|
69
|
-
type: `xstate.after
|
|
68
|
+
type: `xstate.after.${delayRef}.${id}`
|
|
70
69
|
};
|
|
71
70
|
}
|
|
72
71
|
|
|
@@ -298,16 +297,17 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
298
297
|
};
|
|
299
298
|
}
|
|
300
299
|
function createInvokeId(stateNodeId, index) {
|
|
301
|
-
return `${
|
|
300
|
+
return `${index}.${stateNodeId}`;
|
|
302
301
|
}
|
|
303
302
|
function resolveReferencedActor(machine, src) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
303
|
+
const match = src.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
|
304
|
+
if (!match) {
|
|
305
|
+
return machine.implementations.actors[src];
|
|
306
|
+
}
|
|
307
|
+
const [, indexStr, nodeId] = match;
|
|
308
|
+
const node = machine.getStateNodeById(nodeId);
|
|
309
|
+
const invokeConfig = node.config.invoke;
|
|
310
|
+
return (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src;
|
|
311
311
|
}
|
|
312
312
|
function getAllOwnEventDescriptors(snapshot) {
|
|
313
313
|
return [...new Set([...snapshot._nodes.flatMap(sn => sn.ownEvents)])];
|
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-367eeb6f.cjs.js');
|
|
7
|
+
var log = require('./log-3d815f5e.cjs.js');
|
|
8
8
|
require('../dev/dist/xstate-dev.cjs.js');
|
|
9
9
|
|
|
10
10
|
class SimulatedClock {
|
|
@@ -254,8 +254,8 @@ class StateNode {
|
|
|
254
254
|
src,
|
|
255
255
|
systemId
|
|
256
256
|
} = invokeConfig;
|
|
257
|
-
const resolvedId = invokeConfig.id
|
|
258
|
-
const resolvedSrc = typeof src === 'string' ? src : `xstate
|
|
257
|
+
const resolvedId = invokeConfig.id ?? guards_dist_xstateGuards.createInvokeId(this.id, i);
|
|
258
|
+
const resolvedSrc = typeof src === 'string' ? src : `xstate.invoke.${guards_dist_xstateGuards.createInvokeId(this.id, i)}`;
|
|
259
259
|
return {
|
|
260
260
|
...invokeConfig,
|
|
261
261
|
src: resolvedSrc,
|
|
@@ -497,7 +497,7 @@ class StateMachine {
|
|
|
497
497
|
spawn,
|
|
498
498
|
input: event.input
|
|
499
499
|
});
|
|
500
|
-
return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [
|
|
500
|
+
return guards_dist_xstateGuards.resolveActionsAndContext(preInitial, initEvent, actorScope, [log.assign(assignment)], internalQueue);
|
|
501
501
|
}
|
|
502
502
|
return preInitial;
|
|
503
503
|
}
|
|
@@ -716,16 +716,14 @@ exports.stateIn = guards_dist_xstateGuards.stateIn;
|
|
|
716
716
|
exports.stop = guards_dist_xstateGuards.stop;
|
|
717
717
|
exports.stopChild = guards_dist_xstateGuards.stopChild;
|
|
718
718
|
exports.toObserver = guards_dist_xstateGuards.toObserver;
|
|
719
|
-
exports.SpecialTargets =
|
|
720
|
-
exports.assign =
|
|
721
|
-
exports.
|
|
722
|
-
exports.
|
|
723
|
-
exports.
|
|
724
|
-
exports.
|
|
725
|
-
exports.
|
|
726
|
-
exports.
|
|
727
|
-
exports.sendParent = pure.sendParent;
|
|
728
|
-
exports.sendTo = pure.sendTo;
|
|
719
|
+
exports.SpecialTargets = log.SpecialTargets;
|
|
720
|
+
exports.assign = log.assign;
|
|
721
|
+
exports.enqueueActions = log.enqueueActions;
|
|
722
|
+
exports.escalate = log.escalate;
|
|
723
|
+
exports.forwardTo = log.forwardTo;
|
|
724
|
+
exports.log = log.log;
|
|
725
|
+
exports.sendParent = log.sendParent;
|
|
726
|
+
exports.sendTo = log.sendTo;
|
|
729
727
|
exports.SimulatedClock = SimulatedClock;
|
|
730
728
|
exports.StateMachine = StateMachine;
|
|
731
729
|
exports.StateNode = StateNode;
|
package/dist/xstate.cjs.mjs
CHANGED