xstate 5.0.0-beta.26 → 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.
Files changed (57) hide show
  1. package/actions/dist/xstate-actions.cjs.js +20 -18
  2. package/actions/dist/xstate-actions.cjs.mjs +2 -0
  3. package/actions/dist/xstate-actions.development.cjs.js +20 -18
  4. package/actions/dist/xstate-actions.development.cjs.mjs +2 -0
  5. package/actions/dist/xstate-actions.development.esm.js +1 -1
  6. package/actions/dist/xstate-actions.esm.js +1 -1
  7. package/actions/dist/xstate-actions.umd.min.js +1 -1
  8. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  9. package/actors/dist/xstate-actors.cjs.js +37 -14
  10. package/actors/dist/xstate-actors.cjs.mjs +0 -5
  11. package/actors/dist/xstate-actors.development.cjs.js +37 -14
  12. package/actors/dist/xstate-actors.development.cjs.mjs +0 -5
  13. package/actors/dist/xstate-actors.development.esm.js +34 -1
  14. package/actors/dist/xstate-actors.esm.js +34 -1
  15. package/actors/dist/xstate-actors.umd.min.js +1 -1
  16. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  17. package/dist/{actions-5943a9db.esm.js → actions-020463e9.esm.js} +76 -532
  18. package/dist/{actions-cf69419d.development.esm.js → actions-9754d2ca.development.esm.js} +76 -532
  19. package/dist/{actions-0971b43d.development.cjs.js → actions-ca622922.development.cjs.js} +81 -546
  20. package/dist/{actions-319cefe7.cjs.js → actions-d1dba4ac.cjs.js} +81 -546
  21. package/dist/declarations/src/Machine.d.ts +4 -3
  22. package/dist/declarations/src/State.d.ts +1 -1
  23. package/dist/declarations/src/StateNode.d.ts +0 -9
  24. package/dist/declarations/src/actions/assign.d.ts +6 -11
  25. package/dist/declarations/src/actions/cancel.d.ts +5 -12
  26. package/dist/declarations/src/actions/choose.d.ts +7 -6
  27. package/dist/declarations/src/actions/log.d.ts +5 -20
  28. package/dist/declarations/src/actions/pure.d.ts +9 -8
  29. package/dist/declarations/src/actions/raise.d.ts +6 -5
  30. package/dist/declarations/src/actions/send.d.ts +7 -12
  31. package/dist/declarations/src/actions/stop.d.ts +5 -12
  32. package/dist/declarations/src/actions.d.ts +2 -0
  33. package/dist/declarations/src/actors/index.d.ts +0 -20
  34. package/dist/declarations/src/actors/promise.d.ts +2 -1
  35. package/dist/declarations/src/constants.d.ts +7 -0
  36. package/dist/declarations/src/guards.d.ts +2 -2
  37. package/dist/declarations/src/index.d.ts +14 -14
  38. package/dist/declarations/src/typegenTypes.d.ts +1 -1
  39. package/dist/declarations/src/types.d.ts +10 -15
  40. package/dist/declarations/src/utils.d.ts +1 -2
  41. package/dist/promise-2ad94e3b.development.esm.js +406 -0
  42. package/dist/promise-3b7e3357.development.cjs.js +412 -0
  43. package/dist/promise-5b07c38e.esm.js +406 -0
  44. package/dist/promise-7a8c1768.cjs.js +412 -0
  45. package/dist/xstate.cjs.js +78 -102
  46. package/dist/xstate.development.cjs.js +78 -102
  47. package/dist/xstate.development.esm.js +6 -30
  48. package/dist/xstate.esm.js +6 -30
  49. package/dist/xstate.umd.min.js +1 -1
  50. package/dist/xstate.umd.min.js.map +1 -1
  51. package/guards/dist/xstate-guards.cjs.js +6 -6
  52. package/guards/dist/xstate-guards.development.cjs.js +6 -6
  53. package/guards/dist/xstate-guards.development.esm.js +1 -1
  54. package/guards/dist/xstate-guards.esm.js +1 -1
  55. package/guards/dist/xstate-guards.umd.min.js +1 -1
  56. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  57. package/package.json +1 -1
