xstate 4.30.2 → 4.30.3
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 +16 -0
- package/dist/xstate.interpreter.js +1 -1
- package/dist/xstate.js +1 -1
- package/dist/xstate.web.js +2 -2
- package/es/Machine.d.ts +1 -2
- package/es/State.js +5 -5
- 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 -4
- package/es/interpreter.d.ts +2 -0
- package/es/interpreter.js +9 -5
- package/es/invokeUtils.js +2 -2
- package/es/mapState.js +2 -2
- package/es/stateUtils.js +2 -2
- package/es/types.d.ts +5 -3
- package/es/utils.d.ts +1 -4
- package/es/utils.js +9 -27
- package/lib/Machine.d.ts +1 -2
- package/lib/State.js +4 -4
- 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 -10
- package/lib/interpreter.d.ts +2 -0
- package/lib/interpreter.js +9 -5
- 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 +5 -3
- package/lib/utils.d.ts +1 -4
- package/lib/utils.js +7 -26
- 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;
|
|
@@ -472,11 +458,7 @@ var interopSymbols = (_a = {}, _a[symbolObservable] = function () {
|
|
|
472
458
|
return this;
|
|
473
459
|
}, _a);
|
|
474
460
|
function isMachine(value) {
|
|
475
|
-
|
|
476
|
-
return '__xstatenode' in value;
|
|
477
|
-
} catch (e) {
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
461
|
+
return !!value && '__xstatenode' in value;
|
|
480
462
|
}
|
|
481
463
|
function isActor(value) {
|
|
482
464
|
return !!value && typeof value.send === 'function';
|
|
@@ -610,7 +592,6 @@ exports.isObservable = isObservable;
|
|
|
610
592
|
exports.isPromiseLike = isPromiseLike;
|
|
611
593
|
exports.isStateLike = isStateLike;
|
|
612
594
|
exports.isString = isString;
|
|
613
|
-
exports.keys = keys;
|
|
614
595
|
exports.mapContext = mapContext;
|
|
615
596
|
exports.mapFilterValues = mapFilterValues;
|
|
616
597
|
exports.mapValues = mapValues;
|