xstate 4.31.0 → 5.0.0-alpha.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.
- package/CHANGELOG.md +526 -0
- package/actions/ExecutableAction.ts +58 -0
- package/actions/dist/xstate-actions.cjs.d.ts +1 -0
- package/actions/dist/xstate-actions.cjs.dev.js +32 -0
- package/actions/dist/xstate-actions.cjs.js +7 -0
- package/actions/dist/xstate-actions.cjs.prod.js +32 -0
- package/actions/dist/xstate-actions.esm.js +2 -0
- package/actions/dynamicAction.ts +34 -0
- package/actions/package.json +4 -0
- package/actors/dist/xstate-actors.cjs.d.ts +1 -0
- package/actors/dist/xstate-actors.cjs.dev.js +21 -0
- package/actors/dist/xstate-actors.cjs.js +7 -0
- package/actors/dist/xstate-actors.cjs.prod.js +21 -0
- package/actors/dist/xstate-actors.esm.js +2 -0
- package/actors/package.json +4 -0
- package/dev/dist/xstate-dev.cjs.d.ts +1 -0
- package/dev/dist/xstate-dev.cjs.dev.js +11 -0
- package/dev/dist/xstate-dev.cjs.js +7 -0
- package/{lib/devTools.js → dev/dist/xstate-dev.cjs.prod.js} +17 -10
- package/dev/dist/xstate-dev.esm.js +1 -0
- package/dev/package.json +4 -0
- package/dist/Machine-9ce74c11.cjs.dev.js +755 -0
- package/dist/Machine-dca041dc.cjs.prod.js +749 -0
- package/dist/Machine-fb2f47f5.esm.js +751 -0
- package/dist/actions-6b86876d.cjs.dev.js +4815 -0
- package/dist/actions-70094c93.cjs.prod.js +4765 -0
- package/dist/actions-ff512f16.esm.js +4757 -0
- package/dist/declarations/actions/ExecutableAction.d.ts +23 -0
- package/dist/declarations/actions/dynamicAction.d.ts +3 -0
- package/dist/declarations/src/Machine.d.ts +4 -0
- package/dist/declarations/src/Mailbox.d.ts +12 -0
- package/dist/declarations/src/ObservableActorRef.d.ts +25 -0
- package/{lib → dist/declarations/src}/SimulatedClock.d.ts +0 -1
- package/dist/declarations/src/State.d.ts +104 -0
- package/dist/declarations/src/StateMachine.d.ts +112 -0
- package/dist/declarations/src/StateNode.d.ts +127 -0
- package/{es → dist/declarations/src}/actionTypes.d.ts +0 -3
- package/dist/declarations/src/actions/assign.d.ts +7 -0
- package/dist/declarations/src/actions/cancel.d.ts +10 -0
- package/dist/declarations/src/actions/choose.d.ts +3 -0
- package/dist/declarations/src/actions/invoke.d.ts +3 -0
- package/dist/declarations/src/actions/log.d.ts +11 -0
- package/dist/declarations/src/actions/pure.d.ts +3 -0
- package/dist/declarations/src/actions/raise.d.ts +9 -0
- package/dist/declarations/src/actions/send.d.ts +55 -0
- package/dist/declarations/src/actions/stop.d.ts +8 -0
- package/dist/declarations/src/actions.d.ts +44 -0
- package/dist/declarations/src/actors.d.ts +38 -0
- package/dist/declarations/src/constants.d.ts +5 -0
- package/{lib/devTools.d.ts → dist/declarations/src/dev/index.d.ts} +2 -2
- package/{es → dist/declarations/src}/environment.d.ts +0 -1
- package/dist/declarations/src/guards.d.ts +9 -0
- package/dist/declarations/src/index.d.ts +47 -0
- package/dist/declarations/src/interpreter.d.ts +147 -0
- package/{es → dist/declarations/src}/mapState.d.ts +0 -1
- package/dist/declarations/src/match.d.ts +5 -0
- package/dist/declarations/src/memo.d.ts +1 -0
- package/dist/declarations/src/model.d.ts +5 -0
- package/{lib → dist/declarations/src}/model.types.d.ts +10 -9
- package/dist/declarations/src/registry.d.ts +8 -0
- package/{es → dist/declarations/src}/schema.d.ts +0 -1
- package/dist/declarations/src/spawn.d.ts +2 -0
- package/dist/declarations/src/stateUtils.d.ts +85 -0
- package/{lib → dist/declarations/src}/typegenTypes.d.ts +28 -26
- package/dist/declarations/src/types.d.ts +1026 -0
- package/dist/declarations/src/utils.d.ts +56 -0
- package/{es/devTools.js → dist/index-20b364c4.esm.js} +18 -6
- package/dist/index-2a564d03.cjs.dev.js +64 -0
- package/dist/xstate.cjs.d.ts +1 -0
- package/dist/xstate.cjs.dev.js +217 -0
- package/dist/xstate.cjs.js +7 -0
- package/dist/xstate.cjs.prod.js +217 -0
- package/dist/xstate.esm.js +172 -0
- package/guards/dist/xstate-guards.cjs.d.ts +1 -0
- package/guards/dist/xstate-guards.cjs.dev.js +15 -0
- package/guards/dist/xstate-guards.cjs.js +7 -0
- package/guards/dist/xstate-guards.cjs.prod.js +15 -0
- package/guards/dist/xstate-guards.esm.js +2 -0
- package/guards/package.json +4 -0
- package/invoke/package.json +4 -0
- package/model/dist/xstate-model.cjs.d.ts +1 -0
- package/model/dist/xstate-model.cjs.dev.js +41 -0
- package/model/dist/xstate-model.cjs.js +7 -0
- package/model/dist/xstate-model.cjs.prod.js +41 -0
- package/model/dist/xstate-model.esm.js +37 -0
- package/model/package.json +4 -0
- package/package.json +21 -30
- package/dist/xstate.interpreter.js +0 -15
- package/dist/xstate.js +0 -15
- package/dist/xstate.web.js +0 -15
- package/es/Actor.d.ts +0 -25
- package/es/Actor.js +0 -99
- package/es/Machine.d.ts +0 -12
- package/es/Machine.js +0 -14
- package/es/SimulatedClock.d.ts +0 -17
- package/es/SimulatedClock.js +0 -81
- package/es/State.d.ts +0 -123
- package/es/State.js +0 -274
- package/es/StateNode.d.ts +0 -287
- package/es/StateNode.js +0 -1566
- package/es/_virtual/_tslib.js +0 -78
- package/es/actionTypes.js +0 -22
- package/es/actions.d.ts +0 -154
- package/es/actions.js +0 -520
- package/es/behaviors.d.ts +0 -37
- package/es/behaviors.js +0 -131
- package/es/constants.d.ts +0 -6
- package/es/constants.js +0 -6
- package/es/devTools.d.ts +0 -14
- package/es/each.d.ts +0 -4
- package/es/each.js +0 -13
- package/es/environment.js +0 -3
- package/es/index.d.ts +0 -22
- package/es/index.js +0 -23
- package/es/interpreter.d.ts +0 -209
- package/es/interpreter.js +0 -1402
- package/es/invoke.d.ts +0 -11
- package/es/invokeUtils.d.ts +0 -7
- package/es/invokeUtils.js +0 -40
- package/es/json.d.ts +0 -31
- package/es/json.js +0 -86
- package/es/mapState.js +0 -32
- package/es/match.d.ts +0 -9
- package/es/match.js +0 -34
- package/es/model.d.ts +0 -5
- package/es/model.js +0 -50
- package/es/model.types.d.ts +0 -52
- package/es/patterns.d.ts +0 -14
- package/es/patterns.js +0 -48
- package/es/registry.d.ts +0 -9
- package/es/registry.js +0 -19
- package/es/scheduler.d.ts +0 -17
- package/es/scheduler.js +0 -79
- package/es/schema.js +0 -6
- package/es/scxml.d.ts +0 -6
- package/es/serviceScope.d.ts +0 -4
- package/es/serviceScope.js +0 -16
- package/es/stateUtils.d.ts +0 -17
- package/es/stateUtils.js +0 -259
- package/es/typegenTypes.d.ts +0 -130
- package/es/types.d.ts +0 -1037
- package/es/types.js +0 -33
- package/es/utils.d.ts +0 -72
- package/es/utils.js +0 -626
- package/es/waitFor.d.ts +0 -32
- package/es/waitFor.js +0 -66
- package/lib/Actor.d.ts +0 -25
- package/lib/Actor.js +0 -108
- package/lib/Machine.d.ts +0 -12
- package/lib/Machine.js +0 -19
- package/lib/SimulatedClock.js +0 -85
- package/lib/State.d.ts +0 -123
- package/lib/State.js +0 -282
- package/lib/StateNode.d.ts +0 -287
- package/lib/StateNode.js +0 -1570
- package/lib/_virtual/_tslib.js +0 -85
- package/lib/actionTypes.d.ts +0 -20
- package/lib/actionTypes.js +0 -43
- package/lib/actions.d.ts +0 -154
- package/lib/actions.js +0 -552
- package/lib/behaviors.d.ts +0 -37
- package/lib/behaviors.js +0 -137
- package/lib/constants.d.ts +0 -6
- package/lib/constants.js +0 -13
- package/lib/each.d.ts +0 -4
- package/lib/each.js +0 -17
- package/lib/environment.d.ts +0 -2
- package/lib/environment.js +0 -7
- package/lib/index.d.ts +0 -22
- package/lib/index.js +0 -60
- package/lib/interpreter.d.ts +0 -209
- package/lib/interpreter.js +0 -1408
- package/lib/invoke.d.ts +0 -11
- package/lib/invoke.js +0 -20
- package/lib/invokeUtils.d.ts +0 -7
- package/lib/invokeUtils.js +0 -45
- package/lib/json.d.ts +0 -31
- package/lib/json.js +0 -94
- package/lib/mapState.d.ts +0 -4
- package/lib/mapState.js +0 -36
- package/lib/match.d.ts +0 -9
- package/lib/match.js +0 -38
- package/lib/model.d.ts +0 -5
- package/lib/model.js +0 -54
- package/lib/model.types.js +0 -2
- package/lib/patterns.d.ts +0 -14
- package/lib/patterns.js +0 -53
- package/lib/registry.d.ts +0 -9
- package/lib/registry.js +0 -23
- package/lib/scheduler.d.ts +0 -17
- package/lib/scheduler.js +0 -83
- package/lib/schema.d.ts +0 -3
- package/lib/schema.js +0 -11
- package/lib/scxml.d.ts +0 -6
- package/lib/scxml.js +0 -350
- package/lib/serviceScope.d.ts +0 -4
- package/lib/serviceScope.js +0 -21
- package/lib/stateUtils.d.ts +0 -17
- package/lib/stateUtils.js +0 -273
- package/lib/typegenTypes.js +0 -2
- package/lib/types.d.ts +0 -1037
- package/lib/types.js +0 -35
- package/lib/utils.d.ts +0 -72
- package/lib/utils.js +0 -673
- package/lib/waitFor.d.ts +0 -32
- package/lib/waitFor.js +0 -70
package/lib/types.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
exports.ActionTypes = void 0;
|
|
6
|
-
|
|
7
|
-
(function (ActionTypes) {
|
|
8
|
-
ActionTypes["Start"] = "xstate.start";
|
|
9
|
-
ActionTypes["Stop"] = "xstate.stop";
|
|
10
|
-
ActionTypes["Raise"] = "xstate.raise";
|
|
11
|
-
ActionTypes["Send"] = "xstate.send";
|
|
12
|
-
ActionTypes["Cancel"] = "xstate.cancel";
|
|
13
|
-
ActionTypes["NullEvent"] = "";
|
|
14
|
-
ActionTypes["Assign"] = "xstate.assign";
|
|
15
|
-
ActionTypes["After"] = "xstate.after";
|
|
16
|
-
ActionTypes["DoneState"] = "done.state";
|
|
17
|
-
ActionTypes["DoneInvoke"] = "done.invoke";
|
|
18
|
-
ActionTypes["Log"] = "xstate.log";
|
|
19
|
-
ActionTypes["Init"] = "xstate.init";
|
|
20
|
-
ActionTypes["Invoke"] = "xstate.invoke";
|
|
21
|
-
ActionTypes["ErrorExecution"] = "error.execution";
|
|
22
|
-
ActionTypes["ErrorCommunication"] = "error.communication";
|
|
23
|
-
ActionTypes["ErrorPlatform"] = "error.platform";
|
|
24
|
-
ActionTypes["ErrorCustom"] = "xstate.error";
|
|
25
|
-
ActionTypes["Update"] = "xstate.update";
|
|
26
|
-
ActionTypes["Pure"] = "xstate.pure";
|
|
27
|
-
ActionTypes["Choose"] = "xstate.choose";
|
|
28
|
-
})(exports.ActionTypes || (exports.ActionTypes = {}));
|
|
29
|
-
|
|
30
|
-
exports.SpecialTargets = void 0;
|
|
31
|
-
|
|
32
|
-
(function (SpecialTargets) {
|
|
33
|
-
SpecialTargets["Parent"] = "#_parent";
|
|
34
|
-
SpecialTargets["Internal"] = "#_internal";
|
|
35
|
-
})(exports.SpecialTargets || (exports.SpecialTargets = {}));
|
package/lib/utils.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Event, StateValue, ActionType, Action, EventObject, PropertyMapper, Mapper, EventType, HistoryValue, AssignAction, Condition, Subscribable, ConditionPredicate, SCXML, StateLike, EventData, TransitionConfig, TransitionConfigTarget, NullEvent, SingleOrArray, Guard, InvokeSourceDefinition, Observer, Behavior } from './types';
|
|
2
|
-
import { StateNode } from './StateNode';
|
|
3
|
-
import { State } from './State';
|
|
4
|
-
import { Actor } from './Actor';
|
|
5
|
-
import { AnyStateMachine } from '.';
|
|
6
|
-
export declare function keys<T extends object>(value: T): Array<keyof T & string>;
|
|
7
|
-
export declare function matchesState(parentStateId: StateValue, childStateId: StateValue, delimiter?: string): boolean;
|
|
8
|
-
export declare function getEventType<TEvent extends EventObject = EventObject>(event: Event<TEvent>): TEvent['type'];
|
|
9
|
-
export declare function getActionType(action: Action<any, any>): ActionType;
|
|
10
|
-
export declare function toStatePath(stateId: string | string[], delimiter: string): string[];
|
|
11
|
-
export declare function isStateLike(state: any): state is StateLike<any>;
|
|
12
|
-
export declare function toStateValue(stateValue: StateLike<any> | StateValue | string[], delimiter: string): StateValue;
|
|
13
|
-
export declare function pathToStateValue(statePath: string[]): StateValue;
|
|
14
|
-
export declare function mapValues<P, O extends Record<string, unknown>>(collection: O, iteratee: (item: O[keyof O], key: keyof O, collection: O, i: number) => P): {
|
|
15
|
-
[key in keyof O]: P;
|
|
16
|
-
};
|
|
17
|
-
export declare function mapFilterValues<T, P>(collection: {
|
|
18
|
-
[key: string]: T;
|
|
19
|
-
}, iteratee: (item: T, key: string, collection: {
|
|
20
|
-
[key: string]: T;
|
|
21
|
-
}) => P, predicate: (item: T) => boolean): {
|
|
22
|
-
[key: string]: P;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves a value at the given path.
|
|
26
|
-
* @param props The deep path to the prop of the desired value
|
|
27
|
-
*/
|
|
28
|
-
export declare const path: <T extends Record<string, any>>(props: string[]) => any;
|
|
29
|
-
/**
|
|
30
|
-
* Retrieves a value at the given path via the nested accessor prop.
|
|
31
|
-
* @param props The deep path to the prop of the desired value
|
|
32
|
-
*/
|
|
33
|
-
export declare function nestedPath<T extends Record<string, any>>(props: string[], accessorProp: keyof T): (object: T) => T;
|
|
34
|
-
export declare function toStatePaths(stateValue: StateValue | undefined): string[][];
|
|
35
|
-
export declare function pathsToStateValue(paths: string[][]): StateValue;
|
|
36
|
-
export declare function flatten<T>(array: Array<T | T[]>): T[];
|
|
37
|
-
export declare function toArrayStrict<T>(value: T[] | T): T[];
|
|
38
|
-
export declare function toArray<T>(value: T[] | T | undefined): T[];
|
|
39
|
-
export declare function mapContext<TContext, TEvent extends EventObject>(mapper: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>, context: TContext, _event: SCXML.Event<TEvent>): any;
|
|
40
|
-
export declare function isBuiltInEvent(eventType: EventType): boolean;
|
|
41
|
-
export declare function isPromiseLike(value: any): value is PromiseLike<any>;
|
|
42
|
-
export declare function isBehavior(value: any): value is Behavior<any, any>;
|
|
43
|
-
export declare function partition<T, A extends T, B extends T>(items: T[], predicate: (item: T) => item is A): [A[], B[]];
|
|
44
|
-
export declare function updateHistoryStates(hist: HistoryValue, stateValue: StateValue): Record<string, HistoryValue | undefined>;
|
|
45
|
-
export declare function updateHistoryValue(hist: HistoryValue, stateValue: StateValue): HistoryValue;
|
|
46
|
-
export declare function updateContext<TContext, TEvent extends EventObject>(context: TContext, _event: SCXML.Event<TEvent>, assignActions: Array<AssignAction<TContext, TEvent>>, state?: State<TContext, TEvent>): TContext;
|
|
47
|
-
declare let warn: (condition: boolean | Error, message: string) => void;
|
|
48
|
-
export { warn };
|
|
49
|
-
export declare function isArray(value: any): value is any[];
|
|
50
|
-
export declare function isFunction(value: any): value is Function;
|
|
51
|
-
export declare function isString(value: any): value is string;
|
|
52
|
-
export declare function toGuard<TContext, TEvent extends EventObject>(condition?: Condition<TContext, TEvent>, guardMap?: Record<string, ConditionPredicate<TContext, TEvent>>): Guard<TContext, TEvent> | undefined;
|
|
53
|
-
export declare function isObservable<T>(value: any): value is Subscribable<T>;
|
|
54
|
-
export declare const symbolObservable: typeof Symbol.observable;
|
|
55
|
-
export declare const interopSymbols: {
|
|
56
|
-
[Symbol.observable]: () => any;
|
|
57
|
-
};
|
|
58
|
-
export declare function isMachine(value: any): value is AnyStateMachine;
|
|
59
|
-
export declare function isActor(value: any): value is Actor;
|
|
60
|
-
export declare const uniqueId: () => string;
|
|
61
|
-
export declare function toEventObject<TEvent extends EventObject>(event: Event<TEvent>, payload?: EventData): TEvent;
|
|
62
|
-
export declare function toSCXMLEvent<TEvent extends EventObject>(event: Event<TEvent> | SCXML.Event<TEvent>, scxmlEvent?: Partial<SCXML.Event<TEvent>>): SCXML.Event<TEvent>;
|
|
63
|
-
export declare function toTransitionConfigArray<TContext, TEvent extends EventObject>(event: TEvent['type'] | NullEvent['type'] | '*', configLike: SingleOrArray<TransitionConfig<TContext, TEvent> | TransitionConfigTarget<TContext, TEvent>>): Array<TransitionConfig<TContext, TEvent> & {
|
|
64
|
-
event: TEvent['type'] | NullEvent['type'] | '*';
|
|
65
|
-
}>;
|
|
66
|
-
export declare function normalizeTarget<TContext, TEvent extends EventObject>(target: SingleOrArray<string | StateNode<TContext, any, TEvent>> | undefined): Array<string | StateNode<TContext, any, TEvent>> | undefined;
|
|
67
|
-
export declare function reportUnhandledExceptionOnInvocation(originalError: any, currentError: any, id: string): void;
|
|
68
|
-
export declare function evaluateGuard<TContext, TEvent extends EventObject>(machine: StateNode<TContext, any, TEvent, any, any>, guard: Guard<TContext, TEvent>, context: TContext, _event: SCXML.Event<TEvent>, state: State<TContext, TEvent>): boolean;
|
|
69
|
-
export declare function toInvokeSource(src: string | InvokeSourceDefinition): InvokeSourceDefinition;
|
|
70
|
-
export declare function toObserver<T>(nextHandler: Observer<T> | ((value: T) => void), errorHandler?: (error: any) => void, completionHandler?: () => void): Observer<T>;
|
|
71
|
-
export declare function createInvokeId(stateNodeId: string, index: number): string;
|
|
72
|
-
//# sourceMappingURL=utils.d.ts.map
|