xstate 5.0.0-beta.47 → 5.0.0-beta.48

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 (30) hide show
  1. package/actions/dist/xstate-actions.cjs.js +2 -2
  2. package/actions/dist/xstate-actions.development.cjs.js +2 -2
  3. package/actions/dist/xstate-actions.development.esm.js +2 -2
  4. package/actions/dist/xstate-actions.esm.js +2 -2
  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/dist/declarations/src/interpreter.d.ts +30 -4
  12. package/dist/declarations/src/setup.d.ts +3 -3
  13. package/dist/{raise-7dc97582.development.cjs.js → raise-0eafc1df.development.cjs.js} +29 -3
  14. package/dist/{raise-156f5f68.development.esm.js → raise-286581d5.development.esm.js} +29 -3
  15. package/dist/{raise-91ec8b4f.esm.js → raise-84fd7a92.esm.js} +29 -3
  16. package/dist/{raise-7af24c22.cjs.js → raise-cd0dde81.cjs.js} +29 -3
  17. package/dist/{send-bc0d3e22.development.cjs.js → send-32a63473.development.cjs.js} +1 -1
  18. package/dist/{send-401f5c30.cjs.js → send-355ba004.cjs.js} +1 -1
  19. package/dist/{send-ed326064.esm.js → send-ae491737.esm.js} +1 -1
  20. package/dist/{send-7489590c.development.esm.js → send-f0a3179c.development.esm.js} +1 -1
  21. package/dist/xstate.cjs.js +2 -2
  22. package/dist/xstate.development.cjs.js +2 -2
  23. package/dist/xstate.development.esm.js +4 -4
  24. package/dist/xstate.esm.js +4 -4
  25. package/dist/xstate.umd.min.js.map +1 -1
  26. package/guards/dist/xstate-guards.cjs.js +1 -1
  27. package/guards/dist/xstate-guards.development.cjs.js +1 -1
  28. package/guards/dist/xstate-guards.development.esm.js +1 -1
  29. package/guards/dist/xstate-guards.esm.js +1 -1
  30. package/package.json +1 -1
@@ -838,10 +838,36 @@ class Actor {
838
838
  }
839
839
 
840
840
  /**
841
- * Creates a new `ActorRef` instance for the given machine with the provided options, if any.
841
+ * Creates a new actor instance for the given actor logic with the provided options, if any.
842
842
  *
843
- * @param machine The machine to create an actor from
844
- * @param options `ActorRef` options
843
+ * @remarks
844
+ * When you create an actor from actor logic via `createActor(logic)`, you implicitly create an actor system where the created actor is the root actor.
845
+ * Any actors spawned from this root actor and its descendants are part of that actor system.
846
+ *
847
+ * @example
848
+ * ```ts
849
+ * import { createActor } from 'xstate';
850
+ * import { someActorLogic } from './someActorLogic.ts';
851
+ *
852
+ * // Creating the actor, which implicitly creates an actor system with itself as the root actor
853
+ * const actor = createActor(someActorLogic);
854
+ *
855
+ * actor.subscribe((snapshot) => {
856
+ * console.log(snapshot);
857
+ * });
858
+ *
859
+ * // Actors must be started by calling `actor.start()`, which will also start the actor system.
860
+ * actor.start();
861
+ *
862
+ * // Actors can receive events
863
+ * actor.send({ type: 'someEvent' });
864
+ *
865
+ * // You can stop root actors by calling `actor.stop()`, which will also stop the actor system and all actors in that system.
866
+ * actor.stop();
867
+ * ```
868
+ *
869
+ * @param logic - The actor logic to create an actor from. For a state machine actor logic creator, see {@link createMachine}. Other actor logic creators include {@link fromCallback}, {@link fromEventObservable}, {@link fromObservable}, {@link fromPromise}, and {@link fromTransition}.
870
+ * @param options - Actor options
845
871
  */
846
872
 
