xstate 5.0.0-alpha.3 → 5.0.0-alpha.5

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 (50) hide show
  1. package/actions/dist/xstate-actions.cjs.dev.js +1 -1
  2. package/actions/dist/xstate-actions.cjs.prod.js +1 -1
  3. package/actions/dist/xstate-actions.esm.js +1 -1
  4. package/actions/dist/xstate-actions.umd.min.js +1 -1
  5. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  6. package/actors/dist/xstate-actors.cjs.dev.js +1 -1
  7. package/actors/dist/xstate-actors.cjs.prod.js +1 -1
  8. package/actors/dist/xstate-actors.esm.js +1 -1
  9. package/actors/dist/xstate-actors.umd.min.js +1 -1
  10. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  11. package/dev/dist/xstate-dev.umd.min.js.map +1 -1
  12. package/dist/{actions-3910d35f.cjs.prod.js → actions-2479953d.cjs.prod.js} +80 -89
  13. package/dist/{actions-4fe4ada8.esm.js → actions-7678b87b.esm.js} +80 -89
  14. package/dist/{actions-3f0ba11b.cjs.dev.js → actions-96f799fc.cjs.dev.js} +80 -89
  15. package/dist/declarations/src/Machine.d.ts +3 -3
  16. package/dist/declarations/src/SimulatedClock.d.ts +1 -1
  17. package/dist/declarations/src/State.d.ts +3 -3
  18. package/dist/declarations/src/StateMachine.d.ts +4 -4
  19. package/dist/declarations/src/StateNode.d.ts +3 -3
  20. package/dist/declarations/src/actionTypes.d.ts +1 -1
  21. package/dist/declarations/src/actions/assign.d.ts +1 -1
  22. package/dist/declarations/src/actions/cancel.d.ts +2 -2
  23. package/dist/declarations/src/actions/choose.d.ts +2 -2
  24. package/dist/declarations/src/actions/invoke.d.ts +2 -2
  25. package/dist/declarations/src/actions/log.d.ts +2 -2
  26. package/dist/declarations/src/actions/pure.d.ts +1 -1
  27. package/dist/declarations/src/actions/raise.d.ts +1 -1
  28. package/dist/declarations/src/actions/send.d.ts +2 -2
  29. package/dist/declarations/src/actions/stop.d.ts +1 -1
  30. package/dist/declarations/src/actions.d.ts +10 -10
  31. package/dist/declarations/src/actors/index.d.ts +5 -5
  32. package/dist/declarations/src/dev/index.d.ts +1 -1
  33. package/dist/declarations/src/guards.d.ts +2 -2
  34. package/dist/declarations/src/index.d.ts +21 -21
  35. package/dist/declarations/src/interpreter.d.ts +4 -4
  36. package/dist/declarations/src/spawn.d.ts +1 -1
  37. package/dist/declarations/src/stateUtils.d.ts +4 -4
  38. package/dist/declarations/src/typegenTypes.d.ts +1 -1
  39. package/dist/declarations/src/types.d.ts +14 -16
  40. package/dist/declarations/src/utils.d.ts +4 -4
  41. package/dist/xstate.cjs.dev.js +2 -1
  42. package/dist/xstate.cjs.prod.js +2 -1
  43. package/dist/xstate.esm.js +3 -2
  44. package/dist/xstate.umd.min.js +1 -1
  45. package/dist/xstate.umd.min.js.map +1 -1
  46. package/guards/dist/xstate-guards.cjs.dev.js +1 -1
  47. package/guards/dist/xstate-guards.cjs.prod.js +1 -1
  48. package/guards/dist/xstate-guards.esm.js +1 -1
  49. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  50. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"xstate-dev.umd.min.js","sources":["../../src/dev/index.ts"],"sourcesContent":["import { IS_PRODUCTION } from '../environment.js';\nimport { AnyInterpreter, DevToolsAdapter } from '../types.js';\n\ninterface DevInterface {\n services: Set<AnyInterpreter>;\n register(service: AnyInterpreter): void;\n onRegister(listener: ServiceListener): void;\n}\ntype ServiceListener = (service: AnyInterpreter) => void;\n\nexport interface XStateDevInterface {\n register: (service: AnyInterpreter) => void;\n unregister: (service: AnyInterpreter) => void;\n onRegister: (\n listener: ServiceListener\n ) => {\n unsubscribe: () => void;\n };\n services: Set<AnyInterpreter>;\n}\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis\nexport function getGlobal(): typeof globalThis | undefined {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n if (!IS_PRODUCTION) {\n console.warn(\n 'XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues'\n );\n }\n}\n\nfunction getDevTools(): DevInterface | undefined {\n const w = getGlobal();\n if (!!(w as any).__xstate__) {\n return (w as any).__xstate__;\n }\n\n return undefined;\n}\n\nexport function registerService(service: AnyInterpreter) {\n if (typeof window === 'undefined') {\n return;\n }\n\n const devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n}\n\nexport const devToolsAdapter: DevToolsAdapter = (service) => {\n if (typeof window === 'undefined') {\n return;\n }\n\n const devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n};\n"],"names":["getGlobal","globalThis","self","window","getDevTools","w","__xstate__","service","devTools","register"],"mappings":"iPAsBO,SAASA,IACd,MAA0B,oBAAfC,WACFA,WAEW,oBAATC,KACFA,KAGAC,OAYX,SAASC,IACP,IAAMC,EAAIL,IACV,GAAOK,EAAUC,WACf,OAAQD,EAAUC,6BAkB0B,SAACC,GAK/C,IAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF,oCApBf,SAAyBA,GAK9B,IAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF"}
