xstate 4.20.0 → 4.23.0

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 (94) hide show
  1. package/CHANGELOG.md +205 -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.d.ts +6 -5
  6. package/es/Actor.js +22 -7
  7. package/es/Machine.d.ts +10 -5
  8. package/es/Machine.js +3 -6
  9. package/es/State.js +3 -5
  10. package/es/StateNode.d.ts +4 -3
  11. package/es/StateNode.js +34 -28
  12. package/es/_virtual/_tslib.js +59 -73
  13. package/es/actionTypes.js +3 -2
  14. package/es/actions.d.ts +1 -1
  15. package/es/actions.js +51 -37
  16. package/es/behaviors.d.ts +37 -0
  17. package/es/behaviors.js +65 -0
  18. package/es/constants.js +2 -1
  19. package/es/devTools.js +1 -1
  20. package/es/environment.js +2 -1
  21. package/es/index.js +3 -1
  22. package/es/interpreter.d.ts +15 -8
  23. package/es/interpreter.js +48 -22
  24. package/es/invokeUtils.js +4 -3
  25. package/es/mapState.js +1 -1
  26. package/es/match.js +1 -1
  27. package/es/model.d.ts +2 -36
  28. package/es/model.types.d.ts +37 -0
  29. package/es/registry.js +2 -1
  30. package/es/scheduler.js +2 -1
  31. package/es/schema.js +1 -1
  32. package/es/serviceScope.js +1 -3
  33. package/es/stateUtils.d.ts +1 -0
  34. package/es/stateUtils.js +14 -8
  35. package/es/types.d.ts +35 -9
  36. package/es/types.js +1 -1
  37. package/es/utils.d.ts +3 -2
  38. package/es/utils.js +4 -40
  39. package/lib/Actor.d.ts +25 -24
  40. package/lib/Actor.js +87 -53
  41. package/lib/Machine.d.ts +17 -12
  42. package/lib/Machine.js +14 -14
  43. package/lib/SimulatedClock.d.ts +16 -16
  44. package/lib/State.d.ts +108 -108
  45. package/lib/State.js +246 -236
  46. package/lib/StateNode.d.ts +279 -278
  47. package/lib/StateNode.js +1535 -1350
  48. package/lib/_virtual/_tslib.js +81 -0
  49. package/lib/actionTypes.d.ts +19 -19
  50. package/lib/actionTypes.js +43 -23
  51. package/lib/actions.d.ts +138 -138
  52. package/lib/actions.js +465 -387
  53. package/lib/behaviors.d.ts +37 -0
  54. package/lib/behaviors.js +69 -0
  55. package/lib/constants.d.ts +5 -5
  56. package/lib/constants.js +13 -7
  57. package/lib/devTools.d.ts +15 -15
  58. package/lib/devTools.js +37 -26
  59. package/lib/each.d.ts +3 -3
  60. package/lib/environment.d.ts +1 -1
  61. package/lib/environment.js +7 -4
  62. package/lib/index.d.ts +30 -30
  63. package/lib/index.js +67 -57
  64. package/lib/interpreter.d.ts +205 -198
  65. package/lib/interpreter.js +1307 -1052
  66. package/lib/invoke.d.ts +10 -10
  67. package/lib/invokeUtils.d.ts +6 -6
  68. package/lib/invokeUtils.js +40 -37
  69. package/lib/json.d.ts +30 -30
  70. package/lib/mapState.d.ts +3 -3
  71. package/lib/mapState.js +31 -32
  72. package/lib/match.d.ts +8 -8
  73. package/lib/match.js +33 -47
  74. package/lib/model.d.ts +4 -38
  75. package/lib/model.js +5 -1
  76. package/lib/model.types.d.ts +37 -0
  77. package/lib/model.types.js +2 -0
  78. package/lib/patterns.d.ts +13 -13
  79. package/lib/registry.d.ts +8 -8
  80. package/lib/registry.js +21 -18
  81. package/lib/scheduler.d.ts +16 -16
  82. package/lib/scheduler.js +79 -70
  83. package/lib/schema.d.ts +1 -1
  84. package/lib/schema.js +6 -4
  85. package/lib/scxml.d.ts +5 -5
  86. package/lib/serviceScope.d.ts +3 -3
  87. package/lib/serviceScope.js +16 -12
  88. package/lib/stateUtils.d.ts +14 -13
  89. package/lib/stateUtils.js +232 -190
  90. package/lib/types.d.ts +928 -902
  91. package/lib/types.js +29 -29
  92. package/lib/utils.d.ts +68 -67
  93. package/lib/utils.js +530 -529
  94. package/package.json +5 -5
