xstate 4.28.0 → 4.30.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.
- package/CHANGELOG.md +216 -91
- package/README.md +5 -5
- package/dist/xstate.interpreter.js +1 -1
- package/dist/xstate.js +1 -1
- package/dist/xstate.web.js +2 -2
- package/es/Actor.d.ts +1 -2
- package/es/Machine.d.ts +5 -4
- package/es/State.d.ts +17 -14
- package/es/State.js +4 -4
- package/es/StateNode.d.ts +22 -17
- package/es/StateNode.js +21 -25
- package/es/actions.d.ts +3 -4
- package/es/actions.js +8 -3
- package/es/behaviors.d.ts +1 -1
- package/es/devTools.d.ts +3 -4
- package/es/each.d.ts +1 -1
- package/es/index.d.ts +10 -22
- package/es/index.js +11 -23
- package/es/interpreter.d.ts +34 -27
- package/es/interpreter.js +7 -4
- package/es/model.d.ts +2 -2
- package/es/model.types.d.ts +8 -9
- package/es/schema.d.ts +1 -0
- package/es/schema.js +2 -1
- package/es/scxml.d.ts +2 -2
- package/es/stateUtils.d.ts +6 -5
- package/es/typegenTypes.d.ts +121 -0
- package/es/types.d.ts +122 -61
- package/es/utils.d.ts +4 -4
- package/es/utils.js +1 -1
- package/lib/Actor.d.ts +1 -2
- package/lib/Machine.d.ts +5 -4
- package/lib/State.d.ts +17 -14
- package/lib/State.js +4 -4
- package/lib/StateNode.d.ts +22 -17
- package/lib/StateNode.js +21 -25
- package/lib/actions.d.ts +3 -4
- package/lib/actions.js +5 -0
- package/lib/behaviors.d.ts +1 -1
- package/lib/devTools.d.ts +3 -4
- package/lib/each.d.ts +1 -1
- package/lib/index.d.ts +10 -22
- package/lib/index.js +15 -27
- package/lib/interpreter.d.ts +34 -27
- package/lib/interpreter.js +5 -2
- package/lib/model.d.ts +2 -2
- package/lib/model.types.d.ts +8 -9
- package/lib/schema.d.ts +1 -0
- package/lib/schema.js +2 -0
- package/lib/scxml.d.ts +2 -2
- package/lib/stateUtils.d.ts +6 -5
- package/lib/typegenTypes.d.ts +121 -0
- package/lib/typegenTypes.js +2 -0
- package/lib/types.d.ts +122 -61
- package/lib/utils.d.ts +4 -4
- package/lib/utils.js +1 -1
- package/package.json +5 -5
package/es/StateNode.js
CHANGED
|
@@ -50,8 +50,8 @@ function () {
|
|
|
50
50
|
/**
|
|
51
51
|
* The initial extended state
|
|
52
52
|
*/
|
|
53
|
-
_context // TODO: this is unsafe, but we're removing it in v5 anyway
|
|
54
|
-
) {
|
|
53
|
+
_context, // TODO: this is unsafe, but we're removing it in v5 anyway
|
|
54
|
+
_stateInfo) {
|
|
55
55
|
var _this = this;
|
|
56
56
|
|
|
57
57
|
if (_context === void 0) {
|
|
@@ -81,8 +81,8 @@ function () {
|
|
|
81
81
|
this.idMap = {};
|
|
82
82
|
this.tags = [];
|
|
83
83
|
this.options = Object.assign(createDefaultOptions(), options);
|
|
84
|
-
this.parent =
|
|
85
|
-
this.key = this.config.key ||
|
|
84
|
+
this.parent = _stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.parent;
|
|
85
|
+
this.key = this.config.key || (_stateInfo === null || _stateInfo === void 0 ? void 0 : _stateInfo.key) || this.config.id || '(machine)';
|
|
86
86
|
this.machine = this.parent ? this.parent.machine : this;
|
|
87
87
|
this.path = this.parent ? this.parent.path.concat(this.key) : [];
|
|
88
88
|
this.delimiter = this.config.delimiter || (this.parent ? this.parent.delimiter : STATE_DELIMITER);
|
|
@@ -100,9 +100,9 @@ function () {
|
|
|
100
100
|
this.states = this.config.states ? mapValues(this.config.states, function (stateConfig, key) {
|
|
101
101
|
var _a;
|
|
102
102
|
|
|
103
|
-
var stateNode = new StateNode(stateConfig, {
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
var stateNode = new StateNode(stateConfig, {}, undefined, {
|
|
104
|
+
parent: _this,
|
|
105
|
+
key: key
|
|
106
106
|
});
|
|
107
107
|
Object.assign(_this.idMap, __assign((_a = {}, _a[stateNode.id] = stateNode, _a), stateNode.idMap));
|
|
108
108
|
return stateNode;
|
|
@@ -437,9 +437,10 @@ function () {
|
|
|
437
437
|
|
|
438
438
|
|
|
439
439
|
StateNode.prototype.resolveState = function (state) {
|
|
440
|
-
var
|
|
441
|
-
|
|
442
|
-
|
|
440
|
+
var stateFromConfig = state instanceof State ? state : State.create(state);
|
|
441
|
+
var configuration = Array.from(getConfiguration([], this.getStateNodes(stateFromConfig.value)));
|
|
442
|
+
return new State(__assign(__assign({}, stateFromConfig), {
|
|
443
|
+
value: this.resolve(stateFromConfig.value),
|
|
443
444
|
configuration: configuration,
|
|
444
445
|
done: isInFinalState(configuration, this),
|
|
445
446
|
tags: getTagsFromConfiguration(configuration)
|
|
@@ -823,7 +824,7 @@ function () {
|
|
|
823
824
|
var prevConfig = getConfiguration([], this.getStateNodes(currentState.value));
|
|
824
825
|
var resolvedConfig = stateTransition.configuration.length ? getConfiguration(prevConfig, stateTransition.configuration) : prevConfig;
|
|
825
826
|
stateTransition.configuration = __spreadArray([], __read(resolvedConfig), false);
|
|
826
|
-
return this.resolveTransition(stateTransition, currentState, _event);
|
|
827
|
+
return this.resolveTransition(stateTransition, currentState, currentState.context, _event);
|
|
827
828
|
};
|
|
828
829
|
|
|
829
830
|
StateNode.prototype.resolveRaisedTransition = function (state, _event, originalEvent) {
|
|
@@ -841,7 +842,7 @@ function () {
|
|
|
841
842
|
return state;
|
|
842
843
|
};
|
|
843
844
|
|
|
844
|
-
StateNode.prototype.resolveTransition = function (stateTransition, currentState,
|
|
845
|
+
StateNode.prototype.resolveTransition = function (stateTransition, currentState, context, _event) {
|
|
845
846
|
var e_6, _a;
|
|
846
847
|
|
|
847
848
|
var _this = this;
|
|
@@ -850,10 +851,6 @@ function () {
|
|
|
850
851
|
_event = initEvent;
|
|
851
852
|
}
|
|
852
853
|
|
|
853
|
-
if (context === void 0) {
|
|
854
|
-
context = this.machine.context;
|
|
855
|
-
}
|
|
856
|
-
|
|
857
854
|
var configuration = stateTransition.configuration; // Transition will "apply" if:
|
|
858
855
|
// - this is the initial state (there is no current state)
|
|
859
856
|
// - OR there are transitions
|
|
@@ -861,8 +858,7 @@ function () {
|
|
|
861
858
|
var willTransition = !currentState || stateTransition.transitions.length > 0;
|
|
862
859
|
var resolvedStateValue = willTransition ? getValue(this.machine, configuration) : undefined;
|
|
863
860
|
var historyValue = currentState ? currentState.historyValue ? currentState.historyValue : stateTransition.source ? this.machine.historyValue(currentState.value) : undefined : undefined;
|
|
864
|
-
var
|
|
865
|
-
var actions = this.getActions(stateTransition, currentContext, _event, currentState);
|
|
861
|
+
var actions = this.getActions(stateTransition, context, _event, currentState);
|
|
866
862
|
var activities = currentState ? __assign({}, currentState.activities) : {};
|
|
867
863
|
|
|
868
864
|
try {
|
|
@@ -887,7 +883,7 @@ function () {
|
|
|
887
883
|
}
|
|
888
884
|
}
|
|
889
885
|
|
|
890
|
-
var _b = __read(resolveActions(this, currentState,
|
|
886
|
+
var _b = __read(resolveActions(this, currentState, context, _event, actions, this.machine.config.preserveActionOrder), 2),
|
|
891
887
|
resolvedActions = _b[0],
|
|
892
888
|
updatedContext = _b[1];
|
|
893
889
|
|
|
@@ -906,7 +902,7 @@ function () {
|
|
|
906
902
|
acc[action.activity.id] = createInvocableActor(action.activity, _this.machine, updatedContext, _event);
|
|
907
903
|
return acc;
|
|
908
904
|
}, currentState ? __assign({}, currentState.children) : {});
|
|
909
|
-
var resolvedConfiguration =
|
|
905
|
+
var resolvedConfiguration = willTransition ? stateTransition.configuration : currentState ? currentState.configuration : [];
|
|
910
906
|
var isDone = isInFinalState(resolvedConfiguration, this);
|
|
911
907
|
var nextState = new State({
|
|
912
908
|
value: resolvedStateValue || currentState.value,
|
|
@@ -926,7 +922,7 @@ function () {
|
|
|
926
922
|
tags: currentState === null || currentState === void 0 ? void 0 : currentState.tags,
|
|
927
923
|
machine: this
|
|
928
924
|
});
|
|
929
|
-
var didUpdateContext =
|
|
925
|
+
var didUpdateContext = context !== updatedContext;
|
|
930
926
|
nextState.changed = _event.name === update || didUpdateContext; // Dispose of penultimate histories to prevent memory leaks
|
|
931
927
|
|
|
932
928
|
var history = nextState.history;
|
|
@@ -1146,6 +1142,9 @@ function () {
|
|
|
1146
1142
|
});
|
|
1147
1143
|
|
|
1148
1144
|
StateNode.prototype.getInitialState = function (stateValue, context) {
|
|
1145
|
+
this._init(); // TODO: this should be in the constructor (see note in constructor)
|
|
1146
|
+
|
|
1147
|
+
|
|
1149
1148
|
var configuration = this.getStateNodes(stateValue);
|
|
1150
1149
|
return this.resolveTransition({
|
|
1151
1150
|
configuration: configuration,
|
|
@@ -1154,7 +1153,7 @@ function () {
|
|
|
1154
1153
|
transitions: [],
|
|
1155
1154
|
source: undefined,
|
|
1156
1155
|
actions: []
|
|
1157
|
-
}, undefined,
|
|
1156
|
+
}, undefined, context !== null && context !== void 0 ? context : this.machine.context, undefined);
|
|
1158
1157
|
};
|
|
1159
1158
|
|
|
1160
1159
|
Object.defineProperty(StateNode.prototype, "initialState", {
|
|
@@ -1163,9 +1162,6 @@ function () {
|
|
|
1163
1162
|
* entering the initial state.
|
|
1164
1163
|
*/
|
|
1165
1164
|
get: function () {
|
|
1166
|
-
this._init(); // TODO: this should be in the constructor (see note in constructor)
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
1165
|
var initialStateValue = this.initialStateValue;
|
|
1170
1166
|
|
|
1171
1167
|
if (!initialStateValue) {
|
package/es/actions.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { Action, Event, EventObject, SingleOrArray, SendAction, SendActionOptions, CancelAction, ActionObject, ActionType, Assigner, PropertyAssigner, AssignAction, ActionFunction, ActionFunctionMap, ActivityActionObject, ActionTypes, ActivityDefinition, RaiseAction, RaiseActionObject, DoneEvent, ErrorPlatformEvent, DoneEventObject, SendExpr, SendActionObject, PureAction, LogExpr, LogAction, LogActionObject, DelayFunctionMap, SCXML, ExprWithMeta, ChooseCondition, ChooseAction, AnyEventObject, Expr, Cast } from './types';
|
|
1
|
+
import { Action, Event, EventObject, SingleOrArray, SendAction, SendActionOptions, CancelAction, ActionObject, ActionType, Assigner, PropertyAssigner, AssignAction, ActionFunction, ActionFunctionMap, ActivityActionObject, ActionTypes, ActivityDefinition, RaiseAction, RaiseActionObject, DoneEvent, ErrorPlatformEvent, DoneEventObject, SendExpr, SendActionObject, PureAction, LogExpr, LogAction, LogActionObject, DelayFunctionMap, SCXML, ExprWithMeta, ChooseCondition, ChooseAction, AnyEventObject, Expr, StopAction, StopActionObject, Cast, ActorRef, EventFrom } from './types';
|
|
2
2
|
import * as actionTypes from './actionTypes';
|
|
3
3
|
import { State } from './State';
|
|
4
4
|
import { StateNode } from './StateNode';
|
|
5
|
-
import { ActorRef, EventFrom, StopAction, StopActionObject } from '.';
|
|
6
5
|
export { actionTypes };
|
|
7
6
|
export declare const initEvent: SCXML.Event<{
|
|
8
7
|
type: ActionTypes;
|
|
9
8
|
}>;
|
|
10
9
|
export declare function getActionFunction<TContext, TEvent extends EventObject>(actionType: ActionType, actionFunctionMap?: ActionFunctionMap<TContext, TEvent>): ActionObject<TContext, TEvent> | ActionFunction<TContext, TEvent> | undefined;
|
|
11
10
|
export declare function toActionObject<TContext, TEvent extends EventObject>(action: Action<TContext, TEvent>, actionFunctionMap?: ActionFunctionMap<TContext, TEvent>): ActionObject<TContext, TEvent>;
|
|
12
|
-
export declare const toActionObjects: <TContext, TEvent extends EventObject>(action?: SingleOrArray<Action<TContext, TEvent>> | undefined, actionFunctionMap?: ActionFunctionMap<TContext, TEvent,
|
|
11
|
+
export declare const toActionObjects: <TContext, TEvent extends EventObject>(action?: SingleOrArray<Action<TContext, TEvent>> | undefined, actionFunctionMap?: ActionFunctionMap<TContext, TEvent, import("./types").BaseActionObject> | undefined) => ActionObject<TContext, TEvent>[];
|
|
13
12
|
export declare function toActivityDefinition<TContext, TEvent extends EventObject>(action: string | ActivityDefinition<TContext, TEvent>): ActivityDefinition<TContext, TEvent>;
|
|
14
13
|
/**
|
|
15
14
|
* Raises an event. This places the event in the internal event queue, so that
|
|
@@ -151,5 +150,5 @@ export declare function forwardTo<TContext, TEvent extends EventObject>(target:
|
|
|
151
150
|
*/
|
|
152
151
|
export declare function escalate<TContext, TEvent extends EventObject, TErrorData = any>(errorData: TErrorData | ExprWithMeta<TContext, TEvent, TErrorData>, options?: SendActionOptions<TContext, TEvent>): SendAction<TContext, TEvent, AnyEventObject>;
|
|
153
152
|
export declare function choose<TContext, TEvent extends EventObject>(conds: Array<ChooseCondition<TContext, TEvent>>): ChooseAction<TContext, TEvent>;
|
|
154
|
-
export declare function resolveActions<TContext, TEvent extends EventObject>(machine: StateNode<TContext, any, TEvent, any>, currentState: State<TContext, TEvent> | undefined, currentContext: TContext, _event: SCXML.Event<TEvent>, actions: Array<ActionObject<TContext, TEvent>>, preserveActionOrder?: boolean): [Array<ActionObject<TContext, TEvent>>, TContext];
|
|
153
|
+
export declare function resolveActions<TContext, TEvent extends EventObject>(machine: StateNode<TContext, any, TEvent, any, any, any>, currentState: State<TContext, TEvent> | undefined, currentContext: TContext, _event: SCXML.Event<TEvent>, actions: Array<ActionObject<TContext, TEvent>>, preserveActionOrder?: boolean): [Array<ActionObject<TContext, TEvent>>, TContext];
|
|
155
154
|
//# sourceMappingURL=actions.d.ts.map
|
package/es/actions.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { __assign, __read, __spreadArray } from './_virtual/_tslib.js';
|
|
2
2
|
import { IS_PRODUCTION } from './environment.js';
|
|
3
|
-
import {
|
|
3
|
+
import { toSCXMLEvent, isString, isFunction, toEventObject, getEventType, partition, updateContext, flatten, toArray, toGuard, evaluateGuard, warn, isArray } from './utils.js';
|
|
4
4
|
import { SpecialTargets, ActionTypes } from './types.js';
|
|
5
|
-
import { send as send$1,
|
|
5
|
+
import { send as send$1, raise as raise$1, update, log as log$1, cancel as cancel$1, assign as assign$1, error as error$1, stop as stop$1, pure as pure$1, choose as choose$1, init } from './actionTypes.js';
|
|
6
|
+
import * as actionTypes from './actionTypes.js';
|
|
7
|
+
export { actionTypes };
|
|
6
8
|
|
|
7
9
|
var initEvent = /*#__PURE__*/toSCXMLEvent({
|
|
8
10
|
type: init
|
|
@@ -288,6 +290,9 @@ var assign = function (assignment) {
|
|
|
288
290
|
assignment: assignment
|
|
289
291
|
};
|
|
290
292
|
};
|
|
293
|
+
function isActionObject(action) {
|
|
294
|
+
return typeof action === 'object' && 'type' in action;
|
|
295
|
+
}
|
|
291
296
|
/**
|
|
292
297
|
* Returns an event type that represents an implicit event that
|
|
293
298
|
* is sent after the specified `delay`.
|
|
@@ -512,4 +517,4 @@ function resolveActions(machine, currentState, currentContext, _event, actions,
|
|
|
512
517
|
return [resolvedActions, updatedContext];
|
|
513
518
|
}
|
|
514
519
|
|
|
515
|
-
export { after, assign, cancel, choose, done, doneInvoke, error, escalate, forwardTo, getActionFunction, initEvent, log, pure, raise, resolveActions, resolveLog, resolveRaise, resolveSend, resolveStop, respond, send, sendParent, sendTo, sendUpdate, start, stop, toActionObject, toActionObjects, toActivityDefinition };
|
|
520
|
+
export { after, assign, cancel, choose, done, doneInvoke, error, escalate, forwardTo, getActionFunction, initEvent, isActionObject, log, pure, raise, resolveActions, resolveLog, resolveRaise, resolveSend, resolveStop, respond, send, sendParent, sendTo, sendUpdate, start, stop, toActionObject, toActionObjects, toActivityDefinition };
|
package/es/behaviors.d.ts
CHANGED
package/es/devTools.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Interpreter } from '.';
|
|
2
1
|
import { AnyInterpreter } from './types';
|
|
3
2
|
declare type ServiceListener = (service: AnyInterpreter) => void;
|
|
4
3
|
export interface XStateDevInterface {
|
|
5
|
-
register: (service:
|
|
6
|
-
unregister: (service:
|
|
4
|
+
register: (service: AnyInterpreter) => void;
|
|
5
|
+
unregister: (service: AnyInterpreter) => void;
|
|
7
6
|
onRegister: (listener: ServiceListener) => {
|
|
8
7
|
unsubscribe: () => void;
|
|
9
8
|
};
|
|
10
|
-
services: Set<
|
|
9
|
+
services: Set<AnyInterpreter>;
|
|
11
10
|
}
|
|
12
11
|
export declare function getGlobal(): typeof globalThis | undefined;
|
|
13
12
|
export declare function registerService(service: AnyInterpreter): void;
|
package/es/each.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventObject, SingleOrArray, ActionObject } from '
|
|
1
|
+
import { EventObject, SingleOrArray, ActionObject } from './types';
|
|
2
2
|
export declare function each<TContext, TEvent extends EventObject>(collection: keyof TContext, item: keyof TContext, actions: SingleOrArray<ActionObject<TContext, TEvent>>): ActionObject<TContext, TEvent>;
|
|
3
3
|
export declare function each<TContext, TEvent extends EventObject>(collection: keyof TContext, item: keyof TContext, index: keyof TContext, actions: SingleOrArray<ActionObject<TContext, TEvent>>): ActionObject<TContext, TEvent>;
|
|
4
4
|
//# sourceMappingURL=each.d.ts.map
|
package/es/index.d.ts
CHANGED
|
@@ -4,29 +4,17 @@ import { StateNode } from './StateNode';
|
|
|
4
4
|
import { State } from './State';
|
|
5
5
|
import { Machine, createMachine } from './Machine';
|
|
6
6
|
import { Actor } from './Actor';
|
|
7
|
-
import
|
|
7
|
+
import * as actions from './actions';
|
|
8
8
|
import { interpret, Interpreter, spawn, InterpreterStatus } from './interpreter';
|
|
9
9
|
import { matchState } from './match';
|
|
10
|
-
import { createSchema } from './schema';
|
|
11
|
-
declare const actions:
|
|
12
|
-
|
|
13
|
-
send: typeof send;
|
|
14
|
-
sendParent: typeof sendParent;
|
|
15
|
-
sendTo: typeof sendTo;
|
|
16
|
-
sendUpdate: typeof sendUpdate;
|
|
17
|
-
log: typeof log;
|
|
18
|
-
cancel: (sendId: string | number) => import("./types").CancelAction;
|
|
19
|
-
start: typeof start;
|
|
20
|
-
stop: typeof stop;
|
|
21
|
-
assign: <TContext, TEvent extends import("./types").EventObject = import("./types").EventObject>(assignment: import("./types").Assigner<TContext, TEvent> | import("./types").PropertyAssigner<TContext, TEvent>) => import("./types").AssignAction<TContext, TEvent>;
|
|
22
|
-
after: typeof after;
|
|
23
|
-
done: typeof done;
|
|
24
|
-
respond: typeof respond;
|
|
25
|
-
forwardTo: typeof forwardTo;
|
|
26
|
-
escalate: typeof escalate;
|
|
27
|
-
choose: typeof choose;
|
|
28
|
-
pure: typeof pure;
|
|
29
|
-
};
|
|
30
|
-
export { Actor, Machine, StateNode, State, matchesState, mapState, actions, assign, send, sendParent, sendUpdate, forwardTo, interpret, Interpreter, InterpreterStatus, matchState, spawn, doneInvoke, createMachine, createSchema };
|
|
10
|
+
import { createSchema, t } from './schema';
|
|
11
|
+
declare const assign: <TContext, TEvent extends import("./types").EventObject = import("./types").EventObject>(assignment: import("./types").Assigner<TContext, TEvent> | import("./types").PropertyAssigner<TContext, TEvent>) => import("./types").AssignAction<TContext, TEvent>, send: typeof actions.send, sendParent: typeof actions.sendParent, sendUpdate: typeof actions.sendUpdate, forwardTo: typeof actions.forwardTo, doneInvoke: typeof actions.doneInvoke;
|
|
12
|
+
export { Actor, Machine, StateNode, State, matchesState, mapState, actions, assign, send, sendParent, sendUpdate, forwardTo, interpret, Interpreter, InterpreterStatus, matchState, spawn, doneInvoke, createMachine, createSchema, t };
|
|
31
13
|
export * from './types';
|
|
14
|
+
export * from './typegenTypes';
|
|
15
|
+
declare global {
|
|
16
|
+
interface SymbolConstructor {
|
|
17
|
+
readonly observable: symbol;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
32
20
|
//# sourceMappingURL=index.d.ts.map
|
package/es/index.js
CHANGED
|
@@ -1,33 +1,21 @@
|
|
|
1
1
|
export { matchesState } from './utils.js';
|
|
2
2
|
export { mapState } from './mapState.js';
|
|
3
3
|
export { ActionTypes, SpecialTargets } from './types.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { assign as assign$1, send as send$1, sendParent as sendParent$1, sendUpdate as sendUpdate$1, forwardTo as forwardTo$1, doneInvoke as doneInvoke$1 } from './actions.js';
|
|
5
|
+
import * as actions from './actions.js';
|
|
6
|
+
export { actions };
|
|
6
7
|
export { State } from './State.js';
|
|
7
8
|
export { StateNode } from './StateNode.js';
|
|
8
9
|
export { Machine, createMachine } from './Machine.js';
|
|
9
10
|
export { Interpreter, InterpreterStatus, interpret, spawn } from './interpreter.js';
|
|
10
11
|
export { matchState } from './match.js';
|
|
11
|
-
export { createSchema } from './schema.js';
|
|
12
|
+
export { createSchema, t } from './schema.js';
|
|
12
13
|
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
log: log,
|
|
20
|
-
cancel: cancel,
|
|
21
|
-
start: start,
|
|
22
|
-
stop: stop,
|
|
23
|
-
assign: assign,
|
|
24
|
-
after: after,
|
|
25
|
-
done: done,
|
|
26
|
-
respond: respond,
|
|
27
|
-
forwardTo: forwardTo,
|
|
28
|
-
escalate: escalate,
|
|
29
|
-
choose: choose,
|
|
30
|
-
pure: pure
|
|
31
|
-
};
|
|
14
|
+
var assign = assign$1,
|
|
15
|
+
send = send$1,
|
|
16
|
+
sendParent = sendParent$1,
|
|
17
|
+
sendUpdate = sendUpdate$1,
|
|
18
|
+
forwardTo = forwardTo$1,
|
|
19
|
+
doneInvoke = doneInvoke$1;
|
|
32
20
|
|
|
33
|
-
export {
|
|
21
|
+
export { assign, doneInvoke, forwardTo, send, sendParent, sendUpdate };
|
package/es/interpreter.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { StateMachine, Event, EventObject, DefaultContext, StateSchema, StateValue, InterpreterOptions, SingleOrArray, Subscribable, DoneEvent, MachineOptions, SCXML, EventData, Observer, Spawnable, Typestate, ActorRef, ActorRefFrom, Behavior, Subscription } from './types';
|
|
1
|
+
import { StateMachine, Event, EventObject, DefaultContext, StateSchema, StateValue, InterpreterOptions, SingleOrArray, Subscribable, DoneEvent, MachineOptions, SCXML, EventData, Observer, Spawnable, Typestate, ActorRef, ActorRefFrom, Behavior, Subscription, StateConfig } from './types';
|
|
2
2
|
import { State } from './State';
|
|
3
|
+
import { AreAllImplementationsAssumedToBeProvided, TypegenDisabled } from './typegenTypes';
|
|
3
4
|
export declare type StateListener<TContext, TEvent extends EventObject, TStateSchema extends StateSchema<TContext> = any, TTypestate extends Typestate<TContext> = {
|
|
4
5
|
value: any;
|
|
5
6
|
context: TContext;
|
|
6
|
-
}> = (state: State<TContext, TEvent, TStateSchema, TTypestate>, event: TEvent) => void;
|
|
7
|
+
}, TResolvedTypesMeta = TypegenDisabled> = (state: State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>, event: TEvent) => void;
|
|
7
8
|
export declare type ContextListener<TContext = DefaultContext> = (context: TContext, prevContext: TContext | undefined) => void;
|
|
8
9
|
export declare type EventListener<TEvent extends EventObject = EventObject> = (event: TEvent) => void;
|
|
9
10
|
export declare type Listener = () => void;
|
|
@@ -24,15 +25,21 @@ export declare enum InterpreterStatus {
|
|
|
24
25
|
export declare class Interpreter<TContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
|
|
25
26
|
value: any;
|
|
26
27
|
context: TContext;
|
|
27
|
-
}> implements ActorRef<TEvent, State<TContext, TEvent, TStateSchema, TTypestate>> {
|
|
28
|
-
machine: StateMachine<TContext, TStateSchema, TEvent, TTypestate>;
|
|
28
|
+
}, TResolvedTypesMeta = TypegenDisabled> implements ActorRef<TEvent, State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>> {
|
|
29
|
+
machine: StateMachine<TContext, TStateSchema, TEvent, TTypestate, any, any, TResolvedTypesMeta>;
|
|
29
30
|
/**
|
|
30
31
|
* The default interpreter options:
|
|
31
32
|
*
|
|
32
33
|
* - `clock` uses the global `setTimeout` and `clearTimeout` functions
|
|
33
34
|
* - `logger` uses the global `console.log()` method
|
|
34
35
|
*/
|
|
35
|
-
static defaultOptions:
|
|
36
|
+
static defaultOptions: {
|
|
37
|
+
execute: boolean;
|
|
38
|
+
deferEvents: boolean;
|
|
39
|
+
clock: Clock;
|
|
40
|
+
logger: any;
|
|
41
|
+
devTools: boolean;
|
|
42
|
+
};
|
|
36
43
|
/**
|
|
37
44
|
* The current state of the interpreted machine.
|
|
38
45
|
*/
|
|
@@ -72,9 +79,9 @@ export declare class Interpreter<TContext, TStateSchema extends StateSchema = an
|
|
|
72
79
|
* @param machine The machine to be interpreted
|
|
73
80
|
* @param options Interpreter options
|
|
74
81
|
*/
|
|
75
|
-
constructor(machine: StateMachine<TContext, TStateSchema, TEvent, TTypestate>, options?:
|
|
76
|
-
get initialState(): State<TContext, TEvent, TStateSchema, TTypestate>;
|
|
77
|
-
get state(): State<TContext, TEvent, TStateSchema, TTypestate>;
|
|
82
|
+
constructor(machine: StateMachine<TContext, TStateSchema, TEvent, TTypestate, any, any, TResolvedTypesMeta>, options?: InterpreterOptions);
|
|
83
|
+
get initialState(): State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>;
|
|
84
|
+
get state(): State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>;
|
|
78
85
|
static interpret: typeof interpret;
|
|
79
86
|
/**
|
|
80
87
|
* Executes the actions of the given state, with that state's `context` and `event`.
|
|
@@ -82,56 +89,56 @@ export declare class Interpreter<TContext, TStateSchema extends StateSchema = an
|
|
|
82
89
|
* @param state The state whose actions will be executed
|
|
83
90
|
* @param actionsConfig The action implementations to use
|
|
84
91
|
*/
|
|
85
|
-
execute(state: State<TContext, TEvent, TStateSchema, TTypestate>, actionsConfig?: MachineOptions<TContext, TEvent>['actions']): void;
|
|
92
|
+
execute(state: State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>, actionsConfig?: MachineOptions<TContext, TEvent>['actions']): void;
|
|
86
93
|
private update;
|
|
87
|
-
onTransition(listener: StateListener<TContext, TEvent, TStateSchema, TTypestate>): this;
|
|
88
|
-
subscribe(nextListener?: (state: State<TContext, TEvent, any, TTypestate>) => void, errorListener?: (error: any) => void, completeListener?: () => void): Subscription;
|
|
89
|
-
subscribe(observer: Observer<State<TContext, TEvent, any, TTypestate>>): Subscription;
|
|
94
|
+
onTransition(listener: StateListener<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>): this;
|
|
95
|
+
subscribe(nextListener?: (state: State<TContext, TEvent, any, TTypestate, TResolvedTypesMeta>) => void, errorListener?: (error: any) => void, completeListener?: () => void): Subscription;
|
|
96
|
+
subscribe(observer: Observer<State<TContext, TEvent, any, TTypestate, TResolvedTypesMeta>>): Subscription;
|
|
90
97
|
/**
|
|
91
98
|
* Adds an event listener that is notified whenever an event is sent to the running interpreter.
|
|
92
99
|
* @param listener The event listener
|
|
93
100
|
*/
|
|
94
|
-
onEvent(listener: EventListener):
|
|
101
|
+
onEvent(listener: EventListener): this;
|
|
95
102
|
/**
|
|
96
103
|
* Adds an event listener that is notified whenever a `send` event occurs.
|
|
97
104
|
* @param listener The event listener
|
|
98
105
|
*/
|
|
99
|
-
onSend(listener: EventListener):
|
|
106
|
+
onSend(listener: EventListener): this;
|
|
100
107
|
/**
|
|
101
108
|
* Adds a context listener that is notified whenever the state context changes.
|
|
102
109
|
* @param listener The context listener
|
|
103
110
|
*/
|
|
104
|
-
onChange(listener: ContextListener<TContext>):
|
|
111
|
+
onChange(listener: ContextListener<TContext>): this;
|
|
105
112
|
/**
|
|
106
113
|
* Adds a listener that is notified when the machine is stopped.
|
|
107
114
|
* @param listener The listener
|
|
108
115
|
*/
|
|
109
|
-
onStop(listener: Listener):
|
|
116
|
+
onStop(listener: Listener): this;
|
|
110
117
|
/**
|
|
111
118
|
* Adds a state listener that is notified when the statechart has reached its final state.
|
|
112
119
|
* @param listener The state listener
|
|
113
120
|
*/
|
|
114
|
-
onDone(listener: EventListener<DoneEvent>):
|
|
121
|
+
onDone(listener: EventListener<DoneEvent>): this;
|
|
115
122
|
/**
|
|
116
123
|
* Removes a listener.
|
|
117
124
|
* @param listener The listener to remove
|
|
118
125
|
*/
|
|
119
|
-
off(listener: (...args: any[]) => void):
|
|
126
|
+
off(listener: (...args: any[]) => void): this;
|
|
120
127
|
/**
|
|
121
128
|
* Alias for Interpreter.prototype.start
|
|
122
129
|
*/
|
|
123
|
-
init: (initialState?: StateValue | State<TContext, TEvent, TStateSchema, TTypestate> |
|
|
130
|
+
init: (initialState?: StateValue | State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta> | StateConfig<TContext, TEvent> | undefined) => this;
|
|
124
131
|
/**
|
|
125
132
|
* Starts the interpreter from the given state, or the initial state.
|
|
126
133
|
* @param initialState The state to start the statechart from
|
|
127
134
|
*/
|
|
128
|
-
start(initialState?: State<TContext, TEvent, TStateSchema, TTypestate> |
|
|
135
|
+
start(initialState?: State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta> | StateConfig<TContext, TEvent> | StateValue): this;
|
|
129
136
|
/**
|
|
130
137
|
* Stops the interpreter and unsubscribe all listeners.
|
|
131
138
|
*
|
|
132
139
|
* This will also notify the `onStop` listeners.
|
|
133
140
|
*/
|
|
134
|
-
stop():
|
|
141
|
+
stop(): this;
|
|
135
142
|
/**
|
|
136
143
|
* Sends an event to the running interpreter to trigger a transition.
|
|
137
144
|
*
|
|
@@ -141,7 +148,7 @@ export declare class Interpreter<TContext, TStateSchema extends StateSchema = an
|
|
|
141
148
|
*
|
|
142
149
|
* @param event The event(s) to send
|
|
143
150
|
*/
|
|
144
|
-
send: (event: SingleOrArray<Event<TEvent>> | SCXML.Event<TEvent>, payload?: EventData | undefined) => State<TContext, TEvent, TStateSchema, TTypestate>;
|
|
151
|
+
send: (event: SingleOrArray<Event<TEvent>> | SCXML.Event<TEvent>, payload?: EventData | undefined) => State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>;
|
|
145
152
|
private batch;
|
|
146
153
|
/**
|
|
147
154
|
* Returns a send function bound to this interpreter instance.
|
|
@@ -157,7 +164,7 @@ export declare class Interpreter<TContext, TStateSchema extends StateSchema = an
|
|
|
157
164
|
*
|
|
158
165
|
* @param event The event to determine the next state
|
|
159
166
|
*/
|
|
160
|
-
nextState(event: Event<TEvent> | SCXML.Event<TEvent>): State<TContext, TEvent, TStateSchema, TTypestate>;
|
|
167
|
+
nextState(event: Event<TEvent> | SCXML.Event<TEvent>): State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>;
|
|
161
168
|
private forward;
|
|
162
169
|
private defer;
|
|
163
170
|
private cancel;
|
|
@@ -181,11 +188,11 @@ export declare class Interpreter<TContext, TStateSchema extends StateSchema = an
|
|
|
181
188
|
toJSON(): {
|
|
182
189
|
id: string;
|
|
183
190
|
};
|
|
184
|
-
[Symbol.observable](): Subscribable<State<TContext, TEvent, TStateSchema, TTypestate>>;
|
|
185
|
-
getSnapshot(): State<TContext, TEvent, TStateSchema, TTypestate>;
|
|
191
|
+
[Symbol.observable](): Subscribable<State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>>;
|
|
192
|
+
getSnapshot(): State<TContext, TEvent, TStateSchema, TTypestate, TResolvedTypesMeta>;
|
|
186
193
|
}
|
|
187
194
|
export declare function spawn<T extends Behavior<any, any>>(entity: T, nameOrOptions?: string | SpawnOptions): ActorRefFrom<T>;
|
|
188
|
-
export declare function spawn<TC, TE extends EventObject>(entity: StateMachine<TC, any, TE>, nameOrOptions?: string | SpawnOptions): ActorRefFrom<StateMachine<TC, any, TE>>;
|
|
195
|
+
export declare function spawn<TC, TE extends EventObject>(entity: StateMachine<TC, any, TE, any, any, any, any>, nameOrOptions?: string | SpawnOptions): ActorRefFrom<StateMachine<TC, any, TE, any, any, any, any>>;
|
|
189
196
|
export declare function spawn(entity: Spawnable, nameOrOptions?: string | SpawnOptions): ActorRef<any>;
|
|
190
197
|
/**
|
|
191
198
|
* Creates a new Interpreter instance for the given machine with the provided options, if any.
|
|
@@ -196,6 +203,6 @@ export declare function spawn(entity: Spawnable, nameOrOptions?: string | SpawnO
|
|
|
196
203
|
export declare function interpret<TContext = DefaultContext, TStateSchema extends StateSchema = any, TEvent extends EventObject = EventObject, TTypestate extends Typestate<TContext> = {
|
|
197
204
|
value: any;
|
|
198
205
|
context: TContext;
|
|
199
|
-
}>(machine: StateMachine<TContext, TStateSchema, TEvent, TTypestate
|
|
206
|
+
}, TResolvedTypesMeta = TypegenDisabled>(machine: AreAllImplementationsAssumedToBeProvided<TResolvedTypesMeta> extends true ? StateMachine<TContext, TStateSchema, TEvent, TTypestate, any, any, TResolvedTypesMeta> : 'Some implementations missing', options?: InterpreterOptions): Interpreter<TContext, TStateSchema, TEvent, TTypestate, TResolvedTypesMeta>;
|
|
200
207
|
export {};
|
|
201
208
|
//# sourceMappingURL=interpreter.d.ts.map
|
package/es/interpreter.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { __values,
|
|
1
|
+
import { __values, __spreadArray, __read, __assign } from './_virtual/_tslib.js';
|
|
2
2
|
import { IS_PRODUCTION } from './environment.js';
|
|
3
3
|
import { warn, mapContext, isFunction, keys, toSCXMLEvent, toInvokeSource, isMachine, isPromiseLike, isObservable, isBehavior, reportUnhandledExceptionOnInvocation, interopSymbols, symbolObservable, isArray, toEventObject, isString, isActor, toObserver, uniqueId } from './utils.js';
|
|
4
4
|
import { ActionTypes, SpecialTargets } from './types.js';
|
|
5
5
|
import { isInFinalState } from './stateUtils.js';
|
|
6
6
|
import { errorPlatform, log, stop, start, cancel, send, update, error as error$1 } from './actionTypes.js';
|
|
7
7
|
import { doneInvoke, initEvent, getActionFunction, error } from './actions.js';
|
|
8
|
-
import {
|
|
8
|
+
import { isStateConfig, State, bindActionToState } from './State.js';
|
|
9
9
|
import { provide, consume } from './serviceScope.js';
|
|
10
10
|
import { isSpawnedActor, createDeferredActor } from './Actor.js';
|
|
11
11
|
import { Scheduler } from './scheduler.js';
|
|
@@ -459,7 +459,7 @@ function () {
|
|
|
459
459
|
this.initialized = true;
|
|
460
460
|
this.status = InterpreterStatus.Running;
|
|
461
461
|
var resolvedState = initialState === undefined ? this.initialState : provide(this, function () {
|
|
462
|
-
return
|
|
462
|
+
return isStateConfig(initialState) ? _this.machine.resolveState(initialState) : _this.machine.resolveState(State.from(initialState, _this.machine.context));
|
|
463
463
|
});
|
|
464
464
|
|
|
465
465
|
if (this.options.devTools) {
|
|
@@ -558,7 +558,9 @@ function () {
|
|
|
558
558
|
return this;
|
|
559
559
|
}
|
|
560
560
|
|
|
561
|
-
this.state.configuration.
|
|
561
|
+
__spreadArray([], __read(this.state.configuration), false).sort(function (a, b) {
|
|
562
|
+
return b.order - a.order;
|
|
563
|
+
}).forEach(function (stateNode) {
|
|
562
564
|
var e_11, _a;
|
|
563
565
|
|
|
564
566
|
try {
|
|
@@ -580,6 +582,7 @@ function () {
|
|
|
580
582
|
}
|
|
581
583
|
}); // Stop all children
|
|
582
584
|
|
|
585
|
+
|
|
583
586
|
this.children.forEach(function (child) {
|
|
584
587
|
if (isFunction(child.stop)) {
|
|
585
588
|
child.stop();
|
package/es/model.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EventObject, BaseActionObject } from './types';
|
|
2
|
-
import {
|
|
1
|
+
import type { Cast, EventObject, BaseActionObject, Prop, IsNever } from './types';
|
|
2
|
+
import { UnionFromCreatorsReturnTypes, FinalModelCreators, Model, ModelCreators } from './model.types';
|
|
3
3
|
export declare function createModel<TContext, TEvent extends EventObject, TAction extends BaseActionObject = BaseActionObject>(initialContext: TContext): Model<TContext, TEvent, TAction, void>;
|
|
4
4
|
export declare function createModel<TContext, TModelCreators extends ModelCreators<TModelCreators>, TFinalModelCreators = FinalModelCreators<TModelCreators>, TComputedEvent = UnionFromCreatorsReturnTypes<Prop<TFinalModelCreators, 'events'>>, TComputedAction = UnionFromCreatorsReturnTypes<Prop<TFinalModelCreators, 'actions'>>>(initialContext: TContext, creators: TModelCreators): Model<TContext, Cast<TComputedEvent, EventObject>, IsNever<TComputedAction> extends true ? BaseActionObject : Cast<TComputedAction, BaseActionObject>, TFinalModelCreators>;
|
|
5
5
|
//# sourceMappingURL=model.d.ts.map
|
package/es/model.types.d.ts
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare type IsNever<T> = [T] extends [never] ? true : false;
|
|
4
|
-
export declare type Cast<T extends any, TCastType extends any> = T extends TCastType ? T : TCastType;
|
|
5
|
-
export declare type Compute<A extends any> = {
|
|
6
|
-
[K in keyof A]: A[K];
|
|
7
|
-
} & unknown;
|
|
8
|
-
export declare type Prop<T, K> = K extends keyof T ? T[K] : never;
|
|
1
|
+
import { AnyFunction, AssignAction, Assigner, BaseActionObject, Compute, EventObject, ExtractEvent, MachineConfig, Prop, PropertyAssigner, StateMachine, InternalMachineOptions, ServiceMap } from './types';
|
|
2
|
+
import { ResolveTypegenMeta, TypegenConstraint, TypegenDisabled } from './typegenTypes';
|
|
9
3
|
export interface Model<TContext, TEvent extends EventObject, TAction extends BaseActionObject = BaseActionObject, TModelCreators = void> {
|
|
10
4
|
initialContext: TContext;
|
|
11
5
|
assign: <TEventType extends TEvent['type'] = TEvent['type']>(assigner: Assigner<TContext, ExtractEvent<TEvent, TEventType>> | PropertyAssigner<TContext, ExtractEvent<TEvent, TEventType>>, eventType?: TEventType) => AssignAction<TContext, ExtractEvent<TEvent, TEventType>>;
|
|
12
6
|
events: Prop<TModelCreators, 'events'>;
|
|
13
7
|
actions: Prop<TModelCreators, 'actions'>;
|
|
14
8
|
reset: () => AssignAction<TContext, any>;
|
|
15
|
-
createMachine:
|
|
9
|
+
createMachine: {
|
|
10
|
+
<TServiceMap extends ServiceMap = ServiceMap, TTypesMeta extends TypegenConstraint = TypegenDisabled>(config: MachineConfig<TContext, any, TEvent, TAction, TServiceMap, TTypesMeta>, implementations?: InternalMachineOptions<TContext, TEvent, ResolveTypegenMeta<TTypesMeta, TEvent, TAction, TServiceMap>>): StateMachine<TContext, any, TEvent, {
|
|
11
|
+
value: any;
|
|
12
|
+
context: TContext;
|
|
13
|
+
}, TAction, TServiceMap, ResolveTypegenMeta<TTypesMeta, TEvent, TAction, TServiceMap>>;
|
|
14
|
+
};
|
|
16
15
|
}
|
|
17
16
|
export declare type ModelContextFrom<TModel extends Model<any, any, any, any>> = TModel extends Model<infer TContext, any, any, any> ? TContext : never;
|
|
18
17
|
export declare type ModelEventsFrom<TModel extends Model<any, any, any, any> | undefined> = TModel extends Model<any, infer TEvent, any, any> ? TEvent : EventObject;
|
package/es/schema.d.ts
CHANGED
package/es/schema.js
CHANGED
package/es/scxml.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnyStateMachine } from './index';
|
|
2
2
|
export interface ScxmlToMachineOptions {
|
|
3
3
|
delimiter?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare function toMachine(xml: string, options: ScxmlToMachineOptions):
|
|
5
|
+
export declare function toMachine(xml: string, options: ScxmlToMachineOptions): AnyStateMachine;
|
|
6
6
|
//# sourceMappingURL=scxml.d.ts.map
|
package/es/stateUtils.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { EventObject,
|
|
1
|
+
import { EventObject, StateValue } from './types';
|
|
2
|
+
import { StateNode } from './StateNode';
|
|
2
3
|
declare type Configuration<TC, TE extends EventObject> = Iterable<StateNode<TC, any, TE>>;
|
|
3
4
|
declare type AdjList<TC, TE extends EventObject> = Map<StateNode<TC, any, TE>, Array<StateNode<TC, any, TE>>>;
|
|
4
|
-
export declare const isLeafNode: (stateNode: StateNode<any, any, any, any>) => boolean;
|
|
5
|
+
export declare const isLeafNode: (stateNode: StateNode<any, any, any, any, any, any>) => boolean;
|
|
5
6
|
export declare function getChildren<TC, TE extends EventObject>(stateNode: StateNode<TC, any, TE>): Array<StateNode<TC, any, TE>>;
|
|
6
|
-
export declare function getAllStateNodes<TC, TE extends EventObject>(stateNode: StateNode<TC, any, TE, any>): Array<StateNode<TC, any, TE, any>>;
|
|
7
|
-
export declare function getConfiguration<TC, TE extends EventObject>(prevStateNodes: Iterable<StateNode<TC, any, TE, any>>, stateNodes: Iterable<StateNode<TC, any, TE, any>>): Set<StateNode<TC, any, TE, any>>;
|
|
7
|
+
export declare function getAllStateNodes<TC, TE extends EventObject>(stateNode: StateNode<TC, any, TE, any, any, any>): Array<StateNode<TC, any, TE, any, any, any>>;
|
|
8
|
+
export declare function getConfiguration<TC, TE extends EventObject>(prevStateNodes: Iterable<StateNode<TC, any, TE, any, any, any>>, stateNodes: Iterable<StateNode<TC, any, TE, any, any, any>>): Set<StateNode<TC, any, TE, any, any, any>>;
|
|
8
9
|
export declare function getAdjList<TC, TE extends EventObject>(configuration: Configuration<TC, TE>): AdjList<TC, TE>;
|
|
9
10
|
export declare function getValue<TC, TE extends EventObject>(rootNode: StateNode<TC, any, TE, any>, configuration: Configuration<TC, TE>): StateValue;
|
|
10
11
|
export declare function has<T>(iterable: Iterable<T>, item: T): boolean;
|
|
11
12
|
export declare function nextEvents<TC, TE extends EventObject>(configuration: Array<StateNode<TC, any, TE>>): Array<TE['type']>;
|
|
12
|
-
export declare function isInFinalState<TC, TE extends EventObject>(configuration: Array<StateNode<TC, any, TE, any>>, stateNode: StateNode<TC, any, TE, any>): boolean;
|
|
13
|
+
export declare function isInFinalState<TC, TE extends EventObject>(configuration: Array<StateNode<TC, any, TE, any, any, any>>, stateNode: StateNode<TC, any, TE, any, any, any>): boolean;
|
|
13
14
|
export declare function getMeta(configuration?: StateNode[]): Record<string, any>;
|
|
14
15
|
export declare function getTagsFromConfiguration(configuration: StateNode<any, any, any, any>[]): Set<string>;
|
|
15
16
|
export {};
|