1
+ {"version":3,"file":"xstate-dev.umd.min.js","sources":["../../src/dev/index.ts"],"sourcesContent":["import { IS_PRODUCTION } from '../environment.ts';\nimport { AnyInterpreter, DevToolsAdapter } from '../types.ts';\n\ninterface DevInterface {\n services: Set<AnyInterpreter>;\n register(service: AnyInterpreter): void;\n onRegister(listener: ServiceListener): void;\n}\ntype ServiceListener = (service: AnyInterpreter) => void;\n\nexport interface XStateDevInterface {\n register: (service: AnyInterpreter) => void;\n unregister: (service: AnyInterpreter) => void;\n onRegister: (listener: ServiceListener) => {\n unsubscribe: () => void;\n };\n services: Set<AnyInterpreter>;\n}\n\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis\nexport function getGlobal(): typeof globalThis | undefined {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n if (!IS_PRODUCTION) {\n console.warn(\n 'XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues'\n );\n }\n}\n\nfunction getDevTools(): DevInterface | undefined {\n const w = getGlobal();\n if (!!(w as any).__xstate__) {\n return (w as any).__xstate__;\n }\n\n return undefined;\n}\n\nexport function registerService(service: AnyInterpreter) {\n if (typeof window === 'undefined') {\n return;\n }\n\n const devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n}\n\nexport const devToolsAdapter: DevToolsAdapter = (service) => {\n if (typeof window === 'undefined') {\n return;\n }\n\n const devTools = getDevTools();\n\n if (devTools) {\n devTools.register(service);\n }\n};\n"],"names":["getGlobal","globalThis","self","window","getDevTools","w","__xstate__","service","devTools","register"],"mappings":"iPAoBO,SAASA,IACd,MAA0B,oBAAfC,WACFA,WAEW,oBAATC,KACFA,KAGAC,OAYX,SAASC,IACP,IAAMC,EAAIL,IACV,GAAOK,EAAUC,WACf,OAAQD,EAAUC,6BAkB0B,SAACC,GAK/C,IAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF,oCApBf,SAAyBA,GAK9B,IAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF"}
@@ -513,7 +513,6 @@ function send$1(eventOrExpr, options) {
513
513
  context: state.context,
514
514
  event: _event.data,
515
515
  _event: _event,
516
- state: state,
517
516
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : null,
518
517
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
519
518
  };
