mobx 6.13.7 → 6.15.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.
@@ -294,6 +294,13 @@
294
294
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
295
295
  return n;
296
296
  }
297
+ function _construct(t, e, r) {
298
+ if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
299
+ var o = [null];
300
+ o.push.apply(o, e);
301
+ var p = new (t.bind.apply(t, o))();
302
+ return r && _setPrototypeOf(p, r.prototype), p;
303
+ }
297
304
  function _defineProperties(e, r) {
298
305
  for (var t = 0; t < r.length; t++) {
299
306
  var o = r[t];
@@ -331,9 +338,29 @@
331
338
  return n;
332
339
  }, _extends.apply(null, arguments);
333
340
  }
341
+ function _getPrototypeOf(t) {
342
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
343
+ return t.__proto__ || Object.getPrototypeOf(t);
344
+ }, _getPrototypeOf(t);
345
+ }
334
346
  function _inheritsLoose(t, o) {
335
347
  t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
336
348
  }
349
+ function _isNativeFunction(t) {
350
+ try {
351
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
352
+ } catch (n) {
353
+ return "function" == typeof t;
354
+ }
355
+ }
356
+ function _isNativeReflectConstruct() {
357
+ try {
358
+ var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
359
+ } catch (t) {}
360
+ return (_isNativeReflectConstruct = function () {
361
+ return !!t;
362
+ })();
363
+ }
337
364
  function _setPrototypeOf(t, e) {
338
365
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
339
366
  return t.__proto__ = e, t;
@@ -360,6 +387,28 @@
360
387
  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;
361
388
  }
362
389
  }
390
+ function _wrapNativeSuper(t) {
391
+ var r = "function" == typeof Map ? new Map() : void 0;
392
+ return _wrapNativeSuper = function (t) {
393
+ if (null === t || !_isNativeFunction(t)) return t;
394
+ if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function");
395
+ if (void 0 !== r) {
396
+ if (r.has(t)) return r.get(t);
397
+ r.set(t, Wrapper);
398
+ }
399
+ function Wrapper() {
400
+ return _construct(t, arguments, _getPrototypeOf(this).constructor);
401
+ }
402
+ return Wrapper.prototype = Object.create(t.prototype, {
403
+ constructor: {
404
+ value: Wrapper,
405
+ enumerable: !1,
406
+ writable: !0,
407
+ configurable: !0
408
+ }
409
+ }), _setPrototypeOf(Wrapper, t);
410
+ }, _wrapNativeSuper(t);
411
+ }
363
412
 
364
413
  var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
365
414
  /**
@@ -1012,7 +1061,8 @@
1012
1061
  // lone setter -> action setter
1013
1062
  if (descriptor.set) {
1014
1063
  // TODO make action applicable to setter and delegate to action.make_
1015
- var set = createAction(key.toString(), descriptor.set);
1064
+ var set = isAction(descriptor.set) ? descriptor.set // See #4553
1065
+ : createAction(key.toString(), descriptor.set);
1016
1066
  // own
1017
1067
  if (source === adm.target_) {
1018
1068
  return adm.defineProperty_(key, {
@@ -1377,13 +1427,14 @@
1377
1427
  _this.equals = equals;
1378
1428
  _this.value_ = enhancer(value, undefined, name_);
1379
1429
  if ( notifySpy && isSpyEnabled()) {
1430
+ var _this$value_;
1380
1431
  // only notify spy if this is a stand-alone observable
1381
1432
  spyReport({
1382
1433
  type: CREATE,
1383
1434
  object: _this,
1384
1435
  observableKind: "value",
1385
1436
  debugObjectName: _this.name_,
1386
- newValue: "" + _this.value_
1437
+ newValue: "" + ((_this$value_ = _this.value_) == null ? void 0 : _this$value_.toString())
1387
1438
  });
1388
1439
  }
1389
1440
  return _this;
@@ -1576,7 +1627,7 @@
1576
1627
  }
1577
1628
  }
1578
1629
  // to check for cycles
1579
- ;
1630
+ ;
1580
1631
  /**
1581
1632
  * Returns the current value of this computed value.
1582
1633
  * Will evaluate its computation first if needed.
@@ -2551,6 +2602,9 @@
2551
2602
  };
2552
2603
  abortSignal == null || abortSignal.addEventListener == null || abortSignal.addEventListener("abort", dispose);
2553
2604
  dispose[$mobx] = this;
2605
+ if ("dispose" in Symbol && typeof Symbol.dispose === "symbol") {
2606
+ dispose[Symbol.dispose] = dispose;
2607
+ }
2554
2608
  return dispose;
2555
2609
  };
2556
2610
  _proto.toString = function toString() {
@@ -3013,10 +3067,21 @@
3013
3067
  }
3014
3068
 
3015
3069
  var generatorId = 0;
3016
- function FlowCancellationError() {
3017
- this.message = "FLOW_CANCELLED";
3018
- }
3019
- FlowCancellationError.prototype = /*#__PURE__*/Object.create(Error.prototype);
3070
+ var FlowCancellationError = /*#__PURE__*/function (_Error) {
3071
+ function FlowCancellationError() {
3072
+ var _this;
3073
+ _this = _Error.call(this, "FLOW_CANCELLED") || this;
3074
+ Object.setPrototypeOf(_this, (this instanceof FlowCancellationError ? this.constructor : void 0).prototype);
3075
+ _this.name = "FlowCancellationError";
3076
+ return _this;
3077
+ }
3078
+ _inheritsLoose(FlowCancellationError, _Error);
3079
+ var _proto = FlowCancellationError.prototype;
3080
+ _proto.toString = function toString() {
3081
+ return "Error: " + this.message;
3082
+ };
3083
+ return FlowCancellationError;
3084
+ }(/*#__PURE__*/_wrapNativeSuper(Error));
3020
3085
  function isFlowCancellationError(error) {
3021
3086
  return error instanceof FlowCancellationError;
3022
3087
  }
@@ -5028,7 +5093,7 @@
5028
5093
  }
5029
5094
  }
5030
5095
  // Trap for "in"
5031
- ;
5096
+ ;
5032
5097
  _proto.has_ = function has_(key) {
5033
5098
  if (!globalState.trackingDerivation) {
5034
5099
  // Skip key subscription outside derivation
@@ -5160,7 +5225,7 @@
5160
5225
  return true;
5161
5226
  }
5162
5227
  // If original descriptor becomes relevant, move this to annotation directly
5163
- ;
5228
+ ;
5164
5229
  _proto.defineObservableProperty_ = function defineObservableProperty_(key, value, enhancer, proxyTrap) {
5165
5230
  if (proxyTrap === void 0) {
5166
5231
  proxyTrap = false;
@@ -5212,7 +5277,7 @@
5212
5277
  return true;
5213
5278
  }
5214
5279
  // If original descriptor becomes relevant, move this to annotation directly
5215
- ;
5280
+ ;
5216
5281
  _proto.defineComputedProperty_ = function defineComputedProperty_(key, options, proxyTrap) {
5217
5282
  if (proxyTrap === void 0) {
5218
5283
  proxyTrap = false;