mobx 6.12.5 → 6.13.0
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 +11 -5
- package/dist/mobx.cjs.development.js +232 -167
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.esm.development.js +232 -167
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +232 -167
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +232 -167
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/dist/types/observableset.d.ts +7 -0
- package/dist/utils/utils.d.ts +2 -2
- package/package.json +1 -1
- package/src/types/observableset.ts +48 -0
|
@@ -267,99 +267,76 @@ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function get
|
|
|
267
267
|
return res;
|
|
268
268
|
};
|
|
269
269
|
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
Object.defineProperty(
|
|
283
|
-
writable:
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
293
|
-
target[key] = source[key];
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return target;
|
|
298
|
-
};
|
|
299
|
-
return _extends.apply(this, arguments);
|
|
300
|
-
}
|
|
301
|
-
function _inheritsLoose(subClass, superClass) {
|
|
302
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
303
|
-
subClass.prototype.constructor = subClass;
|
|
304
|
-
_setPrototypeOf(subClass, superClass);
|
|
305
|
-
}
|
|
306
|
-
function _setPrototypeOf(o, p) {
|
|
307
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
308
|
-
o.__proto__ = p;
|
|
309
|
-
return o;
|
|
310
|
-
};
|
|
311
|
-
return _setPrototypeOf(o, p);
|
|
312
|
-
}
|
|
313
|
-
function _assertThisInitialized(self) {
|
|
314
|
-
if (self === void 0) {
|
|
315
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
316
|
-
}
|
|
317
|
-
return self;
|
|
318
|
-
}
|
|
319
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
320
|
-
if (!o) return;
|
|
321
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
322
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
323
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
324
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
325
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
326
|
-
}
|
|
327
|
-
function _arrayLikeToArray(arr, len) {
|
|
328
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
329
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
330
|
-
return arr2;
|
|
331
|
-
}
|
|
332
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
333
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
334
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
335
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
336
|
-
if (it) o = it;
|
|
337
|
-
var i = 0;
|
|
270
|
+
function _arrayLikeToArray(r, a) {
|
|
271
|
+
(null == a || a > r.length) && (a = r.length);
|
|
272
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
273
|
+
return n;
|
|
274
|
+
}
|
|
275
|
+
function _defineProperties(e, r) {
|
|
276
|
+
for (var t = 0; t < r.length; t++) {
|
|
277
|
+
var o = r[t];
|
|
278
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function _createClass(e, r, t) {
|
|
282
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
283
|
+
writable: !1
|
|
284
|
+
}), e;
|
|
285
|
+
}
|
|
286
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
287
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
288
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
289
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
290
|
+
t && (r = t);
|
|
291
|
+
var o = 0;
|
|
338
292
|
return function () {
|
|
339
|
-
|
|
340
|
-
done:
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
value: o[i++]
|
|
293
|
+
return o >= r.length ? {
|
|
294
|
+
done: !0
|
|
295
|
+
} : {
|
|
296
|
+
done: !1,
|
|
297
|
+
value: r[o++]
|
|
345
298
|
};
|
|
346
299
|
};
|
|
347
300
|
}
|
|
348
301
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
349
302
|
}
|
|
350
|
-
function
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
303
|
+
function _extends() {
|
|
304
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
305
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
306
|
+
var t = arguments[e];
|
|
307
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
308
|
+
}
|
|
309
|
+
return n;
|
|
310
|
+
}, _extends.apply(null, arguments);
|
|
311
|
+
}
|
|
312
|
+
function _inheritsLoose(t, o) {
|
|
313
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
314
|
+
}
|
|
315
|
+
function _setPrototypeOf(t, e) {
|
|
316
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
317
|
+
return t.__proto__ = e, t;
|
|
318
|
+
}, _setPrototypeOf(t, e);
|
|
319
|
+
}
|
|
320
|
+
function _toPrimitive(t, r) {
|
|
321
|
+
if ("object" != typeof t || !t) return t;
|
|
322
|
+
var e = t[Symbol.toPrimitive];
|
|
323
|
+
if (void 0 !== e) {
|
|
324
|
+
var i = e.call(t, r || "default");
|
|
325
|
+
if ("object" != typeof i) return i;
|
|
356
326
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
357
327
|
}
|
|
358
|
-
return (
|
|
328
|
+
return ("string" === r ? String : Number)(t);
|
|
359
329
|
}
|
|
360
|
-
function _toPropertyKey(
|
|
361
|
-
var
|
|
362
|
-
return
|
|
330
|
+
function _toPropertyKey(t) {
|
|
331
|
+
var i = _toPrimitive(t, "string");
|
|
332
|
+
return "symbol" == typeof i ? i : i + "";
|
|
333
|
+
}
|
|
334
|
+
function _unsupportedIterableToArray(r, a) {
|
|
335
|
+
if (r) {
|
|
336
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
337
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
338
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
339
|
+
}
|
|
363
340
|
}
|
|
364
341
|
|
|
365
342
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
@@ -432,8 +409,6 @@ function assert20223DecoratorType(context, types) {
|
|
|
432
409
|
|
|
433
410
|
var $mobx = /*#__PURE__*/Symbol("mobx administration");
|
|
434
411
|
var Atom = /*#__PURE__*/function () {
|
|
435
|
-
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
436
|
-
|
|
437
412
|
/**
|
|
438
413
|
* Create a new atom. For debugging purposes it is recommended to give it a name.
|
|
439
414
|
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
@@ -444,16 +419,18 @@ var Atom = /*#__PURE__*/function () {
|
|
|
444
419
|
}
|
|
445
420
|
this.name_ = void 0;
|
|
446
421
|
this.isPendingUnobservation = false;
|
|
422
|
+
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
447
423
|
this.isBeingObserved = false;
|
|
448
424
|
this.observers_ = new Set();
|
|
449
425
|
this.diffValue_ = 0;
|
|
450
426
|
this.lastAccessedBy_ = 0;
|
|
451
427
|
this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
|
|
428
|
+
// onBecomeObservedListeners
|
|
452
429
|
this.onBOL = void 0;
|
|
430
|
+
// onBecomeUnobservedListeners
|
|
453
431
|
this.onBUOL = void 0;
|
|
454
432
|
this.name_ = name_;
|
|
455
433
|
}
|
|
456
|
-
// onBecomeObservedListeners
|
|
457
434
|
var _proto = Atom.prototype;
|
|
458
435
|
_proto.onBO = function onBO() {
|
|
459
436
|
if (this.onBOL) {
|
|
@@ -635,7 +612,6 @@ function make_(adm, key) {
|
|
|
635
612
|
}
|
|
636
613
|
return 0 /* MakeResult.Cancel */;
|
|
637
614
|
}
|
|
638
|
-
|
|
639
615
|
function extend_(adm, key, descriptor, proxyTrap) {
|
|
640
616
|
die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
|
|
641
617
|
}
|
|
@@ -668,12 +644,10 @@ function make_$1(adm, key, descriptor, source) {
|
|
|
668
644
|
// rest of the proto chain must be annotated already
|
|
669
645
|
return 1 /* MakeResult.Break */;
|
|
670
646
|
}
|
|
671
|
-
|
|
672
647
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
|
|
673
648
|
defineProperty(source, key, actionDescriptor);
|
|
674
649
|
return 2 /* MakeResult.Continue */;
|
|
675
650
|
}
|
|
676
|
-
|
|
677
651
|
function extend_$1(adm, key, descriptor, proxyTrap) {
|
|
678
652
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
|
|
679
653
|
return adm.defineProperty_(key, actionDescriptor, proxyTrap);
|
|
@@ -771,18 +745,15 @@ function make_$2(adm, key, descriptor, source) {
|
|
|
771
745
|
return 0 /* MakeResult.Cancel */;
|
|
772
746
|
}
|
|
773
747
|
}
|
|
774
|
-
|
|
775
748
|
if (isFlow(descriptor.value)) {
|
|
776
749
|
// A prototype could have been annotated already by other constructor,
|
|
777
750
|
// rest of the proto chain must be annotated already
|
|
778
751
|
return 1 /* MakeResult.Break */;
|
|
779
752
|
}
|
|
780
|
-
|
|
781
753
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
|
|
782
754
|
defineProperty(source, key, flowDescriptor);
|
|
783
755
|
return 2 /* MakeResult.Continue */;
|
|
784
756
|
}
|
|
785
|
-
|
|
786
757
|
function extend_$2(adm, key, descriptor, proxyTrap) {
|
|
787
758
|
var _this$options_2;
|
|
788
759
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
|
|
@@ -859,7 +830,6 @@ function createComputedAnnotation(name, options) {
|
|
|
859
830
|
function make_$3(adm, key, descriptor) {
|
|
860
831
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
861
832
|
}
|
|
862
|
-
|
|
863
833
|
function extend_$3(adm, key, descriptor, proxyTrap) {
|
|
864
834
|
assertComputedDescriptor(adm, this, key, descriptor);
|
|
865
835
|
return adm.defineComputedProperty_(key, _extends({}, this.options_, {
|
|
@@ -907,7 +877,6 @@ function createObservableAnnotation(name, options) {
|
|
|
907
877
|
function make_$4(adm, key, descriptor) {
|
|
908
878
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
909
879
|
}
|
|
910
|
-
|
|
911
880
|
function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
912
881
|
var _this$options_$enhanc, _this$options_;
|
|
913
882
|
assertObservableDescriptor(adm, this, key, descriptor);
|
|
@@ -1327,11 +1296,8 @@ function allowStateChangesEnd(prev) {
|
|
|
1327
1296
|
globalState.allowStateChanges = prev;
|
|
1328
1297
|
}
|
|
1329
1298
|
|
|
1330
|
-
var _Symbol$toPrimitive;
|
|
1331
1299
|
var CREATE = "create";
|
|
1332
|
-
_Symbol$toPrimitive = Symbol.toPrimitive;
|
|
1333
1300
|
var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
1334
|
-
_inheritsLoose(ObservableValue, _Atom);
|
|
1335
1301
|
function ObservableValue(value, enhancer, name_, notifySpy, equals) {
|
|
1336
1302
|
var _this;
|
|
1337
1303
|
if (name_ === void 0) {
|
|
@@ -1360,7 +1326,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1360
1326
|
// only notify spy if this is a stand-alone observable
|
|
1361
1327
|
spyReport({
|
|
1362
1328
|
type: CREATE,
|
|
1363
|
-
object:
|
|
1329
|
+
object: _this,
|
|
1364
1330
|
observableKind: "value",
|
|
1365
1331
|
debugObjectName: _this.name_,
|
|
1366
1332
|
newValue: "" + _this.value_
|
|
@@ -1368,6 +1334,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1368
1334
|
}
|
|
1369
1335
|
return _this;
|
|
1370
1336
|
}
|
|
1337
|
+
_inheritsLoose(ObservableValue, _Atom);
|
|
1371
1338
|
var _proto = ObservableValue.prototype;
|
|
1372
1339
|
_proto.dehanceValue = function dehanceValue(value) {
|
|
1373
1340
|
if (this.dehancer !== undefined) {
|
|
@@ -1459,14 +1426,13 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1459
1426
|
_proto.valueOf = function valueOf() {
|
|
1460
1427
|
return toPrimitive(this.get());
|
|
1461
1428
|
};
|
|
1462
|
-
_proto[
|
|
1429
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1463
1430
|
return this.valueOf();
|
|
1464
1431
|
};
|
|
1465
1432
|
return ObservableValue;
|
|
1466
1433
|
}(Atom);
|
|
1467
1434
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1468
1435
|
|
|
1469
|
-
var _Symbol$toPrimitive$1;
|
|
1470
1436
|
function getFlag(flags, mask) {
|
|
1471
1437
|
return !!(flags & mask);
|
|
1472
1438
|
}
|
|
@@ -1497,13 +1463,7 @@ function setFlag(flags, mask, newValue) {
|
|
|
1497
1463
|
*
|
|
1498
1464
|
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
|
|
1499
1465
|
*/
|
|
1500
|
-
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1501
1466
|
var ComputedValue = /*#__PURE__*/function () {
|
|
1502
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
1503
|
-
// during tracking it's an array with new observed observers
|
|
1504
|
-
|
|
1505
|
-
// N.B: unminified as it is used by MST
|
|
1506
|
-
|
|
1507
1467
|
/**
|
|
1508
1468
|
* Create a new computed value based on a function expression.
|
|
1509
1469
|
*
|
|
@@ -1519,7 +1479,9 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1519
1479
|
function ComputedValue(options) {
|
|
1520
1480
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
1521
1481
|
this.observing_ = [];
|
|
1482
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
1522
1483
|
this.newObserving_ = null;
|
|
1484
|
+
// during tracking it's an array with new observed observers
|
|
1523
1485
|
this.observers_ = new Set();
|
|
1524
1486
|
this.diffValue_ = 0;
|
|
1525
1487
|
this.runId_ = 0;
|
|
@@ -1531,6 +1493,7 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1531
1493
|
this.triggeredBy_ = void 0;
|
|
1532
1494
|
this.flags_ = 0;
|
|
1533
1495
|
this.derivation = void 0;
|
|
1496
|
+
// N.B: unminified as it is used by MST
|
|
1534
1497
|
this.setter_ = void 0;
|
|
1535
1498
|
this.isTracing_ = TraceMode.NONE;
|
|
1536
1499
|
this.scope_ = void 0;
|
|
@@ -1712,10 +1675,10 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1712
1675
|
_proto.valueOf = function valueOf() {
|
|
1713
1676
|
return toPrimitive(this.get());
|
|
1714
1677
|
};
|
|
1715
|
-
_proto[
|
|
1678
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1716
1679
|
return this.valueOf();
|
|
1717
1680
|
};
|
|
1718
|
-
_createClass(ComputedValue, [{
|
|
1681
|
+
return _createClass(ComputedValue, [{
|
|
1719
1682
|
key: "isComputing",
|
|
1720
1683
|
get: function get() {
|
|
1721
1684
|
return getFlag(this.flags_, ComputedValue.isComputingMask_);
|
|
@@ -1748,7 +1711,6 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1748
1711
|
this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);
|
|
1749
1712
|
}
|
|
1750
1713
|
}]);
|
|
1751
|
-
return ComputedValue;
|
|
1752
1714
|
}();
|
|
1753
1715
|
ComputedValue.isComputingMask_ = 1;
|
|
1754
1716
|
ComputedValue.isRunningSetterMask_ = 2;
|
|
@@ -1787,7 +1749,6 @@ var CaughtException = function CaughtException(cause) {
|
|
|
1787
1749
|
this.cause = cause;
|
|
1788
1750
|
// Empty
|
|
1789
1751
|
};
|
|
1790
|
-
|
|
1791
1752
|
function isCaughtException(e) {
|
|
1792
1753
|
return e instanceof CaughtException;
|
|
1793
1754
|
}
|
|
@@ -1851,7 +1812,6 @@ function shouldCompute(derivation) {
|
|
|
1851
1812
|
function isComputingDerivation() {
|
|
1852
1813
|
return globalState.trackingDerivation !== null; // filter out actions inside computations
|
|
1853
1814
|
}
|
|
1854
|
-
|
|
1855
1815
|
function checkIfStateModificationsAreAllowed(atom) {
|
|
1856
1816
|
var hasObservers = atom.observers_.size > 0;
|
|
1857
1817
|
// Should not be possible to change observed state outside strict mode, except during initialization, see #563
|
|
@@ -2022,28 +1982,113 @@ function changeDependenciesStateTo0(derivation) {
|
|
|
2022
1982
|
*/
|
|
2023
1983
|
var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
|
|
2024
1984
|
var MobXGlobals = function MobXGlobals() {
|
|
1985
|
+
/**
|
|
1986
|
+
* MobXGlobals version.
|
|
1987
|
+
* MobX compatiblity with other versions loaded in memory as long as this version matches.
|
|
1988
|
+
* It indicates that the global state still stores similar information
|
|
1989
|
+
*
|
|
1990
|
+
* N.B: this version is unrelated to the package version of MobX, and is only the version of the
|
|
1991
|
+
* internal state storage of MobX, and can be the same across many different package versions
|
|
1992
|
+
*/
|
|
2025
1993
|
this.version = 6;
|
|
1994
|
+
/**
|
|
1995
|
+
* globally unique token to signal unchanged
|
|
1996
|
+
*/
|
|
2026
1997
|
this.UNCHANGED = {};
|
|
1998
|
+
/**
|
|
1999
|
+
* Currently running derivation
|
|
2000
|
+
*/
|
|
2027
2001
|
this.trackingDerivation = null;
|
|
2002
|
+
/**
|
|
2003
|
+
* Currently running reaction. This determines if we currently have a reactive context.
|
|
2004
|
+
* (Tracking derivation is also set for temporal tracking of computed values inside actions,
|
|
2005
|
+
* but trackingReaction can only be set by a form of Reaction)
|
|
2006
|
+
*/
|
|
2028
2007
|
this.trackingContext = null;
|
|
2008
|
+
/**
|
|
2009
|
+
* Each time a derivation is tracked, it is assigned a unique run-id
|
|
2010
|
+
*/
|
|
2029
2011
|
this.runId = 0;
|
|
2012
|
+
/**
|
|
2013
|
+
* 'guid' for general purpose. Will be persisted amongst resets.
|
|
2014
|
+
*/
|
|
2030
2015
|
this.mobxGuid = 0;
|
|
2016
|
+
/**
|
|
2017
|
+
* Are we in a batch block? (and how many of them)
|
|
2018
|
+
*/
|
|
2031
2019
|
this.inBatch = 0;
|
|
2020
|
+
/**
|
|
2021
|
+
* Observables that don't have observers anymore, and are about to be
|
|
2022
|
+
* suspended, unless somebody else accesses it in the same batch
|
|
2023
|
+
*
|
|
2024
|
+
* @type {IObservable[]}
|
|
2025
|
+
*/
|
|
2032
2026
|
this.pendingUnobservations = [];
|
|
2027
|
+
/**
|
|
2028
|
+
* List of scheduled, not yet executed, reactions.
|
|
2029
|
+
*/
|
|
2033
2030
|
this.pendingReactions = [];
|
|
2031
|
+
/**
|
|
2032
|
+
* Are we currently processing reactions?
|
|
2033
|
+
*/
|
|
2034
2034
|
this.isRunningReactions = false;
|
|
2035
|
+
/**
|
|
2036
|
+
* Is it allowed to change observables at this point?
|
|
2037
|
+
* In general, MobX doesn't allow that when running computations and React.render.
|
|
2038
|
+
* To ensure that those functions stay pure.
|
|
2039
|
+
*/
|
|
2035
2040
|
this.allowStateChanges = false;
|
|
2041
|
+
/**
|
|
2042
|
+
* Is it allowed to read observables at this point?
|
|
2043
|
+
* Used to hold the state needed for `observableRequiresReaction`
|
|
2044
|
+
*/
|
|
2036
2045
|
this.allowStateReads = true;
|
|
2046
|
+
/**
|
|
2047
|
+
* If strict mode is enabled, state changes are by default not allowed
|
|
2048
|
+
*/
|
|
2037
2049
|
this.enforceActions = true;
|
|
2050
|
+
/**
|
|
2051
|
+
* Spy callbacks
|
|
2052
|
+
*/
|
|
2038
2053
|
this.spyListeners = [];
|
|
2054
|
+
/**
|
|
2055
|
+
* Globally attached error handlers that react specifically to errors in reactions
|
|
2056
|
+
*/
|
|
2039
2057
|
this.globalReactionErrorHandlers = [];
|
|
2058
|
+
/**
|
|
2059
|
+
* Warn if computed values are accessed outside a reactive context
|
|
2060
|
+
*/
|
|
2040
2061
|
this.computedRequiresReaction = false;
|
|
2062
|
+
/**
|
|
2063
|
+
* (Experimental)
|
|
2064
|
+
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
2065
|
+
*/
|
|
2041
2066
|
this.reactionRequiresObservable = false;
|
|
2067
|
+
/**
|
|
2068
|
+
* (Experimental)
|
|
2069
|
+
* Warn if observables are accessed outside a reactive context
|
|
2070
|
+
*/
|
|
2042
2071
|
this.observableRequiresReaction = false;
|
|
2072
|
+
/*
|
|
2073
|
+
* Don't catch and rethrow exceptions. This is useful for inspecting the state of
|
|
2074
|
+
* the stack when an exception occurs while debugging.
|
|
2075
|
+
*/
|
|
2043
2076
|
this.disableErrorBoundaries = false;
|
|
2077
|
+
/*
|
|
2078
|
+
* If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as
|
|
2079
|
+
* they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836
|
|
2080
|
+
*/
|
|
2044
2081
|
this.suppressReactionErrors = false;
|
|
2045
2082
|
this.useProxies = true;
|
|
2083
|
+
/*
|
|
2084
|
+
* print warnings about code that would fail if proxies weren't available
|
|
2085
|
+
*/
|
|
2046
2086
|
this.verifyProxies = false;
|
|
2087
|
+
/**
|
|
2088
|
+
* False forces all object's descriptors to
|
|
2089
|
+
* writable: true
|
|
2090
|
+
* configurable: true
|
|
2091
|
+
*/
|
|
2047
2092
|
this.safeDescriptors = true;
|
|
2048
2093
|
};
|
|
2049
2094
|
var canMergeGlobalState = true;
|
|
@@ -2140,7 +2185,6 @@ function addObserver(observable, node) {
|
|
|
2140
2185
|
// invariantObservers(observable);
|
|
2141
2186
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
|
|
2142
2187
|
}
|
|
2143
|
-
|
|
2144
2188
|
function removeObserver(observable, node) {
|
|
2145
2189
|
// invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
|
|
2146
2190
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
|
|
@@ -2153,7 +2197,6 @@ function removeObserver(observable, node) {
|
|
|
2153
2197
|
// invariantObservers(observable);
|
|
2154
2198
|
// invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
|
|
2155
2199
|
}
|
|
2156
|
-
|
|
2157
2200
|
function queueForUnobservation(observable) {
|
|
2158
2201
|
if (observable.isPendingUnobservation === false) {
|
|
2159
2202
|
// invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
|
|
@@ -2291,7 +2334,6 @@ function propagateMaybeChanged(observable) {
|
|
|
2291
2334
|
});
|
|
2292
2335
|
// invariantLOS(observable, "maybe end");
|
|
2293
2336
|
}
|
|
2294
|
-
|
|
2295
2337
|
function logTraceInfo(derivation, observable) {
|
|
2296
2338
|
console.log("[mobx.trace] '" + derivation.name_ + "' is invalidated due to a change in: '" + observable.name_ + "'");
|
|
2297
2339
|
if (derivation.isTracing_ === TraceMode.BREAK) {
|
|
@@ -2315,8 +2357,6 @@ function printDepTree(tree, lines, depth) {
|
|
|
2315
2357
|
}
|
|
2316
2358
|
|
|
2317
2359
|
var Reaction = /*#__PURE__*/function () {
|
|
2318
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
2319
|
-
|
|
2320
2360
|
function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {
|
|
2321
2361
|
if (name_ === void 0) {
|
|
2322
2362
|
name_ = "Reaction@" + getNextId() ;
|
|
@@ -2326,6 +2366,7 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2326
2366
|
this.errorHandler_ = void 0;
|
|
2327
2367
|
this.requiresObservable_ = void 0;
|
|
2328
2368
|
this.observing_ = [];
|
|
2369
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
2329
2370
|
this.newObserving_ = [];
|
|
2330
2371
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
2331
2372
|
this.diffValue_ = 0;
|
|
@@ -2388,7 +2429,6 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2388
2429
|
return;
|
|
2389
2430
|
// console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either
|
|
2390
2431
|
}
|
|
2391
|
-
|
|
2392
2432
|
startBatch();
|
|
2393
2433
|
var notify = isSpyEnabled();
|
|
2394
2434
|
var startTime;
|
|
@@ -2463,9 +2503,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2463
2503
|
var _this2 = this;
|
|
2464
2504
|
var dispose = function dispose() {
|
|
2465
2505
|
_this2.dispose();
|
|
2466
|
-
abortSignal == null
|
|
2506
|
+
abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener("abort", dispose);
|
|
2467
2507
|
};
|
|
2468
|
-
abortSignal == null
|
|
2508
|
+
abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
|
|
2469
2509
|
dispose[$mobx] = this;
|
|
2470
2510
|
return dispose;
|
|
2471
2511
|
};
|
|
@@ -2517,7 +2557,6 @@ function runReactionsHelper() {
|
|
|
2517
2557
|
console.error( "Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + (" Probably there is a cycle in the reactive function: " + allReactions[0]) );
|
|
2518
2558
|
allReactions.splice(0); // clear reactions
|
|
2519
2559
|
}
|
|
2520
|
-
|
|
2521
2560
|
var remainingReactions = allReactions.splice(0);
|
|
2522
2561
|
for (var i = 0, l = remainingReactions.length; i < l; i++) {
|
|
2523
2562
|
remainingReactions[i].runReaction_();
|
|
@@ -2645,7 +2684,7 @@ function isAction(thing) {
|
|
|
2645
2684
|
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
2646
2685
|
*/
|
|
2647
2686
|
function autorun(view, opts) {
|
|
2648
|
-
var _opts$name, _opts, _opts2,
|
|
2687
|
+
var _opts$name, _opts, _opts2, _opts3;
|
|
2649
2688
|
if (opts === void 0) {
|
|
2650
2689
|
opts = EMPTY_OBJECT;
|
|
2651
2690
|
}
|
|
@@ -2684,7 +2723,7 @@ function autorun(view, opts) {
|
|
|
2684
2723
|
function reactionRunner() {
|
|
2685
2724
|
view(reaction);
|
|
2686
2725
|
}
|
|
2687
|
-
if (!((_opts2 = opts) != null && (_opts2
|
|
2726
|
+
if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {
|
|
2688
2727
|
reaction.schedule_();
|
|
2689
2728
|
}
|
|
2690
2729
|
return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);
|
|
@@ -2698,7 +2737,7 @@ function createSchedulerFromOptions(opts) {
|
|
|
2698
2737
|
} : run;
|
|
2699
2738
|
}
|
|
2700
2739
|
function reaction(expression, effect, opts) {
|
|
2701
|
-
var _opts$name2, _opts4,
|
|
2740
|
+
var _opts$name2, _opts4, _opts5;
|
|
2702
2741
|
if (opts === void 0) {
|
|
2703
2742
|
opts = EMPTY_OBJECT;
|
|
2704
2743
|
}
|
|
@@ -2747,7 +2786,7 @@ function reaction(expression, effect, opts) {
|
|
|
2747
2786
|
}
|
|
2748
2787
|
firstTime = false;
|
|
2749
2788
|
}
|
|
2750
|
-
if (!((_opts4 = opts) != null && (_opts4
|
|
2789
|
+
if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {
|
|
2751
2790
|
r.schedule_();
|
|
2752
2791
|
}
|
|
2753
2792
|
return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);
|
|
@@ -2956,7 +2995,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2956
2995
|
}
|
|
2957
2996
|
onFulfilled(undefined); // kick off the process
|
|
2958
2997
|
});
|
|
2959
|
-
|
|
2960
2998
|
promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
|
|
2961
2999
|
try {
|
|
2962
3000
|
if (pendingPromise) {
|
|
@@ -2974,7 +3012,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2974
3012
|
rejector(e); // there could be a throwing finally block
|
|
2975
3013
|
}
|
|
2976
3014
|
});
|
|
2977
|
-
|
|
2978
3015
|
return promise;
|
|
2979
3016
|
};
|
|
2980
3017
|
res.isMobXFlow = true;
|
|
@@ -2989,7 +3026,6 @@ function cancelPromise(promise) {
|
|
|
2989
3026
|
function flowResult(result) {
|
|
2990
3027
|
return result; // just tricking TypeScript :)
|
|
2991
3028
|
}
|
|
2992
|
-
|
|
2993
3029
|
function isFlow(fn) {
|
|
2994
3030
|
return (fn == null ? void 0 : fn.isMobXFlow) === true;
|
|
2995
3031
|
}
|
|
@@ -3411,10 +3447,10 @@ function whenPromise(predicate, opts) {
|
|
|
3411
3447
|
disposer();
|
|
3412
3448
|
reject(new Error("WHEN_ABORTED"));
|
|
3413
3449
|
};
|
|
3414
|
-
opts == null
|
|
3450
|
+
opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener("abort", abort);
|
|
3415
3451
|
})["finally"](function () {
|
|
3416
3452
|
var _opts$signal3;
|
|
3417
|
-
return opts == null
|
|
3453
|
+
return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener("abort", abort);
|
|
3418
3454
|
});
|
|
3419
3455
|
res.cancel = cancel;
|
|
3420
3456
|
return res;
|
|
@@ -3631,8 +3667,6 @@ var arrayTraps = {
|
|
|
3631
3667
|
}
|
|
3632
3668
|
};
|
|
3633
3669
|
var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
3634
|
-
// this is the prop that gets proxied, so can't replace it!
|
|
3635
|
-
|
|
3636
3670
|
function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {
|
|
3637
3671
|
if (name === void 0) {
|
|
3638
3672
|
name = "ObservableArray@" + getNextId() ;
|
|
@@ -3641,6 +3675,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3641
3675
|
this.legacyMode_ = void 0;
|
|
3642
3676
|
this.atom_ = void 0;
|
|
3643
3677
|
this.values_ = [];
|
|
3678
|
+
// this is the prop that gets proxied, so can't replace it!
|
|
3644
3679
|
this.interceptors_ = void 0;
|
|
3645
3680
|
this.changeListeners_ = void 0;
|
|
3646
3681
|
this.enhancer_ = void 0;
|
|
@@ -3761,7 +3796,6 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3761
3796
|
var lengthDelta = newItems.length - deleteCount;
|
|
3762
3797
|
this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified
|
|
3763
3798
|
}
|
|
3764
|
-
|
|
3765
3799
|
var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
|
|
3766
3800
|
if (deleteCount !== 0 || newItems.length !== 0) {
|
|
3767
3801
|
this.notifyArraySplice_(index, newItems, res);
|
|
@@ -3861,6 +3895,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3861
3895
|
var change = interceptChange(this, {
|
|
3862
3896
|
type: UPDATE,
|
|
3863
3897
|
object: this.proxy_,
|
|
3898
|
+
// since "this" is the real array we need to pass its proxy
|
|
3864
3899
|
index: index,
|
|
3865
3900
|
newValue: newValue
|
|
3866
3901
|
});
|
|
@@ -4076,17 +4111,12 @@ function isObservableArray(thing) {
|
|
|
4076
4111
|
return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);
|
|
4077
4112
|
}
|
|
4078
4113
|
|
|
4079
|
-
var _Symbol$iterator, _Symbol$toStringTag;
|
|
4080
4114
|
var ObservableMapMarker = {};
|
|
4081
4115
|
var ADD = "add";
|
|
4082
4116
|
var DELETE = "delete";
|
|
4083
4117
|
// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
|
|
4084
4118
|
// But: https://github.com/mobxjs/mobx/issues/1556
|
|
4085
|
-
_Symbol$iterator = Symbol.iterator;
|
|
4086
|
-
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4087
4119
|
var ObservableMap = /*#__PURE__*/function () {
|
|
4088
|
-
// hasMap, not hashMap >-).
|
|
4089
|
-
|
|
4090
4120
|
function ObservableMap(initialData, enhancer_, name_) {
|
|
4091
4121
|
var _this = this;
|
|
4092
4122
|
if (enhancer_ === void 0) {
|
|
@@ -4100,6 +4130,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4100
4130
|
this[$mobx] = ObservableMapMarker;
|
|
4101
4131
|
this.data_ = void 0;
|
|
4102
4132
|
this.hasMap_ = void 0;
|
|
4133
|
+
// hasMap, not hashMap >-).
|
|
4103
4134
|
this.keysAtom_ = void 0;
|
|
4104
4135
|
this.interceptors_ = void 0;
|
|
4105
4136
|
this.changeListeners_ = void 0;
|
|
@@ -4188,7 +4219,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4188
4219
|
transaction(function () {
|
|
4189
4220
|
var _this3$hasMap_$get;
|
|
4190
4221
|
_this3.keysAtom_.reportChanged();
|
|
4191
|
-
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null
|
|
4222
|
+
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);
|
|
4192
4223
|
var observable = _this3.data_.get(key);
|
|
4193
4224
|
observable.setNewValue_(undefined);
|
|
4194
4225
|
_this3.data_["delete"](key);
|
|
@@ -4238,7 +4269,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4238
4269
|
var observable = new ObservableValue(newValue, _this4.enhancer_, _this4.name_ + "." + stringifyKey(key) , false);
|
|
4239
4270
|
_this4.data_.set(key, observable);
|
|
4240
4271
|
newValue = observable.value_; // value might have been changed
|
|
4241
|
-
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null
|
|
4272
|
+
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);
|
|
4242
4273
|
_this4.keysAtom_.reportChanged();
|
|
4243
4274
|
});
|
|
4244
4275
|
var notifySpy = isSpyEnabled();
|
|
@@ -4307,7 +4338,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4307
4338
|
}
|
|
4308
4339
|
});
|
|
4309
4340
|
};
|
|
4310
|
-
_proto[
|
|
4341
|
+
_proto[Symbol.iterator] = function () {
|
|
4311
4342
|
return this.entries();
|
|
4312
4343
|
};
|
|
4313
4344
|
_proto.forEach = function forEach(callback, thisArg) {
|
|
@@ -4461,19 +4492,18 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4461
4492
|
_proto.intercept_ = function intercept_(handler) {
|
|
4462
4493
|
return registerInterceptor(this, handler);
|
|
4463
4494
|
};
|
|
4464
|
-
_createClass(ObservableMap, [{
|
|
4495
|
+
return _createClass(ObservableMap, [{
|
|
4465
4496
|
key: "size",
|
|
4466
4497
|
get: function get() {
|
|
4467
4498
|
this.keysAtom_.reportObserved();
|
|
4468
4499
|
return this.data_.size;
|
|
4469
4500
|
}
|
|
4470
4501
|
}, {
|
|
4471
|
-
key:
|
|
4502
|
+
key: Symbol.toStringTag,
|
|
4472
4503
|
get: function get() {
|
|
4473
4504
|
return "Map";
|
|
4474
4505
|
}
|
|
4475
4506
|
}]);
|
|
4476
|
-
return ObservableMap;
|
|
4477
4507
|
}();
|
|
4478
4508
|
// eslint-disable-next-line
|
|
4479
4509
|
var isObservableMap = /*#__PURE__*/createInstanceofPredicate("ObservableMap", ObservableMap);
|
|
@@ -4493,10 +4523,7 @@ function convertToMap(dataStructure) {
|
|
|
4493
4523
|
}
|
|
4494
4524
|
}
|
|
4495
4525
|
|
|
4496
|
-
var _Symbol$iterator$1, _Symbol$toStringTag$1;
|
|
4497
4526
|
var ObservableSetMarker = {};
|
|
4498
|
-
_Symbol$iterator$1 = Symbol.iterator;
|
|
4499
|
-
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
4500
4527
|
var ObservableSet = /*#__PURE__*/function () {
|
|
4501
4528
|
function ObservableSet(initialData, enhancer, name_) {
|
|
4502
4529
|
var _this = this;
|
|
@@ -4567,7 +4594,6 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4567
4594
|
// ideally, value = change.value would be done here, so that values can be
|
|
4568
4595
|
// changed by interceptor. Same applies for other Set and Map api's.
|
|
4569
4596
|
}
|
|
4570
|
-
|
|
4571
4597
|
if (!this.has(value)) {
|
|
4572
4598
|
transaction(function () {
|
|
4573
4599
|
_this3.data_.add(_this3.enhancer_(value, undefined));
|
|
@@ -4673,6 +4699,47 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4673
4699
|
}
|
|
4674
4700
|
});
|
|
4675
4701
|
};
|
|
4702
|
+
_proto.intersection = function intersection(otherSet) {
|
|
4703
|
+
if (isES6Set(otherSet)) {
|
|
4704
|
+
return otherSet.intersection(this);
|
|
4705
|
+
} else {
|
|
4706
|
+
var dehancedSet = new Set(this);
|
|
4707
|
+
return dehancedSet.intersection(otherSet);
|
|
4708
|
+
}
|
|
4709
|
+
};
|
|
4710
|
+
_proto.union = function union(otherSet) {
|
|
4711
|
+
if (isES6Set(otherSet)) {
|
|
4712
|
+
return otherSet.union(this);
|
|
4713
|
+
} else {
|
|
4714
|
+
var dehancedSet = new Set(this);
|
|
4715
|
+
return dehancedSet.union(otherSet);
|
|
4716
|
+
}
|
|
4717
|
+
};
|
|
4718
|
+
_proto.difference = function difference(otherSet) {
|
|
4719
|
+
return new Set(this).difference(otherSet);
|
|
4720
|
+
};
|
|
4721
|
+
_proto.symmetricDifference = function symmetricDifference(otherSet) {
|
|
4722
|
+
if (isES6Set(otherSet)) {
|
|
4723
|
+
return otherSet.symmetricDifference(this);
|
|
4724
|
+
} else {
|
|
4725
|
+
var dehancedSet = new Set(this);
|
|
4726
|
+
return dehancedSet.symmetricDifference(otherSet);
|
|
4727
|
+
}
|
|
4728
|
+
};
|
|
4729
|
+
_proto.isSubsetOf = function isSubsetOf(otherSet) {
|
|
4730
|
+
return new Set(this).isSubsetOf(otherSet);
|
|
4731
|
+
};
|
|
4732
|
+
_proto.isSupersetOf = function isSupersetOf(otherSet) {
|
|
4733
|
+
return new Set(this).isSupersetOf(otherSet);
|
|
4734
|
+
};
|
|
4735
|
+
_proto.isDisjointFrom = function isDisjointFrom(otherSet) {
|
|
4736
|
+
if (isES6Set(otherSet)) {
|
|
4737
|
+
return otherSet.isDisjointFrom(this);
|
|
4738
|
+
} else {
|
|
4739
|
+
var dehancedSet = new Set(this);
|
|
4740
|
+
return dehancedSet.isDisjointFrom(otherSet);
|
|
4741
|
+
}
|
|
4742
|
+
};
|
|
4676
4743
|
_proto.replace = function replace(other) {
|
|
4677
4744
|
var _this5 = this;
|
|
4678
4745
|
if (isObservableSet(other)) {
|
|
@@ -4711,22 +4778,21 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4711
4778
|
_proto.toString = function toString() {
|
|
4712
4779
|
return "[object ObservableSet]";
|
|
4713
4780
|
};
|
|
4714
|
-
_proto[
|
|
4781
|
+
_proto[Symbol.iterator] = function () {
|
|
4715
4782
|
return this.values();
|
|
4716
4783
|
};
|
|
4717
|
-
_createClass(ObservableSet, [{
|
|
4784
|
+
return _createClass(ObservableSet, [{
|
|
4718
4785
|
key: "size",
|
|
4719
4786
|
get: function get() {
|
|
4720
4787
|
this.atom_.reportObserved();
|
|
4721
4788
|
return this.data_.size;
|
|
4722
4789
|
}
|
|
4723
4790
|
}, {
|
|
4724
|
-
key:
|
|
4791
|
+
key: Symbol.toStringTag,
|
|
4725
4792
|
get: function get() {
|
|
4726
4793
|
return "Set";
|
|
4727
4794
|
}
|
|
4728
4795
|
}]);
|
|
4729
|
-
return ObservableSet;
|
|
4730
4796
|
}();
|
|
4731
4797
|
// eslint-disable-next-line
|
|
4732
4798
|
var isObservableSet = /*#__PURE__*/createInstanceofPredicate("ObservableSet", ObservableSet);
|
|
@@ -5126,7 +5192,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5126
5192
|
}
|
|
5127
5193
|
// Delete
|
|
5128
5194
|
try {
|
|
5129
|
-
var _this$pendingKeys_
|
|
5195
|
+
var _this$pendingKeys_;
|
|
5130
5196
|
startBatch();
|
|
5131
5197
|
var notify = hasListeners(this);
|
|
5132
5198
|
var notifySpy = "development" !== "production" && isSpyEnabled();
|
|
@@ -5164,7 +5230,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5164
5230
|
this.keysAtom_.reportChanged();
|
|
5165
5231
|
// Notify "has" observers
|
|
5166
5232
|
// "in" as it may still exist in proto
|
|
5167
|
-
(_this$pendingKeys_ = this.pendingKeys_) == null
|
|
5233
|
+
(_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);
|
|
5168
5234
|
// Notify spies/listeners
|
|
5169
5235
|
if (notify || notifySpy) {
|
|
5170
5236
|
var _change2 = {
|
|
@@ -5205,7 +5271,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5205
5271
|
return registerInterceptor(this, handler);
|
|
5206
5272
|
};
|
|
5207
5273
|
_proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {
|
|
5208
|
-
var _this$pendingKeys_2
|
|
5274
|
+
var _this$pendingKeys_2;
|
|
5209
5275
|
var notify = hasListeners(this);
|
|
5210
5276
|
var notifySpy = isSpyEnabled();
|
|
5211
5277
|
if (notify || notifySpy) {
|
|
@@ -5227,7 +5293,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5227
5293
|
spyReportEnd();
|
|
5228
5294
|
}
|
|
5229
5295
|
}
|
|
5230
|
-
(_this$pendingKeys_2 = this.pendingKeys_) == null
|
|
5296
|
+
(_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);
|
|
5231
5297
|
// Notify "keys/entries/values" observers
|
|
5232
5298
|
this.keysAtom_.reportChanged();
|
|
5233
5299
|
};
|
|
@@ -5289,7 +5355,7 @@ function recordAnnotationApplied(adm, annotation, key) {
|
|
|
5289
5355
|
adm.appliedAnnotations_[key] = annotation;
|
|
5290
5356
|
}
|
|
5291
5357
|
// Remove applied decorator annotation so we don't try to apply it again in subclass constructor
|
|
5292
|
-
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null
|
|
5358
|
+
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];
|
|
5293
5359
|
}
|
|
5294
5360
|
function assertAnnotable(adm, annotation, key) {
|
|
5295
5361
|
// Valid annotation
|
|
@@ -5369,8 +5435,7 @@ inherit(StubArray, Array.prototype);
|
|
|
5369
5435
|
// Weex proto freeze protection was here,
|
|
5370
5436
|
// but it is unclear why the hack is need as MobX never changed the prototype
|
|
5371
5437
|
// anyway, so removed it in V6
|
|
5372
|
-
var LegacyObservableArray = /*#__PURE__*/function (_StubArray
|
|
5373
|
-
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5438
|
+
var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
5374
5439
|
function LegacyObservableArray(initialValues, enhancer, name, owned) {
|
|
5375
5440
|
var _this;
|
|
5376
5441
|
if (name === void 0) {
|
|
@@ -5382,8 +5447,8 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5382
5447
|
_this = _StubArray.call(this) || this;
|
|
5383
5448
|
initObservable(function () {
|
|
5384
5449
|
var adm = new ObservableArrayAdministration(name, enhancer, owned, true);
|
|
5385
|
-
adm.proxy_ =
|
|
5386
|
-
addHiddenFinalProp(
|
|
5450
|
+
adm.proxy_ = _this;
|
|
5451
|
+
addHiddenFinalProp(_this, $mobx, adm);
|
|
5387
5452
|
if (initialValues && initialValues.length) {
|
|
5388
5453
|
// @ts-ignore
|
|
5389
5454
|
_this.spliceWithArray(0, 0, initialValues);
|
|
@@ -5391,11 +5456,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5391
5456
|
if (safariPrototypeSetterInheritanceBug) {
|
|
5392
5457
|
// Seems that Safari won't use numeric prototype setter until any * numeric property is
|
|
5393
5458
|
// defined on the instance. After that it works fine, even if this property is deleted.
|
|
5394
|
-
Object.defineProperty(
|
|
5459
|
+
Object.defineProperty(_this, "0", ENTRY_0);
|
|
5395
5460
|
}
|
|
5396
5461
|
});
|
|
5397
5462
|
return _this;
|
|
5398
5463
|
}
|
|
5464
|
+
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5399
5465
|
var _proto = LegacyObservableArray.prototype;
|
|
5400
5466
|
_proto.concat = function concat() {
|
|
5401
5467
|
this[$mobx].atom_.reportObserved();
|
|
@@ -5408,7 +5474,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5408
5474
|
return isObservableArray(a) ? a.slice() : a;
|
|
5409
5475
|
}));
|
|
5410
5476
|
};
|
|
5411
|
-
_proto[
|
|
5477
|
+
_proto[Symbol.iterator] = function () {
|
|
5412
5478
|
var self = this;
|
|
5413
5479
|
var nextIndex = 0;
|
|
5414
5480
|
return makeIterable({
|
|
@@ -5423,7 +5489,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5423
5489
|
}
|
|
5424
5490
|
});
|
|
5425
5491
|
};
|
|
5426
|
-
_createClass(LegacyObservableArray, [{
|
|
5492
|
+
return _createClass(LegacyObservableArray, [{
|
|
5427
5493
|
key: "length",
|
|
5428
5494
|
get: function get() {
|
|
5429
5495
|
return this[$mobx].getArrayLength_();
|
|
@@ -5432,13 +5498,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5432
5498
|
this[$mobx].setArrayLength_(newLength);
|
|
5433
5499
|
}
|
|
5434
5500
|
}, {
|
|
5435
|
-
key:
|
|
5501
|
+
key: Symbol.toStringTag,
|
|
5436
5502
|
get: function get() {
|
|
5437
5503
|
return "Array";
|
|
5438
5504
|
}
|
|
5439
5505
|
}]);
|
|
5440
|
-
|
|
5441
|
-
}(StubArray, Symbol.toStringTag, Symbol.iterator);
|
|
5506
|
+
}(StubArray);
|
|
5442
5507
|
Object.entries(arrayExtensions).forEach(function (_ref) {
|
|
5443
5508
|
var prop = _ref[0],
|
|
5444
5509
|
fn = _ref[1];
|