@@ -688,6 +687,86 @@ function _createClass(Constructor, protoProps, staticProps) {
688
687
  return Constructor;
689
688
  }
690
689
 
690
+ var Mailbox = /*#__PURE__*/function () {
691
+ function Mailbox(_process) {
692
+ _classCallCheck(this, Mailbox);
693
+ this._process = _process;
694
+ _defineProperty(this, "_active", false);
695
+ _defineProperty(this, "_current", null);
696
+ _defineProperty(this, "_last", null);
697
+ }
698
+ _createClass(Mailbox, [{
699
+ key: "start",
700
+ value: function start() {
701
+ this._active = true;
702
+ this.flush();
703
+ }
704
+ }, {
705
+ key: "clear",
706
+ value: function clear() {
707
+ // we can't set _current to null because we might be currently processing
708
+ // and enqueue following clear shouldnt start processing the enqueued item immediately
709
+ if (this._current) {
710
+ this._current.next = null;
711
+ this._last = this._current;
712
+ }
713
+ }
714
+
715
+ // TODO: rethink this design
716
+ }, {
717
+ key: "prepend",
718
+ value: function prepend(event) {
719
+ if (!this._current) {
720
+ this.enqueue(event);
721
+ return;
722
+ }
723
+
724
+ // we know that something is already queued up
725
+ // so the mailbox is already flushing or it's inactive
726
+ // therefore the only thing that we need to do is to reassign `this._current`
727
+ this._current = {
728
+ value: event,
729
+ next: this._current
730
+ };
731
+ }
732
+ }, {
733
+ key: "enqueue",
734
+ value: function enqueue(event) {
735
+ var enqueued = {
736
+ value: event,
737
+ next: null
738
+ };
739
+ if (this._current) {
740
+ this._last.next = enqueued;
741
+ this._last = enqueued;
742
+ return;
743
+ }
744
+ this._current = enqueued;
745
+ this._last = enqueued;
746
+ if (this._active) {
747
+ this.flush();
748
+ }
749
+ }
750
+ }, {
751
+ key: "flush",
752
+ value: function flush() {
753
+ while (this._current) {
754
+ // atm the given _process is responsible for implementing proper try/catch handling
755
+ // we assume here that this won't throw in a way that can affect this mailbox
756
+ var consumed = this._current;
757
+ this._process(consumed.value);
758
+ // something could have been prepended in the meantime
759
+ // so we need to be defensive here to avoid skipping over a prepended item
760
+ if (consumed === this._current) {
761
+ this._current = this._current.next;
762
+ }
763
+ }
764
+ this._last = null;
765
+ }
766
+ }]);
767
+ return Mailbox;
768
+ }();
769
+
691
770
  var symbolObservable = function () {
692
771
  return typeof Symbol === 'function' && Symbol.observable || '@@observable';
693
772
  }();
@@ -1153,86 +1232,6 @@ function toActorRef(actorRefLike) {
1153
1232
  }), _objectSpread2$1), actorRefLike);
1154
1233
  }
1155
1234
 
