xstate 5.0.0-alpha.0 → 5.0.0-alpha.2
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 +26 -15
- package/actions/dist/xstate-actions.cjs.dev.js +24 -25
- package/actions/dist/xstate-actions.cjs.prod.js +23 -24
- package/actions/dist/xstate-actions.esm.js +2 -2
- package/actions/dist/xstate-actions.umd.min.js +2 -0
- package/actions/dist/xstate-actions.umd.min.js.map +1 -0
- package/actions/dynamicAction.ts +15 -7
- package/actions/package.json +5 -1
- package/actors/dist/xstate-actors.cjs.d.ts +1 -1
- package/actors/dist/xstate-actors.cjs.dev.js +14 -14
- package/actors/dist/xstate-actors.cjs.prod.js +13 -13
- package/actors/dist/xstate-actors.esm.js +2 -2
- package/actors/dist/xstate-actors.umd.min.js +2 -0
- package/actors/dist/xstate-actors.umd.min.js.map +1 -0
- package/actors/package.json +5 -1
- package/dev/dist/xstate-dev.cjs.dev.js +1 -1
- package/dev/dist/xstate-dev.cjs.prod.js +0 -11
- package/dev/dist/xstate-dev.esm.js +1 -1
- package/dev/dist/xstate-dev.umd.min.js +2 -0
- package/dev/dist/xstate-dev.umd.min.js.map +1 -0
- package/dev/package.json +5 -1
- package/dist/{actions-6b86876d.cjs.dev.js → actions-1e9778c2.cjs.dev.js} +2819 -3334
- package/dist/actions-9778f6fb.esm.js +4246 -0
- package/dist/actions-acb29ffe.cjs.prod.js +4262 -0
- package/dist/declarations/actions/dynamicAction.d.ts +5 -3
- package/dist/declarations/src/Machine.d.ts +4 -4
- package/dist/declarations/src/Mailbox.d.ts +12 -12
- package/dist/declarations/src/SimulatedClock.d.ts +16 -16
- package/dist/declarations/src/State.d.ts +97 -104
- package/dist/declarations/src/StateMachine.d.ts +110 -112
- package/dist/declarations/src/StateNode.d.ts +127 -127
- package/dist/declarations/src/actionTypes.d.ts +16 -17
- package/dist/declarations/src/actions/assign.d.ts +7 -7
- package/dist/declarations/src/actions/cancel.d.ts +10 -10
- package/dist/declarations/src/actions/choose.d.ts +3 -3
- package/dist/declarations/src/actions/invoke.d.ts +3 -3
- package/dist/declarations/src/actions/log.d.ts +11 -11
- package/dist/declarations/src/actions/pure.d.ts +3 -3
- package/dist/declarations/src/actions/raise.d.ts +8 -9
- package/dist/declarations/src/actions/send.d.ts +53 -55
- package/dist/declarations/src/actions/stop.d.ts +7 -8
- package/dist/declarations/src/actions.d.ts +47 -44
- package/dist/declarations/src/actors/callback.d.ts +8 -0
- package/dist/declarations/src/actors/index.d.ts +27 -0
- package/dist/declarations/src/actors/observable.d.ts +23 -0
- package/dist/declarations/src/actors/promise.d.ts +12 -0
- package/dist/declarations/src/actors/transition.d.ts +13 -0
- package/dist/declarations/src/constants.d.ts +5 -5
- package/dist/declarations/src/dev/index.d.ts +14 -14
- package/dist/declarations/src/environment.d.ts +1 -1
- package/dist/declarations/src/guards.d.ts +8 -9
- package/dist/declarations/src/index.d.ts +44 -47
- package/dist/declarations/src/interpreter.d.ts +104 -147
- package/dist/declarations/src/mapState.d.ts +3 -3
- package/dist/declarations/src/memo.d.ts +2 -1
- package/dist/declarations/src/schema.d.ts +2 -2
- package/dist/declarations/src/spawn.d.ts +2 -2
- package/dist/declarations/src/stateUtils.d.ts +70 -85
- package/dist/declarations/src/symbolObservable.d.ts +1 -0
- package/dist/declarations/src/system.d.ts +2 -0
- package/dist/declarations/src/typegenTypes.d.ts +132 -132
- package/dist/declarations/src/types.d.ts +1008 -1026
- package/dist/declarations/src/utils.d.ts +58 -56
- package/dist/{index-20b364c4.esm.js → index-50bd0aff.esm.js} +0 -12
- package/dist/{index-2a564d03.cjs.dev.js → index-ebaab3c9.cjs.dev.js} +0 -12
- package/dist/xstate.cjs.dev.js +798 -100
- package/dist/xstate.cjs.prod.js +797 -99
- package/dist/xstate.esm.js +756 -55
- package/dist/xstate.umd.min.js +2 -0
- package/dist/xstate.umd.min.js.map +1 -0
- package/guards/dist/xstate-guards.cjs.dev.js +8 -8
- package/guards/dist/xstate-guards.cjs.prod.js +7 -7
- package/guards/dist/xstate-guards.esm.js +2 -2
- package/guards/dist/xstate-guards.umd.min.js +2 -0
- package/guards/dist/xstate-guards.umd.min.js.map +1 -0
- package/guards/package.json +5 -1
- package/package.json +28 -6
- package/CHANGELOG.md +0 -1986
- package/actions/ExecutableAction.ts +0 -58
- package/dist/Machine-9ce74c11.cjs.dev.js +0 -755
- package/dist/Machine-dca041dc.cjs.prod.js +0 -749
- package/dist/Machine-fb2f47f5.esm.js +0 -751
- package/dist/actions-70094c93.cjs.prod.js +0 -4765
- package/dist/actions-ff512f16.esm.js +0 -4757
- package/dist/declarations/actions/ExecutableAction.d.ts +0 -23
- package/dist/declarations/src/ObservableActorRef.d.ts +0 -25
- package/dist/declarations/src/actors.d.ts +0 -38
- package/dist/declarations/src/match.d.ts +0 -5
- package/dist/declarations/src/model.d.ts +0 -5
- package/dist/declarations/src/model.types.d.ts +0 -53
- package/dist/declarations/src/registry.d.ts +0 -8
- package/model/dist/xstate-model.cjs.d.ts +0 -1
- package/model/dist/xstate-model.cjs.dev.js +0 -41
- package/model/dist/xstate-model.cjs.js +0 -7
- package/model/dist/xstate-model.cjs.prod.js +0 -41
- package/model/dist/xstate-model.esm.js +0 -37
- package/model/package.json +0 -4
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { State } from '../src/State';
|
|
2
|
-
import { TypegenDisabled } from '../src/typegenTypes';
|
|
3
|
-
import { BaseActionObject, EventObject, MachineContext } from '../src/types';
|
|
4
|
-
export interface ResolvedActionObject<TContext extends MachineContext, TEvent extends EventObject, TResolvedTypesMeta = TypegenDisabled> {
|
|
5
|
-
type: string;
|
|
6
|
-
params: Record<string, any>;
|
|
7
|
-
/**
|
|
8
|
-
* The intermediate context
|
|
9
|
-
*/
|
|
10
|
-
context: TContext | undefined;
|
|
11
|
-
execute: (state: State<TContext, TEvent, TResolvedTypesMeta>) => any;
|
|
12
|
-
}
|
|
13
|
-
export declare class ExecutableAction<TContext extends object, TEvent extends EventObject, TResolvedTypesMeta = TypegenDisabled> implements ResolvedActionObject<TContext, TEvent, TResolvedTypesMeta> {
|
|
14
|
-
actionObject: BaseActionObject;
|
|
15
|
-
private _exec?;
|
|
16
|
-
type: string;
|
|
17
|
-
params: Record<string, any>;
|
|
18
|
-
context: TContext | undefined;
|
|
19
|
-
constructor(actionObject: BaseActionObject, _exec?: ((context: TContext, event: TEvent, meta: import("../src/types").ActionMeta<TContext, TEvent, BaseActionObject>) => void) | undefined);
|
|
20
|
-
execute(state: State<TContext, TEvent, TResolvedTypesMeta>): void | undefined;
|
|
21
|
-
setContext(context: TContext): void;
|
|
22
|
-
}
|
|
23
|
-
export declare function isExecutableAction(action: BaseActionObject | ResolvedActionObject<any, any, any>): action is ExecutableAction<any, any, any>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { EventObject, ActorRef, Behavior } from './types';
|
|
2
|
-
import { symbolObservable } from './utils';
|
|
3
|
-
export declare class ObservableActorRef<TEvent extends EventObject, TSnapshot> implements ActorRef<TEvent, TSnapshot> {
|
|
4
|
-
private behavior;
|
|
5
|
-
name: string;
|
|
6
|
-
private current;
|
|
7
|
-
private context;
|
|
8
|
-
private mailbox;
|
|
9
|
-
private _observers;
|
|
10
|
-
constructor(behavior: Behavior<TEvent, TSnapshot>, name: string);
|
|
11
|
-
start(): this;
|
|
12
|
-
stop(): this;
|
|
13
|
-
subscribe(observer: any): {
|
|
14
|
-
unsubscribe: () => void;
|
|
15
|
-
};
|
|
16
|
-
send(event: any): void;
|
|
17
|
-
toJSON(): {
|
|
18
|
-
name: string;
|
|
19
|
-
current: TSnapshot;
|
|
20
|
-
};
|
|
21
|
-
getSnapshot(): TSnapshot;
|
|
22
|
-
[symbolObservable](): this;
|
|
23
|
-
private receive;
|
|
24
|
-
private _process;
|
|
25
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { InvokeCallback, Subscribable, InterpreterOptions, Lazy, Behavior, ActorContext, EventObject, ActorRef, AnyStateMachine, BaseActorRef, EventFrom, StateFrom } from './types';
|
|
2
|
-
import { AreAllImplementationsAssumedToBeProvided } from './typegenTypes';
|
|
3
|
-
/**
|
|
4
|
-
* Returns an actor behavior from a reducer and its initial state.
|
|
5
|
-
*
|
|
6
|
-
* @param transition The pure reducer that returns the next state given the current state and event.
|
|
7
|
-
* @param initialState The initial state of the reducer.
|
|
8
|
-
* @returns An actor behavior
|
|
9
|
-
*/
|
|
10
|
-
export declare function fromReducer<TState, TEvent extends EventObject>(transition: (state: TState, event: TEvent, actorContext: ActorContext<TEvent, TState>) => TState, initialState: TState): Behavior<TEvent, TState>;
|
|
11
|
-
export declare const startSignalType: unique symbol;
|
|
12
|
-
export declare const stopSignalType: unique symbol;
|
|
13
|
-
export declare const startSignal: StartSignal;
|
|
14
|
-
export declare const stopSignal: StopSignal;
|
|
15
|
-
export interface StartSignal {
|
|
16
|
-
type: typeof startSignalType;
|
|
17
|
-
}
|
|
18
|
-
export interface StopSignal {
|
|
19
|
-
type: typeof stopSignalType;
|
|
20
|
-
}
|
|
21
|
-
export declare type LifecycleSignal = StartSignal | StopSignal;
|
|
22
|
-
export declare function fromCallback<TEvent extends EventObject>(invokeCallback: InvokeCallback): Behavior<TEvent, undefined>;
|
|
23
|
-
export declare function fromPromise<T>(lazyPromise: Lazy<PromiseLike<T>>): Behavior<{
|
|
24
|
-
type: string;
|
|
25
|
-
}, T | undefined>;
|
|
26
|
-
export declare function fromObservable<T, TEvent extends EventObject>(lazyObservable: Lazy<Subscribable<T>>): Behavior<TEvent, T | undefined>;
|
|
27
|
-
/**
|
|
28
|
-
* Creates an event observable behavior that listens to an observable
|
|
29
|
-
* that delivers event objects.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @param lazyObservable A function that creates an observable
|
|
33
|
-
* @returns An event observable behavior
|
|
34
|
-
*/
|
|
35
|
-
export declare function fromEventObservable<T extends EventObject>(lazyObservable: Lazy<Subscribable<T>>): Behavior<EventObject, T | undefined>;
|
|
36
|
-
export declare function fromMachine<TMachine extends AnyStateMachine>(machine: AreAllImplementationsAssumedToBeProvided<TMachine['__TResolvedTypesMeta']> extends true ? TMachine : 'Some implementations missing', options?: Partial<InterpreterOptions>): Behavior<EventFrom<TMachine>, StateFrom<TMachine>>;
|
|
37
|
-
export declare function isActorRef(item: any): item is ActorRef<any>;
|
|
38
|
-
export declare function toActorRef<TEvent extends EventObject, TSnapshot = any, TActorRefLike extends BaseActorRef<TEvent> = BaseActorRef<TEvent>>(actorRefLike: TActorRefLike): ActorRef<TEvent, TSnapshot> & Omit<TActorRefLike, keyof ActorRef<any, any>>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { State } from './State';
|
|
2
|
-
import { StateValue, EventObject, MachineContext } from './types';
|
|
3
|
-
export declare type ValueFromStateGetter<T, TContext extends MachineContext, TEvent extends EventObject> = (state: State<TContext, TEvent>) => T;
|
|
4
|
-
export declare type StatePatternTuple<T, TContext extends MachineContext, TEvent extends EventObject> = [StateValue, ValueFromStateGetter<T, TContext, TEvent>];
|
|
5
|
-
export declare function matchState<T, TContext extends MachineContext, TEvent extends EventObject>(state: State<TContext, TEvent> | StateValue, patterns: Array<StatePatternTuple<T, TContext, TEvent>>, defaultValue: ValueFromStateGetter<T, TContext, TEvent>): T;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { MachineContext, Cast, EventObject, BaseActionObject, Prop, IsNever } from './types';
|
|
2
|
-
import { UnionFromCreatorsReturnTypes, FinalModelCreators, Model, ModelCreators } from './model.types';
|
|
3
|
-
export declare function createModel<TContext extends MachineContext, TEvent extends EventObject, TAction extends BaseActionObject = BaseActionObject>(initialContext: TContext): Model<TContext, TEvent, TAction, void>;
|
|
4
|
-
export declare function createModel<TContext extends MachineContext, TEvent extends EventObject>(initialContext: TContext): Model<TContext, TEvent, never>;
|
|
5
|
-
export declare function createModel<TContext extends MachineContext, TModelCreators extends ModelCreators<TModelCreators>, TFinalModelCreators = FinalModelCreators<TModelCreators>, TComputedEvent = UnionFromCreatorsReturnTypes<Prop<TFinalModelCreators, 'events'>>, TComputedAction = UnionFromCreatorsReturnTypes<Prop<TFinalModelCreators, 'actions'>>>(initialContext: TContext, creators: TModelCreators): Model<TContext, Cast<TComputedEvent, EventObject>, IsNever<TComputedAction> extends true ? BaseActionObject : Cast<TComputedAction, BaseActionObject>, TFinalModelCreators>;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { StateMachine } from './StateMachine';
|
|
2
|
-
import { ResolveTypegenMeta, TypegenConstraint, TypegenDisabled } from './typegenTypes';
|
|
3
|
-
import { ActorMap, AnyFunction, Assigner, BaseActionObject, Compute, DynamicAssignAction, EventObject, InternalMachineImplementations, MachineConfig, MachineContext, Prop, PropertyAssigner } from './types';
|
|
4
|
-
declare type SimplisticExtractEvent<TEvent extends EventObject, TEventType extends TEvent['type']> = TEvent extends {
|
|
5
|
-
type: TEventType;
|
|
6
|
-
} ? TEvent : never;
|
|
7
|
-
export interface Model<TContext extends MachineContext, TEvent extends EventObject, TAction extends BaseActionObject = BaseActionObject, TModelCreators = void> {
|
|
8
|
-
initialContext: TContext;
|
|
9
|
-
assign: <TEventType extends TEvent['type'] = TEvent['type']>(assigner: Assigner<TContext, SimplisticExtractEvent<TEvent, TEventType>> | PropertyAssigner<TContext, SimplisticExtractEvent<TEvent, TEventType>>, eventType?: TEventType) => DynamicAssignAction<TContext, SimplisticExtractEvent<TEvent, TEventType>>;
|
|
10
|
-
events: Prop<TModelCreators, 'events'>;
|
|
11
|
-
actions: Prop<TModelCreators, 'actions'>;
|
|
12
|
-
reset: () => DynamicAssignAction<TContext, any>;
|
|
13
|
-
createMachine: {
|
|
14
|
-
<TActorMap extends ActorMap = ActorMap, TTypesMeta extends TypegenConstraint = TypegenDisabled>(config: MachineConfig<TContext, TEvent, TAction, TActorMap, TTypesMeta>, implementations?: InternalMachineImplementations<TContext, TEvent, ResolveTypegenMeta<TTypesMeta, TEvent, TAction, TActorMap>>): StateMachine<TContext, TEvent, TAction, TActorMap, ResolveTypegenMeta<TTypesMeta, TEvent, TAction, TActorMap>>;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export declare type ModelContextFrom<TModel extends Model<any, any, any, any>> = TModel extends Model<infer TContext, any, any, any> ? TContext : never;
|
|
18
|
-
export declare type ModelEventsFrom<TModel extends Model<any, any, any, any> | undefined> = TModel extends Model<any, infer TEvent, any, any> ? TEvent : EventObject;
|
|
19
|
-
export declare type ModelActionsFrom<TModel extends Model<any, any, any, any>> = TModel extends Model<any, any, infer TAction, any> ? TAction : never;
|
|
20
|
-
export declare type EventCreator<Self extends AnyFunction, Return = ReturnType<Self>> = Return extends object ? Return extends {
|
|
21
|
-
type: any;
|
|
22
|
-
} ? "An event creator can't return an object with a type property" : Self : 'An event creator must return an object';
|
|
23
|
-
export declare type EventCreators<Self> = {
|
|
24
|
-
[K in keyof Self]: Self[K] extends AnyFunction ? EventCreator<Self[K]> : 'An event creator must be a function';
|
|
25
|
-
};
|
|
26
|
-
export declare type FinalEventCreators<Self> = {
|
|
27
|
-
[K in keyof Self]: Self[K] extends AnyFunction ? (...args: Parameters<Self[K]>) => Compute<ReturnType<Self[K]> & {
|
|
28
|
-
type: K;
|
|
29
|
-
}> : never;
|
|
30
|
-
};
|
|
31
|
-
export declare type ActionCreator<Self extends AnyFunction, Return = ReturnType<Self>> = Return extends object ? Return extends {
|
|
32
|
-
type: any;
|
|
33
|
-
} ? "An action creator can't return an object with a type property" : Self : 'An action creator must return an object';
|
|
34
|
-
export declare type ActionCreators<Self> = {
|
|
35
|
-
[K in keyof Self]: Self[K] extends AnyFunction ? ActionCreator<Self[K]> : 'An action creator must be a function';
|
|
36
|
-
};
|
|
37
|
-
export declare type FinalActionCreators<Self> = {
|
|
38
|
-
[K in keyof Self]: Self[K] extends AnyFunction ? (...args: Parameters<Self[K]>) => Compute<ReturnType<Self[K]> & {
|
|
39
|
-
type: K;
|
|
40
|
-
}> : never;
|
|
41
|
-
};
|
|
42
|
-
export interface ModelCreators<Self> {
|
|
43
|
-
events?: EventCreators<Prop<Self, 'events'>>;
|
|
44
|
-
actions?: ActionCreators<Prop<Self, 'actions'>>;
|
|
45
|
-
}
|
|
46
|
-
export interface FinalModelCreators<Self> {
|
|
47
|
-
events: FinalEventCreators<Prop<Self, 'events'>>;
|
|
48
|
-
actions: FinalActionCreators<Prop<Self, 'actions'>>;
|
|
49
|
-
}
|
|
50
|
-
export declare type UnionFromCreatorsReturnTypes<TCreators> = {
|
|
51
|
-
[K in keyof TCreators]: TCreators[K] extends AnyFunction ? ReturnType<TCreators[K]> : never;
|
|
52
|
-
}[keyof TCreators];
|
|
53
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "../../dist/declarations/src/model";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var guards_dist_xstateGuards = require('../../dist/actions-6b86876d.cjs.dev.js');
|
|
6
|
-
require('../../dist/index-2a564d03.cjs.dev.js');
|
|
7
|
-
var Machine = require('../../dist/Machine-9ce74c11.cjs.dev.js');
|
|
8
|
-
|
|
9
|
-
function createModel(initialContext, creators) {
|
|
10
|
-
var eventCreators = creators === null || creators === void 0 ? void 0 : creators.events;
|
|
11
|
-
var actionCreators = creators === null || creators === void 0 ? void 0 : creators.actions;
|
|
12
|
-
var model = {
|
|
13
|
-
initialContext: initialContext,
|
|
14
|
-
assign: guards_dist_xstateGuards.assign,
|
|
15
|
-
events: eventCreators ? guards_dist_xstateGuards.mapValues(eventCreators, function (fn, eventType) {
|
|
16
|
-
return function () {
|
|
17
|
-
return guards_dist_xstateGuards._objectSpread2(guards_dist_xstateGuards._objectSpread2({}, fn.apply(void 0, arguments)), {}, {
|
|
18
|
-
type: eventType
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
}) : undefined,
|
|
22
|
-
actions: actionCreators ? guards_dist_xstateGuards.mapValues(actionCreators, function (fn, actionType) {
|
|
23
|
-
return function () {
|
|
24
|
-
return guards_dist_xstateGuards._objectSpread2(guards_dist_xstateGuards._objectSpread2({}, fn.apply(void 0, arguments)), {}, {
|
|
25
|
-
type: actionType
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
}) : undefined,
|
|
29
|
-
reset: function reset() {
|
|
30
|
-
return guards_dist_xstateGuards.assign(initialContext);
|
|
31
|
-
},
|
|
32
|
-
createMachine: function createMachine(config, implementations) {
|
|
33
|
-
return Machine.createMachine('context' in config ? config : guards_dist_xstateGuards._objectSpread2(guards_dist_xstateGuards._objectSpread2({}, config), {}, {
|
|
34
|
-
context: initialContext
|
|
35
|
-
}), implementations);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return model;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
exports.createModel = createModel;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var guards_dist_xstateGuards = require('../../dist/actions-70094c93.cjs.prod.js');
|
|
6
|
-
require('../../dev/dist/xstate-dev.cjs.prod.js');
|
|
7
|
-
var Machine = require('../../dist/Machine-dca041dc.cjs.prod.js');
|
|
8
|
-
|
|
9
|
-
function createModel(initialContext, creators) {
|
|
10
|
-
var eventCreators = creators === null || creators === void 0 ? void 0 : creators.events;
|
|
11
|
-
var actionCreators = creators === null || creators === void 0 ? void 0 : creators.actions;
|
|
12
|
-
var model = {
|
|
13
|
-
initialContext: initialContext,
|
|
14
|
-
assign: guards_dist_xstateGuards.assign,
|
|
15
|
-
events: eventCreators ? guards_dist_xstateGuards.mapValues(eventCreators, function (fn, eventType) {
|
|
16
|
-
return function () {
|
|
17
|
-
return guards_dist_xstateGuards._objectSpread2(guards_dist_xstateGuards._objectSpread2({}, fn.apply(void 0, arguments)), {}, {
|
|
18
|
-
type: eventType
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
}) : undefined,
|
|
22
|
-
actions: actionCreators ? guards_dist_xstateGuards.mapValues(actionCreators, function (fn, actionType) {
|
|
23
|
-
return function () {
|
|
24
|
-
return guards_dist_xstateGuards._objectSpread2(guards_dist_xstateGuards._objectSpread2({}, fn.apply(void 0, arguments)), {}, {
|
|
25
|
-
type: actionType
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
}) : undefined,
|
|
29
|
-
reset: function reset() {
|
|
30
|
-
return guards_dist_xstateGuards.assign(initialContext);
|
|
31
|
-
},
|
|
32
|
-
createMachine: function createMachine(config, implementations) {
|
|
33
|
-
return Machine.createMachine('context' in config ? config : guards_dist_xstateGuards._objectSpread2(guards_dist_xstateGuards._objectSpread2({}, config), {}, {
|
|
34
|
-
context: initialContext
|
|
35
|
-
}), implementations);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return model;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
exports.createModel = createModel;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { n as assign, M as mapValues, X as _objectSpread2 } from '../../dist/actions-ff512f16.esm.js';
|
|
2
|
-
import '../../dist/index-20b364c4.esm.js';
|
|
3
|
-
import { c as createMachine } from '../../dist/Machine-fb2f47f5.esm.js';
|
|
4
|
-
|
|
5
|
-
function createModel(initialContext, creators) {
|
|
6
|
-
var eventCreators = creators === null || creators === void 0 ? void 0 : creators.events;
|
|
7
|
-
var actionCreators = creators === null || creators === void 0 ? void 0 : creators.actions;
|
|
8
|
-
var model = {
|
|
9
|
-
initialContext: initialContext,
|
|
10
|
-
assign: assign,
|
|
11
|
-
events: eventCreators ? mapValues(eventCreators, function (fn, eventType) {
|
|
12
|
-
return function () {
|
|
13
|
-
return _objectSpread2(_objectSpread2({}, fn.apply(void 0, arguments)), {}, {
|
|
14
|
-
type: eventType
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
}) : undefined,
|
|
18
|
-
actions: actionCreators ? mapValues(actionCreators, function (fn, actionType) {
|
|
19
|
-
return function () {
|
|
20
|
-
return _objectSpread2(_objectSpread2({}, fn.apply(void 0, arguments)), {}, {
|
|
21
|
-
type: actionType
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
}) : undefined,
|
|
25
|
-
reset: function reset() {
|
|
26
|
-
return assign(initialContext);
|
|
27
|
-
},
|
|
28
|
-
createMachine: function createMachine$1(config, implementations) {
|
|
29
|
-
return createMachine('context' in config ? config : _objectSpread2(_objectSpread2({}, config), {}, {
|
|
30
|
-
context: initialContext
|
|
31
|
-
}), implementations);
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return model;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { createModel };
|
package/model/package.json
DELETED