xstate 4.20.1 → 4.23.1

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 (92) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/dist/xstate.interpreter.js +1 -1
  3. package/dist/xstate.js +1 -1
  4. package/dist/xstate.web.js +2 -2
  5. package/es/Actor.js +17 -5
  6. package/es/Machine.d.ts +6 -3
  7. package/es/Machine.js +3 -6
  8. package/es/State.js +1 -3
  9. package/es/StateNode.d.ts +4 -3
  10. package/es/StateNode.js +34 -20
  11. package/es/_virtual/_tslib.js +59 -73
  12. package/es/actionTypes.js +3 -2
  13. package/es/actions.d.ts +1 -1
  14. package/es/actions.js +51 -37
  15. package/es/behaviors.d.ts +37 -0
  16. package/es/behaviors.js +65 -0
  17. package/es/constants.js +2 -1
  18. package/es/devTools.js +1 -1
  19. package/es/environment.js +2 -1
  20. package/es/index.js +3 -1
  21. package/es/interpreter.d.ts +10 -3
  22. package/es/interpreter.js +44 -22
  23. package/es/invokeUtils.js +4 -3
  24. package/es/mapState.js +1 -1
  25. package/es/match.js +1 -1
  26. package/es/model.d.ts +2 -36
  27. package/es/model.types.d.ts +37 -0
  28. package/es/registry.js +2 -1
  29. package/es/scheduler.js +2 -1
  30. package/es/schema.js +1 -1
  31. package/es/serviceScope.js +1 -3
  32. package/es/stateUtils.js +1 -9
  33. package/es/types.d.ts +26 -5
  34. package/es/types.js +1 -1
  35. package/es/utils.d.ts +3 -2
  36. package/es/utils.js +4 -40
  37. package/lib/Actor.d.ts +25 -25
  38. package/lib/Actor.js +85 -66
  39. package/lib/Machine.d.ts +17 -14
  40. package/lib/Machine.js +14 -14
  41. package/lib/SimulatedClock.d.ts +16 -16
  42. package/lib/State.d.ts +108 -108
  43. package/lib/State.js +246 -236
  44. package/lib/StateNode.d.ts +279 -278
  45. package/lib/StateNode.js +1535 -1339
  46. package/lib/_virtual/_tslib.js +81 -0
  47. package/lib/actionTypes.d.ts +19 -19
  48. package/lib/actionTypes.js +43 -23
  49. package/lib/actions.d.ts +138 -138
  50. package/lib/actions.js +465 -387
  51. package/lib/behaviors.d.ts +37 -0
  52. package/lib/behaviors.js +69 -0
  53. package/lib/constants.d.ts +5 -5
  54. package/lib/constants.js +13 -7
  55. package/lib/devTools.d.ts +15 -15
  56. package/lib/devTools.js +37 -26
  57. package/lib/each.d.ts +3 -3
  58. package/lib/environment.d.ts +1 -1
  59. package/lib/environment.js +7 -4
  60. package/lib/index.d.ts +30 -30
  61. package/lib/index.js +67 -57
  62. package/lib/interpreter.d.ts +205 -198
  63. package/lib/interpreter.js +1306 -1054
  64. package/lib/invoke.d.ts +10 -10
  65. package/lib/invokeUtils.d.ts +6 -6
  66. package/lib/invokeUtils.js +40 -37
  67. package/lib/json.d.ts +30 -30
  68. package/lib/mapState.d.ts +3 -3
  69. package/lib/mapState.js +31 -32
  70. package/lib/match.d.ts +8 -8
  71. package/lib/match.js +33 -47
  72. package/lib/model.d.ts +4 -38
  73. package/lib/model.js +5 -1
  74. package/lib/model.types.d.ts +37 -0
  75. package/lib/model.types.js +2 -0
  76. package/lib/patterns.d.ts +13 -13
  77. package/lib/registry.d.ts +8 -8
  78. package/lib/registry.js +21 -18
  79. package/lib/scheduler.d.ts +16 -16
  80. package/lib/scheduler.js +79 -70
  81. package/lib/schema.d.ts +1 -1
  82. package/lib/schema.js +6 -4
  83. package/lib/scxml.d.ts +5 -5
  84. package/lib/serviceScope.d.ts +3 -3
  85. package/lib/serviceScope.js +16 -12
  86. package/lib/stateUtils.d.ts +14 -14
  87. package/lib/stateUtils.js +231 -199
  88. package/lib/types.d.ts +928 -907
  89. package/lib/types.js +29 -29
  90. package/lib/utils.d.ts +68 -67
  91. package/lib/utils.js +530 -529
  92. package/package.json +6 -6