@@ -2,7 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var actors_dist_xstateActors = require('./actions-0971b43d.development.cjs.js');
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(actors_dist_xstateActors.STATE_DELIMITER);
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 ? actors_dist_xstateActors.mapValues(this.config.states, (stateConfig, key) => {
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 = actors_dist_xstateActors.toArray(this.config.entry).slice();
136
- this.exit = actors_dist_xstateActors.toArray(this.config.exit).slice();
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 = actors_dist_xstateActors.toArray(config.tags).slice();
140
+ this.tags = guards_dist_xstateGuards.toArray(config.tags).slice();
140
141
  }
141
142
  _initialize() {
142
- this.transitions = actors_dist_xstateActors.formatTransitions(this);
143
+ this.transitions = guards_dist_xstateGuards.formatTransitions(this);
143
144
  if (this.config.always) {
144
- this.always = actors_dist_xstateActors.toTransitionConfigArray(this.config.always).map(t => actors_dist_xstateActors.formatTransition(this, actors_dist_xstateActors.NULL_EVENT, t));
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: actors_dist_xstateActors.mapValues(this.states, state => {
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 actors_dist_xstateActors.memo(this, 'invoke', () => actors_dist_xstateActors.toArray(this.config.invoke).map((invocable, i) => {
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 actors_dist_xstateActors.memo(this, 'on', () => {
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 actors_dist_xstateActors.memo(this, 'delayedTransitions', () => actors_dist_xstateActors.getDelayedTransitions(this));
252
+ return guards_dist_xstateGuards.memo(this, 'delayedTransitions', () => guards_dist_xstateGuards.getDelayedTransitions(this));
255
253
  }
256
254
  get initial() {
257
- return actors_dist_xstateActors.memo(this, 'initial', () => actors_dist_xstateActors.formatInitialTransition(this, this.config.initial || []));
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 = actors_dist_xstateActors.memo(this, `candidates-${eventType}`, () => actors_dist_xstateActors.getCandidates(this, eventType));
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 || actors_dist_xstateActors.evaluateGuard(guard, resolvedContext, event, state);
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 actors_dist_xstateActors.memo(this, 'events', () => {
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 = actors_dist_xstateActors.getConfiguration(actors_dist_xstateActors.getStateNodes(this.root, state.value));
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: actors_dist_xstateActors.resolveStateValue(this.root, state.value),
417
+ value: guards_dist_xstateGuards.resolveStateValue(this.root, state.value),
442
418
  configuration,
443
- done: actors_dist_xstateActors.isInFinalState(configuration)
419
+ done: guards_dist_xstateGuards.isInFinalState(configuration)
444
420
  });
445
421
  }
446
422
  resolveStateValue(stateValue, ...[context]) {
447
- const resolvedStateValue = actors_dist_xstateActors.resolveStateValue(this.root, stateValue);
448
- return this.resolveState(actors_dist_xstateActors.State.from(resolvedStateValue, context, this));
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 (actors_dist_xstateActors.isErrorEvent(event) && !state.nextEvents.some(nextEvent => nextEvent === event.type)) {
461
- return actors_dist_xstateActors.cloneState(state, {
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
- } = actors_dist_xstateActors.macrostep(state, event, actorCtx);
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 actors_dist_xstateActors.macrostep(state, event, actorCtx).microstates;
455
+ return guards_dist_xstateGuards.macrostep(state, event, actorCtx).microstates;
480
456
  }
481
457
  getTransitionData(state, event) {
482
- return actors_dist_xstateActors.transitionNode(this.root, state.value, state, event) || [];
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: actors_dist_xstateActors.getInitialConfiguration(this.root),
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 actors_dist_xstateActors.resolveActionsAndContext([actors_dist_xstateActors.assign(assignment)], initEvent, preInitial, actorCtx);
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 = actors_dist_xstateActors.createInitEvent(input); // TODO: fix;
494
+ const initEvent = guards_dist_xstateGuards.createInitEvent(input); // TODO: fix;
519
495
 
520
496
  const preInitialState = this.getPreInitialState(actorCtx, initEvent);
521
- const nextState = actors_dist_xstateActors.microstep([{
522
- target: [...preInitialState.configuration].filter(actors_dist_xstateActors.isAtomicStateNode),
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
- } = actors_dist_xstateActors.macrostep(nextState, initEvent, actorCtx);
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(actors_dist_xstateActors.STATE_DELIMITER);
518
+ const fullPath = stateId.split(guards_dist_xstateGuards.STATE_DELIMITER);
543
519
  const relativePath = fullPath.slice(1);
544
- const resolvedStateId = actors_dist_xstateActors.isStateId(fullPath[0]) ? fullPath[0].slice(STATE_IDENTIFIER.length) : fullPath[0];
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 actors_dist_xstateActors.getStateNodeByPath(stateNode, relativePath);
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 actors_dist_xstateActors.getPersistedState(state);
534
+ return guards_dist_xstateGuards.getPersistedState(state);
559
535
  }
560
536
  createState(stateConfig) {
561
- return stateConfig instanceof actors_dist_xstateActors.State ? stateConfig : new actors_dist_xstateActors.State(stateConfig, this);
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 ? actors_dist_xstateActors.resolveReferencedActor(this.implementations.actors[src])?.src : undefined;
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 = actors_dist_xstateActors.createActor(logic, {
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 actors_dist_xstateActors.State({
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 = actors_dist_xstateActors.resolveReferencedActor(this.implementations.actors[src]);
583
+ const referenced = guards_dist_xstateGuards.resolveReferencedActor(this.implementations.actors[src]);
608
584
  if (referenced) {
609
- const actorRef = actors_dist_xstateActors.createActor(referenced.src, {
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 (actors_dist_xstateActors.matchesState(mappedStateId, stateId) && (!foundStateId || stateId.length > foundStateId.length)) {
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 = actors_dist_xstateActors.Actor;
763
- exports.ActorStatus = actors_dist_xstateActors.ActorStatus;
764
- exports.ConstantPrefix = actors_dist_xstateActors.ConstantPrefix;
765
- exports.InterpreterStatus = actors_dist_xstateActors.InterpreterStatus;
766
- exports.SpecialTargets = actors_dist_xstateActors.SpecialTargets;
767
- exports.State = actors_dist_xstateActors.State;
768
- exports.and = actors_dist_xstateActors.and;
769
- exports.assign = actors_dist_xstateActors.assign;
770
- exports.cancel = actors_dist_xstateActors.cancel;
771
- exports.choose = actors_dist_xstateActors.choose;
772
- exports.createActor = actors_dist_xstateActors.createActor;
773
- exports.doneInvoke = actors_dist_xstateActors.doneInvoke;
774
- exports.forwardTo = actors_dist_xstateActors.forwardTo;
775
- exports.fromCallback = actors_dist_xstateActors.fromCallback;
776
- exports.fromEventObservable = actors_dist_xstateActors.fromEventObservable;
777
- exports.fromObservable = actors_dist_xstateActors.fromObservable;
778
- exports.fromPromise = actors_dist_xstateActors.fromPromise;
779
- exports.fromTransition = actors_dist_xstateActors.fromTransition;
780
- exports.getStateNodes = actors_dist_xstateActors.getStateNodes;
781
- exports.interpret = actors_dist_xstateActors.interpret;
782
- exports.log = actors_dist_xstateActors.log;
783
- exports.matchesState = actors_dist_xstateActors.matchesState;
784
- exports.not = actors_dist_xstateActors.not;
785
- exports.or = actors_dist_xstateActors.or;
786
- exports.pathToStateValue = actors_dist_xstateActors.pathToStateValue;
787
- exports.pure = actors_dist_xstateActors.pure;
788
- exports.raise = actors_dist_xstateActors.raise;
789
- exports.sendParent = actors_dist_xstateActors.sendParent;
790
- exports.sendTo = actors_dist_xstateActors.sendTo;
791
- exports.stateIn = actors_dist_xstateActors.stateIn;
792
- exports.stop = actors_dist_xstateActors.stop;
793
- exports.toObserver = actors_dist_xstateActors.toObserver;
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 flatten, g as createInvokeId, h as getDelayedTransitions, i as formatInitialTransition, j as getCandidates, k as toInvokeConfig, l as getConfiguration, n as getStateNodes, r as resolveStateValue, o as isInFinalState, p as State, q as isErrorEvent, s as cloneState, u as macrostep, v as transitionNode, w as getInitialConfiguration, x as resolveActionsAndContext, y as assign, z as createInitEvent, A as microstep, B as isAtomicStateNode, C as isStateId, D as getStateNodeByPath, E as getPersistedState, F as resolveReferencedActor, G as createActor, H as matchesState } from './actions-cf69419d.development.esm.js';
2
- export { M as Actor, O as ActorStatus, a7 as ConstantPrefix, P as InterpreterStatus, a8 as SpecialTargets, p as State, a5 as and, y as assign, R as cancel, T as choose, G as createActor, Q as doneInvoke, K as forwardTo, a0 as fromCallback, a1 as fromEventObservable, $ as fromObservable, _ as fromPromise, a2 as fromTransition, n as getStateNodes, L as interpret, U as log, H as matchesState, a4 as not, a6 as or, Y as pathToStateValue, V as pure, W as raise, J as sendParent, I as sendTo, a3 as stateIn, X as stop, Z as toObserver } from './actions-cf69419d.development.esm.js';
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((invocable, i) => {
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
  */
@@ -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 flatten, g as createInvokeId, h as getDelayedTransitions, i as formatInitialTransition, j as getCandidates, k as toInvokeConfig, l as getConfiguration, n as getStateNodes, r as resolveStateValue, o as isInFinalState, p as State, q as isErrorEvent, s as cloneState, u as macrostep, v as transitionNode, w as getInitialConfiguration, x as resolveActionsAndContext, y as assign, z as createInitEvent, A as microstep, B as isAtomicStateNode, C as isStateId, D as getStateNodeByPath, E as getPersistedState, F as resolveReferencedActor, G as createActor, H as matchesState } from './actions-5943a9db.esm.js';
2
- export { M as Actor, O as ActorStatus, a7 as ConstantPrefix, P as InterpreterStatus, a8 as SpecialTargets, p as State, a5 as and, y as assign, R as cancel, T as choose, G as createActor, Q as doneInvoke, K as forwardTo, a0 as fromCallback, a1 as fromEventObservable, $ as fromObservable, _ as fromPromise, a2 as fromTransition, n as getStateNodes, L as interpret, U as log, H as matchesState, a4 as not, a6 as or, Y as pathToStateValue, V as pure, W as raise, J as sendParent, I as sendTo, a3 as stateIn, X as stop, Z as toObserver } from './actions-5943a9db.esm.js';
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((invocable, i) => {
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
  */