1156
- var Mailbox = /*#__PURE__*/function () {
1157
- function Mailbox(_process) {
1158
- _classCallCheck(this, Mailbox);
1159
- this._process = _process;
1160
- _defineProperty(this, "_active", false);
1161
- _defineProperty(this, "_current", null);
1162
- _defineProperty(this, "_last", null);
1163
- }
1164
- _createClass(Mailbox, [{
1165
- key: "start",
1166
- value: function start() {
1167
- this._active = true;
1168
- this.flush();
1169
- }
1170
- }, {
1171
- key: "clear",
1172
- value: function clear() {
1173
- // we can't set _current to null because we might be currently processing
1174
- // and enqueue following clear shouldnt start processing the enqueued item immediately
1175
- if (this._current) {
1176
- this._current.next = null;
1177
- this._last = this._current;
1178
- }
1179
- }
1180
-
1181
- // TODO: rethink this design
1182
- }, {
1183
- key: "prepend",
1184
- value: function prepend(event) {
1185
- if (!this._current) {
1186
- this.enqueue(event);
1187
- return;
1188
- }
1189
-
1190
- // we know that something is already queued up
1191
- // so the mailbox is already flushing or it's inactive
1192
- // therefore the only thing that we need to do is to reassign `this._current`
1193
- this._current = {
1194
- value: event,
1195
- next: this._current
1196
- };
1197
- }
1198
- }, {
1199
- key: "enqueue",
1200
- value: function enqueue(event) {
1201
- var enqueued = {
1202
- value: event,
1203
- next: null
1204
- };
1205
- if (this._current) {
1206
- this._last.next = enqueued;
1207
- this._last = enqueued;
1208
- return;
1209
- }
1210
- this._current = enqueued;
1211
- this._last = enqueued;
1212
- if (this._active) {
1213
- this.flush();
1214
- }
1215
- }
1216
- }, {
1217
- key: "flush",
1218
- value: function flush() {
1219
- while (this._current) {
1220
- // atm the given _process is responsible for implementing proper try/catch handling
1221
- // we assume here that this won't throw in a way that can affect this mailbox
1222
- var consumed = this._current;
1223
- this._process(consumed.value);
1224
- // something could have been prepended in the meantime
1225
- // so we need to be defensive here to avoid skipping over a prepended item
1226
- if (consumed === this._current) {
1227
- this._current = this._current.next;
1228
- }
1229
- }
1230
- this._last = null;
1231
- }
1232
- }]);
1233
- return Mailbox;
1234
- }();
1235
-
1236
1235
  function createSystem() {
1237
1236
  var sessionIdCounter = 0;
1238
1237
  var children = new Map();
@@ -1792,7 +1791,6 @@ function log$1() {
1792
1791
  context: state.context,
1793
1792
  event: _event.data,
1794
1793
  _event: _event,
1795
- state: state,
1796
1794
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
1797
1795
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
1798
1796
  }) : expr;
@@ -1837,8 +1835,6 @@ function cancel$1(sendId) {
1837
1835
  context: state.context,
1838
1836
  event: _event.data,
1839
1837
  _event: _event,
1840
- state: state,
1841
- // TODO: fix types,
1842
1838
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
1843
1839
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
1844
1840
  }) : sendId;
@@ -3949,7 +3945,6 @@ function assign$1(assignment) {
3949
3945
  var args = {
3950
3946
  context: state.context,
3951
3947
  event: _event.data,
3952
- state: state,
3953
3948
  action: action,
3954
3949
  _event: _event,
3955
3950
  spawn: createSpawner(actorContext === null || actorContext === void 0 ? void 0 : actorContext.self, state.machine, state.context, _event, capturedActions),
@@ -4007,8 +4002,6 @@ function raise$1(eventOrExpr, options) {
4007
4002
  context: state.context,
4008
4003
  event: _event.data,
4009
4004
  _event: _event,
4010
- state: state,
4011
- // TODO: fix
4012
4005
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
4013
4006
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
4014
4007
  };
@@ -4089,7 +4082,6 @@ function resolveActionObject(actionObject, actionFunctionMap) {
4089
4082
  event: state.event,
4090
4083
  action: a,
4091
4084
  _event: state._event,
4092
- state: state,
4093
4085
  system: actorCtx.system,
4094
4086
  self: actorCtx.self
4095
4087
  });
@@ -4131,7 +4123,6 @@ function toActionObject(action) {
4131
4123
  event: _event.data,
4132
4124
  action: actionObject,
4133
4125
  _event: _event,
4134
- state: state,
4135
4126
  self: actorCtx.self,
4136
4127
  system: actorCtx.system
4137
4128
  });
@@ -560,7 +560,6 @@ function send$1(eventOrExpr, options) {
560
560
  context: state.context,
561
561
  event: _event.data,
562
562
  _event: _event,
563
- state: state,
564
563
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : null,
565
564
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
566
565
  };