package/lib/Actor.js CHANGED
@@ -1,80 +1,99 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.toActorRef = exports.isSpawnedActor = exports.isActor = exports.createDeferredActor = exports.createInvocableActor = exports.createNullActor = void 0;
15
- var utils_1 = require("./utils");
16
- var serviceScope = require("./serviceScope");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('./_virtual/_tslib.js');
6
+ var utils = require('./utils.js');
7
+ var serviceScope = require('./serviceScope.js');
8
+
17
9
  function createNullActor(id) {
18
- return {
19
- id: id,
20
- send: function () { return void 0; },
21
- subscribe: function () { return ({
22
- unsubscribe: function () { return void 0; }
23
- }); },
24
- getSnapshot: function () { return undefined; },
25
- toJSON: function () { return ({
26
- id: id
27
- }); }
28
- };
10
+ return {
11
+ id: id,
12
+ send: function () {
13
+ return void 0;
14
+ },
15
+ subscribe: function () {
16
+ return {
17
+ unsubscribe: function () {
18
+ return void 0;
19
+ }
20
+ };
21
+ },
22
+ getSnapshot: function () {
23
+ return undefined;
24
+ },
25
+ toJSON: function () {
26
+ return {
27
+ id: id
28
+ };
29
+ }
30
+ };
29
31
  }
30
- exports.createNullActor = createNullActor;
31
- /**
32
- * Creates a deferred actor that is able to be invoked given the provided
33
- * invocation information in its `.meta` value.
34
- *
35
- * @param invokeDefinition The meta information needed to invoke the actor.
32
+ /**
33
+ * Creates a deferred actor that is able to be invoked given the provided
34
+ * invocation information in its `.meta` value.
35
+ *
36
+ * @param invokeDefinition The meta information needed to invoke the actor.
36
37
  */
38
+
37
39
  function createInvocableActor(invokeDefinition, machine, context, _event) {
38
- var _a;
39
- var invokeSrc = utils_1.toInvokeSource(invokeDefinition.src);
40
- var serviceCreator = (_a = machine === null || machine === void 0 ? void 0 : machine.options.services) === null || _a === void 0 ? void 0 : _a[invokeSrc.type];
41
- var resolvedData = invokeDefinition.data
42
- ? utils_1.mapContext(invokeDefinition.data, context, _event)
43
- : undefined;
44
- var tempActor = serviceCreator
45
- ? createDeferredActor(serviceCreator, invokeDefinition.id, resolvedData)
46
- : createNullActor(invokeDefinition.id);
47
- // @ts-ignore
48
- tempActor.meta = invokeDefinition;
49
- return tempActor;
40
+ var _a;
41
+
42
+ var invokeSrc = utils.toInvokeSource(invokeDefinition.src);
43
+ var serviceCreator = (_a = machine === null || machine === void 0 ? void 0 : machine.options.services) === null || _a === void 0 ? void 0 : _a[invokeSrc.type];
44
+ var resolvedData = invokeDefinition.data ? utils.mapContext(invokeDefinition.data, context, _event) : undefined;
45
+ var tempActor = serviceCreator ? createDeferredActor(serviceCreator, invokeDefinition.id, resolvedData) : createNullActor(invokeDefinition.id); // @ts-ignore
46
+
47
+ tempActor.meta = invokeDefinition;
48
+ return tempActor;
50
49
  }
51
- exports.createInvocableActor = createInvocableActor;
52
50
  function createDeferredActor(entity, id, data) {
53
- var tempActor = createNullActor(id);
54
- // @ts-ignore
55
- tempActor.deferred = true;
56
- if (utils_1.isMachine(entity)) {
57
- // "mute" the existing service scope so potential spawned actors within the `.initialState` stay deferred here
58
- var initialState_1 = (tempActor.state = serviceScope.provide(undefined, function () { return (data ? entity.withContext(data) : entity).initialState; }));
59
- tempActor.getSnapshot = function () { return initialState_1; };
60
- }
61
- return tempActor;
51
+ var tempActor = createNullActor(id); // @ts-ignore
52
+
53
+ tempActor.deferred = true;
54
+
55
+ if (utils.isMachine(entity)) {
56
+ // "mute" the existing service scope so potential spawned actors within the `.initialState` stay deferred here
57
+ var initialState_1 = tempActor.state = serviceScope.provide(undefined, function () {
58
+ return (data ? entity.withContext(data) : entity).initialState;
59
+ });
60
+
61
+ tempActor.getSnapshot = function () {
62
+ return initialState_1;
63
+ };
64
+ }
65
+
66
+ return tempActor;
62
67
  }
