xstate 5.25.1 → 5.26.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/actions/dist/xstate-actions.cjs.js +3 -3
- package/actions/dist/xstate-actions.development.cjs.js +3 -3
- package/actions/dist/xstate-actions.development.esm.js +3 -3
- package/actions/dist/xstate-actions.esm.js +3 -3
- 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/dist/{StateMachine-fee05db8.cjs.js → StateMachine-29d33e13.cjs.js} +2 -2
- package/dist/{StateMachine-6d24a98f.development.cjs.js → StateMachine-3a7b3253.development.cjs.js} +2 -2
- package/dist/{StateMachine-d0e98d09.development.esm.js → StateMachine-ceed8de1.development.esm.js} +2 -2
- package/dist/{StateMachine-6c48f805.esm.js → StateMachine-d08f7a0b.esm.js} +2 -2
- package/dist/{assign-541a432d.development.esm.js → assign-382e15e2.development.esm.js} +1 -1
- package/dist/{assign-37a2fc1e.esm.js → assign-5d7df46f.esm.js} +1 -1
- package/dist/{assign-577bb842.development.cjs.js → assign-6a45790f.development.cjs.js} +1 -1
- package/dist/{assign-592716a8.cjs.js → assign-9271e302.cjs.js} +1 -1
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/stateUtils.d.ts +2 -0
- package/dist/declarations/src/transition.d.ts +26 -1
- package/dist/{log-ce14fc9a.esm.js → log-46a8697a.esm.js} +2 -2
- package/dist/{log-3827c227.development.cjs.js → log-661c5df8.development.cjs.js} +2 -2
- package/dist/{log-b8ca474e.development.esm.js → log-d09f274f.development.esm.js} +2 -2
- package/dist/{log-9c9f917d.cjs.js → log-fe39762e.cjs.js} +2 -2
- package/dist/{raise-13a60c49.development.esm.js → raise-13e2f823.development.esm.js} +4 -2
- package/dist/{raise-577e4163.cjs.js → raise-df325116.cjs.js} +5 -1
- package/dist/{raise-ed7c6f3d.development.cjs.js → raise-e47e3273.development.cjs.js} +5 -1
- package/dist/{raise-f5c7cb5b.esm.js → raise-f11495d1.esm.js} +4 -2
- package/dist/xstate.cjs.js +61 -4
- package/dist/xstate.cjs.mjs +1 -0
- package/dist/xstate.development.cjs.js +61 -4
- package/dist/xstate.development.cjs.mjs +1 -0
- package/dist/xstate.development.esm.js +65 -9
- package/dist/xstate.esm.js +65 -9
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/graph/dist/xstate-graph.cjs.js +3 -3
- package/graph/dist/xstate-graph.development.cjs.js +3 -3
- package/graph/dist/xstate-graph.development.esm.js +3 -3
- package/graph/dist/xstate-graph.esm.js +3 -3
- package/graph/dist/xstate-graph.umd.min.js +1 -1
- package/graph/dist/xstate-graph.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/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var guards_dist_xstateGuards = require('../../dist/raise-
|
|
5
|
+
var guards_dist_xstateGuards = require('../../dist/raise-df325116.cjs.js');
|
|
6
6
|
require('../../dev/dist/xstate-dev.cjs.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var guards_dist_xstateGuards = require('../../dist/raise-
|
|
5
|
+
var guards_dist_xstateGuards = require('../../dist/raise-e47e3273.development.cjs.js');
|
|
6
6
|
require('../../dev/dist/xstate-dev.development.cjs.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
4
|
-
var assign = require('./assign-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-df325116.cjs.js');
|
|
4
|
+
var assign = require('./assign-9271e302.cjs.js');
|
|
5
5
|
|
|
6
6
|
const cache = new WeakMap();
|
|
7
7
|
function memo(object, key, fn) {
|
package/dist/{StateMachine-6d24a98f.development.cjs.js → StateMachine-3a7b3253.development.cjs.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
4
|
-
var assign = require('./assign-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-e47e3273.development.cjs.js');
|
|
4
|
+
var assign = require('./assign-6a45790f.development.cjs.js');
|
|
5
5
|
|
|
6
6
|
const cache = new WeakMap();
|
|
7
7
|
function memo(object, key, fn) {
|
package/dist/{StateMachine-d0e98d09.development.esm.js → StateMachine-ceed8de1.development.esm.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER,
|
|
2
|
-
import { a as assign } from './assign-
|
|
1
|
+
import { S as STATE_DELIMITER, v as mapValues, t as toArray, w as formatTransitions, x as toTransitionConfigArray, y as formatTransition, N as NULL_EVENT, z as evaluateGuard, B as createInvokeId, C as getDelayedTransitions, D as formatInitialTransition, E as getCandidates, F as resolveStateValue, G as getAllStateNodes, j as getStateNodes, H as createMachineSnapshot, I as isInFinalState, J as macrostep, K as transitionNode, L as resolveActionsAndContext, M as createInitEvent, O as microstep, P as getInitialStateNodes, Q as toStatePath, R as isStateId, T as getStateNodeByPath, U as getPersistedSnapshot, V as resolveReferencedActor, c as createActor, $ as $$ACTOR_TYPE } from './raise-13e2f823.development.esm.js';
|
|
2
|
+
import { a as assign } from './assign-382e15e2.development.esm.js';
|
|
3
3
|
|
|
4
4
|
const cache = new WeakMap();
|
|
5
5
|
function memo(object, key, fn) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as STATE_DELIMITER,
|
|
2
|
-
import { a as assign } from './assign-
|
|
1
|
+
import { S as STATE_DELIMITER, v as mapValues, t as toArray, w as formatTransitions, x as toTransitionConfigArray, y as formatTransition, N as NULL_EVENT, z as evaluateGuard, B as createInvokeId, C as getDelayedTransitions, D as formatInitialTransition, E as getCandidates, F as resolveStateValue, G as getAllStateNodes, j as getStateNodes, H as createMachineSnapshot, I as isInFinalState, J as macrostep, K as transitionNode, L as resolveActionsAndContext, M as createInitEvent, O as microstep, P as getInitialStateNodes, Q as toStatePath, R as isStateId, T as getStateNodeByPath, U as getPersistedSnapshot, V as resolveReferencedActor, c as createActor, $ as $$ACTOR_TYPE } from './raise-f11495d1.esm.js';
|
|
2
|
+
import { a as assign } from './assign-5d7df46f.esm.js';
|
|
3
3
|
|
|
4
4
|
const cache = new WeakMap();
|
|
5
5
|
function memo(object, key, fn) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as ProcessingStatus, V as resolveReferencedActor, c as createActor, a0 as cloneMachineSnapshot, W as executingCustomAction } from './raise-13e2f823.development.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Z as ProcessingStatus, V as resolveReferencedActor, c as createActor, _ as cloneMachineSnapshot } from './raise-f11495d1.esm.js';
|
|
2
2
|
|
|
3
3
|
function createSpawner(actorScope, {
|
|
4
4
|
machine,
|
|
@@ -17,7 +17,7 @@ export type { ActorSystem } from "./system.js";
|
|
|
17
17
|
export { toPromise } from "./toPromise.js";
|
|
18
18
|
export * from "./types.js";
|
|
19
19
|
export { getAllOwnEventDescriptors as __unsafe_getAllOwnEventDescriptors, matchesState, pathToStateValue, toObserver } from "./utils.js";
|
|
20
|
-
export { transition, initialTransition } from "./transition.js";
|
|
20
|
+
export { transition, initialTransition, getNextTransitions } from "./transition.js";
|
|
21
21
|
export { waitFor } from "./waitFor.js";
|
|
22
22
|
declare global {
|
|
23
23
|
interface SymbolConstructor {
|
|
@@ -3,6 +3,8 @@ import type { StateNode } from "./StateNode.js";
|
|
|
3
3
|
import { ActionArgs, AnyEventObject, AnyMachineSnapshot, AnyStateNode, AnyTransitionDefinition, DelayedTransitionDefinition, EventObject, InitialTransitionConfig, InitialTransitionDefinition, MachineContext, StateValue, TransitionDefinition, TODO, UnknownAction, ParameterizedObject, AnyTransitionConfig, AnyActorScope } from "./types.js";
|
|
4
4
|
type StateNodeIterable<TContext extends MachineContext, TE extends EventObject> = Iterable<StateNode<TContext, TE>>;
|
|
5
5
|
type AnyStateNodeIterable = StateNodeIterable<any, any>;
|
|
6
|
+
export declare function isAtomicStateNode(stateNode: StateNode<any, any>): boolean;
|
|
7
|
+
export declare function getProperAncestors(stateNode: AnyStateNode, toStateNode: AnyStateNode | undefined): Array<typeof stateNode>;
|
|
6
8
|
export declare function getAllStateNodes(stateNodes: Iterable<AnyStateNode>): Set<AnyStateNode>;
|
|
7
9
|
export declare function getStateValue(rootNode: AnyStateNode, stateNodes: AnyStateNodeIterable): StateValue;
|
|
8
10
|
export declare function isInFinalState(stateNodeSet: Set<AnyStateNode>, stateNode: AnyStateNode): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyActorLogic, EventFromLogic, InputFrom, SnapshotFrom, ExecutableActionsFrom } from "./types.js";
|
|
1
|
+
import { AnyActorLogic, EventFromLogic, InputFrom, SnapshotFrom, ExecutableActionsFrom, AnyTransitionDefinition, AnyMachineSnapshot } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Given actor `logic`, a `snapshot`, and an `event`, returns a tuple of the
|
|
4
4
|
* `nextSnapshot` and `actions` to execute.
|
|
@@ -14,3 +14,28 @@ export declare function transition<T extends AnyActorLogic>(logic: T, snapshot:
|
|
|
14
14
|
* This is a pure function that does not execute `actions`.
|
|
15
15
|
*/
|
|
16
16
|
export declare function initialTransition<T extends AnyActorLogic>(logic: T, ...[input]: undefined extends InputFrom<T> ? [input?: InputFrom<T>] : [input: InputFrom<T>]): [SnapshotFrom<T>, ExecutableActionsFrom<T>[]];
|
|
17
|
+
/**
|
|
18
|
+
* Gets all potential next transitions from the current state.
|
|
19
|
+
*
|
|
20
|
+
* Returns all transitions that are available from the current state, including:
|
|
21
|
+
*
|
|
22
|
+
* - All transitions from atomic states (leaf states in the current state
|
|
23
|
+
* configuration)
|
|
24
|
+
* - All transitions from ancestor states (parent states that may handle events)
|
|
25
|
+
* - All guarded transitions (regardless of whether their guards would pass)
|
|
26
|
+
* - Always (eventless) transitions
|
|
27
|
+
* - After (delayed) transitions
|
|
28
|
+
*
|
|
29
|
+
* The order of transitions is deterministic:
|
|
30
|
+
*
|
|
31
|
+
* 1. Atomic states are processed in document order
|
|
32
|
+
* 2. For each atomic state, transitions are collected from the state itself first,
|
|
33
|
+
* then its ancestors
|
|
34
|
+
* 3. Within each state node, transitions are in the order they appear in the state
|
|
35
|
+
* definition
|
|
36
|
+
*
|
|
37
|
+
* @param state - The current machine snapshot
|
|
38
|
+
* @returns Array of transition definitions from the current state, in
|
|
39
|
+
* deterministic order
|
|
40
|
+
*/
|
|
41
|
+
export declare function getNextTransitions(state: AnyMachineSnapshot): AnyTransitionDefinition[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as assign } from './assign-
|
|
1
|
+
import { W as XSTATE_ERROR, Y as createErrorActorEvent, z as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-f11495d1.esm.js';
|
|
2
|
+
import { a as assign } from './assign-5d7df46f.esm.js';
|
|
3
3
|
|
|
4
4
|
function resolveEmit(_, snapshot, args, actionParams, {
|
|
5
5
|
event: eventOrExpr
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
4
|
-
var assign = require('./assign-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-e47e3273.development.cjs.js');
|
|
4
|
+
var assign = require('./assign-6a45790f.development.cjs.js');
|
|
5
5
|
|
|
6
6
|
function resolveEmit(_, snapshot, args, actionParams, {
|
|
7
7
|
event: eventOrExpr
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as assign } from './assign-
|
|
1
|
+
import { W as executingCustomAction, Y as XSTATE_ERROR, Z as createErrorActorEvent, z as evaluateGuard, a as cancel, r as raise, b as spawnChild, s as stopChild } from './raise-13e2f823.development.esm.js';
|
|
2
|
+
import { a as assign } from './assign-382e15e2.development.esm.js';
|
|
3
3
|
|
|
4
4
|
function resolveEmit(_, snapshot, args, actionParams, {
|
|
5
5
|
event: eventOrExpr
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
4
|
-
var assign = require('./assign-
|
|
3
|
+
var guards_dist_xstateGuards = require('./raise-df325116.cjs.js');
|
|
4
|
+
var assign = require('./assign-9271e302.cjs.js');
|
|
5
5
|
|
|
6
6
|
function resolveEmit(_, snapshot, args, actionParams, {
|
|
7
7
|
event: eventOrExpr
|
|
@@ -1575,7 +1575,9 @@ function evaluateGuard(guard, context, event, snapshot) {
|
|
|
1575
1575
|
);
|
|
1576
1576
|
}
|
|
1577
1577
|
|
|
1578
|
-
|
|
1578
|
+
function isAtomicStateNode(stateNode) {
|
|
1579
|
+
return stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
1580
|
+
}
|
|
1579
1581
|
function getChildren(stateNode) {
|
|
1580
1582
|
return Object.values(stateNode.states).filter(sn => sn.type !== 'history');
|
|
1581
1583
|
}
|
|
@@ -2741,4 +2743,4 @@ function raise(eventOrExpr, options) {
|
|
|
2741
2743
|
return raise;
|
|
2742
2744
|
}
|
|
2743
2745
|
|
|
2744
|
-
export { $$ACTOR_TYPE as $, Actor as A,
|
|
2746
|
+
export { $$ACTOR_TYPE as $, Actor as A, createInvokeId as B, getDelayedTransitions as C, formatInitialTransition as D, getCandidates as E, resolveStateValue as F, getAllStateNodes as G, createMachineSnapshot as H, isInFinalState as I, macrostep as J, transitionNode as K, resolveActionsAndContext as L, createInitEvent as M, NULL_EVENT as N, microstep as O, getInitialStateNodes as P, toStatePath as Q, isStateId as R, STATE_DELIMITER as S, getStateNodeByPath as T, getPersistedSnapshot as U, resolveReferencedActor as V, executingCustomAction as W, XSTATE_STOP as X, XSTATE_ERROR as Y, createErrorActorEvent as Z, ProcessingStatus as _, cancel as a, cloneMachineSnapshot as a0, spawnChild as b, createActor as c, interpret as d, and as e, stateIn as f, getProperAncestors as g, isMachineSnapshot as h, isAtomicStateNode as i, getStateNodes as j, getAllOwnEventDescriptors as k, matchesState as l, matchesEventDescriptor as m, not as n, or as o, pathToStateValue as p, toObserver as q, raise as r, stopChild as s, toArray as t, stop as u, mapValues as v, formatTransitions as w, toTransitionConfigArray as x, formatTransition as y, evaluateGuard as z };
|
|
@@ -1535,7 +1535,9 @@ function evaluateGuard(guard, context, event, snapshot) {
|
|
|
1535
1535
|
);
|
|
1536
1536
|
}
|
|
1537
1537
|
|
|
1538
|
-
|
|
1538
|
+
function isAtomicStateNode(stateNode) {
|
|
1539
|
+
return stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
1540
|
+
}
|
|
1539
1541
|
function getChildren(stateNode) {
|
|
1540
1542
|
return Object.values(stateNode.states).filter(sn => sn.type !== 'history');
|
|
1541
1543
|
}
|
|
@@ -2706,9 +2708,11 @@ exports.getCandidates = getCandidates;
|
|
|
2706
2708
|
exports.getDelayedTransitions = getDelayedTransitions;
|
|
2707
2709
|
exports.getInitialStateNodes = getInitialStateNodes;
|
|
2708
2710
|
exports.getPersistedSnapshot = getPersistedSnapshot;
|
|
2711
|
+
exports.getProperAncestors = getProperAncestors;
|
|
2709
2712
|
exports.getStateNodeByPath = getStateNodeByPath;
|
|
2710
2713
|
exports.getStateNodes = getStateNodes;
|
|
2711
2714
|
exports.interpret = interpret;
|
|
2715
|
+
exports.isAtomicStateNode = isAtomicStateNode;
|
|
2712
2716
|
exports.isInFinalState = isInFinalState;
|
|
2713
2717
|
exports.isMachineSnapshot = isMachineSnapshot;
|
|
2714
2718
|
exports.isStateId = isStateId;
|
|
@@ -1577,7 +1577,9 @@ function evaluateGuard(guard, context, event, snapshot) {
|
|
|
1577
1577
|
);
|
|
1578
1578
|
}
|
|
1579
1579
|
|
|
1580
|
-
|
|
1580
|
+
function isAtomicStateNode(stateNode) {
|
|
1581
|
+
return stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
1582
|
+
}
|
|
1581
1583
|
function getChildren(stateNode) {
|
|
1582
1584
|
return Object.values(stateNode.states).filter(sn => sn.type !== 'history');
|
|
1583
1585
|
}
|
|
@@ -2768,9 +2770,11 @@ exports.getCandidates = getCandidates;
|
|
|
2768
2770
|
exports.getDelayedTransitions = getDelayedTransitions;
|
|
2769
2771
|
exports.getInitialStateNodes = getInitialStateNodes;
|
|
2770
2772
|
exports.getPersistedSnapshot = getPersistedSnapshot;
|
|
2773
|
+
exports.getProperAncestors = getProperAncestors;
|
|
2771
2774
|
exports.getStateNodeByPath = getStateNodeByPath;
|
|
2772
2775
|
exports.getStateNodes = getStateNodes;
|
|
2773
2776
|
exports.interpret = interpret;
|
|
2777
|
+
exports.isAtomicStateNode = isAtomicStateNode;
|
|
2774
2778
|
exports.isInFinalState = isInFinalState;
|
|
2775
2779
|
exports.isMachineSnapshot = isMachineSnapshot;
|
|
2776
2780
|
exports.isStateId = isStateId;
|
|
@@ -1533,7 +1533,9 @@ function evaluateGuard(guard, context, event, snapshot) {
|
|
|
1533
1533
|
);
|
|
1534
1534
|
}
|
|
1535
1535
|
|
|
1536
|
-
|
|
1536
|
+
function isAtomicStateNode(stateNode) {
|
|
1537
|
+
return stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
1538
|
+
}
|
|
1537
1539
|
function getChildren(stateNode) {
|
|
1538
1540
|
return Object.values(stateNode.states).filter(sn => sn.type !== 'history');
|
|
1539
1541
|
}
|
|
@@ -2679,4 +2681,4 @@ function raise(eventOrExpr, options) {
|
|
|
2679
2681
|
return raise;
|
|
2680
2682
|
}
|
|
2681
2683
|
|
|
2682
|
-
export { $$ACTOR_TYPE as $, Actor as A,
|
|
2684
|
+
export { $$ACTOR_TYPE as $, Actor as A, createInvokeId as B, getDelayedTransitions as C, formatInitialTransition as D, getCandidates as E, resolveStateValue as F, getAllStateNodes as G, createMachineSnapshot as H, isInFinalState as I, macrostep as J, transitionNode as K, resolveActionsAndContext as L, createInitEvent as M, NULL_EVENT as N, microstep as O, getInitialStateNodes as P, toStatePath as Q, isStateId as R, STATE_DELIMITER as S, getStateNodeByPath as T, getPersistedSnapshot as U, resolveReferencedActor as V, XSTATE_ERROR as W, XSTATE_STOP as X, createErrorActorEvent as Y, ProcessingStatus as Z, cloneMachineSnapshot as _, cancel as a, spawnChild as b, createActor as c, interpret as d, and as e, stateIn as f, getProperAncestors as g, isMachineSnapshot as h, isAtomicStateNode as i, getStateNodes as j, getAllOwnEventDescriptors as k, matchesState as l, matchesEventDescriptor as m, not as n, or as o, pathToStateValue as p, toObserver as q, raise as r, stopChild as s, toArray as t, stop as u, mapValues as v, formatTransitions as w, toTransitionConfigArray as x, formatTransition as y, evaluateGuard as z };
|
package/dist/xstate.cjs.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var actors_dist_xstateActors = require('../actors/dist/xstate-actors.cjs.js');
|
|
6
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
7
|
-
var StateMachine = require('./StateMachine-
|
|
8
|
-
var assign = require('./assign-
|
|
9
|
-
var log = require('./log-
|
|
6
|
+
var guards_dist_xstateGuards = require('./raise-df325116.cjs.js');
|
|
7
|
+
var StateMachine = require('./StateMachine-29d33e13.cjs.js');
|
|
8
|
+
var assign = require('./assign-9271e302.cjs.js');
|
|
9
|
+
var log = require('./log-fe39762e.cjs.js');
|
|
10
10
|
require('../dev/dist/xstate-dev.cjs.js');
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -338,6 +338,62 @@ function initialTransition(logic, ...[input]) {
|
|
|
338
338
|
return [nextSnapshot, executableActions];
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Gets all potential next transitions from the current state.
|
|
343
|
+
*
|
|
344
|
+
* Returns all transitions that are available from the current state, including:
|
|
345
|
+
*
|
|
346
|
+
* - All transitions from atomic states (leaf states in the current state
|
|
347
|
+
* configuration)
|
|
348
|
+
* - All transitions from ancestor states (parent states that may handle events)
|
|
349
|
+
* - All guarded transitions (regardless of whether their guards would pass)
|
|
350
|
+
* - Always (eventless) transitions
|
|
351
|
+
* - After (delayed) transitions
|
|
352
|
+
*
|
|
353
|
+
* The order of transitions is deterministic:
|
|
354
|
+
*
|
|
355
|
+
* 1. Atomic states are processed in document order
|
|
356
|
+
* 2. For each atomic state, transitions are collected from the state itself first,
|
|
357
|
+
* then its ancestors
|
|
358
|
+
* 3. Within each state node, transitions are in the order they appear in the state
|
|
359
|
+
* definition
|
|
360
|
+
*
|
|
361
|
+
* @param state - The current machine snapshot
|
|
362
|
+
* @returns Array of transition definitions from the current state, in
|
|
363
|
+
* deterministic order
|
|
364
|
+
*/
|
|
365
|
+
function getNextTransitions(state) {
|
|
366
|
+
const potentialTransitions = [];
|
|
367
|
+
const atomicStates = state._nodes.filter(guards_dist_xstateGuards.isAtomicStateNode);
|
|
368
|
+
const visited = new Set();
|
|
369
|
+
|
|
370
|
+
// Collect all transitions from atomic states and their ancestors
|
|
371
|
+
// Process atomic states in document order (as they appear in state._nodes)
|
|
372
|
+
for (const stateNode of atomicStates) {
|
|
373
|
+
// For each atomic state, process the state itself first, then its ancestors
|
|
374
|
+
// This ensures child state transitions come before parent state transitions
|
|
375
|
+
for (const s of [stateNode].concat(guards_dist_xstateGuards.getProperAncestors(stateNode, undefined))) {
|
|
376
|
+
if (visited.has(s.id)) {
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
visited.add(s.id);
|
|
380
|
+
|
|
381
|
+
// Get all transitions for each event type
|
|
382
|
+
// Include ALL transitions, even if the same event type appears in multiple state nodes
|
|
383
|
+
// This is important for guarded transitions - all are "potential" regardless of guard evaluation
|
|
384
|
+
for (const [, transitions] of s.transitions) {
|
|
385
|
+
potentialTransitions.push(...transitions);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Also include always (eventless) transitions
|
|
389
|
+
if (s.always) {
|
|
390
|
+
potentialTransitions.push(...s.always);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return potentialTransitions;
|
|
395
|
+
}
|
|
396
|
+
|
|
341
397
|
const defaultWaitForOptions = {
|
|
342
398
|
timeout: Infinity // much more than 10 seconds
|
|
343
399
|
};
|
|
@@ -478,6 +534,7 @@ exports.assertEvent = assertEvent;
|
|
|
478
534
|
exports.createMachine = createMachine;
|
|
479
535
|
exports.getInitialSnapshot = getInitialSnapshot;
|
|
480
536
|
exports.getNextSnapshot = getNextSnapshot;
|
|
537
|
+
exports.getNextTransitions = getNextTransitions;
|
|
481
538
|
exports.initialTransition = initialTransition;
|
|
482
539
|
exports.setup = setup;
|
|
483
540
|
exports.toPromise = toPromise;
|
package/dist/xstate.cjs.mjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var actors_dist_xstateActors = require('../actors/dist/xstate-actors.development.cjs.js');
|
|
6
|
-
var guards_dist_xstateGuards = require('./raise-
|
|
7
|
-
var StateMachine = require('./StateMachine-
|
|
8
|
-
var assign = require('./assign-
|
|
9
|
-
var log = require('./log-
|
|
6
|
+
var guards_dist_xstateGuards = require('./raise-e47e3273.development.cjs.js');
|
|
7
|
+
var StateMachine = require('./StateMachine-3a7b3253.development.cjs.js');
|
|
8
|
+
var assign = require('./assign-6a45790f.development.cjs.js');
|
|
9
|
+
var log = require('./log-661c5df8.development.cjs.js');
|
|
10
10
|
require('../dev/dist/xstate-dev.development.cjs.js');
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -338,6 +338,62 @@ function initialTransition(logic, ...[input]) {
|
|
|
338
338
|
return [nextSnapshot, executableActions];
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Gets all potential next transitions from the current state.
|
|
343
|
+
*
|
|
344
|
+
* Returns all transitions that are available from the current state, including:
|
|
345
|
+
*
|
|
346
|
+
* - All transitions from atomic states (leaf states in the current state
|
|
347
|
+
* configuration)
|
|
348
|
+
* - All transitions from ancestor states (parent states that may handle events)
|
|
349
|
+
* - All guarded transitions (regardless of whether their guards would pass)
|
|
350
|
+
* - Always (eventless) transitions
|
|
351
|
+
* - After (delayed) transitions
|
|
352
|
+
*
|
|
353
|
+
* The order of transitions is deterministic:
|
|
354
|
+
*
|
|
355
|
+
* 1. Atomic states are processed in document order
|
|
356
|
+
* 2. For each atomic state, transitions are collected from the state itself first,
|
|
357
|
+
* then its ancestors
|
|
358
|
+
* 3. Within each state node, transitions are in the order they appear in the state
|
|
359
|
+
* definition
|
|
360
|
+
*
|
|
361
|
+
* @param state - The current machine snapshot
|
|
362
|
+
* @returns Array of transition definitions from the current state, in
|
|
363
|
+
* deterministic order
|
|
364
|
+
*/
|
|
365
|
+
function getNextTransitions(state) {
|
|
366
|
+
const potentialTransitions = [];
|
|
367
|
+
const atomicStates = state._nodes.filter(guards_dist_xstateGuards.isAtomicStateNode);
|
|
368
|
+
const visited = new Set();
|
|
369
|
+
|
|
370
|
+
// Collect all transitions from atomic states and their ancestors
|
|
371
|
+
// Process atomic states in document order (as they appear in state._nodes)
|
|
372
|
+
for (const stateNode of atomicStates) {
|
|
373
|
+
// For each atomic state, process the state itself first, then its ancestors
|
|
374
|
+
// This ensures child state transitions come before parent state transitions
|
|
375
|
+
for (const s of [stateNode].concat(guards_dist_xstateGuards.getProperAncestors(stateNode, undefined))) {
|
|
376
|
+
if (visited.has(s.id)) {
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
visited.add(s.id);
|
|
380
|
+
|
|
381
|
+
// Get all transitions for each event type
|
|
382
|
+
// Include ALL transitions, even if the same event type appears in multiple state nodes
|
|
383
|
+
// This is important for guarded transitions - all are "potential" regardless of guard evaluation
|
|
384
|
+
for (const [, transitions] of s.transitions) {
|
|
385
|
+
potentialTransitions.push(...transitions);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Also include always (eventless) transitions
|
|
389
|
+
if (s.always) {
|
|
390
|
+
potentialTransitions.push(...s.always);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return potentialTransitions;
|
|
395
|
+
}
|
|
396
|
+
|
|
341
397
|
const defaultWaitForOptions = {
|
|
342
398
|
timeout: Infinity // much more than 10 seconds
|
|
343
399
|
};
|
|
@@ -481,6 +537,7 @@ exports.assertEvent = assertEvent;
|
|
|
481
537
|
exports.createMachine = createMachine;
|
|
482
538
|
exports.getInitialSnapshot = getInitialSnapshot;
|
|
483
539
|
exports.getNextSnapshot = getNextSnapshot;
|
|
540
|
+
exports.getNextTransitions = getNextTransitions;
|
|
484
541
|
exports.initialTransition = initialTransition;
|
|
485
542
|
exports.setup = setup;
|
|
486
543
|
exports.toPromise = toPromise;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.development.esm.js';
|
|
2
|
-
import { m as matchesEventDescriptor, t as toArray, c as createActor, r as raise, a as cancel, s as stopChild, b as spawnChild } from './raise-
|
|
3
|
-
export { A as Actor,
|
|
4
|
-
import { S as StateMachine } from './StateMachine-
|
|
5
|
-
export { S as StateMachine, a as StateNode } from './StateMachine-
|
|
6
|
-
import { a as assign } from './assign-
|
|
7
|
-
export { a as assign } from './assign-
|
|
8
|
-
import { s as sendTo, l as log, e as enqueueActions, a as emit } from './log-
|
|
9
|
-
export { S as SpecialTargets, a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-
|
|
2
|
+
import { m as matchesEventDescriptor, t as toArray, c as createActor, r as raise, a as cancel, s as stopChild, b as spawnChild, i as isAtomicStateNode, g as getProperAncestors } from './raise-13e2f823.development.esm.js';
|
|
3
|
+
export { A as Actor, k as __unsafe_getAllOwnEventDescriptors, e as and, a as cancel, c as createActor, j as getStateNodes, d as interpret, h as isMachineSnapshot, l as matchesState, n as not, o as or, p as pathToStateValue, r as raise, b as spawnChild, f as stateIn, u as stop, s as stopChild, q as toObserver } from './raise-13e2f823.development.esm.js';
|
|
4
|
+
import { S as StateMachine } from './StateMachine-ceed8de1.development.esm.js';
|
|
5
|
+
export { S as StateMachine, a as StateNode } from './StateMachine-ceed8de1.development.esm.js';
|
|
6
|
+
import { a as assign } from './assign-382e15e2.development.esm.js';
|
|
7
|
+
export { a as assign } from './assign-382e15e2.development.esm.js';
|
|
8
|
+
import { s as sendTo, l as log, e as enqueueActions, a as emit } from './log-d09f274f.development.esm.js';
|
|
9
|
+
export { S as SpecialTargets, a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-d09f274f.development.esm.js';
|
|
10
10
|
import '../dev/dist/xstate-dev.development.esm.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -338,6 +338,62 @@ function initialTransition(logic, ...[input]) {
|
|
|
338
338
|
return [nextSnapshot, executableActions];
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Gets all potential next transitions from the current state.
|
|
343
|
+
*
|
|
344
|
+
* Returns all transitions that are available from the current state, including:
|
|
345
|
+
*
|
|
346
|
+
* - All transitions from atomic states (leaf states in the current state
|
|
347
|
+
* configuration)
|
|
348
|
+
* - All transitions from ancestor states (parent states that may handle events)
|
|
349
|
+
* - All guarded transitions (regardless of whether their guards would pass)
|
|
350
|
+
* - Always (eventless) transitions
|
|
351
|
+
* - After (delayed) transitions
|
|
352
|
+
*
|
|
353
|
+
* The order of transitions is deterministic:
|
|
354
|
+
*
|
|
355
|
+
* 1. Atomic states are processed in document order
|
|
356
|
+
* 2. For each atomic state, transitions are collected from the state itself first,
|
|
357
|
+
* then its ancestors
|
|
358
|
+
* 3. Within each state node, transitions are in the order they appear in the state
|
|
359
|
+
* definition
|
|
360
|
+
*
|
|
361
|
+
* @param state - The current machine snapshot
|
|
362
|
+
* @returns Array of transition definitions from the current state, in
|
|
363
|
+
* deterministic order
|
|
364
|
+
*/
|
|
365
|
+
function getNextTransitions(state) {
|
|
366
|
+
const potentialTransitions = [];
|
|
367
|
+
const atomicStates = state._nodes.filter(isAtomicStateNode);
|
|
368
|
+
const visited = new Set();
|
|
369
|
+
|
|
370
|
+
// Collect all transitions from atomic states and their ancestors
|
|
371
|
+
// Process atomic states in document order (as they appear in state._nodes)
|
|
372
|
+
for (const stateNode of atomicStates) {
|
|
373
|
+
// For each atomic state, process the state itself first, then its ancestors
|
|
374
|
+
// This ensures child state transitions come before parent state transitions
|
|
375
|
+
for (const s of [stateNode].concat(getProperAncestors(stateNode, undefined))) {
|
|
376
|
+
if (visited.has(s.id)) {
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
visited.add(s.id);
|
|
380
|
+
|
|
381
|
+
// Get all transitions for each event type
|
|
382
|
+
// Include ALL transitions, even if the same event type appears in multiple state nodes
|
|
383
|
+
// This is important for guarded transitions - all are "potential" regardless of guard evaluation
|
|
384
|
+
for (const [, transitions] of s.transitions) {
|
|
385
|
+
potentialTransitions.push(...transitions);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Also include always (eventless) transitions
|
|
389
|
+
if (s.always) {
|
|
390
|
+
potentialTransitions.push(...s.always);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return potentialTransitions;
|
|
395
|
+
}
|
|
396
|
+
|
|
341
397
|
const defaultWaitForOptions = {
|
|
342
398
|
timeout: Infinity // much more than 10 seconds
|
|
343
399
|
};
|
|
@@ -442,4 +498,4 @@ function waitFor(actorRef, predicate, options) {
|
|
|
442
498
|
});
|
|
443
499
|
}
|
|
444
500
|
|
|
445
|
-
export { SimulatedClock, assertEvent, createMachine, getInitialSnapshot, getNextSnapshot, initialTransition, setup, toPromise, transition, waitFor };
|
|
501
|
+
export { SimulatedClock, assertEvent, createMachine, getInitialSnapshot, getNextSnapshot, getNextTransitions, initialTransition, setup, toPromise, transition, waitFor };
|