xstate 6.0.0-alpha.48 → 6.0.0-alpha.49
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 +23 -0
- package/dist/{StateMachine-b09d2b00.cjs.js → StateMachine-0adb3a70.cjs.js} +1 -1
- package/dist/{StateMachine-b3a890bf.development.cjs.js → StateMachine-29450e6d.development.cjs.js} +1 -1
- package/dist/{StateMachine-8329769a.esm.js → StateMachine-2af31c11.esm.js} +1 -1
- package/dist/{StateMachine-88b3c26a.development.esm.js → StateMachine-faf50c5c.development.esm.js} +1 -1
- package/dist/{createActor-27287c65.esm.js → createActor-268165d4.esm.js} +1 -1
- package/dist/{createActor-309d77eb.development.esm.js → createActor-88709f74.development.esm.js} +1 -1
- package/dist/{createActor-cc3d6dde.development.cjs.js → createActor-a1e0dffb.development.cjs.js} +0 -3
- package/dist/{createActor-9b41ade9.cjs.js → createActor-b4dd05ae.cjs.js} +0 -3
- package/dist/declarations/src/fsm/createFSMActor.d.ts +67 -0
- package/dist/declarations/src/fsm/index.d.ts +2 -0
- package/dist/declarations/src/fsm.d.ts +5 -4
- package/dist/{effectDescriptor-b1f5deb6.esm.js → effectDescriptor-30c9a744.esm.js} +1 -1
- package/dist/{effectDescriptor-7707794b.development.esm.js → effectDescriptor-39d22100.development.esm.js} +1 -1
- package/dist/{effectDescriptor-a1678d06.development.cjs.js → effectDescriptor-7ff6802f.development.cjs.js} +1 -1
- package/dist/{effectDescriptor-bd36a33e.cjs.js → effectDescriptor-be348e50.cjs.js} +1 -1
- package/dist/fsm-7a2e9697.cjs.js +777 -0
- package/dist/fsm-b804b3e9.esm.js +775 -0
- package/dist/fsm-c1316948.development.cjs.js +777 -0
- package/dist/fsm-e18a7cb4.development.esm.js +775 -0
- package/dist/{types-81d03bef.esm.js → types-3c3455f7.esm.js} +1 -1
- package/dist/{types-1793b8b6.development.esm.js → types-adda3842.development.esm.js} +1 -1
- package/dist/{types-7e468202.development.cjs.js → types-b3fea5bd.development.cjs.js} +1 -1
- package/dist/{types-9c1bc85f.cjs.js → types-fbabaeee.cjs.js} +1 -1
- package/dist/xstate-actors.cjs.js +1 -1
- package/dist/xstate-actors.development.cjs.js +1 -1
- package/dist/xstate-actors.development.esm.js +2 -2
- package/dist/xstate-actors.esm.js +2 -2
- package/dist/xstate-durable.cjs.js +2 -2
- package/dist/xstate-durable.development.cjs.js +2 -2
- package/dist/xstate-durable.development.esm.js +2 -2
- package/dist/xstate-durable.esm.js +2 -2
- package/dist/xstate-fsm.cjs.d.mts +2 -0
- package/dist/xstate-fsm.cjs.d.ts +2 -0
- package/dist/xstate-fsm.cjs.js +409 -0
- package/dist/xstate-fsm.cjs.mjs +5 -0
- package/dist/xstate-fsm.development.cjs.js +409 -0
- package/dist/xstate-fsm.development.cjs.mjs +5 -0
- package/dist/xstate-fsm.development.esm.js +403 -0
- package/dist/xstate-fsm.esm.js +403 -0
- package/dist/xstate-fsm.umd.min.js +2 -0
- package/dist/xstate-fsm.umd.min.js.map +1 -0
- package/dist/xstate-graph.cjs.js +2 -2
- package/dist/xstate-graph.development.cjs.js +2 -2
- package/dist/xstate-graph.development.esm.js +2 -2
- package/dist/xstate-graph.esm.js +2 -2
- package/dist/xstate-scxml.cjs.js +3 -3
- package/dist/xstate-scxml.development.cjs.js +3 -3
- package/dist/xstate-scxml.development.esm.js +3 -3
- package/dist/xstate-scxml.esm.js +3 -3
- package/dist/xstate-validation.cjs.js +1 -1
- package/dist/xstate-validation.development.cjs.js +1 -1
- package/dist/xstate-validation.development.esm.js +1 -1
- package/dist/xstate-validation.esm.js +1 -1
- package/dist/xstate.cjs.js +6 -380
- package/dist/xstate.development.cjs.js +6 -380
- package/dist/xstate.development.esm.js +10 -384
- package/dist/xstate.esm.js +10 -384
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/fsm/package.json +8 -0
- package/package.json +18 -2
package/README.md
CHANGED
|
@@ -17,6 +17,29 @@ XState is a state management and orchestration solution for JavaScript and TypeS
|
|
|
17
17
|
|
|
18
18
|
It uses event-driven programming, state machines, statecharts, and the actor model to handle complex logic in predictable, robust, and visual ways. XState provides a powerful and flexible way to manage application and workflow state by allowing developers to model logic as actors and state machines.
|
|
19
19
|
|
|
20
|
+
For flat finite state machines, `xstate/fsm` provides a self-contained compact
|
|
21
|
+
runtime and a specialized actor:
|
|
22
|
+
|
|
23
|
+
<!-- public exports from packages/core/src/fsm/index.ts; exact capabilities documented in docs/fsm.md -->
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { createFSM, createFSMActor } from 'xstate/fsm';
|
|
27
|
+
|
|
28
|
+
const logic = createFSM({
|
|
29
|
+
initial: 'inactive',
|
|
30
|
+
states: {
|
|
31
|
+
inactive: { on: { toggle: { target: 'active' } } },
|
|
32
|
+
active: { on: { toggle: { target: 'inactive' } } }
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const actor = createFSMActor(logic).start();
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
See the [exact supported surface](https://stately.ai/docs/fsm). Use the root `xstate`
|
|
40
|
+
entry point for compound or parallel statecharts, invocation, named sources,
|
|
41
|
+
schemas, serialization and inspection.
|
|
42
|
+
|
|
20
43
|
### ✨ Create state machines visually in Stately Studio → [state.new](https://state.new)
|
|
21
44
|
|
|
22
45
|
---
|
package/dist/{StateMachine-b3a890bf.development.cjs.js → StateMachine-29450e6d.development.cjs.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createActor = require('./createActor-
|
|
3
|
+
var createActor = require('./createActor-a1e0dffb.development.cjs.js');
|
|
4
4
|
var validation = require('./validation-f2714a35.development.cjs.js');
|
|
5
5
|
|
|
6
6
|
function createSpawner(actorScope, actors, spawnedChildren) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as resolveRegisteredActorSource, M as allocateChildId, N as assertChildIdFree, O as reserveChildId, S as STATE_DELIMITER, P as mapValues, t as toArray, Q as createInvokeId, R as getDelayedTransitions, T as getEventDescriptorKey, U as getCandidates, V as evaluateCandidate, W as formatTransition, Y as NULL_EVENT, Z as toTransitionConfigArray, _ as createInvokeTimeoutEventId, $ as matchesActorSession, a0 as formatRouteTransitions, a1 as resolveStateValue, a2 as getAllStateNodes, f as getStateNodes, a3 as createMachineSnapshot, a4 as isInFinalState, a5 as createInertActorScope, a6 as setInertActorScopeSnapshot, a7 as beginSpawnAllocation, a8 as attachSnapshotActorRef, a9 as macrostep, aa as isInertActorScope, ab as setSnapshotActorRef, ac as cloneMachineSnapshot, ad as transitionNode, J as XSTATE_TIMER, m as matchesEventDescriptor, ae as getTransitionResult, af as hasEffect, ag as createErrorPlatformEvent, ah as withActorSelf, ai as resolveActionsWithContext, aj as takeSpawnAllocationCounters, ak as mergeActorIdCounters, y as createInitEvent, al as createSpawnEffect, am as initialMicrostep, an as toStatePath, ao as isStateId, ap as getStateNodeByPath, aq as getPersistedSnapshot, ar as createRemoteActorRef, as as resolveReferencedActor, at as createInvokeTimeoutEvent, au as parseGeneratedActorId, av as ACTOR_REF_TYPE, c as createActor } from './createActor-268165d4.esm.js';
|
|
2
2
|
import { a as assertValid } from './validation-05f1d517.esm.js';
|
|
3
3
|
|
|
4
4
|
function createSpawner(actorScope, actors, spawnedChildren) {
|
package/dist/{StateMachine-88b3c26a.development.esm.js → StateMachine-faf50c5c.development.esm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as resolveRegisteredActorSource, M as allocateChildId, N as assertChildIdFree, O as reserveChildId, S as STATE_DELIMITER, P as mapValues, t as toArray, Q as createInvokeId, R as getDelayedTransitions, T as getEventDescriptorKey, U as getCandidates, V as evaluateCandidate, W as formatTransition, Y as NULL_EVENT, Z as toTransitionConfigArray, _ as createInvokeTimeoutEventId, $ as matchesActorSession, a0 as formatRouteTransitions, a1 as resolveStateValue, a2 as getAllStateNodes, f as getStateNodes, a3 as createMachineSnapshot, a4 as isInFinalState, a5 as createInertActorScope, a6 as setInertActorScopeSnapshot, a7 as beginSpawnAllocation, a8 as attachSnapshotActorRef, a9 as macrostep, aa as isInertActorScope, ab as setSnapshotActorRef, ac as cloneMachineSnapshot, ad as transitionNode, J as XSTATE_TIMER, m as matchesEventDescriptor, ae as getTransitionResult, af as hasEffect, ag as createErrorPlatformEvent, ah as withActorSelf, ai as resolveActionsWithContext, aj as takeSpawnAllocationCounters, ak as mergeActorIdCounters, y as createInitEvent, al as createSpawnEffect, am as initialMicrostep, an as toStatePath, ao as isStateId, ap as getStateNodeByPath, aq as getPersistedSnapshot, ar as createRemoteActorRef, as as resolveReferencedActor, at as createInvokeTimeoutEvent, au as parseGeneratedActorId, av as ACTOR_REF_TYPE, c as createActor } from './createActor-88709f74.development.esm.js';
|
|
2
2
|
import { a as assertValid } from './validation-e69470ad.development.esm.js';
|
|
3
3
|
|
|
4
4
|
function createSpawner(actorScope, actors, spawnedChildren) {
|
|
@@ -5755,4 +5755,4 @@ function createActor(logic, options) {
|
|
|
5755
5755
|
return new Actor(logic, options);
|
|
5756
5756
|
}
|
|
5757
5757
|
|
|
5758
|
-
export {
|
|
5758
|
+
export { matchesActorSession as $, Actor as A, XSTATE_LOGIC_EFFECT_START as B, XSTATE_LOGIC_EFFECT_RESOLVE as C, XSTATE_LOGIC_EFFECT_REJECT as D, finalizeTransitionResult as E, createEmitEffect as F, createSendToEffect as G, XSTATE_INIT as H, withActorScope as I, XSTATE_TIMER as J, isLazyActorScope as K, resolveRegisteredActorSource as L, allocateChildId as M, assertChildIdFree as N, reserveChildId as O, mapValues as P, createInvokeId as Q, getDelayedTransitions as R, STATE_DELIMITER as S, getEventDescriptorKey as T, getCandidates as U, evaluateCandidate as V, formatTransition as W, XSTATE_STOP as X, NULL_EVENT as Y, toTransitionConfigArray as Z, createInvokeTimeoutEventId as _, createListenerLogic as a, formatRouteTransitions as a0, resolveStateValue as a1, getAllStateNodes as a2, createMachineSnapshot as a3, isInFinalState as a4, createInertActorScope as a5, setInertActorScopeSnapshot as a6, beginSpawnAllocation as a7, attachSnapshotActorRef as a8, macrostep as a9, getAllOwnEvents as aA, matchesEvent as aB, encodeAddressSegment as aC, getRootActorId as aD, RUNTIME_OPERATIONS as aE, withSystemInspector as aF, getSnapshotActorRef as aG, withExecutionIdentity as aH, isInertActorScope as aa, setSnapshotActorRef as ab, cloneMachineSnapshot as ac, transitionNode as ad, getTransitionResult as ae, hasEffect as af, createErrorPlatformEvent as ag, withActorSelf as ah, resolveActionsWithContext as ai, takeSpawnAllocationCounters as aj, mergeActorIdCounters as ak, createSpawnEffect as al, initialMicrostep as am, toStatePath as an, isStateId as ao, getStateNodeByPath as ap, getPersistedSnapshot as aq, createRemoteActorRef as ar, resolveReferencedActor as as, createInvokeTimeoutEvent as at, parseGeneratedActorId as au, ACTOR_REF_TYPE as av, hasAmbientInspector as aw, getProperAncestors as ax, isRemoteActorRef as ay, getActorIdPrefix as az, createSubscriptionLogic as b, createActor as c, getNextSnapshot as d, isMachineSnapshot as e, getStateNodes as f, getInitialSnapshot as g, getAllOwnEventDescriptors as h, isAtomicStateNode as i, matchesState as j, checkStateIn as k, listenerLogic as l, matchesEventDescriptor as m, pathToStateValue as n, toObserver as o, parseDelayToMilliseconds as p, executeEffects as q, isBuiltInExecutableAction as r, subscriptionLogic as s, toArray as t, deliverEvent as u, runStep as v, stopActor as w, terminateActor as x, createInitEvent as y, createCustomEffect as z };
|
package/dist/{createActor-309d77eb.development.esm.js → createActor-88709f74.development.esm.js}
RENAMED
|
@@ -5794,4 +5794,4 @@ function createActor(logic, options) {
|
|
|
5794
5794
|
return new Actor(logic, options);
|
|
5795
5795
|
}
|
|
5796
5796
|
|
|
5797
|
-
export {
|
|
5797
|
+
export { matchesActorSession as $, Actor as A, XSTATE_LOGIC_EFFECT_START as B, XSTATE_LOGIC_EFFECT_RESOLVE as C, XSTATE_LOGIC_EFFECT_REJECT as D, finalizeTransitionResult as E, createEmitEffect as F, createSendToEffect as G, XSTATE_INIT as H, withActorScope as I, XSTATE_TIMER as J, isLazyActorScope as K, resolveRegisteredActorSource as L, allocateChildId as M, assertChildIdFree as N, reserveChildId as O, mapValues as P, createInvokeId as Q, getDelayedTransitions as R, STATE_DELIMITER as S, getEventDescriptorKey as T, getCandidates as U, evaluateCandidate as V, formatTransition as W, XSTATE_STOP as X, NULL_EVENT as Y, toTransitionConfigArray as Z, createInvokeTimeoutEventId as _, createListenerLogic as a, formatRouteTransitions as a0, resolveStateValue as a1, getAllStateNodes as a2, createMachineSnapshot as a3, isInFinalState as a4, createInertActorScope as a5, setInertActorScopeSnapshot as a6, beginSpawnAllocation as a7, attachSnapshotActorRef as a8, macrostep as a9, getAllOwnEvents as aA, matchesEvent as aB, encodeAddressSegment as aC, getRootActorId as aD, RUNTIME_OPERATIONS as aE, withSystemInspector as aF, getSnapshotActorRef as aG, withExecutionIdentity as aH, isInertActorScope as aa, setSnapshotActorRef as ab, cloneMachineSnapshot as ac, transitionNode as ad, getTransitionResult as ae, hasEffect as af, createErrorPlatformEvent as ag, withActorSelf as ah, resolveActionsWithContext as ai, takeSpawnAllocationCounters as aj, mergeActorIdCounters as ak, createSpawnEffect as al, initialMicrostep as am, toStatePath as an, isStateId as ao, getStateNodeByPath as ap, getPersistedSnapshot as aq, createRemoteActorRef as ar, resolveReferencedActor as as, createInvokeTimeoutEvent as at, parseGeneratedActorId as au, ACTOR_REF_TYPE as av, hasAmbientInspector as aw, getProperAncestors as ax, isRemoteActorRef as ay, getActorIdPrefix as az, createSubscriptionLogic as b, createActor as c, getNextSnapshot as d, isMachineSnapshot as e, getStateNodes as f, getInitialSnapshot as g, getAllOwnEventDescriptors as h, isAtomicStateNode as i, matchesState as j, checkStateIn as k, listenerLogic as l, matchesEventDescriptor as m, pathToStateValue as n, toObserver as o, parseDelayToMilliseconds as p, executeEffects as q, isBuiltInExecutableAction as r, subscriptionLogic as s, toArray as t, deliverEvent as u, runStep as v, stopActor as w, terminateActor as x, createInitEvent as y, createCustomEffect as z };
|
package/dist/{createActor-cc3d6dde.development.cjs.js → createActor-a1e0dffb.development.cjs.js}
RENAMED
|
@@ -5811,7 +5811,6 @@ exports.allocateChildId = allocateChildId;
|
|
|
5811
5811
|
exports.assertChildIdFree = assertChildIdFree;
|
|
5812
5812
|
exports.attachSnapshotActorRef = attachSnapshotActorRef;
|
|
5813
5813
|
exports.beginSpawnAllocation = beginSpawnAllocation;
|
|
5814
|
-
exports.builtInActions = builtInActions;
|
|
5815
5814
|
exports.checkStateIn = checkStateIn;
|
|
5816
5815
|
exports.cloneMachineSnapshot = cloneMachineSnapshot;
|
|
5817
5816
|
exports.createActor = createActor;
|
|
@@ -5829,9 +5828,7 @@ exports.createRemoteActorRef = createRemoteActorRef;
|
|
|
5829
5828
|
exports.createSendToEffect = createSendToEffect;
|
|
5830
5829
|
exports.createSpawnEffect = createSpawnEffect;
|
|
5831
5830
|
exports.createSubscriptionLogic = createSubscriptionLogic;
|
|
5832
|
-
exports.createTransitionEnqueue = createTransitionEnqueue;
|
|
5833
5831
|
exports.deliverEvent = deliverEvent;
|
|
5834
|
-
exports.deriveDeferredStarts = deriveDeferredStarts;
|
|
5835
5832
|
exports.encodeAddressSegment = encodeAddressSegment;
|
|
5836
5833
|
exports.evaluateCandidate = evaluateCandidate;
|
|
5837
5834
|
exports.executeEffects = executeEffects;
|
|
@@ -5772,7 +5772,6 @@ exports.allocateChildId = allocateChildId;
|
|
|
5772
5772
|
exports.assertChildIdFree = assertChildIdFree;
|
|
5773
5773
|
exports.attachSnapshotActorRef = attachSnapshotActorRef;
|
|
5774
5774
|
exports.beginSpawnAllocation = beginSpawnAllocation;
|
|
5775
|
-
exports.builtInActions = builtInActions;
|
|
5776
5775
|
exports.checkStateIn = checkStateIn;
|
|
5777
5776
|
exports.cloneMachineSnapshot = cloneMachineSnapshot;
|
|
5778
5777
|
exports.createActor = createActor;
|
|
@@ -5790,9 +5789,7 @@ exports.createRemoteActorRef = createRemoteActorRef;
|
|
|
5790
5789
|
exports.createSendToEffect = createSendToEffect;
|
|
5791
5790
|
exports.createSpawnEffect = createSpawnEffect;
|
|
5792
5791
|
exports.createSubscriptionLogic = createSubscriptionLogic;
|
|
5793
|
-
exports.createTransitionEnqueue = createTransitionEnqueue;
|
|
5794
5792
|
exports.deliverEvent = deliverEvent;
|
|
5795
|
-
exports.deriveDeferredStarts = deriveDeferredStarts;
|
|
5796
5793
|
exports.encodeAddressSegment = encodeAddressSegment;
|
|
5797
5794
|
exports.evaluateCandidate = evaluateCandidate;
|
|
5798
5795
|
exports.executeEffects = executeEffects;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ActorOptions, AnyActorLogic, EventFromLogic, InputFrom, Observer, SnapshotFrom } from "../types.js";
|
|
2
|
+
/** A compact actor runtime for logic returned by `createFSM(...)`. */
|
|
3
|
+
export declare class FSMActor<TLogic extends AnyActorLogic> {
|
|
4
|
+
readonly logic: TLogic;
|
|
5
|
+
private readonly options;
|
|
6
|
+
private _snapshot;
|
|
7
|
+
private _effects;
|
|
8
|
+
private _queue;
|
|
9
|
+
private _processing;
|
|
10
|
+
private _observers;
|
|
11
|
+
private _listeners;
|
|
12
|
+
private _trigger;
|
|
13
|
+
private _restored;
|
|
14
|
+
_processingStatus: any;
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly sessionId: string;
|
|
17
|
+
readonly address: string;
|
|
18
|
+
readonly ref: this;
|
|
19
|
+
readonly src: string | AnyActorLogic;
|
|
20
|
+
readonly system: any;
|
|
21
|
+
readonly _parent: any;
|
|
22
|
+
constructor(logic: TLogic, options?: ActorOptions<TLogic>);
|
|
23
|
+
private get self();
|
|
24
|
+
private get logger();
|
|
25
|
+
private defer;
|
|
26
|
+
private get emit();
|
|
27
|
+
private stopChild;
|
|
28
|
+
private actionExecutor;
|
|
29
|
+
start(): this;
|
|
30
|
+
send(event: EventFromLogic<TLogic>): void;
|
|
31
|
+
_send(event: EventFromLogic<TLogic>): void;
|
|
32
|
+
private flush;
|
|
33
|
+
private runEffects;
|
|
34
|
+
getSnapshot(): SnapshotFrom<TLogic>;
|
|
35
|
+
getPersistedSnapshot(options?: unknown): import("../types.js").Snapshot<unknown>;
|
|
36
|
+
toJSON(): {
|
|
37
|
+
xstate$type: string;
|
|
38
|
+
id: string;
|
|
39
|
+
address: string;
|
|
40
|
+
src: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
_stop(): this;
|
|
43
|
+
stop(): this;
|
|
44
|
+
subscribe(observerOrNext?: Observer<SnapshotFrom<TLogic>> | ((snapshot: SnapshotFrom<TLogic>) => void), error?: (error: unknown) => void, complete?: () => void): {
|
|
45
|
+
unsubscribe(): void;
|
|
46
|
+
};
|
|
47
|
+
on(type: string, handler: (event: any) => void): {
|
|
48
|
+
unsubscribe: () => boolean;
|
|
49
|
+
};
|
|
50
|
+
_emit(event: any): void;
|
|
51
|
+
_terminate(termination: any): void;
|
|
52
|
+
private fail;
|
|
53
|
+
private notify;
|
|
54
|
+
_isRunning(): boolean;
|
|
55
|
+
_inspectTransition(): void;
|
|
56
|
+
get trigger(): any;
|
|
57
|
+
select<T>(selector: (snapshot: SnapshotFrom<TLogic>) => T, equal?: (a: T, b: T) => boolean): {
|
|
58
|
+
get: () => T;
|
|
59
|
+
subscribe: (observerOrNext: Observer<T> | ((value: T) => void)) => {
|
|
60
|
+
unsubscribe(): void;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
[Symbol.observable](): this;
|
|
64
|
+
}
|
|
65
|
+
export declare function createFSMActor<TLogic extends AnyActorLogic>(logic: TLogic, options?: ActorOptions<TLogic> & {
|
|
66
|
+
[K in undefined extends InputFrom<TLogic> ? never : 'input']: unknown;
|
|
67
|
+
}): FSMActor<TLogic>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ActorLogic, EventObject, MachineContext, LogicalTimer, NonReducibleUnknown, Snapshot } from "./types.js";
|
|
1
|
+
import type { ActorLogic, EnqueueObject, EventObject, MachineContext, LogicalTimer, NonReducibleUnknown, Snapshot } from "./types.js";
|
|
3
2
|
export type FSMSnapshot<TContext extends MachineContext, TState extends string, TInput = unknown> = Snapshot<undefined> & {
|
|
4
3
|
value: TState;
|
|
5
4
|
context: TContext;
|
|
@@ -31,7 +30,7 @@ type FSMArgs<TContext extends MachineContext, TEvent extends EventObject, TState
|
|
|
31
30
|
};
|
|
32
31
|
type FSMAction<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput> & {
|
|
33
32
|
input: Record<string, unknown> | undefined;
|
|
34
|
-
}, enq:
|
|
33
|
+
}, enq: EnqueueObject<TEvent, EventObject>) => void | {
|
|
35
34
|
context?: FSMContextPatch<TContext>;
|
|
36
35
|
};
|
|
37
36
|
type FSMGuard<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput>) => boolean;
|
|
@@ -52,14 +51,16 @@ type FSMTarget<TContext extends MachineContext> = {
|
|
|
52
51
|
type FSMObjectTarget<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = Omit<FSMTarget<TContext>, 'context'> & {
|
|
53
52
|
context?: FSMContextPatch<TContext> | FSMContextMapper<TContext, TEvent, TState, TInput>;
|
|
54
53
|
};
|
|
55
|
-
type FSMTransitionFunction<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput>, enq:
|
|
54
|
+
type FSMTransitionFunction<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = (args: FSMArgs<TContext, TEvent, TState, TInput>, enq: EnqueueObject<TEvent, EventObject>) => void | false | FSMTarget<TContext>;
|
|
56
55
|
type FSMTransition<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = FSMObjectTarget<TContext, TEvent, TState, TInput> | (FSMObjectTarget<TContext, TEvent, TState, TInput> & {
|
|
57
56
|
guard?: FSMGuard<TContext, TEvent, TState, TInput>;
|
|
58
57
|
actions?: FSMAction<TContext, TEvent, TState, TInput> | Array<FSMAction<TContext, TEvent, TState, TInput>>;
|
|
59
58
|
}) | FSMTransitionFunction<TContext, TEvent, TState, TInput>;
|
|
60
59
|
type FSMStateConfig<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput> = {
|
|
60
|
+
type?: 'final';
|
|
61
61
|
entry?: FSMAction<TContext, TEvent, TState, TInput> | Array<FSMAction<TContext, TEvent, TState, TInput>>;
|
|
62
62
|
exit?: FSMAction<TContext, TEvent, TState, TInput> | Array<FSMAction<TContext, TEvent, TState, TInput>>;
|
|
63
|
+
always?: FSMTransition<TContext, TEvent, TState, TInput> | Array<FSMTransition<TContext, TEvent, TState, TInput>>;
|
|
63
64
|
on?: Record<string, FSMTransition<TContext, TEvent, TState, TInput> | Array<FSMTransition<TContext, TEvent, TState, TInput>>>;
|
|
64
65
|
};
|
|
65
66
|
export type FSMConfig<TContext extends MachineContext, TEvent extends EventObject, TState extends string, TInput = NonReducibleUnknown> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a5 as createInertActorScope, a6 as setInertActorScopeSnapshot, E as finalizeTransitionResult, a8 as attachSnapshotActorRef, y as createInitEvent, aw as hasAmbientInspector, a7 as beginSpawnAllocation, a9 as macrostep, al as createSpawnEffect, am as initialMicrostep, i as isAtomicStateNode, ax as getProperAncestors, ay as isRemoteActorRef, az as getActorIdPrefix } from './createActor-268165d4.esm.js';
|
|
2
2
|
|
|
3
3
|
function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
|
|
4
4
|
if (!microsteps.length) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a5 as createInertActorScope, a6 as setInertActorScopeSnapshot, E as finalizeTransitionResult, a8 as attachSnapshotActorRef, y as createInitEvent, aw as hasAmbientInspector, a7 as beginSpawnAllocation, a9 as macrostep, al as createSpawnEffect, am as initialMicrostep, i as isAtomicStateNode, ax as getProperAncestors, ay as isRemoteActorRef, az as getActorIdPrefix } from './createActor-88709f74.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
|
|
4
4
|
if (!microsteps.length) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var createActor = require('./createActor-
|
|
3
|
+
var createActor = require('./createActor-a1e0dffb.development.cjs.js');
|
|
4
4
|
|
|
5
5
|
function attachMicrostepActorRefs(microsteps, actorScope, inputSnapshot) {
|
|
6
6
|
if (!microsteps.length) {
|