xstate 4.30.1 → 4.30.4
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/CHANGELOG.md +38 -0
- package/dist/xstate.interpreter.js +1 -1
- package/dist/xstate.js +1 -1
- package/dist/xstate.web.js +2 -2
- package/es/Actor.d.ts +1 -1
- package/es/Actor.js +15 -6
- package/es/Machine.d.ts +1 -2
- package/es/State.d.ts +3 -2
- package/es/State.js +5 -10
- package/es/StateNode.js +19 -19
- package/es/actions.js +3 -3
- package/es/behaviors.js +2 -2
- package/es/index.d.ts +12 -10
- package/es/index.js +5 -3
- package/es/interpreter.d.ts +6 -3
- package/es/interpreter.js +37 -23
- package/es/invokeUtils.js +2 -2
- package/es/mapState.js +2 -2
- package/es/stateUtils.js +2 -2
- package/es/types.d.ts +14 -9
- package/es/utils.d.ts +2 -5
- package/es/utils.js +13 -28
- package/lib/Actor.d.ts +1 -1
- package/lib/Actor.js +14 -5
- package/lib/Machine.d.ts +1 -2
- package/lib/State.d.ts +3 -2
- package/lib/State.js +4 -9
- package/lib/StateNode.js +18 -18
- package/lib/actions.js +2 -2
- package/lib/behaviors.js +2 -2
- package/lib/index.d.ts +12 -10
- package/lib/index.js +15 -8
- package/lib/interpreter.d.ts +6 -3
- package/lib/interpreter.js +37 -23
- package/lib/invokeUtils.js +2 -2
- package/lib/mapState.js +1 -1
- package/lib/scxml.js +1 -1
- package/lib/stateUtils.js +1 -1
- package/lib/types.d.ts +14 -9
- package/lib/utils.d.ts +2 -5
- package/lib/utils.js +11 -27
- package/package.json +1 -1
package/lib/utils.js
CHANGED
|
@@ -7,9 +7,6 @@ var constants = require('./constants.js');
|
|
|
7
7
|
var environment = require('./environment.js');
|
|
8
8
|
|
|
9
9
|
var _a;
|
|
10
|
-
function keys(value) {
|
|
11
|
-
return Object.keys(value);
|
|
12
|
-
}
|
|
13
10
|
function matchesState(parentStateId, childStateId, delimiter) {
|
|
14
11
|
if (delimiter === void 0) {
|
|
15
12
|
delimiter = constants.STATE_DELIMITER;
|
|
@@ -31,7 +28,7 @@ function matchesState(parentStateId, childStateId, delimiter) {
|
|
|
31
28
|
return parentStateValue in childStateValue;
|
|
32
29
|
}
|
|
33
30
|
|
|
34
|
-
return keys(parentStateValue).every(function (key) {
|
|
31
|
+
return Object.keys(parentStateValue).every(function (key) {
|
|
35
32
|
if (!(key in childStateValue)) {
|
|
36
33
|
return false;
|
|
37
34
|
}
|
|
@@ -97,7 +94,7 @@ function pathToStateValue(statePath) {
|
|
|
97
94
|
}
|
|
98
95
|
function mapValues(collection, iteratee) {
|
|
99
96
|
var result = {};
|
|
100
|
-
var collectionKeys = keys(collection);
|
|
97
|
+
var collectionKeys = Object.keys(collection);
|
|
101
98
|
|
|
102
99
|
for (var i = 0; i < collectionKeys.length; i++) {
|
|
103
100
|
var key = collectionKeys[i];
|
|
@@ -112,7 +109,7 @@ function mapFilterValues(collection, iteratee, predicate) {
|
|
|
112
109
|
var result = {};
|
|
113
110
|
|
|
114
111
|
try {
|
|
115
|
-
for (var _b = _tslib.__values(keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
112
|
+
for (var _b = _tslib.__values(Object.keys(collection)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
116
113
|
var key = _c.value;
|
|
117
114
|
var item = collection[key];
|
|
118
115
|
|
|
@@ -207,7 +204,7 @@ function toStatePaths(stateValue) {
|
|
|
207
204
|
return [[stateValue]];
|
|
208
205
|
}
|
|
209
206
|
|
|
210
|
-
var result = flatten(keys(stateValue).map(function (key) {
|
|
207
|
+
var result = flatten(Object.keys(stateValue).map(function (key) {
|
|
211
208
|
var subStateValue = stateValue[key];
|
|
212
209
|
|
|
213
210
|
if (typeof subStateValue !== 'string' && (!subStateValue || !Object.keys(subStateValue).length)) {
|
|
@@ -366,7 +363,7 @@ function updateContext(context, _event, assignActions, state) {
|
|
|
366
363
|
partialUpdate = assignment(acc, _event.data, meta);
|
|
367
364
|
} else {
|
|
368
365
|
try {
|
|
369
|
-
for (var _b = _tslib.__values(keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
366
|
+
for (var _b = _tslib.__values(Object.keys(assignment)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
370
367
|
var key = _c.value;
|
|
371
368
|
var propAssignment = assignment[key];
|
|
372
369
|
partialUpdate[key] = isFunction(propAssignment) ? propAssignment(acc, _event.data, meta) : propAssignment;
|
|
@@ -420,18 +417,7 @@ function isFunction(value) {
|
|
|
420
417
|
}
|
|
421
418
|
function isString(value) {
|
|
422
419
|
return typeof value === 'string';
|
|
423
|
-
}
|
|
424
|
-
// o: TP,
|
|
425
|
-
// property: string,
|
|
426
|
-
// getter: () => T
|
|
427
|
-
// ): void {
|
|
428
|
-
// Object.defineProperty(o.prototype, property, {
|
|
429
|
-
// get: getter,
|
|
430
|
-
// enumerable: false,
|
|
431
|
-
// configurable: false
|
|
432
|
-
// });
|
|
433
|
-
// }
|
|
434
|
-
|
|
420
|
+
}
|
|
435
421
|
function toGuard(condition, guardMap) {
|
|
436
422
|
if (!condition) {
|
|
437
423
|
return undefined;
|
|
@@ -464,16 +450,15 @@ function isObservable(value) {
|
|
|
464
450
|
}
|
|
465
451
|
var symbolObservable = /*#__PURE__*/function () {
|
|
466
452
|
return typeof Symbol === 'function' && Symbol.observable || '@@observable';
|
|
467
|
-
}();
|
|
453
|
+
}(); // TODO: to be removed in v5, left it out just to minimize the scope of the change and maintain compatibility with older versions of integration paackages
|
|
454
|
+
|
|
468
455
|
var interopSymbols = (_a = {}, _a[symbolObservable] = function () {
|
|
469
456
|
return this;
|
|
457
|
+
}, _a[Symbol.observable] = function () {
|
|
458
|
+
return this;
|
|
470
459
|
}, _a);
|
|
471
460
|
function isMachine(value) {
|
|
472
|
-
|
|
473
|
-
return '__xstatenode' in value;
|
|
474
|
-
} catch (e) {
|
|
475
|
-
return false;
|
|
476
|
-
}
|
|
461
|
+
return !!value && '__xstatenode' in value;
|
|
477
462
|
}
|
|
478
463
|
function isActor(value) {
|
|
479
464
|
return !!value && typeof value.send === 'function';
|
|
@@ -607,7 +592,6 @@ exports.isObservable = isObservable;
|
|
|
607
592
|
exports.isPromiseLike = isPromiseLike;
|
|
608
593
|
exports.isStateLike = isStateLike;
|
|
609
594
|
exports.isString = isString;
|
|
610
|
-
exports.keys = keys;
|
|
611
595
|
exports.mapContext = mapContext;
|
|
612
596
|
exports.mapFilterValues = mapFilterValues;
|
|
613
597
|
exports.mapValues = mapValues;
|