63
- exports.createDeferredActor = createDeferredActor;
64
68
  function isActor(item) {
65
- try {
66
- return typeof item.send === 'function';
67
- }
68
- catch (e) {
69
- return false;
70
- }
69
+ try {
70
+ return typeof item.send === 'function';
71
+ } catch (e) {
72
+ return false;
73
+ }
71
74
  }
72
- exports.isActor = isActor;
73
75
  function isSpawnedActor(item) {
74
- return isActor(item) && 'id' in item;
76
+ return isActor(item) && 'id' in item;
75
77
  }
76
- exports.isSpawnedActor = isSpawnedActor;
77
78
  function toActorRef(actorRefLike) {
78
- return __assign({ subscribe: function () { return ({ unsubscribe: function () { return void 0; } }); }, id: 'anonymous', getSnapshot: function () { return undefined; } }, actorRefLike);
79
+ return _tslib.__assign({
80
+ subscribe: function () {
81
+ return {
82
+ unsubscribe: function () {
83
+ return void 0;
84
+ }
85
+ };
86
+ },
87
+ id: 'anonymous',
88
+ getSnapshot: function () {
89
+ return undefined;
90
+ }
91
+ }, actorRefLike);
79
92
  }
93
+
94
+ exports.createDeferredActor = createDeferredActor;
95
+ exports.createInvocableActor = createInvocableActor;
96
+ exports.createNullActor = createNullActor;
97
+ exports.isActor = isActor;
98
+ exports.isSpawnedActor = isSpawnedActor;
80
99
  exports.toActorRef = toActorRef;
package/lib/Machine.d.ts CHANGED
@@ -1,15 +1,18 @@
1
- import { StateMachine, MachineOptions, DefaultContext, MachineConfig, StateSchema, EventObject, AnyEventObject, Typestate } from './types';
2
- import { Model, ModelContextFrom, ModelEventsFrom } from './model';
3
- export declare function Machine<TContext = any, TEvent extends EventObject = AnyEventObject>(config: MachineConfig<TContext, any, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>, initialContext?: TContext): StateMachine<TContext, any, TEvent>;
4
- export declare function Machine<TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = AnyEventObject>(config: MachineConfig<TContext, TStateSchema, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>, initialContext?: TContext): StateMachine<TContext, TStateSchema, TEvent>;
5
- export declare function createMachine<TModel extends Model<any, any, any>, TContext = ModelContextFrom<TModel>, TEvent extends EventObject = ModelEventsFrom<TModel>, TTypestate extends Typestate<TContext> = {
6
- value: any;
7
- context: TContext;
8
- }>(config: MachineConfig<TContext, any, TEvent> & {
9
- context: TContext;
10
- }, options?: Partial<MachineOptions<TContext, TEvent>>): StateMachine<TContext, any, TEvent, TTypestate>;
11
- export declare function createMachine<TContext, TEvent extends EventObject = AnyEventObject, TTypestate extends Typestate<TContext> = {
12
- value: any;
13
- context: TContext;
14
- }>(config: TContext extends Model<any, any, any> ? never : MachineConfig<TContext, any, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>): StateMachine<TContext, any, TEvent, TTypestate>;
1
+ import { StateMachine, MachineOptions, DefaultContext, MachineConfig, StateSchema, EventObject, AnyEventObject, Typestate, EventFrom } from './types';
2
+ import { Model, ModelContextFrom } from './model.types';
3
+ /**
4
+ * @deprecated Use `createMachine(...)` instead.
5
+ */
6
+ export declare function Machine<TContext = any, TEvent extends EventObject = AnyEventObject>(config: MachineConfig<TContext, any, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>, initialContext?: TContext): StateMachine<TContext, any, TEvent>;
7
+ export declare function Machine<TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = AnyEventObject>(config: MachineConfig<TContext, TStateSchema, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>, initialContext?: TContext): StateMachine<TContext, TStateSchema, TEvent>;
8
+ export declare function createMachine<TModel extends Model<any, any, any>, TContext = ModelContextFrom<TModel>, TEvent extends EventObject = EventFrom<TModel>, TTypestate extends Typestate<TContext> = {
9
+ value: any;
10
+ context: TContext;
11
+ }>(config: MachineConfig<TContext, any, TEvent> & {
12
+ context: TContext;
13
+ }, options?: Partial<MachineOptions<TContext, TEvent>>): StateMachine<TContext, any, TEvent, TTypestate>;
14
+ export declare function createMachine<TContext, TEvent extends EventObject = AnyEventObject, TTypestate extends Typestate<TContext> = {
15
+ value: any;
16
+ context: TContext;
17
+ }>(config: TContext extends Model<any, any, any> ? never : MachineConfig<TContext, any, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>): StateMachine<TContext, any, TEvent, TTypestate>;
15
18
  //# sourceMappingURL=Machine.d.ts.map
