mobx 6.3.6 → 6.3.10
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 +28 -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 +75 -61
- 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 +75 -61
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +75 -61
- 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 +75 -61
- 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/observe.ts +4 -3
- package/src/api/when.ts +1 -1
- 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/eq.ts +1 -1
- package/src/utils/utils.ts +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# mobx
|
|
2
2
|
|
|
3
|
+
## 6.3.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2d70798e`](https://github.com/mobxjs/mobx/commit/2d70798eb327187d93757757ceaf410a608735b2) [#3233](https://github.com/mobxjs/mobx/pull/3233) Thanks [@anderlaw](https://github.com/anderlaw)! - `eq.ts` fix comparer logic
|
|
8
|
+
|
|
9
|
+
## 6.3.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`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`
|
|
14
|
+
|
|
15
|
+
* [`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)
|
|
16
|
+
|
|
17
|
+
## 6.3.8
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`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`
|
|
22
|
+
|
|
23
|
+
* [`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
|
|
24
|
+
|
|
25
|
+
## 6.3.7
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [`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
|
|
30
|
+
|
|
3
31
|
## 6.3.6
|
|
4
32
|
|
|
5
33
|
### 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
|
|
|
@@ -3683,9 +3691,12 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3683
3691
|
|
|
3684
3692
|
return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));
|
|
3685
3693
|
} else {
|
|
3686
|
-
|
|
3687
|
-
var
|
|
3688
|
-
|
|
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;
|
|
3689
3700
|
|
|
3690
3701
|
for (var i = 0; i < newItems.length; i++) {
|
|
3691
3702
|
this.values_[index + i] = newItems[i];
|
|
@@ -4002,7 +4013,7 @@ var DELETE = "delete"; // just extend Map? See also https://gist.github.com/nest
|
|
|
4002
4013
|
|
|
4003
4014
|
_Symbol$iterator = Symbol.iterator;
|
|
4004
4015
|
_Symbol$toStringTag = Symbol.toStringTag;
|
|
4005
|
-
var ObservableMap = /*#__PURE__*/function () {
|
|
4016
|
+
var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTag2) {
|
|
4006
4017
|
// hasMap, not hashMap >-).
|
|
4007
4018
|
function ObservableMap(initialData, enhancer_, name_) {
|
|
4008
4019
|
if (enhancer_ === void 0) {
|
|
@@ -4108,7 +4119,8 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4108
4119
|
name: key
|
|
4109
4120
|
} : null;
|
|
4110
4121
|
|
|
4111
|
-
if ( notifySpy) spyReportStart(_change);
|
|
4122
|
+
if ( notifySpy) spyReportStart(_change); // TODO fix type
|
|
4123
|
+
|
|
4112
4124
|
transaction(function () {
|
|
4113
4125
|
var _this2$hasMap_$get;
|
|
4114
4126
|
|
|
@@ -4146,7 +4158,8 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4146
4158
|
name: key,
|
|
4147
4159
|
newValue: newValue
|
|
4148
4160
|
} : null;
|
|
4149
|
-
if ( notifySpy) spyReportStart(change);
|
|
4161
|
+
if ( notifySpy) spyReportStart(change); // TODO fix type
|
|
4162
|
+
|
|
4150
4163
|
observable.setNewValue_(newValue);
|
|
4151
4164
|
if (notify) notifyListeners(this, change);
|
|
4152
4165
|
if ( notifySpy) spyReportEnd();
|
|
@@ -4180,7 +4193,8 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4180
4193
|
name: key,
|
|
4181
4194
|
newValue: newValue
|
|
4182
4195
|
} : null;
|
|
4183
|
-
if ( notifySpy) spyReportStart(change);
|
|
4196
|
+
if ( notifySpy) spyReportStart(change); // TODO fix type
|
|
4197
|
+
|
|
4184
4198
|
if (notify) notifyListeners(this, change);
|
|
4185
4199
|
if ( notifySpy) spyReportEnd();
|
|
4186
4200
|
};
|
|
@@ -4237,7 +4251,7 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4237
4251
|
});
|
|
4238
4252
|
};
|
|
4239
4253
|
|
|
4240
|
-
_proto[_Symbol$
|
|
4254
|
+
_proto[_Symbol$iterator2] = function () {
|
|
4241
4255
|
return this.entries();
|
|
4242
4256
|
};
|
|
4243
4257
|
|
|
@@ -4417,14 +4431,14 @@ var ObservableMap = /*#__PURE__*/function () {
|
|
|
4417
4431
|
return this.data_.size;
|
|
4418
4432
|
}
|
|
4419
4433
|
}, {
|
|
4420
|
-
key: _Symbol$
|
|
4434
|
+
key: _Symbol$toStringTag2,
|
|
4421
4435
|
get: function get() {
|
|
4422
4436
|
return "Map";
|
|
4423
4437
|
}
|
|
4424
4438
|
}]);
|
|
4425
4439
|
|
|
4426
4440
|
return ObservableMap;
|
|
4427
|
-
}(); // eslint-disable-next-line
|
|
4441
|
+
}(_Symbol$iterator, _Symbol$toStringTag); // eslint-disable-next-line
|
|
4428
4442
|
|
|
4429
4443
|
var isObservableMap = /*#__PURE__*/createInstanceofPredicate("ObservableMap", ObservableMap);
|
|
4430
4444
|
|
|
@@ -4450,7 +4464,7 @@ var _Symbol$iterator$1, _Symbol$toStringTag$1;
|
|
|
4450
4464
|
var ObservableSetMarker = {};
|
|
4451
4465
|
_Symbol$iterator$1 = Symbol.iterator;
|
|
4452
4466
|
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
4453
|
-
var ObservableSet = /*#__PURE__*/function () {
|
|
4467
|
+
var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTag2) {
|
|
4454
4468
|
function ObservableSet(initialData, enhancer, name_) {
|
|
4455
4469
|
if (enhancer === void 0) {
|
|
4456
4470
|
enhancer = deepEnhancer;
|
|
@@ -4683,7 +4697,7 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4683
4697
|
return "[object ObservableSet]";
|
|
4684
4698
|
};
|
|
4685
4699
|
|
|
4686
|
-
_proto[_Symbol$
|
|
4700
|
+
_proto[_Symbol$iterator2] = function () {
|
|
4687
4701
|
return this.values();
|
|
4688
4702
|
};
|
|
4689
4703
|
|
|
@@ -4694,14 +4708,14 @@ var ObservableSet = /*#__PURE__*/function () {
|
|
|
4694
4708
|
return this.data_.size;
|
|
4695
4709
|
}
|
|
4696
4710
|
}, {
|
|
4697
|
-
key: _Symbol$
|
|
4711
|
+
key: _Symbol$toStringTag2,
|
|
4698
4712
|
get: function get() {
|
|
4699
4713
|
return "Set";
|
|
4700
4714
|
}
|
|
4701
4715
|
}]);
|
|
4702
4716
|
|
|
4703
4717
|
return ObservableSet;
|
|
4704
|
-
}(); // eslint-disable-next-line
|
|
4718
|
+
}(_Symbol$iterator$1, _Symbol$toStringTag$1); // eslint-disable-next-line
|
|
4705
4719
|
|
|
4706
4720
|
var isObservableSet = /*#__PURE__*/createInstanceofPredicate("ObservableSet", ObservableSet);
|
|
4707
4721
|
|
|
@@ -4887,7 +4901,7 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
|
|
|
4887
4901
|
// When called from super() some props may not exist yet.
|
|
4888
4902
|
// However we don't have to worry about missing prop,
|
|
4889
4903
|
// because the decorator must have been applied to something.
|
|
4890
|
-
if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol])
|
|
4904
|
+
if ((_this$target_$storedA = this.target_[storedAnnotationsSymbol]) != null && _this$target_$storedA[key]) {
|
|
4891
4905
|
return; // will be annotated by subclass constructor
|
|
4892
4906
|
} else {
|
|
4893
4907
|
die(1, annotation.annotationType_, this.name_ + "." + key.toString());
|
|
@@ -5391,7 +5405,7 @@ inherit(StubArray, Array.prototype); // Weex proto freeze protection was here,
|
|
|
5391
5405
|
// but it is unclear why the hack is need as MobX never changed the prototype
|
|
5392
5406
|
// anyway, so removed it in V6
|
|
5393
5407
|
|
|
5394
|
-
var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
5408
|
+
var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringTag, _Symbol$iterator) {
|
|
5395
5409
|
_inheritsLoose(LegacyObservableArray, _StubArray);
|
|
5396
5410
|
|
|
5397
5411
|
function LegacyObservableArray(initialValues, enhancer, name, owned) {
|
|
@@ -5436,7 +5450,7 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
|
5436
5450
|
}));
|
|
5437
5451
|
};
|
|
5438
5452
|
|
|
5439
|
-
_proto[
|
|
5453
|
+
_proto[_Symbol$iterator] = function () {
|
|
5440
5454
|
var self = this;
|
|
5441
5455
|
var nextIndex = 0;
|
|
5442
5456
|
return makeIterable({
|
|
@@ -5462,14 +5476,14 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray) {
|
|
|
5462
5476
|
this[$mobx].setArrayLength_(newLength);
|
|
5463
5477
|
}
|
|
5464
5478
|
}, {
|
|
5465
|
-
key:
|
|
5479
|
+
key: _Symbol$toStringTag,
|
|
5466
5480
|
get: function get() {
|
|
5467
5481
|
return "Array";
|
|
5468
5482
|
}
|
|
5469
5483
|
}]);
|
|
5470
5484
|
|
|
5471
5485
|
return LegacyObservableArray;
|
|
5472
|
-
}(StubArray);
|
|
5486
|
+
}(StubArray, Symbol.toStringTag, Symbol.iterator);
|
|
5473
5487
|
|
|
5474
5488
|
Object.entries(arrayExtensions).forEach(function (_ref) {
|
|
5475
5489
|
var prop = _ref[0],
|
|
@@ -5592,7 +5606,7 @@ function eq(a, b, depth, aStack, bStack) {
|
|
|
5592
5606
|
if (a !== a) return b !== b; // Exhaust primitive checks
|
|
5593
5607
|
|
|
5594
5608
|
var type = typeof a;
|
|
5595
|
-
if (
|
|
5609
|
+
if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names.
|
|
5596
5610
|
|
|
5597
5611
|
var className = toString.call(a);
|
|
5598
5612
|
if (className !== toString.call(b)) return false;
|