@@ -735,6 +734,86 @@ function _createClass(Constructor, protoProps, staticProps) {
735
734
  return Constructor;
736
735
  }
737
736
 
737
+ var Mailbox = /*#__PURE__*/function () {
738
+ function Mailbox(_process) {
739
+ _classCallCheck(this, Mailbox);
740
+ this._process = _process;
741
+ _defineProperty(this, "_active", false);
742
+ _defineProperty(this, "_current", null);
743
+ _defineProperty(this, "_last", null);
744
+ }
745
+ _createClass(Mailbox, [{
746
+ key: "start",
747
+ value: function start() {
748
+ this._active = true;
749
+ this.flush();
750
+ }
751
+ }, {
752
+ key: "clear",
753
+ value: function clear() {
754
+ // we can't set _current to null because we might be currently processing
755
+ // and enqueue following clear shouldnt start processing the enqueued item immediately
756
+ if (this._current) {
757
+ this._current.next = null;
758
+ this._last = this._current;
759
+ }
760
+ }
761
+
762
+ // TODO: rethink this design
763
+ }, {
764
+ key: "prepend",
765
+ value: function prepend(event) {
766
+ if (!this._current) {
767
+ this.enqueue(event);
768
+ return;
769
+ }
770
+
771
+ // we know that something is already queued up
772
+ // so the mailbox is already flushing or it's inactive
773
+ // therefore the only thing that we need to do is to reassign `this._current`
774
+ this._current = {
775
+ value: event,
776
+ next: this._current
777
+ };
778
+ }
779
+ }, {
780
+ key: "enqueue",
781
+ value: function enqueue(event) {
782
+ var enqueued = {
783
+ value: event,
784
+ next: null
785
+ };
786
+ if (this._current) {
787
+ this._last.next = enqueued;
788
+ this._last = enqueued;
789
+ return;
790
+ }
791
+ this._current = enqueued;
792
+ this._last = enqueued;
793
+ if (this._active) {
794
+ this.flush();
795
+ }
796
+ }
797
+ }, {
798
+ key: "flush",
799
+ value: function flush() {
800
+ while (this._current) {
801
+ // atm the given _process is responsible for implementing proper try/catch handling
802
+ // we assume here that this won't throw in a way that can affect this mailbox
803
+ var consumed = this._current;
804
+ this._process(consumed.value);
805
+ // something could have been prepended in the meantime
806
+ // so we need to be defensive here to avoid skipping over a prepended item
807
+ if (consumed === this._current) {
808
+ this._current = this._current.next;
809
+ }
810
+ }
811
+ this._last = null;
812
+ }
813
+ }]);
814
+ return Mailbox;
815
+ }();
816
+
738
817
  var symbolObservable = function () {
739
818
  return typeof Symbol === 'function' && Symbol.observable || '@@observable';
740
819
  }();
@@ -1200,86 +1279,6 @@ function toActorRef(actorRefLike) {
1200
1279
  }), _objectSpread2$1), actorRefLike);
1201
1280
  }
1202
1281
 