package/lib/Machine.js CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createMachine = exports.Machine = void 0;
4
- var StateNode_1 = require("./StateNode");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var StateNode = require('./StateNode.js');
6
+
5
7
  function Machine(config, options, initialContext) {
6
- if (initialContext === void 0) { initialContext = config.context; }
7
- var resolvedInitialContext = typeof initialContext === 'function'
8
- ? initialContext()
9
- : initialContext;
10
- return new StateNode_1.StateNode(config, options, resolvedInitialContext);
8
+ if (initialContext === void 0) {
9
+ initialContext = config.context;
10
+ }
11
+
12
+ return new StateNode.StateNode(config, options, initialContext);
11
13
  }
12
- exports.Machine = Machine;
13
14
  function createMachine(config, options) {
14
- var resolvedInitialContext = typeof config.context === 'function'
15
- ? config.context()
16
- : config.context;
17
- return new StateNode_1.StateNode(config, options, resolvedInitialContext);
15
+ return new StateNode.StateNode(config, options);
18
16
  }
17
+
18
+ exports.Machine = Machine;
19
19
  exports.createMachine = createMachine;
@@ -1,17 +1,17 @@
1
- import { Clock } from './interpreter';
2
- export interface SimulatedClock extends Clock {
3
- start(speed: number): void;
4
- increment(ms: number): void;
5
- set(ms: number): void;
6
- }
7
- export declare class SimulatedClock implements SimulatedClock {
8
- private timeouts;
9
- private _now;
10
- private _id;
11
- now(): number;
12
- private getId;
13
- setTimeout(fn: (...args: any[]) => void, timeout: number): number;
14
- clearTimeout(id: number): void;
15
- private flushTimeouts;
16
- }
1
+ import { Clock } from './interpreter';
2
+ export interface SimulatedClock extends Clock {
3
+ start(speed: number): void;
4
+ increment(ms: number): void;
5
+ set(ms: number): void;
6
+ }
7
+ export declare class SimulatedClock implements SimulatedClock {
8
+ private timeouts;
9
+ private _now;
10
+ private _id;
11
+ now(): number;
12
+ private getId;
13
+ setTimeout(fn: (...args: any[]) => void, timeout: number): number;
14
+ clearTimeout(id: number): void;
15
+ private flushTimeouts;
16
+ }
17
17
  //# sourceMappingURL=SimulatedClock.d.ts.map
