xstate 5.0.0-beta.11 → 5.0.0-beta.13
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/actions/dist/xstate-actions.cjs.js +1 -1
- package/actions/dist/xstate-actions.development.cjs.js +1 -1
- package/actions/dist/xstate-actions.development.esm.js +1 -1
- package/actions/dist/xstate-actions.esm.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actors/dist/xstate-actors.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.esm.js +1 -1
- package/actors/dist/xstate-actors.esm.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/{actions-b82e841e.esm.js → actions-b34f6ce7.esm.js} +7 -21
- package/dist/{actions-cff79077.development.esm.js → actions-c8b9504d.development.esm.js} +7 -21
- package/dist/{actions-acbe7aa1.development.cjs.js → actions-d9c19f35.development.cjs.js} +7 -21
- package/dist/{actions-26f9aa9d.cjs.js → actions-e4c704f3.cjs.js} +7 -21
- package/dist/declarations/src/Machine.d.ts +3 -3
- package/dist/declarations/src/SimulatedClock.d.ts +1 -1
- package/dist/declarations/src/State.d.ts +3 -3
- package/dist/declarations/src/StateMachine.d.ts +4 -4
- package/dist/declarations/src/StateNode.d.ts +3 -3
- package/dist/declarations/src/actionTypes.d.ts +1 -1
- package/dist/declarations/src/actions/assign.d.ts +1 -1
- package/dist/declarations/src/actions/cancel.d.ts +2 -2
- package/dist/declarations/src/actions/choose.d.ts +2 -2
- package/dist/declarations/src/actions/log.d.ts +2 -2
- package/dist/declarations/src/actions/pure.d.ts +2 -2
- package/dist/declarations/src/actions/raise.d.ts +1 -1
- package/dist/declarations/src/actions/send.d.ts +2 -2
- package/dist/declarations/src/actions/stop.d.ts +1 -1
- package/dist/declarations/src/actions.d.ts +10 -10
- package/dist/declarations/src/actors/callback.d.ts +1 -1
- package/dist/declarations/src/actors/index.d.ts +5 -5
- package/dist/declarations/src/actors/observable.d.ts +1 -1
- package/dist/declarations/src/actors/promise.d.ts +1 -1
- package/dist/declarations/src/actors/transition.d.ts +1 -1
- package/dist/declarations/src/dev/index.d.ts +1 -1
- package/dist/declarations/src/guards.d.ts +2 -2
- package/dist/declarations/src/index.d.ts +22 -22
- package/dist/declarations/src/interpreter.d.ts +4 -9
- package/dist/declarations/src/stateUtils.d.ts +5 -5
- package/dist/declarations/src/typegenTypes.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +7 -6
- package/dist/declarations/src/utils.d.ts +4 -4
- package/dist/declarations/src/waitFor.d.ts +1 -1
- package/dist/xstate.cjs.js +1 -1
- package/dist/xstate.development.cjs.js +1 -1
- package/dist/xstate.development.esm.js +2 -2
- package/dist/xstate.esm.js +2 -2
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.cjs.js +1 -1
- package/guards/dist/xstate-guards.development.esm.js +1 -1
- package/guards/dist/xstate-guards.esm.js +1 -1
- package/package.json +1 -1
|
@@ -1178,25 +1178,6 @@ class Interpreter {
|
|
|
1178
1178
|
};
|
|
1179
1179
|
}
|
|
1180
1180
|
|
|
1181
|
-
/**
|
|
1182
|
-
* Adds a state listener that is notified when the statechart has reached its final state.
|
|
1183
|
-
* @param listener The state listener
|
|
1184
|
-
*/
|
|
1185
|
-
onDone(listener) {
|
|
1186
|
-
if (this.status === ActorStatus.Stopped && this._doneEvent) {
|
|
1187
|
-
listener(this._doneEvent);
|
|
1188
|
-
} else {
|
|
1189
|
-
this.observers.add({
|
|
1190
|
-
complete: () => {
|
|
1191
|
-
if (this._doneEvent) {
|
|
1192
|
-
listener(this._doneEvent);
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
return this;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
1181
|
/**
|
|
1201
1182
|
* Starts the interpreter from the initial state
|
|
1202
1183
|
*/
|
|
@@ -2951,6 +2932,9 @@ function invoke(invokeDef) {
|
|
|
2951
2932
|
|
|
2952
2933
|
function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
2953
2934
|
return (src, options = {}) => {
|
|
2935
|
+
const {
|
|
2936
|
+
systemId
|
|
2937
|
+
} = options;
|
|
2954
2938
|
if (isString(src)) {
|
|
2955
2939
|
const referenced = resolveReferencedActor(machine.options.actors[src]);
|
|
2956
2940
|
if (referenced) {
|
|
@@ -2974,7 +2958,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
2974
2958
|
// TODO
|
|
2975
2959
|
ref: actorRef,
|
|
2976
2960
|
meta: undefined,
|
|
2977
|
-
input
|
|
2961
|
+
input,
|
|
2962
|
+
systemId
|
|
2978
2963
|
}));
|
|
2979
2964
|
return actorRef; // TODO: fix types
|
|
2980
2965
|
}
|
|
@@ -2986,7 +2971,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
2986
2971
|
const actorRef = interpret(src, {
|
|
2987
2972
|
id: options.id || 'anonymous',
|
|
2988
2973
|
parent: self,
|
|
2989
|
-
input: options.input
|
|
2974
|
+
input: options.input,
|
|
2975
|
+
systemId
|
|
2990
2976
|
});
|
|
2991
2977
|
mutCapturedActions.push(invoke({
|
|
2992
2978
|
// @ts-ignore TODO: fix types
|
|
@@ -1188,25 +1188,6 @@ class Interpreter {
|
|
|
1188
1188
|
};
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
|
-
/**
|
|
1192
|
-
* Adds a state listener that is notified when the statechart has reached its final state.
|
|
1193
|
-
* @param listener The state listener
|
|
1194
|
-
*/
|
|
1195
|
-
onDone(listener) {
|
|
1196
|
-
if (this.status === ActorStatus.Stopped && this._doneEvent) {
|
|
1197
|
-
listener(this._doneEvent);
|
|
1198
|
-
} else {
|
|
1199
|
-
this.observers.add({
|
|
1200
|
-
complete: () => {
|
|
1201
|
-
if (this._doneEvent) {
|
|
1202
|
-
listener(this._doneEvent);
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
return this;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
1191
|
/**
|
|
1211
1192
|
* Starts the interpreter from the initial state
|
|
1212
1193
|
*/
|
|
@@ -2986,6 +2967,9 @@ function invoke(invokeDef) {
|
|
|
2986
2967
|
|
|
2987
2968
|
function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
2988
2969
|
return (src, options = {}) => {
|
|
2970
|
+
const {
|
|
2971
|
+
systemId
|
|
2972
|
+
} = options;
|
|
2989
2973
|
if (isString(src)) {
|
|
2990
2974
|
const referenced = resolveReferencedActor(machine.options.actors[src]);
|
|
2991
2975
|
if (referenced) {
|
|
@@ -3009,7 +2993,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
3009
2993
|
// TODO
|
|
3010
2994
|
ref: actorRef,
|
|
3011
2995
|
meta: undefined,
|
|
3012
|
-
input
|
|
2996
|
+
input,
|
|
2997
|
+
systemId
|
|
3013
2998
|
}));
|
|
3014
2999
|
return actorRef; // TODO: fix types
|
|
3015
3000
|
}
|
|
@@ -3021,7 +3006,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
3021
3006
|
const actorRef = interpret(src, {
|
|
3022
3007
|
id: options.id || 'anonymous',
|
|
3023
3008
|
parent: self,
|
|
3024
|
-
input: options.input
|
|
3009
|
+
input: options.input,
|
|
3010
|
+
systemId
|
|
3025
3011
|
});
|
|
3026
3012
|
mutCapturedActions.push(invoke({
|
|
3027
3013
|
// @ts-ignore TODO: fix types
|
|
@@ -1190,25 +1190,6 @@ class Interpreter {
|
|
|
1190
1190
|
};
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
|
-
/**
|
|
1194
|
-
* Adds a state listener that is notified when the statechart has reached its final state.
|
|
1195
|
-
* @param listener The state listener
|
|
1196
|
-
*/
|
|
1197
|
-
onDone(listener) {
|
|
1198
|
-
if (this.status === ActorStatus.Stopped && this._doneEvent) {
|
|
1199
|
-
listener(this._doneEvent);
|
|
1200
|
-
} else {
|
|
1201
|
-
this.observers.add({
|
|
1202
|
-
complete: () => {
|
|
1203
|
-
if (this._doneEvent) {
|
|
1204
|
-
listener(this._doneEvent);
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
return this;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
1193
|
/**
|
|
1213
1194
|
* Starts the interpreter from the initial state
|
|
1214
1195
|
*/
|
|
@@ -2988,6 +2969,9 @@ function invoke(invokeDef) {
|
|
|
2988
2969
|
|
|
2989
2970
|
function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
2990
2971
|
return (src, options = {}) => {
|
|
2972
|
+
const {
|
|
2973
|
+
systemId
|
|
2974
|
+
} = options;
|
|
2991
2975
|
if (isString(src)) {
|
|
2992
2976
|
const referenced = resolveReferencedActor(machine.options.actors[src]);
|
|
2993
2977
|
if (referenced) {
|
|
@@ -3011,7 +2995,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
3011
2995
|
// TODO
|
|
3012
2996
|
ref: actorRef,
|
|
3013
2997
|
meta: undefined,
|
|
3014
|
-
input
|
|
2998
|
+
input,
|
|
2999
|
+
systemId
|
|
3015
3000
|
}));
|
|
3016
3001
|
return actorRef; // TODO: fix types
|
|
3017
3002
|
}
|
|
@@ -3023,7 +3008,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
3023
3008
|
const actorRef = interpret(src, {
|
|
3024
3009
|
id: options.id || 'anonymous',
|
|
3025
3010
|
parent: self,
|
|
3026
|
-
input: options.input
|
|
3011
|
+
input: options.input,
|
|
3012
|
+
systemId
|
|
3027
3013
|
});
|
|
3028
3014
|
mutCapturedActions.push(invoke({
|
|
3029
3015
|
// @ts-ignore TODO: fix types
|
|
@@ -1180,25 +1180,6 @@ class Interpreter {
|
|
|
1180
1180
|
};
|
|
1181
1181
|
}
|
|
1182
1182
|
|
|
1183
|
-
/**
|
|
1184
|
-
* Adds a state listener that is notified when the statechart has reached its final state.
|
|
1185
|
-
* @param listener The state listener
|
|
1186
|
-
*/
|
|
1187
|
-
onDone(listener) {
|
|
1188
|
-
if (this.status === ActorStatus.Stopped && this._doneEvent) {
|
|
1189
|
-
listener(this._doneEvent);
|
|
1190
|
-
} else {
|
|
1191
|
-
this.observers.add({
|
|
1192
|
-
complete: () => {
|
|
1193
|
-
if (this._doneEvent) {
|
|
1194
|
-
listener(this._doneEvent);
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
return this;
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
1183
|
/**
|
|
1203
1184
|
* Starts the interpreter from the initial state
|
|
1204
1185
|
*/
|
|
@@ -2953,6 +2934,9 @@ function invoke(invokeDef) {
|
|
|
2953
2934
|
|
|
2954
2935
|
function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
2955
2936
|
return (src, options = {}) => {
|
|
2937
|
+
const {
|
|
2938
|
+
systemId
|
|
2939
|
+
} = options;
|
|
2956
2940
|
if (isString(src)) {
|
|
2957
2941
|
const referenced = resolveReferencedActor(machine.options.actors[src]);
|
|
2958
2942
|
if (referenced) {
|
|
@@ -2976,7 +2960,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
2976
2960
|
// TODO
|
|
2977
2961
|
ref: actorRef,
|
|
2978
2962
|
meta: undefined,
|
|
2979
|
-
input
|
|
2963
|
+
input,
|
|
2964
|
+
systemId
|
|
2980
2965
|
}));
|
|
2981
2966
|
return actorRef; // TODO: fix types
|
|
2982
2967
|
}
|
|
@@ -2988,7 +2973,8 @@ function createSpawner(self, machine, context, event, mutCapturedActions) {
|
|
|
2988
2973
|
const actorRef = interpret(src, {
|
|
2989
2974
|
id: options.id || 'anonymous',
|
|
2990
2975
|
parent: self,
|
|
2991
|
-
input: options.input
|
|
2976
|
+
input: options.input,
|
|
2977
|
+
systemId
|
|
2992
2978
|
});
|
|
2993
2979
|
mutCapturedActions.push(invoke({
|
|
2994
2980
|
// @ts-ignore TODO: fix types
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MachineConfig, EventObject, AnyEventObject, MachineContext, ActorMap, InternalMachineImplementations, ParameterizedObject } from
|
|
2
|
-
import { TypegenConstraint, TypegenDisabled, ResolveTypegenMeta } from
|
|
3
|
-
import { StateMachine } from
|
|
1
|
+
import { MachineConfig, EventObject, AnyEventObject, MachineContext, ActorMap, InternalMachineImplementations, ParameterizedObject } from "./types.js";
|
|
2
|
+
import { TypegenConstraint, TypegenDisabled, ResolveTypegenMeta } from "./typegenTypes.js";
|
|
3
|
+
import { StateMachine } from "./StateMachine.js";
|
|
4
4
|
export declare function createMachine<TContext extends MachineContext, TEvent extends EventObject = AnyEventObject, TActorMap extends ActorMap = ActorMap, TTypesMeta extends TypegenConstraint = TypegenDisabled>(config: MachineConfig<TContext, TEvent, ParameterizedObject, TActorMap, TTypesMeta>, implementations?: InternalMachineImplementations<TContext, TEvent, ResolveTypegenMeta<TTypesMeta, TEvent, ParameterizedObject, TActorMap>>): StateMachine<TContext, TEvent, ParameterizedObject, TActorMap, ResolveTypegenMeta<TTypesMeta, TEvent, ParameterizedObject, TActorMap>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { StateNode } from
|
|
2
|
-
import { TypegenDisabled, TypegenEnabled } from
|
|
3
|
-
import type { ActorRef, AnyState, AnyStateMachine, BaseActionObject, EventObject, HistoryValue, MachineContext, PersistedMachineState, Prop, StateConfig, StateValue, TransitionDefinition } from
|
|
1
|
+
import type { StateNode } from "./StateNode.js";
|
|
2
|
+
import { TypegenDisabled, TypegenEnabled } from "./typegenTypes.js";
|
|
3
|
+
import type { ActorRef, AnyState, AnyStateMachine, BaseActionObject, EventObject, HistoryValue, MachineContext, PersistedMachineState, Prop, StateConfig, StateValue, TransitionDefinition } from "./types.js";
|
|
4
4
|
export declare function isStateConfig<TContext extends MachineContext, TEvent extends EventObject>(state: any): state is StateConfig<TContext, TEvent>;
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Use `isStateConfig(object)` or `state instanceof State` instead.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { State } from
|
|
2
|
-
import { StateNode } from
|
|
3
|
-
import type { AreAllImplementationsAssumedToBeProvided, MarkAllImplementationsAsProvided, ResolveTypegenMeta, TypegenDisabled } from
|
|
4
|
-
import type { ActorContext, ActorMap, ActorBehavior, EventObject, InternalMachineImplementations, MachineConfig, MachineContext, MachineImplementationsSimplified, MachineTypes, NoInfer, StateConfig, StateMachineDefinition, StateValue, TransitionDefinition, PersistedMachineState, ParameterizedObject, AnyActorContext } from
|
|
1
|
+
import { State } from "./State.js";
|
|
2
|
+
import { StateNode } from "./StateNode.js";
|
|
3
|
+
import type { AreAllImplementationsAssumedToBeProvided, MarkAllImplementationsAsProvided, ResolveTypegenMeta, TypegenDisabled } from "./typegenTypes.js";
|
|
4
|
+
import type { ActorContext, ActorMap, ActorBehavior, EventObject, InternalMachineImplementations, MachineConfig, MachineContext, MachineImplementationsSimplified, MachineTypes, NoInfer, StateConfig, StateMachineDefinition, StateValue, TransitionDefinition, PersistedMachineState, ParameterizedObject, AnyActorContext } from "./types.js";
|
|
5
5
|
export declare const NULL_EVENT = "";
|
|
6
6
|
export declare const STATE_IDENTIFIER = "#";
|
|
7
7
|
export declare const WILDCARD = "*";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { EventObject, StateNodeDefinition, TransitionDefinition, DelayedTransitionDefinition, StateNodeConfig, StateNodesConfig, InvokeDefinition, Mapper, PropertyMapper, TransitionDefinitionMap, InitialTransitionDefinition, MachineContext, BaseActionObject } from
|
|
2
|
-
import type { State } from
|
|
3
|
-
import type { StateMachine } from
|
|
1
|
+
import type { EventObject, StateNodeDefinition, TransitionDefinition, DelayedTransitionDefinition, StateNodeConfig, StateNodesConfig, InvokeDefinition, Mapper, PropertyMapper, TransitionDefinitionMap, InitialTransitionDefinition, MachineContext, BaseActionObject } from "./types.js";
|
|
2
|
+
import type { State } from "./State.js";
|
|
3
|
+
import type { StateMachine } from "./StateMachine.js";
|
|
4
4
|
interface StateNodeOptions<TContext extends MachineContext, TEvent extends EventObject> {
|
|
5
5
|
_key: string;
|
|
6
6
|
_parent?: StateNode<TContext, TEvent>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EventObject, Assigner, PropertyAssigner, MachineContext, DynamicAssignAction, LowInfer } from
|
|
1
|
+
import type { EventObject, Assigner, PropertyAssigner, MachineContext, DynamicAssignAction, LowInfer } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Updates the current context of the machine.
|
|
4
4
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventObject, ExprWithMeta, MachineContext } from
|
|
2
|
-
import { BaseDynamicActionObject, CancelActionObject, DynamicCancelActionObject } from
|
|
1
|
+
import { EventObject, ExprWithMeta, MachineContext } from "../types.js";
|
|
2
|
+
import { BaseDynamicActionObject, CancelActionObject, DynamicCancelActionObject } from "../index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Cancels an in-flight `send(...)` action. A canceled sent action will not
|
|
5
5
|
* be executed, nor will its event be sent, unless it has already been sent
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EventObject, ChooseCondition, MachineContext } from
|
|
2
|
-
import { BaseDynamicActionObject, ChooseAction, ResolvedChooseAction } from
|
|
1
|
+
import { EventObject, ChooseCondition, MachineContext } from "../types.js";
|
|
2
|
+
import { BaseDynamicActionObject, ChooseAction, ResolvedChooseAction } from "../index.js";
|
|
3
3
|
export declare function choose<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject>(guards: Array<ChooseCondition<TContext, TExpressionEvent>>): BaseDynamicActionObject<TContext, TExpressionEvent, TEvent, ResolvedChooseAction, ChooseAction<TContext, TExpressionEvent>['params']>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventObject, LogExpr, MachineContext, LogActionObject } from
|
|
2
|
-
import { BaseDynamicActionObject, DynamicLogAction } from
|
|
1
|
+
import { EventObject, LogExpr, MachineContext, LogActionObject } from "../types.js";
|
|
2
|
+
import { BaseDynamicActionObject, DynamicLogAction } from "../index.js";
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param expr The expression function to evaluate which will be logged.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventObject, SingleOrArray, MachineContext } from
|
|
2
|
-
import { BaseActionObject, BaseDynamicActionObject, DynamicPureActionObject, PureActionObject } from
|
|
1
|
+
import { EventObject, SingleOrArray, MachineContext } from "../types.js";
|
|
2
|
+
import { BaseActionObject, BaseDynamicActionObject, DynamicPureActionObject, PureActionObject } from "../index.js";
|
|
3
3
|
export declare function pure<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject = TExpressionEvent>(getActions: ({ context, event }: {
|
|
4
4
|
context: TContext;
|
|
5
5
|
event: TExpressionEvent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventObject, MachineContext, RaiseActionObject, BaseDynamicActionObject, RaiseActionOptions, SendExpr, RaiseActionParams, NoInfer } from
|
|
1
|
+
import { EventObject, MachineContext, RaiseActionObject, BaseDynamicActionObject, RaiseActionOptions, SendExpr, RaiseActionParams, NoInfer } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Raises an event. This places the event in the internal event queue, so that
|
|
4
4
|
* the event is immediately consumed by the machine in the current step.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EventObject, SendActionParams, SendExpr, AnyEventObject, MachineContext } from
|
|
2
|
-
import { AnyActorRef, BaseDynamicActionObject, Cast, EventFrom, ExprWithMeta, InferEvent, SendActionObject, SendActionOptions } from
|
|
1
|
+
import { EventObject, SendActionParams, SendExpr, AnyEventObject, MachineContext } from "../types.js";
|
|
2
|
+
import { AnyActorRef, BaseDynamicActionObject, Cast, EventFrom, ExprWithMeta, InferEvent, SendActionObject, SendActionOptions } from "../index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Sends an event. This returns an action that will be read by an interpreter to
|
|
5
5
|
* send the event in the next step, after the current step is finished executing.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActorRef, BaseDynamicActionObject, DynamicStopActionObject, EventObject, Expr, MachineContext, StopActionObject } from
|
|
1
|
+
import { ActorRef, BaseDynamicActionObject, DynamicStopActionObject, EventObject, Expr, MachineContext, StopActionObject } from "../types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Stops an actor.
|
|
4
4
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Action, EventObject, SingleOrArray, ActionFunction, ActionFunctionMap, ActionTypes, DoneEvent, ErrorPlatformEvent, DoneEventObject, MachineContext, BaseActionObject } from
|
|
2
|
-
import * as actionTypes from
|
|
3
|
-
export { send, sendTo, sendParent, forwardTo, escalate } from
|
|
4
|
-
export { stop } from
|
|
5
|
-
export { log } from
|
|
6
|
-
export { cancel } from
|
|
7
|
-
export { assign } from
|
|
8
|
-
export { raise } from
|
|
9
|
-
export { choose } from
|
|
10
|
-
export { pure } from
|
|
1
|
+
import { Action, EventObject, SingleOrArray, ActionFunction, ActionFunctionMap, ActionTypes, DoneEvent, ErrorPlatformEvent, DoneEventObject, MachineContext, BaseActionObject } from "./types.js";
|
|
2
|
+
import * as actionTypes from "./actionTypes.js";
|
|
3
|
+
export { send, sendTo, sendParent, forwardTo, escalate } from "./actions/send.js";
|
|
4
|
+
export { stop } from "./actions/stop.js";
|
|
5
|
+
export { log } from "./actions/log.js";
|
|
6
|
+
export { cancel } from "./actions/cancel.js";
|
|
7
|
+
export { assign } from "./actions/assign.js";
|
|
8
|
+
export { raise } from "./actions/raise.js";
|
|
9
|
+
export { choose } from "./actions/choose.js";
|
|
10
|
+
export { pure } from "./actions/pure.js";
|
|
11
11
|
export { actionTypes };
|
|
12
12
|
export declare const initEvent: {
|
|
13
13
|
type: ActionTypes;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { EventObject, ActorRef, BaseActorRef, AnyEventObject } from
|
|
2
|
-
export { fromTransition } from
|
|
3
|
-
export { fromPromise } from
|
|
4
|
-
export { fromObservable, fromEventObservable } from
|
|
5
|
-
export { fromCallback } from
|
|
1
|
+
import type { EventObject, ActorRef, BaseActorRef, AnyEventObject } from "../types.js";
|
|
2
|
+
export { fromTransition } from "./transition.js";
|
|
3
|
+
export { fromPromise } from "./promise.js";
|
|
4
|
+
export { fromObservable, fromEventObservable } from "./observable.js";
|
|
5
|
+
export { fromCallback } from "./callback.js";
|
|
6
6
|
export declare const startSignalType = "xstate.init";
|
|
7
7
|
export declare const stopSignalType = "xstate.stop";
|
|
8
8
|
export declare const startSignal: StartSignal;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Subscribable, ActorBehavior, EventObject, Subscription } from
|
|
1
|
+
import { Subscribable, ActorBehavior, EventObject, Subscription } from "../types.js";
|
|
2
2
|
export interface ObservableInternalState<T> {
|
|
3
3
|
subscription: Subscription | undefined;
|
|
4
4
|
status: 'active' | 'done' | 'error' | 'canceled';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyInterpreter, DevToolsAdapter } from
|
|
1
|
+
import { AnyInterpreter, DevToolsAdapter } from "../types.js";
|
|
2
2
|
type ServiceListener = (service: AnyInterpreter) => void;
|
|
3
3
|
export interface XStateDevInterface {
|
|
4
4
|
register: (service: AnyInterpreter) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { EventObject, StateValue, BooleanGuardDefinition, GuardConfig, GuardDefinition, GuardPredicate, MachineContext } from
|
|
2
|
-
import type { State } from
|
|
1
|
+
import type { EventObject, StateValue, BooleanGuardDefinition, GuardConfig, GuardDefinition, GuardPredicate, MachineContext } from "./types.js";
|
|
2
|
+
import type { State } from "./State.js";
|
|
3
3
|
export declare function stateIn<TContext extends MachineContext, TEvent extends EventObject>(stateValue: StateValue): GuardDefinition<TContext, TEvent>;
|
|
4
4
|
export declare function not<TContext extends MachineContext, TEvent extends EventObject>(guard: GuardConfig<TContext, TEvent>): BooleanGuardDefinition<TContext, TEvent>;
|
|
5
5
|
export declare function and<TContext extends MachineContext, TEvent extends EventObject>(guards: Array<GuardConfig<TContext, TEvent>>): BooleanGuardDefinition<TContext, TEvent>;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { doneInvoke, forwardTo, sendParent, sendTo } from
|
|
2
|
-
export { assign } from
|
|
3
|
-
export { cancel } from
|
|
4
|
-
export { choose } from
|
|
5
|
-
export { log } from
|
|
6
|
-
export { pure } from
|
|
7
|
-
export { raise } from
|
|
8
|
-
export { stop } from
|
|
9
|
-
import { interpret, Interpreter, ActorStatus } from
|
|
10
|
-
import { createMachine } from
|
|
11
|
-
import { mapState } from
|
|
12
|
-
import { State } from
|
|
13
|
-
import { StateNode } from
|
|
14
|
-
export { SimulatedClock } from
|
|
15
|
-
export { StateMachine } from
|
|
16
|
-
export { getStateNodes } from
|
|
17
|
-
export { waitFor } from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export { matchesState, pathToStateValue, toObserver } from
|
|
1
|
+
import { doneInvoke, forwardTo, sendParent, sendTo } from "./actions.js";
|
|
2
|
+
export { assign } from "./actions/assign.js";
|
|
3
|
+
export { cancel } from "./actions/cancel.js";
|
|
4
|
+
export { choose } from "./actions/choose.js";
|
|
5
|
+
export { log } from "./actions/log.js";
|
|
6
|
+
export { pure } from "./actions/pure.js";
|
|
7
|
+
export { raise } from "./actions/raise.js";
|
|
8
|
+
export { stop } from "./actions/stop.js";
|
|
9
|
+
import { interpret, Interpreter, ActorStatus } from "./interpreter.js";
|
|
10
|
+
import { createMachine } from "./Machine.js";
|
|
11
|
+
import { mapState } from "./mapState.js";
|
|
12
|
+
import { State } from "./State.js";
|
|
13
|
+
import { StateNode } from "./StateNode.js";
|
|
14
|
+
export { SimulatedClock } from "./SimulatedClock.js";
|
|
15
|
+
export { StateMachine } from "./StateMachine.js";
|
|
16
|
+
export { getStateNodes } from "./stateUtils.js";
|
|
17
|
+
export { waitFor } from "./waitFor.js";
|
|
18
|
+
export * from "./typegenTypes.js";
|
|
19
|
+
export * from "./types.js";
|
|
20
|
+
export { matchesState, pathToStateValue, toObserver } from "./utils.js";
|
|
21
21
|
export { StateNode, State, mapState, sendTo, sendParent, forwardTo, interpret, Interpreter, ActorStatus as InterpreterStatus, doneInvoke, createMachine };
|
|
22
|
-
export { fromPromise, fromObservable, fromCallback, fromEventObservable, fromTransition } from
|
|
23
|
-
export { stateIn, not, and, or } from
|
|
22
|
+
export { fromPromise, fromObservable, fromCallback, fromEventObservable, fromTransition } from "./actors/index.js";
|
|
23
|
+
export { stateIn, not, and, or } from "./guards.js";
|
|
24
24
|
declare global {
|
|
25
25
|
interface SymbolConstructor {
|
|
26
26
|
readonly observable: symbol;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { symbolObservable } from
|
|
2
|
-
import { AreAllImplementationsAssumedToBeProvided, MissingImplementationsError } from
|
|
3
|
-
import type { ActorSystem, AnyActorBehavior, AnyStateMachine, EventFromBehavior, InterpreterFrom, PersistedStateFrom, RaiseActionObject, SnapshotFrom } from
|
|
4
|
-
import { ActorRef,
|
|
1
|
+
import { symbolObservable } from "./symbolObservable.js";
|
|
2
|
+
import { AreAllImplementationsAssumedToBeProvided, MissingImplementationsError } from "./typegenTypes.js";
|
|
3
|
+
import type { ActorSystem, AnyActorBehavior, AnyStateMachine, EventFromBehavior, InterpreterFrom, PersistedStateFrom, RaiseActionObject, SnapshotFrom } from "./types.js";
|
|
4
|
+
import { ActorRef, EventObject, InteropSubscribable, InterpreterOptions, Observer, SendActionObject, Subscription } from "./types.js";
|
|
5
5
|
export type SnapshotListener<TBehavior extends AnyActorBehavior> = (state: SnapshotFrom<TBehavior>) => void;
|
|
6
6
|
export type EventListener<TEvent extends EventObject = EventObject> = (event: TEvent) => void;
|
|
7
7
|
export type Listener = () => void;
|
|
@@ -61,11 +61,6 @@ export declare class Interpreter<TBehavior extends AnyActorBehavior, TEvent exte
|
|
|
61
61
|
private update;
|
|
62
62
|
subscribe(observer: Observer<SnapshotFrom<TBehavior>>): Subscription;
|
|
63
63
|
subscribe(nextListener?: (state: SnapshotFrom<TBehavior>) => void, errorListener?: (error: any) => void, completeListener?: () => void): Subscription;
|
|
64
|
-
/**
|
|
65
|
-
* Adds a state listener that is notified when the statechart has reached its final state.
|
|
66
|
-
* @param listener The state listener
|
|
67
|
-
*/
|
|
68
|
-
onDone(listener: EventListener<DoneEvent>): this;
|
|
69
64
|
/**
|
|
70
65
|
* Starts the interpreter from the initial state
|
|
71
66
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseActionObject, EventObject, StateValue, TransitionConfig, TransitionDefinition, SingleOrArray, StateValueMap, InitialTransitionConfig, MachineContext } from
|
|
2
|
-
import { State } from
|
|
3
|
-
import { NULL_EVENT } from
|
|
4
|
-
import type { StateNode } from
|
|
5
|
-
import { AnyActorContext, AnyHistoryValue, AnyState, AnyStateMachine, AnyStateNode, AnyTransitionDefinition, DelayedTransitionDefinition, InitialTransitionDefinition, StateFromMachine } from
|
|
1
|
+
import { BaseActionObject, EventObject, StateValue, TransitionConfig, TransitionDefinition, SingleOrArray, StateValueMap, InitialTransitionConfig, MachineContext } from "./types.js";
|
|
2
|
+
import { State } from "./State.js";
|
|
3
|
+
import { NULL_EVENT } from "./constants.js";
|
|
4
|
+
import type { StateNode } from "./StateNode.js";
|
|
5
|
+
import { AnyActorContext, AnyHistoryValue, AnyState, AnyStateMachine, AnyStateNode, AnyTransitionDefinition, DelayedTransitionDefinition, InitialTransitionDefinition, StateFromMachine } from "./index.js";
|
|
6
6
|
type Configuration<TContext extends MachineContext, TE extends EventObject> = Iterable<StateNode<TContext, TE>>;
|
|
7
7
|
type AnyConfiguration = Configuration<any, any>;
|
|
8
8
|
type AdjList = Map<AnyStateNode, Array<AnyStateNode>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Compute, EventObject, IndexByType, IsNever, Prop, Values, IsAny, ActorMap, Cast, ParameterizedObject } from
|
|
1
|
+
import { Compute, EventObject, IndexByType, IsNever, Prop, Values, IsAny, ActorMap, Cast, ParameterizedObject } from "./types.js";
|
|
2
2
|
export interface TypegenDisabled {
|
|
3
3
|
'@@xstate/typegen': false;
|
|
4
4
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { StateNode } from
|
|
2
|
-
import type { State } from
|
|
3
|
-
import type { ActorStatus, Clock, Interpreter } from
|
|
4
|
-
import type { StateMachine } from
|
|
5
|
-
import type { LifecycleSignal } from
|
|
6
|
-
import { TypegenDisabled, ResolveTypegenMeta, TypegenConstraint, MarkAllImplementationsAsProvided, AreAllImplementationsAssumedToBeProvided } from
|
|
1
|
+
import type { StateNode } from "./StateNode.js";
|
|
2
|
+
import type { State } from "./State.js";
|
|
3
|
+
import type { ActorStatus, Clock, Interpreter } from "./interpreter.js";
|
|
4
|
+
import type { StateMachine } from "./StateMachine.js";
|
|
5
|
+
import type { LifecycleSignal } from "./actors/index.js";
|
|
6
|
+
import { TypegenDisabled, ResolveTypegenMeta, TypegenConstraint, MarkAllImplementationsAsProvided, AreAllImplementationsAssumedToBeProvided } from "./typegenTypes.js";
|
|
7
7
|
export type AnyFunction = (...args: any[]) => any;
|
|
8
8
|
type ReturnTypeOrValue<T> = T extends AnyFunction ? ReturnType<T> : T;
|
|
9
9
|
export type IsNever<T> = [T] extends [never] ? true : false;
|
|
@@ -79,6 +79,7 @@ export interface ActionMeta<TEvent extends EventObject, TAction extends Paramete
|
|
|
79
79
|
export type Spawner = <T extends ActorBehavior<any, any> | string>(// TODO: read string from machine behavior keys
|
|
80
80
|
behavior: T, options?: Partial<{
|
|
81
81
|
id: string;
|
|
82
|
+
systemId?: string;
|
|
82
83
|
input: any;
|
|
83
84
|
}>) => T extends ActorBehavior<infer TActorEvent, infer TActorEmitted> ? ActorRef<TActorEvent, TActorEmitted> : ActorRef<any, any>;
|
|
84
85
|
export interface AssignMeta<TExpressionEvent extends EventObject, _TEvent extends EventObject> extends StateMeta<TExpressionEvent> {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AnyActorBehavior, AnyState } from
|
|
2
|
-
import { NULL_EVENT } from
|
|
3
|
-
import type { StateNode } from
|
|
4
|
-
import type { ActorBehavior, AnyEventObject, EventObject, EventType, InvokeConfig, MachineContext, Mapper, Observer, PropertyMapper, ErrorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfig, TransitionConfigTarget } from
|
|
1
|
+
import { AnyActorBehavior, AnyState } from "./index.js";
|
|
2
|
+
import { NULL_EVENT } from "./constants.js";
|
|
3
|
+
import type { StateNode } from "./StateNode.js";
|
|
4
|
+
import type { ActorBehavior, AnyEventObject, EventObject, EventType, InvokeConfig, MachineContext, Mapper, Observer, PropertyMapper, ErrorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfig, TransitionConfigTarget } from "./types.js";
|
|
5
5
|
export declare function keys<T extends object>(value: T): Array<keyof T & string>;
|
|
6
6
|
export declare function matchesState(parentStateId: StateValue, childStateId: StateValue, delimiter?: string): boolean;
|
|
7
7
|
export declare function toStatePath(stateId: string | string[], delimiter: string): string[];
|
package/dist/xstate.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var actors_dist_xstateActors = require('./actions-
|
|
5
|
+
var actors_dist_xstateActors = require('./actions-e4c704f3.cjs.js');
|
|
6
6
|
require('../dev/dist/xstate-dev.cjs.js');
|
|
7
7
|
|
|
8
8
|
const EMPTY_OBJECT = {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var actors_dist_xstateActors = require('./actions-
|
|
5
|
+
var actors_dist_xstateActors = require('./actions-d9c19f35.development.cjs.js');
|
|
6
6
|
require('../dev/dist/xstate-dev.development.cjs.js');
|
|
7
7
|
|
|
8
8
|
const EMPTY_OBJECT = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as mapValues, t as toActionObjects, a as toArray, f as formatTransitions, b as toTransitionConfigArray, N as NULL_EVENT, c as formatTransition, d as memo, e as evaluateGuard, g as flatten, h as createInvokeId, i as isString, j as invoke, k as getDelayedTransitions, l as formatInitialTransition, n as getCandidates, o as toInvokeConfig, p as createSpawner, S as STATE_DELIMITER, q as getConfiguration, r as getStateNodes, s as resolveStateValue, u as isInFinalState, v as State, w as isErrorEvent, x as macrostep, y as transitionNode, z as getInitialConfiguration, A as createInitEvent, B as resolveActionsAndContext, C as microstep, D as error, E as isStateId, F as getStateNodeByPath, G as getPersistedState, H as resolveReferencedActor, I as interpret, J as initEvent, K as matchesState } from './actions-
|
|
2
|
-
export { a9 as ActionTypes, P as Interpreter, Q as InterpreterStatus, aa as SpecialTargets, v as State, a7 as and, T as assign, U as cancel, V as choose, R as doneInvoke, O as forwardTo, a2 as fromCallback, a3 as fromEventObservable, a1 as fromObservable, a0 as fromPromise, a4 as fromTransition, r as getStateNodes, I as interpret, W as log, K as matchesState, a6 as not, a8 as or, _ as pathToStateValue, X as pure, Y as raise, M as sendParent, L as sendTo, a5 as stateIn, Z as stop, $ as toObserver } from './actions-
|
|
1
|
+
import { m as mapValues, t as toActionObjects, a as toArray, f as formatTransitions, b as toTransitionConfigArray, N as NULL_EVENT, c as formatTransition, d as memo, e as evaluateGuard, g as flatten, h as createInvokeId, i as isString, j as invoke, k as getDelayedTransitions, l as formatInitialTransition, n as getCandidates, o as toInvokeConfig, p as createSpawner, S as STATE_DELIMITER, q as getConfiguration, r as getStateNodes, s as resolveStateValue, u as isInFinalState, v as State, w as isErrorEvent, x as macrostep, y as transitionNode, z as getInitialConfiguration, A as createInitEvent, B as resolveActionsAndContext, C as microstep, D as error, E as isStateId, F as getStateNodeByPath, G as getPersistedState, H as resolveReferencedActor, I as interpret, J as initEvent, K as matchesState } from './actions-c8b9504d.development.esm.js';
|
|
2
|
+
export { a9 as ActionTypes, P as Interpreter, Q as InterpreterStatus, aa as SpecialTargets, v as State, a7 as and, T as assign, U as cancel, V as choose, R as doneInvoke, O as forwardTo, a2 as fromCallback, a3 as fromEventObservable, a1 as fromObservable, a0 as fromPromise, a4 as fromTransition, r as getStateNodes, I as interpret, W as log, K as matchesState, a6 as not, a8 as or, _ as pathToStateValue, X as pure, Y as raise, M as sendParent, L as sendTo, a5 as stateIn, Z as stop, $ as toObserver } from './actions-c8b9504d.development.esm.js';
|
|
3
3
|
import '../dev/dist/xstate-dev.development.esm.js';
|
|
4
4
|
|
|
5
5
|
const EMPTY_OBJECT = {};
|