mobx 5.5.2 → 5.9.0

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 CHANGED
@@ -1,3 +1,45 @@
1
+ # 5.9.0 / 4.9.0
2
+
3
+ **Features**
4
+
5
+ * Introduced support for observable sets! Through [#1592](https://github.com/mobxjs/mobx/pull/1592) by [@newraina](https://github.com/newraina)
6
+ * `observable.box` now accepts an `equals` option, to be able to pass a custom comparision function. Through [#1862](https://github.com/mobxjs/mobx/pull/1862), [#1874](https://github.com/mobxjs/mobx/pull/1874) by [@fi3ework](https://github.com/fi3ework). Fixes [#1580](https://github.com/mobxjs/mobx/issues/1580)
7
+ * Improved logging of reactions; if an action throws an exception, errors in reactions that react to that are only logged as warnings. Fixes [#1836](https://github.com/mobxjs/mobx/issues/1836)
8
+
9
+ **Fixes**
10
+
11
+ * Improved typings for `flow`, see [#1827](https://github.com/mobxjs/mobx/pull/1827) by [@xaviergonz](https://github.com/xaviergonz)
12
+ * Don't allow subclassing map, fixes [#1858](https://github.com/mobxjs/mobx/issues/1858)
13
+ * Fixed `trace(true)` not being able to handle multi-line comments in traced function. Fixes [#1850](https://github.com/mobxjs/mobx/issues/1850)
14
+ * `@computed` now introduces non-configurable properties, to fail fast on incorrect inheritance or property deletion. Fixes [#1867](https://github.com/mobxjs/mobx/issues/1867)
15
+ * The options `enforceActions` and `isolateGlobalState` now work correctly when used together. Fixes [#1869](https://github.com/mobxjs/mobx/issues/1869)
16
+
17
+ # 5.8.0 / 4.8.0
18
+
19
+ * MobX now requires TypeScript 3 (this was already the case in 5.7.0, but in this version the difference is actually noticeable in the typings).
20
+ * Fixed array dehancer sometimes skipping. Fixes [#1839](https://github.com/mobxjs/mobx/issues/1839) through [#1841](https://github.com/mobxjs/mobx/pull/1841) by [k-g-a](https://github.com/k-g-a)
21
+ * Fixed issue where webpack 4 wouldn't use the ESM module [#1834](https://github.com/mobxjs/mobx/pull/1834) by [mrtnbroder](https://github.com/mrtnbroder)
22
+ * Improved type inference for `flow` in TypeScript 3. Fixes [#1816](https://github.com/mobxjs/mobx/issue/1816) through [#1825](https://github.com/mobxjs/mobx/pull/1825) by [ismailhabib](https://github.com/ismailhabib)
23
+ * Introduced support for global environment variable `IGNORE_MOBX_MINIFIY_WARNING=true` to skip the built-in minification warning. See [#1835](https://github.com/mobxjs/mobx/pull/1835) by [fi3ework](https://github.com/fi3ework)
24
+ * Fixed onBecome(Un)Observed dispoer cleanup. Fixes [#1537](https://github.com/mobxjs/mobx/issues/1537) through [#1833](https://github.com/mobxjs/mobx/pull/1833) by [fi3ework](https://github.com/fi3ework)
25
+
26
+ # 5.7.1 / 4.7.1
27
+ * Fixed [#1839](https://github.com/mobxjs/mobx/issues/1839), ObservableArrayAdministration.dehanceValues does not dehance last value.
28
+
29
+ # 5.7.0 / 4.7.0
30
+
31
+ * Upgraded typings to TypeScript 3
32
+ * Fixed [#1742](https://github.com/mobxjs/mobx/issues/1742), change detection fails when multiple mobx instances were active.
33
+ * Fixed [#1624](https://github.com/mobxjs/mobx/issues/1624), use built-in flow types for iterators
34
+ * Fixed [#1777](https://github.com/mobxjs/mobx/issues/1777) through [#1826](https://github.com/mobxjs/mobx/pull/1826), stack overflow exception, in development mode, when using `@computed` on a React component. The MobX 5 behavior here has been reverted to the MobX 4 behavior.
35
+
36
+
37
+ # 5.6.0 / 4.6.0
38
+
39
+ * `keepAlive` has become smarter and won't recomputed computed values that are kept alive, as long as they aren't read. Implements [#1534](https://github.com/mobxjs/mobx/issues/1534)
40
+ * Fixed [#1796](https://github.com/mobxjs/mobx/issues/1796), undeleting a property that had an initial value of `undefined` was undetected
41
+ * Improved Flow typings, see [#1794](https://github.com/mobxjs/mobx/pull/1794) and [#1786](https://github.com/mobxjs/mobx/pull/1786)
42
+
1
43
  # 5.5.2 / 4.5.2
2
44
 
3
45
  * Fixed bug in `toJS` not handling `null` values correctly. Fixes [#1557](https://github.com/mobxjs/mobx/issues/1557) through [#1783](https://github.com/mobxjs/mobx/pull/1783) by [@wangyiz4262](https://github.com/wangyiz4262)
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -12,19 +12,19 @@ _Simple, scalable state management_
12
12
  [![OpenCollective](https://opencollective.com/mobx/sponsors/badge.svg)](#sponsors)
13
13
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
14
14
 
15
- MobX is proudly sponsored by Mendix, Coinbase, Facebook Open Source, Algolia, Guilded, Canva and many [individual sponsors](#backers)
15
+ MobX is proudly sponsored by Mendix, Coinbase, Facebook Open Source, Canva, Algolia, Guilded and many [individual sponsors](#backers)
16
16
 
17
17
  <img src="docs/mendix-logo.png" align="center" width="100" title="Mendix" alt="Mendix" /> <img src="docs/coinbase.jpeg" align="center" width="100" title="Coinbase" alt="Coinbase" /> <img src="docs/fbos.jpeg" align="center" width="100" title="Facebook Open Source" alt="Facebook Open Source" />
18
+ <img src="docs/canva.png" align="center" width="100" title="Canva" alt="Canva" />
18
19
  <img src="docs/algolia.jpg" align="center" width="100" title="Algolia" alt="Algolia" />
19
20
  <img src="docs/guilded.jpg" align="center" width="100" title="Guilded" alt="Guilded" />
20
- <img src="docs/canva.png" align="center" width="100" title="Canva" alt="Canva" />
21
21
 
22
22
  # Installation
23
23
 
24
24
  * Installation: `npm install mobx --save`. React bindings: `npm install mobx-react --save`. To enable ESNext decorators (optional), see below.
25
25
  * CDN:
26
- - https://unpkg.com/mobx/lib/mobx.umd.js
27
- - https://cdnjs.com/libraries/mobx
26
+ * https://unpkg.com/mobx/lib/mobx.umd.js
27
+ * https://cdnjs.com/libraries/mobx
28
28
 
29
29
 
30
30
  _Tip: Consider using the faster and smaller ES6 build if targetting a modern environment: `lib/mobx.es6.js`. For example by setting up a webpack alias: `resolve: { alias: { mobx: __dirname + "/node_modules/mobx/lib/mobx.es6.js" }}`_
@@ -88,11 +88,11 @@ MobX adds observable capabilities to existing data structures like objects, arra
88
88
  This can simply be done by annotating your class properties with the [@observable](http://mobxjs.github.io/mobx/refguide/observable-decorator.html) decorator (ES.Next).
89
89
 
90
90
  ```javascript
91
- import { observable } from "mobx"
91
+ import { observable } from 'mobx';
92
92
 
93
93
  class Todo {
94
94
  id = Math.random();
95
- @observable title = "";
95
+ @observable title = '';
96
96
  @observable finished = false;
97
97
  }
98
98
  ```
@@ -106,11 +106,11 @@ Or you can skip them altoghether, as MobX can be used fine without decorator _sy
106
106
  Many MobX users prefer the slightly more concise decorator syntax, but the following snippet achieves the same:
107
107
 
108
108
  ```javascript
109
- import { decorate, observable } from "mobx"
109
+ import { decorate, observable } from 'mobx';
110
110
 
111
111
  class Todo {
112
112
  id = Math.random();
113
- title = "";
113
+ title = '';
114
114
  finished = false;
115
115
  }
116
116
  decorate(Todo, {
@@ -173,7 +173,7 @@ class TodoListView extends Component {
173
173
  const TodoView = observer(({todo}) =>
174
174
  <li>
175
175
  <input
176
- type="checkbox"
176
+ type='checkbox'
177
177
  checked={todo.finished}
178
178
  onClick={() => todo.finished = !todo.finished}
179
179
  />{todo.title}
@@ -197,7 +197,7 @@ For example the following `autorun` prints a log message each time the amount of
197
197
 
198
198
  ```javascript
199
199
  autorun(() => {
200
- console.log("Tasks left: " + todos.unfinishedTodoCount)
200
+ console.log(`Tasks left: ${ todos.unfinishedTodoCount }`)
201
201
  })
202
202
  ```
203
203
 
@@ -227,8 +227,8 @@ There is no technical need for firing events, calling a dispatcher, etc. A React
227
227
 
228
228
  ```javascript
229
229
  store.todos.push(
230
- new Todo("Get Coffee"),
231
- new Todo("Write simpler code")
230
+ new Todo('Get Coffee'),
231
+ new Todo('Write simpler code')
232
232
  );
233
233
  store.todos[0].finished = true;
234
234
  ```
@@ -311,6 +311,8 @@ And finally, kudos to all the people that believed in, tried, validated and even
311
311
 
312
312
  > The #mobx is the way I always want things to be! It's really surprising simple and fast! Totally awesome! Don't miss it!
313
313
 
314
+ > I've been using MobX for over 2 years now, and it *still* feels like cheating! 😎
315
+
314
316
  ## Contributing
315
317
 
316
318
  * Feel free to send small pull requests. Please discuss new features or big changes in a GitHub issue first.
@@ -1,6 +1,17 @@
1
1
  import { BabelDescriptor } from "../internal";
2
2
  declare function dontReassignFields(): void;
3
- export declare function namedActionDecorator(name: string): (target: any, prop: any, descriptor: BabelDescriptor) => any;
3
+ export declare function namedActionDecorator(name: string): (target: any, prop: any, descriptor: BabelDescriptor) => void | {
4
+ value: Function & import("../internal").IAction;
5
+ enumerable: boolean;
6
+ configurable: boolean;
7
+ writable: boolean;
8
+ } | {
9
+ enumerable: boolean;
10
+ configurable: boolean;
11
+ writable: boolean;
12
+ initializer(): Function & import("../internal").IAction;
13
+ value?: undefined;
14
+ };
4
15
  export declare function actionFieldDecorator(name: string): (target: any, prop: any, descriptor: any) => void;
5
16
  export declare function boundActionDecorator(target: any, propertyName: any, descriptor: any, applyToInstance?: boolean): {
6
17
  configurable: boolean;
@@ -1,5 +1,5 @@
1
- import { IComputedValue, IObservable, IObservableArray, Lambda, ObservableMap } from "../internal";
2
- export declare function onBecomeObserved(value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any>, listener: Lambda): Lambda;
1
+ import { IComputedValue, IObservable, IObservableArray, Lambda, ObservableMap, ObservableSet } from "../internal";
2
+ export declare function onBecomeObserved(value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any> | ObservableSet<any>, listener: Lambda): Lambda;
3
3
  export declare function onBecomeObserved<K, V = any>(value: ObservableMap<K, V> | Object, property: K, listener: Lambda): Lambda;
4
- export declare function onBecomeUnobserved(value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any>, listener: Lambda): Lambda;
4
+ export declare function onBecomeUnobserved(value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any> | ObservableSet<any>, listener: Lambda): Lambda;
5
5
  export declare function onBecomeUnobserved<K, V = any>(value: ObservableMap<K, V> | Object, property: K, listener: Lambda): Lambda;
package/lib/api/flow.d.ts CHANGED
@@ -1,17 +1,12 @@
1
1
  export declare type CancellablePromise<T> = Promise<T> & {
2
2
  cancel(): void;
3
3
  };
4
- export interface FlowIterator<T> {
5
- next(value?: any): IteratorResult<T> | Promise<IteratorResult<T>>;
6
- return?(value?: any): IteratorResult<T> | Promise<IteratorResult<T>>;
7
- throw?(e?: any): IteratorResult<T> | Promise<IteratorResult<T>>;
4
+ export interface FlowYield {
5
+ "!!flowYield": undefined;
8
6
  }
9
- export declare function flow<R>(generator: () => FlowIterator<any>): () => CancellablePromise<R>;
10
- export declare function flow<A1>(generator: (a1: A1) => FlowIterator<any>): (a1: A1) => CancellablePromise<any>;
11
- export declare function flow<A1, A2>(generator: (a1: A1, a2: A2) => FlowIterator<any>): (a1: A1, a2: A2) => CancellablePromise<any>;
12
- export declare function flow<A1, A2, A3>(generator: (a1: A1, a2: A2, a3: A3) => FlowIterator<any>): (a1: A1, a2: A2, a3: A3) => CancellablePromise<any>;
13
- export declare function flow<A1, A2, A3, A4>(generator: (a1: A1, a2: A2, a3: A3, a4: A4) => FlowIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4) => CancellablePromise<any>;
14
- export declare function flow<A1, A2, A3, A4, A5>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => FlowIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => CancellablePromise<any>;
15
- export declare function flow<A1, A2, A3, A4, A5, A6>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => FlowIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => CancellablePromise<any>;
16
- export declare function flow<A1, A2, A3, A4, A5, A6, A7>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => FlowIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => CancellablePromise<any>;
17
- export declare function flow<A1, A2, A3, A4, A5, A6, A7, A8>(generator: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => FlowIterator<any>): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => CancellablePromise<any>;
7
+ export interface FlowReturn<T> {
8
+ "!!flowReturn": T;
9
+ }
10
+ export declare type FlowReturnType<R> = IfAllAreFlowYieldThenVoid<R extends FlowReturn<infer FR> ? FR extends Promise<infer FRP> ? FRP : FR : R extends Promise<any> ? FlowYield : R>;
11
+ export declare type IfAllAreFlowYieldThenVoid<R> = Exclude<R, FlowYield> extends never ? void : Exclude<R, FlowYield>;
12
+ export declare function flow<R, Args extends any[]>(generator: (...args: Args) => IterableIterator<R>): (...args: Args) => CancellablePromise<FlowReturnType<R>>;
@@ -1,7 +1,8 @@
1
- import { IObservableArray, IObservableValue, Lambda, ObservableMap } from "../internal";
1
+ import { IObservableArray, IObservableValue, Lambda, ObservableMap, ObservableSet } from "../internal";
2
2
  export declare type ReadInterceptor<T> = (value: any) => T;
3
3
  /** Experimental feature right now, tested indirectly via Mobx-State-Tree */
4
4
  export declare function interceptReads<T>(value: IObservableValue<T>, handler: ReadInterceptor<T>): Lambda;
5
5
  export declare function interceptReads<T>(observableArray: IObservableArray<T>, handler: ReadInterceptor<T>): Lambda;
6
6
  export declare function interceptReads<K, V>(observableMap: ObservableMap<K, V>, handler: ReadInterceptor<V>): Lambda;
7
+ export declare function interceptReads<V>(observableSet: ObservableSet<V>, handler: ReadInterceptor<V>): Lambda;
7
8
  export declare function interceptReads(object: Object, property: string, handler: ReadInterceptor<any>): Lambda;
@@ -1,7 +1,8 @@
1
- import { IArrayWillChange, IArrayWillSplice, IInterceptor, IMapWillChange, IObjectWillChange, IObservableArray, IObservableValue, IValueWillChange, Lambda, ObservableMap } from "../internal";
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
4
  export declare function intercept<K, V>(observableMap: ObservableMap<K, V>, handler: IInterceptor<IMapWillChange<K, V>>): Lambda;
5
+ export declare function intercept<V>(observableMap: ObservableSet<V>, handler: IInterceptor<ISetWillChange<V>>): Lambda;
5
6
  export declare function intercept<K, V>(observableMap: ObservableMap<K, V>, property: K, handler: IInterceptor<IValueWillChange<V>>): Lambda;
6
7
  export declare function intercept(object: Object, handler: IInterceptor<IObjectWillChange>): Lambda;
7
8
  export declare function intercept<T extends Object, K extends keyof T>(object: T, property: K, handler: IInterceptor<IValueWillChange<any>>): Lambda;
@@ -1,11 +1,14 @@
1
- import { IObservableArray, ObservableMap } from "../internal";
1
+ import { IObservableArray, ObservableMap, ObservableSet } from "../internal";
2
2
  export declare function keys<K>(map: ObservableMap<K, any>): ReadonlyArray<K>;
3
3
  export declare function keys<T>(ar: IObservableArray<T>): ReadonlyArray<number>;
4
+ export declare function keys<T>(set: ObservableSet<T>): ReadonlyArray<T>;
4
5
  export declare function keys<T extends Object>(obj: T): ReadonlyArray<string>;
5
6
  export declare function values<K, T>(map: ObservableMap<K, T>): ReadonlyArray<T>;
7
+ export declare function values<T>(set: ObservableSet<T>): ReadonlyArray<T>;
6
8
  export declare function values<T>(ar: IObservableArray<T>): ReadonlyArray<T>;
7
9
  export declare function values<T = any>(obj: T): ReadonlyArray<any>;
8
10
  export declare function entries<K, T>(map: ObservableMap<K, T>): ReadonlyArray<[K, T]>;
11
+ export declare function entries<T>(set: ObservableSet<T>): ReadonlyArray<[T, T]>;
9
12
  export declare function entries<T>(ar: IObservableArray<T>): ReadonlyArray<[number, T]>;
10
13
  export declare function entries<T = any>(obj: T): ReadonlyArray<[string, any]>;
11
14
  export declare function set<V>(obj: ObservableMap<string, V>, values: {
@@ -18,9 +21,11 @@ export declare function set<T extends Object>(obj: T, values: {
18
21
  }): any;
19
22
  export declare function set<T extends Object>(obj: T, key: string, value: any): any;
20
23
  export declare function remove<K, V>(obj: ObservableMap<K, V>, key: K): any;
24
+ export declare function remove<T>(obj: ObservableSet<T>, key: T): any;
21
25
  export declare function remove<T>(obj: IObservableArray<T>, index: number): any;
22
26
  export declare function remove<T extends Object>(obj: T, key: string): any;
23
27
  export declare function has<K>(obj: ObservableMap<K, any>, key: K): boolean;
28
+ export declare function has<T>(obj: ObservableSet<T>, key: T): boolean;
24
29
  export declare function has<T>(obj: IObservableArray<T>, index: number): boolean;
25
30
  export declare function has<T extends Object>(obj: T, key: string): boolean;
26
31
  export declare function get<K, V>(obj: ObservableMap<K, V>, key: K): V | undefined;
@@ -1,6 +1,7 @@
1
- import { IEnhancer, IObservableArray, IObservableDecorator, IObservableMapInitialValues, IObservableObject, IObservableValue, ObservableMap } from "../internal";
1
+ import { IEnhancer, IEqualsComparer, IObservableArray, IObservableDecorator, IObservableMapInitialValues, IObservableSetInitialValues, IObservableObject, IObservableValue, ObservableMap, ObservableSet } from "../internal";
2
2
  export declare type CreateObservableOptions = {
3
3
  name?: string;
4
+ equals?: IEqualsComparer<any>;
4
5
  deep?: boolean;
5
6
  defaultDecorator?: IObservableDecorator;
6
7
  proxy?: boolean;
@@ -21,6 +22,7 @@ export interface IObservableFactory {
21
22
  export interface IObservableFactories {
22
23
  box<T = any>(value?: T, options?: CreateObservableOptions): IObservableValue<T>;
23
24
  array<T = any>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T>;
25
+ set<T = any>(initialValues?: IObservableSetInitialValues<T>, options?: CreateObservableOptions): ObservableSet<T>;
24
26
  map<K = any, V = any>(initialValues?: IObservableMapInitialValues<K, V>, options?: CreateObservableOptions): ObservableMap<K, V>;
25
27
  object<T = any>(props: T, decorators?: {
26
28
  [K in keyof T]?: Function;
@@ -1,6 +1,7 @@
1
- import { IArrayChange, IArraySplice, IComputedValue, IMapDidChange, IObjectDidChange, IObservableArray, IObservableValue, IValueDidChange, Lambda, ObservableMap } from "../internal";
1
+ import { IArrayChange, IArraySplice, 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: IArrayChange<T> | IArraySplice<T>) => void, fireImmediately?: boolean): Lambda;
4
+ export declare function observe<V>(observableMap: ObservableSet<V>, listener: (change: ISetDidChange<V>) => void, fireImmediately?: boolean): Lambda;
4
5
  export declare function observe<K, V>(observableMap: ObservableMap<K, V>, listener: (change: IMapDidChange<K, V>) => void, fireImmediately?: boolean): Lambda;
5
6
  export declare function observe<K, V>(observableMap: ObservableMap<K, V>, property: K, listener: (change: IValueDidChange<V>) => void, fireImmediately?: boolean): Lambda;
6
7
  export declare function observe(object: Object, listener: (change: IObjectDidChange) => void, fireImmediately?: boolean): Lambda;
@@ -1,4 +1,5 @@
1
1
  import { IDerivationState, IObservable } from "../internal";
2
+ import { Lambda } from "../utils/utils";
2
3
  export declare const $mobx: unique symbol;
3
4
  export interface IAtom extends IObservable {
4
5
  reportObserved(): any;
@@ -17,8 +18,10 @@ 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);
20
- onBecomeUnobserved(): void;
21
+ onBecomeObservedListeners: Set<Lambda> | undefined;
22
+ onBecomeUnobservedListeners: Set<Lambda> | undefined;
21
23
  onBecomeObserved(): void;
24
+ onBecomeUnobserved(): void;
22
25
  /**
23
26
  * Invoke this method to notify mobx that your atom has been used somehow.
24
27
  * Returns true if there is currently a reactive context.
@@ -57,7 +57,6 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
57
57
  private equals;
58
58
  private requiresReaction;
59
59
  private keepAlive;
60
- private firstGet;
61
60
  /**
62
61
  * Create a new computed value based on a function expression.
63
62
  *
@@ -72,8 +71,10 @@ export declare class ComputedValue<T> implements IObservable, IComputedValue<T>,
72
71
  */
73
72
  constructor(options: IComputedValueOptions<T>);
74
73
  onBecomeStale(): void;
75
- onBecomeUnobserved(): void;
74
+ onBecomeObservedListeners: Set<Lambda> | undefined;
75
+ onBecomeUnobservedListeners: Set<Lambda> | undefined;
76
76
  onBecomeObserved(): void;
77
+ onBecomeUnobserved(): void;
77
78
  /**
78
79
  * Returns the current value of this computed value.
79
80
  * Will evaluate its computation first if needed.
@@ -1,4 +1,5 @@
1
1
  import { IDerivation, IObservable, Reaction } from "../internal";
2
+ export declare type IUNCHANGED = {};
2
3
  export declare class MobXGlobals {
3
4
  /**
4
5
  * MobXGlobals version.
@@ -9,6 +10,10 @@ export declare class MobXGlobals {
9
10
  * internal state storage of MobX, and can be the same across many different package versions
10
11
  */
11
12
  version: number;
13
+ /**
14
+ * globally unique token to signal unchanged
15
+ */
16
+ UNCHANGED: IUNCHANGED;
12
17
  /**
13
18
  * Currently running derivation
14
19
  */
@@ -69,6 +74,7 @@ export declare class MobXGlobals {
69
74
  */
70
75
  computedRequiresReaction: boolean;
71
76
  disableErrorBoundaries: boolean;
77
+ suppressReactionErrors: boolean;
72
78
  }
73
79
  export declare let globalState: MobXGlobals;
74
80
  export declare function isolateGlobalState(): void;
@@ -1,4 +1,4 @@
1
- import { IDerivation, IDerivationState } from "../internal";
1
+ import { Lambda, IDerivation, IDerivationState } from "../internal";
2
2
  export interface IDepTreeNode {
3
3
  name: string;
4
4
  observing?: IObservable[];
@@ -17,6 +17,8 @@ export interface IObservable extends IDepTreeNode {
17
17
  observers: Set<IDerivation>;
18
18
  onBecomeUnobserved(): void;
19
19
  onBecomeObserved(): void;
20
+ onBecomeUnobservedListeners: Set<Lambda> | undefined;
21
+ onBecomeObservedListeners: Set<Lambda> | undefined;
20
22
  }
21
23
  export declare function hasObservers(observable: IObservable): boolean;
22
24
  export declare function getObservers(observable: IObservable): Set<IDerivation>;
package/lib/internal.d.ts CHANGED
@@ -38,6 +38,7 @@ export * from "./types/intercept-utils";
38
38
  export * from "./types/listen-utils";
39
39
  export * from "./types/observablearray";
40
40
  export * from "./types/observablemap";
41
+ export * from "./types/observableset";
41
42
  export * from "./types/observableobject";
42
43
  export * from "./types/type-utils";
43
44
  export * from "./utils/eq";
package/lib/mobx.d.ts CHANGED
@@ -15,4 +15,4 @@
15
15
  * - utils/ Utility stuff.
16
16
  *
17
17
  */
18
- export { IObservable, IDepTreeNode, Reaction, IReactionPublic, IReactionDisposer, IDerivation, untracked, IDerivationState, IAtom, createAtom, IAction, spy, IComputedValue, IEqualsComparer, comparer, IEnhancer, IInterceptable, IInterceptor, IListenable, IObjectWillChange, IObjectDidChange, IObservableObject, isObservableObject, IValueDidChange, IValueWillChange, IObservableValue, isObservableValue as isBoxedObservable, IObservableArray, IArrayWillChange, IArrayWillSplice, IArrayChange, IArraySplice, isObservableArray, IKeyValueMap, ObservableMap, IMapEntries, IMapEntry, IMapWillChange, IMapDidChange, isObservableMap, IObservableMapInitialValues, transaction, observable, IObservableFactory, IObservableFactories, computed, IComputed, isObservable, isObservableProp, isComputed, isComputedProp, extendObservable, observe, intercept, autorun, IAutorunOptions, reaction, IReactionOptions, when, IWhenOptions, action, isAction, runInAction, IActionFactory, keys, values, entries, set, remove, has, get, decorate, configure, onBecomeObserved, onBecomeUnobserved, flow, toJS, trace, IObserverTree, IDependencyTree, getDependencyTree, getObserverTree, resetGlobalState as _resetGlobalState, getGlobalState as _getGlobalState, getDebugName, getAtom, getAdministration as _getAdministration, allowStateChanges as _allowStateChanges, allowStateChangesInsideComputed as _allowStateChangesInsideComputed, Lambda, isArrayLike, $mobx, isComputingDerivation as _isComputingDerivation, onReactionError, interceptReads as _interceptReads, IComputedValueOptions } from "./internal";
18
+ export { IObservable, IDepTreeNode, Reaction, IReactionPublic, IReactionDisposer, IDerivation, untracked, IDerivationState, IAtom, createAtom, IAction, spy, IComputedValue, IEqualsComparer, comparer, IEnhancer, IInterceptable, IInterceptor, IListenable, IObjectWillChange, IObjectDidChange, IObservableObject, isObservableObject, IValueDidChange, IValueWillChange, IObservableValue, isObservableValue as isBoxedObservable, IObservableArray, IArrayWillChange, IArrayWillSplice, IArrayChange, IArraySplice, isObservableArray, IKeyValueMap, ObservableMap, IMapEntries, IMapEntry, IMapWillChange, IMapDidChange, isObservableMap, IObservableMapInitialValues, ObservableSet, isObservableSet, ISetDidChange, ISetWillChange, IObservableSetInitialValues, transaction, observable, IObservableFactory, IObservableFactories, computed, IComputed, isObservable, isObservableProp, isComputed, isComputedProp, extendObservable, observe, intercept, autorun, IAutorunOptions, reaction, IReactionOptions, when, IWhenOptions, action, isAction, runInAction, IActionFactory, keys, values, entries, set, remove, has, get, decorate, configure, onBecomeObserved, onBecomeUnobserved, flow, toJS, trace, IObserverTree, IDependencyTree, getDependencyTree, getObserverTree, resetGlobalState as _resetGlobalState, getGlobalState as _getGlobalState, getDebugName, getAtom, getAdministration as _getAdministration, allowStateChanges as _allowStateChanges, allowStateChangesInsideComputed as _allowStateChangesInsideComputed, Lambda, isArrayLike, $mobx, isComputingDerivation as _isComputingDerivation, onReactionError, interceptReads as _interceptReads, IComputedValueOptions } from "./internal";