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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# mobx
|
|
2
2
|
|
|
3
|
+
## 6.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`5e711e0b4737fd6b5b3c6f9b32afd4f195bc5fc3`](https://github.com/mobxjs/mobx/commit/5e711e0b4737fd6b5b3c6f9b32afd4f195bc5fc3) [#3901](https://github.com/mobxjs/mobx/pull/3901) Thanks [@peterm-canva](https://github.com/peterm-canva)! - Shrink Atom and Reaction using a bitfield
|
|
8
|
+
|
|
9
|
+
## 6.13.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`16f070e6aac60e9010c2591b1743276d700b23d5`](https://github.com/mobxjs/mobx/commit/16f070e6aac60e9010c2591b1743276d700b23d5) [#3898](https://github.com/mobxjs/mobx/pull/3898) Thanks [@inoyakaigor](https://github.com/inoyakaigor)! - Added new Set methods
|
|
14
|
+
|
|
3
15
|
## 6.12.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1402,7 +1414,7 @@ A deprecation message will now be printed if creating computed properties while
|
|
|
1402
1414
|
|
|
1403
1415
|
```javascript
|
|
1404
1416
|
const x = observable({
|
|
1405
|
-
computedProp: function() {
|
|
1417
|
+
computedProp: function () {
|
|
1406
1418
|
return someComputation
|
|
1407
1419
|
}
|
|
1408
1420
|
})
|
|
@@ -1427,7 +1439,7 @@ or alternatively:
|
|
|
1427
1439
|
|
|
1428
1440
|
```javascript
|
|
1429
1441
|
observable({
|
|
1430
|
-
computedProp: computed(function() {
|
|
1442
|
+
computedProp: computed(function () {
|
|
1431
1443
|
return someComputation
|
|
1432
1444
|
})
|
|
1433
1445
|
})
|
|
@@ -1445,7 +1457,7 @@ N.B. If you want to introduce actions on an observable that modify its state, us
|
|
|
1445
1457
|
```javascript
|
|
1446
1458
|
observable({
|
|
1447
1459
|
counter: 0,
|
|
1448
|
-
increment: action(function() {
|
|
1460
|
+
increment: action(function () {
|
|
1449
1461
|
this.counter++
|
|
1450
1462
|
})
|
|
1451
1463
|
})
|
|
@@ -1571,10 +1583,10 @@ function Square() {
|
|
|
1571
1583
|
extendObservable(this, {
|
|
1572
1584
|
length: 2,
|
|
1573
1585
|
squared: computed(
|
|
1574
|
-
function() {
|
|
1586
|
+
function () {
|
|
1575
1587
|
return this.squared * this.squared
|
|
1576
1588
|
},
|
|
1577
|
-
function(surfaceSize) {
|
|
1589
|
+
function (surfaceSize) {
|
|
1578
1590
|
this.length = Math.sqrt(surfaceSize)
|
|
1579
1591
|
}
|
|
1580
1592
|
)
|
package/dist/core/atom.d.ts
CHANGED
|
@@ -6,10 +6,11 @@ export interface IAtom extends IObservable {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class Atom implements IAtom {
|
|
8
8
|
name_: string;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
private static readonly isBeingObservedMask_;
|
|
10
|
+
private static readonly isPendingUnobservationMask_;
|
|
11
|
+
private static readonly diffValueMask_;
|
|
12
|
+
private flags_;
|
|
11
13
|
observers_: Set<IDerivation>;
|
|
12
|
-
diffValue_: number;
|
|
13
14
|
lastAccessedBy_: number;
|
|
14
15
|
lowestObserverState_: IDerivationState_;
|
|
15
16
|
/**
|
|
@@ -17,6 +18,12 @@ export declare class Atom implements IAtom {
|
|
|
17
18
|
* The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management.
|
|
18
19
|
*/
|
|
19
20
|
constructor(name_?: string);
|
|
21
|
+
get isBeingObserved(): boolean;
|
|
22
|
+
set isBeingObserved(newValue: boolean);
|
|
23
|
+
get isPendingUnobservation(): boolean;
|
|
24
|
+
set isPendingUnobservation(newValue: boolean);
|
|
25
|
+
get diffValue(): 0 | 1;
|
|
26
|
+
set diffValue(newValue: 0 | 1);
|
|
20
27
|
onBOL: Set<Lambda> | undefined;
|
|
21
28
|
onBUOL: Set<Lambda> | undefined;
|
|
22
29
|
onBO(): void;
|
|
@@ -44,7 +44,6 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
|
|
|
44
44
|
observing_: IObservable[];
|
|
45
45
|
newObserving_: null;
|
|
46
46
|
observers_: Set<IDerivation>;
|
|
47
|
-
diffValue_: number;
|
|
48
47
|
runId_: number;
|
|
49
48
|
lastAccessedBy_: number;
|
|
50
49
|
lowestObserverState_: IDerivationState_;
|
|
@@ -56,6 +55,7 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
|
|
|
56
55
|
private static readonly isRunningSetterMask_;
|
|
57
56
|
private static readonly isBeingObservedMask_;
|
|
58
57
|
private static readonly isPendingUnobservationMask_;
|
|
58
|
+
private static readonly diffValueMask_;
|
|
59
59
|
private flags_;
|
|
60
60
|
derivation: () => T;
|
|
61
61
|
setter_?: (value: T) => void;
|
|
@@ -90,6 +90,8 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
|
|
|
90
90
|
set isBeingObserved(newValue: boolean);
|
|
91
91
|
get isPendingUnobservation(): boolean;
|
|
92
92
|
set isPendingUnobservation(newValue: boolean);
|
|
93
|
+
get diffValue(): 0 | 1;
|
|
94
|
+
set diffValue(newValue: 0 | 1);
|
|
93
95
|
/**
|
|
94
96
|
* Returns the current value of this computed value.
|
|
95
97
|
* Will evaluate its computation first if needed.
|
|
@@ -4,7 +4,7 @@ export interface IDepTreeNode {
|
|
|
4
4
|
observing_?: IObservable[];
|
|
5
5
|
}
|
|
6
6
|
export interface IObservable extends IDepTreeNode {
|
|
7
|
-
|
|
7
|
+
diffValue: number;
|
|
8
8
|
/**
|
|
9
9
|
* Id of the derivation *run* that last accessed this observable.
|
|
10
10
|
* If this id equals the *run* id of the current derivation,
|
package/dist/core/reaction.d.ts
CHANGED
|
@@ -33,18 +33,28 @@ export declare class Reaction implements IDerivation, IReactionPublic {
|
|
|
33
33
|
observing_: IObservable[];
|
|
34
34
|
newObserving_: IObservable[];
|
|
35
35
|
dependenciesState_: IDerivationState_;
|
|
36
|
-
diffValue_: number;
|
|
37
36
|
runId_: number;
|
|
38
37
|
unboundDepsCount_: number;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
private static readonly isDisposedMask_;
|
|
39
|
+
private static readonly isScheduledMask_;
|
|
40
|
+
private static readonly isTrackPendingMask_;
|
|
41
|
+
private static readonly isRunningMask_;
|
|
42
|
+
private static readonly diffValueMask_;
|
|
43
|
+
private flags_;
|
|
43
44
|
isTracing_: TraceMode;
|
|
44
45
|
constructor(name_: string, onInvalidate_: () => void, errorHandler_?: ((error: any, derivation: IDerivation) => void) | undefined, requiresObservable_?: any);
|
|
46
|
+
get isDisposed(): boolean;
|
|
47
|
+
set isDisposed(newValue: boolean);
|
|
48
|
+
get isScheduled(): boolean;
|
|
49
|
+
set isScheduled(newValue: boolean);
|
|
50
|
+
get isTrackPending(): boolean;
|
|
51
|
+
set isTrackPending(newValue: boolean);
|
|
52
|
+
get isRunning(): boolean;
|
|
53
|
+
set isRunning(newValue: boolean);
|
|
54
|
+
get diffValue(): 0 | 1;
|
|
55
|
+
set diffValue(newValue: 0 | 1);
|
|
45
56
|
onBecomeStale_(): void;
|
|
46
57
|
schedule_(): void;
|
|
47
|
-
isScheduled(): boolean;
|
|
48
58
|
/**
|
|
49
59
|
* internal, use schedule() if you intend to kick off a reaction
|
|
50
60
|
*/
|