1203
- var Mailbox = /*#__PURE__*/function () {
1204
- function Mailbox(_process) {
1205
- _classCallCheck(this, Mailbox);
1206
- this._process = _process;
1207
- _defineProperty(this, "_active", false);
1208
- _defineProperty(this, "_current", null);
1209
- _defineProperty(this, "_last", null);
1210
- }
1211
- _createClass(Mailbox, [{
1212
- key: "start",
1213
- value: function start() {
1214
- this._active = true;
1215
- this.flush();
1216
- }
1217
- }, {
1218
- key: "clear",
1219
- value: function clear() {
1220
- // we can't set _current to null because we might be currently processing
1221
- // and enqueue following clear shouldnt start processing the enqueued item immediately
1222
- if (this._current) {
1223
- this._current.next = null;
1224
- this._last = this._current;
1225
- }
1226
- }
1227
-
1228
- // TODO: rethink this design
1229
- }, {
1230
- key: "prepend",
1231
- value: function prepend(event) {
1232
- if (!this._current) {
1233
- this.enqueue(event);
1234
- return;
1235
- }
1236
-
1237
- // we know that something is already queued up
1238
- // so the mailbox is already flushing or it's inactive
1239
- // therefore the only thing that we need to do is to reassign `this._current`
1240
- this._current = {
1241
- value: event,
1242
- next: this._current
1243
- };
1244
- }
1245
- }, {
1246
- key: "enqueue",
1247
- value: function enqueue(event) {
1248
- var enqueued = {
1249
- value: event,
1250
- next: null
1251
- };
1252
- if (this._current) {
1253
- this._last.next = enqueued;
1254
- this._last = enqueued;
1255
- return;
1256
- }
1257
- this._current = enqueued;
1258
- this._last = enqueued;
1259
- if (this._active) {
1260
- this.flush();
1261
- }
1262
- }
1263
- }, {
1264
- key: "flush",
1265
- value: function flush() {
1266
- while (this._current) {
1267
- // atm the given _process is responsible for implementing proper try/catch handling
1268
- // we assume here that this won't throw in a way that can affect this mailbox
1269
- var consumed = this._current;
1270
- this._process(consumed.value);
1271
- // something could have been prepended in the meantime
1272
- // so we need to be defensive here to avoid skipping over a prepended item
1273
- if (consumed === this._current) {
1274
- this._current = this._current.next;
1275
- }
1276
- }
1277
- this._last = null;
1278
- }
1279
- }]);
1280
- return Mailbox;
1281
- }();
1282
-
1283
1282
  function createSystem() {
1284
1283
  var sessionIdCounter = 0;
1285
1284
  var children = new Map();
@@ -1845,7 +1844,6 @@ function log$1() {
1845
1844
  context: state.context,
1846
1845
  event: _event.data,
1847
1846
  _event: _event,
1848
- state: state,
1849
1847
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
1850
1848
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
1851
1849
  }) : expr;
@@ -1890,8 +1888,6 @@ function cancel$1(sendId) {
1890
1888
  context: state.context,
1891
1889
  event: _event.data,
1892
1890
  _event: _event,
1893
- state: state,
1894
- // TODO: fix types,
1895
1891
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
1896
1892
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
1897
1893
  }) : sendId;
@@ -4019,7 +4015,6 @@ function assign$1(assignment) {
4019
4015
  var args = {
4020
4016
  context: state.context,
4021
4017
  event: _event.data,
4022
- state: state,
4023
4018
  action: action,
4024
4019
  _event: _event,
4025
4020
  spawn: createSpawner(actorContext === null || actorContext === void 0 ? void 0 : actorContext.self, state.machine, state.context, _event, capturedActions),
@@ -4077,8 +4072,6 @@ function raise$1(eventOrExpr, options) {
4077
4072
  context: state.context,
4078
4073
  event: _event.data,
4079
4074
  _event: _event,
4080
- state: state,
4081
- // TODO: fix
4082
4075
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
4083
4076
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
4084
4077
  };
@@ -4159,7 +4152,6 @@ function resolveActionObject(actionObject, actionFunctionMap) {
4159
4152
  event: state.event,
4160
4153
  action: a,
4161
4154
  _event: state._event,
4162
- state: state,
4163
4155
  system: actorCtx.system,
4164
4156
  self: actorCtx.self
4165
4157
  });
@@ -4201,7 +4193,6 @@ function toActionObject(action) {
4201
4193
  event: _event.data,
4202
4194
  action: actionObject,
4203
4195
  _event: _event,
4204
- state: state,
4205
4196
  self: actorCtx.self,
4206
4197
  system: actorCtx.system
4207
4198
  });
@@ -529,7 +529,6 @@ function send$1(eventOrExpr, options) {
529
529
  context: state.context,
530
530
  event: _event.data,
531
531
  _event: _event,
532
- state: state,
533
532
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : null,
534
533
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
535
534
  };