@@ -1,279 +1,280 @@
1
- import { Event, StateValue, MachineOptions, EventObject, HistoryValue, StateNodeDefinition, TransitionDefinition, DelayedTransitionDefinition, ActivityDefinition, StateNodeConfig, StateSchema, StateNodesConfig, InvokeDefinition, ActionObject, Mapper, PropertyMapper, SCXML, Typestate, TransitionDefinitionMap, MachineSchema } from './types';
2
- import { State } from './State';
3
- declare class StateNode<TContext = any, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
4
- value: any;
5
- context: TContext;
6
- }> {
7
- /**
8
- * The raw config used to create the machine.
9
- */
10
- config: StateNodeConfig<TContext, TStateSchema, TEvent>;
11
- /**
12
- * The initial extended state
13
- */
14
- context: Readonly<TContext>;
15
- /**
16
- * The relative key of the state node, which represents its location in the overall state value.
17
- */
18
- key: string;
19
- /**
20
- * The unique ID of the state node.
21
- */
22
- id: string;
23
- /**
24
- * The machine's own version.
25
- */
26
- version?: string;
27
- /**
28
- * The type of this state node:
29
- *
30
- * - `'atomic'` - no child state nodes
31
- * - `'compound'` - nested child state nodes (XOR)
32
- * - `'parallel'` - orthogonal nested child state nodes (AND)
33
- * - `'history'` - history state node
34
- * - `'final'` - final state node
35
- */
36
- type: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';
37
- /**
38
- * The string path from the root machine node to this node.
39
- */
40
- path: string[];
41
- /**
42
- * The initial state node key.
43
- */
44
- initial?: keyof TStateSchema['states'];
45
- /**
46
- * (DEPRECATED) Whether the state node is a parallel state node.
47
- *
48
- * Use `type: 'parallel'` instead.
49
- */
50
- parallel?: boolean;
51
- /**
52
- * Whether the state node is "transient". A state node is considered transient if it has
53
- * an immediate transition from a "null event" (empty string), taken upon entering the state node.
54
- */
55
- private _transient;
56
- /**
57
- * The child state nodes.
58
- */
59
- states: StateNodesConfig<TContext, TStateSchema, TEvent>;
60
- /**
61
- * The type of history on this state node. Can be:
62
- *
63
- * - `'shallow'` - recalls only top-level historical state value
64
- * - `'deep'` - recalls historical state value at all levels
65
- */
66
- history: false | 'shallow' | 'deep';
67
- /**
68
- * The action(s) to be executed upon entering the state node.
69
- */
70
- onEntry: Array<ActionObject<TContext, TEvent>>;
71
- /**
72
- * The action(s) to be executed upon exiting the state node.
73
- */
74
- onExit: Array<ActionObject<TContext, TEvent>>;
75
- /**
76
- * The activities to be started upon entering the state node,
77
- * and stopped upon exiting the state node.
78
- */
79
- activities: Array<ActivityDefinition<TContext, TEvent>>;
80
- strict: boolean;
81
- /**
82
- * The parent state node.
83
- */
84
- parent?: StateNode<TContext, any, TEvent, any>;
85
- /**
86
- * The root machine node.
87
- */
88
- machine: StateNode<TContext, any, TEvent, TTypestate>;
89
- /**
90
- * The meta data associated with this state node, which will be returned in State instances.
91
- */
92
- meta?: TStateSchema extends {
93
- meta: infer D;
94
- } ? D : any;
95
- /**
96
- * The data sent with the "done.state._id_" event if this is a final state node.
97
- */
98
- doneData?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
99
- /**
100
- * The string delimiter for serializing the path to a string. The default is "."
101
- */
102
- delimiter: string;
103
- /**
104
- * The order this state node appears. Corresponds to the implicit SCXML document order.
105
- */
106
- order: number;
107
- /**
108
- * The services invoked by this state node.
109
- */
110
- invoke: Array<InvokeDefinition<TContext, TEvent>>;
111
- options: MachineOptions<TContext, TEvent>;
112
- schema: MachineSchema<TContext, TEvent>;
113
- __xstatenode: true;
114
- private __cache;
115
- private idMap;
116
- tags: string[];
117
- constructor(
118
- /**
119
- * The raw config used to create the machine.
120
- */
121
- config: StateNodeConfig<TContext, TStateSchema, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>,
122
- /**
123
- * The initial extended state
124
- */
125
- context?: Readonly<TContext>);
126
- private _init;
127
- /**
128
- * Clones this state machine with custom options and context.
129
- *
130
- * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.
131
- * @param context Custom context (will override predefined context)
132
- */
133
- withConfig(options: Partial<MachineOptions<TContext, TEvent>>, context?: TContext | undefined): StateNode<TContext, TStateSchema, TEvent, TTypestate>;
134
- /**
135
- * Clones this state machine with custom context.
136
- *
137
- * @param context Custom context (will override predefined context, not recursive)
138
- */
139
- withContext(context: TContext): StateNode<TContext, TStateSchema, TEvent, TTypestate>;
140
- /**
141
- * The well-structured state node definition.
142
- */
143
- get definition(): StateNodeDefinition<TContext, TStateSchema, TEvent>;
144
- toJSON(): StateNodeDefinition<TContext, TStateSchema, TEvent>;
145
- /**
146
- * The mapping of events to transitions.
147
- */
148
- get on(): TransitionDefinitionMap<TContext, TEvent>;
149
- get after(): Array<DelayedTransitionDefinition<TContext, TEvent>>;
150
- /**
151
- * All the transitions that can be taken from this state node.
152
- */
153
- get transitions(): Array<TransitionDefinition<TContext, TEvent>>;
154
- private getCandidates;
155
- /**
156
- * All delayed transitions from the config.
157
- */
158
- private getDelayedTransitions;
159
- /**
160
- * Returns the state nodes represented by the current state value.
161
- *
162
- * @param state The state value or State instance
163
- */
164
- getStateNodes(state: StateValue | State<TContext, TEvent, any, TTypestate>): Array<StateNode<TContext, any, TEvent, TTypestate>>;
165
- /**
166
- * Returns `true` if this state node explicitly handles the given event.
167
- *
168
- * @param event The event in question
169
- */
170
- handles(event: Event<TEvent>): boolean;
171
- /**
172
- * Resolves the given `state` to a new `State` instance relative to this machine.
173
- *
174
- * This ensures that `.events` and `.nextEvents` represent the correct values.
175
- *
176
- * @param state The state to resolve
177
- */
178
- resolveState(state: State<TContext, TEvent, any, any>): State<TContext, TEvent, TStateSchema, TTypestate>;
179
- private transitionLeafNode;
180
- private transitionCompoundNode;
181
- private transitionParallelNode;
182
- private _transition;
183
- private next;
184
- private nodesFromChild;
185
- /**
186
- * Whether the given state node "escapes" this state node. If the `stateNode` is equal to or the parent of
187
- * this state node, it does not escape.
188
- */
189
- private escapes;
190
- private getActions;
191
- /**
192
- * Determines the next state given the current `state` and sent `event`.
193
- *
194
- * @param state The current State instance or state value
195
- * @param event The event that was sent at the current state
196
- * @param context The current context (extended state) of the current state
197
- */
198
- transition(state: StateValue | State<TContext, TEvent, any, TTypestate> | undefined, event: Event<TEvent> | SCXML.Event<TEvent>, context?: TContext): State<TContext, TEvent, TStateSchema, TTypestate>;
199
- private resolveRaisedTransition;
200
- private resolveTransition;
201
- /**
202
- * Returns the child state node from its relative `stateKey`, or throws.
203
- */
204
- getStateNode(stateKey: string): StateNode<TContext, any, TEvent, TTypestate>;
205
- /**
206
- * Returns the state node with the given `stateId`, or throws.
207
- *
208
- * @param stateId The state ID. The prefix "#" is removed.
209
- */
210
- getStateNodeById(stateId: string): StateNode<TContext, any, TEvent, any>;
211
- /**
212
- * Returns the relative state node from the given `statePath`, or throws.
213
- *
214
- * @param statePath The string or string array relative path to the state node.
215
- */
216
- getStateNodeByPath(statePath: string | string[]): StateNode<TContext, any, TEvent, any>;
217
- /**
218
- * Resolves a partial state value with its full representation in this machine.
219
- *
220
- * @param stateValue The partial state value to resolve.
221
- */
222
- resolve(stateValue: StateValue): StateValue;
223
- private getResolvedPath;
224
- private get initialStateValue();
225
- getInitialState(stateValue: StateValue, context?: TContext): State<TContext, TEvent, TStateSchema, TTypestate>;
226
- /**
227
- * The initial State instance, which includes all actions to be executed from
228
- * entering the initial state.
229
- */
230
- get initialState(): State<TContext, TEvent, TStateSchema, TTypestate>;
231
- /**
232
- * The target state value of the history state node, if it exists. This represents the
233
- * default state value to transition to if no history value exists yet.
234
- */
235
- get target(): StateValue | undefined;
236
- /**
237
- * Returns the leaf nodes from a state path relative to this state node.
238
- *
239
- * @param relativeStateId The relative state path to retrieve the state nodes
240
- * @param history The previous state to retrieve history
241
- * @param resolve Whether state nodes should resolve to initial child state nodes
242
- */
243
- getRelativeStateNodes(relativeStateId: StateNode<TContext, any, TEvent>, historyValue?: HistoryValue, resolve?: boolean): Array<StateNode<TContext, any, TEvent>>;
244
- get initialStateNodes(): Array<StateNode<TContext, any, TEvent, any>>;
245
- /**
246
- * Retrieves state nodes from a relative path to this state node.
247
- *
248
- * @param relativePath The relative path from this state node
249
- * @param historyValue
250
- */
251
- getFromRelativePath(relativePath: string[]): Array<StateNode<TContext, any, TEvent, any>>;
252
- private historyValue;
253
- /**
254
- * Resolves to the historical value(s) of the parent state node,
255
- * represented by state nodes.
256
- *
257
- * @param historyValue
258
- */
259
- private resolveHistory;
260
- /**
261
- * All the state node IDs of this state node and its descendant state nodes.
262
- */
263
- get stateIds(): string[];
264
- /**
265
- * All the event types accepted by this state node and its descendants.
266
- */
267
- get events(): Array<TEvent['type']>;
268
- /**
269
- * All the events that have transitions directly from this state node.
270
- *
271
- * Excludes any inert events.
272
- */
273
- get ownEvents(): Array<TEvent['type']>;
274
- private resolveTarget;
275
- private formatTransition;
276
- private formatTransitions;
277
- }
278
- export { StateNode };
1
+ import { Event, StateValue, MachineOptions, EventObject, HistoryValue, StateNodeDefinition, TransitionDefinition, DelayedTransitionDefinition, ActivityDefinition, StateNodeConfig, StateSchema, StateNodesConfig, InvokeDefinition, ActionObject, Mapper, PropertyMapper, SCXML, Typestate, TransitionDefinitionMap, MachineSchema } from './types';
2
+ import { State } from './State';
3
+ declare class StateNode<TContext = any, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
4
+ value: any;
5
+ context: TContext;
6
+ }> {
7
+ /**
8
+ * The raw config used to create the machine.
9
+ */
10
+ config: StateNodeConfig<TContext, TStateSchema, TEvent>;
11
+ /**
12
+ * The initial extended state
13
+ */
14
+ private _context;
15
+ /**
16
+ * The relative key of the state node, which represents its location in the overall state value.
17
+ */
18
+ key: string;
19
+ /**
20
+ * The unique ID of the state node.
21
+ */
22
+ id: string;
23
+ /**
24
+ * The machine's own version.
25
+ */
26
+ version?: string;
27
+ /**
28
+ * The type of this state node:
29
+ *
30
+ * - `'atomic'` - no child state nodes
31
+ * - `'compound'` - nested child state nodes (XOR)
32
+ * - `'parallel'` - orthogonal nested child state nodes (AND)
33
+ * - `'history'` - history state node
34
+ * - `'final'` - final state node
35
+ */
36
+ type: 'atomic' | 'compound' | 'parallel' | 'final' | 'history';
37
+ /**
38
+ * The string path from the root machine node to this node.
39
+ */
40
+ path: string[];
41
+ /**
42
+ * The initial state node key.
43
+ */
44
+ initial?: keyof TStateSchema['states'];
45
+ /**
46
+ * (DEPRECATED) Whether the state node is a parallel state node.
47
+ *
48
+ * Use `type: 'parallel'` instead.
49
+ */
50
+ parallel?: boolean;
51
+ /**
52
+ * Whether the state node is "transient". A state node is considered transient if it has
53
+ * an immediate transition from a "null event" (empty string), taken upon entering the state node.
54
+ */
55
+ private _transient;
56
+ /**
57
+ * The child state nodes.
58
+ */
59
+ states: StateNodesConfig<TContext, TStateSchema, TEvent>;
60
+ /**
61
+ * The type of history on this state node. Can be:
62
+ *
63
+ * - `'shallow'` - recalls only top-level historical state value
64
+ * - `'deep'` - recalls historical state value at all levels
65
+ */
66
+ history: false | 'shallow' | 'deep';
67
+ /**
68
+ * The action(s) to be executed upon entering the state node.
69
+ */
70
+ onEntry: Array<ActionObject<TContext, TEvent>>;
71
+ /**
72
+ * The action(s) to be executed upon exiting the state node.
73
+ */
74
+ onExit: Array<ActionObject<TContext, TEvent>>;
75
+ /**
76
+ * The activities to be started upon entering the state node,
77
+ * and stopped upon exiting the state node.
78
+ */
79
+ activities: Array<ActivityDefinition<TContext, TEvent>>;
80
+ strict: boolean;
81
+ /**
82
+ * The parent state node.
83
+ */
84
+ parent?: StateNode<TContext, any, TEvent, any>;
85
+ /**
86
+ * The root machine node.
87
+ */
88
+ machine: StateNode<TContext, any, TEvent, TTypestate>;
89
+ /**
90
+ * The meta data associated with this state node, which will be returned in State instances.
91
+ */
92
+ meta?: TStateSchema extends {
93
+ meta: infer D;
94
+ } ? D : any;
95
+ /**
96
+ * The data sent with the "done.state._id_" event if this is a final state node.
97
+ */
98
+ doneData?: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>;
99
+ /**
100
+ * The string delimiter for serializing the path to a string. The default is "."
101
+ */
102
+ delimiter: string;
103
+ /**
104
+ * The order this state node appears. Corresponds to the implicit SCXML document order.
105
+ */
106
+ order: number;
107
+ /**
108
+ * The services invoked by this state node.
109
+ */
110
+ invoke: Array<InvokeDefinition<TContext, TEvent>>;
111
+ options: MachineOptions<TContext, TEvent>;
112
+ schema: MachineSchema<TContext, TEvent>;
113
+ __xstatenode: true;
114
+ private __cache;
115
+ private idMap;
116
+ tags: string[];
117
+ constructor(
118
+ /**
119
+ * The raw config used to create the machine.
120
+ */
121
+ config: StateNodeConfig<TContext, TStateSchema, TEvent>, options?: Partial<MachineOptions<TContext, TEvent>>,
122
+ /**
123
+ * The initial extended state
124
+ */
125
+ _context?: Readonly<TContext> | (() => Readonly<TContext>));
126
+ private _init;
127
+ /**
128
+ * Clones this state machine with custom options and context.
129
+ *
130
+ * @param options Options (actions, guards, activities, services) to recursively merge with the existing options.
131
+ * @param context Custom context (will override predefined context)
132
+ */
133
+ withConfig(options: Partial<MachineOptions<TContext, TEvent>>, context?: TContext): StateNode<TContext, TStateSchema, TEvent, TTypestate>;
134
+ /**
135
+ * Clones this state machine with custom context.
136
+ *
137
+ * @param context Custom context (will override predefined context, not recursive)
138
+ */
139
+ withContext(context: TContext): StateNode<TContext, TStateSchema, TEvent, TTypestate>;
140
+ get context(): TContext;
141
+ /**
142
+ * The well-structured state node definition.
143
+ */
144
+ get definition(): StateNodeDefinition<TContext, TStateSchema, TEvent>;
145
+ toJSON(): StateNodeDefinition<TContext, TStateSchema, TEvent>;
146
+ /**
147
+ * The mapping of events to transitions.
148
+ */
149
+ get on(): TransitionDefinitionMap<TContext, TEvent>;
150
+ get after(): Array<DelayedTransitionDefinition<TContext, TEvent>>;
151
+ /**
152
+ * All the transitions that can be taken from this state node.
153
+ */
154
+ get transitions(): Array<TransitionDefinition<TContext, TEvent>>;
155
+ private getCandidates;
156
+ /**
157
+ * All delayed transitions from the config.
158
+ */
159
+ private getDelayedTransitions;
160
+ /**
161
+ * Returns the state nodes represented by the current state value.
162
+ *
163
+ * @param state The state value or State instance
164
+ */
165
+ getStateNodes(state: StateValue | State<TContext, TEvent, any, TTypestate>): Array<StateNode<TContext, any, TEvent, TTypestate>>;
166
+ /**
167
+ * Returns `true` if this state node explicitly handles the given event.
168
+ *
169
+ * @param event The event in question
170
+ */
171
+ handles(event: Event<TEvent>): boolean;
172
+ /**
173
+ * Resolves the given `state` to a new `State` instance relative to this machine.
174
+ *
175
+ * This ensures that `.events` and `.nextEvents` represent the correct values.
176
+ *
177
+ * @param state The state to resolve
178
+ */
179
+ resolveState(state: State<TContext, TEvent, any, any>): State<TContext, TEvent, TStateSchema, TTypestate>;
180
+ private transitionLeafNode;
181
+ private transitionCompoundNode;
182
+ private transitionParallelNode;
183
+ private _transition;
184
+ private next;
185
+ private nodesFromChild;
186
+ /**
187
+ * Whether the given state node "escapes" this state node. If the `stateNode` is equal to or the parent of
188
+ * this state node, it does not escape.
189
+ */
190
+ private escapes;
191
+ private getActions;
192
+ /**
193
+ * Determines the next state given the current `state` and sent `event`.
194
+ *
195
+ * @param state The current State instance or state value
196
+ * @param event The event that was sent at the current state
197
+ * @param context The current context (extended state) of the current state
198
+ */
199
+ transition(state: StateValue | State<TContext, TEvent, any, TTypestate> | undefined, event: Event<TEvent> | SCXML.Event<TEvent>, context?: TContext): State<TContext, TEvent, TStateSchema, TTypestate>;
200
+ private resolveRaisedTransition;
201
+ private resolveTransition;
202
+ /**
203
+ * Returns the child state node from its relative `stateKey`, or throws.
204
+ */
205
+ getStateNode(stateKey: string): StateNode<TContext, any, TEvent, TTypestate>;
206
+ /**
207
+ * Returns the state node with the given `stateId`, or throws.
208
+ *
209
+ * @param stateId The state ID. The prefix "#" is removed.
210
+ */
211
+ getStateNodeById(stateId: string): StateNode<TContext, any, TEvent, any>;
212
+ /**
213
+ * Returns the relative state node from the given `statePath`, or throws.
214
+ *
215
+ * @param statePath The string or string array relative path to the state node.
216
+ */
217
+ getStateNodeByPath(statePath: string | string[]): StateNode<TContext, any, TEvent, any>;
218
+ /**
219
+ * Resolves a partial state value with its full representation in this machine.
220
+ *
221
+ * @param stateValue The partial state value to resolve.
222
+ */
223
+ resolve(stateValue: StateValue): StateValue;
224
+ private getResolvedPath;
225
+ private get initialStateValue();
226
+ getInitialState(stateValue: StateValue, context?: TContext): State<TContext, TEvent, TStateSchema, TTypestate>;
227
+ /**
228
+ * The initial State instance, which includes all actions to be executed from
229
+ * entering the initial state.
230
+ */
231
+ get initialState(): State<TContext, TEvent, TStateSchema, TTypestate>;
232
+ /**
233
+ * The target state value of the history state node, if it exists. This represents the
234
+ * default state value to transition to if no history value exists yet.
235
+ */
236
+ get target(): StateValue | undefined;
237
+ /**
238
+ * Returns the leaf nodes from a state path relative to this state node.
239
+ *
240
+ * @param relativeStateId The relative state path to retrieve the state nodes
241
+ * @param history The previous state to retrieve history
242
+ * @param resolve Whether state nodes should resolve to initial child state nodes
243
+ */
244
+ getRelativeStateNodes(relativeStateId: StateNode<TContext, any, TEvent>, historyValue?: HistoryValue, resolve?: boolean): Array<StateNode<TContext, any, TEvent>>;
245
+ get initialStateNodes(): Array<StateNode<TContext, any, TEvent, any>>;
246
+ /**
247
+ * Retrieves state nodes from a relative path to this state node.
248
+ *
249
+ * @param relativePath The relative path from this state node
250
+ * @param historyValue
251
+ */
252
+ getFromRelativePath(relativePath: string[]): Array<StateNode<TContext, any, TEvent, any>>;
253
+ private historyValue;
254
+ /**
255
+ * Resolves to the historical value(s) of the parent state node,
256
+ * represented by state nodes.
257
+ *
258
+ * @param historyValue
259
+ */
260
+ private resolveHistory;
261
+ /**
262
+ * All the state node IDs of this state node and its descendant state nodes.
263
+ */
264
+ get stateIds(): string[];
265
+ /**
266
+ * All the event types accepted by this state node and its descendants.
267
+ */
268
+ get events(): Array<TEvent['type']>;
269
+ /**
270
+ * All the events that have transitions directly from this state node.
271
+ *
272
+ * Excludes any inert events.
273
+ */
274
+ get ownEvents(): Array<TEvent['type']>;
275
+ private resolveTarget;
276
+ private formatTransition;
277
+ private formatTransitions;
278
+ }
279
+ export { StateNode };
279
280
  //# sourceMappingURL=StateNode.d.ts.map