xstate 5.0.0-beta.21 → 5.0.0-beta.22

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 (32) hide show
  1. package/actions/dist/xstate-actions.cjs.js +1 -1
  2. package/actions/dist/xstate-actions.development.cjs.js +1 -1
  3. package/actions/dist/xstate-actions.development.esm.js +1 -1
  4. package/actions/dist/xstate-actions.esm.js +1 -1
  5. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  6. package/actors/dist/xstate-actors.cjs.js +1 -1
  7. package/actors/dist/xstate-actors.development.cjs.js +1 -1
  8. package/actors/dist/xstate-actors.development.esm.js +1 -1
  9. package/actors/dist/xstate-actors.esm.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-a95d2e66.development.cjs.js → actions-4b70fc8d.development.cjs.js} +38 -20
  13. package/dist/{actions-c619a105.cjs.js → actions-8f2e997e.cjs.js} +38 -20
  14. package/dist/{actions-49f0501e.development.esm.js → actions-d4305983.development.esm.js} +36 -20
  15. package/dist/{actions-5039c951.esm.js → actions-fb7384f8.esm.js} +36 -20
  16. package/dist/declarations/src/dev/index.d.ts +6 -6
  17. package/dist/declarations/src/index.d.ts +3 -2
  18. package/dist/declarations/src/interpreter.d.ts +30 -16
  19. package/dist/declarations/src/types.d.ts +14 -7
  20. package/dist/xstate.cjs.js +7 -5
  21. package/dist/xstate.cjs.mjs +3 -1
  22. package/dist/xstate.development.cjs.js +7 -5
  23. package/dist/xstate.development.cjs.mjs +3 -1
  24. package/dist/xstate.development.esm.js +4 -4
  25. package/dist/xstate.esm.js +4 -4
  26. package/dist/xstate.umd.min.js +1 -1
  27. package/dist/xstate.umd.min.js.map +1 -1
  28. package/guards/dist/xstate-guards.cjs.js +1 -1
  29. package/guards/dist/xstate-guards.development.cjs.js +1 -1
  30. package/guards/dist/xstate-guards.development.esm.js +1 -1
  31. package/guards/dist/xstate-guards.esm.js +1 -1
  32. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"xstate-dev.umd.min.js","sources":["../../src/dev/index.ts"],"sourcesContent":["import isDevelopment from '#is-development';\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 (isDevelopment) {\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,MAUX,CAEA,SAASC,IACP,MAAMC,EAAIL,IACV,GAAOK,EAAUC,WACf,OAAQD,EAAUC,UAItB,mBAciDC,IAK/C,MAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF,EACpB,kCArBK,SAAyBA,GAK9B,MAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF,EAEtB"}