@@ -704,6 +703,86 @@ function _createClass(Constructor, protoProps, staticProps) {
704
703
  return Constructor;
705
704
  }
706
705
 
706
+ var Mailbox = /*#__PURE__*/function () {
707
+ function Mailbox(_process) {
708
+ _classCallCheck(this, Mailbox);
709
+ this._process = _process;
710
+ _defineProperty(this, "_active", false);
711
+ _defineProperty(this, "_current", null);
712
+ _defineProperty(this, "_last", null);
713
+ }
714
+ _createClass(Mailbox, [{
715
+ key: "start",
716
+ value: function start() {
717
+ this._active = true;
718
+ this.flush();
719
+ }
720
+ }, {
721
+ key: "clear",
722
+ value: function clear() {
723
+ // we can't set _current to null because we might be currently processing
724
+ // and enqueue following clear shouldnt start processing the enqueued item immediately
725
+ if (this._current) {
726
+ this._current.next = null;
727
+ this._last = this._current;
728
+ }
729
+ }
730
+
731
+ // TODO: rethink this design
732
+ }, {
733
+ key: "prepend",
734
+ value: function prepend(event) {
735
+ if (!this._current) {
736
+ this.enqueue(event);
737
+ return;
738
+ }
739
+
740
+ // we know that something is already queued up
741
+ // so the mailbox is already flushing or it's inactive
742
+ // therefore the only thing that we need to do is to reassign `this._current`
743
+ this._current = {
744
+ value: event,
745
+ next: this._current
746
+ };
747
+ }
748
+ }, {
749
+ key: "enqueue",
750
+ value: function enqueue(event) {
751
+ var enqueued = {
752
+ value: event,
753
+ next: null
754
+ };
755
+ if (this._current) {
756
+ this._last.next = enqueued;
757
+ this._last = enqueued;
758
+ return;
759
+ }
760
+ this._current = enqueued;
761
+ this._last = enqueued;
762
+ if (this._active) {
763
+ this.flush();
764
+ }
765
+ }
766
+ }, {
767
+ key: "flush",
768
+ value: function flush() {
769
+ while (this._current) {
770
+ // atm the given _process is responsible for implementing proper try/catch handling
771
+ // we assume here that this won't throw in a way that can affect this mailbox
772
+ var consumed = this._current;
773
+ this._process(consumed.value);
774
+ // something could have been prepended in the meantime
775
+ // so we need to be defensive here to avoid skipping over a prepended item
776
+ if (consumed === this._current) {
777
+ this._current = this._current.next;
778
+ }
779
+ }
780
+ this._last = null;
781
+ }
782
+ }]);
783
+ return Mailbox;
784
+ }();
785
+
707
786
  var symbolObservable = function () {
708
787
  return typeof Symbol === 'function' && Symbol.observable || '@@observable';
709
788
  }();
@@ -1169,86 +1248,6 @@ function toActorRef(actorRefLike) {
1169
1248
  }), _objectSpread2$1), actorRefLike);
1170
1249
  }
1171
1250
 
