xstate 5.9.1 → 5.11.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.
Files changed (40) hide show
  1. package/actions/dist/xstate-actions.cjs.js +2 -2
  2. package/actions/dist/xstate-actions.development.cjs.js +2 -2
  3. package/actions/dist/xstate-actions.development.esm.js +2 -2
  4. package/actions/dist/xstate-actions.esm.js +2 -2
  5. package/actions/dist/xstate-actions.umd.min.js +1 -1
  6. package/actions/dist/xstate-actions.umd.min.js.map +1 -1
  7. package/actors/dist/xstate-actors.cjs.js +1 -1
  8. package/actors/dist/xstate-actors.development.cjs.js +1 -1
  9. package/actors/dist/xstate-actors.development.esm.js +1 -1
  10. package/actors/dist/xstate-actors.esm.js +1 -1
  11. package/actors/dist/xstate-actors.umd.min.js +1 -1
  12. package/actors/dist/xstate-actors.umd.min.js.map +1 -1
  13. package/dist/declarations/src/StateMachine.d.ts +2 -2
  14. package/dist/declarations/src/actions/raise.d.ts +2 -2
  15. package/dist/declarations/src/actions/send.d.ts +2 -2
  16. package/dist/declarations/src/actions/spawnChild.d.ts +7 -2
  17. package/dist/declarations/src/guards.d.ts +4 -4
  18. package/dist/declarations/src/spawn.d.ts +9 -1
  19. package/dist/declarations/src/system.d.ts +3 -0
  20. package/dist/declarations/src/types.d.ts +15 -3
  21. package/dist/{log-a312ebfc.cjs.js → log-11d3f771.cjs.js} +6 -5
  22. package/dist/{log-28ea35fe.development.cjs.js → log-6380a394.development.cjs.js} +6 -5
  23. package/dist/{log-c48e8ab0.esm.js → log-cd22d72c.esm.js} +6 -5
  24. package/dist/{log-0fbf8cec.development.esm.js → log-f64de12b.development.esm.js} +6 -5
  25. package/dist/{raise-80cc66b2.development.esm.js → raise-03a786f4.development.esm.js} +11 -5
  26. package/dist/{raise-411df926.esm.js → raise-040ba012.esm.js} +11 -5
  27. package/dist/{raise-182bb5c9.cjs.js → raise-40b1a1f5.cjs.js} +11 -5
  28. package/dist/{raise-933cd731.development.cjs.js → raise-52a00e8f.development.cjs.js} +11 -5
  29. package/dist/xstate.cjs.js +2 -2
  30. package/dist/xstate.development.cjs.js +2 -2
  31. package/dist/xstate.development.esm.js +4 -4
  32. package/dist/xstate.esm.js +4 -4
  33. package/dist/xstate.umd.min.js +1 -1
  34. package/dist/xstate.umd.min.js.map +1 -1
  35. package/guards/dist/xstate-guards.cjs.js +1 -1
  36. package/guards/dist/xstate-guards.development.cjs.js +1 -1
  37. package/guards/dist/xstate-guards.development.esm.js +1 -1
  38. package/guards/dist/xstate-guards.esm.js +1 -1
  39. package/guards/dist/xstate-guards.umd.min.js.map +1 -1
  40. package/package.json +1 -1
@@ -10,12 +10,17 @@ interface SpawnActionOptions<TContext extends MachineContext, TExpressionEvent e
10
10
  input?: Mapper<TContext, TEvent, InputFrom<TActor['logic']>, TEvent> | InputFrom<TActor['logic']>;
11
11
  syncSnapshot?: boolean;
12
12
  }
