mobx 6.3.5 → 6.3.9
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 +30 -0
- package/dist/api/intercept.d.ts +4 -4
- package/dist/api/observe.d.ts +3 -3
- package/dist/core/atom.d.ts +1 -1
- package/dist/mobx.cjs.development.js +80 -62
- 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 +80 -62
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +80 -62
- 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 +80 -62
- 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/observableobject.d.ts +3 -3
- package/dist/utils/utils.d.ts +3 -3
- package/package.json +1 -1
- package/src/api/intercept.ts +4 -4
- package/src/api/makeObservable.ts +7 -1
- package/src/api/observe.ts +4 -3
- package/src/api/when.ts +2 -2
- package/src/core/atom.ts +1 -1
- package/src/core/computedvalue.ts +3 -3
- package/src/types/dynamicobject.ts +1 -1
- package/src/types/observablearray.ts +6 -2
- package/src/types/observablemap.ts +8 -6
- package/src/types/observableobject.ts +3 -2
- package/src/utils/utils.ts +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# mobx
|
|
2
2
|
|
|
3
|
+
## 6.3.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`87e5a037`](https://github.com/mobxjs/mobx/commit/87e5a03735dbc1930e54a15b5ce88ad684bc3dc1) [#3214](https://github.com/mobxjs/mobx/pull/3214) Thanks [@urugator](https://github.com/urugator)! - `requiresReaction` always takes precedence over global `computedRequiresReaction`
|
|
8
|
+
|
|
9
|
+
* [`9b90e25c`](https://github.com/mobxjs/mobx/commit/9b90e25c7bc0cdc0a07d1f847683604e86790f24) [#3198](https://github.com/mobxjs/mobx/pull/3198) Thanks [@urugator](https://github.com/urugator)! - fix `isPlainObject` impl (fixes #3197)
|
|
10
|
+
|
|
11
|
+
## 6.3.8
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`9d5e65cb`](https://github.com/mobxjs/mobx/commit/9d5e65cbd612f262d925e57cebb559f5cf36c502) [#3193](https://github.com/mobxjs/mobx/pull/3193) Thanks [@ChocolateLoverRaj](https://github.com/ChocolateLoverRaj)! - Make `IAtom['reportObserved']` return `boolean`
|
|
16
|
+
|
|
17
|
+
* [`55508af6`](https://github.com/mobxjs/mobx/commit/55508af690fa875e6affaf30f34280b3f27b6126) [#3189](https://github.com/mobxjs/mobx/pull/3189) Thanks [@RvanderLaan](https://github.com/RvanderLaan)! - Fix for RangeError in ObservableArray.replace for large arrays
|
|
18
|
+
|
|
19
|
+
## 6.3.7
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [`3a7dee6f`](https://github.com/mobxjs/mobx/commit/3a7dee6fdaddbb4b79205b054601a8020c226fcc) [#3180](https://github.com/mobxjs/mobx/pull/3180) Thanks [@kubk](https://github.com/kubk)! - Fix type inference of observe function
|
|
24
|
+
|
|
25
|
+
## 6.3.6
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [`49468204`](https://github.com/mobxjs/mobx/commit/49468204d3bc28d15dbf383c0b7f874ca26dff30) [#3162](https://github.com/mobxjs/mobx/pull/3162) Thanks [@upsuper](https://github.com/upsuper)! - Have cancelled when reject with an error rather than a string
|
|
30
|
+
|
|
31
|
+
* [`4afb1ec2`](https://github.com/mobxjs/mobx/commit/4afb1ec24427cf8e1f768d0c6fc49d0f44f4ab8e) [#3154](https://github.com/mobxjs/mobx/pull/3154) Thanks [@urugator](https://github.com/urugator)! - `makeObservable` throws when mixing @decorator syntax with annotations
|
|
32
|
+
|
|
3
33
|
## 6.3.5
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/dist/api/intercept.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IArrayWillChange, IArrayWillSplice, IInterceptor, IMapWillChange, IObjectWillChange, IObservableArray, IObservableValue, IValueWillChange, Lambda, ObservableMap, ObservableSet, ISetWillChange } from "../internal";
|
|
2
2
|
export declare function intercept<T>(value: IObservableValue<T>, handler: IInterceptor<IValueWillChange<T>>): Lambda;
|
|
3
3
|
export declare function intercept<T>(observableArray: IObservableArray<T>, handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;
|
|
4
|
-
export declare function intercept<K, V>(observableMap: ObservableMap<K, V>, handler: IInterceptor<IMapWillChange<K, V>>): Lambda;
|
|
5
|
-
export declare function intercept<V>(
|
|
6
|
-
export declare function intercept<K, V>(observableMap: ObservableMap<K, V>, property: K, handler: IInterceptor<IValueWillChange<V>>): Lambda;
|
|
4
|
+
export declare function intercept<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, handler: IInterceptor<IMapWillChange<K, V>>): Lambda;
|
|
5
|
+
export declare function intercept<V>(observableSet: ObservableSet<V> | Set<V>, handler: IInterceptor<ISetWillChange<V>>): Lambda;
|
|
6
|
+
export declare function intercept<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, property: K, handler: IInterceptor<IValueWillChange<V>>): Lambda;
|
|
7
7
|
export declare function intercept(object: object, handler: IInterceptor<IObjectWillChange>): Lambda;
|
|
8
|
-
export declare function intercept<T extends object, K extends keyof T>(object: T, property: K, handler: IInterceptor<IValueWillChange<
|
|
8
|
+
export declare function intercept<T extends object, K extends keyof T>(object: T, property: K, handler: IInterceptor<IValueWillChange<T[K]>>): Lambda;
|
package/dist/api/observe.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IArrayDidChange, IComputedValue, IMapDidChange, IObjectDidChange, IObservableArray, IObservableValue, IValueDidChange, Lambda, ObservableMap, ObservableSet, ISetDidChange } from "../internal";
|
|
2
2
|
export declare function observe<T>(value: IObservableValue<T> | IComputedValue<T>, listener: (change: IValueDidChange<T>) => void, fireImmediately?: boolean): Lambda;
|
|
3
3
|
export declare function observe<T>(observableArray: IObservableArray<T>, listener: (change: IArrayDidChange<T>) => void, fireImmediately?: boolean): Lambda;
|
|
4
|
-
export declare function observe<V>(
|
|
5
|
-
export declare function observe<K, V>(observableMap: ObservableMap<K, V>, listener: (change: IMapDidChange<K, V>) => void, fireImmediately?: boolean): Lambda;
|
|
6
|
-
export declare function observe<K, V>(observableMap: ObservableMap<K, V>, property: K, listener: (change: IValueDidChange<V>) => void, fireImmediately?: boolean): Lambda;
|
|
4
|
+
export declare function observe<V>(observableSet: ObservableSet<V> | Set<V>, listener: (change: ISetDidChange<V>) => void, fireImmediately?: boolean): Lambda;
|
|
5
|
+
export declare function observe<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, listener: (change: IMapDidChange<K, V>) => void, fireImmediately?: boolean): Lambda;
|
|
6
|
+
export declare function observe<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, property: K, listener: (change: IValueDidChange<V>) => void, fireImmediately?: boolean): Lambda;
|
|
7
7
|
export declare function observe(object: Object, listener: (change: IObjectDidChange) => void, fireImmediately?: boolean): Lambda;
|
|
8
8
|
export declare function observe<T, K extends keyof T>(object: T, property: K, listener: (change: IValueDidChange<T[K]>) => void, fireImmediately?: boolean): Lambda;
|
package/dist/core/atom.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IDerivationState_, IObservable, IDerivation, Lambda } from "../internal";
|
|
2
2
|
export declare const $mobx: unique symbol;
|
|
3
3
|
export interface IAtom extends IObservable {
|
|
4
|
-
reportObserved():
|
|
4
|
+
reportObserved(): boolean;
|
|
5
5
|
reportChanged(): any;
|
|
6
6
|
}
|
|
7
7
|
export declare class Atom implements IAtom {
|
|
@@ -168,12 +168,11 @@ function isObject(value) {
|
|
|
168
168
|
return value !== null && typeof value === "object";
|
|
169
169
|
}
|
|
170
170
|
function isPlainObject(value) {
|
|
171
|
-
var _proto$constructor;
|
|
172
|
-
|
|
173
171
|
if (!isObject(value)) return false;
|
|
174
172
|
var proto = Object.getPrototypeOf(value);
|
|
175
173
|
if (proto == null) return true;
|
|
176
|
-
|
|
174
|
+
var protoConstructor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
|
|
175
|
+
return typeof protoConstructor === "function" && protoConstructor.toString() === plainObjectString;
|
|
177
176
|
} // https://stackoverflow.com/a/37865170
|
|
178
177
|
|
|
179
178
|
function isGenerator(obj) {
|
|
@@ -268,6 +267,9 @@ function _defineProperties(target, props) {
|
|
|
268
267
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
269
268
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
270
269
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
270
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
271
|
+
writable: false
|
|
272
|
+
});
|
|
271
273
|
return Constructor;
|
|
272
274
|
}
|
|
273
275
|
|
|
@@ -292,7 +294,17 @@ function _extends() {
|
|
|
292
294
|
function _inheritsLoose(subClass, superClass) {
|
|
293
295
|
subClass.prototype = Object.create(superClass.prototype);
|
|
294
296
|
subClass.prototype.constructor = subClass;
|
|
295
|
-
|
|
297
|
+
|
|
298
|
+
_setPrototypeOf(subClass, superClass);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function _setPrototypeOf(o, p) {
|
|
302
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
303
|
+
o.__proto__ = p;
|
|
304
|
+
return o;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
return _setPrototypeOf(o, p);
|
|
296
308
|
}
|
|
297
309
|
|
|
298
310
|
function _assertThisInitialized(self) {
|
|
@@ -321,28 +333,24 @@ function _arrayLikeToArray(arr, len) {
|
|
|
321
333
|
}
|
|
322
334
|
|
|
323
335
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
324
|
-
var it;
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
};
|
|
334
|
-
return {
|
|
335
|
-
done: false,
|
|
336
|
-
value: o[i++]
|
|
337
|
-
};
|
|
336
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
337
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
338
|
+
|
|
339
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
340
|
+
if (it) o = it;
|
|
341
|
+
var i = 0;
|
|
342
|
+
return function () {
|
|
343
|
+
if (i >= o.length) return {
|
|
344
|
+
done: true
|
|
338
345
|
};
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
346
|
+
return {
|
|
347
|
+
done: false,
|
|
348
|
+
value: o[i++]
|
|
349
|
+
};
|
|
350
|
+
};
|
|
342
351
|
}
|
|
343
352
|
|
|
344
|
-
|
|
345
|
-
return it.next.bind(it);
|
|
353
|
+
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
354
|
}
|
|
347
355
|
|
|
348
356
|
var storedAnnotationsSymbol = /*#__PURE__*/Symbol("mobx-stored-annotations");
|
|
@@ -626,7 +634,7 @@ function make_$1(adm, key, descriptor, source) {
|
|
|
626
634
|
var _this$options_;
|
|
627
635
|
|
|
628
636
|
// bound
|
|
629
|
-
if ((_this$options_ = this.options_)
|
|
637
|
+
if ((_this$options_ = this.options_) != null && _this$options_.bound) {
|
|
630
638
|
return this.extend_(adm, key, descriptor, false) === null ? 0
|
|
631
639
|
/* Cancel */
|
|
632
640
|
: 1
|
|
@@ -684,7 +692,7 @@ safeDescriptors) {
|
|
|
684
692
|
assertActionDescriptor(adm, annotation, key, descriptor);
|
|
685
693
|
var value = descriptor.value;
|
|
686
694
|
|
|
687
|
-
if ((_annotation$options_ = annotation.options_)
|
|
695
|
+
if ((_annotation$options_ = annotation.options_) != null && _annotation$options_.bound) {
|
|
688
696
|
var _adm$proxy_;
|
|
689
697
|
|
|
690
698
|
value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);
|
|
@@ -692,7 +700,7 @@ safeDescriptors) {
|
|
|
692
700
|
|
|
693
701
|
return {
|
|
694
702
|
value: createAction((_annotation$options_$ = (_annotation$options_2 = annotation.options_) == null ? void 0 : _annotation$options_2.name) != null ? _annotation$options_$ : key.toString(), value, (_annotation$options_$2 = (_annotation$options_3 = annotation.options_) == null ? void 0 : _annotation$options_3.autoAction) != null ? _annotation$options_$2 : false, // https://github.com/mobxjs/mobx/discussions/3140
|
|
695
|
-
(
|
|
703
|
+
(_annotation$options_4 = annotation.options_) != null && _annotation$options_4.bound ? (_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_ : undefined),
|
|
696
704
|
// Non-configurable for classes
|
|
697
705
|
// prevents accidental field redefinition in subclass
|
|
698
706
|
configurable: safeDescriptors ? adm.isPlainObject_ : true,
|
|
@@ -727,7 +735,7 @@ function make_$2(adm, key, descriptor, source) {
|
|
|
727
735
|
// bound - must annotate protos to support super.flow()
|
|
728
736
|
|
|
729
737
|
|
|
730
|
-
if ((
|
|
738
|
+
if ((_this$options_ = this.options_) != null && _this$options_.bound && !isFlow(adm.target_[key])) {
|
|
731
739
|
if (this.extend_(adm, key, descriptor, false) === null) return 0
|
|
732
740
|
/* Cancel */
|
|
733
741
|
;
|
|
@@ -910,11 +918,11 @@ function make_$5(adm, key, descriptor, source) {
|
|
|
910
918
|
if (isGenerator(descriptor.value)) {
|
|
911
919
|
var _this$options_;
|
|
912
920
|
|
|
913
|
-
var flowAnnotation = (
|
|
921
|
+
var flowAnnotation = (_this$options_ = this.options_) != null && _this$options_.autoBind ? flow.bound : flow;
|
|
914
922
|
return flowAnnotation.make_(adm, key, descriptor, source);
|
|
915
923
|
}
|
|
916
924
|
|
|
917
|
-
var actionAnnotation = (
|
|
925
|
+
var actionAnnotation = (_this$options_2 = this.options_) != null && _this$options_2.autoBind ? autoAction.bound : autoAction;
|
|
918
926
|
return actionAnnotation.make_(adm, key, descriptor, source);
|
|
919
927
|
} // other -> observable
|
|
920
928
|
// Copy props from proto as well, see test:
|
|
@@ -923,7 +931,7 @@ function make_$5(adm, key, descriptor, source) {
|
|
|
923
931
|
|
|
924
932
|
var observableAnnotation = ((_this$options_3 = this.options_) == null ? void 0 : _this$options_3.deep) === false ? observable.ref : observable; // if function respect autoBind option
|
|
925
933
|
|
|
926
|
-
if (typeof descriptor.value === "function" && (
|
|
934
|
+
if (typeof descriptor.value === "function" && (_this$options_4 = this.options_) != null && _this$options_4.autoBind) {
|
|
927
935
|
var _adm$proxy_;
|
|
928
936
|
|
|
929
937
|
descriptor.value = descriptor.value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);
|
|
@@ -951,7 +959,7 @@ function extend_$5(adm, key, descriptor, proxyTrap) {
|
|
|
951
959
|
// if function respect autoBind option
|
|
952
960
|
|
|
953
961
|
|
|
954
|
-
if (typeof descriptor.value === "function" && (
|
|
962
|
+
if (typeof descriptor.value === "function" && (_this$options_5 = this.options_) != null && _this$options_5.autoBind) {
|
|
955
963
|
var _adm$proxy_2;
|
|
956
964
|
|
|
957
965
|
descriptor.value = descriptor.value.bind((_adm$proxy_2 = adm.proxy_) != null ? _adm$proxy_2 : adm.target_);
|
|
@@ -1229,7 +1237,7 @@ function allowStateChangesEnd(prev) {
|
|
|
1229
1237
|
var _Symbol$toPrimitive;
|
|
1230
1238
|
var CREATE = "create";
|
|
1231
1239
|
_Symbol$toPrimitive = Symbol.toPrimitive;
|
|
1232
|
-
var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
1240
|
+
var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
|
|
1233
1241
|
_inheritsLoose(ObservableValue, _Atom);
|
|
1234
1242
|
|
|
1235
1243
|
function ObservableValue(value, enhancer, name_, notifySpy, equals) {
|
|
@@ -1376,12 +1384,12 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
|
|
|
1376
1384
|
return toPrimitive(this.get());
|
|
1377
1385
|
};
|
|
1378
1386
|
|
|
1379
|
-
_proto[_Symbol$
|
|
1387
|
+
_proto[_Symbol$toPrimitive2] = function () {
|
|
1380
1388
|
return this.valueOf();
|
|
1381
1389
|
};
|
|
1382
1390
|
|
|
1383
1391
|
return ObservableValue;
|
|
1384
|
-
}(Atom);
|
|
1392
|
+
}(Atom, _Symbol$toPrimitive);
|
|
1385
1393
|
var isObservableValue = /*#__PURE__*/createInstanceofPredicate("ObservableValue", ObservableValue);
|
|
1386
1394
|
|
|
1387
1395
|
var _Symbol$toPrimitive$1;
|
|
@@ -1406,7 +1414,7 @@ var _Symbol$toPrimitive$1;
|
|
|
1406
1414
|
*/
|
|
1407
1415
|
|
|
1408
1416
|
_Symbol$toPrimitive$1 = Symbol.toPrimitive;
|
|
1409
|
-
var ComputedValue = /*#__PURE__*/function () {
|
|
1417
|
+
var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
|
|
1410
1418
|
// nodes we are looking at. Our value depends on these nodes
|
|
1411
1419
|
// during tracking it's an array with new observed observers
|
|
1412
1420
|
// to check for cycles
|
|
@@ -1460,7 +1468,7 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1460
1468
|
|
|
1461
1469
|
this.equals_ = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer["default"]);
|
|
1462
1470
|
this.scope_ = options.context;
|
|
1463
|
-
this.requiresReaction_ =
|
|
1471
|
+
this.requiresReaction_ = options.requiresReaction;
|
|
1464
1472
|
this.keepAlive_ = !!options.keepAlive;
|
|
1465
1473
|
}
|
|
1466
1474
|
|
|
@@ -1628,7 +1636,7 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1628
1636
|
console.log("[mobx.trace] Computed value '" + this.name_ + "' is being read outside a reactive context. Doing a full recompute.");
|
|
1629
1637
|
}
|
|
1630
1638
|
|
|
1631
|
-
if (
|
|
1639
|
+
if (typeof this.requiresReaction_ === "boolean" ? this.requiresReaction_ : globalState.computedRequiresReaction) {
|
|
1632
1640
|
console.warn("[mobx] Computed value '" + this.name_ + "' is being read outside a reactive context. Doing a full recompute.");
|
|
1633
1641
|
}
|
|
1634
1642
|
};
|
|
@@ -1641,12 +1649,12 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1641
1649
|
return toPrimitive(this.get());
|
|
1642
1650
|
};
|
|
1643
1651
|
|
|
1644
|
-
_proto[_Symbol$
|
|
1652
|
+
_proto[_Symbol$toPrimitive2] = function () {
|
|
1645
1653
|
return this.valueOf();
|
|
1646
1654
|
};
|
|
1647
1655
|
|
|
1648
1656
|
return ComputedValue;
|
|
1649
|
-
}();
|
|
1657
|
+
}(_Symbol$toPrimitive$1);
|
|
1650
1658
|
var isComputedValue = /*#__PURE__*/createInstanceofPredicate("ComputedValue", ComputedValue);
|
|
1651
1659
|
|
|
1652
1660
|
var IDerivationState_;
|
|
@@ -2187,8 +2195,8 @@ function propagateChangeConfirmed(observable) {
|
|
|
2187
2195
|
}
|
|
2188
2196
|
} else if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_ // this happens during computing of `d`, just keep lowestObserverState up to date.
|
|
2189
2197
|
) {
|
|
2190
|
-
|
|
2191
|
-
|
|
2198
|
+
observable.lowestObserverState_ = IDerivationState_.UP_TO_DATE_;
|
|
2199
|
+
}
|
|
2192
2200
|
}); // invariantLOS(observable, "confirmed end");
|
|
2193
2201
|
} // Used by computed when its dependency changed, but we don't wan't to immediately recompute.
|
|
2194
2202
|
|
|
@@ -3325,7 +3333,7 @@ function whenPromise(predicate, opts) {
|
|
|
3325
3333
|
|
|
3326
3334
|
cancel = function cancel() {
|
|
3327
3335
|
disposer();
|
|
3328
|
-
reject("WHEN_CANCELLED");
|
|
3336
|
+
reject(new Error("WHEN_CANCELLED"));
|
|
3329
3337
|
};
|
|
3330
3338
|
});
|
|
3331
3339
|
res.cancel = cancel;
|
|
@@ -3456,7 +3464,11 @@ function makeObservable(target, annotations, options) {
|
|
|
3456
3464
|
try {
|
|
3457
3465
|
var _annotations;
|
|
3458
3466
|
|
|
3459
|
-
|
|
3467
|
+
if ("development" !== "production" && annotations && target[storedAnnotationsSymbol]) {
|
|
3468
|
+
die("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.");
|
|
3469
|
+
} // Default to decorators
|
|
3470
|
+
|
|
3471
|
+
|
|
3460
3472
|
(_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target); // Annotate
|
|
3461
3473
|
|
|
3462
3474
|
ownKeys(annotations).forEach(function (key) {
|
|
@@ -3679,9 +3691,12 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3679
3691
|
|
|
3680
3692
|
return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));
|
|
3681
3693
|
} else {
|
|
3682
|
-
|
|
3683
|
-
var
|
|
3684
|
-
|
|
3694
|
+
// The items removed by the splice
|
|
3695
|
+
var res = this.values_.slice(index, index + deleteCount); // The items that that should remain at the end of the array
|
|
3696
|
+
|
|
3697
|
+
var oldItems = this.values_.slice(index + deleteCount); // New length is the previous length + addition count - deletion count
|
|
3698
|
+
|
|
3699
|
+
this.values_.length += newItems.length - deleteCount;
|
|
3685
3700
|
|
|
3686
3701
|
for (var i = 0; i < newItems.length; i++) {
|
|
3687
3702
|
this.values_[index + i] = newItems[i];
|
|
@@ -3998,7 +4013,7 @@ var DELETE = "delete"; // just extend Map? See also https://gist.github.com/nest
|
|
|
3998
4013
|
|
|
3999
4014
|
_Symbol$iterator = Symbol.iterator;
|
|
4000
4015
|
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4001
|
-
var ObservableMap = /*#__PURE__*/function () {
|
|
4016
|
+
var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTag2) {
|
|
4002
4017
|
// hasMap, not hashMap >-).
|
|
4003
4018
|
function ObservableMap(initialData, enhancer_, name_) {
|
|
4004
4019
|
if (enhancer_ === void 0) {
|
|
@@ -4104,7 +4119,8 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4104
4119
|
name: key
|
|
4105
4120
|
} : null;
|
|
4106
4121
|
|
|
4107
|
-
if ( notifySpy) spyReportStart(_change);
|
|
4122
|
+
if ( notifySpy) spyReportStart(_change); // TODO fix type
|
|
4123
|
+
|
|
4108
4124
|
transaction(function () {
|
|
4109
4125
|
var _this2$hasMap_$get;
|
|
4110
4126
|
|
|
@@ -4142,7 +4158,8 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4142
4158
|
name: key,
|
|
4143
4159
|
newValue: newValue
|
|
4144
4160
|
} : null;
|
|
4145
|
-
if ( notifySpy) spyReportStart(change);
|
|
4161
|
+
if ( notifySpy) spyReportStart(change); // TODO fix type
|
|
4162
|
+
|
|
4146
4163
|
observable.setNewValue_(newValue);
|
|
4147
4164
|
if (notify) notifyListeners(this, change);
|
|
4148
4165
|
if ( notifySpy) spyReportEnd();
|
|
@@ -4176,7 +4193,8 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4176
4193
|
name: key,
|
|
4177
4194
|
newValue: newValue
|
|
4178
4195
|
} : null;
|
|
4179
|
-
if ( notifySpy) spyReportStart(change);
|
|
4196
|
+
if ( notifySpy) spyReportStart(change); // TODO fix type
|
|
4197
|
+
|
|
4180
4198
|
if (notify) notifyListeners(this, change);
|
|
4181
4199
|
if ( notifySpy) spyReportEnd();
|
|
4182
4200
|
};
|
|
@@ -4233,7 +4251,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4233
4251
|
});
|
|
4234
4252
|
};
|
|
4235
4253
|
|
|
4236
|
-
_proto[_Symbol$
|
|
4254
|
+
_proto[_Symbol$iterator2] = function () {
|
|
4237
4255
|
return this.entries();
|
|
4238
4256
|
};
|
|
4239
4257
|
|
|
@@ -4413,14 +4431,14 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4413
4431
|
return this.data_.size;
|
|
4414
4432
|
}
|
|
4415
4433
|
}, {
|
|
4416
|
-
key: _Symbol$
|
|
4434
|
+
key: _Symbol$toStringTag2,
|
|
4417
4435
|
get: function get() {
|
|
4418
4436
|
return "Map";
|
|
4419
4437
|
}
|
|
4420
4438
|
}]);
|
|
4421
4439
|
|
|
4422
4440
|
return ObservableMap;
|
|
4423
|
-
}(); // eslint-disable-next-line
|
|
4441
|
+
}(_Symbol$iterator, _Symbol$toStringTag); // eslint-disable-next-line
|
|
4424
4442
|
|
|
4425
4443
|
var isObservableMap = /*#__PURE__*/createInstanceofPredicate("ObservableMap", ObservableMap);
|
|
4426
4444
|
|
|
@@ -4446,7 +4464,7 @@ var _Symbol$iterator$1, _Symbol$toStringTag$1;
|
|
|
4446
4464
|
var ObservableSetMarker = {};
|
|
4447
4465
|
_Symbol$iterator$1 = Symbol.iterator;
|
|
4448
4466
|
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
4449
|
-
var ObservableSet = /*#__PURE__*/function () {
|
|
4467
|
+
var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTag2) {
|
|
4450
4468
|
function ObservableSet(initialData, enhancer, name_) {
|
|
4451
4469
|
if (enhancer === void 0) {
|
|
4452
4470
|
enhancer = deepEnhancer;
|
|
@@ -4679,7 +4697,7 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4679
4697
|
return "[object ObservableSet]";
|
|
4680
4698
|
};
|
|
4681
4699
|
|
|
4682
|
-
_proto[_Symbol$
|
|
4700
|
+
_proto[_Symbol$iterator2] = function () {
|
|
4683
4701
|
return this.values();
|
|
4684
4702
|
};
|
|
4685
4703
|
|
|
@@ -4690,14 +4708,14 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4690
4708
|
return this.data_.size;
|
|
4691
4709
|
}
|
|
4692
4710
|
}, {
|
|
4693
|
-
key: _Symbol$
|
|
4711
|
+
key: _Symbol$toStringTag2,
|
|
4694
4712
|
get: function get() {
|
|
4695
4713
|
return "Set";
|
|
4696
4714
|
}
|
|
4697
4715
|
}]);
|
|
4698
4716
|
|
|
4699
4717
|
return ObservableSet;
|
|
4700
|
-
}(); // eslint-disable-next-line
|
|
4718
|
+
}(_Symbol$iterator$1, _Symbol$toStringTag$1); // eslint-disable-next-line
|
|
4701
4719
|
|
|
4702
4720
|
var isObservableSet = /*#__PURE__*/createInstanceofPredicate("ObservableSet", ObservableSet);
|
|
4703
4721
|
|
|
@@ -4883,7 +4901,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
4883
4901
|
// When called from super() some props may not exist yet.
|
|
4884
4902
|
// However we don't have to worry about missing prop,
|
|
4885
4903
|
// because the decorator must have been applied to something.
|
|
4886
|
-
if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol])
|
|
4904
|
+
if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {
|
|
4887
4905
|
return; // will be annotated by subclass constructor
|
|
4888
4906
|
} else {
|
|
4889
4907
|
die(1, annotation.annotationType_, this.name_ + "." + key.toString());
|
|
@@ -5387,7 +5405,7 @@ inherit(StubArray, Array.prototype); // Weex proto freeze protection was here,
|
|
|
5387
5405
|
// but it is unclear why the hack is need as MobX never changed the prototype
|
|
5388
5406
|
// anyway, so removed it in V6
|
|
5389
5407
|
|
|
5390
|
-
var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
5408
|
+
var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringTag, _Symbol$iterator) {
|
|
5391
5409
|
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5392
5410
|
|
|
5393
5411
|
function LegacyObservableArray(initialValues, enhancer, name, owned) {
|
|
@@ -5432,7 +5450,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
|
5432
5450
|
}));
|
|
5433
5451
|
};
|
|
5434
5452
|
|
|
5435
|
-
_proto[
|
|
5453
|
+
_proto[_Symbol$iterator] = function () {
|
|
5436
5454
|
var self = this;
|
|
5437
5455
|
var nextIndex = 0;
|
|
5438
5456
|
return makeIterable({
|
|
@@ -5458,14 +5476,14 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
|
5458
5476
|
this[$mobx].setArrayLength_(newLength);
|
|
5459
5477
|
}
|
|
5460
5478
|
}, {
|
|
5461
|
-
key:
|
|
5479
|
+
key: _Symbol$toStringTag,
|
|
5462
5480
|
get: function get() {
|
|
5463
5481
|
return "Array";
|
|
5464
5482
|
}
|
|
5465
5483
|
}]);
|
|
5466
5484
|
|
|
5467
5485
|
return LegacyObservableArray;
|
|
5468
|
-
}(StubArray);
|
|
5486
|
+
}(StubArray, Symbol.toStringTag, Symbol.iterator);
|
|
5469
5487
|
|
|
5470
5488
|
Object.entries(arrayExtensions).forEach(function (_ref) {
|
|
5471
5489
|
var prop = _ref[0],
|