1
+ {"version":3,"file":"xstate-dev.umd.min.js","sources":["../../src/dev/index.ts"],"sourcesContent":["import isDevelopment from '#is-development';\nimport { AnyActor, DevToolsAdapter } from '../types.ts';\n\ninterface DevInterface {\n services: Set<AnyActor>;\n register(service: AnyActor): void;\n onRegister(listener: ServiceListener): void;\n}\ntype ServiceListener = (service: AnyActor) => void;\n\nexport interface XStateDevInterface {\n register: (service: AnyActor) => void;\n unregister: (service: AnyActor) => void;\n onRegister: (listener: ServiceListener) => {\n unsubscribe: () => void;\n };\n services: Set<AnyActor>;\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 (isDevelopment) {\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: AnyActor) {\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,MAUX,CAEA,SAASC,IACP,MAAMC,EAAIL,IACV,GAAOK,EAAUC,WACf,OAAQD,EAAUC,UAItB,mBAciDC,IAK/C,MAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF,EACpB,kCArBK,SAAyBA,GAK9B,MAAMC,EAAWJ,IAEbI,GACFA,EAASC,SAASF,EAEtB"}
@@ -941,7 +941,7 @@ function toActorRef(actorRefLike) {
941
941
  }
942
942
  const emptyLogic = fromTransition(_ => undefined, undefined);
943
943
  function createEmptyActor() {
944
- return interpret(emptyLogic);
944
+ return createActor(emptyLogic);
945
945
  }
946
946
 
947
947
  /**
@@ -997,6 +997,11 @@ let ActorStatus = /*#__PURE__*/function (ActorStatus) {
997
997
  ActorStatus[ActorStatus["Stopped"] = 2] = "Stopped";
998
998
  return ActorStatus;
999
999
  }({});
1000
+
1001
+ /**
1002
+ * @deprecated Use `ActorStatus` instead.
1003
+ */
1004
+ const InterpreterStatus = ActorStatus;
1000
1005
  const defaultOptions = {
1001
1006
  deferEvents: true,
1002
1007
  clock: {
@@ -1010,9 +1015,9 @@ const defaultOptions = {
1010
1015
  logger: console.log.bind(console),
1011
1016
  devTools: false
1012
1017
  };
1013
- class Interpreter {
1018
+ class Actor {
1014
1019
  /**
1015
- * The current state of the interpreted logic.
1020
+ * The current internal state of the actor.
1016
1021
  */
1017
1022
 
1018
1023
  /**
@@ -1036,10 +1041,10 @@ class Interpreter {
1036
1041
  */
1037
1042
 
1038
1043
  /**
1039
- * Creates a new Interpreter instance (i.e., service) for the given logic with the provided options, if any.
1044
+ * Creates a new actor instance for the given logic with the provided options, if any.
1040
1045
  *
1041
- * @param logic The logic to be interpreted
1042
- * @param options Interpreter options
1046
+ * @param logic The logic to create an actor from
1047
+ * @param options Actor options
1043
1048
  */
1044
1049
  constructor(logic, options) {
1045
1050
  this.logic = logic;
@@ -1103,7 +1108,7 @@ class Interpreter {
1103
1108
  }
1104
1109
  };
1105
1110
 
1106
- // Ensure that the send method is bound to this interpreter instance
1111
+ // Ensure that the send method is bound to this Actor instance
1107
1112
  // if destructured
1108
1113
  this.send = this.send.bind(this);
1109
1114
  this._initState();
@@ -1166,7 +1171,7 @@ class Interpreter {
1166
1171
  }
1167
1172
 
1168
1173
  /**
1169
- * Starts the interpreter from the initial state
1174
+ * Starts the Actor from the initial state
1170
1175
  */
1171
1176
  start() {
1172
1177
  if (this.status === ActorStatus.Running) {
@@ -1253,7 +1258,7 @@ class Interpreter {
1253
1258
  }
1254
1259
 
1255
1260
  /**
1256
- * Stops the interpreter and unsubscribe all listeners.
1261
+ * Stops the Actor and unsubscribe all listeners.
1257
1262
  */
1258
1263
  stop() {
1259
1264
  if (this._parent) {
@@ -1295,7 +1300,7 @@ class Interpreter {
1295
1300
  }
1296
1301
  _stopProcedure() {
1297
1302
  if (this.status !== ActorStatus.Running) {
1298
- // Interpreter already stopped; do nothing
1303
+ // Actor already stopped; do nothing
1299
1304
  return this;
1300
1305
  }
1301
1306
 
@@ -1317,7 +1322,7 @@ class Interpreter {
1317
1322
  }
1318
1323
 
1319
1324
  /**
1320
- * Sends an event to the running interpreter to trigger a transition.
1325
+ * Sends an event to the running Actor to trigger a transition.
1321
1326
  *
1322
1327
  * @param event The event to send
1323
1328
  */
@@ -1393,17 +1398,28 @@ class Interpreter {
1393
1398
  }
1394
1399
 
1395
1400
  /**
1396
- * Creates a new Interpreter instance for the given machine with the provided options, if any.
1401
+ * Creates a new `ActorRef` instance for the given machine with the provided options, if any.
1397
1402
  *
1398
- * @param machine The machine to interpret
1399
- * @param options Interpreter options
1403
+ * @param machine The machine to create an actor from
1404
+ * @param options `ActorRef` options
1400
1405
  */
1401
1406
 
1402
- function interpret(logic, options) {
1403
- const interpreter = new Interpreter(logic, options);
1407
+ function createActor(logic, options) {
1408
+ const interpreter = new Actor(logic, options);
1404
1409
  return interpreter;
1405
1410
  }
1406
1411
 
1412
+ /**
1413
+ * Creates a new Interpreter instance for the given machine with the provided options, if any.
1414
+ *
1415
+ * @deprecated Use `createActor` instead
1416
+ */
1417
+ const interpret = createActor;
1418
+
1419
+ /**
1420
+ * @deprecated Use `Actor` instead.
1421
+ */
1422
+
1407
1423
  function resolve$6(actorContext, state, actionArgs, {
1408
1424
  id,
1409
1425
  systemId,
@@ -1415,7 +1431,7 @@ function resolve$6(actorContext, state, actionArgs, {
1415
1431
  if (referenced) {
1416
1432
  // TODO: inline `input: undefined` should win over the referenced one
1417
1433
  const configuredInput = input || referenced.input;
1418
- actorRef = interpret(referenced.src, {
1434
+ actorRef = createActor(referenced.src, {
1419
1435
  id,
1420
1436
  src,
1421
1437
  parent: actorContext?.self,
@@ -2870,7 +2886,7 @@ function createSpawner(actorContext, {
2870
2886
  const input = 'input' in options ? options.input : referenced.input;
2871
2887
 
2872
2888
  // TODO: this should also receive `src`
2873
- const actor = interpret(referenced.src, {
2889
+ const actor = createActor(referenced.src, {
2874
2890
  id: options.id,
2875
2891
  parent: actorContext.self,
2876
2892
  input: typeof input === 'function' ? input({
@@ -2884,7 +2900,7 @@ function createSpawner(actorContext, {
2884
2900
  return actor;
2885
2901
  } else {
2886
2902
  // TODO: this should also receive `src`
2887
- return interpret(src, {
2903
+ return createActor(src, {
2888
2904
  id: options.id,
2889
2905
  parent: actorContext.self,
2890
2906
  input: options.input,
@@ -3119,9 +3135,10 @@ function createInitEvent(input) {
3119
3135
  };
3120
3136
  }
3121
3137
 
3138
+ exports.Actor = Actor;
3122
3139
  exports.ActorStatus = ActorStatus;
3123
3140
  exports.ConstantPrefix = ConstantPrefix;
3124
- exports.Interpreter = Interpreter;
3141
+ exports.InterpreterStatus = InterpreterStatus;
3125
3142
  exports.NULL_EVENT = NULL_EVENT;
3126
3143
  exports.STATE_DELIMITER = STATE_DELIMITER;
3127
3144
  exports.SpecialTargets = SpecialTargets;
@@ -3133,6 +3150,7 @@ exports.cancel = cancel;
3133
3150
  exports.choose = choose;
3134
3151
  exports.cloneState = cloneState;
3135
3152
  exports.constantPrefixes = constantPrefixes;
3153
+ exports.createActor = createActor;
3136
3154
  exports.createEmptyActor = createEmptyActor;
3137
3155
  exports.createInitEvent = createInitEvent;
3138
3156
  exports.createInvokeId = createInvokeId;
@@ -922,7 +922,7 @@ function toActorRef(actorRefLike) {
922
922
  }
923
923
  const emptyLogic = fromTransition(_ => undefined, undefined);
924
924
  function createEmptyActor() {
925
- return interpret(emptyLogic);
925
+ return createActor(emptyLogic);
926
926
  }
927
927
 
928
928
  /**
@@ -978,6 +978,11 @@ let ActorStatus = /*#__PURE__*/function (ActorStatus) {
978
978
  ActorStatus[ActorStatus["Stopped"] = 2] = "Stopped";
979
979
  return ActorStatus;
980
980
  }({});
981
+
982
+ /**
983
+ * @deprecated Use `ActorStatus` instead.
984
+ */
985
+ const InterpreterStatus = ActorStatus;
981
986
  const defaultOptions = {
982
987
  deferEvents: true,
983
988
  clock: {
@@ -991,9 +996,9 @@ const defaultOptions = {
991
996
  logger: console.log.bind(console),
992
997
  devTools: false
993
998
  };
994
- class Interpreter {
999
+ class Actor {
995
1000
  /**
996
- * The current state of the interpreted logic.
1001
+ * The current internal state of the actor.
997
1002
  */
998
1003
 
999
1004
  /**
@@ -1017,10 +1022,10 @@ class Interpreter {
1017
1022
  */
1018
1023
 
1019
1024
  /**
1020
- * Creates a new Interpreter instance (i.e., service) for the given logic with the provided options, if any.
1025
+ * Creates a new actor instance for the given logic with the provided options, if any.
1021
1026
  *
1022
- * @param logic The logic to be interpreted
1023
- * @param options Interpreter options
1027
+ * @param logic The logic to create an actor from
1028
+ * @param options Actor options
1024
1029
  */
1025
1030
  constructor(logic, options) {
1026
1031
  this.logic = logic;
@@ -1084,7 +1089,7 @@ class Interpreter {
1084
1089
  }
1085
1090
  };
1086
1091
 
1087
- // Ensure that the send method is bound to this interpreter instance
1092
+ // Ensure that the send method is bound to this Actor instance
1088
1093
  // if destructured
1089
1094
  this.send = this.send.bind(this);
1090
1095
  this._initState();
@@ -1147,7 +1152,7 @@ class Interpreter {
1147
1152
  }
1148
1153
 
1149
1154
  /**
1150
- * Starts the interpreter from the initial state
1155
+ * Starts the Actor from the initial state
1151
1156
  */
1152
1157
  start() {
1153
1158
  if (this.status === ActorStatus.Running) {
@@ -1234,7 +1239,7 @@ class Interpreter {
1234
1239
  }
1235
1240
 
1236
1241
  /**
1237
- * Stops the interpreter and unsubscribe all listeners.
1242
+ * Stops the Actor and unsubscribe all listeners.
1238
1243
  */
1239
1244
  stop() {
1240
1245
  if (this._parent) {
@@ -1276,7 +1281,7 @@ class Interpreter {
1276
1281
  }
1277
1282
  _stopProcedure() {
1278
1283
  if (this.status !== ActorStatus.Running) {
1279
- // Interpreter already stopped; do nothing
1284
+ // Actor already stopped; do nothing
1280
1285
  return this;
1281
1286
  }
1282
1287
 
@@ -1298,7 +1303,7 @@ class Interpreter {
1298
1303
  }
1299
1304
 
1300
1305
  /**
1301
- * Sends an event to the running interpreter to trigger a transition.
1306
+ * Sends an event to the running Actor to trigger a transition.
1302
1307
  *
1303
1308
  * @param event The event to send
1304
1309
  */
@@ -1369,17 +1374,28 @@ class Interpreter {
1369
1374
  }
1370
1375
 
1371
1376
  /**
1372
- * Creates a new Interpreter instance for the given machine with the provided options, if any.
1377
+ * Creates a new `ActorRef` instance for the given machine with the provided options, if any.
1373
1378
  *
1374
- * @param machine The machine to interpret
1375
- * @param options Interpreter options
1379
+ * @param machine The machine to create an actor from
1380
+ * @param options `ActorRef` options
1376
1381
  */
1377
1382
 
1378
- function interpret(logic, options) {
1379
- const interpreter = new Interpreter(logic, options);
1383
+ function createActor(logic, options) {
1384
+ const interpreter = new Actor(logic, options);
1380
1385
  return interpreter;
1381
1386
  }
1382
1387
 
1388
+ /**
1389
+ * Creates a new Interpreter instance for the given machine with the provided options, if any.
1390
+ *
1391
+ * @deprecated Use `createActor` instead
1392
+ */
1393
+ const interpret = createActor;
1394
+
1395
+ /**
1396
+ * @deprecated Use `Actor` instead.
1397
+ */
1398
+
1383
1399
  function resolve$6(actorContext, state, actionArgs, {
1384
1400
  id,
1385
1401
  systemId,
@@ -1391,7 +1407,7 @@ function resolve$6(actorContext, state, actionArgs, {
1391
1407
  if (referenced) {
1392
1408
  // TODO: inline `input: undefined` should win over the referenced one
1393
1409
  const configuredInput = input || referenced.input;
1394
- actorRef = interpret(referenced.src, {
1410
+ actorRef = createActor(referenced.src, {
1395
1411
  id,
1396
1412
  src,
1397
1413
  parent: actorContext?.self,
@@ -2817,7 +2833,7 @@ function createSpawner(actorContext, {
2817
2833
  const input = 'input' in options ? options.input : referenced.input;
2818
2834
 
2819
2835
  // TODO: this should also receive `src`
2820
- const actor = interpret(referenced.src, {
2836
+ const actor = createActor(referenced.src, {
2821
2837
  id: options.id,
2822
2838
  parent: actorContext.self,
2823
2839
  input: typeof input === 'function' ? input({
@@ -2831,7 +2847,7 @@ function createSpawner(actorContext, {
2831
2847
  return actor;
2832
2848
  } else {
2833
2849
  // TODO: this should also receive `src`
2834
- return interpret(src, {
2850
+ return createActor(src, {
2835
2851
  id: options.id,
2836
2852
  parent: actorContext.self,
2837
2853
  input: options.input,
@@ -3054,9 +3070,10 @@ function createInitEvent(input) {
3054
3070
  };
3055
3071
  }
3056
3072
 
3073
+ exports.Actor = Actor;
3057
3074
  exports.ActorStatus = ActorStatus;
3058
3075
  exports.ConstantPrefix = ConstantPrefix;
3059
- exports.Interpreter = Interpreter;
3076
+ exports.InterpreterStatus = InterpreterStatus;
3060
3077
  exports.NULL_EVENT = NULL_EVENT;
3061
3078
  exports.STATE_DELIMITER = STATE_DELIMITER;
3062
3079
  exports.SpecialTargets = SpecialTargets;
@@ -3068,6 +3085,7 @@ exports.cancel = cancel;
3068
3085
  exports.choose = choose;
3069
3086
  exports.cloneState = cloneState;
3070
3087
  exports.constantPrefixes = constantPrefixes;
3088
+ exports.createActor = createActor;
3071
3089
  exports.createEmptyActor = createEmptyActor;
3072
3090
  exports.createInitEvent = createInitEvent;
3073
3091
  exports.createInvokeId = createInvokeId;
@@ -939,7 +939,7 @@ function toActorRef(actorRefLike) {
939
939
  }
940
940
  const emptyLogic = fromTransition(_ => undefined, undefined);
941
941
  function createEmptyActor() {
942
- return interpret(emptyLogic);
942
+ return createActor(emptyLogic);
943
943
  }
944
944
 
945
945
  /**
@@ -995,6 +995,11 @@ let ActorStatus = /*#__PURE__*/function (ActorStatus) {
995
995
  ActorStatus[ActorStatus["Stopped"] = 2] = "Stopped";
996
996
  return ActorStatus;
997
997
  }({});
998
+
999
+ /**
1000
+ * @deprecated Use `ActorStatus` instead.
1001
+ */
1002
+ const InterpreterStatus = ActorStatus;
998
1003
  const defaultOptions = {
999
1004
  deferEvents: true,
1000
1005
  clock: {
@@ -1008,9 +1013,9 @@ const defaultOptions = {
1008
1013
  logger: console.log.bind(console),
1009
1014
  devTools: false
1010
1015
  };
1011
- class Interpreter {
1016
+ class Actor {
1012
1017
  /**
1013
- * The current state of the interpreted logic.
1018
+ * The current internal state of the actor.
1014
1019
  */
1015
1020
 
1016
1021
  /**
@@ -1034,10 +1039,10 @@ class Interpreter {
1034
1039
  */
1035
1040
 
1036
1041
  /**
1037
- * Creates a new Interpreter instance (i.e., service) for the given logic with the provided options, if any.
1042
+ * Creates a new actor instance for the given logic with the provided options, if any.
1038
1043
  *
1039
- * @param logic The logic to be interpreted
1040
- * @param options Interpreter options
1044
+ * @param logic The logic to create an actor from
1045
+ * @param options Actor options
1041
1046
  */
1042
1047
  constructor(logic, options) {
1043
1048
  this.logic = logic;
@@ -1101,7 +1106,7 @@ class Interpreter {
1101
1106
  }
1102
1107
  };
1103
1108
 
1104
- // Ensure that the send method is bound to this interpreter instance
1109
+ // Ensure that the send method is bound to this Actor instance
1105
1110
  // if destructured
1106
1111
  this.send = this.send.bind(this);
1107
1112
  this._initState();
@@ -1164,7 +1169,7 @@ class Interpreter {
1164
1169
  }
1165
1170
 
1166
1171
  /**
1167
- * Starts the interpreter from the initial state
1172
+ * Starts the Actor from the initial state
1168
1173
  */
1169
1174
  start() {
1170
1175
  if (this.status === ActorStatus.Running) {
@@ -1251,7 +1256,7 @@ class Interpreter {
1251
1256
  }
1252
1257
 
1253
1258
  /**
1254
- * Stops the interpreter and unsubscribe all listeners.
1259
+ * Stops the Actor and unsubscribe all listeners.
1255
1260
  */
1256
1261
  stop() {
1257
1262
  if (this._parent) {
@@ -1293,7 +1298,7 @@ class Interpreter {
1293
1298
  }
1294
1299
  _stopProcedure() {
1295
1300
  if (this.status !== ActorStatus.Running) {
1296
- // Interpreter already stopped; do nothing
1301
+ // Actor already stopped; do nothing
1297
1302
  return this;
1298
1303
  }
1299
1304
 
@@ -1315,7 +1320,7 @@ class Interpreter {
1315
1320
  }
1316
1321
 
1317
1322
  /**
1318
- * Sends an event to the running interpreter to trigger a transition.
1323
+ * Sends an event to the running Actor to trigger a transition.
1319
1324
  *
1320
1325
  * @param event The event to send
1321
1326
  */
@@ -1391,17 +1396,28 @@ class Interpreter {
1391
1396
  }
1392
1397
 
1393
1398
  /**
1394
- * Creates a new Interpreter instance for the given machine with the provided options, if any.
1399
+ * Creates a new `ActorRef` instance for the given machine with the provided options, if any.
1395
1400
  *
1396
- * @param machine The machine to interpret
1397
- * @param options Interpreter options
1401
+ * @param machine The machine to create an actor from
1402
+ * @param options `ActorRef` options
1398
1403
  */
1399
1404
 
1400
- function interpret(logic, options) {
1401
- const interpreter = new Interpreter(logic, options);
1405
+ function createActor(logic, options) {
1406
+ const interpreter = new Actor(logic, options);
1402
1407
  return interpreter;
1403
1408
  }
1404
1409
 
1410
+ /**
1411
+ * Creates a new Interpreter instance for the given machine with the provided options, if any.
1412
+ *
1413
+ * @deprecated Use `createActor` instead
1414
+ */
1415
+ const interpret = createActor;
1416
+
1417
+ /**
1418
+ * @deprecated Use `Actor` instead.
1419
+ */
1420
+
1405
1421
  function resolve$6(actorContext, state, actionArgs, {
1406
1422
  id,
1407
1423
  systemId,
@@ -1413,7 +1429,7 @@ function resolve$6(actorContext, state, actionArgs, {
1413
1429
  if (referenced) {
1414
1430
  // TODO: inline `input: undefined` should win over the referenced one
1415
1431
  const configuredInput = input || referenced.input;
1416
- actorRef = interpret(referenced.src, {
1432
+ actorRef = createActor(referenced.src, {
1417
1433
  id,
1418
1434
  src,
1419
1435
  parent: actorContext?.self,
@@ -2868,7 +2884,7 @@ function createSpawner(actorContext, {
2868
2884
  const input = 'input' in options ? options.input : referenced.input;
2869
2885
 
2870
2886
  // TODO: this should also receive `src`
2871
- const actor = interpret(referenced.src, {
2887
+ const actor = createActor(referenced.src, {
2872
2888
  id: options.id,
2873
2889
  parent: actorContext.self,
2874
2890
  input: typeof input === 'function' ? input({
@@ -2882,7 +2898,7 @@ function createSpawner(actorContext, {
2882
2898
  return actor;
2883
2899
  } else {
2884
2900
  // TODO: this should also receive `src`
2885
- return interpret(src, {
2901
+ return createActor(src, {
2886
2902
  id: options.id,
2887
2903
  parent: actorContext.self,
2888
2904
  input: options.input,
@@ -3117,4 +3133,4 @@ function createInitEvent(input) {
3117
3133
  };
3118
3134
  }
3119
3135
 
3120
- export { fromEventObservable as $, microstep as A, isAtomicStateNode as B, isStateId as C, getStateNodeByPath as D, getPersistedState as E, resolveReferencedActor as F, interpret as G, matchesState as H, sendTo as I, sendParent as J, forwardTo as K, Interpreter as L, ActorStatus as M, NULL_EVENT as N, doneInvoke as O, cancel as P, choose as Q, log as R, STATE_DELIMITER as S, pure as T, raise as U, stop as V, pathToStateValue as W, toObserver as X, fromPromise as Y, fromObservable as Z, fromCallback as _, toTransitionConfigArray as a, fromTransition as a0, stateIn as a1, not as a2, and as a3, or as a4, ConstantPrefix as a5, SpecialTargets as a6, startSignalType as a7, stopSignalType as a8, startSignal as a9, stopSignal as aa, isSignal as ab, isActorRef as ac, toActorRef as ad, createEmptyActor as ae, toGuardDefinition as af, constantPrefixes as ag, after as ah, done as ai, error as aj, escalate as ak, formatTransition as b, memo as c, flatten as d, evaluateGuard as e, formatTransitions as f, createInvokeId as g, getDelayedTransitions as h, formatInitialTransition as i, getCandidates as j, toInvokeConfig as k, getConfiguration as l, mapValues as m, getStateNodes as n, isInFinalState as o, State as p, isErrorEvent as q, resolveStateValue as r, cloneState as s, toArray as t, macrostep as u, transitionNode as v, getInitialConfiguration as w, resolveActionsAndContext as x, assign as y, createInitEvent as z };
3136
+ export { fromObservable as $, microstep as A, isAtomicStateNode as B, isStateId as C, getStateNodeByPath as D, getPersistedState as E, resolveReferencedActor as F, createActor as G, matchesState as H, sendTo as I, sendParent as J, forwardTo as K, interpret as L, Actor as M, NULL_EVENT as N, ActorStatus as O, InterpreterStatus as P, doneInvoke as Q, cancel as R, STATE_DELIMITER as S, choose as T, log as U, pure as V, raise as W, stop as X, pathToStateValue as Y, toObserver as Z, fromPromise as _, toTransitionConfigArray as a, fromCallback as a0, fromEventObservable as a1, fromTransition as a2, stateIn as a3, not as a4, and as a5, or as a6, ConstantPrefix as a7, SpecialTargets as a8, startSignalType as a9, stopSignalType as aa, startSignal as ab, stopSignal as ac, isSignal as ad, isActorRef as ae, toActorRef as af, createEmptyActor as ag, toGuardDefinition as ah, constantPrefixes as ai, after as aj, done as ak, error as al, escalate as am, formatTransition as b, memo as c, flatten as d, evaluateGuard as e, formatTransitions as f, createInvokeId as g, getDelayedTransitions as h, formatInitialTransition as i, getCandidates as j, toInvokeConfig as k, getConfiguration as l, mapValues as m, getStateNodes as n, isInFinalState as o, State as p, isErrorEvent as q, resolveStateValue as r, cloneState as s, toArray as t, macrostep as u, transitionNode as v, getInitialConfiguration as w, resolveActionsAndContext as x, assign as y, createInitEvent as z };
@@ -920,7 +920,7 @@ function toActorRef(actorRefLike) {
920
920
  }
921
921
  const emptyLogic = fromTransition(_ => undefined, undefined);
922
922
  function createEmptyActor() {
923
- return interpret(emptyLogic);
923
+ return createActor(emptyLogic);
924
924
  }
925
925
 
926
926
  /**
@@ -976,6 +976,11 @@ let ActorStatus = /*#__PURE__*/function (ActorStatus) {
976
976
  ActorStatus[ActorStatus["Stopped"] = 2] = "Stopped";
977
977
  return ActorStatus;
978
978
  }({});
979
+
980
+ /**
981
+ * @deprecated Use `ActorStatus` instead.
982
+ */
983
+ const InterpreterStatus = ActorStatus;
979
984
  const defaultOptions = {
980
985
  deferEvents: true,
981
986
  clock: {
@@ -989,9 +994,9 @@ const defaultOptions = {
989
994
  logger: console.log.bind(console),
990
995
  devTools: false
991
996
  };
992
- class Interpreter {
997
+ class Actor {
993
998
  /**
994
- * The current state of the interpreted logic.
999
+ * The current internal state of the actor.
995
1000
  */
996
1001
 
997
1002
  /**
@@ -1015,10 +1020,10 @@ class Interpreter {
1015
1020
  */
1016
1021
 
1017
1022
  /**
1018
- * Creates a new Interpreter instance (i.e., service) for the given logic with the provided options, if any.
1023
+ * Creates a new actor instance for the given logic with the provided options, if any.
1019
1024
  *
1020
- * @param logic The logic to be interpreted
1021
- * @param options Interpreter options
1025
+ * @param logic The logic to create an actor from
1026
+ * @param options Actor options
1022
1027
  */
1023
1028
  constructor(logic, options) {
1024
1029
  this.logic = logic;
@@ -1082,7 +1087,7 @@ class Interpreter {
1082
1087
  }
1083
1088
  };
1084
1089
 
1085
- // Ensure that the send method is bound to this interpreter instance
1090
+ // Ensure that the send method is bound to this Actor instance
1086
1091
  // if destructured
1087
1092
  this.send = this.send.bind(this);
1088
1093
  this._initState();
@@ -1145,7 +1150,7 @@ class Interpreter {
1145
1150
  }
1146
1151
 
1147
1152
  /**
1148
- * Starts the interpreter from the initial state
1153
+ * Starts the Actor from the initial state
1149
1154
  */
1150
1155
  start() {
1151
1156
  if (this.status === ActorStatus.Running) {
@@ -1232,7 +1237,7 @@ class Interpreter {
1232
1237
  }
1233
1238
 
1234
1239
  /**
1235
- * Stops the interpreter and unsubscribe all listeners.
1240
+ * Stops the Actor and unsubscribe all listeners.
1236
1241
  */
1237
1242
  stop() {
1238
1243
  if (this._parent) {
@@ -1274,7 +1279,7 @@ class Interpreter {
1274
1279
  }
1275
1280
  _stopProcedure() {
1276
1281
  if (this.status !== ActorStatus.Running) {
1277
- // Interpreter already stopped; do nothing
1282
+ // Actor already stopped; do nothing
1278
1283
  return this;
1279
1284
  }
1280
1285
 
@@ -1296,7 +1301,7 @@ class Interpreter {
1296
1301
  }
1297
1302
 
1298
1303
  /**
1299
- * Sends an event to the running interpreter to trigger a transition.
1304
+ * Sends an event to the running Actor to trigger a transition.
1300
1305
  *
1301
1306
  * @param event The event to send
1302
1307
  */
@@ -1367,17 +1372,28 @@ class Interpreter {
1367
1372
  }
1368
1373
 
1369
1374
  /**
1370
- * Creates a new Interpreter instance for the given machine with the provided options, if any.
1375
+ * Creates a new `ActorRef` instance for the given machine with the provided options, if any.
1371
1376
  *
1372
- * @param machine The machine to interpret
1373
- * @param options Interpreter options
1377
+ * @param machine The machine to create an actor from
1378
+ * @param options `ActorRef` options
1374
1379
  */
1375
1380
 
1376
- function interpret(logic, options) {
1377
- const interpreter = new Interpreter(logic, options);
1381
+ function createActor(logic, options) {
1382
+ const interpreter = new Actor(logic, options);
1378
1383
  return interpreter;
1379
1384
  }
1380
1385
 
1386
+ /**
1387
+ * Creates a new Interpreter instance for the given machine with the provided options, if any.
1388
+ *
1389
+ * @deprecated Use `createActor` instead
1390
+ */
1391
+ const interpret = createActor;
1392
+
1393
+ /**
1394
+ * @deprecated Use `Actor` instead.
1395
+ */
1396
+
1381
1397
  function resolve$6(actorContext, state, actionArgs, {
1382
1398
  id,
1383
1399
  systemId,
@@ -1389,7 +1405,7 @@ function resolve$6(actorContext, state, actionArgs, {
1389
1405
  if (referenced) {
1390
1406
  // TODO: inline `input: undefined` should win over the referenced one
1391
1407
  const configuredInput = input || referenced.input;
1392
- actorRef = interpret(referenced.src, {
1408
+ actorRef = createActor(referenced.src, {
1393
1409
  id,
1394
1410
  src,
1395
1411
  parent: actorContext?.self,
@@ -2815,7 +2831,7 @@ function createSpawner(actorContext, {
2815
2831
  const input = 'input' in options ? options.input : referenced.input;
2816
2832
 
2817
2833
  // TODO: this should also receive `src`
2818
- const actor = interpret(referenced.src, {
2834
+ const actor = createActor(referenced.src, {
2819
2835
  id: options.id,
2820
2836
  parent: actorContext.self,
2821
2837
  input: typeof input === 'function' ? input({
@@ -2829,7 +2845,7 @@ function createSpawner(actorContext, {
2829
2845
  return actor;
2830
2846
  } else {
2831
2847
  // TODO: this should also receive `src`
2832
- return interpret(src, {
2848
+ return createActor(src, {
2833
2849
  id: options.id,
2834
2850
  parent: actorContext.self,
2835
2851
  input: options.input,
@@ -3052,4 +3068,4 @@ function createInitEvent(input) {
3052
3068
  };
3053
3069
  }
3054
3070
 
3055
- export { fromEventObservable as $, microstep as A, isAtomicStateNode as B, isStateId as C, getStateNodeByPath as D, getPersistedState as E, resolveReferencedActor as F, interpret as G, matchesState as H, sendTo as I, sendParent as J, forwardTo as K, Interpreter as L, ActorStatus as M, NULL_EVENT as N, doneInvoke as O, cancel as P, choose as Q, log as R, STATE_DELIMITER as S, pure as T, raise as U, stop as V, pathToStateValue as W, toObserver as X, fromPromise as Y, fromObservable as Z, fromCallback as _, toTransitionConfigArray as a, fromTransition as a0, stateIn as a1, not as a2, and as a3, or as a4, ConstantPrefix as a5, SpecialTargets as a6, startSignalType as a7, stopSignalType as a8, startSignal as a9, stopSignal as aa, isSignal as ab, isActorRef as ac, toActorRef as ad, createEmptyActor as ae, toGuardDefinition as af, constantPrefixes as ag, after as ah, done as ai, error as aj, escalate as ak, formatTransition as b, memo as c, flatten as d, evaluateGuard as e, formatTransitions as f, createInvokeId as g, getDelayedTransitions as h, formatInitialTransition as i, getCandidates as j, toInvokeConfig as k, getConfiguration as l, mapValues as m, getStateNodes as n, isInFinalState as o, State as p, isErrorEvent as q, resolveStateValue as r, cloneState as s, toArray as t, macrostep as u, transitionNode as v, getInitialConfiguration as w, resolveActionsAndContext as x, assign as y, createInitEvent as z };
3071
+ export { fromObservable as $, microstep as A, isAtomicStateNode as B, isStateId as C, getStateNodeByPath as D, getPersistedState as E, resolveReferencedActor as F, createActor as G, matchesState as H, sendTo as I, sendParent as J, forwardTo as K, interpret as L, Actor as M, NULL_EVENT as N, ActorStatus as O, InterpreterStatus as P, doneInvoke as Q, cancel as R, STATE_DELIMITER as S, choose as T, log as U, pure as V, raise as W, stop as X, pathToStateValue as Y, toObserver as Z, fromPromise as _, toTransitionConfigArray as a, fromCallback as a0, fromEventObservable as a1, fromTransition as a2, stateIn as a3, not as a4, and as a5, or as a6, ConstantPrefix as a7, SpecialTargets as a8, startSignalType as a9, stopSignalType as aa, startSignal as ab, stopSignal as ac, isSignal as ad, isActorRef as ae, toActorRef as af, createEmptyActor as ag, toGuardDefinition as ah, constantPrefixes as ai, after as aj, done as ak, error as al, escalate as am, formatTransition as b, memo as c, flatten as d, evaluateGuard as e, formatTransitions as f, createInvokeId as g, getDelayedTransitions as h, formatInitialTransition as i, getCandidates as j, toInvokeConfig as k, getConfiguration as l, mapValues as m, getStateNodes as n, isInFinalState as o, State as p, isErrorEvent as q, resolveStateValue as r, cloneState as s, toArray as t, macrostep as u, transitionNode as v, getInitialConfiguration as w, resolveActionsAndContext as x, assign as y, createInitEvent as z };