package/lib/State.d.ts CHANGED
@@ -1,109 +1,109 @@
1
- import { StateValue, ActivityMap, EventObject, HistoryValue, ActionObject, EventType, StateConfig, SCXML, StateSchema, TransitionDefinition, Typestate, ActorRef } from './types';
2
- import { StateNode } from './StateNode';
3
- export declare function stateValuesEqual(a: StateValue | undefined, b: StateValue | undefined): boolean;
4
- export declare function isState<TContext, TEvent extends EventObject, TStateSchema extends StateSchema<TContext> = any, TTypestate extends Typestate<TContext> = {
5
- value: any;
6
- context: TContext;
7
- }>(state: object | string): state is State<TContext, TEvent, TStateSchema, TTypestate>;
8
- export declare function bindActionToState<TC, TE extends EventObject>(action: ActionObject<TC, TE>, state: State<TC, TE, any, any>): ActionObject<TC, TE>;
9
- export declare class State<TContext, TEvent extends EventObject = EventObject, TStateSchema extends StateSchema<TContext> = any, TTypestate extends Typestate<TContext> = {
10
- value: any;
11
- context: TContext;
12
- }> {
13
- value: StateValue;
14
- context: TContext;
15
- historyValue?: HistoryValue | undefined;
16
- history?: State<TContext, TEvent, TStateSchema, TTypestate>;
17
- actions: Array<ActionObject<TContext, TEvent>>;
18
- activities: ActivityMap;
19
- meta: any;
20
- events: TEvent[];
21
- event: TEvent;
22
- _event: SCXML.Event<TEvent>;
23
- _sessionid: string | null;
24
- /**
25
- * Indicates whether the state has changed from the previous state. A state is considered "changed" if:
26
- *
27
- * - Its value is not equal to its previous value, or:
28
- * - It has any new actions (side-effects) to execute.
29
- *
30
- * An initial state (with no history) will return `undefined`.
31
- */
32
- changed: boolean | undefined;
33
- /**
34
- * Indicates whether the state is a final state.
35
- */
36
- done: boolean | undefined;
37
- /**
38
- * The enabled state nodes representative of the state value.
39
- */
40
- configuration: Array<StateNode<TContext, any, TEvent, any>>;
41
- /**
42
- * The next events that will cause a transition from the current state.
43
- */
44
- nextEvents: EventType[];
45
- /**
46
- * The transition definitions that resulted in this state.
47
- */
48
- transitions: Array<TransitionDefinition<TContext, TEvent>>;
49
- /**
50
- * An object mapping actor IDs to spawned actors/invoked services.
51
- */
52
- children: Record<string, ActorRef<any>>;
53
- tags: Set<string>;
54
- /**
55
- * Creates a new State instance for the given `stateValue` and `context`.
56
- * @param stateValue
57
- * @param context
58
- */
59
- static from<TC, TE extends EventObject = EventObject>(stateValue: State<TC, TE, any, any> | StateValue, context?: TC | undefined): State<TC, TE, any, any>;
60
- /**
61
- * Creates a new State instance for the given `config`.
62
- * @param config The state config
63
- */
64
- static create<TC, TE extends EventObject = EventObject>(config: StateConfig<TC, TE>): State<TC, TE>;
65
- /**
66
- * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
67
- * @param stateValue
68
- * @param context
69
- */
70
- static inert<TC, TE extends EventObject = EventObject>(stateValue: State<TC, TE> | StateValue, context: TC): State<TC, TE>;
71
- /**
72
- * Creates a new State instance.
73
- * @param value The state value
74
- * @param context The extended state
75
- * @param historyValue The tree representing historical values of the state nodes
76
- * @param history The previous state
77
- * @param actions An array of action objects to execute as side-effects
78
- * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
79
- * @param meta
80
- * @param events Internal event queue. Should be empty with run-to-completion semantics.
81
- * @param configuration
82
- */
83
- constructor(config: StateConfig<TContext, TEvent>);
84
- /**
85
- * Returns an array of all the string leaf state node paths.
86
- * @param stateValue
87
- * @param delimiter The character(s) that separate each subpath in the string state node path.
88
- */
89
- toStrings(stateValue?: StateValue, delimiter?: string): string[];
90
- toJSON(): Omit<this, "configuration" | "transitions" | "tags"> & {
91
- tags: string[];
92
- };
93
- /**
94
- * Whether the current state value is a subset of the given parent state value.
95
- * @param parentStateValue
96
- */
97
- matches<TSV extends TTypestate['value']>(parentStateValue: TSV): this is State<(TTypestate extends any ? {
98
- value: TSV;
99
- context: any;
100
- } extends TTypestate ? TTypestate : never : never)['context'], TEvent, TStateSchema, TTypestate> & {
101
- value: TSV;
102
- };
103
- /**
104
- * Whether the current state configuration has a state node with the specified `tag`.
105
- * @param tag
106
- */
107
- hasTag(tag: string): boolean;
108
- }
1
+ import { StateValue, ActivityMap, EventObject, HistoryValue, ActionObject, EventType, StateConfig, SCXML, StateSchema, TransitionDefinition, Typestate, ActorRef } from './types';
2
+ import { StateNode } from './StateNode';
3
+ export declare function stateValuesEqual(a: StateValue | undefined, b: StateValue | undefined): boolean;
4
+ export declare function isState<TContext, TEvent extends EventObject, TStateSchema extends StateSchema<TContext> = any, TTypestate extends Typestate<TContext> = {
5
+ value: any;
6
+ context: TContext;
7
+ }>(state: object | string): state is State<TContext, TEvent, TStateSchema, TTypestate>;
8
+ export declare function bindActionToState<TC, TE extends EventObject>(action: ActionObject<TC, TE>, state: State<TC, TE, any, any>): ActionObject<TC, TE>;
9
+ export declare class State<TContext, TEvent extends EventObject = EventObject, TStateSchema extends StateSchema<TContext> = any, TTypestate extends Typestate<TContext> = {
10
+ value: any;
11
+ context: TContext;
12
+ }> {
13
+ value: StateValue;
14
+ context: TContext;
15
+ historyValue?: HistoryValue | undefined;
16
+ history?: State<TContext, TEvent, TStateSchema, TTypestate>;
17
+ actions: Array<ActionObject<TContext, TEvent>>;
18
+ activities: ActivityMap;
19
+ meta: any;
20
+ events: TEvent[];
21
+ event: TEvent;
22
+ _event: SCXML.Event<TEvent>;
23
+ _sessionid: string | null;
24
+ /**
25
+ * Indicates whether the state has changed from the previous state. A state is considered "changed" if:
26
+ *
27
+ * - Its value is not equal to its previous value, or:
28
+ * - It has any new actions (side-effects) to execute.
29
+ *
30
+ * An initial state (with no history) will return `undefined`.
31
+ */
32
+ changed: boolean | undefined;
33
+ /**
34
+ * Indicates whether the state is a final state.
35
+ */
36
+ done: boolean | undefined;
37
+ /**
38
+ * The enabled state nodes representative of the state value.
39
+ */
40
+ configuration: Array<StateNode<TContext, any, TEvent, any>>;
41
+ /**
42
+ * The next events that will cause a transition from the current state.
43
+ */
44
+ nextEvents: EventType[];
45
+ /**
46
+ * The transition definitions that resulted in this state.
47
+ */
48
+ transitions: Array<TransitionDefinition<TContext, TEvent>>;
49
+ /**
50
+ * An object mapping actor IDs to spawned actors/invoked services.
51
+ */
52
+ children: Record<string, ActorRef<any>>;
53
+ tags: Set<string>;
54
+ /**
55
+ * Creates a new State instance for the given `stateValue` and `context`.
56
+ * @param stateValue
57
+ * @param context
58
+ */
59
+ static from<TC, TE extends EventObject = EventObject>(stateValue: State<TC, TE, any, any> | StateValue, context?: TC | undefined): State<TC, TE, any, any>;
60
+ /**
61
+ * Creates a new State instance for the given `config`.
62
+ * @param config The state config
63
+ */
64
+ static create<TC, TE extends EventObject = EventObject>(config: StateConfig<TC, TE>): State<TC, TE>;
65
+ /**
66
+ * Creates a new `State` instance for the given `stateValue` and `context` with no actions (side-effects).
67
+ * @param stateValue
68
+ * @param context
69
+ */
70
+ static inert<TC, TE extends EventObject = EventObject>(stateValue: State<TC, TE> | StateValue, context: TC): State<TC, TE>;
71
+ /**
72
+ * Creates a new State instance.
73
+ * @param value The state value
74
+ * @param context The extended state
75
+ * @param historyValue The tree representing historical values of the state nodes
76
+ * @param history The previous state
77
+ * @param actions An array of action objects to execute as side-effects
78
+ * @param activities A mapping of activities and whether they are started (`true`) or stopped (`false`).
79
+ * @param meta
80
+ * @param events Internal event queue. Should be empty with run-to-completion semantics.
81
+ * @param configuration
82
+ */
83
+ constructor(config: StateConfig<TContext, TEvent>);
84
+ /**
85
+ * Returns an array of all the string leaf state node paths.
86
+ * @param stateValue
87
+ * @param delimiter The character(s) that separate each subpath in the string state node path.
88
+ */
89
+ toStrings(stateValue?: StateValue, delimiter?: string): string[];
90
+ toJSON(): Omit<this, "configuration" | "transitions" | "tags"> & {
91
+ tags: string[];
92
+ };
93
+ /**
94
+ * Whether the current state value is a subset of the given parent state value.
95
+ * @param parentStateValue
96
+ */
97
+ matches<TSV extends TTypestate['value']>(parentStateValue: TSV): this is State<(TTypestate extends any ? {
98
+ value: TSV;
99
+ context: any;
100
+ } extends TTypestate ? TTypestate : never : never)['context'], TEvent, TStateSchema, TTypestate> & {
101
+ value: TSV;
102
+ };
103
+ /**
104
+ * Whether the current state configuration has a state node with the specified `tag`.
105
+ * @param tag
106
+ */
107
+ hasTag(tag: string): boolean;
108
+ }
109
109
  //# sourceMappingURL=State.d.ts.map