xstate 5.0.0-alpha.2 → 5.0.0-alpha.4
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.dev.js +1 -1
- package/actions/dist/xstate-actions.cjs.prod.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.dev.js +1 -1
- package/actors/dist/xstate-actors.cjs.prod.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/dev/dist/xstate-dev.umd.min.js.map +1 -1
- package/dist/{actions-acb29ffe.cjs.prod.js → actions-2479953d.cjs.prod.js} +173 -134
- package/dist/{actions-9778f6fb.esm.js → actions-7678b87b.esm.js} +173 -134
- package/dist/{actions-1e9778c2.cjs.dev.js → actions-96f799fc.cjs.dev.js} +173 -134
- 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/invoke.d.ts +2 -2
- package/dist/declarations/src/actions/log.d.ts +2 -2
- package/dist/declarations/src/actions/pure.d.ts +5 -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/index.d.ts +5 -5
- 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 +21 -21
- package/dist/declarations/src/interpreter.d.ts +4 -4
- package/dist/declarations/src/spawn.d.ts +1 -1
- package/dist/declarations/src/stateUtils.d.ts +4 -4
- package/dist/declarations/src/typegenTypes.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +47 -23
- package/dist/declarations/src/utils.d.ts +4 -4
- package/dist/xstate.cjs.dev.js +5 -2
- package/dist/xstate.cjs.prod.js +5 -2
- package/dist/xstate.esm.js +6 -3
- 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 +1 -1
- package/guards/dist/xstate-guards.cjs.prod.js +1 -1
- package/guards/dist/xstate-guards.esm.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Action, EventObject, SingleOrArray, ActionFunction, ActionFunctionMap, ActionTypes, DoneEvent, ErrorPlatformEvent, DoneEventObject, MachineContext, BaseActionObject, SCXML } from './types.
|
|
2
|
-
import * as actionTypes from './actionTypes.
|
|
3
|
-
export { send, sendTo, sendParent, respond, forwardTo, escalate } from './actions/send.
|
|
4
|
-
export { stop } from './actions/stop.
|
|
5
|
-
export { log } from './actions/log.
|
|
6
|
-
export { cancel } from './actions/cancel.
|
|
7
|
-
export { assign } from './actions/assign.
|
|
8
|
-
export { raise } from './actions/raise.
|
|
9
|
-
export { choose } from './actions/choose.
|
|
1
|
+
import { Action, EventObject, SingleOrArray, ActionFunction, ActionFunctionMap, ActionTypes, DoneEvent, ErrorPlatformEvent, DoneEventObject, MachineContext, BaseActionObject, SCXML } from './types.ts';
|
|
2
|
+
import * as actionTypes from './actionTypes.ts';
|
|
3
|
+
export { send, sendTo, sendParent, respond, forwardTo, escalate } from './actions/send.ts';
|
|
4
|
+
export { stop } from './actions/stop.ts';
|
|
5
|
+
export { log } from './actions/log.ts';
|
|
6
|
+
export { cancel } from './actions/cancel.ts';
|
|
7
|
+
export { assign } from './actions/assign.ts';
|
|
8
|
+
export { raise } from './actions/raise.ts';
|
|
9
|
+
export { choose } from './actions/choose.ts';
|
|
10
10
|
export { actionTypes };
|
|
11
11
|
export declare const initEvent: SCXML.Event<{
|
|
12
12
|
type: ActionTypes;
|
|
13
13
|
}>;
|
|
14
14
|
export declare function resolveActionObject(actionObject: BaseActionObject, actionFunctionMap: ActionFunctionMap<any, any>): BaseActionObject;
|
|
15
15
|
export declare function toActionObject<TContext extends MachineContext, TEvent extends EventObject>(action: BaseActionObject | ActionFunction<TContext, TEvent> | string): BaseActionObject;
|
|
16
|
-
export declare const toActionObjects: <TContext extends MachineContext, TEvent extends EventObject>(action?: SingleOrArray<Action<TContext, TEvent
|
|
16
|
+
export declare const toActionObjects: <TContext extends MachineContext, TEvent extends EventObject>(action?: SingleOrArray<Action<TContext, TEvent>> | undefined) => BaseActionObject[];
|
|
17
17
|
/**
|
|
18
18
|
* Returns an event type that represents an implicit event that
|
|
19
19
|
* is sent after the specified `delay`.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { EventObject, ActorRef, BaseActorRef } from '../types.
|
|
2
|
-
export { fromTransition } from './transition.
|
|
3
|
-
export { fromPromise } from './promise.
|
|
4
|
-
export { fromObservable, fromEventObservable } from './observable.
|
|
5
|
-
export { fromCallback } from './callback.
|
|
1
|
+
import type { EventObject, ActorRef, BaseActorRef } from '../types.ts';
|
|
2
|
+
export { fromTransition } from './transition.ts';
|
|
3
|
+
export { fromPromise } from './promise.ts';
|
|
4
|
+
export { fromObservable, fromEventObservable } from './observable.ts';
|
|
5
|
+
export { fromCallback } from './callback.ts';
|
|
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 { AnyInterpreter, DevToolsAdapter } from '../types.
|
|
1
|
+
import { AnyInterpreter, DevToolsAdapter } from '../types.ts';
|
|
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, SCXML, GuardPredicate, MachineContext } from './types.
|
|
2
|
-
import type { State } from './State.
|
|
1
|
+
import type { EventObject, StateValue, BooleanGuardDefinition, GuardConfig, GuardDefinition, SCXML, GuardPredicate, MachineContext } from './types.ts';
|
|
2
|
+
import type { State } from './State.ts';
|
|
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,24 +1,24 @@
|
|
|
1
|
-
import { after, done, doneInvoke, escalate, forwardTo, respond, sendParent, sendTo } from './actions.
|
|
2
|
-
import { assign } from './actions/assign.
|
|
3
|
-
import { cancel } from './actions/cancel.
|
|
4
|
-
import { choose } from './actions/choose.
|
|
5
|
-
import { log } from './actions/log.
|
|
6
|
-
import { pure } from './actions/pure.
|
|
7
|
-
import { raise } from './actions/raise.
|
|
8
|
-
import { send } from './actions/send.
|
|
9
|
-
import { stop } from './actions/stop.
|
|
10
|
-
import { interpret, Interpreter, ActorStatus } from './interpreter.
|
|
11
|
-
import { createMachine } from './Machine.
|
|
12
|
-
import { mapState } from './mapState.
|
|
13
|
-
import { State } from './State.
|
|
14
|
-
import { StateNode } from './StateNode.
|
|
15
|
-
export { createSchema, t } from './schema.
|
|
16
|
-
export { SimulatedClock } from './SimulatedClock.
|
|
17
|
-
export { StateMachine } from './StateMachine.
|
|
18
|
-
export { getStateNodes } from './stateUtils.
|
|
19
|
-
export * from './typegenTypes.
|
|
20
|
-
export * from './types.
|
|
21
|
-
export { matchesState, pathToStateValue, toObserver, toSCXMLEvent } from './utils.
|
|
1
|
+
import { after, done, doneInvoke, escalate, forwardTo, respond, sendParent, sendTo } from './actions.ts';
|
|
2
|
+
import { assign } from './actions/assign.ts';
|
|
3
|
+
import { cancel } from './actions/cancel.ts';
|
|
4
|
+
import { choose } from './actions/choose.ts';
|
|
5
|
+
import { log } from './actions/log.ts';
|
|
6
|
+
import { pure } from './actions/pure.ts';
|
|
7
|
+
import { raise } from './actions/raise.ts';
|
|
8
|
+
import { send } from './actions/send.ts';
|
|
9
|
+
import { stop } from './actions/stop.ts';
|
|
10
|
+
import { interpret, Interpreter, ActorStatus } from './interpreter.ts';
|
|
11
|
+
import { createMachine } from './Machine.ts';
|
|
12
|
+
import { mapState } from './mapState.ts';
|
|
13
|
+
import { State } from './State.ts';
|
|
14
|
+
import { StateNode } from './StateNode.ts';
|
|
15
|
+
export { createSchema, t } from './schema.ts';
|
|
16
|
+
export { SimulatedClock } from './SimulatedClock.ts';
|
|
17
|
+
export { StateMachine } from './StateMachine.ts';
|
|
18
|
+
export { getStateNodes } from './stateUtils.ts';
|
|
19
|
+
export * from './typegenTypes.ts';
|
|
20
|
+
export * from './types.ts';
|
|
21
|
+
export { matchesState, pathToStateValue, toObserver, toSCXMLEvent } from './utils.ts';
|
|
22
22
|
export { StateNode, State, mapState, actions, assign, send, sendTo, sendParent, forwardTo, interpret, Interpreter, ActorStatus as InterpreterStatus, doneInvoke, createMachine };
|
|
23
23
|
declare const actions: {
|
|
24
24
|
raise: typeof raise;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AreAllImplementationsAssumedToBeProvided } from './typegenTypes.
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { symbolObservable } from './symbolObservable.ts';
|
|
2
|
+
import { AreAllImplementationsAssumedToBeProvided } from './typegenTypes.ts';
|
|
3
|
+
import type { ActorSystem, AnyActorBehavior, AnyStateMachine, EventFromBehavior, InterpreterFrom, PersistedStateFrom, RaiseActionObject, SnapshotFrom } from './types.ts';
|
|
4
|
+
import { ActorRef, DoneEvent, EventObject, InteropSubscribable, InterpreterOptions, Observer, SCXML, SendActionObject, Subscription } from './types.ts';
|
|
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;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InvokeActionObject, AnyStateMachine, Spawner, ActorRef, MachineContext, EventObject, SCXML } from '.';
|
|
1
|
+
import { InvokeActionObject, AnyStateMachine, Spawner, ActorRef, MachineContext, EventObject, SCXML } from './index.ts';
|
|
2
2
|
export declare function createSpawner<TContext extends MachineContext, TEvent extends EventObject>(self: ActorRef<any, any> | undefined, machine: AnyStateMachine, context: TContext, _event: SCXML.Event<TEvent>, mutCapturedActions: InvokeActionObject[]): Spawner;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BaseActionObject, EventObject, StateValue, TransitionConfig, TransitionDefinition, SingleOrArray, SCXML, StateValueMap, InitialTransitionConfig, MachineContext } from './types.
|
|
2
|
-
import { State } from './State.
|
|
3
|
-
import { NULL_EVENT } from './constants.
|
|
4
|
-
import type { StateNode } from './StateNode.
|
|
1
|
+
import { BaseActionObject, EventObject, StateValue, TransitionConfig, TransitionDefinition, SingleOrArray, SCXML, StateValueMap, InitialTransitionConfig, MachineContext } from './types.ts';
|
|
2
|
+
import { State } from './State.ts';
|
|
3
|
+
import { NULL_EVENT } from './constants.ts';
|
|
4
|
+
import type { StateNode } from './StateNode.ts';
|
|
5
5
|
import { AnyActorContext, AnyHistoryValue, AnyState, AnyStateMachine, AnyStateNode, AnyTransitionDefinition, DelayedTransitionDefinition, InitialTransitionDefinition, StateFromMachine } from '.';
|
|
6
6
|
type Configuration<TContext extends MachineContext, TE extends EventObject> = Iterable<StateNode<TContext, TE>>;
|
|
7
7
|
type AnyConfiguration = Configuration<any, any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventObject, IndexByType, IsNever, Prop, Values, IsAny, ActorMap, Cast, ParameterizedObject } from './types.
|
|
1
|
+
import { EventObject, IndexByType, IsNever, Prop, Values, IsAny, ActorMap, Cast, ParameterizedObject } from './types.ts';
|
|
2
2
|
export interface TypegenDisabled {
|
|
3
3
|
'@@xstate/typegen': false;
|
|
4
4
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { StateNode } from './StateNode.
|
|
2
|
-
import type { State } from './State.
|
|
3
|
-
import type { ActorStatus, Clock, Interpreter } from './interpreter.
|
|
4
|
-
import type { StateMachine } from './StateMachine.
|
|
5
|
-
import type { LifecycleSignal } from './actors/index.
|
|
6
|
-
import { TypegenDisabled, ResolveTypegenMeta, TypegenConstraint, MarkAllImplementationsAsProvided, AreAllImplementationsAssumedToBeProvided } from './typegenTypes.
|
|
1
|
+
import type { StateNode } from './StateNode.ts';
|
|
2
|
+
import type { State } from './State.ts';
|
|
3
|
+
import type { ActorStatus, Clock, Interpreter } from './interpreter.ts';
|
|
4
|
+
import type { StateMachine } from './StateMachine.ts';
|
|
5
|
+
import type { LifecycleSignal } from './actors/index.ts';
|
|
6
|
+
import { TypegenDisabled, ResolveTypegenMeta, TypegenConstraint, MarkAllImplementationsAsProvided, AreAllImplementationsAssumedToBeProvided } from './typegenTypes.ts';
|
|
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;
|
|
@@ -51,6 +51,10 @@ export interface BuiltInActionObject extends ParameterizedObject {
|
|
|
51
51
|
type: `xstate.${string}`;
|
|
52
52
|
params: Record<string, any>;
|
|
53
53
|
}
|
|
54
|
+
export interface UnifiedArg<TContext extends MachineContext, TEvent extends EventObject> {
|
|
55
|
+
context: TContext;
|
|
56
|
+
event: TEvent;
|
|
57
|
+
}
|
|
54
58
|
export interface BaseDynamicActionObject<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TResolvedAction extends BaseActionObject, TDynamicParams extends Record<string, any>> {
|
|
55
59
|
type: `xstate.${string}`;
|
|
56
60
|
params: TDynamicParams;
|
|
@@ -63,10 +67,13 @@ export interface BaseDynamicActionObject<TContext extends MachineContext, TExpre
|
|
|
63
67
|
actorContext: AnyActorContext | undefined;
|
|
64
68
|
}) => [AnyState, TResolvedAction];
|
|
65
69
|
/** @deprecated an internal signature that doesn't exist at runtime. Its existence helps TS to choose a better code path in the inference algorithm */
|
|
66
|
-
(
|
|
70
|
+
(args: {
|
|
71
|
+
context: TContext;
|
|
72
|
+
event: TExpressionEvent;
|
|
73
|
+
} & ActionMeta<TEvent, ParameterizedObject>): void;
|
|
67
74
|
}
|
|
68
75
|
export type MachineContext = Record<string, any>;
|
|
69
|
-
export interface ActionMeta<
|
|
76
|
+
export interface ActionMeta<TEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject> extends StateMeta<TEvent> {
|
|
70
77
|
action: TAction;
|
|
71
78
|
_event: SCXML.Event<TEvent>;
|
|
72
79
|
}
|
|
@@ -75,14 +82,15 @@ behavior: T, options?: Partial<{
|
|
|
75
82
|
id: string;
|
|
76
83
|
input: any;
|
|
77
84
|
}>) => T extends ActorBehavior<infer TActorEvent, infer TActorEmitted> ? ActorRef<TActorEvent, TActorEmitted> : ActorRef<any, any>;
|
|
78
|
-
export interface AssignMeta<
|
|
85
|
+
export interface AssignMeta<TExpressionEvent extends EventObject, _TEvent extends EventObject> extends StateMeta<TExpressionEvent> {
|
|
79
86
|
action: BaseActionObject;
|
|
80
87
|
_event: SCXML.Event<TExpressionEvent>;
|
|
81
88
|
spawn: Spawner;
|
|
82
89
|
}
|
|
83
|
-
export type ActionFunction<TContext extends MachineContext, TExpressionEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject, TEvent extends EventObject = TExpressionEvent> = {
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
export type ActionFunction<TContext extends MachineContext, TExpressionEvent extends EventObject, TAction extends ParameterizedObject = ParameterizedObject, TEvent extends EventObject = TExpressionEvent> = (args: {
|
|
91
|
+
context: TContext;
|
|
92
|
+
event: TExpressionEvent;
|
|
93
|
+
} & ActionMeta<TEvent, TAction>) => void;
|
|
86
94
|
export interface ChooseCondition<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject = TExpressionEvent> {
|
|
87
95
|
guard?: GuardConfig<TContext, TEvent>;
|
|
88
96
|
actions: Actions<TContext, TExpressionEvent, TEvent>;
|
|
@@ -107,7 +115,10 @@ export interface StateValueMap {
|
|
|
107
115
|
* - For complex state nodes, this is an object, e.g., `{ success: "someChildState" }`.
|
|
108
116
|
*/
|
|
109
117
|
export type StateValue = string | StateValueMap;
|
|
110
|
-
export type GuardPredicate<TContext extends MachineContext, TEvent extends EventObject> = (
|
|
118
|
+
export type GuardPredicate<TContext extends MachineContext, TEvent extends EventObject> = (args: {
|
|
119
|
+
context: TContext;
|
|
120
|
+
event: TEvent;
|
|
121
|
+
} & GuardMeta<TContext, TEvent>) => boolean;
|
|
111
122
|
export interface DefaultGuardObject<TContext extends MachineContext, TEvent extends EventObject> extends ParameterizedObject {
|
|
112
123
|
/**
|
|
113
124
|
* Nested guards
|
|
@@ -325,7 +336,6 @@ export interface StateNodeConfig<TContext extends MachineContext, TEvent extends
|
|
|
325
336
|
* @private
|
|
326
337
|
*/
|
|
327
338
|
parent?: StateNode<TContext, TEvent>;
|
|
328
|
-
strict?: boolean | undefined;
|
|
329
339
|
/**
|
|
330
340
|
* The meta data associated with this state node, which will be returned in State instances.
|
|
331
341
|
*/
|
|
@@ -623,8 +633,8 @@ export interface SendActionObject<TSentEvent extends EventObject = AnyEventObjec
|
|
|
623
633
|
internal: boolean;
|
|
624
634
|
};
|
|
625
635
|
}
|
|
626
|
-
export type Expr<TContext extends MachineContext, TEvent extends EventObject, T> = (
|
|
627
|
-
export type ExprWithMeta<TContext extends MachineContext, TEvent extends EventObject, T> = (
|
|
636
|
+
export type Expr<TContext extends MachineContext, TEvent extends EventObject, T> = (arg: UnifiedArg<TContext, TEvent>) => T;
|
|
637
|
+
export type ExprWithMeta<TContext extends MachineContext, TEvent extends EventObject, T> = (args: UnifiedArg<TContext, TEvent> & StateMeta<TEvent>) => T;
|
|
628
638
|
export type SendExpr<TContext extends MachineContext, TEvent extends EventObject, TSentEvent extends EventObject = AnyEventObject> = ExprWithMeta<TContext, TEvent, TSentEvent>;
|
|
629
639
|
export declare enum SpecialTargets {
|
|
630
640
|
Parent = "#_parent",
|
|
@@ -655,14 +665,26 @@ export interface CancelActionObject extends BaseActionObject {
|
|
|
655
665
|
sendId: string;
|
|
656
666
|
};
|
|
657
667
|
}
|
|
658
|
-
export type Assigner<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject = TExpressionEvent> = (
|
|
659
|
-
|
|
668
|
+
export type Assigner<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject = TExpressionEvent> = (args: {
|
|
669
|
+
context: TContext;
|
|
670
|
+
event: TExpressionEvent;
|
|
671
|
+
} & AssignMeta<TExpressionEvent, TEvent>) => Partial<TContext>;
|
|
672
|
+
export type PartialAssigner<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TKey extends keyof TContext> = (args: {
|
|
673
|
+
context: TContext;
|
|
674
|
+
event: TExpressionEvent;
|
|
675
|
+
} & AssignMeta<TExpressionEvent, TEvent>) => TContext[TKey];
|
|
660
676
|
export type PropertyAssigner<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject = TExpressionEvent> = {
|
|
661
677
|
[K in keyof TContext]?: PartialAssigner<TContext, TExpressionEvent, TEvent, K> | TContext[K];
|
|
662
678
|
};
|
|
663
|
-
export type Mapper<TContext extends MachineContext, TEvent extends EventObject, TParams extends {}> = (
|
|
679
|
+
export type Mapper<TContext extends MachineContext, TEvent extends EventObject, TParams extends {}> = (args: {
|
|
680
|
+
context: TContext;
|
|
681
|
+
event: TEvent;
|
|
682
|
+
}) => TParams;
|
|
664
683
|
export type PropertyMapper<TContext extends MachineContext, TEvent extends EventObject, TParams extends {}> = {
|
|
665
|
-
[K in keyof TParams]?: ((
|
|
684
|
+
[K in keyof TParams]?: ((args: {
|
|
685
|
+
context: TContext;
|
|
686
|
+
event: TEvent;
|
|
687
|
+
}) => TParams[K]) | TParams[K];
|
|
666
688
|
};
|
|
667
689
|
export interface AnyAssignAction extends BaseActionObject {
|
|
668
690
|
type: ActionTypes.Assign;
|
|
@@ -681,7 +703,10 @@ export interface AssignActionObject<TContext extends MachineContext> extends Bas
|
|
|
681
703
|
export interface DynamicPureActionObject<TContext extends MachineContext, TEvent extends EventObject> {
|
|
682
704
|
type: ActionTypes.Pure;
|
|
683
705
|
params: {
|
|
684
|
-
get: (
|
|
706
|
+
get: (args: {
|
|
707
|
+
context: TContext;
|
|
708
|
+
event: TEvent;
|
|
709
|
+
}) => SingleOrArray<BaseActionObject | BaseActionObject['type']> | undefined;
|
|
685
710
|
};
|
|
686
711
|
}
|
|
687
712
|
export interface PureActionObject extends BaseActionObject {
|
|
@@ -756,8 +781,7 @@ export interface Segment<TContext extends MachineContext, TEvent extends EventOb
|
|
|
756
781
|
*/
|
|
757
782
|
event: TEvent;
|
|
758
783
|
}
|
|
759
|
-
export interface StateMeta<
|
|
760
|
-
state: State<TContext, TEvent, any>;
|
|
784
|
+
export interface StateMeta<TEvent extends EventObject> {
|
|
761
785
|
_event: SCXML.Event<TEvent>;
|
|
762
786
|
self: ActorRef<TEvent>;
|
|
763
787
|
system: ActorSystem<any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AnyActorBehavior, AnyState } from '.';
|
|
2
|
-
import { NULL_EVENT } from './constants.
|
|
3
|
-
import type { StateNode } from './StateNode.
|
|
4
|
-
import type { ActorBehavior, EventObject, EventType, InvokeConfig, MachineContext, Mapper, Observer, PropertyMapper, SCXML, SCXMLErrorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfig, TransitionConfigTarget } from './types.
|
|
1
|
+
import { AnyActorBehavior, AnyState } from './index.ts';
|
|
2
|
+
import { NULL_EVENT } from './constants.ts';
|
|
3
|
+
import type { StateNode } from './StateNode.ts';
|
|
4
|
+
import type { ActorBehavior, EventObject, EventType, InvokeConfig, MachineContext, Mapper, Observer, PropertyMapper, SCXML, SCXMLErrorEvent, SingleOrArray, StateLike, StateValue, Subscribable, TransitionConfig, TransitionConfigTarget } from './types.ts';
|
|
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.dev.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-96f799fc.cjs.dev.js');
|
|
6
6
|
require('./index-ebaab3c9.cjs.dev.js');
|
|
7
7
|
|
|
8
8
|
function pure(getActions) {
|
|
@@ -17,7 +17,10 @@ function pure(getActions) {
|
|
|
17
17
|
return [state, {
|
|
18
18
|
type: actors_dist_xstateActors.pure,
|
|
19
19
|
params: {
|
|
20
|
-
actions: (_toArray = actors_dist_xstateActors.toArray(actors_dist_xstateActors.toActionObjects(getActions(
|
|
20
|
+
actions: (_toArray = actors_dist_xstateActors.toArray(actors_dist_xstateActors.toActionObjects(getActions({
|
|
21
|
+
context: state.context,
|
|
22
|
+
event: _event.data
|
|
23
|
+
})))) !== null && _toArray !== void 0 ? _toArray : []
|
|
21
24
|
}
|
|
22
25
|
}];
|
|
23
26
|
});
|
package/dist/xstate.cjs.prod.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-2479953d.cjs.prod.js');
|
|
6
6
|
require('../dev/dist/xstate-dev.cjs.prod.js');
|
|
7
7
|
|
|
8
8
|
function pure(getActions) {
|
|
@@ -17,7 +17,10 @@ function pure(getActions) {
|
|
|
17
17
|
return [state, {
|
|
18
18
|
type: actors_dist_xstateActors.pure,
|
|
19
19
|
params: {
|
|
20
|
-
actions: (_toArray = actors_dist_xstateActors.toArray(actors_dist_xstateActors.toActionObjects(getActions(
|
|
20
|
+
actions: (_toArray = actors_dist_xstateActors.toArray(actors_dist_xstateActors.toActionObjects(getActions({
|
|
21
|
+
context: state.context,
|
|
22
|
+
event: _event.data
|
|
23
|
+
})))) !== null && _toArray !== void 0 ? _toArray : []
|
|
21
24
|
}
|
|
22
25
|
}];
|
|
23
26
|
});
|
package/dist/xstate.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createDynamicAction, p as pure$1, t as toArray, a as toActionObjects, _ as _createClass, f as formatTransitions, b as toTransitionConfigArray, N as NULL_EVENT, d as formatTransition, m as mapValues, e as memo, g as _createForOfIteratorHelper, h as evaluateGuard, i as _toConsumableArray, j as flatten, k as _classCallCheck, l as _defineProperty, n as createInvokeId, o as toInvokeConfig, q as _objectSpread2, r as invoke, s as _objectWithoutProperties, u as getDelayedTransitions, v as formatInitialTransition, w as getCandidates, x as isString, y as createSpawner, z as createInitEvent, A as getConfiguration, B as getStateNodes, C as resolveStateValue, D as isInFinalState, S as State, E as toSCXMLEvent, F as isSCXMLErrorEvent, G as macrostep, H as transitionNode, I as _slicedToArray, J as getInitialConfiguration, K as resolveActionsAndContext, L as microstep, M as error, O as isStateId, P as getPersistedState, Q as resolveReferencedActor, R as interpret, T as STATE_DELIMITER, U as initEvent, V as matchesState, W as raise, X as send, Y as sendParent, Z as sendTo, $ as log, a0 as cancel, a1 as stop, a2 as assign, a3 as after, a4 as done, a5 as respond, a6 as forwardTo, a7 as escalate, a8 as choose } from './actions-
|
|
2
|
-
export { ae as ActionTypes, a9 as Interpreter, aa as InterpreterStatus, af as SpecialTargets, S as State, a2 as assign, ab as doneInvoke, a6 as forwardTo, B as getStateNodes, R as interpret, V as matchesState, ac as pathToStateValue, X as send, Y as sendParent, Z as sendTo, ad as toObserver, E as toSCXMLEvent } from './actions-
|
|
1
|
+
import { c as createDynamicAction, p as pure$1, t as toArray, a as toActionObjects, _ as _createClass, f as formatTransitions, b as toTransitionConfigArray, N as NULL_EVENT, d as formatTransition, m as mapValues, e as memo, g as _createForOfIteratorHelper, h as evaluateGuard, i as _toConsumableArray, j as flatten, k as _classCallCheck, l as _defineProperty, n as createInvokeId, o as toInvokeConfig, q as _objectSpread2, r as invoke, s as _objectWithoutProperties, u as getDelayedTransitions, v as formatInitialTransition, w as getCandidates, x as isString, y as createSpawner, z as createInitEvent, A as getConfiguration, B as getStateNodes, C as resolveStateValue, D as isInFinalState, S as State, E as toSCXMLEvent, F as isSCXMLErrorEvent, G as macrostep, H as transitionNode, I as _slicedToArray, J as getInitialConfiguration, K as resolveActionsAndContext, L as microstep, M as error, O as isStateId, P as getPersistedState, Q as resolveReferencedActor, R as interpret, T as STATE_DELIMITER, U as initEvent, V as matchesState, W as raise, X as send, Y as sendParent, Z as sendTo, $ as log, a0 as cancel, a1 as stop, a2 as assign, a3 as after, a4 as done, a5 as respond, a6 as forwardTo, a7 as escalate, a8 as choose } from './actions-7678b87b.esm.js';
|
|
2
|
+
export { ae as ActionTypes, a9 as Interpreter, aa as InterpreterStatus, af as SpecialTargets, S as State, a2 as assign, ab as doneInvoke, a6 as forwardTo, B as getStateNodes, R as interpret, V as matchesState, ac as pathToStateValue, X as send, Y as sendParent, Z as sendTo, ad as toObserver, E as toSCXMLEvent } from './actions-7678b87b.esm.js';
|
|
3
3
|
import './index-50bd0aff.esm.js';
|
|
4
4
|
|
|
5
5
|
function pure(getActions) {
|
|
@@ -14,7 +14,10 @@ function pure(getActions) {
|
|
|
14
14
|
return [state, {
|
|
15
15
|
type: pure$1,
|
|
16
16
|
params: {
|
|
17
|
-
actions: (_toArray = toArray(toActionObjects(getActions(
|
|
17
|
+
actions: (_toArray = toArray(toActionObjects(getActions({
|
|
18
|
+
context: state.context,
|
|
19
|
+
event: _event.data
|
|
20
|
+
})))) !== null && _toArray !== void 0 ? _toArray : []
|
|
18
21
|
}
|
|
19
22
|
}];
|
|
20
23
|
});
|