xstate 5.32.0 → 5.32.1
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/dist/declarations/src/setup.d.ts +14 -2
- package/dist/declarations/src/types.d.ts +3 -2
- package/dist/{log-5a37e0ee.development.esm.js → log-410e5e55.development.esm.js} +4 -0
- package/dist/{log-fedf0966.cjs.js → log-7776fcf2.cjs.js} +4 -0
- package/dist/{log-029f180b.development.cjs.js → log-c2e11c01.development.cjs.js} +4 -0
- package/dist/{log-605ef461.esm.js → log-fa75ec2d.esm.js} +4 -0
- package/dist/xstate-actions.cjs.js +1 -1
- package/dist/xstate-actions.development.cjs.js +1 -1
- package/dist/xstate-actions.development.esm.js +1 -1
- package/dist/xstate-actions.esm.js +1 -1
- package/dist/xstate-actions.umd.min.js.map +1 -1
- package/dist/xstate.cjs.js +5 -1
- package/dist/xstate.development.cjs.js +5 -1
- package/dist/xstate.development.esm.js +6 -2
- package/dist/xstate.esm.js +6 -2
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,18 @@ type ToStateSchema<TSchema extends StateSchema> = {
|
|
|
29
29
|
} : TSchema[K];
|
|
30
30
|
};
|
|
31
31
|
type RequiredSetupKeys<TChildrenMap> = IsNever<keyof TChildrenMap> extends true ? never : 'actors';
|
|
32
|
+
type ExtractInvokeEntry<T> = T extends {
|
|
33
|
+
id: infer TId extends string;
|
|
34
|
+
src: infer TSrc extends string;
|
|
35
|
+
} ? {
|
|
36
|
+
[K in TId]: TSrc;
|
|
37
|
+
} : {};
|
|
38
|
+
type ExtractInvokeChildren<T> = T extends readonly (infer E)[] ? UnionToIntersection<ExtractInvokeEntry<E>> : ExtractInvokeEntry<T>;
|
|
39
|
+
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
40
|
+
type ExtractConfigChildren<TConfig> = TConfig extends {
|
|
41
|
+
invoke: infer TInvoke;
|
|
42
|
+
} ? ExtractInvokeChildren<TInvoke> : {};
|
|
43
|
+
type MergeChildrenMap<TExplicit extends Record<string, string>, TInferred extends Record<string, string>> = IsNever<keyof TExplicit> extends true ? TInferred : TExplicit;
|
|
32
44
|
export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEventObject, TActors extends Record<string, UnknownActorLogic>, TChildrenMap extends Record<string, string>, TActions extends Record<string, ParameterizedObject['params'] | undefined>, TGuards extends Record<string, ParameterizedObject['params'] | undefined>, TDelay extends string, TTag extends string, TInput, TOutput extends NonReducibleUnknown, TEmitted extends EventObject, TMeta extends MetaObject> = {
|
|
33
45
|
extend: <TExtendActions extends Record<string, ParameterizedObject['params'] | undefined> = {}, TExtendGuards extends Record<string, ParameterizedObject['params'] | undefined> = {}, TExtendDelays extends string = never>({ actions, guards, delays }: {
|
|
34
46
|
actions?: {
|
|
@@ -96,10 +108,10 @@ export type SetupReturn<TContext extends MachineContext, TEvent extends AnyEvent
|
|
|
96
108
|
* ```
|
|
97
109
|
*/
|
|
98
110
|
createAction: (action: ActionFunction<TContext, TEvent, TEvent, unknown, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TEmitted>) => typeof action;
|
|
99
|
-
createMachine: <const TConfig extends MachineConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, TInput, TOutput, TEmitted, TMeta
|
|
111
|
+
createMachine: <const TConfig extends MachineConfig<TContext, TEvent, ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, TTag, TInput, TOutput, TEmitted, TMeta>, TResolvedChildren extends Record<string, string> = MergeChildrenMap<TChildrenMap, Cast<ExtractConfigChildren<TConfig>, Record<string, string>>>>(config: TConfig) => StateMachine<TContext, TEvent | ([RoutableStateId<TConfig>] extends [never] ? never : {
|
|
100
112
|
type: 'xstate.route';
|
|
101
113
|
to: RoutableStateId<TConfig>;
|
|
102
|
-
}), Cast<ToChildren<ToProvidedActor<
|
|
114
|
+
}), Cast<ToChildren<ToProvidedActor<TResolvedChildren, TActors>>, Record<string, AnyActorRef | undefined>>, ToProvidedActor<TResolvedChildren, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay, ToStateValue<TConfig>, TTag, TInput, TOutput, TEmitted, TMeta, ToStateSchema<TConfig>>;
|
|
103
115
|
assign: typeof assign<TContext, TEvent, undefined, TEvent, ToProvidedActor<TChildrenMap, TActors>>;
|
|
104
116
|
sendTo: <TTargetActor extends AnyActorRef>(...args: Parameters<typeof sendTo<TContext, TEvent, undefined, TTargetActor, TEvent, TDelay, TDelay>>) => ReturnType<typeof sendTo<TContext, TEvent, undefined, TTargetActor, TEvent, TDelay, TDelay>>;
|
|
105
117
|
raise: typeof raise<TContext, TEvent, TEvent, undefined, TDelay, TDelay>;
|
|
@@ -937,12 +937,13 @@ type ExtractLiteralString<T extends string | undefined> = T extends string ? str
|
|
|
937
937
|
type ToConcreteChildren<TActor extends ProvidedActor> = {
|
|
938
938
|
[A in TActor as ExtractLiteralString<A['id']>]?: ActorRefFromLogic<A['logic']>;
|
|
939
939
|
};
|
|
940
|
+
type NonConcreteActors<TActor extends ProvidedActor> = TActor extends any ? ExtractLiteralString<TActor['id']> extends never ? TActor : never : never;
|
|
940
941
|
export type ToChildren<TActor extends ProvidedActor> = string extends TActor['src'] ? Record<string, AnyActorRef> : Compute<ToConcreteChildren<TActor> & {
|
|
941
942
|
include: {
|
|
942
|
-
[id: string]: TActor extends any ? ActorRefFromLogic<TActor['logic']> | undefined : never;
|
|
943
|
+
[id: string]: NonConcreteActors<TActor> extends never ? AnyActorRef | undefined : NonConcreteActors<TActor> extends any ? ActorRefFromLogic<NonConcreteActors<TActor>['logic']> | undefined : never;
|
|
943
944
|
};
|
|
944
945
|
exclude: unknown;
|
|
945
|
-
}[
|
|
946
|
+
}[NonConcreteActors<TActor> extends never ? 'exclude' : 'include']>;
|
|
946
947
|
export type StateSchema = {
|
|
947
948
|
id?: string;
|
|
948
949
|
route?: unknown;
|
|
@@ -151,6 +151,10 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
|
151
151
|
* @template TSystem - The type of the actor system.
|
|
152
152
|
*/
|
|
153
153
|
|
|
154
|
+
// Actors that don't have literal string IDs — these are the only ones
|
|
155
|
+
// that should appear in the index signature fallback, since actors with
|
|
156
|
+
// literal IDs are already covered by ToConcreteChildren.
|
|
157
|
+
|
|
154
158
|
/** @deprecated */
|
|
155
159
|
|
|
156
160
|
// TODO: cover all that can be actually returned
|
|
@@ -147,6 +147,10 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
|
147
147
|
* @template TSystem - The type of the actor system.
|
|
148
148
|
*/
|
|
149
149
|
|
|
150
|
+
// Actors that don't have literal string IDs — these are the only ones
|
|
151
|
+
// that should appear in the index signature fallback, since actors with
|
|
152
|
+
// literal IDs are already covered by ToConcreteChildren.
|
|
153
|
+
|
|
150
154
|
/** @deprecated */
|
|
151
155
|
|
|
152
156
|
// TODO: cover all that can be actually returned
|
|
@@ -153,6 +153,10 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
|
153
153
|
* @template TSystem - The type of the actor system.
|
|
154
154
|
*/
|
|
155
155
|
|
|
156
|
+
// Actors that don't have literal string IDs — these are the only ones
|
|
157
|
+
// that should appear in the index signature fallback, since actors with
|
|
158
|
+
// literal IDs are already covered by ToConcreteChildren.
|
|
159
|
+
|
|
156
160
|
/** @deprecated */
|
|
157
161
|
|
|
158
162
|
// TODO: cover all that can be actually returned
|
|
@@ -145,6 +145,10 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
|
|
|
145
145
|
* @template TSystem - The type of the actor system.
|
|
146
146
|
*/
|
|
147
147
|
|
|
148
|
+
// Actors that don't have literal string IDs — these are the only ones
|
|
149
|
+
// that should appear in the index signature fallback, since actors with
|
|
150
|
+
// literal IDs are already covered by ToConcreteChildren.
|
|
151
|
+
|
|
148
152
|
/** @deprecated */
|
|
149
153
|
|
|
150
154
|
// TODO: cover all that can be actually returned
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var assign = require('./assign-e8f2bd75.cjs.js');
|
|
6
6
|
var dist_xstateGuards = require('./raise-7c948725.cjs.js');
|
|
7
|
-
var log = require('./log-
|
|
7
|
+
var log = require('./log-7776fcf2.cjs.js');
|
|
8
8
|
require('./xstate-dev.cjs.js');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var assign = require('./assign-927227d6.development.cjs.js');
|
|
6
6
|
var dist_xstateGuards = require('./raise-964cd4e9.development.cjs.js');
|
|
7
|
-
var log = require('./log-
|
|
7
|
+
var log = require('./log-c2e11c01.development.cjs.js');
|
|
8
8
|
require('./xstate-dev.development.cjs.js');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { a as assign } from './assign-f338cee3.development.esm.js';
|
|
2
2
|
export { a as cancel, r as raise, b as spawnChild, x as stop, s as stopChild } from './raise-74097812.development.esm.js';
|
|
3
|
-
export { a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-
|
|
3
|
+
export { a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-410e5e55.development.esm.js';
|
|
4
4
|
import './xstate-dev.development.esm.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { a as assign } from './assign-2aa58daa.esm.js';
|
|
2
2
|
export { a as cancel, r as raise, b as spawnChild, x as stop, s as stopChild } from './raise-e974d1c9.esm.js';
|
|
3
|
-
export { a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-
|
|
3
|
+
export { a as emit, e as enqueueActions, f as forwardTo, l as log, b as sendParent, s as sendTo } from './log-fa75ec2d.esm.js';
|
|
4
4
|
import './xstate-dev.esm.js';
|