@systemfsoftware/xstate 0.0.0-stage → 6.0.0-beta.65

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.
@@ -0,0 +1,512 @@
1
+ import { f as StandardSchemaV1, n as EventObject } from "./base.types-DF8ZPiXj.js";
2
+ import { Ar as ActorSystemRuntime, Bn as Subscribable, C as AnyActor, D as AnyEventObject, Hn as Subscription, T as AnyActorRef, Ur as ActorLogicValidator, Wt as NonReducibleUnknown, f as ActorRefFromLogic, h as ActorScope, hn as Snapshot, i as ActorFromLogic, jr as AnyActorSystem, s as ActorLogic, vt as ExecutableActionObject } from "./types-B2EAwOk-.js";
3
+ /** @public */
4
+ type LogicSnapshot<TContext, TOutput, TInput> = Snapshot<TOutput> & {
5
+ context: TContext;
6
+ input: TInput | undefined;
7
+ effects?: Record<string, LogicEffectState>;
8
+ };
9
+ /** @public */
10
+ type LogicEffectState = {
11
+ status: 'active';
12
+ } | {
13
+ status: 'done';
14
+ output?: unknown;
15
+ } | {
16
+ status: 'error';
17
+ error: unknown;
18
+ };
19
+ /** @public */
20
+ interface LogicArgs<TContext, TEvent extends EventObject, TInput> {
21
+ context: TContext;
22
+ event: TEvent;
23
+ input: TInput;
24
+ system: AnyActorSystem;
25
+ self: LogicActorRef<TContext, unknown, TEvent, TInput>;
26
+ }
27
+ /** @public */
28
+ type LogicEffect<_TEvent extends EventObject, _TEmitted extends EventObject> = ExecutableActionObject;
29
+ /** @public */
30
+ interface LogicEnqueue<TEvent extends EventObject, TEmitted extends EventObject> {
31
+ emit: (emitted: TEmitted) => void;
32
+ sendBack: (event: EventObject) => void;
33
+ raise: (event: TEvent) => void;
34
+ effect: {
35
+ (exec: (runtime?: Partial<ActorSystemRuntime>) => void | (() => void)): void;
36
+ (key: string, exec: (runtime?: Partial<ActorSystemRuntime>) => void | (() => void)): void;
37
+ };
38
+ }
39
+ /** @public */
40
+ type LogicPatch<TContext, TOutput, TInput> = Partial<{
41
+ context: TContext;
42
+ input: TInput | undefined;
43
+ status: LogicSnapshot<TContext, TOutput, TInput>['status'];
44
+ output: TOutput;
45
+ error: unknown;
46
+ effects: Record<string, LogicEffectState>;
47
+ }>;
48
+ /** @public */
49
+ type LogicFunction<TContext, TOutput, TEvent extends EventObject, TInput, TEmitted extends EventObject> = (args: LogicArgs<TContext, TEvent, TInput>, enq: LogicEnqueue<TEvent, TEmitted>) => void | LogicPatch<TContext, TOutput, TInput>;
50
+ /** @public */
51
+ interface LogicConfig<TContext, TOutput, TEvent extends EventObject, TInput, TEmitted extends EventObject, TInputSchema extends StandardSchemaV1 = StandardSchemaV1, TOutputSchema extends StandardSchemaV1 = StandardSchemaV1> {
52
+ id?: string | undefined;
53
+ validator?: ActorLogicValidator | undefined;
54
+ schemas?: {
55
+ input?: TInputSchema;
56
+ output?: TOutputSchema;
57
+ } | undefined;
58
+ context: TContext | ((args: {
59
+ input: TInput;
60
+ }) => TContext);
61
+ run: LogicFunction<TContext, TOutput, TEvent, TInput, TEmitted>;
62
+ }
63
+ interface LogicTransition<TContext, TOutput, TEvent extends EventObject, TInput, TEmitted extends EventObject> {
64
+ (snapshot: LogicSnapshot<TContext, TOutput, TInput>, event: TEvent, actorScope: ActorScope<LogicSnapshot<TContext, TOutput, TInput>, TEvent, AnyActorSystem, TEmitted>): [LogicSnapshot<TContext, TOutput, TInput>, LogicEffect<TEvent, TEmitted>[]];
65
+ (snapshot: LogicSnapshot<TContext, TOutput, TInput>, event: TEvent, actorScope: ActorScope<LogicSnapshot<TContext, TOutput, TInput>, TEvent, AnyActorSystem, TEmitted>): LogicSnapshot<TContext, TOutput, TInput>;
66
+ }
67
+ /** @public */
68
+ type LogicActorLogic<TContext, TOutput, TEvent extends EventObject = EventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject> = Omit<ActorLogic<LogicSnapshot<TContext, TOutput, TInput>, TEvent, TInput, AnyActorSystem, TEmitted>, 'transition'> & {
69
+ id?: string | undefined;
70
+ transition: LogicTransition<TContext, TOutput, TEvent, TInput, TEmitted>;
71
+ };
72
+ /** @public */
73
+ type LogicActorRef<TContext, TOutput, TEvent extends EventObject, TInput> = ActorRefFromLogic<LogicActorLogic<TContext, TOutput, TEvent, TInput>>;
74
+ /** @public */
75
+ declare function createLogic<TContext, const TInputSchema extends StandardSchemaV1, const TOutputSchema extends StandardSchemaV1, TEvent extends EventObject = EventObject, TEmitted extends EventObject = EventObject>(config: LogicConfig<TContext, StandardSchemaV1.InferOutput<TOutputSchema>, TEvent, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema, TOutputSchema> & {
76
+ schemas: {
77
+ input: TInputSchema;
78
+ output: TOutputSchema;
79
+ };
80
+ }): LogicActorLogic<TContext, StandardSchemaV1.InferOutput<TOutputSchema>, TEvent, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted>;
81
+ declare function createLogic<TContext, TOutput, const TInputSchema extends StandardSchemaV1, TEvent extends EventObject = EventObject, TEmitted extends EventObject = EventObject>(config: LogicConfig<TContext, TOutput, TEvent, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema> & {
82
+ schemas: {
83
+ input: TInputSchema;
84
+ output?: undefined;
85
+ };
86
+ }): LogicActorLogic<TContext, TOutput, TEvent, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted>;
87
+ declare function createLogic<TContext, const TOutputSchema extends StandardSchemaV1, TEvent extends EventObject = EventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject>(config: LogicConfig<TContext, StandardSchemaV1.InferOutput<TOutputSchema>, TEvent, TInput, TEmitted, StandardSchemaV1, TOutputSchema> & {
88
+ schemas: {
89
+ input?: undefined;
90
+ output: TOutputSchema;
91
+ };
92
+ }): LogicActorLogic<TContext, StandardSchemaV1.InferOutput<TOutputSchema>, TEvent, TInput, TEmitted>;
93
+ declare function createLogic<TContext, TOutput = unknown, TEvent extends EventObject = EventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject>(config: LogicConfig<TContext, TOutput, TEvent, TInput, TEmitted>): LogicActorLogic<TContext, TOutput, TEvent, TInput, TEmitted>;
94
+ /** @public */
95
+ type CallbackSnapshot<TInput> = Snapshot<undefined> & {
96
+ input: TInput;
97
+ effects?: Record<string, {
98
+ status: 'active';
99
+ } | {
100
+ status: 'done';
101
+ output?: unknown;
102
+ } | {
103
+ status: 'error';
104
+ error: unknown;
105
+ }>;
106
+ };
107
+ /** @public */
108
+ type CallbackActorLogic<TEvent extends EventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject> = ActorLogic<CallbackSnapshot<TInput>, TEvent, TInput, AnyActorSystem, TEmitted>;
109
+ /**
110
+ * Represents an actor created by `createCallbackLogic`.
111
+ *
112
+ * The type of `self` within the actor's logic.
113
+ *
114
+ * @example
115
+ *
116
+ * ```ts
117
+ * import { createCallbackLogic, createActor } from '@systemfsoftware/xstate';
118
+ *
119
+ * // The events the actor receives.
120
+ * type Event = { type: 'someEvent' };
121
+ * // The actor's input.
122
+ * type Input = { name: string };
123
+ *
124
+ * // Actor logic that logs whenever it receives an event of type `someEvent`.
125
+ * const logic = createCallbackLogic<Event, Input>(
126
+ * ({ self, input, receive }) => {
127
+ * self;
128
+ * // ^? CallbackActorRef<Event, Input>
129
+ *
130
+ * receive((event) => {
131
+ * if (event.type === 'someEvent') {
132
+ * console.log(`${input.name}: received "someEvent" event`);
133
+ * // logs 'myActor: received "someEvent" event'
134
+ * }
135
+ * });
136
+ * }
137
+ * );
138
+ *
139
+ * const actor = createActor(logic, { input: { name: 'myActor' } });
140
+ * // ^? CallbackActorRef<Event, Input>
141
+ * ```
142
+ *
143
+ * @see {@link (createCallbackLogic:1)}
144
+ * @public
145
+ */
146
+ type CallbackActorRef<TEvent extends EventObject, TInput = NonReducibleUnknown> = ActorRefFromLogic<CallbackActorLogic<TEvent, TInput>>;
147
+ type Receiver<TEvent extends EventObject> = (listener: {
148
+ bivarianceHack(event: TEvent): void;
149
+ }['bivarianceHack']) => void;
150
+ /** @public */
151
+ type CallbackLogicFunction<TEvent extends EventObject = AnyEventObject, TSentEvent extends EventObject = AnyEventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject> = ({ input, system, self, sendBack, receive, emit }: {
152
+ /**
153
+ * Data that was provided to the callback actor
154
+ *
155
+ * @see {@link https://stately.ai/docs/input | Input docs}
156
+ */
157
+ input: TInput;
158
+ /** The actor system to which the callback actor belongs */
159
+ system: AnyActorSystem;
160
+ /** The parent actor of the callback actor */
161
+ self: CallbackActorRef<TEvent>;
162
+ /** A function that can send events back to the parent actor */
163
+ sendBack: (event: TSentEvent) => void;
164
+ /**
165
+ * A function that can be called with a listener function argument; the
166
+ * listener is then called whenever events are received by the callback actor
167
+ */
168
+ receive: Receiver<TEvent>;
169
+ emit: (emitted: TEmitted) => void;
170
+ }) => (() => void) | void;
171
+ /** @public */
172
+ interface CallbackLogicConfig<TEvent extends EventObject = AnyEventObject, TSentEvent extends EventObject = AnyEventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject, TInputSchema extends StandardSchemaV1 = StandardSchemaV1> {
173
+ validator?: ActorLogicValidator;
174
+ schemas?: {
175
+ input?: TInputSchema;
176
+ };
177
+ run: CallbackLogicFunction<TEvent, TSentEvent, TInput, TEmitted>;
178
+ }
179
+ /**
180
+ * An actor logic creator which returns callback logic as defined by a callback
181
+ * function.
182
+ *
183
+ * @remarks
184
+ * Useful for subscription-based or other free-form logic that can send events
185
+ * back to the parent actor.
186
+ *
187
+ * Actors created from callback logic (“callback actors”) can:
188
+ *
189
+ * - Receive events via the `receive` function
190
+ * - Send events to the parent actor via the `sendBack` function
191
+ *
192
+ * Callback actors are a bit different from other actors in that they:
193
+ *
194
+ * - Do not work with `onDone`
195
+ * - Do not produce a snapshot using `.getSnapshot()`
196
+ * - Do not emit values when used with `.subscribe()`
197
+ * - Can not be stopped with `.stop()`
198
+ *
199
+ * @example
200
+ *
201
+ * ```typescript
202
+ * const callbackLogic = createCallbackLogic(({ sendBack, receive }) => {
203
+ * let lockStatus = 'unlocked';
204
+ *
205
+ * const handler = (event) => {
206
+ * if (lockStatus === 'locked') {
207
+ * return;
208
+ * }
209
+ * sendBack(event);
210
+ * };
211
+ *
212
+ * receive((event) => {
213
+ * if (event.type === 'lock') {
214
+ * lockStatus = 'locked';
215
+ * } else if (event.type === 'unlock') {
216
+ * lockStatus = 'unlocked';
217
+ * }
218
+ * });
219
+ *
220
+ * document.body.addEventListener('click', handler);
221
+ *
222
+ * return () => {
223
+ * document.body.removeEventListener('click', handler);
224
+ * };
225
+ * });
226
+ * ```
227
+ *
228
+ * @param callback - The callback function used to describe the callback logic
229
+ * The callback function is passed an object with the following properties:
230
+ *
231
+ * - `receive` - A function that can send events back to the parent actor; the
232
+ * listener is then called whenever events are received by the callback
233
+ * actor
234
+ * - `sendBack` - A function that can send events back to the parent actor
235
+ * - `input` - Data that was provided to the callback actor
236
+ * - `self` - The parent actor of the callback actor
237
+ * - `system` - The actor system to which the callback actor belongs The callback
238
+ * function can (optionally) return a cleanup function, which is called
239
+ * when the actor is stopped.
240
+ *
241
+ * @returns Callback logic
242
+ * @see {@link CallbackLogicFunction} for more information about the callback function and its object argument
243
+ * @see {@link https://stately.ai/docs/input | Input docs} for more information about how input is passed
244
+ * @public
245
+ */
246
+ declare function createCallbackLogic<TEvent extends EventObject, const TInputSchema extends StandardSchemaV1, TEmitted extends EventObject = EventObject>(config: CallbackLogicConfig<TEvent, AnyEventObject, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema> & {
247
+ schemas: {
248
+ input: TInputSchema;
249
+ };
250
+ }): CallbackActorLogic<TEvent, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted>;
251
+ declare function createCallbackLogic<TEvent extends EventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject>(config: CallbackLogicConfig<TEvent, AnyEventObject, TInput, TEmitted> & {
252
+ schemas?: undefined;
253
+ }): CallbackActorLogic<TEvent, TInput, TEmitted>;
254
+ declare function createCallbackLogic<TEvent extends EventObject, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject>(callback: CallbackLogicFunction<TEvent, AnyEventObject, TInput, TEmitted>): CallbackActorLogic<TEvent, TInput, TEmitted>;
255
+ /** @public */
256
+ type ListenerSnapshot = Snapshot<undefined> & {
257
+ input: ListenerInput<any, any>;
258
+ };
259
+ /** @public */
260
+ interface ListenerInput<TEmitted extends EventObject, TMappedEvent extends EventObject> {
261
+ actor: AnyActor;
262
+ eventType: string;
263
+ mapper: (event: TEmitted) => TMappedEvent;
264
+ }
265
+ /** @public */
266
+ type ListenerActorLogic<TEmitted extends EventObject = EventObject, TMappedEvent extends EventObject = EventObject> = ActorLogic<ListenerSnapshot, EventObject, ListenerInput<TEmitted, TMappedEvent>, AnyActorSystem, EventObject>;
267
+ /** @public */
268
+ type ListenerActorRef<TEmitted extends EventObject = EventObject, TMappedEvent extends EventObject = EventObject> = ActorRefFromLogic<ListenerActorLogic<TEmitted, TMappedEvent>>;
269
+ /**
270
+ * Creates actor logic for listening to emitted events from another actor. Used
271
+ * internally by `enq.listen()`.
272
+ *
273
+ * @public
274
+ */
275
+ declare function createListenerLogic<TEmitted extends EventObject = EventObject, TMappedEvent extends EventObject = EventObject>(): ListenerActorLogic<TEmitted, TMappedEvent>;
276
+ /** @public */
277
+ declare const listenerLogic: ListenerActorLogic<EventObject, EventObject>;
278
+ /** @public */
279
+ type ObservableSnapshot<TContext, TInput extends NonReducibleUnknown> = Snapshot<undefined> & {
280
+ context: TContext | undefined;
281
+ input: TInput | undefined;
282
+ effects?: Record<string, {
283
+ status: 'active';
284
+ } | {
285
+ status: 'done';
286
+ output?: unknown;
287
+ } | {
288
+ status: 'error';
289
+ error: unknown;
290
+ }>;
291
+ _subscription: Subscription | undefined;
292
+ };
293
+ /** @public */
294
+ type ObservableActorLogic<TContext, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject> = ActorLogic<ObservableSnapshot<TContext, TInput>, {
295
+ type: string;
296
+ [k: string]: unknown;
297
+ }, TInput, AnyActorSystem, TEmitted>;
298
+ /**
299
+ * Represents an actor created by `createObservableLogic` or
300
+ * `createEventObservableLogic`.
301
+ *
302
+ * The type of `self` within the actor's logic.
303
+ *
304
+ * @example
305
+ *
306
+ * ```ts
307
+ * import { createObservableLogic, createActor } from '@systemfsoftware/xstate';
308
+ * import { interval } from 'rxjs';
309
+ *
310
+ * // The type of the value observed by the actor's logic.
311
+ * type Context = number;
312
+ * // The actor's input.
313
+ * type Input = { period?: number };
314
+ *
315
+ * // Actor logic that observes a number incremented every `input.period`
316
+ * // milliseconds (default: 1_000).
317
+ * const logic = createObservableLogic<Context, Input>(
318
+ * ({ input, self }) => {
319
+ * self;
320
+ * // ^? ObservableActor<Event, Input>
321
+ *
322
+ * return interval(input.period ?? 1_000);
323
+ * }
324
+ * );
325
+ *
326
+ * const actor = createActor(logic, { input: { period: 2_000 } });
327
+ * // ^? ObservableActor<Event, Input>
328
+ * ```
329
+ *
330
+ * @see {@link (createObservableLogic:1)}
331
+ * @see {@link (createEventObservableLogic:1)}
332
+ * @public
333
+ */
334
+ type ObservableActorRef<TContext> = ActorRefFromLogic<ObservableActorLogic<TContext, any>>;
335
+ type ObservableActor<TContext, TInput extends NonReducibleUnknown = any, TEmitted extends EventObject = EventObject> = ActorFromLogic<ObservableActorLogic<TContext, TInput, TEmitted>>;
336
+ /** @public */
337
+ type ObservableLogicFunction<TContext, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject> = ({ input, system, self, emit }: {
338
+ input: TInput;
339
+ system: AnyActorSystem;
340
+ self: ObservableActor<TContext, TInput, TEmitted>;
341
+ emit: (emitted: TEmitted) => void;
342
+ }) => Subscribable<TContext>;
343
+ /** @public */
344
+ interface ObservableLogicConfig<TContext, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject, TInputSchema extends StandardSchemaV1 = StandardSchemaV1> {
345
+ validator?: ActorLogicValidator;
346
+ schemas?: {
347
+ input?: TInputSchema;
348
+ };
349
+ run: ObservableLogicFunction<TContext, TInput, TEmitted>;
350
+ }
351
+ /** @public */
352
+ type EventObservableLogicFunction<TEvent extends EventObject, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject> = ({ input, system, self, emit }: {
353
+ input: TInput;
354
+ system: AnyActorSystem;
355
+ self: ObservableActor<TEvent, TInput, TEmitted>;
356
+ emit: (emitted: TEmitted) => void;
357
+ }) => Subscribable<TEvent>;
358
+ /** @public */
359
+ interface EventObservableLogicConfig<TEvent extends EventObject, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject, TInputSchema extends StandardSchemaV1 = StandardSchemaV1> {
360
+ validator?: ActorLogicValidator;
361
+ schemas?: {
362
+ input?: TInputSchema;
363
+ };
364
+ run: EventObservableLogicFunction<TEvent, TInput, TEmitted>;
365
+ }
366
+ /**
367
+ * Observable actor logic is described by an observable stream of values. Actors
368
+ * created from observable logic (“observable actors”) can:
369
+ *
370
+ * - Emit snapshots of the observable’s emitted value
371
+ *
372
+ * The observable’s emitted value is used as its observable actor’s `context`.
373
+ *
374
+ * Sending events to observable actors will have no effect.
375
+ *
376
+ * @example
377
+ *
378
+ * ```ts
379
+ * import { createObservableLogic, createActor } from '@systemfsoftware/xstate';
380
+ * import { interval } from 'rxjs';
381
+ *
382
+ * const logic = createObservableLogic((obj) => interval(1000));
383
+ *
384
+ * const actor = createActor(logic);
385
+ *
386
+ * actor.subscribe((snapshot) => {
387
+ * console.log(snapshot.context);
388
+ * });
389
+ *
390
+ * actor.start();
391
+ * // At every second:
392
+ * // Logs 0
393
+ * // Logs 1
394
+ * // Logs 2
395
+ * // ...
396
+ * ```
397
+ *
398
+ * @param observableCreator A function that creates an observable. It receives
399
+ * one argument, an object with the following properties:
400
+ *
401
+ * - `input` - Data that was provided to the observable actor
402
+ * - `self` - The parent actor
403
+ * - `system` - The actor system to which the observable actor belongs
404
+ *
405
+ * It should return a `Subscribable`, which is compatible with an RxJS
406
+ * Observable, although RxJS is not required to create them.
407
+ * @see {@link https://rxjs.dev} for documentation on RxJS Observable and observable creators.
408
+ * @see `Subscribable` interface in XState, which is based on and compatible with RxJS Observable.
409
+ * @public
410
+ */
411
+ declare function createObservableLogic<TContext, const TInputSchema extends StandardSchemaV1, TEmitted extends EventObject = EventObject>(config: ObservableLogicConfig<TContext, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema> & {
412
+ schemas: {
413
+ input: TInputSchema;
414
+ };
415
+ }): ObservableActorLogic<TContext, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted>;
416
+ declare function createObservableLogic<TContext, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject>(config: ObservableLogicConfig<TContext, TInput, TEmitted> & {
417
+ schemas?: undefined;
418
+ }): ObservableActorLogic<TContext, TInput, TEmitted>;
419
+ declare function createObservableLogic<TContext, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject>(observableCreator: ObservableLogicFunction<TContext, TInput, TEmitted>): ObservableActorLogic<TContext, TInput, TEmitted>;
420
+ /**
421
+ * Creates event observable logic that listens to an observable that delivers
422
+ * event objects.
423
+ *
424
+ * Event observable actor logic is described by an observable stream of
425
+ * {@link https://stately.ai/docs/transitions#event-objects | event objects}.
426
+ * Actors created from event observable logic (“event observable actors”) can:
427
+ *
428
+ * - Implicitly send events to its parent actor
429
+ * - Emit snapshots of its emitted event objects
430
+ *
431
+ * Sending events to event observable actors will have no effect.
432
+ *
433
+ * @example
434
+ *
435
+ * ```ts
436
+ * import {
437
+ * createEventObservableLogic,
438
+ * Subscribable,
439
+ * EventObject,
440
+ * createMachine,
441
+ * createActor
442
+ * } from '@systemfsoftware/xstate';
443
+ * import { fromEvent } from 'rxjs';
444
+ *
445
+ * const mouseClickLogic = createEventObservableLogic(
446
+ * () => fromEvent(document.body, 'click') as Subscribable<EventObject>
447
+ * );
448
+ *
449
+ * const canvasMachine = createMachine({
450
+ * invoke: {
451
+ * // Will send mouse `click` events to the canvas actor
452
+ * src: mouseClickLogic
453
+ * }
454
+ * });
455
+ *
456
+ * const canvasActor = createActor(canvasMachine);
457
+ * canvasActor.start();
458
+ * ```
459
+ *
460
+ * @param lazyObservable A function that creates an observable that delivers
461
+ * event objects. It receives one argument, an object with the following
462
+ * properties:
463
+ *
464
+ * - `input` - Data that was provided to the event observable actor
465
+ * - `self` - The parent actor
466
+ * - `system` - The actor system to which the event observable actor belongs.
467
+ *
468
+ * It should return a `Subscribable`, which is compatible with an RxJS
469
+ * Observable, although RxJS is not required to create them.
470
+ * @public
471
+ */
472
+ declare function createEventObservableLogic<TEvent extends EventObject, const TInputSchema extends StandardSchemaV1, TEmitted extends EventObject = EventObject>(config: EventObservableLogicConfig<TEvent, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema> & {
473
+ schemas: {
474
+ input: TInputSchema;
475
+ };
476
+ }): ObservableActorLogic<TEvent, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted>;
477
+ declare function createEventObservableLogic<TEvent extends EventObject, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject>(config: EventObservableLogicConfig<TEvent, TInput, TEmitted> & {
478
+ schemas?: undefined;
479
+ }): ObservableActorLogic<TEvent, TInput, TEmitted>;
480
+ declare function createEventObservableLogic<TEvent extends EventObject, TInput extends NonReducibleUnknown, TEmitted extends EventObject = EventObject>(lazyObservable: EventObservableLogicFunction<TEvent, TInput, TEmitted>): ObservableActorLogic<TEvent, TInput, TEmitted>;
481
+ /** @public */
482
+ type SubscriptionSnapshot = Snapshot<undefined> & {
483
+ input: SubscriptionInput<any, any, any, any>;
484
+ };
485
+ /** @public */
486
+ interface SubscriptionMappers<TSnapshot extends Snapshot<unknown>, TOutput, TMappedEvent extends EventObject> {
487
+ snapshot?: (snapshot: TSnapshot) => TMappedEvent;
488
+ done?: (output: TOutput) => TMappedEvent;
489
+ error?: (error: unknown) => TMappedEvent;
490
+ }
491
+ /** @public */
492
+ interface SubscriptionInput<TSnapshot extends Snapshot<unknown>, TOutput, TMappedEvent extends EventObject, TMappers extends SubscriptionMappers<TSnapshot, TOutput, TMappedEvent>> {
493
+ actor: AnyActorRef;
494
+ mappers: TMappers;
495
+ }
496
+ /** @public */
497
+ type SubscriptionActorLogic<TSnapshot extends Snapshot<unknown> = Snapshot<unknown>, TOutput = unknown, TMappedEvent extends EventObject = EventObject> = ActorLogic<SubscriptionSnapshot, EventObject, SubscriptionInput<TSnapshot, TOutput, TMappedEvent, SubscriptionMappers<TSnapshot, TOutput, TMappedEvent>>, AnyActorSystem, EventObject>;
498
+ /** @public */
499
+ type SubscriptionActorRef<TSnapshot extends Snapshot<unknown> = Snapshot<unknown>, TOutput = unknown, TMappedEvent extends EventObject = EventObject> = ActorRefFromLogic<SubscriptionActorLogic<TSnapshot, TOutput, TMappedEvent>>;
500
+ /**
501
+ * Creates actor logic for subscribing to lifecycle events (done/error/snapshot)
502
+ * from another actor. Used internally by `enq.subscribeTo()`.
503
+ *
504
+ * @public
505
+ */
506
+ declare function createSubscriptionLogic<TSnapshot extends Snapshot<unknown> = Snapshot<unknown>, TOutput = unknown, TMappedEvent extends EventObject = EventObject>(): SubscriptionActorLogic<TSnapshot, TOutput, TMappedEvent>;
507
+ /** @public */
508
+ declare const subscriptionLogic: SubscriptionActorLogic<Snapshot<unknown>, unknown, EventObject>;
509
+ declare const emptyLogic: LogicActorLogic<undefined, undefined, EventObject, NonReducibleUnknown, EventObject>;
510
+ /** @public */
511
+ declare function createEmptyActor(): ActorFromLogic<typeof emptyLogic>;
512
+ export { LogicActorLogic as A, createLogic as B, listenerLogic as C, CallbackLogicFunction as D, CallbackLogicConfig as E, LogicEffectState as F, LogicEnqueue as I, LogicFunction as L, LogicArgs as M, LogicConfig as N, CallbackSnapshot as O, LogicEffect as P, LogicPatch as R, createListenerLogic as S, CallbackActorRef as T, createObservableLogic as _, SubscriptionMappers as a, ListenerInput as b, subscriptionLogic as c, ObservableActorLogic as d, ObservableActorRef as f, createEventObservableLogic as g, ObservableSnapshot as h, SubscriptionInput as i, LogicActorRef as j, createCallbackLogic as k, EventObservableLogicConfig as l, ObservableLogicFunction as m, SubscriptionActorLogic as n, SubscriptionSnapshot as o, ObservableLogicConfig as p, SubscriptionActorRef as r, createSubscriptionLogic as s, createEmptyActor as t, EventObservableLogicFunction as u, ListenerActorLogic as v, CallbackActorLogic as w, ListenerSnapshot as x, ListenerActorRef as y, LogicSnapshot as z };
@@ -0,0 +1,6 @@
1
+ import { c as SetupStateSchema, d as SetupStateSchemas, f as StandardSchemaV1, h as types, i as InferEvents, l as SetupStateType, m as isTypeSchema, n as EventObject, o as MachineContext, p as TypeSchema, s as SetupSchemas, u as Values } from "./base.types-DF8ZPiXj.js";
2
+ import { $ as DelayExpr, $n as TransitionConfigFunction, $t as PersistedSnapshotFor, A as AnyInvokeConfig, An as StateMachineTypes, Ar as ActorSystemRuntime, At as InteropSubscribable, B as BaseActorRef, Bn as Subscribable, Br as InspectionEvent, Bt as MachineTypes, C as AnyActor, Cn as StateConfig, Cr as LogicArgs, Ct as HomomorphicOmit, D as AnyEventObject, Dn as StateIdInputs, Dr as TimeoutError, Dt as InitialTransitionDefinition, E as AnyActorScope, En as StateId, Er as LogicFunction, Et as InitialTransitionConfig, F as AnyStateNode, Fn as StateValue, Fr as EventRejection, Ft as IsNotNever, G as Cast, Gn as TagsFrom, Gr as ActorValidationEventOrigin, Gt as NormalizeDescriptor, H as BuiltInExecutableActionObject, Hn as Subscription, Hr as TransitionInspectionEvent, Ht as MaybeLazy, I as AnyStateNodeConfig, In as StateValueFrom, Ir as EventRejectionReason, It as Lazy, J as ContextFactory, Jn as TimerEvent, Jr as MachineSnapshotSchema, Jt as OutputFrom, K as Compute, Kn as TerminateExecutableActionObject, Kr as ActorValidationRequest, Kt as Observer, L as AnyTransitionConfig, Ln as StateValueFromStateSchema, Lr as WallClock, Lt as LogicalTimer, M as AnyMachineSnapshot, Mn as StateSchema, Mt as IsAny, N as AnyStateConfig, Nn as StateSchemaFrom, Nr as CryptoSource, Nt as IsLiteralString, O as AnyFunction, Oi as MachineSnapshot, On as StateKey, Or as createAsyncLogic, Ot as InputFrom, P as AnyStateMachine, Pn as StateTypes, Pr as DeadLetterDetail, Pt as IsNever, Q as DelayConfig, Qn as TransitionConfig, Qt as PersistedMachineIdentity, R as AnyTransitionConfigFunction, Rn as StateValueMap, Rr as ActionRecord, Rt as LowInfer, S as AnyAction, Sn as StartExecutableActionObject, Sr as AsyncSnapshot, St as HistoryValue, T as AnyActorRef, Ti as WidenLiterals, Tn as StateFrom, Tr as LogicEnqueue, Tt as InitialContext, U as CallbackActors, Un as SystemRegistry, Ur as ActorLogicValidator, Ut as MetaObject, V as BaseExecutableActionObject, Vn as SubscribeToMappers, Vr as SentRecord, Vt as Mapper, W as CancelExecutableActionObject, Wn as TODO, Wr as ActorValidationBoundary, Wt as NonReducibleUnknown, X as CustomExecutableActionObject, Xn as ToExecutableAction, Xr as PersistedMachineSnapshot, Xt as PersistedActorRef, Y as ContextFrom, Yn as ToChildren, Yr as MachineVersionDescriptor, Yt as ParameterizedObject, Z as DeadLetterExecutableActionObject, Zn as ToStateValue, Zt as PersistedHistoryValue, _ as ActorSystemInfo, _n as SnapshotFrom, _r as RequiredActorOptionsFor, _t as EventPayloadPattern, a as ActorInstance, an as Readable, ar as TransitionTarget, at as DoneStateEvent, b as ActorTrigger, bn as SpecialExecutableAction, br as AsyncActorLogic, bt as ExtractEvent, c as ActorLogicTransitionResult, cn as RequiredLogicInput, cr as UnknownActorLogic, ct as EnqueueObject, d as ActorRefFrom, dn as SendToExecutableActionObject, dr as InfiniteTransitionError, dt as ErrorEvent, en as PersistedSnapshotFrom, er as TransitionConfigTarget, et as DelayedTransitionDefinition, f as ActorRefFromLogic, fi as Next_MachineConfig, fn as SendableEventFromLogic, fr as getStateNodes, ft as ErrorFrom, g as ActorSelf, gn as SnapshotEvent, gr as Actor, gt as EventFromLogic, h as ActorScope, hi as Next_TransitionConfigOrTarget, hn as Snapshot, hr as Spawner, ht as EventFrom, i as ActorFromLogic, in as RaiseExecutableActionObject, ir as TransitionDefinitionMap, it as DoneActorEvent, j as AnyInvokeDefinition, jn as StateNodesConfig, jr as AnyActorSystem, jt as InvokeDefinition, k as AnyHistoryValue, ki as isMachineSnapshot, kn as StateLike, kr as ActorSystem, kt as InteropObservable, l as ActorOptions, li as Next_ChoiceStateNodeConfig, ln as RestorablePersistedSnapshotFor, lr as UnknownActorRef, lt as Equals, m as ActorRuntime, mi as Next_StateNodeConfig, mn as SingleOrArray, mr as StateNode, mt as EventDescriptor, n as ActionArgs, nn as Prop, nr as TransitionContextPatch, nt as DevToolsAdapter, o as ActorLike, on as RegistryKeyForLogic, or as TransitionsConfig, ot as EmitExecutableActionObject, p as ActorRefLike, pi as Next_RegularStateNodeConfig, pn as SetupTypes, pr as checkStateIn, pt as ErrorPlatformEvent, q as ConditionalRequired, qn as TimeoutEvent, qr as MachineEventSchema, qt as OutputArg, r as ActionExecutor, rn as ProvidedActor, rr as TransitionDefinition, rt as DoNotInfer, s as ActorLogic, sn as RequiredActorOptions, sr as UnifiedArg, st as EmittedFrom, t as Action, tn as PersistedSnapshotOf, tr as TransitionContextMapper, tt as DelayedTransitions, u as ActorRef, ui as Next_InvokeConfig, un as RoutableStateId, ur as StateMachine, ut as ErrorActorEvent, v as ActorTermination, vi as Sources, vn as SnapshotStatus, vr as RequiredActorOptionsKeys, vt as ExecutableActionObject, w as AnyActorLogic, wn as StateContextFromStateValue, wr as LogicConfig, wt as InferEvent, x as AfterEvent, xn as SpecialTargets, xr as AsyncActorRef, xt as HistoryStateNode, y as ActorTimeoutEvent, yn as SpawnExecutableActionObject, yr as createActor, yt as ExecutableActionObjectFromLogic, z as AnyTransitionDefinition, zn as StopExecutableActionObject, zr as ActorInspectionEvent, zt as MachineSourcesFrom } from "./types-B2EAwOk-.js";
3
+ import { A as LogicActorLogic, B as createLogic, C as listenerLogic, D as CallbackLogicFunction, E as CallbackLogicConfig, F as LogicEffectState, I as LogicEnqueue$1, L as LogicFunction$1, M as LogicArgs$1, N as LogicConfig$1, O as CallbackSnapshot, P as LogicEffect, R as LogicPatch, S as createListenerLogic, T as CallbackActorRef, _ as createObservableLogic, a as SubscriptionMappers, b as ListenerInput, c as subscriptionLogic, d as ObservableActorLogic, f as ObservableActorRef, g as createEventObservableLogic, h as ObservableSnapshot, i as SubscriptionInput, j as LogicActorRef, k as createCallbackLogic, l as EventObservableLogicConfig, m as ObservableLogicFunction, n as SubscriptionActorLogic, o as SubscriptionSnapshot, p as ObservableLogicConfig, r as SubscriptionActorRef, s as createSubscriptionLogic, t as createEmptyActor, u as EventObservableLogicFunction, v as ListenerActorLogic, w as CallbackActorLogic, x as ListenerSnapshot, y as ListenerActorRef, z as LogicSnapshot } from "./index-DDWoKIF5.js";
4
+ import { n as getEffectDescriptor, t as EffectDescriptor } from "./effectDescriptor-EvNuy6U3.js";
5
+ import { $ as WithRootSetupStateSchemas, A as initialSystemTransition, B as RootContextMarker, C as SystemEffectResult, Ct as createMachineFromConfig, D as SystemSnapshot, Dt as assertEvent, E as SystemMessage, Et as createStateConfig, F as CreateAsyncInvokeConfig, G as SetupStateParentTypeMarker, H as SetupConfig, I as CreateInvokeConfig, J as StrictSetupStateTargetsFlag, K as SetupStateSchemasWithParentType, L as CreatedInvoke, M as SimulatedClock, N as ActiveStateContext, O as SystemTimer, P as AnySetupConfig, Q as SystemRuntime, R as CurrentSetupStateSchemaMarker, S as SystemActorState, St as TransitionJSON, T as SystemLogic, Tt as createMachineFromCompiledConfig, U as SetupReturn, V as RootSetupStateSchemasMarker, W as SetupReturnFromConfig, X as SystemActorMap, Y as StrictSetupStateTargetsMarker, Z as SystemConfig, _ as stopActor, _t as ActionJSON, a as isBuiltInExecutableAction, at as serializeMachine, b as InitialSystemTransitionOptions, bt as MachineJSON, c as getNextTransitions, ct as EventAdapterHandlers, d as transition, dt as MigrateSnapshotOptions, et as createSystem, f as toPromise, ft as ParsedPersistedSnapshot, g as runStep, gt as machineVersions, h as deliverEvent, ht as SnapshotMigrationHandlers, i as executeEffects, it as machineConfigToJSON, j as systemTransition, k as advanceSystemTime, l as initialTransition, lt as EventHistorySource, m as pathToStateValue, mt as PersistedSnapshotSource, n as getAllOwnEventDescriptors, nt as hotSwapActorLogic, o as getInitialMicrosteps, ot as mapState, p as matchesState, pt as PersistedSnapshotDataFrom, q as StrictSetupStateSchemas, r as toObserver, rt as CodeExpression, s as getMicrosteps, st as AdaptEventsOptions, t as waitFor, tt as setup, u as isUnhandled, ut as MachineVersionsOptions, v as terminateActor, vt as GuardJSON, w as SystemExternalEffect, wt as createMachine, x as SystemActorReference, xt as StateNodeJSON, y as parseDelayToMilliseconds, yt as InvokeJSON, z as RelativeSetupStateSchemasMarker } from "./index-CKUyiMZC.js";
6
+ export { type Action, type ActionArgs, type ActionExecutor, type ActionJSON, type ActionRecord, type ActiveStateContext, Actor, type ActorFromLogic, type ActorInspectionEvent, type ActorInstance, type ActorLike, type ActorLogic, type ActorLogicTransitionResult, type ActorLogicValidator, type ActorOptions, type ActorRef, type ActorRefFrom, type ActorRefFromLogic, type ActorRefLike, type ActorRuntime, type ActorScope, type ActorSelf, type ActorSystem, type ActorSystemInfo, type ActorSystemRuntime, type ActorTermination, type ActorTimeoutEvent, type ActorTrigger, type ActorValidationBoundary, type ActorValidationEventOrigin, type ActorValidationRequest, type AdaptEventsOptions, type AfterEvent, type AnyAction, type AnyActor, type AnyActorLogic, type AnyActorRef, type AnyActorScope, type AnyActorSystem, type AnyEventObject, type AnyFunction, type AnyHistoryValue, type AnyInvokeConfig, type AnyInvokeDefinition, type AnyMachineSnapshot, type AnySetupConfig, type AnyStateConfig, type AnyStateMachine, type AnyStateNode, type AnyStateNodeConfig, type AnyTransitionConfig, type AnyTransitionConfigFunction, type AnyTransitionDefinition, type AsyncActorLogic, type AsyncActorRef, type LogicArgs as AsyncLogicArgs, type LogicConfig as AsyncLogicConfig, type LogicEnqueue as AsyncLogicEnqueue, type LogicFunction as AsyncLogicFunction, type AsyncSnapshot, type BaseActorRef, type BaseExecutableActionObject, type BuiltInExecutableActionObject, type CallbackActorLogic, type CallbackActorRef, type CallbackActors, type CallbackLogicConfig, type CallbackLogicFunction, type CallbackSnapshot, type CancelExecutableActionObject, type Cast, type Next_ChoiceStateNodeConfig as ChoiceStateNodeConfig, type CodeExpression, type Compute, type ConditionalRequired, type ContextFactory, type ContextFrom, type CreateAsyncInvokeConfig, type CreateInvokeConfig, type CreatedInvoke, type CryptoSource, type CurrentSetupStateSchemaMarker, type CustomExecutableActionObject, type DeadLetterDetail, type DeadLetterExecutableActionObject, type DelayConfig, type DelayExpr, type DelayedTransitionDefinition, type DelayedTransitions, type DevToolsAdapter, type DoNotInfer, type DoneActorEvent, type DoneStateEvent, type EffectDescriptor, type EmitExecutableActionObject, type EmittedFrom, type EnqueueObject, type Equals, type ErrorActorEvent, type ErrorEvent, type ErrorFrom, type ErrorPlatformEvent, type EventAdapterHandlers, type EventDescriptor, type EventFrom, type EventFromLogic, type EventHistorySource, type EventObject, type EventObservableLogicConfig, type EventObservableLogicFunction, type EventPayloadPattern, type EventRejection, type EventRejectionReason, type ExecutableActionObject, type ExecutableActionObjectFromLogic, type ExtractEvent, type GuardJSON, type HistoryStateNode, type HistoryValue, type HomomorphicOmit, type InferEvent, type InferEvents, InfiniteTransitionError, type InitialContext, type InitialSystemTransitionOptions, type InitialTransitionConfig, type InitialTransitionDefinition, type InputFrom, type InspectionEvent, type InteropObservable, type InteropSubscribable, type Next_InvokeConfig as InvokeConfig, type InvokeDefinition, type InvokeJSON, type IsAny, type IsLiteralString, type IsNever, type IsNotNever, type Lazy, type ListenerActorLogic, type ListenerActorRef, type ListenerInput, type ListenerSnapshot, type LogicActorLogic, type LogicActorRef, type LogicArgs$1 as LogicArgs, type LogicConfig$1 as LogicConfig, type LogicEffect, type LogicEffectState, type LogicEnqueue$1 as LogicEnqueue, type LogicFunction$1 as LogicFunction, type LogicPatch, type LogicSnapshot, type LogicalTimer, type LowInfer, type Next_MachineConfig as MachineConfig, type MachineContext, type MachineEventSchema, type MachineJSON, type MachineSnapshot, type MachineSnapshotSchema, type MachineSourcesFrom, type MachineTypes, type MachineVersionDescriptor, type MachineVersionsOptions, type Mapper, type MaybeLazy, type MetaObject, type MigrateSnapshotOptions, type NonReducibleUnknown, type NormalizeDescriptor, type ObservableActorLogic, type ObservableActorRef, type ObservableLogicConfig, type ObservableLogicFunction, type ObservableSnapshot, type Observer, type OutputArg, type OutputFrom, type ParameterizedObject, type ParsedPersistedSnapshot, type PersistedActorRef, type PersistedHistoryValue, type PersistedMachineIdentity, type PersistedMachineSnapshot, type PersistedSnapshotDataFrom, type PersistedSnapshotFor, type PersistedSnapshotFrom, type PersistedSnapshotOf, type PersistedSnapshotSource, type Prop, type ProvidedActor, type RaiseExecutableActionObject, type Readable, type RegistryKeyForLogic, type Next_RegularStateNodeConfig as RegularStateNodeConfig, type RelativeSetupStateSchemasMarker, type RequiredActorOptions, type RequiredActorOptionsFor, type RequiredActorOptionsKeys, type RequiredLogicInput, type RestorablePersistedSnapshotFor, type RootContextMarker, type RootSetupStateSchemasMarker, type RoutableStateId, type SendToExecutableActionObject, type SendableEventFromLogic, type SentRecord, type SetupConfig, type SetupReturn, type SetupReturnFromConfig, type SetupSchemas, type SetupStateParentTypeMarker, type SetupStateSchema, type SetupStateSchemas, type SetupStateSchemasWithParentType, type SetupStateType, type SetupTypes, SimulatedClock, type SingleOrArray, type Snapshot, type SnapshotEvent, type SnapshotFrom, type SnapshotMigrationHandlers, type SnapshotStatus, type Sources, type SpawnExecutableActionObject, type Spawner, type SpecialExecutableAction, SpecialTargets, type StandardSchemaV1, type StartExecutableActionObject, type StateConfig, type StateContextFromStateValue, type StateFrom, type StateId, type StateIdInputs, type StateKey, type StateLike, StateMachine, type StateMachineTypes, StateNode, type Next_StateNodeConfig as StateNodeConfig, type StateNodeJSON, type StateNodesConfig, type StateSchema, type StateSchemaFrom, type StateTypes, type StateValue, type StateValueFrom, type StateValueFromStateSchema, type StateValueMap, type StopExecutableActionObject, type StrictSetupStateSchemas, type StrictSetupStateTargetsFlag, type StrictSetupStateTargetsMarker, type Subscribable, type SubscribeToMappers, type Subscription, type SubscriptionActorLogic, type SubscriptionActorRef, type SubscriptionInput, type SubscriptionMappers, type SubscriptionSnapshot, type SystemActorMap, type SystemActorReference, type SystemActorState, type SystemConfig, type SystemEffectResult, type SystemExternalEffect, type SystemLogic, type SystemMessage, type SystemRegistry, type SystemRuntime, type SystemSnapshot, type SystemTimer, type TODO, type TagsFrom, type TerminateExecutableActionObject, TimeoutError, type TimeoutEvent, type TimerEvent, type ToChildren, type ToExecutableAction, type ToStateValue, type TransitionConfig, type TransitionConfigFunction, type Next_TransitionConfigOrTarget as TransitionConfigOrTarget, type TransitionConfigTarget, type TransitionContextMapper, type TransitionContextPatch, type TransitionDefinition, type TransitionDefinitionMap, type TransitionInspectionEvent, type TransitionJSON, type TransitionTarget, type TransitionsConfig, type TypeSchema, type UnifiedArg, type UnknownActorLogic, type UnknownActorRef, type Values, type WallClock, type WidenLiterals, type WithRootSetupStateSchemas, getAllOwnEventDescriptors as __unsafe_getAllOwnEventDescriptors, createMachineFromCompiledConfig as _createMachineFromCompiledConfig, hotSwapActorLogic as _hotSwapActorLogic, parseDelayToMilliseconds as _parseDelayToMilliseconds, advanceSystemTime, assertEvent, checkStateIn, createActor, createAsyncLogic, createCallbackLogic, createEmptyActor, createEventObservableLogic, createListenerLogic, createLogic, createMachine, createMachineFromConfig, createObservableLogic, createStateConfig, createSubscriptionLogic, createSystem, deliverEvent, executeEffects, getEffectDescriptor, getInitialMicrosteps, getMicrosteps, getNextTransitions, getStateNodes, initialSystemTransition, initialTransition, isBuiltInExecutableAction, isMachineSnapshot, isTypeSchema, isUnhandled, listenerLogic, machineConfigToJSON, machineVersions, mapState, matchesState, pathToStateValue, runStep, serializeMachine, setup, stopActor, subscriptionLogic, systemTransition, terminateActor, toObserver, toPromise, transition, types, waitFor };
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import { n as getAllOwnEventDescriptors, p as toObserver } from "./utils-CXBxxp3Z.mjs";
2
+ import { $ as matchesState, A as executeEffects, B as createListenerLogic, M as isBuiltInExecutableAction, R as createSubscriptionLogic, V as listenerLogic, X as isMachineSnapshot, _t as stopActor, a as InfiniteTransitionError, at as parseDelayToMilliseconds, et as pathToStateValue, gt as runStep, ht as deliverEvent, i as StateNode, n as Actor, r as createActor, u as getStateNodes, v as checkStateIn, vt as terminateActor, z as subscriptionLogic } from "./createActor-BGHd7i8Q.mjs";
3
+ import { _ as createStateConfig, a as systemTransition, b as SpecialTargets, c as setup, d as serializeMachine, f as mapState, g as createMachineFromCompiledConfig, h as createMachine, i as initialSystemTransition, l as hotSwapActorLogic, m as createMachineFromConfig, n as toPromise, o as SimulatedClock, p as machineVersions, r as advanceSystemTime, s as createSystem, t as waitFor, u as machineConfigToJSON, v as StateMachine, y as assertEvent } from "./src-zLWug7SF.mjs";
4
+ import { a as createObservableLogic, i as createEventObservableLogic, n as TimeoutError, o as createCallbackLogic, r as createAsyncLogic, s as createLogic, t as createEmptyActor } from "./actors-LxMBvgxO.mjs";
5
+ import { n as types, t as isTypeSchema } from "./schema.types-tsIbgQd-.mjs";
6
+ import { a as isUnhandled, i as initialTransition, n as getMicrosteps, o as transition, r as getNextTransitions, s as getEffectDescriptor, t as getInitialMicrosteps } from "./transition-ZMXyPI-x.mjs";
7
+ export { Actor, InfiniteTransitionError, SimulatedClock, SpecialTargets, StateMachine, StateNode, TimeoutError, getAllOwnEventDescriptors as __unsafe_getAllOwnEventDescriptors, createMachineFromCompiledConfig as _createMachineFromCompiledConfig, hotSwapActorLogic as _hotSwapActorLogic, parseDelayToMilliseconds as _parseDelayToMilliseconds, advanceSystemTime, assertEvent, checkStateIn, createActor, createAsyncLogic, createCallbackLogic, createEmptyActor, createEventObservableLogic, createListenerLogic, createLogic, createMachine, createMachineFromConfig, createObservableLogic, createStateConfig, createSubscriptionLogic, createSystem, deliverEvent, executeEffects, getEffectDescriptor, getInitialMicrosteps, getMicrosteps, getNextTransitions, getStateNodes, initialSystemTransition, initialTransition, isBuiltInExecutableAction, isMachineSnapshot, isTypeSchema, isUnhandled, listenerLogic, machineConfigToJSON, machineVersions, mapState, matchesState, pathToStateValue, runStep, serializeMachine, setup, stopActor, subscriptionLogic, systemTransition, terminateActor, toObserver, toPromise, transition, types, waitFor };
@@ -0,0 +1,46 @@
1
+ // src/schema.types.ts
2
+ /**
3
+ * Declares schema types for inference only — no runtime validation.
4
+ *
5
+ * Use in a machine's `schemas` when you want TypeScript types without pulling
6
+ * in a schema library like Zod. The returned value is a valid Standard Schema
7
+ * whose validation is the identity function, so it carries types but never
8
+ * rejects input.
9
+ *
10
+ * @example
11
+ *
12
+ * ```ts
13
+ * import { createMachine, types } from '@systemfsoftware/xstate';
14
+ *
15
+ * const machine = createMachine({
16
+ * schemas: {
17
+ * context: types<{ count: number }>(),
18
+ * events: {
19
+ * inc: types<{ by: number }>(),
20
+ * reset: types<void>()
21
+ * }
22
+ * },
23
+ * context: { count: 0 }
24
+ * // ...
25
+ * });
26
+ * ```
27
+ *
28
+ * Use `types<void>()` for events without a payload.
29
+ * @public
30
+ */
31
+ function types() {
32
+ return { "~standard": {
33
+ version: 1,
34
+ vendor: "xstate.types",
35
+ validate: (value) => ({ value })
36
+ } };
37
+ }
38
+ /**
39
+ * Returns true if the value is a type-only schema created by {@link types}.
40
+ *
41
+ * @public
42
+ */
43
+ function isTypeSchema(value) {
44
+ return !!value && typeof value === "object" && "~standard" in value && value["~standard"].vendor === "xstate.types";
45
+ }
46
+ export { types as n, isTypeSchema as t };