xstate 6.0.0-alpha.4 → 6.0.0-alpha.5

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 CHANGED
@@ -365,10 +365,10 @@ const wordMachine = createMachine({
365
365
  initial: 'off',
366
366
  states: {
367
367
  on: {
368
- on: { TOGGLE_BOLD: 'off' }
368
+ on: { TOGGLE_BOLD: { target: 'off' } }
369
369
  },
370
370
  off: {
371
- on: { TOGGLE_BOLD: 'on' }
371
+ on: { TOGGLE_BOLD: { target: 'on' } }
372
372
  }
373
373
  }
374
374
  },
@@ -376,10 +376,10 @@ const wordMachine = createMachine({
376
376
  initial: 'off',
377
377
  states: {
378
378
  on: {
379
- on: { TOGGLE_UNDERLINE: 'off' }
379
+ on: { TOGGLE_UNDERLINE: { target: 'off' } }
380
380
  },
381
381
  off: {
382
- on: { TOGGLE_UNDERLINE: 'on' }
382
+ on: { TOGGLE_UNDERLINE: { target: 'on' } }
383
383
  }
384
384
  }
385
385
  },
@@ -387,10 +387,10 @@ const wordMachine = createMachine({
387
387
  initial: 'off',
388
388
  states: {
389
389
  on: {
390
- on: { TOGGLE_ITALICS: 'off' }
390
+ on: { TOGGLE_ITALICS: { target: 'off' } }
391
391
  },
392
392
  off: {
393
- on: { TOGGLE_ITALICS: 'on' }
393
+ on: { TOGGLE_ITALICS: { target: 'on' } }
394
394
  }
395
395
  }
396
396
  },
@@ -399,20 +399,20 @@ const wordMachine = createMachine({
399
399
  states: {
400
400
  none: {
401
401
  on: {
402
- BULLETS: 'bullets',
403
- NUMBERS: 'numbers'
402
+ BULLETS: { target: 'bullets' },
403
+ NUMBERS: { target: 'numbers' }
404
404
  }
405
405
  },
406
406
  bullets: {
407
407
  on: {
408
- NONE: 'none',
409
- NUMBERS: 'numbers'
408
+ NONE: { target: 'none' },
409
+ NUMBERS: { target: 'numbers' }
410
410
  }
411
411
  },
412
412
  numbers: {
413
413
  on: {
414
- BULLETS: 'bullets',
415
- NONE: 'none'
414
+ BULLETS: { target: 'bullets' },
415
+ NONE: { target: 'none' }
416
416
  }
417
417
  }
418
418
  }
@@ -493,10 +493,10 @@ const paymentMachine = createMachine({
493
493
  },
494
494
  hist: { type: 'history' }
495
495
  },
496
- on: { NEXT: 'review' }
496
+ on: { NEXT: { target: 'review' } }
497
497
  },
498
498
  review: {
499
- on: { PREVIOUS: 'method.hist' }
499
+ on: { PREVIOUS: { target: 'method.hist' } }
500
500
  }
501
501
  }
502
502
  });
@@ -186,7 +186,7 @@ type StateNodeConfigWithNestedInput<TSiblingStateSchemas extends Record<string,
186
186
  type StateTransitions<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays']> = {
187
187
  [K in EventDescriptor<TEvent>]?: StateTransitionConfigOrTarget<TStateSchemas, TContext, ExtractEvent<TEvent, K>, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap>;
188
188
  };
189
- type StateTransitionConfigOrTarget<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays']> = SetupStateTarget<TStateSchemas> | undefined | {
189
+ type StateTransitionConfigOrTarget<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays']> = undefined | {
190
190
  target?: SetupStateTarget<TStateSchemas> | SetupStateTarget<TStateSchemas>[];
191
191
  description?: string;
192
192
  reenter?: boolean;
@@ -297,14 +297,14 @@ interface Next_RegularStateNodeConfig<TContext extends MachineContext, TEvent ex
297
297
  * This is equivalent to defining a `[done(id)]` transition on this state
298
298
  * node's `on` property.
299
299
  */
300
- onDone?: string | TransitionConfigFunction<TContext, DoneStateEvent, TEvent, TEmitted, TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta> | undefined;
300
+ onDone?: Next_TransitionConfigOrTarget<TContext, DoneStateEvent, TEvent, TEmitted, TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta>;
301
301
  /**
302
302
  * The mapping (or array) of delays (in milliseconds) to their potential
303
303
  * transition(s). The delayed transitions are taken after the specified delay
304
304
  * in an interpreter.
305
305
  */
306
306
  after?: {
307
- [K in NoInfer<TDelays> | number]?: string | {
307
+ [K in NoInfer<TDelays> | number]?: {
308
308
  target: string;
309
309
  } | TransitionConfigFunction<TContext, TEvent, TEvent, TODO, // TEmitted
310
310
  TActionMap, TActorMap, TGuardMap, TDelayMap, TMeta>;
@@ -364,7 +364,7 @@ interface Next_RegularStateNodeConfig<TContext extends MachineContext, TEvent ex
364
364
  /** A default target for a history state */
365
365
  target?: string | undefined;
366
366
  }
367
- export type Next_TransitionConfigOrTarget<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays'], TMeta extends MetaObject> = string | undefined | {
367
+ export type Next_TransitionConfigOrTarget<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays'], TMeta extends MetaObject> = undefined | {
368
368
  target?: string | string[];
369
369
  description?: string;
370
370
  reenter?: boolean;