mobx 6.12.5 → 6.13.1
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/core/atom.d.ts +10 -3
- package/dist/core/computedvalue.d.ts +3 -1
- package/dist/core/observable.d.ts +1 -1
- package/dist/core/reaction.d.ts +16 -6
- package/dist/mobx.cjs.development.js +350 -214
- 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 +350 -214
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +350 -214
- 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 +350 -214
- 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 +4 -2
- package/package.json +1 -1
- package/src/api/autorun.ts +4 -4
- package/src/api/when.ts +1 -1
- package/src/core/atom.ts +29 -3
- package/src/core/computedvalue.ts +19 -18
- package/src/core/derivation.ts +6 -6
- package/src/core/observable.ts +1 -1
- package/src/core/reaction.ts +59 -23
- package/src/types/observableset.ts +48 -0
- package/src/utils/utils.ts +13 -0
package/dist/mobx.esm.js
CHANGED
|
@@ -263,100 +263,88 @@ var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function get
|
|
|
263
263
|
});
|
|
264
264
|
return res;
|
|
265
265
|
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
for (var i = 0; i < props.length; i++) {
|
|
269
|
-
var descriptor = props[i];
|
|
270
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
271
|
-
descriptor.configurable = true;
|
|
272
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
273
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
277
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
278
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
279
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
280
|
-
writable: false
|
|
281
|
-
});
|
|
282
|
-
return Constructor;
|
|
283
|
-
}
|
|
284
|
-
function _extends() {
|
|
285
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
286
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
287
|
-
var source = arguments[i];
|
|
288
|
-
for (var key in source) {
|
|
289
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
290
|
-
target[key] = source[key];
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return target;
|
|
295
|
-
};
|
|
296
|
-
return _extends.apply(this, arguments);
|
|
266
|
+
function getFlag(flags, mask) {
|
|
267
|
+
return !!(flags & mask);
|
|
297
268
|
}
|
|
298
|
-
function
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
269
|
+
function setFlag(flags, mask, newValue) {
|
|
270
|
+
if (newValue) {
|
|
271
|
+
flags |= mask;
|
|
272
|
+
} else {
|
|
273
|
+
flags &= ~mask;
|
|
274
|
+
}
|
|
275
|
+
return flags;
|
|
302
276
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
if (
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
327
|
-
return arr2;
|
|
328
|
-
}
|
|
329
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
330
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
331
|
-
if (it) return (it = it.call(o)).next.bind(it);
|
|
332
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
333
|
-
if (it) o = it;
|
|
334
|
-
var i = 0;
|
|
277
|
+
|
|
278
|
+
function _arrayLikeToArray(r, a) {
|
|
279
|
+
(null == a || a > r.length) && (a = r.length);
|
|
280
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
281
|
+
return n;
|
|
282
|
+
}
|
|
283
|
+
function _defineProperties(e, r) {
|
|
284
|
+
for (var t = 0; t < r.length; t++) {
|
|
285
|
+
var o = r[t];
|
|
286
|
+
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function _createClass(e, r, t) {
|
|
290
|
+
return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
|
|
291
|
+
writable: !1
|
|
292
|
+
}), e;
|
|
293
|
+
}
|
|
294
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
295
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
296
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
297
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
298
|
+
t && (r = t);
|
|
299
|
+
var o = 0;
|
|
335
300
|
return function () {
|
|
336
|
-
|
|
337
|
-
done:
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
value: o[i++]
|
|
301
|
+
return o >= r.length ? {
|
|
302
|
+
done: !0
|
|
303
|
+
} : {
|
|
304
|
+
done: !1,
|
|
305
|
+
value: r[o++]
|
|
342
306
|
};
|
|
343
307
|
};
|
|
344
308
|
}
|
|
345
309
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
346
310
|
}
|
|
347
|
-
function
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
311
|
+
function _extends() {
|
|
312
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
313
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
314
|
+
var t = arguments[e];
|
|
315
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
316
|
+
}
|
|
317
|
+
return n;
|
|
318
|
+
}, _extends.apply(null, arguments);
|
|
319
|
+
}
|
|
320
|
+
function _inheritsLoose(t, o) {
|
|
321
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
322
|
+
}
|
|
323
|
+
function _setPrototypeOf(t, e) {
|
|
324
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
325
|
+
return t.__proto__ = e, t;
|
|
326
|
+
}, _setPrototypeOf(t, e);
|
|
327
|
+
}
|
|
328
|
+
function _toPrimitive(t, r) {
|
|
329
|
+
if ("object" != typeof t || !t) return t;
|
|
330
|
+
var e = t[Symbol.toPrimitive];
|
|
331
|
+
if (void 0 !== e) {
|
|
332
|
+
var i = e.call(t, r || "default");
|
|
333
|
+
if ("object" != typeof i) return i;
|
|
353
334
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
354
335
|
}
|
|
355
|
-
return (
|
|
336
|
+
return ("string" === r ? String : Number)(t);
|
|
356
337
|
}
|
|
357
|
-
function _toPropertyKey(
|
|
358
|
-
var
|
|
359
|
-
return
|
|
338
|
+
function _toPropertyKey(t) {
|
|
339
|
+
var i = _toPrimitive(t, "string");
|
|
340
|
+
return "symbol" == typeof i ? i : i + "";
|
|
341
|
+
}
|
|
342
|
+
function _unsupportedIterableToArray(r, a) {
|
|
343
|
+
if (r) {
|
|
344
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
345
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
346
|
+
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;
|
|
347
|
+
}
|
|
360
348
|
}
|
|
361
349
|
|
|
362
350
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
@@ -429,8 +417,6 @@ function assert20223DecoratorType(context, types) {
|
|
|
429
417
|
|
|
430
418
|
var $mobx = /*#__PURE__*/Symbol("mobx administration");
|
|
431
419
|
var Atom = /*#__PURE__*/function () {
|
|
432
|
-
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
433
|
-
|
|
434
420
|
/**
|
|
435
421
|
* Create a new atom. For debugging purposes it is recommended to give it a name.
|
|
436
422
|
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
@@ -440,17 +426,17 @@ var Atom = /*#__PURE__*/function () {
|
|
|
440
426
|
name_ = process.env.NODE_ENV !== "production" ? "Atom@" + getNextId() : "Atom";
|
|
441
427
|
}
|
|
442
428
|
this.name_ = void 0;
|
|
443
|
-
this.
|
|
444
|
-
this.isBeingObserved = false;
|
|
429
|
+
this.flags_ = 0;
|
|
445
430
|
this.observers_ = new Set();
|
|
446
|
-
this.diffValue_ = 0;
|
|
447
431
|
this.lastAccessedBy_ = 0;
|
|
448
432
|
this.lowestObserverState_ = IDerivationState_.NOT_TRACKING_;
|
|
433
|
+
// onBecomeObservedListeners
|
|
449
434
|
this.onBOL = void 0;
|
|
435
|
+
// onBecomeUnobservedListeners
|
|
450
436
|
this.onBUOL = void 0;
|
|
451
437
|
this.name_ = name_;
|
|
452
438
|
}
|
|
453
|
-
//
|
|
439
|
+
// for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed
|
|
454
440
|
var _proto = Atom.prototype;
|
|
455
441
|
_proto.onBO = function onBO() {
|
|
456
442
|
if (this.onBOL) {
|
|
@@ -484,8 +470,35 @@ var Atom = /*#__PURE__*/function () {
|
|
|
484
470
|
_proto.toString = function toString() {
|
|
485
471
|
return this.name_;
|
|
486
472
|
};
|
|
487
|
-
return Atom
|
|
473
|
+
return _createClass(Atom, [{
|
|
474
|
+
key: "isBeingObserved",
|
|
475
|
+
get: function get() {
|
|
476
|
+
return getFlag(this.flags_, Atom.isBeingObservedMask_);
|
|
477
|
+
},
|
|
478
|
+
set: function set(newValue) {
|
|
479
|
+
this.flags_ = setFlag(this.flags_, Atom.isBeingObservedMask_, newValue);
|
|
480
|
+
}
|
|
481
|
+
}, {
|
|
482
|
+
key: "isPendingUnobservation",
|
|
483
|
+
get: function get() {
|
|
484
|
+
return getFlag(this.flags_, Atom.isPendingUnobservationMask_);
|
|
485
|
+
},
|
|
486
|
+
set: function set(newValue) {
|
|
487
|
+
this.flags_ = setFlag(this.flags_, Atom.isPendingUnobservationMask_, newValue);
|
|
488
|
+
}
|
|
489
|
+
}, {
|
|
490
|
+
key: "diffValue",
|
|
491
|
+
get: function get() {
|
|
492
|
+
return getFlag(this.flags_, Atom.diffValueMask_) ? 1 : 0;
|
|
493
|
+
},
|
|
494
|
+
set: function set(newValue) {
|
|
495
|
+
this.flags_ = setFlag(this.flags_, Atom.diffValueMask_, newValue === 1 ? true : false);
|
|
496
|
+
}
|
|
497
|
+
}]);
|
|
488
498
|
}();
|
|
499
|
+
Atom.isBeingObservedMask_ = 1;
|
|
500
|
+
Atom.isPendingUnobservationMask_ = 2;
|
|
501
|
+
Atom.diffValueMask_ = 4;
|
|
489
502
|
var isAtom = /*#__PURE__*/createInstanceofPredicate("Atom", Atom);
|
|
490
503
|
function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) {
|
|
491
504
|
if (onBecomeObservedHandler === void 0) {
|
|
@@ -632,7 +645,6 @@ function make_(adm, key) {
|
|
|
632
645
|
}
|
|
633
646
|
return 0 /* MakeResult.Cancel */;
|
|
634
647
|
}
|
|
635
|
-
|
|
636
648
|
function extend_(adm, key, descriptor, proxyTrap) {
|
|
637
649
|
die("'" + this.annotationType_ + "' can only be used with 'makeObservable'");
|
|
638
650
|
}
|
|
@@ -665,12 +677,10 @@ function make_$1(adm, key, descriptor, source) {
|
|
|
665
677
|
// rest of the proto chain must be annotated already
|
|
666
678
|
return 1 /* MakeResult.Break */;
|
|
667
679
|
}
|
|
668
|
-
|
|
669
680
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor, false);
|
|
670
681
|
defineProperty(source, key, actionDescriptor);
|
|
671
682
|
return 2 /* MakeResult.Continue */;
|
|
672
683
|
}
|
|
673
|
-
|
|
674
684
|
function extend_$1(adm, key, descriptor, proxyTrap) {
|
|
675
685
|
var actionDescriptor = createActionDescriptor(adm, this, key, descriptor);
|
|
676
686
|
return adm.defineProperty_(key, actionDescriptor, proxyTrap);
|
|
@@ -768,18 +778,15 @@ function make_$2(adm, key, descriptor, source) {
|
|
|
768
778
|
return 0 /* MakeResult.Cancel */;
|
|
769
779
|
}
|
|
770
780
|
}
|
|
771
|
-
|
|
772
781
|
if (isFlow(descriptor.value)) {
|
|
773
782
|
// A prototype could have been annotated already by other constructor,
|
|
774
783
|
// rest of the proto chain must be annotated already
|
|
775
784
|
return 1 /* MakeResult.Break */;
|
|
776
785
|
}
|
|
777
|
-
|
|
778
786
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, false, false);
|
|
779
787
|
defineProperty(source, key, flowDescriptor);
|
|
780
788
|
return 2 /* MakeResult.Continue */;
|
|
781
789
|
}
|
|
782
|
-
|
|
783
790
|
function extend_$2(adm, key, descriptor, proxyTrap) {
|
|
784
791
|
var _this$options_2;
|
|
785
792
|
var flowDescriptor = createFlowDescriptor(adm, this, key, descriptor, (_this$options_2 = this.options_) == null ? void 0 : _this$options_2.bound);
|
|
@@ -856,7 +863,6 @@ function createComputedAnnotation(name, options) {
|
|
|
856
863
|
function make_$3(adm, key, descriptor) {
|
|
857
864
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
858
865
|
}
|
|
859
|
-
|
|
860
866
|
function extend_$3(adm, key, descriptor, proxyTrap) {
|
|
861
867
|
assertComputedDescriptor(adm, this, key, descriptor);
|
|
862
868
|
return adm.defineComputedProperty_(key, _extends({}, this.options_, {
|
|
@@ -904,7 +910,6 @@ function createObservableAnnotation(name, options) {
|
|
|
904
910
|
function make_$4(adm, key, descriptor) {
|
|
905
911
|
return this.extend_(adm, key, descriptor, false) === null ? 0 /* MakeResult.Cancel */ : 1 /* MakeResult.Break */;
|
|
906
912
|
}
|
|
907
|
-
|
|
908
913
|
function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
909
914
|
var _this$options_$enhanc, _this$options_;
|
|
910
915
|
assertObservableDescriptor(adm, this, key, descriptor);
|
|
@@ -1324,11 +1329,8 @@ function allowStateChangesEnd(prev) {
|
|
|
1324
1329
|
globalState.allowStateChanges = prev;
|
|
1325
1330
|
}
|
|
1326
1331
|
|
|
1327
|
-
var _Symbol$toPrimitive;
|
|
1328
1332
|
var CREATE = "create";
|
|
1329
|
-
_Symbol$toPrimitive = Symbol.toPrimitive;
|
|
1330
1333
|
var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
1331
|
-
_inheritsLoose(ObservableValue, _Atom);
|
|
1332
1334
|
function ObservableValue(value, enhancer, name_, notifySpy, equals) {
|
|
1333
1335
|
var _this;
|
|
1334
1336
|
if (name_ === void 0) {
|
|
@@ -1357,7 +1359,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1357
1359
|
// only notify spy if this is a stand-alone observable
|
|
1358
1360
|
spyReport({
|
|
1359
1361
|
type: CREATE,
|
|
1360
|
-
object:
|
|
1362
|
+
object: _this,
|
|
1361
1363
|
observableKind: "value",
|
|
1362
1364
|
debugObjectName: _this.name_,
|
|
1363
1365
|
newValue: "" + _this.value_
|
|
@@ -1365,6 +1367,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1365
1367
|
}
|
|
1366
1368
|
return _this;
|
|
1367
1369
|
}
|
|
1370
|
+
_inheritsLoose(ObservableValue, _Atom);
|
|
1368
1371
|
var _proto = ObservableValue.prototype;
|
|
1369
1372
|
_proto.dehanceValue = function dehanceValue(value) {
|
|
1370
1373
|
if (this.dehancer !== undefined) {
|
|
@@ -1456,25 +1459,13 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1456
1459
|
_proto.valueOf = function valueOf() {
|
|
1457
1460
|
return toPrimitive(this.get());
|
|
1458
1461
|
};
|
|
1459
|
-
_proto[
|
|
1462
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1460
1463
|
return this.valueOf();
|
|
1461
1464
|
};
|
|
1462
1465
|
return ObservableValue;
|
|
1463
1466
|
}(Atom);
|
|
1464
1467
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1465
1468
|
|
|
1466
|
-
var _Symbol$toPrimitive$1;
|
|
1467
|
-
function getFlag(flags, mask) {
|
|
1468
|
-
return !!(flags & mask);
|
|
1469
|
-
}
|
|
1470
|
-
function setFlag(flags, mask, newValue) {
|
|
1471
|
-
if (newValue) {
|
|
1472
|
-
flags |= mask;
|
|
1473
|
-
} else {
|
|
1474
|
-
flags &= ~mask;
|
|
1475
|
-
}
|
|
1476
|
-
return flags;
|
|
1477
|
-
}
|
|
1478
1469
|
/**
|
|
1479
1470
|
* A node in the state dependency root that observes other nodes, and can be observed itself.
|
|
1480
1471
|
*
|
|
@@ -1494,13 +1485,7 @@ function setFlag(flags, mask, newValue) {
|
|
|
1494
1485
|
*
|
|
1495
1486
|
* If at any point it's outside batch and it isn't observed: reset everything and go to 1.
|
|
1496
1487
|
*/
|
|
1497
|
-
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1498
1488
|
var ComputedValue = /*#__PURE__*/function () {
|
|
1499
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
1500
|
-
// during tracking it's an array with new observed observers
|
|
1501
|
-
|
|
1502
|
-
// N.B: unminified as it is used by MST
|
|
1503
|
-
|
|
1504
1489
|
/**
|
|
1505
1490
|
* Create a new computed value based on a function expression.
|
|
1506
1491
|
*
|
|
@@ -1516,9 +1501,10 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1516
1501
|
function ComputedValue(options) {
|
|
1517
1502
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
1518
1503
|
this.observing_ = [];
|
|
1504
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
1519
1505
|
this.newObserving_ = null;
|
|
1506
|
+
// during tracking it's an array with new observed observers
|
|
1520
1507
|
this.observers_ = new Set();
|
|
1521
|
-
this.diffValue_ = 0;
|
|
1522
1508
|
this.runId_ = 0;
|
|
1523
1509
|
this.lastAccessedBy_ = 0;
|
|
1524
1510
|
this.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;
|
|
@@ -1528,6 +1514,7 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1528
1514
|
this.triggeredBy_ = void 0;
|
|
1529
1515
|
this.flags_ = 0;
|
|
1530
1516
|
this.derivation = void 0;
|
|
1517
|
+
// N.B: unminified as it is used by MST
|
|
1531
1518
|
this.setter_ = void 0;
|
|
1532
1519
|
this.isTracing_ = TraceMode.NONE;
|
|
1533
1520
|
this.scope_ = void 0;
|
|
@@ -1712,10 +1699,10 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1712
1699
|
_proto.valueOf = function valueOf() {
|
|
1713
1700
|
return toPrimitive(this.get());
|
|
1714
1701
|
};
|
|
1715
|
-
_proto[
|
|
1702
|
+
_proto[Symbol.toPrimitive] = function () {
|
|
1716
1703
|
return this.valueOf();
|
|
1717
1704
|
};
|
|
1718
|
-
_createClass(ComputedValue, [{
|
|
1705
|
+
return _createClass(ComputedValue, [{
|
|
1719
1706
|
key: "isComputing",
|
|
1720
1707
|
get: function get() {
|
|
1721
1708
|
return getFlag(this.flags_, ComputedValue.isComputingMask_);
|
|
@@ -1747,13 +1734,21 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1747
1734
|
set: function set(newValue) {
|
|
1748
1735
|
this.flags_ = setFlag(this.flags_, ComputedValue.isPendingUnobservationMask_, newValue);
|
|
1749
1736
|
}
|
|
1737
|
+
}, {
|
|
1738
|
+
key: "diffValue",
|
|
1739
|
+
get: function get() {
|
|
1740
|
+
return getFlag(this.flags_, ComputedValue.diffValueMask_) ? 1 : 0;
|
|
1741
|
+
},
|
|
1742
|
+
set: function set(newValue) {
|
|
1743
|
+
this.flags_ = setFlag(this.flags_, ComputedValue.diffValueMask_, newValue === 1 ? true : false);
|
|
1744
|
+
}
|
|
1750
1745
|
}]);
|
|
1751
|
-
return ComputedValue;
|
|
1752
1746
|
}();
|
|
1753
1747
|
ComputedValue.isComputingMask_ = 1;
|
|
1754
1748
|
ComputedValue.isRunningSetterMask_ = 2;
|
|
1755
1749
|
ComputedValue.isBeingObservedMask_ = 4;
|
|
1756
1750
|
ComputedValue.isPendingUnobservationMask_ = 8;
|
|
1751
|
+
ComputedValue.diffValueMask_ = 16;
|
|
1757
1752
|
var isComputedValue = /*#__PURE__*/createInstanceofPredicate("ComputedValue", ComputedValue);
|
|
1758
1753
|
|
|
1759
1754
|
var IDerivationState_;
|
|
@@ -1787,7 +1782,6 @@ var CaughtException = function CaughtException(cause) {
|
|
|
1787
1782
|
this.cause = cause;
|
|
1788
1783
|
// Empty
|
|
1789
1784
|
};
|
|
1790
|
-
|
|
1791
1785
|
function isCaughtException(e) {
|
|
1792
1786
|
return e instanceof CaughtException;
|
|
1793
1787
|
}
|
|
@@ -1851,7 +1845,6 @@ function shouldCompute(derivation) {
|
|
|
1851
1845
|
function isComputingDerivation() {
|
|
1852
1846
|
return globalState.trackingDerivation !== null; // filter out actions inside computations
|
|
1853
1847
|
}
|
|
1854
|
-
|
|
1855
1848
|
function checkIfStateModificationsAreAllowed(atom) {
|
|
1856
1849
|
if (!(process.env.NODE_ENV !== "production")) {
|
|
1857
1850
|
return;
|
|
@@ -1930,8 +1923,8 @@ function bindDependencies(derivation) {
|
|
|
1930
1923
|
l = derivation.unboundDepsCount_;
|
|
1931
1924
|
for (var i = 0; i < l; i++) {
|
|
1932
1925
|
var dep = observing[i];
|
|
1933
|
-
if (dep.
|
|
1934
|
-
dep.
|
|
1926
|
+
if (dep.diffValue === 0) {
|
|
1927
|
+
dep.diffValue = 1;
|
|
1935
1928
|
if (i0 !== i) {
|
|
1936
1929
|
observing[i0] = dep;
|
|
1937
1930
|
}
|
|
@@ -1951,18 +1944,18 @@ function bindDependencies(derivation) {
|
|
|
1951
1944
|
l = prevObserving.length;
|
|
1952
1945
|
while (l--) {
|
|
1953
1946
|
var _dep = prevObserving[l];
|
|
1954
|
-
if (_dep.
|
|
1947
|
+
if (_dep.diffValue === 0) {
|
|
1955
1948
|
removeObserver(_dep, derivation);
|
|
1956
1949
|
}
|
|
1957
|
-
_dep.
|
|
1950
|
+
_dep.diffValue = 0;
|
|
1958
1951
|
}
|
|
1959
1952
|
// Go through all new observables and check diffValue: (now it should be unique)
|
|
1960
1953
|
// 0: it was set to 0 in last loop. don't need to do anything.
|
|
1961
1954
|
// 1: it wasn't observed, let's observe it. set back to 0
|
|
1962
1955
|
while (i0--) {
|
|
1963
1956
|
var _dep2 = observing[i0];
|
|
1964
|
-
if (_dep2.
|
|
1965
|
-
_dep2.
|
|
1957
|
+
if (_dep2.diffValue === 1) {
|
|
1958
|
+
_dep2.diffValue = 0;
|
|
1966
1959
|
addObserver(_dep2, derivation);
|
|
1967
1960
|
}
|
|
1968
1961
|
}
|
|
@@ -2028,28 +2021,113 @@ function changeDependenciesStateTo0(derivation) {
|
|
|
2028
2021
|
*/
|
|
2029
2022
|
var persistentKeys = ["mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED", "useProxies"];
|
|
2030
2023
|
var MobXGlobals = function MobXGlobals() {
|
|
2024
|
+
/**
|
|
2025
|
+
* MobXGlobals version.
|
|
2026
|
+
* MobX compatiblity with other versions loaded in memory as long as this version matches.
|
|
2027
|
+
* It indicates that the global state still stores similar information
|
|
2028
|
+
*
|
|
2029
|
+
* N.B: this version is unrelated to the package version of MobX, and is only the version of the
|
|
2030
|
+
* internal state storage of MobX, and can be the same across many different package versions
|
|
2031
|
+
*/
|
|
2031
2032
|
this.version = 6;
|
|
2033
|
+
/**
|
|
2034
|
+
* globally unique token to signal unchanged
|
|
2035
|
+
*/
|
|
2032
2036
|
this.UNCHANGED = {};
|
|
2037
|
+
/**
|
|
2038
|
+
* Currently running derivation
|
|
2039
|
+
*/
|
|
2033
2040
|
this.trackingDerivation = null;
|
|
2041
|
+
/**
|
|
2042
|
+
* Currently running reaction. This determines if we currently have a reactive context.
|
|
2043
|
+
* (Tracking derivation is also set for temporal tracking of computed values inside actions,
|
|
2044
|
+
* but trackingReaction can only be set by a form of Reaction)
|
|
2045
|
+
*/
|
|
2034
2046
|
this.trackingContext = null;
|
|
2047
|
+
/**
|
|
2048
|
+
* Each time a derivation is tracked, it is assigned a unique run-id
|
|
2049
|
+
*/
|
|
2035
2050
|
this.runId = 0;
|
|
2051
|
+
/**
|
|
2052
|
+
* 'guid' for general purpose. Will be persisted amongst resets.
|
|
2053
|
+
*/
|
|
2036
2054
|
this.mobxGuid = 0;
|
|
2055
|
+
/**
|
|
2056
|
+
* Are we in a batch block? (and how many of them)
|
|
2057
|
+
*/
|
|
2037
2058
|
this.inBatch = 0;
|
|
2059
|
+
/**
|
|
2060
|
+
* Observables that don't have observers anymore, and are about to be
|
|
2061
|
+
* suspended, unless somebody else accesses it in the same batch
|
|
2062
|
+
*
|
|
2063
|
+
* @type {IObservable[]}
|
|
2064
|
+
*/
|
|
2038
2065
|
this.pendingUnobservations = [];
|
|
2066
|
+
/**
|
|
2067
|
+
* List of scheduled, not yet executed, reactions.
|
|
2068
|
+
*/
|
|
2039
2069
|
this.pendingReactions = [];
|
|
2070
|
+
/**
|
|
2071
|
+
* Are we currently processing reactions?
|
|
2072
|
+
*/
|
|
2040
2073
|
this.isRunningReactions = false;
|
|
2074
|
+
/**
|
|
2075
|
+
* Is it allowed to change observables at this point?
|
|
2076
|
+
* In general, MobX doesn't allow that when running computations and React.render.
|
|
2077
|
+
* To ensure that those functions stay pure.
|
|
2078
|
+
*/
|
|
2041
2079
|
this.allowStateChanges = false;
|
|
2080
|
+
/**
|
|
2081
|
+
* Is it allowed to read observables at this point?
|
|
2082
|
+
* Used to hold the state needed for `observableRequiresReaction`
|
|
2083
|
+
*/
|
|
2042
2084
|
this.allowStateReads = true;
|
|
2085
|
+
/**
|
|
2086
|
+
* If strict mode is enabled, state changes are by default not allowed
|
|
2087
|
+
*/
|
|
2043
2088
|
this.enforceActions = true;
|
|
2089
|
+
/**
|
|
2090
|
+
* Spy callbacks
|
|
2091
|
+
*/
|
|
2044
2092
|
this.spyListeners = [];
|
|
2093
|
+
/**
|
|
2094
|
+
* Globally attached error handlers that react specifically to errors in reactions
|
|
2095
|
+
*/
|
|
2045
2096
|
this.globalReactionErrorHandlers = [];
|
|
2097
|
+
/**
|
|
2098
|
+
* Warn if computed values are accessed outside a reactive context
|
|
2099
|
+
*/
|
|
2046
2100
|
this.computedRequiresReaction = false;
|
|
2101
|
+
/**
|
|
2102
|
+
* (Experimental)
|
|
2103
|
+
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
2104
|
+
*/
|
|
2047
2105
|
this.reactionRequiresObservable = false;
|
|
2106
|
+
/**
|
|
2107
|
+
* (Experimental)
|
|
2108
|
+
* Warn if observables are accessed outside a reactive context
|
|
2109
|
+
*/
|
|
2048
2110
|
this.observableRequiresReaction = false;
|
|
2111
|
+
/*
|
|
2112
|
+
* Don't catch and rethrow exceptions. This is useful for inspecting the state of
|
|
2113
|
+
* the stack when an exception occurs while debugging.
|
|
2114
|
+
*/
|
|
2049
2115
|
this.disableErrorBoundaries = false;
|
|
2116
|
+
/*
|
|
2117
|
+
* If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as
|
|
2118
|
+
* they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836
|
|
2119
|
+
*/
|
|
2050
2120
|
this.suppressReactionErrors = false;
|
|
2051
2121
|
this.useProxies = true;
|
|
2122
|
+
/*
|
|
2123
|
+
* print warnings about code that would fail if proxies weren't available
|
|
2124
|
+
*/
|
|
2052
2125
|
this.verifyProxies = false;
|
|
2126
|
+
/**
|
|
2127
|
+
* False forces all object's descriptors to
|
|
2128
|
+
* writable: true
|
|
2129
|
+
* configurable: true
|
|
2130
|
+
*/
|
|
2053
2131
|
this.safeDescriptors = true;
|
|
2054
2132
|
};
|
|
2055
2133
|
var canMergeGlobalState = true;
|
|
@@ -2146,7 +2224,6 @@ function addObserver(observable, node) {
|
|
|
2146
2224
|
// invariantObservers(observable);
|
|
2147
2225
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
|
|
2148
2226
|
}
|
|
2149
|
-
|
|
2150
2227
|
function removeObserver(observable, node) {
|
|
2151
2228
|
// invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
|
|
2152
2229
|
// invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node");
|
|
@@ -2159,7 +2236,6 @@ function removeObserver(observable, node) {
|
|
|
2159
2236
|
// invariantObservers(observable);
|
|
2160
2237
|
// invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2");
|
|
2161
2238
|
}
|
|
2162
|
-
|
|
2163
2239
|
function queueForUnobservation(observable) {
|
|
2164
2240
|
if (observable.isPendingUnobservation === false) {
|
|
2165
2241
|
// invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables");
|
|
@@ -2297,7 +2373,6 @@ function propagateMaybeChanged(observable) {
|
|
|
2297
2373
|
});
|
|
2298
2374
|
// invariantLOS(observable, "maybe end");
|
|
2299
2375
|
}
|
|
2300
|
-
|
|
2301
2376
|
function logTraceInfo(derivation, observable) {
|
|
2302
2377
|
console.log("[mobx.trace] '" + derivation.name_ + "' is invalidated due to a change in: '" + observable.name_ + "'");
|
|
2303
2378
|
if (derivation.isTracing_ === TraceMode.BREAK) {
|
|
@@ -2321,8 +2396,6 @@ function printDepTree(tree, lines, depth) {
|
|
|
2321
2396
|
}
|
|
2322
2397
|
|
|
2323
2398
|
var Reaction = /*#__PURE__*/function () {
|
|
2324
|
-
// nodes we are looking at. Our value depends on these nodes
|
|
2325
|
-
|
|
2326
2399
|
function Reaction(name_, onInvalidate_, errorHandler_, requiresObservable_) {
|
|
2327
2400
|
if (name_ === void 0) {
|
|
2328
2401
|
name_ = process.env.NODE_ENV !== "production" ? "Reaction@" + getNextId() : "Reaction";
|
|
@@ -2332,15 +2405,12 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2332
2405
|
this.errorHandler_ = void 0;
|
|
2333
2406
|
this.requiresObservable_ = void 0;
|
|
2334
2407
|
this.observing_ = [];
|
|
2408
|
+
// nodes we are looking at. Our value depends on these nodes
|
|
2335
2409
|
this.newObserving_ = [];
|
|
2336
2410
|
this.dependenciesState_ = IDerivationState_.NOT_TRACKING_;
|
|
2337
|
-
this.diffValue_ = 0;
|
|
2338
2411
|
this.runId_ = 0;
|
|
2339
2412
|
this.unboundDepsCount_ = 0;
|
|
2340
|
-
this.
|
|
2341
|
-
this.isScheduled_ = false;
|
|
2342
|
-
this.isTrackPending_ = false;
|
|
2343
|
-
this.isRunning_ = false;
|
|
2413
|
+
this.flags_ = 0;
|
|
2344
2414
|
this.isTracing_ = TraceMode.NONE;
|
|
2345
2415
|
this.name_ = name_;
|
|
2346
2416
|
this.onInvalidate_ = onInvalidate_;
|
|
@@ -2352,29 +2422,26 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2352
2422
|
this.schedule_();
|
|
2353
2423
|
};
|
|
2354
2424
|
_proto.schedule_ = function schedule_() {
|
|
2355
|
-
if (!this.
|
|
2356
|
-
this.
|
|
2425
|
+
if (!this.isScheduled) {
|
|
2426
|
+
this.isScheduled = true;
|
|
2357
2427
|
globalState.pendingReactions.push(this);
|
|
2358
2428
|
runReactions();
|
|
2359
2429
|
}
|
|
2360
|
-
};
|
|
2361
|
-
_proto.isScheduled = function isScheduled() {
|
|
2362
|
-
return this.isScheduled_;
|
|
2363
2430
|
}
|
|
2364
2431
|
/**
|
|
2365
2432
|
* internal, use schedule() if you intend to kick off a reaction
|
|
2366
2433
|
*/;
|
|
2367
2434
|
_proto.runReaction_ = function runReaction_() {
|
|
2368
|
-
if (!this.
|
|
2435
|
+
if (!this.isDisposed) {
|
|
2369
2436
|
startBatch();
|
|
2370
|
-
this.
|
|
2437
|
+
this.isScheduled = false;
|
|
2371
2438
|
var prev = globalState.trackingContext;
|
|
2372
2439
|
globalState.trackingContext = this;
|
|
2373
2440
|
if (shouldCompute(this)) {
|
|
2374
|
-
this.
|
|
2441
|
+
this.isTrackPending = true;
|
|
2375
2442
|
try {
|
|
2376
2443
|
this.onInvalidate_();
|
|
2377
|
-
if (process.env.NODE_ENV !== "production" && this.
|
|
2444
|
+
if (process.env.NODE_ENV !== "production" && this.isTrackPending && isSpyEnabled()) {
|
|
2378
2445
|
// onInvalidate didn't trigger track right away..
|
|
2379
2446
|
spyReport({
|
|
2380
2447
|
name: this.name_,
|
|
@@ -2390,11 +2457,10 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2390
2457
|
}
|
|
2391
2458
|
};
|
|
2392
2459
|
_proto.track = function track(fn) {
|
|
2393
|
-
if (this.
|
|
2460
|
+
if (this.isDisposed) {
|
|
2394
2461
|
return;
|
|
2395
2462
|
// console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either
|
|
2396
2463
|
}
|
|
2397
|
-
|
|
2398
2464
|
startBatch();
|
|
2399
2465
|
var notify = isSpyEnabled();
|
|
2400
2466
|
var startTime;
|
|
@@ -2405,14 +2471,14 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2405
2471
|
type: "reaction"
|
|
2406
2472
|
});
|
|
2407
2473
|
}
|
|
2408
|
-
this.
|
|
2474
|
+
this.isRunning = true;
|
|
2409
2475
|
var prevReaction = globalState.trackingContext; // reactions could create reactions...
|
|
2410
2476
|
globalState.trackingContext = this;
|
|
2411
2477
|
var result = trackDerivedFunction(this, fn, undefined);
|
|
2412
2478
|
globalState.trackingContext = prevReaction;
|
|
2413
|
-
this.
|
|
2414
|
-
this.
|
|
2415
|
-
if (this.
|
|
2479
|
+
this.isRunning = false;
|
|
2480
|
+
this.isTrackPending = false;
|
|
2481
|
+
if (this.isDisposed) {
|
|
2416
2482
|
// disposed during last run. Clean up everything that was bound after the dispose call.
|
|
2417
2483
|
clearObserving(this);
|
|
2418
2484
|
}
|
|
@@ -2455,9 +2521,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2455
2521
|
});
|
|
2456
2522
|
};
|
|
2457
2523
|
_proto.dispose = function dispose() {
|
|
2458
|
-
if (!this.
|
|
2459
|
-
this.
|
|
2460
|
-
if (!this.
|
|
2524
|
+
if (!this.isDisposed) {
|
|
2525
|
+
this.isDisposed = true;
|
|
2526
|
+
if (!this.isRunning) {
|
|
2461
2527
|
// if disposed while running, clean up later. Maybe not optimal, but rare case
|
|
2462
2528
|
startBatch();
|
|
2463
2529
|
clearObserving(this);
|
|
@@ -2469,9 +2535,9 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2469
2535
|
var _this2 = this;
|
|
2470
2536
|
var dispose = function dispose() {
|
|
2471
2537
|
_this2.dispose();
|
|
2472
|
-
abortSignal == null
|
|
2538
|
+
abortSignal == null || abortSignal.removeEventListener == null || abortSignal.removeEventListener("abort", dispose);
|
|
2473
2539
|
};
|
|
2474
|
-
abortSignal == null
|
|
2540
|
+
abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
|
|
2475
2541
|
dispose[$mobx] = this;
|
|
2476
2542
|
return dispose;
|
|
2477
2543
|
};
|
|
@@ -2484,8 +2550,53 @@ var Reaction = /*#__PURE__*/function () {
|
|
|
2484
2550
|
}
|
|
2485
2551
|
trace(this, enterBreakPoint);
|
|
2486
2552
|
};
|
|
2487
|
-
return Reaction
|
|
2553
|
+
return _createClass(Reaction, [{
|
|
2554
|
+
key: "isDisposed",
|
|
2555
|
+
get: function get() {
|
|
2556
|
+
return getFlag(this.flags_, Reaction.isDisposedMask_);
|
|
2557
|
+
},
|
|
2558
|
+
set: function set(newValue) {
|
|
2559
|
+
this.flags_ = setFlag(this.flags_, Reaction.isDisposedMask_, newValue);
|
|
2560
|
+
}
|
|
2561
|
+
}, {
|
|
2562
|
+
key: "isScheduled",
|
|
2563
|
+
get: function get() {
|
|
2564
|
+
return getFlag(this.flags_, Reaction.isScheduledMask_);
|
|
2565
|
+
},
|
|
2566
|
+
set: function set(newValue) {
|
|
2567
|
+
this.flags_ = setFlag(this.flags_, Reaction.isScheduledMask_, newValue);
|
|
2568
|
+
}
|
|
2569
|
+
}, {
|
|
2570
|
+
key: "isTrackPending",
|
|
2571
|
+
get: function get() {
|
|
2572
|
+
return getFlag(this.flags_, Reaction.isTrackPendingMask_);
|
|
2573
|
+
},
|
|
2574
|
+
set: function set(newValue) {
|
|
2575
|
+
this.flags_ = setFlag(this.flags_, Reaction.isTrackPendingMask_, newValue);
|
|
2576
|
+
}
|
|
2577
|
+
}, {
|
|
2578
|
+
key: "isRunning",
|
|
2579
|
+
get: function get() {
|
|
2580
|
+
return getFlag(this.flags_, Reaction.isRunningMask_);
|
|
2581
|
+
},
|
|
2582
|
+
set: function set(newValue) {
|
|
2583
|
+
this.flags_ = setFlag(this.flags_, Reaction.isRunningMask_, newValue);
|
|
2584
|
+
}
|
|
2585
|
+
}, {
|
|
2586
|
+
key: "diffValue",
|
|
2587
|
+
get: function get() {
|
|
2588
|
+
return getFlag(this.flags_, Reaction.diffValueMask_) ? 1 : 0;
|
|
2589
|
+
},
|
|
2590
|
+
set: function set(newValue) {
|
|
2591
|
+
this.flags_ = setFlag(this.flags_, Reaction.diffValueMask_, newValue === 1 ? true : false);
|
|
2592
|
+
}
|
|
2593
|
+
}]);
|
|
2488
2594
|
}();
|
|
2595
|
+
Reaction.isDisposedMask_ = 1;
|
|
2596
|
+
Reaction.isScheduledMask_ = 2;
|
|
2597
|
+
Reaction.isTrackPendingMask_ = 4;
|
|
2598
|
+
Reaction.isRunningMask_ = 8;
|
|
2599
|
+
Reaction.diffValueMask_ = 16;
|
|
2489
2600
|
function onReactionError(handler) {
|
|
2490
2601
|
globalState.globalReactionErrorHandlers.push(handler);
|
|
2491
2602
|
return function () {
|
|
@@ -2523,7 +2634,6 @@ function runReactionsHelper() {
|
|
|
2523
2634
|
console.error(process.env.NODE_ENV !== "production" ? "Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + (" Probably there is a cycle in the reactive function: " + allReactions[0]) : "[mobx] cycle in reaction: " + allReactions[0]);
|
|
2524
2635
|
allReactions.splice(0); // clear reactions
|
|
2525
2636
|
}
|
|
2526
|
-
|
|
2527
2637
|
var remainingReactions = allReactions.splice(0);
|
|
2528
2638
|
for (var i = 0, l = remainingReactions.length; i < l; i++) {
|
|
2529
2639
|
remainingReactions[i].runReaction_();
|
|
@@ -2663,7 +2773,7 @@ function isAction(thing) {
|
|
|
2663
2773
|
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
2664
2774
|
*/
|
|
2665
2775
|
function autorun(view, opts) {
|
|
2666
|
-
var _opts$name, _opts, _opts2,
|
|
2776
|
+
var _opts$name, _opts, _opts2, _opts3;
|
|
2667
2777
|
if (opts === void 0) {
|
|
2668
2778
|
opts = EMPTY_OBJECT;
|
|
2669
2779
|
}
|
|
@@ -2692,7 +2802,7 @@ function autorun(view, opts) {
|
|
|
2692
2802
|
isScheduled = true;
|
|
2693
2803
|
scheduler(function () {
|
|
2694
2804
|
isScheduled = false;
|
|
2695
|
-
if (!reaction.
|
|
2805
|
+
if (!reaction.isDisposed) {
|
|
2696
2806
|
reaction.track(reactionRunner);
|
|
2697
2807
|
}
|
|
2698
2808
|
});
|
|
@@ -2702,7 +2812,7 @@ function autorun(view, opts) {
|
|
|
2702
2812
|
function reactionRunner() {
|
|
2703
2813
|
view(reaction);
|
|
2704
2814
|
}
|
|
2705
|
-
if (!((_opts2 = opts) != null && (_opts2
|
|
2815
|
+
if (!((_opts2 = opts) != null && (_opts2 = _opts2.signal) != null && _opts2.aborted)) {
|
|
2706
2816
|
reaction.schedule_();
|
|
2707
2817
|
}
|
|
2708
2818
|
return reaction.getDisposer_((_opts3 = opts) == null ? void 0 : _opts3.signal);
|
|
@@ -2716,7 +2826,7 @@ function createSchedulerFromOptions(opts) {
|
|
|
2716
2826
|
} : run;
|
|
2717
2827
|
}
|
|
2718
2828
|
function reaction(expression, effect, opts) {
|
|
2719
|
-
var _opts$name2, _opts4,
|
|
2829
|
+
var _opts$name2, _opts4, _opts5;
|
|
2720
2830
|
if (opts === void 0) {
|
|
2721
2831
|
opts = EMPTY_OBJECT;
|
|
2722
2832
|
}
|
|
@@ -2746,7 +2856,7 @@ function reaction(expression, effect, opts) {
|
|
|
2746
2856
|
}, opts.onError, opts.requiresObservable);
|
|
2747
2857
|
function reactionRunner() {
|
|
2748
2858
|
isScheduled = false;
|
|
2749
|
-
if (r.
|
|
2859
|
+
if (r.isDisposed) {
|
|
2750
2860
|
return;
|
|
2751
2861
|
}
|
|
2752
2862
|
var changed = false;
|
|
@@ -2765,7 +2875,7 @@ function reaction(expression, effect, opts) {
|
|
|
2765
2875
|
}
|
|
2766
2876
|
firstTime = false;
|
|
2767
2877
|
}
|
|
2768
|
-
if (!((_opts4 = opts) != null && (_opts4
|
|
2878
|
+
if (!((_opts4 = opts) != null && (_opts4 = _opts4.signal) != null && _opts4.aborted)) {
|
|
2769
2879
|
r.schedule_();
|
|
2770
2880
|
}
|
|
2771
2881
|
return r.getDisposer_((_opts5 = opts) == null ? void 0 : _opts5.signal);
|
|
@@ -2974,7 +3084,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2974
3084
|
}
|
|
2975
3085
|
onFulfilled(undefined); // kick off the process
|
|
2976
3086
|
});
|
|
2977
|
-
|
|
2978
3087
|
promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
|
|
2979
3088
|
try {
|
|
2980
3089
|
if (pendingPromise) {
|
|
@@ -2992,7 +3101,6 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
|
|
|
2992
3101
|
rejector(e); // there could be a throwing finally block
|
|
2993
3102
|
}
|
|
2994
3103
|
});
|
|
2995
|
-
|
|
2996
3104
|
return promise;
|
|
2997
3105
|
};
|
|
2998
3106
|
res.isMobXFlow = true;
|
|
@@ -3007,7 +3115,6 @@ function cancelPromise(promise) {
|
|
|
3007
3115
|
function flowResult(result) {
|
|
3008
3116
|
return result; // just tricking TypeScript :)
|
|
3009
3117
|
}
|
|
3010
|
-
|
|
3011
3118
|
function isFlow(fn) {
|
|
3012
3119
|
return (fn == null ? void 0 : fn.isMobXFlow) === true;
|
|
3013
3120
|
}
|
|
@@ -3379,7 +3486,7 @@ function _when(predicate, effect, opts) {
|
|
|
3379
3486
|
if (typeof opts.timeout === "number") {
|
|
3380
3487
|
var error = new Error("WHEN_TIMEOUT");
|
|
3381
3488
|
timeoutHandle = setTimeout(function () {
|
|
3382
|
-
if (!disposer[$mobx].
|
|
3489
|
+
if (!disposer[$mobx].isDisposed) {
|
|
3383
3490
|
disposer();
|
|
3384
3491
|
if (opts.onError) {
|
|
3385
3492
|
opts.onError(error);
|
|
@@ -3432,10 +3539,10 @@ function whenPromise(predicate, opts) {
|
|
|
3432
3539
|
disposer();
|
|
3433
3540
|
reject(new Error("WHEN_ABORTED"));
|
|
3434
3541
|
};
|
|
3435
|
-
opts == null
|
|
3542
|
+
opts == null || (_opts$signal2 = opts.signal) == null || _opts$signal2.addEventListener == null || _opts$signal2.addEventListener("abort", abort);
|
|
3436
3543
|
})["finally"](function () {
|
|
3437
3544
|
var _opts$signal3;
|
|
3438
|
-
return opts == null
|
|
3545
|
+
return opts == null || (_opts$signal3 = opts.signal) == null || _opts$signal3.removeEventListener == null ? void 0 : _opts$signal3.removeEventListener("abort", abort);
|
|
3439
3546
|
});
|
|
3440
3547
|
res.cancel = cancel;
|
|
3441
3548
|
return res;
|
|
@@ -3652,8 +3759,6 @@ var arrayTraps = {
|
|
|
3652
3759
|
}
|
|
3653
3760
|
};
|
|
3654
3761
|
var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
3655
|
-
// this is the prop that gets proxied, so can't replace it!
|
|
3656
|
-
|
|
3657
3762
|
function ObservableArrayAdministration(name, enhancer, owned_, legacyMode_) {
|
|
3658
3763
|
if (name === void 0) {
|
|
3659
3764
|
name = process.env.NODE_ENV !== "production" ? "ObservableArray@" + getNextId() : "ObservableArray";
|
|
@@ -3662,6 +3767,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3662
3767
|
this.legacyMode_ = void 0;
|
|
3663
3768
|
this.atom_ = void 0;
|
|
3664
3769
|
this.values_ = [];
|
|
3770
|
+
// this is the prop that gets proxied, so can't replace it!
|
|
3665
3771
|
this.interceptors_ = void 0;
|
|
3666
3772
|
this.changeListeners_ = void 0;
|
|
3667
3773
|
this.enhancer_ = void 0;
|
|
@@ -3782,7 +3888,6 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3782
3888
|
var lengthDelta = newItems.length - deleteCount;
|
|
3783
3889
|
this.updateArrayLength_(length, lengthDelta); // checks if internal array wasn't modified
|
|
3784
3890
|
}
|
|
3785
|
-
|
|
3786
3891
|
var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
|
|
3787
3892
|
if (deleteCount !== 0 || newItems.length !== 0) {
|
|
3788
3893
|
this.notifyArraySplice_(index, newItems, res);
|
|
@@ -3882,6 +3987,7 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3882
3987
|
var change = interceptChange(this, {
|
|
3883
3988
|
type: UPDATE,
|
|
3884
3989
|
object: this.proxy_,
|
|
3990
|
+
// since "this" is the real array we need to pass its proxy
|
|
3885
3991
|
index: index,
|
|
3886
3992
|
newValue: newValue
|
|
3887
3993
|
});
|
|
@@ -4097,17 +4203,12 @@ function isObservableArray(thing) {
|
|
|
4097
4203
|
return isObject(thing) && isObservableArrayAdministration(thing[$mobx]);
|
|
4098
4204
|
}
|
|
4099
4205
|
|
|
4100
|
-
var _Symbol$iterator, _Symbol$toStringTag;
|
|
4101
4206
|
var ObservableMapMarker = {};
|
|
4102
4207
|
var ADD = "add";
|
|
4103
4208
|
var DELETE = "delete";
|
|
4104
4209
|
// just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54
|
|
4105
4210
|
// But: https://github.com/mobxjs/mobx/issues/1556
|
|
4106
|
-
_Symbol$iterator = Symbol.iterator;
|
|
4107
|
-
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4108
4211
|
var ObservableMap = /*#__PURE__*/function () {
|
|
4109
|
-
// hasMap, not hashMap >-).
|
|
4110
|
-
|
|
4111
4212
|
function ObservableMap(initialData, enhancer_, name_) {
|
|
4112
4213
|
var _this = this;
|
|
4113
4214
|
if (enhancer_ === void 0) {
|
|
@@ -4121,6 +4222,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4121
4222
|
this[$mobx] = ObservableMapMarker;
|
|
4122
4223
|
this.data_ = void 0;
|
|
4123
4224
|
this.hasMap_ = void 0;
|
|
4225
|
+
// hasMap, not hashMap >-).
|
|
4124
4226
|
this.keysAtom_ = void 0;
|
|
4125
4227
|
this.interceptors_ = void 0;
|
|
4126
4228
|
this.changeListeners_ = void 0;
|
|
@@ -4209,7 +4311,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4209
4311
|
transaction(function () {
|
|
4210
4312
|
var _this3$hasMap_$get;
|
|
4211
4313
|
_this3.keysAtom_.reportChanged();
|
|
4212
|
-
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null
|
|
4314
|
+
(_this3$hasMap_$get = _this3.hasMap_.get(key)) == null || _this3$hasMap_$get.setNewValue_(false);
|
|
4213
4315
|
var observable = _this3.data_.get(key);
|
|
4214
4316
|
observable.setNewValue_(undefined);
|
|
4215
4317
|
_this3.data_["delete"](key);
|
|
@@ -4259,7 +4361,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4259
4361
|
var observable = new ObservableValue(newValue, _this4.enhancer_, process.env.NODE_ENV !== "production" ? _this4.name_ + "." + stringifyKey(key) : "ObservableMap.key", false);
|
|
4260
4362
|
_this4.data_.set(key, observable);
|
|
4261
4363
|
newValue = observable.value_; // value might have been changed
|
|
4262
|
-
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null
|
|
4364
|
+
(_this4$hasMap_$get = _this4.hasMap_.get(key)) == null || _this4$hasMap_$get.setNewValue_(true);
|
|
4263
4365
|
_this4.keysAtom_.reportChanged();
|
|
4264
4366
|
});
|
|
4265
4367
|
var notifySpy = isSpyEnabled();
|
|
@@ -4328,7 +4430,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4328
4430
|
}
|
|
4329
4431
|
});
|
|
4330
4432
|
};
|
|
4331
|
-
_proto[
|
|
4433
|
+
_proto[Symbol.iterator] = function () {
|
|
4332
4434
|
return this.entries();
|
|
4333
4435
|
};
|
|
4334
4436
|
_proto.forEach = function forEach(callback, thisArg) {
|
|
@@ -4482,19 +4584,18 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4482
4584
|
_proto.intercept_ = function intercept_(handler) {
|
|
4483
4585
|
return registerInterceptor(this, handler);
|
|
4484
4586
|
};
|
|
4485
|
-
_createClass(ObservableMap, [{
|
|
4587
|
+
return _createClass(ObservableMap, [{
|
|
4486
4588
|
key: "size",
|
|
4487
4589
|
get: function get() {
|
|
4488
4590
|
this.keysAtom_.reportObserved();
|
|
4489
4591
|
return this.data_.size;
|
|
4490
4592
|
}
|
|
4491
4593
|
}, {
|
|
4492
|
-
key:
|
|
4594
|
+
key: Symbol.toStringTag,
|
|
4493
4595
|
get: function get() {
|
|
4494
4596
|
return "Map";
|
|
4495
4597
|
}
|
|
4496
4598
|
}]);
|
|
4497
|
-
return ObservableMap;
|
|
4498
4599
|
}();
|
|
4499
4600
|
// eslint-disable-next-line
|
|
4500
4601
|
var isObservableMap = /*#__PURE__*/createInstanceofPredicate("ObservableMap", ObservableMap);
|
|
@@ -4514,10 +4615,7 @@ function convertToMap(dataStructure) {
|
|
|
4514
4615
|
}
|
|
4515
4616
|
}
|
|
4516
4617
|
|
|
4517
|
-
var _Symbol$iterator$1, _Symbol$toStringTag$1;
|
|
4518
4618
|
var ObservableSetMarker = {};
|
|
4519
|
-
_Symbol$iterator$1 = Symbol.iterator;
|
|
4520
|
-
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
4521
4619
|
var ObservableSet = /*#__PURE__*/function () {
|
|
4522
4620
|
function ObservableSet(initialData, enhancer, name_) {
|
|
4523
4621
|
var _this = this;
|
|
@@ -4588,7 +4686,6 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4588
4686
|
// ideally, value = change.value would be done here, so that values can be
|
|
4589
4687
|
// changed by interceptor. Same applies for other Set and Map api's.
|
|
4590
4688
|
}
|
|
4591
|
-
|
|
4592
4689
|
if (!this.has(value)) {
|
|
4593
4690
|
transaction(function () {
|
|
4594
4691
|
_this3.data_.add(_this3.enhancer_(value, undefined));
|
|
@@ -4694,6 +4791,47 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4694
4791
|
}
|
|
4695
4792
|
});
|
|
4696
4793
|
};
|
|
4794
|
+
_proto.intersection = function intersection(otherSet) {
|
|
4795
|
+
if (isES6Set(otherSet)) {
|
|
4796
|
+
return otherSet.intersection(this);
|
|
4797
|
+
} else {
|
|
4798
|
+
var dehancedSet = new Set(this);
|
|
4799
|
+
return dehancedSet.intersection(otherSet);
|
|
4800
|
+
}
|
|
4801
|
+
};
|
|
4802
|
+
_proto.union = function union(otherSet) {
|
|
4803
|
+
if (isES6Set(otherSet)) {
|
|
4804
|
+
return otherSet.union(this);
|
|
4805
|
+
} else {
|
|
4806
|
+
var dehancedSet = new Set(this);
|
|
4807
|
+
return dehancedSet.union(otherSet);
|
|
4808
|
+
}
|
|
4809
|
+
};
|
|
4810
|
+
_proto.difference = function difference(otherSet) {
|
|
4811
|
+
return new Set(this).difference(otherSet);
|
|
4812
|
+
};
|
|
4813
|
+
_proto.symmetricDifference = function symmetricDifference(otherSet) {
|
|
4814
|
+
if (isES6Set(otherSet)) {
|
|
4815
|
+
return otherSet.symmetricDifference(this);
|
|
4816
|
+
} else {
|
|
4817
|
+
var dehancedSet = new Set(this);
|
|
4818
|
+
return dehancedSet.symmetricDifference(otherSet);
|
|
4819
|
+
}
|
|
4820
|
+
};
|
|
4821
|
+
_proto.isSubsetOf = function isSubsetOf(otherSet) {
|
|
4822
|
+
return new Set(this).isSubsetOf(otherSet);
|
|
4823
|
+
};
|
|
4824
|
+
_proto.isSupersetOf = function isSupersetOf(otherSet) {
|
|
4825
|
+
return new Set(this).isSupersetOf(otherSet);
|
|
4826
|
+
};
|
|
4827
|
+
_proto.isDisjointFrom = function isDisjointFrom(otherSet) {
|
|
4828
|
+
if (isES6Set(otherSet)) {
|
|
4829
|
+
return otherSet.isDisjointFrom(this);
|
|
4830
|
+
} else {
|
|
4831
|
+
var dehancedSet = new Set(this);
|
|
4832
|
+
return dehancedSet.isDisjointFrom(otherSet);
|
|
4833
|
+
}
|
|
4834
|
+
};
|
|
4697
4835
|
_proto.replace = function replace(other) {
|
|
4698
4836
|
var _this5 = this;
|
|
4699
4837
|
if (isObservableSet(other)) {
|
|
@@ -4732,22 +4870,21 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4732
4870
|
_proto.toString = function toString() {
|
|
4733
4871
|
return "[object ObservableSet]";
|
|
4734
4872
|
};
|
|
4735
|
-
_proto[
|
|
4873
|
+
_proto[Symbol.iterator] = function () {
|
|
4736
4874
|
return this.values();
|
|
4737
4875
|
};
|
|
4738
|
-
_createClass(ObservableSet, [{
|
|
4876
|
+
return _createClass(ObservableSet, [{
|
|
4739
4877
|
key: "size",
|
|
4740
4878
|
get: function get() {
|
|
4741
4879
|
this.atom_.reportObserved();
|
|
4742
4880
|
return this.data_.size;
|
|
4743
4881
|
}
|
|
4744
4882
|
}, {
|
|
4745
|
-
key:
|
|
4883
|
+
key: Symbol.toStringTag,
|
|
4746
4884
|
get: function get() {
|
|
4747
4885
|
return "Set";
|
|
4748
4886
|
}
|
|
4749
4887
|
}]);
|
|
4750
|
-
return ObservableSet;
|
|
4751
4888
|
}();
|
|
4752
4889
|
// eslint-disable-next-line
|
|
4753
4890
|
var isObservableSet = /*#__PURE__*/createInstanceofPredicate("ObservableSet", ObservableSet);
|
|
@@ -5147,7 +5284,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5147
5284
|
}
|
|
5148
5285
|
// Delete
|
|
5149
5286
|
try {
|
|
5150
|
-
var _this$pendingKeys_
|
|
5287
|
+
var _this$pendingKeys_;
|
|
5151
5288
|
startBatch();
|
|
5152
5289
|
var notify = hasListeners(this);
|
|
5153
5290
|
var notifySpy = process.env.NODE_ENV !== "production" && isSpyEnabled();
|
|
@@ -5185,7 +5322,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5185
5322
|
this.keysAtom_.reportChanged();
|
|
5186
5323
|
// Notify "has" observers
|
|
5187
5324
|
// "in" as it may still exist in proto
|
|
5188
|
-
(_this$pendingKeys_ = this.pendingKeys_) == null
|
|
5325
|
+
(_this$pendingKeys_ = this.pendingKeys_) == null || (_this$pendingKeys_ = _this$pendingKeys_.get(key)) == null || _this$pendingKeys_.set(key in this.target_);
|
|
5189
5326
|
// Notify spies/listeners
|
|
5190
5327
|
if (notify || notifySpy) {
|
|
5191
5328
|
var _change2 = {
|
|
@@ -5226,7 +5363,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5226
5363
|
return registerInterceptor(this, handler);
|
|
5227
5364
|
};
|
|
5228
5365
|
_proto.notifyPropertyAddition_ = function notifyPropertyAddition_(key, value) {
|
|
5229
|
-
var _this$pendingKeys_2
|
|
5366
|
+
var _this$pendingKeys_2;
|
|
5230
5367
|
var notify = hasListeners(this);
|
|
5231
5368
|
var notifySpy = process.env.NODE_ENV !== "production" && isSpyEnabled();
|
|
5232
5369
|
if (notify || notifySpy) {
|
|
@@ -5248,7 +5385,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
5248
5385
|
spyReportEnd();
|
|
5249
5386
|
}
|
|
5250
5387
|
}
|
|
5251
|
-
(_this$pendingKeys_2 = this.pendingKeys_) == null
|
|
5388
|
+
(_this$pendingKeys_2 = this.pendingKeys_) == null || (_this$pendingKeys_2 = _this$pendingKeys_2.get(key)) == null || _this$pendingKeys_2.set(true);
|
|
5252
5389
|
// Notify "keys/entries/values" observers
|
|
5253
5390
|
this.keysAtom_.reportChanged();
|
|
5254
5391
|
};
|
|
@@ -5310,7 +5447,7 @@ function recordAnnotationApplied(adm, annotation, key) {
|
|
|
5310
5447
|
adm.appliedAnnotations_[key] = annotation;
|
|
5311
5448
|
}
|
|
5312
5449
|
// Remove applied decorator annotation so we don't try to apply it again in subclass constructor
|
|
5313
|
-
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null
|
|
5450
|
+
(_adm$target_$storedAn = adm.target_[storedAnnotationsSymbol]) == null || delete _adm$target_$storedAn[key];
|
|
5314
5451
|
}
|
|
5315
5452
|
function assertAnnotable(adm, annotation, key) {
|
|
5316
5453
|
// Valid annotation
|
|
@@ -5390,8 +5527,7 @@ inherit(StubArray, Array.prototype);
|
|
|
5390
5527
|
// Weex proto freeze protection was here,
|
|
5391
5528
|
// but it is unclear why the hack is need as MobX never changed the prototype
|
|
5392
5529
|
// anyway, so removed it in V6
|
|
5393
|
-
var LegacyObservableArray = /*#__PURE__*/function (_StubArray
|
|
5394
|
-
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5530
|
+
var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
5395
5531
|
function LegacyObservableArray(initialValues, enhancer, name, owned) {
|
|
5396
5532
|
var _this;
|
|
5397
5533
|
if (name === void 0) {
|
|
@@ -5403,8 +5539,8 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5403
5539
|
_this = _StubArray.call(this) || this;
|
|
5404
5540
|
initObservable(function () {
|
|
5405
5541
|
var adm = new ObservableArrayAdministration(name, enhancer, owned, true);
|
|
5406
|
-
adm.proxy_ =
|
|
5407
|
-
addHiddenFinalProp(
|
|
5542
|
+
adm.proxy_ = _this;
|
|
5543
|
+
addHiddenFinalProp(_this, $mobx, adm);
|
|
5408
5544
|
if (initialValues && initialValues.length) {
|
|
5409
5545
|
// @ts-ignore
|
|
5410
5546
|
_this.spliceWithArray(0, 0, initialValues);
|
|
@@ -5412,11 +5548,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5412
5548
|
if (safariPrototypeSetterInheritanceBug) {
|
|
5413
5549
|
// Seems that Safari won't use numeric prototype setter until any * numeric property is
|
|
5414
5550
|
// defined on the instance. After that it works fine, even if this property is deleted.
|
|
5415
|
-
Object.defineProperty(
|
|
5551
|
+
Object.defineProperty(_this, "0", ENTRY_0);
|
|
5416
5552
|
}
|
|
5417
5553
|
});
|
|
5418
5554
|
return _this;
|
|
5419
5555
|
}
|
|
5556
|
+
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5420
5557
|
var _proto = LegacyObservableArray.prototype;
|
|
5421
5558
|
_proto.concat = function concat() {
|
|
5422
5559
|
this[$mobx].atom_.reportObserved();
|
|
@@ -5429,7 +5566,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5429
5566
|
return isObservableArray(a) ? a.slice() : a;
|
|
5430
5567
|
}));
|
|
5431
5568
|
};
|
|
5432
|
-
_proto[
|
|
5569
|
+
_proto[Symbol.iterator] = function () {
|
|
5433
5570
|
var self = this;
|
|
5434
5571
|
var nextIndex = 0;
|
|
5435
5572
|
return makeIterable({
|
|
@@ -5444,7 +5581,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5444
5581
|
}
|
|
5445
5582
|
});
|
|
5446
5583
|
};
|
|
5447
|
-
_createClass(LegacyObservableArray, [{
|
|
5584
|
+
return _createClass(LegacyObservableArray, [{
|
|
5448
5585
|
key: "length",
|
|
5449
5586
|
get: function get() {
|
|
5450
5587
|
return this[$mobx].getArrayLength_();
|
|
@@ -5453,13 +5590,12 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
|
|
|
5453
5590
|
this[$mobx].setArrayLength_(newLength);
|
|
5454
5591
|
}
|
|
5455
5592
|
}, {
|
|
5456
|
-
key:
|
|
5593
|
+
key: Symbol.toStringTag,
|
|
5457
5594
|
get: function get() {
|
|
5458
5595
|
return "Array";
|
|
5459
5596
|
}
|
|
5460
5597
|
}]);
|
|
5461
|
-
|
|
5462
|
-
}(StubArray, Symbol.toStringTag, Symbol.iterator);
|
|
5598
|
+
}(StubArray);
|
|
5463
5599
|
Object.entries(arrayExtensions).forEach(function (_ref) {
|
|
5464
5600
|
var prop = _ref[0],
|
|
5465
5601
|
fn = _ref[1];
|