xstate 5.0.0-alpha.1 → 5.0.0-alpha.3
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/README.md +3 -2
- package/actions/dist/xstate-actions.cjs.dev.js +3 -2
- package/actions/dist/xstate-actions.cjs.prod.js +2 -1
- package/actions/dist/xstate-actions.esm.js +2 -2
- package/actions/dist/xstate-actions.umd.min.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actions/dynamicAction.ts +11 -3
- package/actors/dist/xstate-actors.cjs.d.ts +1 -1
- package/actors/dist/xstate-actors.cjs.dev.js +4 -3
- package/actors/dist/xstate-actors.cjs.prod.js +3 -2
- package/actors/dist/xstate-actors.esm.js +2 -2
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dev/dist/xstate-dev.cjs.dev.js +1 -1
- package/dev/dist/xstate-dev.cjs.prod.js +0 -11
- package/dev/dist/xstate-dev.esm.js +1 -1
- package/dev/dist/xstate-dev.umd.min.js.map +1 -1
- package/dist/{actions-7ea9280f.cjs.prod.js → actions-3910d35f.cjs.prod.js} +1127 -1491
- package/dist/{actions-b08d0da8.cjs.dev.js → actions-3f0ba11b.cjs.dev.js} +1131 -1501
- package/dist/{actions-b673cb13.esm.js → actions-4fe4ada8.esm.js} +1134 -1500
- package/dist/declarations/actions/dynamicAction.d.ts +3 -3
- package/dist/declarations/src/Machine.d.ts +4 -4
- package/dist/declarations/src/SimulatedClock.d.ts +1 -1
- package/dist/declarations/src/State.d.ts +6 -6
- package/dist/declarations/src/StateMachine.d.ts +12 -22
- 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 +2 -2
- package/dist/declarations/src/actions/cancel.d.ts +3 -3
- package/dist/declarations/src/actions/choose.d.ts +3 -3
- package/dist/declarations/src/actions/invoke.d.ts +3 -3
- package/dist/declarations/src/actions/log.d.ts +3 -3
- package/dist/declarations/src/actions/pure.d.ts +5 -2
- package/dist/declarations/src/actions/raise.d.ts +2 -3
- package/dist/declarations/src/actions/send.d.ts +11 -9
- package/dist/declarations/src/actions/stop.d.ts +2 -2
- package/dist/declarations/src/actions.d.ts +14 -10
- package/dist/declarations/src/actors/callback.d.ts +8 -0
- package/dist/declarations/src/actors/index.d.ts +27 -0
- package/dist/declarations/src/actors/observable.d.ts +23 -0
- package/dist/declarations/src/actors/promise.d.ts +12 -0
- package/dist/declarations/src/actors/transition.d.ts +13 -0
- package/dist/declarations/src/dev/index.d.ts +2 -2
- 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 +26 -30
- package/dist/declarations/src/spawn.d.ts +2 -2
- package/dist/declarations/src/stateUtils.d.ts +11 -11
- package/dist/declarations/src/system.d.ts +2 -0
- package/dist/declarations/src/typegenTypes.d.ts +9 -9
- package/dist/declarations/src/types.d.ts +300 -267
- package/dist/declarations/src/utils.d.ts +14 -10
- package/dist/{index-20b364c4.esm.js → index-50bd0aff.esm.js} +0 -12
- package/dist/{index-2a564d03.cjs.dev.js → index-ebaab3c9.cjs.dev.js} +0 -12
- package/dist/xstate.cjs.dev.js +142 -217
- package/dist/xstate.cjs.prod.js +141 -216
- package/dist/xstate.esm.js +140 -216
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.dev.js +2 -2
- package/guards/dist/xstate-guards.cjs.prod.js +1 -1
- package/guards/dist/xstate-guards.esm.js +2 -2
- package/guards/dist/xstate-guards.umd.min.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +8 -9
- package/dist/declarations/src/actors.d.ts +0 -37
- package/dist/declarations/src/registry.d.ts +0 -8
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { AnyState } from '.';
|
|
2
|
-
import { NULL_EVENT } from './constants';
|
|
3
|
-
import type { StateNode } from './StateNode';
|
|
4
|
-
import type {
|
|
5
|
-
import { AnyStateMachine } from './types';
|
|
1
|
+
import { AnyActorBehavior, AnyState } from '.';
|
|
2
|
+
import { NULL_EVENT } from './constants.js';
|
|
3
|
+
import type { StateNode } from './StateNode.js';
|
|
4
|
+
import type { ActorBehavior, EventObject, EventType, InvokeConfig, MachineContext, Mapper, Observer, PropertyMapper, SCXML, SCXMLErrorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfig, TransitionConfigTarget } from './types.js';
|
|
6
5
|
export declare function keys<T extends object>(value: T): Array<keyof T & string>;
|
|
7
6
|
export declare function matchesState(parentStateId: StateValue, childStateId: StateValue, delimiter?: string): boolean;
|
|
8
7
|
export declare function toStatePath(stateId: string | string[], delimiter: string): string[];
|
|
@@ -31,24 +30,29 @@ export declare function toArray<T>(value: T[] | T | undefined): T[];
|
|
|
31
30
|
export declare function mapContext<TContext extends MachineContext, TEvent extends EventObject>(mapper: Mapper<TContext, TEvent, any> | PropertyMapper<TContext, TEvent, any>, context: TContext, _event: SCXML.Event<TEvent>): any;
|
|
32
31
|
export declare function isBuiltInEvent(eventType: EventType): boolean;
|
|
33
32
|
export declare function isPromiseLike(value: any): value is PromiseLike<any>;
|
|
34
|
-
export declare function isBehavior(value: any): value is
|
|
33
|
+
export declare function isBehavior(value: any): value is ActorBehavior<any, any>;
|
|
35
34
|
export declare function partition<T, A extends T, B extends T>(items: T[], predicate: (item: T) => item is A): [A[], B[]];
|
|
36
35
|
export declare let warn: (condition: boolean | Error, message: string) => void;
|
|
37
36
|
export declare function isArray(value: any): value is any[];
|
|
38
37
|
export declare function isFunction(value: any): value is Function;
|
|
39
38
|
export declare function isString(value: any): value is string;
|
|
40
39
|
export declare function isObservable<T>(value: any): value is Subscribable<T>;
|
|
41
|
-
export declare function isStateMachine(value: any): value is AnyStateMachine;
|
|
42
40
|
export declare const uniqueId: () => string;
|
|
43
41
|
export declare function isSCXMLEvent<TEvent extends EventObject>(event: TEvent | SCXML.Event<TEvent>): event is SCXML.Event<TEvent>;
|
|
44
42
|
export declare function isSCXMLErrorEvent(event: SCXML.Event<any>): event is SCXMLErrorEvent;
|
|
45
43
|
export declare function toSCXMLEvent<TEvent extends EventObject>(event: TEvent | SCXML.Event<TEvent>, scxmlEvent?: Partial<SCXML.Event<TEvent>>): SCXML.Event<TEvent>;
|
|
46
|
-
export declare function toTransitionConfigArray<TContext extends MachineContext, TEvent extends EventObject>(event: TEvent['type'] | typeof NULL_EVENT | '*', configLike: SingleOrArray<TransitionConfig<TContext, TEvent> | TransitionConfigTarget
|
|
44
|
+
export declare function toTransitionConfigArray<TContext extends MachineContext, TEvent extends EventObject>(event: TEvent['type'] | typeof NULL_EVENT | '*', configLike: SingleOrArray<TransitionConfig<TContext, TEvent> | TransitionConfigTarget>): Array<TransitionConfig<TContext, TEvent> & {
|
|
47
45
|
event: TEvent['type'] | typeof NULL_EVENT | '*';
|
|
48
46
|
}>;
|
|
49
47
|
export declare function normalizeTarget<TContext extends MachineContext, TEvent extends EventObject>(target: SingleOrArray<string | StateNode<TContext, TEvent>> | undefined): Array<string | StateNode<TContext, TEvent>> | undefined;
|
|
50
48
|
export declare function reportUnhandledExceptionOnInvocation(originalError: any, currentError: any, id: string): void;
|
|
51
|
-
export declare function toInvokeConfig<TContext extends MachineContext, TEvent extends EventObject>(invocable: InvokeConfig<TContext, TEvent> | string |
|
|
52
|
-
export declare function toInvokeSource(src: string | InvokeSourceDefinition): InvokeSourceDefinition;
|
|
49
|
+
export declare function toInvokeConfig<TContext extends MachineContext, TEvent extends EventObject>(invocable: InvokeConfig<TContext, TEvent> | string | ActorBehavior<any, any>, id: string): InvokeConfig<TContext, TEvent>;
|
|
53
50
|
export declare function toObserver<T>(nextHandler?: Observer<T> | ((value: T) => void), errorHandler?: (error: any) => void, completionHandler?: () => void): Observer<T>;
|
|
54
51
|
export declare function createInvokeId(stateNodeId: string, index: number): string;
|
|
52
|
+
export declare function resolveReferencedActor(referenced: AnyActorBehavior | {
|
|
53
|
+
src: AnyActorBehavior;
|
|
54
|
+
input: Mapper<any, any, any> | any;
|
|
55
|
+
} | undefined): {
|
|
56
|
+
src: AnyActorBehavior;
|
|
57
|
+
input: Mapper<any, any, any> | any;
|
|
58
|
+
} | undefined;
|
|
@@ -5,41 +5,31 @@ function getGlobal() {
|
|
|
5
5
|
if (typeof globalThis !== 'undefined') {
|
|
6
6
|
return globalThis;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
if (typeof self !== 'undefined') {
|
|
10
9
|
return self;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
if (typeof window !== 'undefined') {
|
|
14
12
|
return window;
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
if (typeof global !== 'undefined') {
|
|
18
15
|
return global;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
if (!IS_PRODUCTION) {
|
|
22
18
|
console.warn('XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues');
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
|
-
|
|
26
21
|
function getDevTools() {
|
|
27
22
|
var w = getGlobal();
|
|
28
|
-
|
|
29
23
|
if (!!w.__xstate__) {
|
|
30
24
|
return w.__xstate__;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
return undefined;
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
function registerService(service) {
|
|
37
29
|
if (typeof window === 'undefined') {
|
|
38
30
|
return;
|
|
39
31
|
}
|
|
40
|
-
|
|
41
32
|
var devTools = getDevTools();
|
|
42
|
-
|
|
43
33
|
if (devTools) {
|
|
44
34
|
devTools.register(service);
|
|
45
35
|
}
|
|
@@ -48,9 +38,7 @@ var devToolsAdapter = function devToolsAdapter(service) {
|
|
|
48
38
|
if (typeof window === 'undefined') {
|
|
49
39
|
return;
|
|
50
40
|
}
|
|
51
|
-
|
|
52
41
|
var devTools = getDevTools();
|
|
53
|
-
|
|
54
42
|
if (devTools) {
|
|
55
43
|
devTools.register(service);
|
|
56
44
|
}
|
|
@@ -7,41 +7,31 @@ function getGlobal() {
|
|
|
7
7
|
if (typeof globalThis !== 'undefined') {
|
|
8
8
|
return globalThis;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
if (typeof self !== 'undefined') {
|
|
12
11
|
return self;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
if (typeof window !== 'undefined') {
|
|
16
14
|
return window;
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
if (typeof global !== 'undefined') {
|
|
20
17
|
return global;
|
|
21
18
|
}
|
|
22
|
-
|
|
23
19
|
if (!IS_PRODUCTION) {
|
|
24
20
|
console.warn('XState could not find a global object in this environment. Please let the maintainers know and raise an issue here: https://github.com/statelyai/xstate/issues');
|
|
25
21
|
}
|
|
26
22
|
}
|
|
27
|
-
|
|
28
23
|
function getDevTools() {
|
|
29
24
|
var w = getGlobal();
|
|
30
|
-
|
|
31
25
|
if (!!w.__xstate__) {
|
|
32
26
|
return w.__xstate__;
|
|
33
27
|
}
|
|
34
|
-
|
|
35
28
|
return undefined;
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
function registerService(service) {
|
|
39
31
|
if (typeof window === 'undefined') {
|
|
40
32
|
return;
|
|
41
33
|
}
|
|
42
|
-
|
|
43
34
|
var devTools = getDevTools();
|
|
44
|
-
|
|
45
35
|
if (devTools) {
|
|
46
36
|
devTools.register(service);
|
|
47
37
|
}
|
|
@@ -50,9 +40,7 @@ var devToolsAdapter = function devToolsAdapter(service) {
|
|
|
50
40
|
if (typeof window === 'undefined') {
|
|
51
41
|
return;
|
|
52
42
|
}
|
|
53
|
-
|
|
54
43
|
var devTools = getDevTools();
|
|
55
|
-
|
|
56
44
|
if (devTools) {
|
|
57
45
|
devTools.register(service);
|
|
58
46
|
}
|