mobx 6.12.4 → 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 +17 -5
- package/dist/mobx.cjs.development.js +241 -170
- 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 +241 -170
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +241 -170
- 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 +241 -170
- 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 +3 -2
- package/package.json +1 -1
- package/src/types/observablemap.ts +2 -1
- package/src/types/observableset.ts +48 -0
- package/src/utils/utils.ts +9 -2
|
@@ -209,10 +209,16 @@
|
|
|
209
209
|
};
|
|
210
210
|
}
|
|
211
211
|
function isES6Map(thing) {
|
|
212
|
-
return thing
|
|
212
|
+
return thing != null && Object.prototype.toString.call(thing) === "[object Map]";
|
|
213
|
+
}
|
|
214
|
+
function isPlainES6Map(thing) {
|
|
215
|
+
var mapProto = Object.getPrototypeOf(thing);
|
|
216
|
+
var objectProto = Object.getPrototypeOf(mapProto);
|
|
217
|
+
var nullProto = Object.getPrototypeOf(objectProto);
|
|
218
|
+
return nullProto === null;
|
|
213
219
|
}
|
|
214
220
|
function isES6Set(thing) {
|
|
215
|
-
return thing
|
|
221
|
+
return thing != null && Object.prototype.toString.call(thing) === "[object Set]";
|
|
216
222
|
}
|
|
217
223
|
var hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== "undefined";
|
|
218
224
|
/**
|
|
@@ -263,99 +269,76 @@
|
|
|
263
269
|
return res;
|
|
264
270
|
};
|
|
265
271
|
|
|
266
|
-
function
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
Object.defineProperty(
|
|
279
|
-
writable:
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
289
|
-
target[key] = source[key];
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return target;
|
|
294
|
-
};
|
|
295
|
-
return _extends.apply(this, arguments);
|
|
296
|
-
}
|
|
297
|
-
function _inheritsLoose(subClass, superClass) {
|
|
298
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
299
|
-
subClass.prototype.constructor = subClass;
|
|
300
|
-
_setPrototypeOf(subClass, superClass);
|
|
301
|
-
}
|
|
302
|
-
function _setPrototypeOf(o, p) {
|
|
303
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
304
|
-
o.__proto__ = p;
|
|
305
|
-
return o;
|
|
306
|
-
};
|
|
307
|
-
return _setPrototypeOf(o, p);
|
|
308
|
-
}
|
|
309
|
-
function _assertThisInitialized(self) {
|
|
310
|
-
if (self === void 0) {
|
|
311
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
312
|
-
}
|
|
313
|
-
return self;
|
|
314
|
-
}
|
|
315
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
316
|
-
if (!o) return;
|
|
317
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
318
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
319
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
320
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
321
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
322
|
-
}
|
|
323
|
-
function _arrayLikeToArray(arr, len) {
|
|
324
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
325
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
326
|
-
return arr2;
|
|
327
|
-
}
|
|
328
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
329
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
330
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
331
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
332
|
-
if (it) o = it;
|
|
333
|
-
var i = 0;
|
|
272
|
+
function _arrayLikeToArray(r, a) {
|
|
273
|
+
(null == a || a > r.length) && (a = r.length);
|
|
274
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
275
|
+
return n;
|
|
276
|
+
}
|
|
277
|
+
function _defineProperties(e, r) {
|
|
278
|
+
for (var t = 0; t < r.length; t++) {
|
|
279
|
+
var o = r[t];
|
|
280
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
function _createClass(e, r, t) {
|
|
284
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
285
|
+
writable: !1
|
|
286
|
+
}), e;
|
|
287
|
+
}
|
|
288
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
289
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
290
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
291
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
292
|
+
t && (r = t);
|
|
293
|
+
var o = 0;
|
|
334
294
|
return function () {
|
|
335
|
-
|
|
336
|
-
done:
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
value: o[i++]
|
|
295
|
+
return o >= r.length ? {
|
|
296
|
+
done: !0
|
|
297
|
+
} : {
|
|
298
|
+
done: !1,
|
|
299
|
+
value: r[o++]
|
|
341
300
|
};
|
|
342
301
|
};
|
|
343
302
|
}
|
|
344
303
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
345
304
|
}
|
|
346
|
-
function
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
305
|
+
function _extends() {
|
|
306
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
307
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
308
|
+
var t = arguments[e];
|
|
309
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
310
|
+
}
|
|
311
|
+
return n;
|
|
312
|
+
}, _extends.apply(null, arguments);
|
|
313
|
+
}
|
|
314
|
+
function _inheritsLoose(t, o) {
|
|
315
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
316
|
+
}
|
|
317
|
+
function _setPrototypeOf(t, e) {
|
|
318
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
319
|
+
return t.__proto__ = e, t;
|
|
320
|
+
}, _setPrototypeOf(t, e);
|
|
321
|
+
}
|
|
322
|
+
function _toPrimitive(t, r) {
|
|
323
|
+
if ("object" != typeof t || !t) return t;
|
|
324
|
+
var e = t[Symbol.toPrimitive];
|
|
325
|
+
if (void 0 !== e) {
|
|
326
|
+
var i = e.call(t, r || "default");
|
|
327
|
+
if ("object" != typeof i) return i;
|
|
352
328
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
353
329
|
}
|
|
354
|
-
return (
|
|
330
|
+
return ("string" === r ? String : Number)(t);
|
|
355
331
|
}
|
|
356
|
-
function _toPropertyKey(
|
|
357
|
-
var
|
|
358
|
-
return
|
|
332
|
+
function _toPropertyKey(t) {
|
|
333
|
+
var i = _toPrimitive(t, "string");
|
|
334
|
+
return "symbol" == typeof i ? i : i + "";
|
|
335
|
+
}
|
|
336
|
+
function _unsupportedIterableToArray(r, a) {
|
|
337
|
+
if (r) {
|
|
338
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
339
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
340
|
+
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;
|
|
341
|
+
}
|
|
359
342
|
}
|
|
360
343
|
|
|
361
344
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
@@ -428,8 +411,6 @@
|
|
|
428
411
|
|
|
429
412
|
var $mobx = /*#__PURE__*/Symbol("mobx administration");
|
|
430
413
|
var Atom = /*#__PURE__*/function () {
|
|
431
|
-
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
432
|
-
|
|
433
414
|
/**
|
|
434
415
|
* Create a new atom. For debugging purposes it is recommended to give it a name.
|
|
435
416
|
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
@@ -440,16 +421,18 @@
|
|
|
440
421
|
}
|
|
441
422
|
this.name_ = void 0;
|
|
442
423
|
this.isPendingUnobservation = false;
|
|
424
|
+
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
443
425
|
this.isBeingObserved = false;
|
|
444
426
|
this.observers_ = new Set();
|
|
445
427
|
this.diffValue_ = 0;
|
|
446
428
|
this.lastAccessedBy_ = 0;
|
|
447
429
|
this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
|
|
430
|
+
// onBecomeObservedListeners
|
|
448
431
|
this.onBOL = void 0;
|
|
432
|
+
// onBecomeUnobservedListeners
|
|
449
433
|
this.onBUOL = void 0;
|
|
450
434
|
this.name_ = name_;
|
|
451
435
|
}
|
|
452
|
-
// onBecomeObservedListeners
|
|
453
436
|
var _proto = Atom.prototype;
|
|
454
437
|
_proto.onBO = function onBO() {
|
|
455
438
|
if (this.onBOL) {
|
|
@@ -631,7 +614,6 @@
|
|
|
631
614
|
}
|
|
632
615
|
return 0 /* MakeResult.Cancel */;
|
|
633
616
|
}
|
|
634
|
-
|
|
635
617
|
function extend_(adm, key, descriptor, proxyTrap) {
|
|
636
618
|
die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
|
|
637
619
|
}
|
|
@@ -664,12 +646,10 @@
|
|
|
664
646
|
// rest of the proto chain must be annotated already
|
|
665
647
|
return 1 /* MakeResult.Break */;
|
|
666
648
|
}
|
|
667
|
-
|
|
668
649
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
|
|
669
650
|
defineProperty(source, key, actionDescriptor);
|
|
670
651
|
return 2 /* MakeResult.Continue */;
|
|
671
652
|
}
|
|
672
|
-
|
|
673
653
|
function extend_$1(adm, key, descriptor, proxyTrap) {
|
|
674
654
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
|
|
675
655
|
return adm.defineProperty_(key, actionDescriptor, proxyTrap);
|
|
@@ -767,18 +747,15 @@
|
|
|
767
747
|
return 0 /* MakeResult.Cancel */;
|
|
768
748
|
}
|
|
769
749
|
}
|
|
770
|
-
|
|
771
750
|
if (isFlow(descriptor.value)) {
|
|
772
751
|
// A prototype could have been annotated already by other constructor,
|
|
773
752
|
// rest of the proto chain must be annotated already
|
|
774
753
|
return 1 /* MakeResult.Break */;
|
|
775
754
|
}
|
|
776
|
-
|
|
777
755
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
|
|
778
756
|
defineProperty(source, key, flowDescriptor);
|
|
779
757
|
return 2 /* MakeResult.Continue */;
|
|
780
758
|
}
|
|
781
|
-
|
|
782
759
|
function extend_$2(adm, key, descriptor, proxyTrap) {
|
|
783
760
|
var _this$options_2;
|
|
784
761
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
|
|
@@ -855,7 +832,6 @@
|
|
|
855
832
|
function make_$3(adm, key, descriptor) {
|
|
856
833
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
857
834
|
}
|
|
858
|
-
|
|
859
835
|
function extend_$3(adm, key, descriptor, proxyTrap) {
|
|
860
836
|
assertComputedDescriptor(adm, this, key, descriptor);
|
|
861
837
|
return adm.defineComputedProperty_(key, _extends({}, this.options_, {
|
|
@@ -903,7 +879,6 @@
|
|
|
903
879
|
function make_$4(adm, key, descriptor) {
|
|
904
880
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
905
881
|
}
|
|
906
|
-
|
|
907
882
|
function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
908
883
|
var _this$options_$enhanc, _this$options_;
|
|
909
884
|
assertObservableDescriptor(adm, this, key, descriptor);
|
|
@@ -1323,11 +1298,8 @@
|
|
|
1323
1298
|
globalState.allowStateChanges = prev;
|
|
1324
1299
|
}
|
|
1325
1300
|
|
|
1326
|
-
var _Symbol$toPrimitive;
|
|
1327
1301
|
var CREATE = "create";
|
|
1328
|
-
_Symbol$toPrimitive = Symbol.toPrimitive;
|
|
1329
1302
|
var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
1330
|
-
_inheritsLoose(ObservableValue, _Atom);
|
|
1331
1303
|
function ObservableValue(value, enhancer, name_, notifySpy, equals) {
|
|
1332
1304
|
var _this;
|
|
1333
1305
|
if (name_ === void 0) {
|
|
@@ -1356,7 +1328,7 @@
|
|
|
1356
1328
|
// only notify spy if this is a stand-alone observable
|
|
1357
1329
|
spyReport({
|
|
1358
1330
|
type: CREATE,
|
|
1359
|
-
object:
|
|
1331
|
+
object: _this,
|
|
1360
1332
|
observableKind: "value",
|
|
1361
1333
|
debugObjectName: _this.name_,
|
|
1362
1334
|
newValue: "" + _this.value_
|
|
@@ -1364,6 +1336,7 @@
|
|
|
1364
1336
|
}
|
|
1365
1337
|
return _this;
|
|
1366
1338
|
}
|
|
1339
|
+
_inheritsLoose(ObservableValue, _Atom);
|
|
1367
1340
|
var _proto = ObservableValue.prototype;
|
|
1368
1341
|
_proto.dehanceValue = function dehanceValue(value) {
|
|
1369
1342
|
if (this.dehancer !== undefined) {
|
|
@@ -1455,14 +1428,13 @@
|
|
|
1455
1428
|
_proto.valueOf = function valueOf() {
|
|
1456
1429
|
return toPrimitive(this.get());
|
|
1457
1430
|
};
|
|
1458
|
-
_proto[
|
|
1431
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1459
1432
|
return this.valueOf();
|
|
1460
1433
|
};
|
|
1461
1434
|
return ObservableValue;
|
|
1462
1435
|
}(Atom);
|
|
1463
1436
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1464
1437
|
|
|
1465
|
-
var _Symbol$toPrimitive$1;
|
|
1466
1438
|
function getFlag(flags, mask) {
|
|
1467
1439
|
return !!(flags & mask);
|
|
1468
1440
|
}
|
|
@@ -1493,13 +1465,7 @@
|
|
|
1493
1465
|
*
|
|
1494
1466
|
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
|
|
1495
1467
|
*/
|
|
1496
|
-
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1497
1468
|
var ComputedValue = /*#__PURE__*/function () {
|
|
1498
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
1499
|
-
// during tracking it's an array with new observed observers
|
|
1500
|
-
|
|
1501
|
-
// N.B: unminified as it is used by MST
|
|
1502
|
-
|
|
1503
1469
|
/**
|
|
1504
1470
|
* Create a new computed value based on a function expression.
|
|
1505
1471
|
*
|
|
@@ -1515,7 +1481,9 @@
|
|
|
1515
1481
|
function ComputedValue(options) {
|
|
1516
1482
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
1517
1483
|
this.observing_ = [];
|
|
1484
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
1518
1485
|
this.newObserving_ = null;
|
|
1486
|
+
// during tracking it's an array with new observed observers
|
|
1519
1487
|
this.observers_ = new Set();
|
|
1520
1488
|
this.diffValue_ = 0;
|
|
1521
1489
|
this.runId_ = 0;
|
|
@@ -1527,6 +1495,7 @@
|
|
|
1527
1495
|
this.triggeredBy_ = void 0;
|
|
1528
1496
|
this.flags_ = 0;
|
|
1529
1497
|
this.derivation = void 0;
|
|
1498
|
+
// N.B: unminified as it is used by MST
|
|
1530
1499
|
this.setter_ = void 0;
|
|
1531
1500
|
this.isTracing_ = TraceMode.NONE;
|
|
1532
1501
|
this.scope_ = void 0;
|
|
@@ -1708,10 +1677,10 @@
|
|
|
1708
1677
|
_proto.valueOf = function valueOf() {
|
|
1709
1678
|
return toPrimitive(this.get());
|
|
1710
1679
|
};
|
|
1711
|
-
_proto[
|
|
1680
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1712
1681
|
return this.valueOf();
|
|
1713
1682
|
};
|
|
1714
|
-
_createClass(ComputedValue, [{
|
|
1683
|
+
return _createClass(ComputedValue, [{
|
|
1715
1684
|
key: "isComputing",
|
|
1716
1685
|
get: function get() {
|
|
1717
1686
|
return getFlag(this.flags_, ComputedValue.isComputingMask_);
|
|
@@ -1744,7 +1713,6 @@
|
|
|
1744
1713
|
this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);
|
|
1745
1714
|
}
|
|
1746
1715
|
}]);
|
|
1747
|
-
return ComputedValue;
|
|
1748
1716
|
}();
|
|
1749
1717
|
ComputedValue.isComputingMask_ = 1;
|
|
1750
1718
|
ComputedValue.isRunningSetterMask_ = 2;
|
|
@@ -1783,7 +1751,6 @@
|
|
|
1783
1751
|
this.cause = cause;
|
|
1784
1752
|
// Empty
|
|
1785
1753
|
};
|
|
1786
|
-
|
|
1787
1754
|
function isCaughtException(e) {
|
|
1788
1755
|
return e instanceof CaughtException;
|
|
1789
1756
|
}
|
|
@@ -1847,7 +1814,6 @@
|
|
|
1847
1814
|
function isComputingDerivation() {
|
|
1848
1815
|
return globalState.trackingDerivation !== null; // filter out actions inside computations
|
|
1849
1816
|
}
|
|
1850
|
-
|
|
1851
1817
|
function checkIfStateModificationsAreAllowed(atom) {
|
|
1852
1818
|
var hasObservers = atom.observers_.size > 0;
|
|
1853
1819
|
// Should not be possible to change observed state outside strict mode, except during initialization, see #563
|
|
@@ -2018,28 +1984,113 @@
|
|
|
2018
1984
|
*/
|
|
2019
1985
|
var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
|
|
2020
1986
|
var MobXGlobals = function MobXGlobals() {
|
|
1987
|
+
/**
|
|
1988
|
+
* MobXGlobals version.
|
|
1989
|
+
* MobX compatiblity with other versions loaded in memory as long as this version matches.
|
|
1990
|
+
* It indicates that the global state still stores similar information
|
|
1991
|
+
*
|
|
1992
|
+
* N.B: this version is unrelated to the package version of MobX, and is only the version of the
|
|
1993
|
+
* internal state storage of MobX, and can be the same across many different package versions
|
|
1994
|
+
*/
|
|
2021
1995
|
this.version = 6;
|
|
1996
|
+
/**
|
|
1997
|
+
* globally unique token to signal unchanged
|
|
1998
|
+
*/
|
|
2022
1999
|
this.UNCHANGED = {};
|
|
2000
|
+
/**
|
|
2001
|
+
* Currently running derivation
|
|
2002
|
+
*/
|
|
2023
2003
|
this.trackingDerivation = null;
|
|
2004
|
+
/**
|
|
2005
|
+
* Currently running reaction. This determines if we currently have a reactive context.
|
|
2006
|
+
* (Tracking derivation is also set for temporal tracking of computed values inside actions,
|
|
2007
|
+
* but trackingReaction can only be set by a form of Reaction)
|
|
2008
|
+
*/
|
|
2024
2009
|
this.trackingContext = null;
|
|
2010
|
+
/**
|
|
2011
|
+
* Each time a derivation is tracked, it is assigned a unique run-id
|
|
2012
|
+
*/
|
|
2025
2013
|
this.runId = 0;
|
|
2014
|
+
/**
|
|
2015
|
+
* 'guid' for general purpose. Will be persisted amongst resets.
|
|
2016
|
+
*/
|
|
2026
2017
|
this.mobxGuid = 0;
|
|
2018
|
+
/**
|
|
2019
|
+
* Are we in a batch block? (and how many of them)
|
|
2020
|
+
*/
|
|
2027
2021
|
this.inBatch = 0;
|
|
2022
|
+
/**
|
|
2023
|
+
* Observables that don't have observers anymore, and are about to be
|
|
2024
|
+
* suspended, unless somebody else accesses it in the same batch
|
|
2025
|
+
*
|
|
2026
|
+
* @type {IObservable[]}
|
|
2027
|
+
*/
|
|
2028
2028
|
this.pendingUnobservations = [];
|
|
2029
|
+
/**
|
|
2030
|
+
* List of scheduled, not yet executed, reactions.
|
|
2031
|
+
*/
|
|
2029
2032
|
this.pendingReactions = [];
|
|
2033
|
+
/**
|
|
2034
|
+
* Are we currently processing reactions?
|
|
2035
|
+
*/
|
|
2030
2036
|
this.isRunningReactions = false;
|
|
2037
|
+
/**
|
|
2038
|
+
* Is it allowed to change observables at this point?
|
|
2039
|
+
* In general, MobX doesn't allow that when running computations and React.render.
|
|
2040
|
+
* To ensure that those functions stay pure.
|
|
2041
|
+
*/
|
|
2031
2042
|
this.allowStateChanges = false;
|
|
2043
|
+
/**
|
|
2044
|
+
* Is it allowed to read observables at this point?
|
|
2045
|
+
* Used to hold the state needed for `observableRequiresReaction`
|
|
2046
|
+
*/
|
|
2032
2047
|
this.allowStateReads = true;
|
|
2048
|
+
/**
|
|
2049
|
+
* If strict mode is enabled, state changes are by default not allowed
|
|
2050
|
+
*/
|
|
2033
2051
|
this.enforceActions = true;
|
|
2052
|
+
/**
|
|
2053
|
+
* Spy callbacks
|
|
2054
|
+
*/
|
|
2034
2055
|
this.spyListeners = [];
|
|
2056
|
+
/**
|
|
2057
|
+
* Globally attached error handlers that react specifically to errors in reactions
|
|
2058
|
+
*/
|
|
2035
2059
|
this.globalReactionErrorHandlers = [];
|
|
2060
|
+
/**
|
|
2061
|
+
* Warn if computed values are accessed outside a reactive context
|
|
2062
|
+
*/
|
|
2036
2063
|
this.computedRequiresReaction = false;
|
|
2064
|
+
/**
|
|
2065
|
+
* (Experimental)
|
|
2066
|
+
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
2067
|
+
*/
|
|
2037
2068
|
this.reactionRequiresObservable = false;
|
|
2069
|
+
/**
|
|
2070
|
+
* (Experimental)
|
|
2071
|
+
* Warn if observables are accessed outside a reactive context
|
|
2072
|
+
*/
|
|
2038
2073
|
this.observableRequiresReaction = false;
|
|
2074
|
+
/*
|
|
2075
|
+
* Don't catch and rethrow exceptions. This is useful for inspecting the state of
|
|
2076
|
+
* the stack when an exception occurs while debugging.
|
|
2077
|
+
*/
|
|
2039
2078
|
this.disableErrorBoundaries = false;
|
|
2079
|
+
/*
|
|
2080
|
+
* If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as
|
|
2081
|
+
* they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836
|
|
2082
|
+
*/
|
|
2040
2083
|
this.suppressReactionErrors = false;
|
|
2041
2084
|
this.useProxies = true;
|
|
2085
|
+
/*
|
|
2086
|
+
* print warnings about code that would fail if proxies weren't available
|
|
2087
|
+
*/
|
|
2042
2088
|
this.verifyProxies = false;
|
|
2089
|
+
/**
|
|
2090
|
+
* False forces all object's descriptors to
|
|
2091
|
+
* writable: true
|
|
2092
|
+
* configurable: true
|
|
2093
|
+
*/
|
|
2043
2094
|
this.safeDescriptors = true;
|
|
2044
2095
|
};
|
|
2045
2096
|
var canMergeGlobalState = true;
|
|
@@ -2136,7 +2187,6 @@
|
|
|
2136
2187
|
// invariantObservers(observable);
|
|
2137
2188
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
|
|
2138
2189
|
}
|
|
2139
|
-
|
|
2140
2190
|
function removeObserver(observable, node) {
|
|
2141
2191
|
// invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
|
|
2142
2192
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
|
|
@@ -2149,7 +2199,6 @@
|
|
|
2149
2199
|
// invariantObservers(observable);
|
|
2150
2200
|
// invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
|
|
2151
2201
|
}
|
|
2152
|
-
|
|
2153
2202
|
function queueForUnobservation(observable) {
|
|
2154
2203
|
if (observable.isPendingUnobservation === false) {
|
|
2155
2204
|
// invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
|
|
@@ -2287,7 +2336,6 @@
|
|
|
2287
2336
|
});
|
|
2288
2337
|
// invariantLOS(observable, "maybe end");
|
|
2289
2338
|
}
|
|
2290
|
-
|
|
2291
2339
|
function logTraceInfo(derivation, observable) {
|
|
2292
2340
|
console.log("[mobx.trace] '" + derivation.name_ + "' is invalidated due to a change in: '" + observable.name_ + "'");
|
|
2293
2341
|
if (derivation.isTracing_ === TraceMode.BREAK) {
|
|
@@ -2311,8 +2359,6 @@
|
|
|
2311
2359
|
}
|
|
2312
2360
|
|
|
2313
2361
|
var Reaction = /*#__PURE__*/function () {
|
|
2314
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
2315
|
-
|
|
2316
2362
|
function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {
|
|
2317
2363
|
if (name_ === void 0) {
|
|
2318
2364
|
name_ = "Reaction@" + getNextId() ;
|
|
@@ -2322,6 +2368,7 @@
|
|
|
2322
2368
|
this.errorHandler_ = void 0;
|
|
2323
2369
|
this.requiresObservable_ = void 0;
|
|
2324
2370
|
this.observing_ = [];
|
|
2371
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
2325
2372
|
this.newObserving_ = [];
|
|
2326
2373
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
2327
2374
|
this.diffValue_ = 0;
|
|
@@ -2384,7 +2431,6 @@
|
|
|
2384
2431
|
return;
|
|
2385
2432
|
// console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either
|
|
2386
2433
|
}
|
|
2387
|
-
|
|
2388
2434
|
startBatch();
|
|
2389
2435
|
var notify = isSpyEnabled();
|
|
2390
2436
|
var startTime;
|
|
@@ -2459,9 +2505,9 @@
|
|
|
2459
2505
|
var _this2 = this;
|
|
2460
2506
|
var dispose = function dispose() {
|
|
2461
2507
|
_this2.dispose();
|
|
2462
|
-
abortSignal == null
|
|
2508
|
+
abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener("abort", dispose);
|
|
2463
2509
|
};
|
|
2464
|
-
abortSignal == null
|
|
2510
|
+
abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
|
|
2465
2511
|
dispose[$mobx] = this;
|
|
2466
2512
|
return dispose;
|
|
2467
2513
|
};
|
|
@@ -2513,7 +2559,6 @@
|
|
|
2513
2559
|
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]) );
|
|
2514
2560
|
allReactions.splice(0); // clear reactions
|
|
2515
2561
|
}
|
|
2516
|
-
|
|
2517
2562
|
var remainingReactions = allReactions.splice(0);
|
|
2518
2563
|
for (var i = 0, l = remainingReactions.length; i < l; i++) {
|
|
2519
2564
|
remainingReactions[i].runReaction_();
|
|
@@ -2641,7 +2686,7 @@
|
|
|
2641
2686
|
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
2642
2687
|
*/
|
|
2643
2688
|
function autorun(view, opts) {
|
|
2644
|
-
var _opts$name, _opts, _opts2,
|
|
2689
|
+
var _opts$name, _opts, _opts2, _opts3;
|
|
2645
2690
|
if (opts === void 0) {
|
|
2646
2691
|
opts = EMPTY_OBJECT;
|
|
2647
2692
|
}
|
|
@@ -2680,7 +2725,7 @@
|
|
|
2680
2725
|
function reactionRunner() {
|
|
2681
2726
|
view(reaction);
|
|
2682
2727
|
}
|
|
2683
|
-
if (!((_opts2 = opts) != null && (_opts2
|
|
2728
|
+
if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {
|
|
2684
2729
|
reaction.schedule_();
|
|
2685
2730
|
}
|
|
2686
2731
|
return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);
|
|
@@ -2694,7 +2739,7 @@
|
|
|
2694
2739
|
} : run;
|
|
2695
2740
|
}
|
|
2696
2741
|
function reaction(expression, effect, opts) {
|
|
2697
|
-
var _opts$name2, _opts4,
|
|
2742
|
+
var _opts$name2, _opts4, _opts5;
|
|
2698
2743
|
if (opts === void 0) {
|
|
2699
2744
|
opts = EMPTY_OBJECT;
|
|
2700
2745
|
}
|
|
@@ -2743,7 +2788,7 @@
|
|
|
2743
2788
|
}
|
|
2744
2789
|
firstTime = false;
|
|
2745
2790
|
}
|
|
2746
|
-
if (!((_opts4 = opts) != null && (_opts4
|
|
2791
|
+
if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {
|
|
2747
2792
|
r.schedule_();
|
|
2748
2793
|
}
|
|
2749
2794
|
return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);
|
|
@@ -2952,7 +2997,6 @@
|
|
|
2952
2997
|
}
|
|
2953
2998
|
onFulfilled(undefined); // kick off the process
|
|
2954
2999
|
});
|
|
2955
|
-
|
|
2956
3000
|
promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
|
|
2957
3001
|
try {
|
|
2958
3002
|
if (pendingPromise) {
|
|
@@ -2970,7 +3014,6 @@
|
|
|
2970
3014
|
rejector(e); // there could be a throwing finally block
|
|
2971
3015
|
}
|
|
2972
3016
|
});
|
|
2973
|
-
|
|
2974
3017
|
return promise;
|
|
2975
3018
|
};
|
|
2976
3019
|
res.isMobXFlow = true;
|
|
@@ -2985,7 +3028,6 @@
|
|
|
2985
3028
|
function flowResult(result) {
|
|
2986
3029
|
return result; // just tricking TypeScript :)
|
|
2987
3030
|
}
|
|
2988
|
-
|
|
2989
3031
|
function isFlow(fn) {
|
|
2990
3032
|
return (fn == null ? void 0 : fn.isMobXFlow) === true;
|
|
2991
3033
|
}
|
|
@@ -3407,10 +3449,10 @@
|
|
|
3407
3449
|
disposer();
|
|
3408
3450
|
reject(new Error("WHEN_ABORTED"));
|
|
3409
3451
|
};
|
|
3410
|
-
opts == null
|
|
3452
|
+
opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener("abort", abort);
|
|
3411
3453
|
})["finally"](function () {
|
|
3412
3454
|
var _opts$signal3;
|
|
3413
|
-
return opts == null
|
|
3455
|
+
return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener("abort", abort);
|
|
3414
3456
|
});
|
|
3415
3457
|
res.cancel = cancel;
|
|
3416
3458
|
return res;
|
|
@@ -3627,8 +3669,6 @@
|
|
|
3627
3669
|
}
|
|
3628
3670
|
};
|
|
3629
3671
|
var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
3630
|
-
// this is the prop that gets proxied, so can't replace it!
|
|
3631
|
-
|
|
3632
3672
|
function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {
|
|
3633
3673
|
if (name === void 0) {
|
|
3634
3674
|
name = "ObservableArray@" + getNextId() ;
|
|
@@ -3637,6 +3677,7 @@
|
|
|
3637
3677
|
this.legacyMode_ = void 0;
|
|
3638
3678
|
this.atom_ = void 0;
|
|
3639
3679
|
this.values_ = [];
|
|
3680
|
+
// this is the prop that gets proxied, so can't replace it!
|
|
3640
3681
|
this.interceptors_ = void 0;
|
|
3641
3682
|
this.changeListeners_ = void 0;
|
|
3642
3683
|
this.enhancer_ = void 0;
|
|
@@ -3757,7 +3798,6 @@
|
|
|
3757
3798
|
var lengthDelta = newItems.length - deleteCount;
|
|
3758
3799
|
this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified
|
|
3759
3800
|
}
|
|
3760
|
-
|
|
3761
3801
|
var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
|
|
3762
3802
|
if (deleteCount !== 0 || newItems.length !== 0) {
|
|
3763
3803
|
this.notifyArraySplice_(index, newItems, res);
|
|
@@ -3857,6 +3897,7 @@
|
|
|
3857
3897
|
var change = interceptChange(this, {
|
|
3858
3898
|
type: UPDATE,
|
|
3859
3899
|
object: this.proxy_,
|
|
3900
|
+
// since "this" is the real array we need to pass its proxy
|
|
3860
3901
|
index: index,
|
|
3861
3902
|
newValue: newValue
|
|
3862
3903
|
});
|
|
@@ -4072,17 +4113,12 @@
|
|
|
4072
4113
|
return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);
|
|
4073
4114
|
}
|
|
4074
4115
|
|
|
4075
|
-
var _Symbol$iterator, _Symbol$toStringTag;
|
|
4076
4116
|
var ObservableMapMarker = {};
|
|
4077
4117
|
var ADD = "add";
|
|
4078
4118
|
var DELETE = "delete";
|
|
4079
4119
|
// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
|
|
4080
4120
|
// But: https://github.com/mobxjs/mobx/issues/1556
|
|
4081
|
-
_Symbol$iterator = Symbol.iterator;
|
|
4082
|
-
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4083
4121
|
var ObservableMap = /*#__PURE__*/function () {
|
|
4084
|
-
// hasMap, not hashMap >-).
|
|
4085
|
-
|
|
4086
4122
|
function ObservableMap(initialData, enhancer_, name_) {
|
|
4087
4123
|
var _this = this;
|
|
4088
4124
|
if (enhancer_ === void 0) {
|
|
@@ -4096,6 +4132,7 @@
|
|
|
4096
4132
|
this[$mobx] = ObservableMapMarker;
|
|
4097
4133
|
this.data_ = void 0;
|
|
4098
4134
|
this.hasMap_ = void 0;
|
|
4135
|
+
// hasMap, not hashMap >-).
|
|
4099
4136
|
this.keysAtom_ = void 0;
|
|
4100
4137
|
this.interceptors_ = void 0;
|
|
4101
4138
|
this.changeListeners_ = void 0;
|
|
@@ -4184,7 +4221,7 @@
|
|
|
4184
4221
|
transaction(function () {
|
|
4185
4222
|
var _this3$hasMap_$get;
|
|
4186
4223
|
_this3.keysAtom_.reportChanged();
|
|
4187
|
-
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null
|
|
4224
|
+
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);
|
|
4188
4225
|
var observable = _this3.data_.get(key);
|
|
4189
4226
|
observable.setNewValue_(undefined);
|
|
4190
4227
|
_this3.data_["delete"](key);
|
|
@@ -4234,7 +4271,7 @@
|
|
|
4234
4271
|
var observable = new ObservableValue(newValue, _this4.enhancer_, _this4.name_ + "." + stringifyKey(key) , false);
|
|
4235
4272
|
_this4.data_.set(key, observable);
|
|
4236
4273
|
newValue = observable.value_; // value might have been changed
|
|
4237
|
-
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null
|
|
4274
|
+
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);
|
|
4238
4275
|
_this4.keysAtom_.reportChanged();
|
|
4239
4276
|
});
|
|
4240
4277
|
var notifySpy = isSpyEnabled();
|
|
@@ -4303,7 +4340,7 @@
|
|
|
4303
4340
|
}
|
|
4304
4341
|
});
|
|
4305
4342
|
};
|
|
4306
|
-
_proto[
|
|
4343
|
+
_proto[Symbol.iterator] = function () {
|
|
4307
4344
|
return this.entries();
|
|
4308
4345
|
};
|
|
4309
4346
|
_proto.forEach = function forEach(callback, thisArg) {
|
|
@@ -4332,7 +4369,7 @@
|
|
|
4332
4369
|
return _this5.set(key, value);
|
|
4333
4370
|
});
|
|
4334
4371
|
} else if (isES6Map(other)) {
|
|
4335
|
-
if (other
|
|
4372
|
+
if (!isPlainES6Map(other)) {
|
|
4336
4373
|
die(19, other);
|
|
4337
4374
|
}
|
|
4338
4375
|
other.forEach(function (value, key) {
|
|
@@ -4457,19 +4494,18 @@
|
|
|
4457
4494
|
_proto.intercept_ = function intercept_(handler) {
|
|
4458
4495
|
return registerInterceptor(this, handler);
|
|
4459
4496
|
};
|
|
4460
|
-
_createClass(ObservableMap, [{
|
|
4497
|
+
return _createClass(ObservableMap, [{
|
|
4461
4498
|
key: "size",
|
|
4462
4499
|
get: function get() {
|
|
4463
4500
|
this.keysAtom_.reportObserved();
|
|
4464
4501
|
return this.data_.size;
|
|
4465
4502
|
}
|
|
4466
4503
|
}, {
|
|
4467
|
-
key:
|
|
4504
|
+
key: Symbol.toStringTag,
|
|
4468
4505
|
get: function get() {
|
|
4469
4506
|
return "Map";
|
|
4470
4507
|
}
|
|
4471
4508
|
}]);
|
|
4472
|
-
return ObservableMap;
|
|
4473
4509
|
}();
|
|
4474
4510
|
// eslint-disable-next-line
|
|
4475
4511
|
var isObservableMap = /*#__PURE__*/createInstanceofPredicate("ObservableMap", ObservableMap);
|
|
@@ -4489,10 +4525,7 @@
|
|
|
4489
4525
|
}
|
|
4490
4526
|
}
|
|
4491
4527
|
|
|
4492
|
-
var _Symbol$iterator$1, _Symbol$toStringTag$1;
|
|
4493
4528
|
var ObservableSetMarker = {};
|
|
4494
|
-
_Symbol$iterator$1 = Symbol.iterator;
|
|
4495
|
-
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
4496
4529
|
var ObservableSet = /*#__PURE__*/function () {
|
|
4497
4530
|
function ObservableSet(initialData, enhancer, name_) {
|
|
4498
4531
|
var _this = this;
|
|
@@ -4563,7 +4596,6 @@
|
|
|
4563
4596
|
// ideally, value = change.value would be done here, so that values can be
|
|
4564
4597
|
// changed by interceptor. Same applies for other Set and Map api's.
|
|
4565
4598
|
}
|
|
4566
|
-
|
|
4567
4599
|
if (!this.has(value)) {
|
|
4568
4600
|
transaction(function () {
|
|
4569
4601
|
_this3.data_.add(_this3.enhancer_(value, undefined));
|
|
@@ -4669,6 +4701,47 @@
|
|
|
4669
4701
|
}
|
|
4670
4702
|
});
|
|
4671
4703
|
};
|
|
4704
|
+
_proto.intersection = function intersection(otherSet) {
|
|
4705
|
+
if (isES6Set(otherSet)) {
|
|
4706
|
+
return otherSet.intersection(this);
|
|
4707
|
+
} else {
|
|
4708
|
+
var dehancedSet = new Set(this);
|
|
4709
|
+
return dehancedSet.intersection(otherSet);
|
|
4710
|
+
}
|
|
4711
|
+
};
|
|
4712
|
+
_proto.union = function union(otherSet) {
|
|
4713
|
+
if (isES6Set(otherSet)) {
|
|
4714
|
+
return otherSet.union(this);
|
|
4715
|
+
} else {
|
|
4716
|
+
var dehancedSet = new Set(this);
|
|
4717
|
+
return dehancedSet.union(otherSet);
|
|
4718
|
+
}
|
|
4719
|
+
};
|
|
4720
|
+
_proto.difference = function difference(otherSet) {
|
|
4721
|
+
return new Set(this).difference(otherSet);
|
|
4722
|
+
};
|
|
4723
|
+
_proto.symmetricDifference = function symmetricDifference(otherSet) {
|
|
4724
|
+
if (isES6Set(otherSet)) {
|
|
4725
|
+
return otherSet.symmetricDifference(this);
|
|
4726
|
+
} else {
|
|
4727
|
+
var dehancedSet = new Set(this);
|
|
4728
|
+
return dehancedSet.symmetricDifference(otherSet);
|
|
4729
|
+
}
|
|
4730
|
+
};
|
|
4731
|
+
_proto.isSubsetOf = function isSubsetOf(otherSet) {
|
|
4732
|
+
return new Set(this).isSubsetOf(otherSet);
|
|
4733
|
+
};
|
|
4734
|
+
_proto.isSupersetOf = function isSupersetOf(otherSet) {
|
|
4735
|
+
return new Set(this).isSupersetOf(otherSet);
|
|
4736
|
+
};
|
|
4737
|
+
_proto.isDisjointFrom = function isDisjointFrom(otherSet) {
|
|
4738
|
+
if (isES6Set(otherSet)) {
|
|
4739
|
+
return otherSet.isDisjointFrom(this);
|
|
4740
|
+
} else {
|
|
4741
|
+
var dehancedSet = new Set(this);
|
|
4742
|
+
return dehancedSet.isDisjointFrom(otherSet);
|
|
4743
|
+
}
|
|
4744
|
+
};
|
|
4672
4745
|
_proto.replace = function replace(other) {
|
|
4673
4746
|
var _this5 = this;
|
|
4674
4747
|
if (isObservableSet(other)) {
|
|
@@ -4707,22 +4780,21 @@
|
|
|
4707
4780
|
_proto.toString = function toString() {
|
|
4708
4781
|
return "[object ObservableSet]";
|
|
4709
4782
|
};
|
|
4710
|
-
_proto[
|
|
4783
|
+
_proto[Symbol.iterator] = function () {
|
|
4711
4784
|
return this.values();
|
|
4712
4785
|
};
|
|
4713
|
-
_createClass(ObservableSet, [{
|
|
4786
|
+
return _createClass(ObservableSet, [{
|
|
4714
4787
|
key: "size",
|
|
4715
4788
|
get: function get() {
|
|
4716
4789
|
this.atom_.reportObserved();
|
|
4717
4790
|
return this.data_.size;
|
|
4718
4791
|
}
|
|
4719
4792
|
}, {
|
|
4720
|
-
key:
|
|
4793
|
+
key: Symbol.toStringTag,
|
|
4721
4794
|
get: function get() {
|
|
4722
4795
|
return "Set";
|
|
4723
4796
|
}
|
|
4724
4797
|
}]);
|
|
4725
|
-
return ObservableSet;
|
|
4726
4798
|
}();
|
|
4727
4799
|
// eslint-disable-next-line
|
|
4728
4800
|
var isObservableSet = /*#__PURE__*/createInstanceofPredicate("ObservableSet", ObservableSet);
|
|
@@ -5122,7 +5194,7 @@
|
|
|
5122
5194
|
}
|
|
5123
5195
|
// Delete
|
|
5124
5196
|
try {
|
|
5125
|
-
var _this$pendingKeys_
|
|
5197
|
+
var _this$pendingKeys_;
|
|
5126
5198
|
startBatch();
|
|
5127
5199
|
var notify = hasListeners(this);
|
|
5128
5200
|
var notifySpy = "development" !== "production" && isSpyEnabled();
|
|
@@ -5160,7 +5232,7 @@
|
|
|
5160
5232
|
this.keysAtom_.reportChanged();
|
|
5161
5233
|
// Notify "has" observers
|
|
5162
5234
|
// "in" as it may still exist in proto
|
|
5163
|
-
(_this$pendingKeys_ = this.pendingKeys_) == null
|
|
5235
|
+
(_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);
|
|
5164
5236
|
// Notify spies/listeners
|
|
5165
5237
|
if (notify || notifySpy) {
|
|
5166
5238
|
var _change2 = {
|
|
@@ -5201,7 +5273,7 @@
|
|
|
5201
5273
|
return registerInterceptor(this, handler);
|
|
5202
5274
|
};
|
|
5203
5275
|
_proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {
|
|
5204
|
-
var _this$pendingKeys_2
|
|
5276
|
+
var _this$pendingKeys_2;
|
|
5205
5277
|
var notify = hasListeners(this);
|
|
5206
5278
|
var notifySpy = isSpyEnabled();
|
|
5207
5279
|
if (notify || notifySpy) {
|
|
@@ -5223,7 +5295,7 @@
|
|
|
5223
5295
|
spyReportEnd();
|
|
5224
5296
|
}
|
|
5225
5297
|
}
|
|
5226
|
-
(_this$pendingKeys_2 = this.pendingKeys_) == null
|
|
5298
|
+
(_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);
|
|
5227
5299
|
// Notify "keys/entries/values" observers
|
|
5228
5300
|
this.keysAtom_.reportChanged();
|
|
5229
5301
|
};
|
|
@@ -5285,7 +5357,7 @@
|
|
|
5285
5357
|
adm.appliedAnnotations_[key] = annotation;
|
|
5286
5358
|
}
|
|
5287
5359
|
// Remove applied decorator annotation so we don't try to apply it again in subclass constructor
|
|
5288
|
-
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null
|
|
5360
|
+
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];
|
|
5289
5361
|
}
|
|
5290
5362
|
function assertAnnotable(adm, annotation, key) {
|
|
5291
5363
|
// Valid annotation
|
|
@@ -5365,8 +5437,7 @@
|
|
|
5365
5437
|
// Weex proto freeze protection was here,
|
|
5366
5438
|
// but it is unclear why the hack is need as MobX never changed the prototype
|
|
5367
5439
|
// anyway, so removed it in V6
|
|
5368
|
-
var LegacyObservableArray = /*#__PURE__*/function (_StubArray
|
|
5369
|
-
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5440
|
+
var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
5370
5441
|
function LegacyObservableArray(initialValues, enhancer, name, owned) {
|
|
5371
5442
|
var _this;
|
|
5372
5443
|
if (name === void 0) {
|
|
@@ -5378,8 +5449,8 @@
|
|
|
5378
5449
|
_this = _StubArray.call(this) || this;
|
|
5379
5450
|
initObservable(function () {
|
|
5380
5451
|
var adm = new ObservableArrayAdministration(name, enhancer, owned, true);
|
|
5381
|
-
adm.proxy_ =
|
|
5382
|
-
addHiddenFinalProp(
|
|
5452
|
+
adm.proxy_ = _this;
|
|
5453
|
+
addHiddenFinalProp(_this, $mobx, adm);
|
|
5383
5454
|
if (initialValues && initialValues.length) {
|
|
5384
5455
|
// @ts-ignore
|
|
5385
5456
|
_this.spliceWithArray(0, 0, initialValues);
|
|
@@ -5387,11 +5458,12 @@
|
|
|
5387
5458
|
if (safariPrototypeSetterInheritanceBug) {
|
|
5388
5459
|
// Seems that Safari won't use numeric prototype setter until any * numeric property is
|
|
5389
5460
|
// defined on the instance. After that it works fine, even if this property is deleted.
|
|
5390
|
-
Object.defineProperty(
|
|
5461
|
+
Object.defineProperty(_this, "0", ENTRY_0);
|
|
5391
5462
|
}
|
|
5392
5463
|
});
|
|
5393
5464
|
return _this;
|
|
5394
5465
|
}
|
|
5466
|
+
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5395
5467
|
var _proto = LegacyObservableArray.prototype;
|
|
5396
5468
|
_proto.concat = function concat() {
|
|
5397
5469
|
this[$mobx].atom_.reportObserved();
|
|
@@ -5404,7 +5476,7 @@
|
|
|
5404
5476
|
return isObservableArray(a) ? a.slice() : a;
|
|
5405
5477
|
}));
|
|
5406
5478
|
};
|
|
5407
|
-
_proto[
|
|
5479
|
+
_proto[Symbol.iterator] = function () {
|
|
5408
5480
|
var self = this;
|
|
5409
5481
|
var nextIndex = 0;
|
|
5410
5482
|
return makeIterable({
|
|
@@ -5419,7 +5491,7 @@
|
|
|
5419
5491
|
}
|
|
5420
5492
|
});
|
|
5421
5493
|
};
|
|
5422
|
-
_createClass(LegacyObservableArray, [{
|
|
5494
|
+
return _createClass(LegacyObservableArray, [{
|
|
5423
5495
|
key: "length",
|
|
5424
5496
|
get: function get() {
|
|
5425
5497
|
return this[$mobx].getArrayLength_();
|
|
@@ -5428,13 +5500,12 @@
|
|
|
5428
5500
|
this[$mobx].setArrayLength_(newLength);
|
|
5429
5501
|
}
|
|
5430
5502
|
}, {
|
|
5431
|
-
key:
|
|
5503
|
+
key: Symbol.toStringTag,
|
|
5432
5504
|
get: function get() {
|
|
5433
5505
|
return "Array";
|
|
5434
5506
|
}
|
|
5435
5507
|
}]);
|
|
5436
|
-
|
|
5437
|
-
}(StubArray, Symbol.toStringTag, Symbol.iterator);
|
|
5508
|
+
}(StubArray);
|
|
5438
5509
|
Object.entries(arrayExtensions).forEach(function (_ref) {
|
|
5439
5510
|
var prop = _ref[0],
|
|
5440
5511
|
fn = _ref[1];
|