847
873
  function createActor(logic, options) {
@@ -840,10 +840,36 @@ class Actor {
840
840
  }
841
841
 
842
842
  /**
843
- * Creates a new `ActorRef` instance for the given machine with the provided options, if any.
843
+ * Creates a new actor instance for the given actor logic with the provided options, if any.
844
844
  *
845
- * @param machine The machine to create an actor from
846
- * @param options `ActorRef` options
845
+ * @remarks
846
+ * When you create an actor from actor logic via `createActor(logic)`, you implicitly create an actor system where the created actor is the root actor.
847
+ * Any actors spawned from this root actor and its descendants are part of that actor system.
848
+ *
849
+ * @example
850
+ * ```ts
851
+ * import { createActor } from 'xstate';
852
+ * import { someActorLogic } from './someActorLogic.ts';
853
+ *
854
+ * // Creating the actor, which implicitly creates an actor system with itself as the root actor
855
+ * const actor = createActor(someActorLogic);
856
+ *
857
+ * actor.subscribe((snapshot) => {
858
+ * console.log(snapshot);
859
+ * });
860
+ *
861
+ * // Actors must be started by calling `actor.start()`, which will also start the actor system.
862
+ * actor.start();
863
+ *
864
+ * // Actors can receive events
865
+ * actor.send({ type: 'someEvent' });
866
+ *
867
+ * // You can stop root actors by calling `actor.stop()`, which will also stop the actor system and all actors in that system.
868
+ * actor.stop();
869
+ * ```
870
+ *
871
+ * @param logic - The actor logic to create an actor from. For a state machine actor logic creator, see {@link createMachine}. Other actor logic creators include {@link fromCallback}, {@link fromEventObservable}, {@link fromObservable}, {@link fromPromise}, and {@link fromTransition}.
872
+ * @param options - Actor options
847
873
  */
848
874
 
849
875
  function createActor(logic, options) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-7dc97582.development.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-0eafc1df.development.cjs.js');
4
4
 
5
5
  function createSpawner(actorScope, {
6
6
  machine,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-7af24c22.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-cd0dde81.cjs.js');
4
4
 
5
5
  function createSpawner(actorScope, {
6
6
  machine,
@@ -1,4 +1,4 @@
1
- import { U as ProcessingStatus, V as createErrorActorEvent, B as resolveReferencedActor, C as createActor, p as cloneMachineSnapshot, e as evaluateGuard, t as toArray, W as XSTATE_ERROR } from './raise-91ec8b4f.esm.js';
1
+ import { U as ProcessingStatus, V as createErrorActorEvent, B as resolveReferencedActor, C as createActor, p as cloneMachineSnapshot, e as evaluateGuard, t as toArray, W as XSTATE_ERROR } from './raise-84fd7a92.esm.js';
2
2
 
3
3
  function createSpawner(actorScope, {
4
4
  machine,
@@ -1,4 +1,4 @@
1
- import { U as ProcessingStatus, V as createErrorActorEvent, B as resolveReferencedActor, C as createActor, p as cloneMachineSnapshot, e as evaluateGuard, t as toArray, W as XSTATE_ERROR } from './raise-156f5f68.development.esm.js';
1
+ import { U as ProcessingStatus, V as createErrorActorEvent, B as resolveReferencedActor, C as createActor, p as cloneMachineSnapshot, e as evaluateGuard, t as toArray, W as XSTATE_ERROR } from './raise-286581d5.development.esm.js';
2
2
 
3
3
  function createSpawner(actorScope, {
4
4
  machine,
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var actors_dist_xstateActors = require('../actors/dist/xstate-actors.cjs.js');
6
- var guards_dist_xstateGuards = require('./raise-7af24c22.cjs.js');
7
- var send = require('./send-401f5c30.cjs.js');
6
+ var guards_dist_xstateGuards = require('./raise-cd0dde81.cjs.js');
7
+ var send = require('./send-355ba004.cjs.js');
8
8
  require('../dev/dist/xstate-dev.cjs.js');
9
9
 
10
10
  class SimulatedClock {
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var actors_dist_xstateActors = require('../actors/dist/xstate-actors.development.cjs.js');
6
- var guards_dist_xstateGuards = require('./raise-7dc97582.development.cjs.js');
7
- var send = require('./send-bc0d3e22.development.cjs.js');
6
+ var guards_dist_xstateGuards = require('./raise-0eafc1df.development.cjs.js');
7
+ var send = require('./send-32a63473.development.cjs.js');
8
8
  require('../dev/dist/xstate-dev.development.cjs.js');
9
9
 
10
10
  class SimulatedClock {
@@ -1,8 +1,8 @@
1
1
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.development.esm.js';
2
- import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-156f5f68.development.esm.js';
3
- export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise, T as spawnChild, M as stateIn, Q as stop, R as stopChild, I as toObserver } from './raise-156f5f68.development.esm.js';
4
- import { a as assign } from './send-7489590c.development.esm.js';
5
- export { S as SpecialTargets, a as assign, c as choose, e as escalate, f as forwardTo, l as log, p as pure, s as sendParent, b as sendTo } from './send-7489590c.development.esm.js';
2
+ import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-286581d5.development.esm.js';
3
+ export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise, T as spawnChild, M as stateIn, Q as stop, R as stopChild, I as toObserver } from './raise-286581d5.development.esm.js';
4
+ import { a as assign } from './send-f0a3179c.development.esm.js';
5
+ export { S as SpecialTargets, a as assign, c as choose, e as escalate, f as forwardTo, l as log, p as pure, s as sendParent, b as sendTo } from './send-f0a3179c.development.esm.js';
6
6
  import '../dev/dist/xstate-dev.development.esm.js';
7
7
 
8
8
  class SimulatedClock {
@@ -1,8 +1,8 @@
1
1
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.esm.js';
2
- import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-91ec8b4f.esm.js';
3
- export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise, T as spawnChild, M as stateIn, Q as stop, R as stopChild, I as toObserver } from './raise-91ec8b4f.esm.js';
4
- import { a as assign } from './send-ed326064.esm.js';
5
- export { S as SpecialTargets, a as assign, c as choose, e as escalate, f as forwardTo, l as log, p as pure, s as sendParent, b as sendTo } from './send-ed326064.esm.js';
2
+ import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as isErrorActorEvent, o as getAllOwnEventDescriptors, p as cloneMachineSnapshot, q as macrostep, s as transitionNode, u as resolveActionsAndContext, v as createInitEvent, w as microstep, x as getInitialStateNodes, y as isStateId, z as getStateNodeByPath, A as getPersistedState, B as resolveReferencedActor, C as createActor, $ as $$ACTOR_TYPE } from './raise-84fd7a92.esm.js';
3
+ export { D as Actor, o as __unsafe_getAllOwnEventDescriptors, J as and, O as cancel, C as createActor, j as getStateNodes, E as interpret, F as isMachineSnapshot, G as matchesState, K as not, L as or, H as pathToStateValue, P as raise, T as spawnChild, M as stateIn, Q as stop, R as stopChild, I as toObserver } from './raise-84fd7a92.esm.js';
4
+ import { a as assign } from './send-ae491737.esm.js';
5
+ export { S as SpecialTargets, a as assign, c as choose, e as escalate, f as forwardTo, l as log, p as pure, s as sendParent, b as sendTo } from './send-ae491737.esm.js';
6
6
  import '../dev/dist/xstate-dev.esm.js';
7
7
 
8
8
  class SimulatedClock {