xstate 6.0.0-alpha.64 → 6.0.0-alpha.66
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 +27 -0
- package/dist/{createActor-8493caa9.esm.js → createActor-18a56099.esm.js} +255 -209
- package/dist/{createActor-29adb8a4.cjs.js → createActor-19ee5e3c.cjs.js} +255 -209
- package/dist/{createActor-bd2527dc.development.esm.js → createActor-57ac74ac.development.esm.js} +287 -208
- package/dist/{createActor-521c8805.development.cjs.js → createActor-ff6a685e.development.cjs.js} +287 -208
- package/dist/declarations/src/State.d.ts +25 -3
- package/dist/declarations/src/StateMachine.d.ts +19 -7
- package/dist/declarations/src/actors/promise.d.ts +5 -5
- package/dist/declarations/src/createMachine.d.ts +5 -3
- package/dist/declarations/src/createMachineFromConfig.d.ts +13 -2
- package/dist/declarations/src/eventTypes.d.ts +8 -0
- package/dist/declarations/src/graph/index.d.ts +1 -0
- package/dist/declarations/src/graph/types.d.ts +20 -2
- package/dist/declarations/src/index.d.ts +1 -1
- package/dist/declarations/src/machineVersions.d.ts +2 -2
- package/dist/declarations/src/serialize.d.ts +7 -2
- package/dist/declarations/src/setup.d.ts +60 -19
- package/dist/declarations/src/transitionActions.d.ts +1 -1
- package/dist/declarations/src/types.d.ts +48 -27
- package/dist/declarations/src/types.v6.d.ts +10 -7
- package/dist/declarations/src/utils.d.ts +9 -0
- package/dist/{effectDescriptor-6dbc400a.cjs.js → effectDescriptor-515bb8bd.cjs.js} +1 -1
- package/dist/{effectDescriptor-85ea06c9.esm.js → effectDescriptor-c96275e6.esm.js} +1 -1
- package/dist/{effectDescriptor-62b53c6d.development.cjs.js → effectDescriptor-d941b462.development.cjs.js} +1 -1
- package/dist/{effectDescriptor-f76948fc.development.esm.js → effectDescriptor-f87ea294.development.esm.js} +1 -1
- package/dist/{index-5587e13b.cjs.js → index-66c07691.development.cjs.js} +29 -14
- package/dist/{index-2afc57c3.development.cjs.js → index-72e3c72c.cjs.js} +29 -14
- package/dist/{index-b0dc2b39.esm.js → index-b0b89ca7.development.esm.js} +29 -14
- package/dist/{index-90ebf5ae.development.esm.js → index-e540ddba.esm.js} +29 -14
- package/dist/xstate-actors.cjs.js +2 -2
- package/dist/xstate-actors.development.cjs.js +2 -2
- package/dist/xstate-actors.development.esm.js +2 -2
- package/dist/xstate-actors.esm.js +2 -2
- package/dist/xstate-actors.umd.min.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-durable.cjs.js +2 -2
- package/dist/xstate-durable.development.cjs.js +2 -2
- package/dist/xstate-durable.development.esm.js +2 -2
- package/dist/xstate-durable.esm.js +2 -2
- package/dist/xstate-durable.umd.min.js +1 -1
- package/dist/xstate-durable.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +8 -4
- package/dist/xstate-graph.cjs.mjs +1 -0
- package/dist/xstate-graph.development.cjs.js +8 -4
- package/dist/xstate-graph.development.cjs.mjs +1 -0
- package/dist/xstate-graph.development.esm.js +8 -4
- package/dist/xstate-graph.esm.js +8 -4
- package/dist/xstate-graph.umd.min.js +1 -1
- package/dist/xstate-graph.umd.min.js.map +1 -1
- package/dist/xstate-validation.cjs.js +24 -7
- package/dist/xstate-validation.development.cjs.js +24 -7
- package/dist/xstate-validation.development.esm.js +24 -7
- package/dist/xstate-validation.esm.js +24 -7
- package/dist/xstate-validation.umd.min.js +1 -1
- package/dist/xstate-validation.umd.min.js.map +1 -1
- package/dist/xstate.cjs.js +475 -265
- package/dist/xstate.development.cjs.js +497 -268
- package/dist/xstate.development.esm.js +499 -270
- package/dist/xstate.esm.js +477 -267
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,13 @@ timers without replaying entry actions. Await `executeEffects()` before persisti
|
|
|
33
33
|
to retain accepted timer deadlines. The host handles root error snapshots;
|
|
34
34
|
`run()` rejects with the root error. See [durable execution](../../docs/durable-execution.md).
|
|
35
35
|
|
|
36
|
+
<!-- state context refinements from packages/core/src/setup.ts and packages/core/src/State.ts -->
|
|
37
|
+
|
|
38
|
+
For [typestates](../../docs/typestates.md), declare state-level `schemas.context`
|
|
39
|
+
in `setup({ states })`. State functions receive narrowed context, transitions
|
|
40
|
+
check the target context requirements, and `snapshot.matches(...)` narrows
|
|
41
|
+
context when reading snapshots.
|
|
42
|
+
|
|
36
43
|
<!-- typed inline invocation from packages/core/src/setup.ts -->
|
|
37
44
|
|
|
38
45
|
Use `s.createInvoke({ src, input, onDone })` inline in `s.createMachine(...)` for an actor used in one state. It infers the actor's input and output and the enclosing state's narrowed context without registering that actor in `setup.actors`. See [typed inline invokes](../../docs/invoke.md#typed-inline-invokes).
|
|
@@ -41,6 +48,14 @@ Pass an async function directly as `src`, with `schemas.input`, `schemas.output`
|
|
|
41
48
|
|
|
42
49
|
The helper requires input for actors whose input excludes `undefined`, and checks child IDs and source compatibility against `schemas.children` declared in the setup or machine.
|
|
43
50
|
|
|
51
|
+
<!-- graph traversal events from packages/core/src/graph/index.ts -->
|
|
52
|
+
|
|
53
|
+
`getAllOwnEvents(snapshot)` from `xstate/graph` includes invoke completions, errors, and delayed events. Compose it with custom traversal payloads: supplied `events` replace the defaults. See [model-based testing](../../docs/model-based-testing.md).
|
|
54
|
+
|
|
55
|
+
<!-- JSON loading and runtime validation from packages/core/src/createMachineFromConfig.ts -->
|
|
56
|
+
|
|
57
|
+
Revive JSON definitions with `createMachineFromConfig(json, { schemas, validator, ...sources })` to restore runtime validation. The loader validates config keys and references. See [serialization](../../docs/serialization.md).
|
|
58
|
+
|
|
44
59
|
For flat finite state machines, `xstate/fsm` provides a tiny pure transition
|
|
45
60
|
table with context and TypeScript support:
|
|
46
61
|
|
|
@@ -635,3 +650,15 @@ For these reasons, it is impractical for our team to be bound by decisions taken
|
|
|
635
650
|
### Packages
|
|
636
651
|
|
|
637
652
|
Most of the packages in the XState family declare a peer dependency on XState itself. We’ll be cautious about maintaining compatibility with already-released packages when releasing a new version of XState, **but** each release of packages depending on XState will always adjust the declared peer dependency range to include the latest version of XState. For example, you should always be able to update `xstate` without `@xstate/react`. But when you update `@xstate/react`, we highly recommend updating `xstate` too.
|
|
653
|
+
|
|
654
|
+
<!-- public input validation contract from src/StateMachine.ts -->
|
|
655
|
+
Validate external input with `machine.eventSchema` before `actor.send()`.
|
|
656
|
+
It validates complete public events, excludes internal/runtime events, and allows
|
|
657
|
+
explicitly configured routes. Payload checks require runtime schemas;
|
|
658
|
+
`types<T>()` supplies types only. See [public input validation](../../docs/internal-events.md#validating-public-input).
|
|
659
|
+
|
|
660
|
+
<!-- entry effects and terminal transition behavior from packages/core/src/stateUtils.ts and transitionActions.ts -->
|
|
661
|
+
|
|
662
|
+
Use the `enq` argument in transition, entry and exit functions to queue effects. Return context or child patches from those functions; the return value of an enqueued effect is ignored, with a development warning. See [actions](../../docs/actions.md).
|
|
663
|
+
|
|
664
|
+
For actors that are done, stopped or failed, pure transitions return the same snapshot and no effects, and `snapshot.can(...)` returns `false`. See [snapshots](../../docs/snapshots.md) and [states](../../docs/states.md).
|