1172
- var Mailbox = /*#__PURE__*/function () {
1173
- function Mailbox(_process) {
1174
- _classCallCheck(this, Mailbox);
1175
- this._process = _process;
1176
- _defineProperty(this, "_active", false);
1177
- _defineProperty(this, "_current", null);
1178
- _defineProperty(this, "_last", null);
1179
- }
1180
- _createClass(Mailbox, [{
1181
- key: "start",
1182
- value: function start() {
1183
- this._active = true;
1184
- this.flush();
1185
- }
1186
- }, {
1187
- key: "clear",
1188
- value: function clear() {
1189
- // we can't set _current to null because we might be currently processing
1190
- // and enqueue following clear shouldnt start processing the enqueued item immediately
1191
- if (this._current) {
1192
- this._current.next = null;
1193
- this._last = this._current;
1194
- }
1195
- }
1196
-
1197
- // TODO: rethink this design
1198
- }, {
1199
- key: "prepend",
1200
- value: function prepend(event) {
1201
- if (!this._current) {
1202
- this.enqueue(event);
1203
- return;
1204
- }
1205
-
1206
- // we know that something is already queued up
1207
- // so the mailbox is already flushing or it's inactive
1208
- // therefore the only thing that we need to do is to reassign `this._current`
1209
- this._current = {
1210
- value: event,
1211
- next: this._current
1212
- };
1213
- }
1214
- }, {
1215
- key: "enqueue",
1216
- value: function enqueue(event) {
1217
- var enqueued = {
1218
- value: event,
1219
- next: null
1220
- };
1221
- if (this._current) {
1222
- this._last.next = enqueued;
1223
- this._last = enqueued;
1224
- return;
1225
- }
1226
- this._current = enqueued;
1227
- this._last = enqueued;
1228
- if (this._active) {
1229
- this.flush();
1230
- }
1231
- }
1232
- }, {
1233
- key: "flush",
1234
- value: function flush() {
1235
- while (this._current) {
1236
- // atm the given _process is responsible for implementing proper try/catch handling
1237
- // we assume here that this won't throw in a way that can affect this mailbox
1238
- var consumed = this._current;
1239
- this._process(consumed.value);
1240
- // something could have been prepended in the meantime
1241
- // so we need to be defensive here to avoid skipping over a prepended item
1242
- if (consumed === this._current) {
1243
- this._current = this._current.next;
1244
- }
1245
- }
1246
- this._last = null;
1247
- }
1248
- }]);
1249
- return Mailbox;
1250
- }();
1251
-
1252
1251
  function createSystem() {
1253
1252
  var sessionIdCounter = 0;
1254
1253
  var children = new Map();
@@ -1813,7 +1812,6 @@ function log$1() {
1813
1812
  context: state.context,
1814
1813
  event: _event.data,
1815
1814
  _event: _event,
1816
- state: state,
1817
1815
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
1818
1816
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
1819
1817
  }) : expr;
@@ -1858,8 +1856,6 @@ function cancel$1(sendId) {
1858
1856
  context: state.context,
1859
1857
  event: _event.data,
1860
1858
  _event: _event,
1861
- state: state,
1862
- // TODO: fix types,
1863
1859
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
1864
1860
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
1865
1861
  }) : sendId;
@@ -3987,7 +3983,6 @@ function assign$1(assignment) {
3987
3983
  var args = {
3988
3984
  context: state.context,
3989
3985
  event: _event.data,
3990
- state: state,
3991
3986
  action: action,
3992
3987
  _event: _event,
3993
3988
  spawn: createSpawner(actorContext === null || actorContext === void 0 ? void 0 : actorContext.self, state.machine, state.context, _event, capturedActions),
@@ -4045,8 +4040,6 @@ function raise$1(eventOrExpr, options) {
4045
4040
  context: state.context,
4046
4041
  event: _event.data,
4047
4042
  _event: _event,
4048
- state: state,
4049
- // TODO: fix
4050
4043
  self: (_actorContext$self = actorContext === null || actorContext === void 0 ? void 0 : actorContext.self) !== null && _actorContext$self !== void 0 ? _actorContext$self : {},
4051
4044
  system: actorContext === null || actorContext === void 0 ? void 0 : actorContext.system
4052
4045
  };
@@ -4127,7 +4120,6 @@ function resolveActionObject(actionObject, actionFunctionMap) {
4127
4120
  event: state.event,
4128
4121
  action: a,
4129
4122
  _event: state._event,
4130
- state: state,
4131
4123
  system: actorCtx.system,
4132
4124
  self: actorCtx.self
4133
4125
  });
@@ -4169,7 +4161,6 @@ function toActionObject(action) {
4169
4161
  event: _event.data,
4170
4162
  action: actionObject,
4171
4163
  _event: _event,
4172
- state: state,
4173
4164
  self: actorCtx.self,
4174
4165
  system: actorCtx.system
4175
4166
  });