13
- type DistributeActors<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor> = TActor extends any ? ConditionalRequired<[
13
+ type DistributeActors<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor> = (TActor extends any ? ConditionalRequired<[
14
14
  src: TActor['src'],
15
15
  options?: SpawnActionOptions<TContext, TExpressionEvent, TEvent, TActor> & {
16
16
  [K in RequiredActorOptions<TActor>]: unknown;
17
17
  }
18
- ], IsNotNever<RequiredActorOptions<TActor>>> : never;
18
+ ], IsNotNever<RequiredActorOptions<TActor>>> : never) | [
19
+ src: AnyActorLogic,
20
+ options?: SpawnActionOptions<TContext, TExpressionEvent, TEvent, ProvidedActor> & {
21
+ id?: never;
22
+ }
23
+ ];
19
24
  type SpawnArguments<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor> = IsLiteralString<TActor['src']> extends true ? DistributeActors<TContext, TExpressionEvent, TEvent, TActor> : [
20
25
  src: string | AnyActorLogic,
21
26
  options?: {
@@ -1,4 +1,4 @@
1
- import type { EventObject, StateValue, MachineContext, ParameterizedObject, AnyMachineSnapshot, NoRequiredParams, NoInfer, WithDynamicParams, Identity, Elements } from "./types.js";
1
+ import type { EventObject, StateValue, MachineContext, ParameterizedObject, AnyMachineSnapshot, NoRequiredParams, WithDynamicParams, Identity, Elements, DoNotInfer } from "./types.js";
2
2
  type SingleGuardArg<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TGuardArg> = [TGuardArg] extends [{
3
3
  type: string;
4
4
  }] ? Identity<TGuardArg> : [TGuardArg] extends [string] ? TGuardArg : GuardPredicate<TContext, TExpressionEvent, TParams, ParameterizedObject>;
@@ -52,7 +52,7 @@ export declare function stateIn<TContext extends MachineContext, TExpressionEven
52
52
  ```
53
53
  * @returns A guard
54
54
  */
55
- export declare function not<TContext extends MachineContext, TExpressionEvent extends EventObject, TArg>(guard: SingleGuardArg<TContext, TExpressionEvent, unknown, TArg>): GuardPredicate<TContext, TExpressionEvent, unknown, NormalizeGuardArg<NoInfer<TArg>>>;
55
+ export declare function not<TContext extends MachineContext, TExpressionEvent extends EventObject, TArg>(guard: SingleGuardArg<TContext, TExpressionEvent, unknown, TArg>): GuardPredicate<TContext, TExpressionEvent, unknown, NormalizeGuardArg<DoNotInfer<TArg>>>;
56
56
  /**
57
57
  * Higher-order guard that evaluates to `true` if all `guards` passed to it
58
58
  * evaluate to `true`.
@@ -87,7 +87,7 @@ export declare function and<TContext extends MachineContext, TExpressionEvent ex
87
87
  ...{
88
88
  [K in keyof TArg]: SingleGuardArg<TContext, TExpressionEvent, unknown, TArg[K]>;
89
89
  }
90
- ]): GuardPredicate<TContext, TExpressionEvent, unknown, NormalizeGuardArgArray<NoInfer<TArg>>>;
90
+ ]): GuardPredicate<TContext, TExpressionEvent, unknown, NormalizeGuardArgArray<DoNotInfer<TArg>>>;
91
91
  /**
92
92
  * Higher-order guard that evaluates to `true` if any of the `guards` passed to it
93
93
  * evaluate to `true`.
@@ -122,6 +122,6 @@ export declare function or<TContext extends MachineContext, TExpressionEvent ext
122
122
  ...{
123
123
  [K in keyof TArg]: SingleGuardArg<TContext, TExpressionEvent, unknown, TArg[K]>;
124
124
  }
125
- ]): GuardPredicate<TContext, TExpressionEvent, unknown, NormalizeGuardArgArray<NoInfer<TArg>>>;
125
+ ]): GuardPredicate<TContext, TExpressionEvent, unknown, NormalizeGuardArgArray<DoNotInfer<TArg>>>;
126
126
  export declare function evaluateGuard<TContext extends MachineContext, TExpressionEvent extends EventObject>(guard: UnknownGuard | UnknownInlineGuard, context: TContext, event: TExpressionEvent, snapshot: AnyMachineSnapshot): boolean;
127
127
  export {};
@@ -14,7 +14,15 @@ type SpawnOptions<TActor extends ProvidedActor, TSrc extends TActor['src']> = TA
14
14
  type GetConcreteLogic<TActor extends ProvidedActor, TSrc extends TActor['src']> = Extract<TActor, {
15
15
  src: TSrc;
16
16
  }>['logic'];
17
- export type Spawner<TActor extends ProvidedActor> = IsLiteralString<TActor['src']> extends true ? <TSrc extends TActor['src']>(logic: TSrc, ...[options]: SpawnOptions<TActor, TSrc>) => ActorRefFrom<GetConcreteLogic<TActor, TSrc>> : <TLogic extends AnyActorLogic | string>(src: TLogic, options?: {
17
+ export type Spawner<TActor extends ProvidedActor> = IsLiteralString<TActor['src']> extends true ? {
18
+ <TSrc extends TActor['src']>(logic: TSrc, ...[options]: SpawnOptions<TActor, TSrc>): ActorRefFrom<GetConcreteLogic<TActor, TSrc>>;
19
+ <TLogic extends AnyActorLogic>(src: TLogic, options?: {
20
+ id?: never;
21
+ systemId?: string;
22
+ input?: InputFrom<TLogic>;
23
+ syncSnapshot?: boolean;
24
+ }): ActorRefFrom<TLogic>;
25
+ } : <TLogic extends AnyActorLogic | string>(src: TLogic, options?: {
18
26
  id?: string;
19
27
  systemId?: string;
20
28
  input?: TLogic extends string ? unknown : InputFrom<TLogic>;
@@ -25,9 +25,12 @@ export interface ActorSystem<T extends ActorSystemInfo> {
25
25
  _scheduledEvents: Record<string, ScheduledEvent>;
26
26
  };
27
27
  start: () => void;
28
+ _clock: Clock;
29
+ _logger: (...args: any[]) => void;
28
30
  }
29
31
  export type AnyActorSystem = ActorSystem<any>;
30
32
  export declare function createSystem<T extends ActorSystemInfo>(rootActor: AnyActorRef, options: {
31
33
  clock: Clock;
34
+ logger: (...args: any[]) => void;
32
35
  snapshot?: unknown;
33
36
  }): ActorSystem<T>;
@@ -57,7 +57,11 @@ export type IndexByType<T extends {
57
57
  export type Equals<A1 extends any, A2 extends any> = (<A>() => A extends A2 ? true : false) extends <A>() => A extends A1 ? true : false ? true : false;
58
58
  export type IsAny<T> = Equals<T, any>;
59
59
  export type Cast<A, B> = A extends B ? A : B;
60
- export type NoInfer<T> = [T][T extends any ? 0 : any];
60
+ export type DoNotInfer<T> = [T][T extends any ? 0 : any];
61
+ /**
62
+ * @deprecated Use the built-in `NoInfer` type instead
63
+ */
64
+ export type NoInfer<T> = DoNotInfer<T>;
61
65
  export type LowInfer<T> = T & {};
62
66
  export type MetaObject = Record<string, any>;
63
67
  export type Lazy<T> = () => T;
@@ -210,7 +214,15 @@ type DistributeActors<TContext extends MachineContext, TEvent extends EventObjec
210
214
  onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent<SnapshotFrom<TSpecificActor['logic']>>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted>>;
211
215
  } & {
212
216
  [K in RequiredActorOptions<TSpecificActor>]: unknown;
213
- }> : never;
217
+ }> | {
218
+ id?: never;
219
+ systemId?: string;
220
+ src: AnyActorLogic;
221
+ input?: Mapper<TContext, TEvent, NonReducibleUnknown, TEvent> | NonReducibleUnknown;
222
+ onDone?: string | SingleOrArray<TransitionConfigOrTarget<TContext, DoneActorEvent<unknown>, TEvent, TActor, TAction, TGuard, TDelay, TEmitted>>;
223
+ onError?: string | SingleOrArray<TransitionConfigOrTarget<TContext, ErrorActorEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted>>;
224
+ onSnapshot?: string | SingleOrArray<TransitionConfigOrTarget<TContext, SnapshotEvent, TEvent, TActor, TAction, TGuard, TDelay, TEmitted>>;
225
+ } : never;
214
226
  export type InvokeConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor, TAction extends ParameterizedObject, TGuard extends ParameterizedObject, TDelay extends string, TEmitted extends EventObject> = IsLiteralString<TActor['src']> extends true ? DistributeActors<TContext, TEvent, TActor, TAction, TGuard, TDelay, TEmitted, TActor> : {
215
227
  /**
216
228
  * The unique identifier for the invoked machine. If not specified, this
@@ -441,7 +453,7 @@ export type ContextFactory<TContext extends MachineContext, TActor extends Provi
441
453
  self: ActorRef<MachineSnapshot<TContext, TEvent, Record<string, AnyActorRef | undefined>, // TODO: this should be replaced with `TChildren`
442
454
  StateValue, string, unknown>, TEvent>;
443
455
  }) => TContext;
444
- export type MachineConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor = ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject, TDelay extends string = string, TTag extends string = string, TInput = any, TOutput = unknown, TEmitted extends EventObject = EventObject, TTypesMeta = TypegenDisabled> = (Omit<StateNodeConfig<NoInfer<TContext>, NoInfer<TEvent>, NoInfer<TActor>, NoInfer<TAction>, NoInfer<TGuard>, NoInfer<TDelay>, NoInfer<TTag>, NoInfer<TOutput>, NoInfer<TEmitted>>, 'output'> & {
456
+ export type MachineConfig<TContext extends MachineContext, TEvent extends EventObject, TActor extends ProvidedActor = ProvidedActor, TAction extends ParameterizedObject = ParameterizedObject, TGuard extends ParameterizedObject = ParameterizedObject, TDelay extends string = string, TTag extends string = string, TInput = any, TOutput = unknown, TEmitted extends EventObject = EventObject, TTypesMeta = TypegenDisabled> = (Omit<StateNodeConfig<DoNotInfer<TContext>, DoNotInfer<TEvent>, DoNotInfer<TActor>, DoNotInfer<TAction>, DoNotInfer<TGuard>, DoNotInfer<TDelay>, DoNotInfer<TTag>, DoNotInfer<TOutput>, DoNotInfer<TEmitted>>, 'output'> & {
445
457
  /**
446
458
  * The initial context (extended state)
447
459
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-182bb5c9.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-40b1a1f5.cjs.js');
4
4
 
5
5
  // it's likely-ish that `(TActor & { src: TSrc })['logic']` would be faster
6
6
  // but it's only possible to do it since https://github.com/microsoft/TypeScript/pull/53098 (TS 5.1)
@@ -209,10 +209,14 @@ eventOrExpr) {
209
209
 
210
210
  // https://github.com/microsoft/TypeScript/issues/23182#issuecomment-379091887
211
211
 
212
+ // @TODO: Replace with native `NoInfer` when TS issue gets fixed:
213
+ // https://github.com/microsoft/TypeScript/pull/57673
214
+ /**
215
+ * @deprecated Use the built-in `NoInfer` type instead
216
+ */
212
217
  /**
213
218
  * The full definition of an event, with a string `type`.
214
219
  */
215
-
216
220
  /**
217
221
  * The string or object representing the state value relative to the parent state node.
218
222
  *
@@ -222,11 +226,8 @@ eventOrExpr) {
222
226
  *
223
227
  * - For complex state nodes, this is an object, e.g., `{ success: "someChildState" }`.
224
228
  */
225
-
226
229
  // TODO: remove once TS fixes this type-widening issue
227
-
228
230
  /** @deprecated use `AnyMachineSnapshot` instead */
229
-
230
231
  // TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
231
232
  /**
232
233
  * @hidden
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var guards_dist_xstateGuards = require('./raise-933cd731.development.cjs.js');
3
+ var guards_dist_xstateGuards = require('./raise-52a00e8f.development.cjs.js');
4
4
 
5
5
  // it's likely-ish that `(TActor & { src: TSrc })['logic']` would be faster
6
6
  // but it's only possible to do it since https://github.com/microsoft/TypeScript/pull/53098 (TS 5.1)
@@ -218,10 +218,14 @@ eventOrExpr) {
218
218
 
219
219
  // https://github.com/microsoft/TypeScript/issues/23182#issuecomment-379091887
220
220
 
221
+ // @TODO: Replace with native `NoInfer` when TS issue gets fixed:
222
+ // https://github.com/microsoft/TypeScript/pull/57673
223
+ /**
224
+ * @deprecated Use the built-in `NoInfer` type instead
225
+ */
221
226
  /**
222
227
  * The full definition of an event, with a string `type`.
223
228
  */
224
-
225
229
  /**
226
230
  * The string or object representing the state value relative to the parent state node.
227
231
  *
@@ -231,11 +235,8 @@ eventOrExpr) {
231
235
  *
232
236
  * - For complex state nodes, this is an object, e.g., `{ success: "someChildState" }`.
233
237
  */
234
-
235
238
  // TODO: remove once TS fixes this type-widening issue
236
-
237
239
  /** @deprecated use `AnyMachineSnapshot` instead */
238
-
239
240
  // TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
240
241
  /**
241
242
  * @hidden
@@ -1,4 +1,4 @@
1
- import { T as ProcessingStatus, z as resolveReferencedActor, A as createActor, U as cloneMachineSnapshot, V as XSTATE_ERROR, W as createErrorActorEvent, e as evaluateGuard, M as cancel, O as raise, P as spawnChild, R as stopChild } from './raise-411df926.esm.js';
1
+ import { T as ProcessingStatus, z as resolveReferencedActor, A as createActor, U as cloneMachineSnapshot, V as XSTATE_ERROR, W as createErrorActorEvent, e as evaluateGuard, M as cancel, O as raise, P as spawnChild, R as stopChild } from './raise-040ba012.esm.js';
2
2
 
3
3
  // it's likely-ish that `(TActor & { src: TSrc })['logic']` would be faster
4
4
  // but it's only possible to do it since https://github.com/microsoft/TypeScript/pull/53098 (TS 5.1)
@@ -207,10 +207,14 @@ eventOrExpr) {
207
207
 
208
208
  // https://github.com/microsoft/TypeScript/issues/23182#issuecomment-379091887
209
209
 
210
+ // @TODO: Replace with native `NoInfer` when TS issue gets fixed:
211
+ // https://github.com/microsoft/TypeScript/pull/57673
212
+ /**
213
+ * @deprecated Use the built-in `NoInfer` type instead
214
+ */
210
215
  /**
211
216
  * The full definition of an event, with a string `type`.
212
217
  */
213
-
214
218
  /**
215
219
  * The string or object representing the state value relative to the parent state node.
216
220
  *
@@ -220,11 +224,8 @@ eventOrExpr) {
220
224
  *
221
225
  * - For complex state nodes, this is an object, e.g., `{ success: "someChildState" }`.
222
226
  */
223
-
224
227
  // TODO: remove once TS fixes this type-widening issue
225
-
226
228
  /** @deprecated use `AnyMachineSnapshot` instead */
227
-
228
229
  // TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
229
230
  /**
230
231
  * @hidden
@@ -1,4 +1,4 @@
1
- import { T as ProcessingStatus, z as resolveReferencedActor, A as createActor, U as cloneMachineSnapshot, V as XSTATE_ERROR, W as createErrorActorEvent, e as evaluateGuard, M as cancel, O as raise, P as spawnChild, R as stopChild } from './raise-80cc66b2.development.esm.js';
1
+ import { T as ProcessingStatus, z as resolveReferencedActor, A as createActor, U as cloneMachineSnapshot, V as XSTATE_ERROR, W as createErrorActorEvent, e as evaluateGuard, M as cancel, O as raise, P as spawnChild, R as stopChild } from './raise-03a786f4.development.esm.js';
2
2
 
3
3
  // it's likely-ish that `(TActor & { src: TSrc })['logic']` would be faster
4
4
  // but it's only possible to do it since https://github.com/microsoft/TypeScript/pull/53098 (TS 5.1)
@@ -216,10 +216,14 @@ eventOrExpr) {
216
216
 
217
217
  // https://github.com/microsoft/TypeScript/issues/23182#issuecomment-379091887
218
218
 
219
+ // @TODO: Replace with native `NoInfer` when TS issue gets fixed:
220
+ // https://github.com/microsoft/TypeScript/pull/57673
221
+ /**
222
+ * @deprecated Use the built-in `NoInfer` type instead
223
+ */
219
224
  /**
220
225
  * The full definition of an event, with a string `type`.
221
226
  */
222
-
223
227
  /**
224
228
  * The string or object representing the state value relative to the parent state node.
225
229
  *
@@ -229,11 +233,8 @@ eventOrExpr) {
229
233
  *
230
234
  * - For complex state nodes, this is an object, e.g., `{ success: "someChildState" }`.
231
235
  */
232
-
233
236
  // TODO: remove once TS fixes this type-widening issue
234
-
235
237
  /** @deprecated use `AnyMachineSnapshot` instead */
236
-
237
238
  // TODO: possibly refactor this somehow, use even a simpler type, and maybe even make `machine.options` private or something
238
239
  /**
239
240
  * @hidden
@@ -136,7 +136,10 @@ function createSystem(rootActor, options) {
136
136
  const reverseKeyedActors = new WeakMap();
137
137
  const inspectionObservers = new Set();
138
138
  const timerMap = {};
139
- const clock = options.clock;
139
+ const {
140
+ clock,
141
+ logger
142
+ } = options;
140
143
  const scheduler = {
141
144
  schedule: (source, target, event, delay, id = Math.random().toString(36).slice(2)) => {
142
145
  const scheduledEvent = {
@@ -244,7 +247,9 @@ function createSystem(rootActor, options) {
244
247
  } = scheduledEvents[scheduledId];
245
248
  scheduler.schedule(source, target, event, delay, id);
246
249
  }
247
- }
250
+ },
251
+ _clock: clock,
252
+ _logger: logger
248
253
  };
249
254
  return system;
250
255
  }
@@ -492,7 +497,8 @@ class Actor {
492
497
  inspect
493
498
  } = resolvedOptions;
494
499
  this.system = parent ? parent.system : createSystem(this, {
495
- clock
500
+ clock,
501
+ logger
496
502
  });
497
503
  if (inspect && !parent) {
498
504
  // Always inspect at the system-level
@@ -500,8 +506,8 @@ class Actor {
500
506
  }
501
507
  this.sessionId = this.system._bookId();
502
508
  this.id = id ?? this.sessionId;
503
- this.logger = logger;
504
- this.clock = clock;
509
+ this.logger = options?.logger ?? this.system._logger;
510
+ this.clock = options?.clock ?? this.system._clock;
505
511
  this._parent = parent;
506
512
  this._syncSnapshot = syncSnapshot;
507
513
  this.options = resolvedOptions;
@@ -136,7 +136,10 @@ function createSystem(rootActor, options) {
136
136
  const reverseKeyedActors = new WeakMap();
137
137
  const inspectionObservers = new Set();
138
138
  const timerMap = {};
139
- const clock = options.clock;
139
+ const {
140
+ clock,
141
+ logger
142
+ } = options;
140
143
  const scheduler = {
141
144
  schedule: (source, target, event, delay, id = Math.random().toString(36).slice(2)) => {
142
145
  const scheduledEvent = {
@@ -244,7 +247,9 @@ function createSystem(rootActor, options) {
244
247
  } = scheduledEvents[scheduledId];
245
248
  scheduler.schedule(source, target, event, delay, id);
246
249
  }
247
- }
250
+ },
251
+ _clock: clock,
252
+ _logger: logger
248
253
  };
249
254
  return system;
250
255
  }
@@ -489,7 +494,8 @@ class Actor {
489
494
  inspect
490
495
  } = resolvedOptions;
491
496
  this.system = parent ? parent.system : createSystem(this, {
492
- clock
497
+ clock,
498
+ logger
493
499
  });
494
500
  if (inspect && !parent) {
495
501
  // Always inspect at the system-level
@@ -497,8 +503,8 @@ class Actor {
497
503
  }
498
504
  this.sessionId = this.system._bookId();
499
505
  this.id = id ?? this.sessionId;
500
- this.logger = logger;
501
- this.clock = clock;
506
+ this.logger = options?.logger ?? this.system._logger;
507
+ this.clock = options?.clock ?? this.system._clock;
502
508
  this._parent = parent;
503
509
  this._syncSnapshot = syncSnapshot;
504
510
  this.options = resolvedOptions;
@@ -138,7 +138,10 @@ function createSystem(rootActor, options) {
138
138
  const reverseKeyedActors = new WeakMap();
139
139
  const inspectionObservers = new Set();
140
140
  const timerMap = {};
141
- const clock = options.clock;
141
+ const {
142
+ clock,
143
+ logger
144
+ } = options;
142
145
  const scheduler = {
143
146
  schedule: (source, target, event, delay, id = Math.random().toString(36).slice(2)) => {
144
147
  const scheduledEvent = {
@@ -246,7 +249,9 @@ function createSystem(rootActor, options) {
246
249
  } = scheduledEvents[scheduledId];
247
250
  scheduler.schedule(source, target, event, delay, id);
248
251
  }
249
- }
252
+ },
253
+ _clock: clock,
254
+ _logger: logger
250
255
  };
251
256
  return system;
252
257
  }
@@ -491,7 +496,8 @@ class Actor {
491
496
  inspect
492
497
  } = resolvedOptions;
493
498
  this.system = parent ? parent.system : createSystem(this, {
494
- clock
499
+ clock,
500
+ logger
495
501
  });
496
502
  if (inspect && !parent) {
497
503
  // Always inspect at the system-level
@@ -499,8 +505,8 @@ class Actor {
499
505
  }
500
506
  this.sessionId = this.system._bookId();
501
507
  this.id = id ?? this.sessionId;
502
- this.logger = logger;
503
- this.clock = clock;
508
+ this.logger = options?.logger ?? this.system._logger;
509
+ this.clock = options?.clock ?? this.system._clock;
504
510
  this._parent = parent;
505
511
  this._syncSnapshot = syncSnapshot;
506
512
  this.options = resolvedOptions;
@@ -138,7 +138,10 @@ function createSystem(rootActor, options) {
138
138
  const reverseKeyedActors = new WeakMap();
139
139
  const inspectionObservers = new Set();
140
140
  const timerMap = {};
141
- const clock = options.clock;
141
+ const {
142
+ clock,
143
+ logger
144
+ } = options;
142
145
  const scheduler = {
143
146
  schedule: (source, target, event, delay, id = Math.random().toString(36).slice(2)) => {
144
147
  const scheduledEvent = {
@@ -246,7 +249,9 @@ function createSystem(rootActor, options) {
246
249
  } = scheduledEvents[scheduledId];
247
250
  scheduler.schedule(source, target, event, delay, id);
248
251
  }
249
- }
252
+ },
253
+ _clock: clock,
254
+ _logger: logger
250
255
  };
251
256
  return system;
252
257
  }
@@ -494,7 +499,8 @@ class Actor {
494
499
  inspect
495
500
  } = resolvedOptions;
496
501
  this.system = parent ? parent.system : createSystem(this, {
497
- clock
502
+ clock,
503
+ logger
498
504
  });
499
505
  if (inspect && !parent) {
500
506
  // Always inspect at the system-level
@@ -502,8 +508,8 @@ class Actor {
502
508
  }
503
509
  this.sessionId = this.system._bookId();
504
510
  this.id = id ?? this.sessionId;
505
- this.logger = logger;
506
- this.clock = clock;
511
+ this.logger = options?.logger ?? this.system._logger;
512
+ this.clock = options?.clock ?? this.system._clock;
507
513
  this._parent = parent;
508
514
  this._syncSnapshot = syncSnapshot;
509
515
  this.options = resolvedOptions;
@@ -3,8 +3,8 @@
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-182bb5c9.cjs.js');
7
- var log = require('./log-a312ebfc.cjs.js');
6
+ var guards_dist_xstateGuards = require('./raise-40b1a1f5.cjs.js');
7
+ var log = require('./log-11d3f771.cjs.js');
8
8
  require('../dev/dist/xstate-dev.cjs.js');
9
9
 
10
10
  class SimulatedClock {
@@ -3,8 +3,8 @@
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-933cd731.development.cjs.js');
7
- var log = require('./log-28ea35fe.development.cjs.js');
6
+ var guards_dist_xstateGuards = require('./raise-52a00e8f.development.cjs.js');
7
+ var log = require('./log-6380a394.development.cjs.js');
8
8
  require('../dev/dist/xstate-dev.development.cjs.js');
9
9
 
10
10
  class SimulatedClock {
@@ -1,8 +1,8 @@
1
1
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.development.esm.js';
2
- import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as toStatePath, w as isStateId, x as getStateNodeByPath, y as getPersistedSnapshot, z as resolveReferencedActor, A as createActor, $ as $$ACTOR_TYPE } from './raise-80cc66b2.development.esm.js';
3
- export { B as Actor, I as __unsafe_getAllOwnEventDescriptors, E as and, M as cancel, A as createActor, j as getStateNodes, C as interpret, D as isMachineSnapshot, J as matchesState, F as not, G as or, K as pathToStateValue, O as raise, P as spawnChild, H as stateIn, Q as stop, R as stopChild, L as toObserver } from './raise-80cc66b2.development.esm.js';
4
- import { a as assign } from './log-0fbf8cec.development.esm.js';
5
- export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-0fbf8cec.development.esm.js';
2
+ import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as toStatePath, w as isStateId, x as getStateNodeByPath, y as getPersistedSnapshot, z as resolveReferencedActor, A as createActor, $ as $$ACTOR_TYPE } from './raise-03a786f4.development.esm.js';
3
+ export { B as Actor, I as __unsafe_getAllOwnEventDescriptors, E as and, M as cancel, A as createActor, j as getStateNodes, C as interpret, D as isMachineSnapshot, J as matchesState, F as not, G as or, K as pathToStateValue, O as raise, P as spawnChild, H as stateIn, Q as stop, R as stopChild, L as toObserver } from './raise-03a786f4.development.esm.js';
4
+ import { a as assign } from './log-f64de12b.development.esm.js';
5
+ export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-f64de12b.development.esm.js';
6
6
  import '../dev/dist/xstate-dev.development.esm.js';
7
7
 
8
8
  class SimulatedClock {
@@ -1,8 +1,8 @@
1
1
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.esm.js';
2
- import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as toStatePath, w as isStateId, x as getStateNodeByPath, y as getPersistedSnapshot, z as resolveReferencedActor, A as createActor, $ as $$ACTOR_TYPE } from './raise-411df926.esm.js';
3
- export { B as Actor, I as __unsafe_getAllOwnEventDescriptors, E as and, M as cancel, A as createActor, j as getStateNodes, C as interpret, D as isMachineSnapshot, J as matchesState, F as not, G as or, K as pathToStateValue, O as raise, P as spawnChild, H as stateIn, Q as stop, R as stopChild, L as toObserver } from './raise-411df926.esm.js';
4
- import { a as assign } from './log-c48e8ab0.esm.js';
5
- export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-c48e8ab0.esm.js';
2
+ import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as toStatePath, w as isStateId, x as getStateNodeByPath, y as getPersistedSnapshot, z as resolveReferencedActor, A as createActor, $ as $$ACTOR_TYPE } from './raise-040ba012.esm.js';
3
+ export { B as Actor, I as __unsafe_getAllOwnEventDescriptors, E as and, M as cancel, A as createActor, j as getStateNodes, C as interpret, D as isMachineSnapshot, J as matchesState, F as not, G as or, K as pathToStateValue, O as raise, P as spawnChild, H as stateIn, Q as stop, R as stopChild, L as toObserver } from './raise-040ba012.esm.js';
4
+ import { a as assign } from './log-cd22d72c.esm.js';
5
+ export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-cd22d72c.esm.js';
6
6
  import '../dev/dist/xstate-dev.esm.js';
7
7
 
8
8
  class SimulatedClock {