xstate 5.0.0-beta.25 → 5.0.0-beta.27
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 +20 -18
- package/actions/dist/xstate-actions.cjs.mjs +2 -0
- package/actions/dist/xstate-actions.development.cjs.js +20 -18
- package/actions/dist/xstate-actions.development.cjs.mjs +2 -0
- package/actions/dist/xstate-actions.development.esm.js +1 -1
- package/actions/dist/xstate-actions.esm.js +1 -1
- 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 +37 -14
- package/actors/dist/xstate-actors.cjs.mjs +0 -5
- package/actors/dist/xstate-actors.development.cjs.js +37 -14
- package/actors/dist/xstate-actors.development.cjs.mjs +0 -5
- package/actors/dist/xstate-actors.development.esm.js +34 -1
- package/actors/dist/xstate-actors.esm.js +34 -1
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/{actions-5943a9db.esm.js → actions-020463e9.esm.js} +76 -532
- package/dist/{actions-cf69419d.development.esm.js → actions-9754d2ca.development.esm.js} +76 -532
- package/dist/{actions-0971b43d.development.cjs.js → actions-ca622922.development.cjs.js} +81 -546
- package/dist/{actions-319cefe7.cjs.js → actions-d1dba4ac.cjs.js} +81 -546
- package/dist/declarations/src/Machine.d.ts +4 -3
- package/dist/declarations/src/State.d.ts +3 -3
- package/dist/declarations/src/StateNode.d.ts +0 -9
- package/dist/declarations/src/actions/assign.d.ts +6 -11
- package/dist/declarations/src/actions/cancel.d.ts +5 -12
- package/dist/declarations/src/actions/choose.d.ts +7 -6
- package/dist/declarations/src/actions/log.d.ts +5 -20
- package/dist/declarations/src/actions/pure.d.ts +9 -8
- package/dist/declarations/src/actions/raise.d.ts +6 -5
- package/dist/declarations/src/actions/send.d.ts +7 -12
- package/dist/declarations/src/actions/stop.d.ts +5 -12
- package/dist/declarations/src/actions.d.ts +2 -0
- package/dist/declarations/src/actors/index.d.ts +0 -20
- package/dist/declarations/src/actors/promise.d.ts +2 -1
- package/dist/declarations/src/constants.d.ts +7 -0
- package/dist/declarations/src/guards.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +14 -14
- package/dist/declarations/src/typegenTypes.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +18 -22
- package/dist/declarations/src/utils.d.ts +1 -2
- package/dist/promise-2ad94e3b.development.esm.js +406 -0
- package/dist/promise-3b7e3357.development.cjs.js +412 -0
- package/dist/promise-5b07c38e.esm.js +406 -0
- package/dist/promise-7a8c1768.cjs.js +412 -0
- package/dist/xstate.cjs.js +78 -102
- package/dist/xstate.development.cjs.js +78 -102
- package/dist/xstate.development.esm.js +6 -30
- package/dist/xstate.esm.js +6 -30
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +6 -6
- package/guards/dist/xstate-guards.development.cjs.js +6 -6
- 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 +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var guards_dist_xstateGuards = require('./actions-ca622922.development.cjs.js');
|
|
6
|
+
var promise = require('./promise-3b7e3357.development.cjs.js');
|
|
6
7
|
require('../dev/dist/xstate-dev.development.cjs.js');
|
|
7
8
|
|
|
8
9
|
const EMPTY_OBJECT = {};
|
|
@@ -113,12 +114,12 @@ class StateNode {
|
|
|
113
114
|
this.key = options._key;
|
|
114
115
|
this.machine = options._machine;
|
|
115
116
|
this.path = this.parent ? this.parent.path.concat(this.key) : [];
|
|
116
|
-
this.id = this.config.id || [this.machine.id, ...this.path].join(
|
|
117
|
+
this.id = this.config.id || [this.machine.id, ...this.path].join(guards_dist_xstateGuards.STATE_DELIMITER);
|
|
117
118
|
this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? 'compound' : this.config.history ? 'history' : 'atomic');
|
|
118
119
|
this.description = this.config.description;
|
|
119
120
|
this.order = this.machine.idMap.size;
|
|
120
121
|
this.machine.idMap.set(this.id, this);
|
|
121
|
-
this.states = this.config.states ?
|
|
122
|
+
this.states = this.config.states ? guards_dist_xstateGuards.mapValues(this.config.states, (stateConfig, key) => {
|
|
122
123
|
const stateNode = new StateNode(stateConfig, {
|
|
123
124
|
_parent: this,
|
|
124
125
|
_key: key,
|
|
@@ -132,16 +133,16 @@ class StateNode {
|
|
|
132
133
|
|
|
133
134
|
// History config
|
|
134
135
|
this.history = this.config.history === true ? 'shallow' : this.config.history || false;
|
|
135
|
-
this.entry =
|
|
136
|
-
this.exit =
|
|
136
|
+
this.entry = guards_dist_xstateGuards.toArray(this.config.entry).slice();
|
|
137
|
+
this.exit = guards_dist_xstateGuards.toArray(this.config.exit).slice();
|
|
137
138
|
this.meta = this.config.meta;
|
|
138
139
|
this.output = this.type === 'final' ? this.config.output : undefined;
|
|
139
|
-
this.tags =
|
|
140
|
+
this.tags = guards_dist_xstateGuards.toArray(config.tags).slice();
|
|
140
141
|
}
|
|
141
142
|
_initialize() {
|
|
142
|
-
this.transitions =
|
|
143
|
+
this.transitions = guards_dist_xstateGuards.formatTransitions(this);
|
|
143
144
|
if (this.config.always) {
|
|
144
|
-
this.always =
|
|
145
|
+
this.always = guards_dist_xstateGuards.toTransitionConfigArray(this.config.always).map(t => guards_dist_xstateGuards.formatTransition(this, guards_dist_xstateGuards.NULL_EVENT, t));
|
|
145
146
|
}
|
|
146
147
|
Object.keys(this.states).forEach(key => {
|
|
147
148
|
this.states[key]._initialize();
|
|
@@ -171,7 +172,7 @@ class StateNode {
|
|
|
171
172
|
})
|
|
172
173
|
} : undefined,
|
|
173
174
|
history: this.history,
|
|
174
|
-
states:
|
|
175
|
+
states: guards_dist_xstateGuards.mapValues(this.states, state => {
|
|
175
176
|
return state.definition;
|
|
176
177
|
}),
|
|
177
178
|
on: this.on,
|
|
@@ -197,15 +198,12 @@ class StateNode {
|
|
|
197
198
|
* The logic invoked as actors by this state node.
|
|
198
199
|
*/
|
|
199
200
|
get invoke() {
|
|
200
|
-
return
|
|
201
|
-
const generatedId = actors_dist_xstateActors.createInvokeId(this.id, i);
|
|
202
|
-
const invokeConfig = actors_dist_xstateActors.toInvokeConfig(invocable, generatedId);
|
|
203
|
-
const resolvedId = invokeConfig.id || generatedId;
|
|
204
|
-
const src = invokeConfig.src;
|
|
201
|
+
return guards_dist_xstateGuards.memo(this, 'invoke', () => guards_dist_xstateGuards.toArray(this.config.invoke).map((invokeConfig, i) => {
|
|
205
202
|
const {
|
|
203
|
+
src,
|
|
206
204
|
systemId
|
|
207
205
|
} = invokeConfig;
|
|
208
|
-
|
|
206
|
+
const resolvedId = invokeConfig.id || guards_dist_xstateGuards.createInvokeId(this.id, i);
|
|
209
207
|
// TODO: resolving should not happen here
|
|
210
208
|
const resolvedSrc = typeof src === 'string' ? src : !('type' in src) ? resolvedId : src;
|
|
211
209
|
if (!this.machine.implementations.actors[resolvedId] && typeof src !== 'string' && !('type' in src)) {
|
|
@@ -241,7 +239,7 @@ class StateNode {
|
|
|
241
239
|
* The mapping of events to transitions.
|
|
242
240
|
*/
|
|
243
241
|
get on() {
|
|
244
|
-
return
|
|
242
|
+
return guards_dist_xstateGuards.memo(this, 'on', () => {
|
|
245
243
|
const transitions = this.transitions;
|
|
246
244
|
return [...transitions].flatMap(([descriptor, t]) => t.map(t => [descriptor, t])).reduce((map, [descriptor, transition]) => {
|
|
247
245
|
map[descriptor] = map[descriptor] || [];
|
|
@@ -251,16 +249,16 @@ class StateNode {
|
|
|
251
249
|
});
|
|
252
250
|
}
|
|
253
251
|
get after() {
|
|
254
|
-
return
|
|
252
|
+
return guards_dist_xstateGuards.memo(this, 'delayedTransitions', () => guards_dist_xstateGuards.getDelayedTransitions(this));
|
|
255
253
|
}
|
|
256
254
|
get initial() {
|
|
257
|
-
return
|
|
255
|
+
return guards_dist_xstateGuards.memo(this, 'initial', () => guards_dist_xstateGuards.formatInitialTransition(this, this.config.initial || []));
|
|
258
256
|
}
|
|
259
257
|
next(state, event) {
|
|
260
258
|
const eventType = event.type;
|
|
261
259
|
const actions = [];
|
|
262
260
|
let selectedTransition;
|
|
263
|
-
const candidates =
|
|
261
|
+
const candidates = guards_dist_xstateGuards.memo(this, `candidates-${eventType}`, () => guards_dist_xstateGuards.getCandidates(this, eventType));
|
|
264
262
|
for (const candidate of candidates) {
|
|
265
263
|
const {
|
|
266
264
|
guard
|
|
@@ -268,7 +266,7 @@ class StateNode {
|
|
|
268
266
|
const resolvedContext = state.context;
|
|
269
267
|
let guardPassed = false;
|
|
270
268
|
try {
|
|
271
|
-
guardPassed = !guard ||
|
|
269
|
+
guardPassed = !guard || guards_dist_xstateGuards.evaluateGuard(guard, resolvedContext, event, state);
|
|
272
270
|
} catch (err) {
|
|
273
271
|
const guardType = typeof guard === 'string' ? guard : typeof guard === 'object' ? guard.type : undefined;
|
|
274
272
|
throw new Error(`Unable to evaluate guard ${guardType ? `'${guardType}' ` : ''}in transition for event '${eventType}' in state node '${this.id}':\n${err.message}`);
|
|
@@ -282,33 +280,11 @@ class StateNode {
|
|
|
282
280
|
return selectedTransition ? [selectedTransition] : undefined;
|
|
283
281
|
}
|
|
284
282
|
|
|
285
|
-
/**
|
|
286
|
-
* The target state value of the history state node, if it exists. This represents the
|
|
287
|
-
* default state value to transition to if no history value exists yet.
|
|
288
|
-
*/
|
|
289
|
-
get target() {
|
|
290
|
-
if (this.type === 'history') {
|
|
291
|
-
const historyConfig = this.config;
|
|
292
|
-
return historyConfig.target;
|
|
293
|
-
}
|
|
294
|
-
return undefined;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* All the state node IDs of this state node and its descendant state nodes.
|
|
299
|
-
*/
|
|
300
|
-
get stateIds() {
|
|
301
|
-
const childStateIds = actors_dist_xstateActors.flatten(Object.keys(this.states).map(stateKey => {
|
|
302
|
-
return this.states[stateKey].stateIds;
|
|
303
|
-
}));
|
|
304
|
-
return [this.id].concat(childStateIds);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
283
|
/**
|
|
308
284
|
* All the event types accepted by this state node and its descendants.
|
|
309
285
|
*/
|
|
310
286
|
get events() {
|
|
311
|
-
return
|
|
287
|
+
return guards_dist_xstateGuards.memo(this, 'events', () => {
|
|
312
288
|
const {
|
|
313
289
|
states
|
|
314
290
|
} = this;
|
|
@@ -434,18 +410,18 @@ class StateMachine {
|
|
|
434
410
|
* @param state The state to resolve
|
|
435
411
|
*/
|
|
436
412
|
resolveState(state) {
|
|
437
|
-
const configurationSet =
|
|
413
|
+
const configurationSet = guards_dist_xstateGuards.getConfiguration(guards_dist_xstateGuards.getStateNodes(this.root, state.value));
|
|
438
414
|
const configuration = Array.from(configurationSet);
|
|
439
415
|
return this.createState({
|
|
440
416
|
...state,
|
|
441
|
-
value:
|
|
417
|
+
value: guards_dist_xstateGuards.resolveStateValue(this.root, state.value),
|
|
442
418
|
configuration,
|
|
443
|
-
done:
|
|
419
|
+
done: guards_dist_xstateGuards.isInFinalState(configuration)
|
|
444
420
|
});
|
|
445
421
|
}
|
|
446
422
|
resolveStateValue(stateValue, ...[context]) {
|
|
447
|
-
const resolvedStateValue =
|
|
448
|
-
return this.resolveState(
|
|
423
|
+
const resolvedStateValue = guards_dist_xstateGuards.resolveStateValue(this.root, stateValue);
|
|
424
|
+
return this.resolveState(guards_dist_xstateGuards.State.from(resolvedStateValue, context, this));
|
|
449
425
|
}
|
|
450
426
|
|
|
451
427
|
/**
|
|
@@ -457,14 +433,14 @@ class StateMachine {
|
|
|
457
433
|
*/
|
|
458
434
|
transition(state, event, actorCtx) {
|
|
459
435
|
// TODO: handle error events in a better way
|
|
460
|
-
if (
|
|
461
|
-
return
|
|
436
|
+
if (guards_dist_xstateGuards.isErrorEvent(event) && !state.nextEvents.some(nextEvent => nextEvent === event.type)) {
|
|
437
|
+
return guards_dist_xstateGuards.cloneState(state, {
|
|
462
438
|
error: event.data
|
|
463
439
|
});
|
|
464
440
|
}
|
|
465
441
|
const {
|
|
466
442
|
state: nextState
|
|
467
|
-
} =
|
|
443
|
+
} = guards_dist_xstateGuards.macrostep(state, event, actorCtx);
|
|
468
444
|
return nextState;
|
|
469
445
|
}
|
|
470
446
|
|
|
@@ -476,10 +452,10 @@ class StateMachine {
|
|
|
476
452
|
* @param event The received event
|
|
477
453
|
*/
|
|
478
454
|
microstep(state, event, actorCtx) {
|
|
479
|
-
return
|
|
455
|
+
return guards_dist_xstateGuards.macrostep(state, event, actorCtx).microstates;
|
|
480
456
|
}
|
|
481
457
|
getTransitionData(state, event) {
|
|
482
|
-
return
|
|
458
|
+
return guards_dist_xstateGuards.transitionNode(this.root, state.value, state, event) || [];
|
|
483
459
|
}
|
|
484
460
|
|
|
485
461
|
/**
|
|
@@ -495,7 +471,7 @@ class StateMachine {
|
|
|
495
471
|
// TODO: this is computed in state constructor
|
|
496
472
|
context: typeof context !== 'function' && context ? context : {},
|
|
497
473
|
meta: undefined,
|
|
498
|
-
configuration:
|
|
474
|
+
configuration: guards_dist_xstateGuards.getInitialConfiguration(this.root),
|
|
499
475
|
children: {}
|
|
500
476
|
}));
|
|
501
477
|
if (typeof context === 'function') {
|
|
@@ -506,7 +482,7 @@ class StateMachine {
|
|
|
506
482
|
spawn,
|
|
507
483
|
input: event.input
|
|
508
484
|
});
|
|
509
|
-
return
|
|
485
|
+
return guards_dist_xstateGuards.resolveActionsAndContext([guards_dist_xstateGuards.assign(assignment)], initEvent, preInitial, actorCtx);
|
|
510
486
|
}
|
|
511
487
|
return preInitial;
|
|
512
488
|
}
|
|
@@ -515,11 +491,11 @@ class StateMachine {
|
|
|
515
491
|
* Returns the initial `State` instance, with reference to `self` as an `ActorRef`.
|
|
516
492
|
*/
|
|
517
493
|
getInitialState(actorCtx, input) {
|
|
518
|
-
const initEvent =
|
|
494
|
+
const initEvent = guards_dist_xstateGuards.createInitEvent(input); // TODO: fix;
|
|
519
495
|
|
|
520
496
|
const preInitialState = this.getPreInitialState(actorCtx, initEvent);
|
|
521
|
-
const nextState =
|
|
522
|
-
target: [...preInitialState.configuration].filter(
|
|
497
|
+
const nextState = guards_dist_xstateGuards.microstep([{
|
|
498
|
+
target: [...preInitialState.configuration].filter(guards_dist_xstateGuards.isAtomicStateNode),
|
|
523
499
|
source: this.root,
|
|
524
500
|
reenter: true,
|
|
525
501
|
actions: [],
|
|
@@ -528,7 +504,7 @@ class StateMachine {
|
|
|
528
504
|
}], preInitialState, actorCtx, initEvent, true);
|
|
529
505
|
const {
|
|
530
506
|
state: macroState
|
|
531
|
-
} =
|
|
507
|
+
} = guards_dist_xstateGuards.macrostep(nextState, initEvent, actorCtx);
|
|
532
508
|
return macroState;
|
|
533
509
|
}
|
|
534
510
|
start(state) {
|
|
@@ -539,14 +515,14 @@ class StateMachine {
|
|
|
539
515
|
});
|
|
540
516
|
}
|
|
541
517
|
getStateNodeById(stateId) {
|
|
542
|
-
const fullPath = stateId.split(
|
|
518
|
+
const fullPath = stateId.split(guards_dist_xstateGuards.STATE_DELIMITER);
|
|
543
519
|
const relativePath = fullPath.slice(1);
|
|
544
|
-
const resolvedStateId =
|
|
520
|
+
const resolvedStateId = guards_dist_xstateGuards.isStateId(fullPath[0]) ? fullPath[0].slice(STATE_IDENTIFIER.length) : fullPath[0];
|
|
545
521
|
const stateNode = this.idMap.get(resolvedStateId);
|
|
546
522
|
if (!stateNode) {
|
|
547
523
|
throw new Error(`Child state node '#${resolvedStateId}' does not exist on machine '${this.id}'`);
|
|
548
524
|
}
|
|
549
|
-
return
|
|
525
|
+
return guards_dist_xstateGuards.getStateNodeByPath(stateNode, relativePath);
|
|
550
526
|
}
|
|
551
527
|
get definition() {
|
|
552
528
|
return this.root.definition;
|
|
@@ -555,10 +531,10 @@ class StateMachine {
|
|
|
555
531
|
return this.definition;
|
|
556
532
|
}
|
|
557
533
|
getPersistedState(state) {
|
|
558
|
-
return
|
|
534
|
+
return guards_dist_xstateGuards.getPersistedState(state);
|
|
559
535
|
}
|
|
560
536
|
createState(stateConfig) {
|
|
561
|
-
return stateConfig instanceof
|
|
537
|
+
return stateConfig instanceof guards_dist_xstateGuards.State ? stateConfig : new guards_dist_xstateGuards.State(stateConfig, this);
|
|
562
538
|
}
|
|
563
539
|
getStatus(state) {
|
|
564
540
|
return state.error ? {
|
|
@@ -577,18 +553,18 @@ class StateMachine {
|
|
|
577
553
|
const actorData = state.children[actorId];
|
|
578
554
|
const childState = actorData.state;
|
|
579
555
|
const src = actorData.src;
|
|
580
|
-
const logic = src ?
|
|
556
|
+
const logic = src ? guards_dist_xstateGuards.resolveReferencedActor(this.implementations.actors[src])?.src : undefined;
|
|
581
557
|
if (!logic) {
|
|
582
558
|
return;
|
|
583
559
|
}
|
|
584
560
|
const actorState = logic.restoreState?.(childState, _actorCtx);
|
|
585
|
-
const actorRef =
|
|
561
|
+
const actorRef = guards_dist_xstateGuards.createActor(logic, {
|
|
586
562
|
id: actorId,
|
|
587
563
|
state: actorState
|
|
588
564
|
});
|
|
589
565
|
children[actorId] = actorRef;
|
|
590
566
|
});
|
|
591
|
-
const restoredState = this.createState(new
|
|
567
|
+
const restoredState = this.createState(new guards_dist_xstateGuards.State({
|
|
592
568
|
...state,
|
|
593
569
|
children
|
|
594
570
|
}, this));
|
|
@@ -604,9 +580,9 @@ class StateMachine {
|
|
|
604
580
|
if (children[id]) {
|
|
605
581
|
return;
|
|
606
582
|
}
|
|
607
|
-
const referenced =
|
|
583
|
+
const referenced = guards_dist_xstateGuards.resolveReferencedActor(this.implementations.actors[src]);
|
|
608
584
|
if (referenced) {
|
|
609
|
-
const actorRef =
|
|
585
|
+
const actorRef = guards_dist_xstateGuards.createActor(referenced.src, {
|
|
610
586
|
id,
|
|
611
587
|
parent: _actorCtx?.self,
|
|
612
588
|
input: 'input' in invokeConfig ? invokeConfig.input : referenced.input
|
|
@@ -629,7 +605,7 @@ function createMachine(config, implementations) {
|
|
|
629
605
|
function mapState(stateMap, stateId) {
|
|
630
606
|
let foundStateId;
|
|
631
607
|
for (const mappedStateId of Object.keys(stateMap)) {
|
|
632
|
-
if (
|
|
608
|
+
if (guards_dist_xstateGuards.matchesState(mappedStateId, stateId) && (!foundStateId || stateId.length > foundStateId.length)) {
|
|
633
609
|
foundStateId = mappedStateId;
|
|
634
610
|
}
|
|
635
611
|
}
|
|
@@ -759,38 +735,38 @@ function waitFor(actorRef, predicate, options) {
|
|
|
759
735
|
});
|
|
760
736
|
}
|
|
761
737
|
|
|
762
|
-
exports.Actor =
|
|
763
|
-
exports.ActorStatus =
|
|
764
|
-
exports.ConstantPrefix =
|
|
765
|
-
exports.InterpreterStatus =
|
|
766
|
-
exports.SpecialTargets =
|
|
767
|
-
exports.State =
|
|
768
|
-
exports.and =
|
|
769
|
-
exports.assign =
|
|
770
|
-
exports.cancel =
|
|
771
|
-
exports.choose =
|
|
772
|
-
exports.createActor =
|
|
773
|
-
exports.doneInvoke =
|
|
774
|
-
exports.forwardTo =
|
|
775
|
-
exports.
|
|
776
|
-
exports.
|
|
777
|
-
exports.
|
|
778
|
-
exports.
|
|
779
|
-
exports.
|
|
780
|
-
exports.
|
|
781
|
-
exports.
|
|
782
|
-
exports.
|
|
783
|
-
exports.
|
|
784
|
-
exports.
|
|
785
|
-
exports.
|
|
786
|
-
exports.
|
|
787
|
-
exports.
|
|
788
|
-
exports.
|
|
789
|
-
exports.
|
|
790
|
-
exports.
|
|
791
|
-
exports.
|
|
792
|
-
exports.
|
|
793
|
-
exports.
|
|
738
|
+
exports.Actor = guards_dist_xstateGuards.Actor;
|
|
739
|
+
exports.ActorStatus = guards_dist_xstateGuards.ActorStatus;
|
|
740
|
+
exports.ConstantPrefix = guards_dist_xstateGuards.ConstantPrefix;
|
|
741
|
+
exports.InterpreterStatus = guards_dist_xstateGuards.InterpreterStatus;
|
|
742
|
+
exports.SpecialTargets = guards_dist_xstateGuards.SpecialTargets;
|
|
743
|
+
exports.State = guards_dist_xstateGuards.State;
|
|
744
|
+
exports.and = guards_dist_xstateGuards.and;
|
|
745
|
+
exports.assign = guards_dist_xstateGuards.assign;
|
|
746
|
+
exports.cancel = guards_dist_xstateGuards.cancel;
|
|
747
|
+
exports.choose = guards_dist_xstateGuards.choose;
|
|
748
|
+
exports.createActor = guards_dist_xstateGuards.createActor;
|
|
749
|
+
exports.doneInvoke = guards_dist_xstateGuards.doneInvoke;
|
|
750
|
+
exports.forwardTo = guards_dist_xstateGuards.forwardTo;
|
|
751
|
+
exports.getStateNodes = guards_dist_xstateGuards.getStateNodes;
|
|
752
|
+
exports.interpret = guards_dist_xstateGuards.interpret;
|
|
753
|
+
exports.log = guards_dist_xstateGuards.log;
|
|
754
|
+
exports.matchesState = guards_dist_xstateGuards.matchesState;
|
|
755
|
+
exports.not = guards_dist_xstateGuards.not;
|
|
756
|
+
exports.or = guards_dist_xstateGuards.or;
|
|
757
|
+
exports.pathToStateValue = guards_dist_xstateGuards.pathToStateValue;
|
|
758
|
+
exports.pure = guards_dist_xstateGuards.pure;
|
|
759
|
+
exports.raise = guards_dist_xstateGuards.raise;
|
|
760
|
+
exports.sendParent = guards_dist_xstateGuards.sendParent;
|
|
761
|
+
exports.sendTo = guards_dist_xstateGuards.sendTo;
|
|
762
|
+
exports.stateIn = guards_dist_xstateGuards.stateIn;
|
|
763
|
+
exports.stop = guards_dist_xstateGuards.stop;
|
|
764
|
+
exports.toObserver = guards_dist_xstateGuards.toObserver;
|
|
765
|
+
exports.fromCallback = promise.fromCallback;
|
|
766
|
+
exports.fromEventObservable = promise.fromEventObservable;
|
|
767
|
+
exports.fromObservable = promise.fromObservable;
|
|
768
|
+
exports.fromPromise = promise.fromPromise;
|
|
769
|
+
exports.fromTransition = promise.fromTransition;
|
|
794
770
|
exports.SimulatedClock = SimulatedClock;
|
|
795
771
|
exports.StateMachine = StateMachine;
|
|
796
772
|
exports.StateNode = StateNode;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as
|
|
2
|
-
export {
|
|
1
|
+
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as createInvokeId, g as getDelayedTransitions, h as formatInitialTransition, i as getCandidates, j as getConfiguration, k as getStateNodes, r as resolveStateValue, l as isInFinalState, n as State, o as isErrorEvent, p as cloneState, q as macrostep, s as transitionNode, u as getInitialConfiguration, v as resolveActionsAndContext, w as assign, x as createInitEvent, y as microstep, z as isAtomicStateNode, A as isStateId, B as getStateNodeByPath, C as getPersistedState, D as resolveReferencedActor, E as createActor, F as matchesState } from './actions-9754d2ca.development.esm.js';
|
|
2
|
+
export { G as Actor, H as ActorStatus, a0 as ConstantPrefix, K as InterpreterStatus, a1 as SpecialTargets, n as State, Y as and, w as assign, L as cancel, M as choose, E as createActor, I as doneInvoke, R as forwardTo, k as getStateNodes, J as interpret, O as log, F as matchesState, Z as not, _ as or, W as pathToStateValue, P as pure, Q as raise, T as sendParent, U as sendTo, $ as stateIn, V as stop, X as toObserver } from './actions-9754d2ca.development.esm.js';
|
|
3
|
+
export { f as fromCallback, a as fromEventObservable, b as fromObservable, c as fromPromise, d as fromTransition } from './promise-2ad94e3b.development.esm.js';
|
|
3
4
|
import '../dev/dist/xstate-dev.development.esm.js';
|
|
4
5
|
|
|
5
6
|
const EMPTY_OBJECT = {};
|
|
@@ -194,15 +195,12 @@ class StateNode {
|
|
|
194
195
|
* The logic invoked as actors by this state node.
|
|
195
196
|
*/
|
|
196
197
|
get invoke() {
|
|
197
|
-
return memo(this, 'invoke', () => toArray(this.config.invoke).map((
|
|
198
|
-
const generatedId = createInvokeId(this.id, i);
|
|
199
|
-
const invokeConfig = toInvokeConfig(invocable, generatedId);
|
|
200
|
-
const resolvedId = invokeConfig.id || generatedId;
|
|
201
|
-
const src = invokeConfig.src;
|
|
198
|
+
return memo(this, 'invoke', () => toArray(this.config.invoke).map((invokeConfig, i) => {
|
|
202
199
|
const {
|
|
200
|
+
src,
|
|
203
201
|
systemId
|
|
204
202
|
} = invokeConfig;
|
|
205
|
-
|
|
203
|
+
const resolvedId = invokeConfig.id || createInvokeId(this.id, i);
|
|
206
204
|
// TODO: resolving should not happen here
|
|
207
205
|
const resolvedSrc = typeof src === 'string' ? src : !('type' in src) ? resolvedId : src;
|
|
208
206
|
if (!this.machine.implementations.actors[resolvedId] && typeof src !== 'string' && !('type' in src)) {
|
|
@@ -279,28 +277,6 @@ class StateNode {
|
|
|
279
277
|
return selectedTransition ? [selectedTransition] : undefined;
|
|
280
278
|
}
|
|
281
279
|
|
|
282
|
-
/**
|
|
283
|
-
* The target state value of the history state node, if it exists. This represents the
|
|
284
|
-
* default state value to transition to if no history value exists yet.
|
|
285
|
-
*/
|
|
286
|
-
get target() {
|
|
287
|
-
if (this.type === 'history') {
|
|
288
|
-
const historyConfig = this.config;
|
|
289
|
-
return historyConfig.target;
|
|
290
|
-
}
|
|
291
|
-
return undefined;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* All the state node IDs of this state node and its descendant state nodes.
|
|
296
|
-
*/
|
|
297
|
-
get stateIds() {
|
|
298
|
-
const childStateIds = flatten(Object.keys(this.states).map(stateKey => {
|
|
299
|
-
return this.states[stateKey].stateIds;
|
|
300
|
-
}));
|
|
301
|
-
return [this.id].concat(childStateIds);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
280
|
/**
|
|
305
281
|
* All the event types accepted by this state node and its descendants.
|
|
306
282
|
*/
|
package/dist/xstate.esm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as
|
|
2
|
-
export {
|
|
1
|
+
import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, c as memo, e as evaluateGuard, d as createInvokeId, g as getDelayedTransitions, h as formatInitialTransition, i as getCandidates, j as getConfiguration, k as getStateNodes, r as resolveStateValue, l as isInFinalState, n as State, o as isErrorEvent, p as cloneState, q as macrostep, s as transitionNode, u as getInitialConfiguration, v as resolveActionsAndContext, w as assign, x as createInitEvent, y as microstep, z as isAtomicStateNode, A as isStateId, B as getStateNodeByPath, C as getPersistedState, D as resolveReferencedActor, E as createActor, F as matchesState } from './actions-020463e9.esm.js';
|
|
2
|
+
export { G as Actor, H as ActorStatus, a0 as ConstantPrefix, K as InterpreterStatus, a1 as SpecialTargets, n as State, Y as and, w as assign, L as cancel, M as choose, E as createActor, I as doneInvoke, R as forwardTo, k as getStateNodes, J as interpret, O as log, F as matchesState, Z as not, _ as or, W as pathToStateValue, P as pure, Q as raise, T as sendParent, U as sendTo, $ as stateIn, V as stop, X as toObserver } from './actions-020463e9.esm.js';
|
|
3
|
+
export { f as fromCallback, a as fromEventObservable, b as fromObservable, c as fromPromise, d as fromTransition } from './promise-5b07c38e.esm.js';
|
|
3
4
|
import '../dev/dist/xstate-dev.esm.js';
|
|
4
5
|
|
|
5
6
|
const EMPTY_OBJECT = {};
|
|
@@ -194,15 +195,12 @@ class StateNode {
|
|
|
194
195
|
* The logic invoked as actors by this state node.
|
|
195
196
|
*/
|
|
196
197
|
get invoke() {
|
|
197
|
-
return memo(this, 'invoke', () => toArray(this.config.invoke).map((
|
|
198
|
-
const generatedId = createInvokeId(this.id, i);
|
|
199
|
-
const invokeConfig = toInvokeConfig(invocable, generatedId);
|
|
200
|
-
const resolvedId = invokeConfig.id || generatedId;
|
|
201
|
-
const src = invokeConfig.src;
|
|
198
|
+
return memo(this, 'invoke', () => toArray(this.config.invoke).map((invokeConfig, i) => {
|
|
202
199
|
const {
|
|
200
|
+
src,
|
|
203
201
|
systemId
|
|
204
202
|
} = invokeConfig;
|
|
205
|
-
|
|
203
|
+
const resolvedId = invokeConfig.id || createInvokeId(this.id, i);
|
|
206
204
|
// TODO: resolving should not happen here
|
|
207
205
|
const resolvedSrc = typeof src === 'string' ? src : !('type' in src) ? resolvedId : src;
|
|
208
206
|
if (!this.machine.implementations.actors[resolvedId] && typeof src !== 'string' && !('type' in src)) {
|
|
@@ -279,28 +277,6 @@ class StateNode {
|
|
|
279
277
|
return selectedTransition ? [selectedTransition] : undefined;
|
|
280
278
|
}
|
|
281
279
|
|
|
282
|
-
/**
|
|
283
|
-
* The target state value of the history state node, if it exists. This represents the
|
|
284
|
-
* default state value to transition to if no history value exists yet.
|
|
285
|
-
*/
|
|
286
|
-
get target() {
|
|
287
|
-
if (this.type === 'history') {
|
|
288
|
-
const historyConfig = this.config;
|
|
289
|
-
return historyConfig.target;
|
|
290
|
-
}
|
|
291
|
-
return undefined;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* All the state node IDs of this state node and its descendant state nodes.
|
|
296
|
-
*/
|
|
297
|
-
get stateIds() {
|
|
298
|
-
const childStateIds = flatten(Object.keys(this.states).map(stateKey => {
|
|
299
|
-
return this.states[stateKey].stateIds;
|
|
300
|
-
}));
|
|
301
|
-
return [this.id].concat(childStateIds);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
280
|
/**
|
|
305
281
|
* All the event types accepted by this state node and its descendants.
|
|
306
282
|
*/
|