xstate 5.0.0-beta.36 → 5.0.0-beta.38
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/actions/dist/xstate-actions.cjs.js +4 -3
- package/actions/dist/xstate-actions.cjs.mjs +1 -0
- package/actions/dist/xstate-actions.development.cjs.js +4 -3
- package/actions/dist/xstate-actions.development.cjs.mjs +1 -0
- package/actions/dist/xstate-actions.development.esm.js +3 -3
- package/actions/dist/xstate-actions.esm.js +3 -3
- package/actions/dist/xstate-actions.umd.min.js +1 -1
- package/actions/dist/xstate-actions.umd.min.js.map +1 -1
- package/actors/dist/xstate-actors.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.cjs.js +1 -1
- package/actors/dist/xstate-actors.development.esm.js +1 -1
- package/actors/dist/xstate-actors.esm.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js +1 -1
- package/actors/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/declarations/src/State.d.ts +2 -2
- package/dist/declarations/src/StateMachine.d.ts +4 -4
- package/dist/declarations/src/actions/assign.d.ts +4 -4
- package/dist/declarations/src/actions/cancel.d.ts +4 -4
- package/dist/declarations/src/actions/choose.d.ts +3 -3
- package/dist/declarations/src/actions/log.d.ts +4 -4
- package/dist/declarations/src/actions/pure.d.ts +4 -4
- package/dist/declarations/src/actions/raise.d.ts +3 -3
- package/dist/declarations/src/actions/send.d.ts +7 -7
- package/dist/declarations/src/actions/spawn.d.ts +34 -0
- package/dist/declarations/src/actions/stop.d.ts +4 -4
- package/dist/declarations/src/actions.d.ts +1 -0
- package/dist/declarations/src/actors/callback.d.ts +2 -2
- package/dist/declarations/src/actors/observable.d.ts +2 -3
- package/dist/declarations/src/actors/promise.d.ts +0 -1
- package/dist/declarations/src/actors/transition.d.ts +1 -1
- package/dist/declarations/src/guards.d.ts +9 -10
- package/dist/declarations/src/interpreter.d.ts +2 -2
- package/dist/declarations/src/spawn.d.ts +1 -2
- package/dist/declarations/src/stateUtils.d.ts +0 -5
- package/dist/declarations/src/typegenTypes.d.ts +2 -0
- package/dist/declarations/src/types.d.ts +47 -58
- package/dist/declarations/src/utils.d.ts +6 -6
- package/dist/declarations/src/waitFor.d.ts +1 -1
- package/dist/{interpreter-5c4e6634.development.esm.js → interpreter-4005eb36.development.esm.js} +14 -24
- package/dist/{interpreter-69605bf0.cjs.js → interpreter-b6f22ee2.cjs.js} +14 -24
- package/dist/{interpreter-de5217bc.esm.js → interpreter-c80ce92e.esm.js} +14 -24
- package/dist/{interpreter-d3567419.development.cjs.js → interpreter-ed3f81f7.development.cjs.js} +14 -24
- package/dist/{raise-5b7ad3b7.development.esm.js → raise-42073973.development.esm.js} +138 -118
- package/dist/{raise-c51b81a3.cjs.js → raise-7faa9b3b.cjs.js} +139 -118
- package/dist/{raise-106ea558.development.cjs.js → raise-b69a3d16.development.cjs.js} +138 -117
- package/dist/{raise-ffe1014a.esm.js → raise-c989c7fb.esm.js} +139 -119
- package/dist/{send-778692de.cjs.js → send-34160163.cjs.js} +31 -27
- package/dist/{send-0a7aa74e.esm.js → send-4b616da9.esm.js} +31 -27
- package/dist/{send-25e70bd4.development.cjs.js → send-58725522.development.cjs.js} +31 -27
- package/dist/{send-e93554d6.development.esm.js → send-bff8c910.development.esm.js} +31 -27
- package/dist/xstate.cjs.js +11 -16
- package/dist/xstate.cjs.mjs +1 -0
- package/dist/xstate.development.cjs.js +11 -16
- package/dist/xstate.development.cjs.mjs +1 -0
- package/dist/xstate.development.esm.js +13 -19
- package/dist/xstate.esm.js +13 -19
- package/dist/xstate.umd.min.js +1 -1
- package/dist/xstate.umd.min.js.map +1 -1
- package/guards/dist/xstate-guards.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.cjs.js +2 -2
- package/guards/dist/xstate-guards.development.esm.js +2 -2
- package/guards/dist/xstate-guards.esm.js +2 -2
- package/guards/dist/xstate-guards.umd.min.js +1 -1
- package/guards/dist/xstate-guards.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/{interpreter-5c4e6634.development.esm.js → interpreter-4005eb36.development.esm.js}
RENAMED
|
@@ -28,22 +28,6 @@ class Mailbox {
|
|
|
28
28
|
this._last = this._current;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
// TODO: rethink this design
|
|
33
|
-
prepend(event) {
|
|
34
|
-
if (!this._current) {
|
|
35
|
-
this.enqueue(event);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// we know that something is already queued up
|
|
40
|
-
// so the mailbox is already flushing or it's inactive
|
|
41
|
-
// therefore the only thing that we need to do is to reassign `this._current`
|
|
42
|
-
this._current = {
|
|
43
|
-
value: event,
|
|
44
|
-
next: this._current
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
31
|
enqueue(event) {
|
|
48
32
|
const enqueued = {
|
|
49
33
|
value: event,
|
|
@@ -66,11 +50,7 @@ class Mailbox {
|
|
|
66
50
|
// we assume here that this won't throw in a way that can affect this mailbox
|
|
67
51
|
const consumed = this._current;
|
|
68
52
|
this._process(consumed.value);
|
|
69
|
-
|
|
70
|
-
// so we need to be defensive here to avoid skipping over a prepended item
|
|
71
|
-
if (consumed === this._current) {
|
|
72
|
-
this._current = this._current.next;
|
|
73
|
-
}
|
|
53
|
+
this._current = consumed.next;
|
|
74
54
|
}
|
|
75
55
|
this._last = null;
|
|
76
56
|
}
|
|
@@ -334,9 +314,19 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
334
314
|
};
|
|
335
315
|
}
|
|
336
316
|
function createInvokeId(stateNodeId, index) {
|
|
337
|
-
return `${stateNodeId}
|
|
317
|
+
return `${stateNodeId}[${index}]`;
|
|
338
318
|
}
|
|
339
|
-
function resolveReferencedActor(
|
|
319
|
+
function resolveReferencedActor(machine, src) {
|
|
320
|
+
if (src.startsWith('xstate#')) {
|
|
321
|
+
const [, indexStr] = src.match(/\[(\d+)\]$/);
|
|
322
|
+
const node = machine.getStateNodeById(src.slice(7, -(indexStr.length + 2)));
|
|
323
|
+
const invokeConfig = node.config.invoke;
|
|
324
|
+
return {
|
|
325
|
+
src: (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src,
|
|
326
|
+
input: undefined
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
const referenced = machine.implementations.actors[src];
|
|
340
330
|
return referenced ? 'transition' in referenced ? {
|
|
341
331
|
src: referenced,
|
|
342
332
|
input: undefined
|
|
@@ -761,7 +751,7 @@ class Actor {
|
|
|
761
751
|
};
|
|
762
752
|
}
|
|
763
753
|
getPersistedState() {
|
|
764
|
-
return this.logic.getPersistedState
|
|
754
|
+
return this.logic.getPersistedState(this._state);
|
|
765
755
|
}
|
|
766
756
|
[symbolObservable]() {
|
|
767
757
|
return this;
|
|
@@ -30,22 +30,6 @@ class Mailbox {
|
|
|
30
30
|
this._last = this._current;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
// TODO: rethink this design
|
|
35
|
-
prepend(event) {
|
|
36
|
-
if (!this._current) {
|
|
37
|
-
this.enqueue(event);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// we know that something is already queued up
|
|
42
|
-
// so the mailbox is already flushing or it's inactive
|
|
43
|
-
// therefore the only thing that we need to do is to reassign `this._current`
|
|
44
|
-
this._current = {
|
|
45
|
-
value: event,
|
|
46
|
-
next: this._current
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
33
|
enqueue(event) {
|
|
50
34
|
const enqueued = {
|
|
51
35
|
value: event,
|
|
@@ -68,11 +52,7 @@ class Mailbox {
|
|
|
68
52
|
// we assume here that this won't throw in a way that can affect this mailbox
|
|
69
53
|
const consumed = this._current;
|
|
70
54
|
this._process(consumed.value);
|
|
71
|
-
|
|
72
|
-
// so we need to be defensive here to avoid skipping over a prepended item
|
|
73
|
-
if (consumed === this._current) {
|
|
74
|
-
this._current = this._current.next;
|
|
75
|
-
}
|
|
55
|
+
this._current = consumed.next;
|
|
76
56
|
}
|
|
77
57
|
this._last = null;
|
|
78
58
|
}
|
|
@@ -333,9 +313,19 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
333
313
|
};
|
|
334
314
|
}
|
|
335
315
|
function createInvokeId(stateNodeId, index) {
|
|
336
|
-
return `${stateNodeId}
|
|
316
|
+
return `${stateNodeId}[${index}]`;
|
|
337
317
|
}
|
|
338
|
-
function resolveReferencedActor(
|
|
318
|
+
function resolveReferencedActor(machine, src) {
|
|
319
|
+
if (src.startsWith('xstate#')) {
|
|
320
|
+
const [, indexStr] = src.match(/\[(\d+)\]$/);
|
|
321
|
+
const node = machine.getStateNodeById(src.slice(7, -(indexStr.length + 2)));
|
|
322
|
+
const invokeConfig = node.config.invoke;
|
|
323
|
+
return {
|
|
324
|
+
src: (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src,
|
|
325
|
+
input: undefined
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
const referenced = machine.implementations.actors[src];
|
|
339
329
|
return referenced ? 'transition' in referenced ? {
|
|
340
330
|
src: referenced,
|
|
341
331
|
input: undefined
|
|
@@ -752,7 +742,7 @@ class Actor {
|
|
|
752
742
|
};
|
|
753
743
|
}
|
|
754
744
|
getPersistedState() {
|
|
755
|
-
return this.logic.getPersistedState
|
|
745
|
+
return this.logic.getPersistedState(this._state);
|
|
756
746
|
}
|
|
757
747
|
[symbolObservable]() {
|
|
758
748
|
return this;
|
|
@@ -28,22 +28,6 @@ class Mailbox {
|
|
|
28
28
|
this._last = this._current;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
// TODO: rethink this design
|
|
33
|
-
prepend(event) {
|
|
34
|
-
if (!this._current) {
|
|
35
|
-
this.enqueue(event);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// we know that something is already queued up
|
|
40
|
-
// so the mailbox is already flushing or it's inactive
|
|
41
|
-
// therefore the only thing that we need to do is to reassign `this._current`
|
|
42
|
-
this._current = {
|
|
43
|
-
value: event,
|
|
44
|
-
next: this._current
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
31
|
enqueue(event) {
|
|
48
32
|
const enqueued = {
|
|
49
33
|
value: event,
|
|
@@ -66,11 +50,7 @@ class Mailbox {
|
|
|
66
50
|
// we assume here that this won't throw in a way that can affect this mailbox
|
|
67
51
|
const consumed = this._current;
|
|
68
52
|
this._process(consumed.value);
|
|
69
|
-
|
|
70
|
-
// so we need to be defensive here to avoid skipping over a prepended item
|
|
71
|
-
if (consumed === this._current) {
|
|
72
|
-
this._current = this._current.next;
|
|
73
|
-
}
|
|
53
|
+
this._current = consumed.next;
|
|
74
54
|
}
|
|
75
55
|
this._last = null;
|
|
76
56
|
}
|
|
@@ -331,9 +311,19 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
331
311
|
};
|
|
332
312
|
}
|
|
333
313
|
function createInvokeId(stateNodeId, index) {
|
|
334
|
-
return `${stateNodeId}
|
|
314
|
+
return `${stateNodeId}[${index}]`;
|
|
335
315
|
}
|
|
336
|
-
function resolveReferencedActor(
|
|
316
|
+
function resolveReferencedActor(machine, src) {
|
|
317
|
+
if (src.startsWith('xstate#')) {
|
|
318
|
+
const [, indexStr] = src.match(/\[(\d+)\]$/);
|
|
319
|
+
const node = machine.getStateNodeById(src.slice(7, -(indexStr.length + 2)));
|
|
320
|
+
const invokeConfig = node.config.invoke;
|
|
321
|
+
return {
|
|
322
|
+
src: (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src,
|
|
323
|
+
input: undefined
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
const referenced = machine.implementations.actors[src];
|
|
337
327
|
return referenced ? 'transition' in referenced ? {
|
|
338
328
|
src: referenced,
|
|
339
329
|
input: undefined
|
|
@@ -750,7 +740,7 @@ class Actor {
|
|
|
750
740
|
};
|
|
751
741
|
}
|
|
752
742
|
getPersistedState() {
|
|
753
|
-
return this.logic.getPersistedState
|
|
743
|
+
return this.logic.getPersistedState(this._state);
|
|
754
744
|
}
|
|
755
745
|
[symbolObservable]() {
|
|
756
746
|
return this;
|
package/dist/{interpreter-d3567419.development.cjs.js → interpreter-ed3f81f7.development.cjs.js}
RENAMED
|
@@ -30,22 +30,6 @@ class Mailbox {
|
|
|
30
30
|
this._last = this._current;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
// TODO: rethink this design
|
|
35
|
-
prepend(event) {
|
|
36
|
-
if (!this._current) {
|
|
37
|
-
this.enqueue(event);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// we know that something is already queued up
|
|
42
|
-
// so the mailbox is already flushing or it's inactive
|
|
43
|
-
// therefore the only thing that we need to do is to reassign `this._current`
|
|
44
|
-
this._current = {
|
|
45
|
-
value: event,
|
|
46
|
-
next: this._current
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
33
|
enqueue(event) {
|
|
50
34
|
const enqueued = {
|
|
51
35
|
value: event,
|
|
@@ -68,11 +52,7 @@ class Mailbox {
|
|
|
68
52
|
// we assume here that this won't throw in a way that can affect this mailbox
|
|
69
53
|
const consumed = this._current;
|
|
70
54
|
this._process(consumed.value);
|
|
71
|
-
|
|
72
|
-
// so we need to be defensive here to avoid skipping over a prepended item
|
|
73
|
-
if (consumed === this._current) {
|
|
74
|
-
this._current = this._current.next;
|
|
75
|
-
}
|
|
55
|
+
this._current = consumed.next;
|
|
76
56
|
}
|
|
77
57
|
this._last = null;
|
|
78
58
|
}
|
|
@@ -336,9 +316,19 @@ function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
|
336
316
|
};
|
|
337
317
|
}
|
|
338
318
|
function createInvokeId(stateNodeId, index) {
|
|
339
|
-
return `${stateNodeId}
|
|
319
|
+
return `${stateNodeId}[${index}]`;
|
|
340
320
|
}
|
|
341
|
-
function resolveReferencedActor(
|
|
321
|
+
function resolveReferencedActor(machine, src) {
|
|
322
|
+
if (src.startsWith('xstate#')) {
|
|
323
|
+
const [, indexStr] = src.match(/\[(\d+)\]$/);
|
|
324
|
+
const node = machine.getStateNodeById(src.slice(7, -(indexStr.length + 2)));
|
|
325
|
+
const invokeConfig = node.config.invoke;
|
|
326
|
+
return {
|
|
327
|
+
src: (Array.isArray(invokeConfig) ? invokeConfig[indexStr] : invokeConfig).src,
|
|
328
|
+
input: undefined
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
const referenced = machine.implementations.actors[src];
|
|
342
332
|
return referenced ? 'transition' in referenced ? {
|
|
343
333
|
src: referenced,
|
|
344
334
|
input: undefined
|
|
@@ -763,7 +753,7 @@ class Actor {
|
|
|
763
753
|
};
|
|
764
754
|
}
|
|
765
755
|
getPersistedState() {
|
|
766
|
-
return this.logic.getPersistedState
|
|
756
|
+
return this.logic.getPersistedState(this._state);
|
|
767
757
|
}
|
|
768
758
|
[symbolObservable]() {
|
|
769
759
|
return this;
|