mobx 6.3.4 → 6.3.8
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/autorun.d.ts +3 -3
- 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 +24 -19
- 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 +24 -19
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +24 -19
- 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 +24 -19
- 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/package.json +1 -1
- package/src/api/autorun.ts +15 -8
- 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 +1 -1
- package/src/core/atom.ts +1 -1
- package/src/core/computedvalue.ts +11 -11
- package/src/types/observablearray.ts +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# mobx
|
|
2
2
|
|
|
3
|
+
## 6.3.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`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`
|
|
8
|
+
|
|
9
|
+
* [`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
|
|
10
|
+
|
|
11
|
+
## 6.3.7
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`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
|
|
16
|
+
|
|
17
|
+
## 6.3.6
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`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
|
|
22
|
+
|
|
23
|
+
* [`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
|
|
24
|
+
|
|
25
|
+
## 6.3.5
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [`4ac6b454`](https://github.com/mobxjs/mobx/commit/4ac6b45473c2e3b07c8e683cd395bc5edfaa8e15) [#3146](https://github.com/mobxjs/mobx/pull/3146) Thanks [@urugator](https://github.com/urugator)! - fix #3109: spy: computed shouldn't report update unless the value changed
|
|
30
|
+
|
|
3
31
|
## 6.3.4
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/api/autorun.d.ts
CHANGED
|
@@ -17,8 +17,8 @@ export interface IAutorunOptions {
|
|
|
17
17
|
* @returns disposer function, which can be used to stop the view from being updated in the future.
|
|
18
18
|
*/
|
|
19
19
|
export declare function autorun(view: (r: IReactionPublic) => any, opts?: IAutorunOptions): IReactionDisposer;
|
|
20
|
-
export declare type IReactionOptions<T> = IAutorunOptions & {
|
|
21
|
-
fireImmediately?:
|
|
20
|
+
export declare type IReactionOptions<T, FireImmediately extends boolean> = IAutorunOptions & {
|
|
21
|
+
fireImmediately?: FireImmediately;
|
|
22
22
|
equals?: IEqualsComparer<T>;
|
|
23
23
|
};
|
|
24
|
-
export declare function reaction<T>(expression: (r: IReactionPublic) => T, effect: (arg: T, prev: T, r: IReactionPublic) => void, opts?: IReactionOptions<T>): IReactionDisposer;
|
|
24
|
+
export declare function reaction<T, FireImmediately extends boolean = false>(expression: (r: IReactionPublic) => T, effect: (arg: T, prev: FireImmediately extends true ? T | undefined : T, r: IReactionPublic) => void, opts?: IReactionOptions<T, FireImmediately>): IReactionDisposer;
|
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 {
|
|
@@ -1539,22 +1539,21 @@ var ComputedValue = /*#__PURE__*/function () {
|
|
|
1539
1539
|
/* see #1208 */
|
|
1540
1540
|
this.dependenciesState_ === IDerivationState_.NOT_TRACKING_;
|
|
1541
1541
|
var newValue = this.computeValue_(true);
|
|
1542
|
-
|
|
1543
|
-
if ( isSpyEnabled()) {
|
|
1544
|
-
spyReport({
|
|
1545
|
-
observableKind: "computed",
|
|
1546
|
-
debugObjectName: this.name_,
|
|
1547
|
-
object: this.scope_,
|
|
1548
|
-
type: "update",
|
|
1549
|
-
oldValue: this.value_,
|
|
1550
|
-
newValue: newValue
|
|
1551
|
-
});
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
1542
|
var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals_(oldValue, newValue);
|
|
1555
1543
|
|
|
1556
1544
|
if (changed) {
|
|
1557
1545
|
this.value_ = newValue;
|
|
1546
|
+
|
|
1547
|
+
if ( isSpyEnabled()) {
|
|
1548
|
+
spyReport({
|
|
1549
|
+
observableKind: "computed",
|
|
1550
|
+
debugObjectName: this.name_,
|
|
1551
|
+
object: this.scope_,
|
|
1552
|
+
type: "update",
|
|
1553
|
+
oldValue: oldValue,
|
|
1554
|
+
newValue: newValue
|
|
1555
|
+
});
|
|
1556
|
+
}
|
|
1558
1557
|
}
|
|
1559
1558
|
|
|
1560
1559
|
return changed;
|
|
@@ -2653,8 +2652,7 @@ function reaction(expression, effect, opts) {
|
|
|
2653
2652
|
var firstTime = true;
|
|
2654
2653
|
var isScheduled = false;
|
|
2655
2654
|
var value;
|
|
2656
|
-
var oldValue
|
|
2657
|
-
|
|
2655
|
+
var oldValue;
|
|
2658
2656
|
var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer["default"];
|
|
2659
2657
|
var r = new Reaction(name, function () {
|
|
2660
2658
|
if (firstTime || runSync) {
|
|
@@ -3327,7 +3325,7 @@ function whenPromise(predicate, opts) {
|
|
|
3327
3325
|
|
|
3328
3326
|
cancel = function cancel() {
|
|
3329
3327
|
disposer();
|
|
3330
|
-
reject("WHEN_CANCELLED");
|
|
3328
|
+
reject(new Error("WHEN_CANCELLED"));
|
|
3331
3329
|
};
|
|
3332
3330
|
});
|
|
3333
3331
|
res.cancel = cancel;
|
|
@@ -3458,7 +3456,11 @@ function makeObservable(target, annotations, options) {
|
|
|
3458
3456
|
try {
|
|
3459
3457
|
var _annotations;
|
|
3460
3458
|
|
|
3461
|
-
|
|
3459
|
+
if ("development" !== "production" && annotations && target[storedAnnotationsSymbol]) {
|
|
3460
|
+
die("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.");
|
|
3461
|
+
} // Default to decorators
|
|
3462
|
+
|
|
3463
|
+
|
|
3462
3464
|
(_annotations = annotations) != null ? _annotations : annotations = collectStoredAnnotations(target); // Annotate
|
|
3463
3465
|
|
|
3464
3466
|
ownKeys(annotations).forEach(function (key) {
|
|
@@ -3681,9 +3683,12 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
|
|
|
3681
3683
|
|
|
3682
3684
|
return (_this$values_ = this.values_).splice.apply(_this$values_, [index, deleteCount].concat(newItems));
|
|
3683
3685
|
} else {
|
|
3684
|
-
|
|
3685
|
-
var
|
|
3686
|
-
|
|
3686
|
+
// The items removed by the splice
|
|
3687
|
+
var res = this.values_.slice(index, index + deleteCount); // The items that that should remain at the end of the array
|
|
3688
|
+
|
|
3689
|
+
var oldItems = this.values_.slice(index + deleteCount); // New length is the previous length + addition count - deletion count
|
|
3690
|
+
|
|
3691
|
+
this.values_.length += newItems.length - deleteCount;
|
|
3687
3692
|
|
|
3688
3693
|
for (var i = 0; i < newItems.length; i++) {
|
|
3689
3694
|
this.values_[index + i] = newItems[i];
|