mobx 4.15.3 → 4.15.7

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +19 -10
  3. package/lib/api/action.d.ts +13 -13
  4. package/lib/api/actiondecorator.d.ts +27 -27
  5. package/lib/api/autorun.d.ts +24 -24
  6. package/lib/api/become-observed.d.ts +5 -5
  7. package/lib/api/computed.d.ts +14 -14
  8. package/lib/api/configure.d.ts +19 -19
  9. package/lib/api/decorate.d.ts +6 -6
  10. package/lib/api/extendobservable.d.ts +7 -7
  11. package/lib/api/extras.d.ts +10 -10
  12. package/lib/api/flow.d.ts +9 -9
  13. package/lib/api/intercept-read.d.ts +8 -8
  14. package/lib/api/intercept.d.ts +8 -8
  15. package/lib/api/iscomputed.d.ts +3 -3
  16. package/lib/api/isobservable.d.ts +2 -2
  17. package/lib/api/object-api.d.ts +34 -34
  18. package/lib/api/observable.d.ts +54 -54
  19. package/lib/api/observabledecorator.d.ts +6 -6
  20. package/lib/api/observe.d.ts +8 -8
  21. package/lib/api/tojs.d.ts +11 -11
  22. package/lib/api/trace.d.ts +3 -3
  23. package/lib/api/transaction.d.ts +8 -8
  24. package/lib/api/when.d.ts +15 -15
  25. package/lib/core/action.d.ts +22 -22
  26. package/lib/core/atom.d.ts +40 -40
  27. package/lib/core/computedvalue.d.ts +93 -93
  28. package/lib/core/derivation.d.ts +74 -74
  29. package/lib/core/globalstate.d.ts +106 -106
  30. package/lib/core/observable.d.ts +44 -44
  31. package/lib/core/reaction.d.ts +63 -63
  32. package/lib/core/spy.d.ts +6 -6
  33. package/lib/index.js +7 -0
  34. package/lib/internal.d.ts +44 -44
  35. package/lib/mobx.d.ts +19 -19
  36. package/lib/mobx.es6.js +4436 -4293
  37. package/lib/mobx.js +4520 -4387
  38. package/lib/mobx.min.js +15 -1
  39. package/lib/mobx.module.js +4535 -4388
  40. package/lib/mobx.umd.js +4536 -4389
  41. package/lib/mobx.umd.min.js +15 -1
  42. package/lib/types/intercept-utils.d.ts +9 -9
  43. package/lib/types/listen-utils.d.ts +8 -8
  44. package/lib/types/modifiers.d.ts +7 -7
  45. package/lib/types/observablearray.d.ts +78 -78
  46. package/lib/types/observablemap.d.ts +83 -83
  47. package/lib/types/observableobject.d.ts +65 -65
  48. package/lib/types/observableset.d.ts +49 -49
  49. package/lib/types/observablevalue.d.ts +37 -37
  50. package/lib/types/type-utils.d.ts +4 -4
  51. package/lib/utils/comparer.d.ts +14 -14
  52. package/lib/utils/decorators2.d.ts +7 -7
  53. package/lib/utils/eq.d.ts +1 -1
  54. package/lib/utils/iterable.d.ts +5 -5
  55. package/lib/utils/utils.d.ts +42 -43
  56. package/package.json +3 -13
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ # UNPUBLISHED (keep this here and add unpublished changes)
2
+
3
+ # 5.15.7 / 4.15.7
4
+
5
+ - Fixed [2438](https://github.com/mobxjs/mobx/issues/2438), factory types caused eslint warnings, by [@amareis](https://github.com/Amareis) through [2439](https://github.com/mobxjs/mobx/pull/2439)
6
+ - Fixed [2432](https://github.com/mobxjs/mobx/issues/2423), array.reduce without initial value by [@urugator](https://github.com/urugator)
7
+
8
+ # 5.15.6 / 4.15.6
9
+
10
+ - Fixed [2423](https://github.com/mobxjs/mobx/issues/2423), array methods not dehancing by [@urugator](https://github.com/urugator)
11
+ - Fixed [2424](https://github.com/mobxjs/mobx/issues/2424) Map / Set instantiation triggering a strict warning, through [#2425](https://github.com/mobxjs/mobx/pull/2425) by [@moonball](https://github.com/moonball)
12
+
13
+ # 5.15.5 / 4.15.5
14
+
15
+ - Fixed ObservableSet.prototype.forEach not being reactive in 4.x [#2341](https://github.com/mobxjs/mobx/pull/2341) by [@melnikov-s](https://github.com/melnikov-s)
16
+ - Add error when computed value declared for unspecified getter [#1867](https://github.com/mobxjs/mobx/issues/1867) by [@berrunder](https://github.com/berrunder)
17
+ - Fixed [#2326](https://github.com/mobxjs/mobx/issues/2326) correct array is passed to callbacks by [@urugator](https://github.com/urugator)
18
+ - Fixed [#2278](https://github.com/mobxjs/mobx/issues/2278), `map.delete` should respect strict mode, by [@urugator](https://github.com/urugator)
19
+ - Fixed [#2253](https://github.com/mobxjs/mobx/issues/2253), [#1980](https://github.com/mobxjs/mobx/issues/1980), map key order not always preserved by [@urugator](https://github.com/urugator)
20
+ - Fixed [#2412](https://github.com/mobxjs/mobx/issues/2412), non-enumerable getters not being picked up by `extendObservable` by [@urugator](https://github.com/urugator)
21
+
22
+ - Several performance improvements
23
+ - Dropped `browser` fields from `package.json`
24
+
25
+ # 5.15.4 / 4.15.4
26
+
27
+ - Fix process.env replacement in build [#2267](https://github.com/mobxjs/mobx/pull/2267) by [@fredyc](https://github.com/fredyc)
28
+
1
29
  # 5.15.3 / 4.15.3
2
30
 
3
31
  - Define action name to be as the function name [#2262](https://github.com/mobxjs/mobx/pull/2262) by [@nadavkaner](https://github.com/nadavkaner)
package/README.md CHANGED
@@ -7,32 +7,35 @@ _Simple, scalable state management_
7
7
  [![CircleCI](https://circleci.com/gh/mobxjs/mobx.svg?style=svg)](https://circleci.com/gh/mobxjs/mobx)
8
8
  [![Coverage Status](https://coveralls.io/repos/mobxjs/mobx/badge.svg?branch=master&service=github)](https://coveralls.io/github/mobxjs/mobx?branch=master)
9
9
  [![Join the chat at https://gitter.im/mobxjs/mobx](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mobxjs/mobx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10
+ [![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/mobx)
10
11
  [![Discuss MobX on Hashnode](https://hashnode.github.io/badges/mobx.svg)](https://hashnode.com/n/mobx)
11
12
  [![OpenCollective](https://opencollective.com/mobx/backers/badge.svg)](#backers)
12
13
  [![OpenCollective](https://opencollective.com/mobx/sponsors/badge.svg)](#sponsors)
13
14
  [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
15
+ [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/mobxjs/mobx)
14
16
 
15
17
  MobX is proudly sponsored by Mendix, Coinbase, Facebook Open Source, Canva, Algolia, Guilded, Auction Frontier, Mantro and TalentPlot for 100\$/month or more! And beyond that by many [individual backers](#backers) and through [one time contributions](https://github.com/mobxjs/mobx/blob/master/sponsors.md).
16
18
 
17
- **🥇Gold sponsors (\$250+ pm):** <br/>
19
+ **🥇Gold sponsors (\$3000+ total contribution):** <br/>
18
20
  <a href="https://mendix.com/"><img src="docs/assets/mendix-logo.png" align="center" width="100" title="Mendix" alt="Mendix" /></a>
21
+ <a href="https://frontendmasters.com/"><img src="docs/assets/frontendmasters.jpg" align="center" width="100" title="Frontend Masters" alt="Frontend Masters"></a>
22
+ <a href="https://opensource.facebook.com/"><img src="docs/assets/fbos.jpeg" align="center" width="100" title="Facebook Open Source" alt="Facebook Open Source" /></a>
19
23
  <a href="http://auctionfrontier.com/"><img src="docs/assets/auctionfrontier.jpeg" align="center" width="100" title="Auction Frontier" alt="Auction Frontier"></a>
24
+ <a href="https://www.guilded.gg/"><img src="docs/assets/guilded.jpg" align="center" width="100" title="Guilded" alt="Guilded" /></a>
25
+ <a href="https://coinbase.com/"><img src="docs/assets/coinbase.jpeg" align="center" width="100" title="Coinbase" alt="Coinbase" /></a>
26
+ <a href="https://www.canva.com/"><img src="docs/assets/canva.png" align="center" width="100" title="Canva" alt="Canva" /></a>
20
27
 
21
28
  **🥈Silver sponsors (\$100+ pm):**<br/>
22
- <a href="https://opensource.facebook.com/"><img src="docs/assets/fbos.jpeg" align="center" width="100" title="Facebook Open Source" alt="Facebook Open Source" /></a>
23
- <a href="https://www.canva.com/"><img src="docs/assets/canva.png" align="center" width="100" title="Canva" alt="Canva" /></a>
24
- <a href="https://www.guilded.gg/"><img src="docs/assets/guilded.jpg" align="center" width="100" title="Guilded" alt="Guilded" /></a>
25
29
  <a href="https://mantro.net/jobs/warlock"><img src="docs/assets/mantro.png" align="center" width="100" title="mantro GmbH" alt="mantro GmbH"></a>
26
30
  <a href="https://www.codefirst.co.uk/"><img src="docs/assets/codefirst.png" align="center" width="100" title="CodeFirst" alt="CodeFirst"/></a>
27
- <a href="https://blokt.com/"><img src="docs/assets/blokt.jpg" align="center" width="100" title="Blokt" alt="Blokt"/></a>
28
31
  <a href="https://www.bugsnag.com/platforms/react-error-reporting?utm_source=MobX&utm_medium=Website&utm_content=open-source&utm_campaign=2019-community&utm_term=20190913"><img src="docs/assets/bugsnag.jpg" align="center" width="100" title="Bugsnag" alt="Bugsnag"/></a>
32
+ <a href="https://curology.com/blog/tech"><img src="docs/assets/curology.png" align="center" width="100" title="Curology" alt="Curology"/></a>
29
33
 
30
34
  **🥉Bronze sponsors (\$500+ total contributions):**<br/>
31
- <a href="https://coinbase.com/"><img src="docs/assets/coinbase.jpeg" align="center" width="100" title="Coinbase" alt="Coinbase" /></a>
32
35
  <a href="https://www.algolia.com/"><img src="docs/assets/algolia.jpg" align="center" width="100" title="Algolia" alt="Algolia" /></a>
33
36
  <a href="https://talentplot.com/"><img src="docs/assets/talentplot.png" align="center" width="100" title="talentplot" alt="talentplot"></a>
34
- <a href="https://frontendmasters.com/"><img src="docs/assets/frontendmasters.jpg" align="center" width="100" title="Frontend Masters" alt="Frontend Masters"></a>
35
37
  <a href="https://careers.dazn.com/"><img src="docs/assets/dazn.png" align="center" width="100" title="DAZN" alt="DAZN"></a>
38
+ <a href="https://blokt.com/"><img src="docs/assets/blokt.jpg" align="center" width="100" title="Blokt" alt="Blokt"/></a>
36
39
 
37
40
  # Installation
38
41
 
@@ -118,8 +121,8 @@ class Todo {
118
121
  }
119
122
  ```
120
123
 
121
- Using `observable` is like turning a property of an object into a spreadsheet cell.
122
- But, unlike spreadsheets, these values can be not only primitive values, but also references, objects and arrays.
124
+ Using `observable` is like turning a property of an object into a spreadsheet cell that when modified may cause other cells to automatically recalculate, a graph to be re-rendered, or trigger other interesting reactions.
125
+ Unlike spreadsheet cells, `observable` values can be not only primitive values, but also references, objects and arrays.
123
126
 
124
127
  If your environment doesn't support decorator syntax, don't worry.
125
128
  You can read [here](http://mobxjs.github.io/mobx/best/decorators.html) about how to set them up.
@@ -345,6 +348,12 @@ And finally, kudos to all the people that believed in, tried, validated and even
345
348
  - and `yarn test:performance` for the performance tests.
346
349
  - Please note that if you want to backport a feature / fix to MobX 4 a second PR needs to be opened to the mobx4-master branch.
347
350
 
351
+ ## Online one-click setup for contributing
352
+
353
+ You can use Gitpod (a free online VS Code-like IDE) for working on issues and making PRs. With a single click it will launch a ready to code workspace with everything setup so that you can start straight away.
354
+
355
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)
356
+
348
357
  # MobX 4 vs MobX 5
349
358
 
350
359
  The difference between MobX 4 and MobX 5 is that the latter uses Proxies to do property tracking. As a consequence, MobX 5 runs only on Proxy supporting browsers, in contrast to MobX 4 that runs on any ES 5 environment.
@@ -352,7 +361,7 @@ The difference between MobX 4 and MobX 5 is that the latter uses Proxies to do p
352
361
  The most notable limitations of MobX 4:
353
362
 
354
363
  - Observable arrays are not real arrays, so they won't pass the `Array.isArray()` check. The practical consequence is that you often need to `.slice()` the array first (to get a real array shallow copy) before passing to third party libraries.
355
- - Adding properties to existing observable objects after creation is not automatically picked up. Instead, either use observable maps or use the the built-in [utility functions](https://mobx.js.org/refguide/object-api.html) to read / write / iterate objects that you want to dynamically add properties to.
364
+ - Adding properties to existing observable objects after creation is not automatically picked up. Instead, either use observable maps or use the built-in [utility functions](https://mobx.js.org/refguide/object-api.html) to read / write / iterate objects that you want to dynamically add properties to.
356
365
 
357
366
  For more details see the [caveats page](https://mobx.js.org/best/pitfalls.html).
358
367
 
@@ -1,13 +1,13 @@
1
- import { IAction } from "../internal";
2
- export interface IActionFactory {
3
- <T extends Function | null | undefined>(fn: T): T & IAction;
4
- <T extends Function | null | undefined>(name: string, fn: T): T & IAction;
5
- (customName: string): (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor) => void;
6
- (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): void;
7
- bound(target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): void;
8
- }
9
- export declare const action: IActionFactory;
10
- export declare function runInAction<T>(block: () => T): T;
11
- export declare function runInAction<T>(name: string, block: () => T): T;
12
- export declare function isAction(thing: any): boolean;
13
- export declare function defineBoundAction(target: any, propertyName: string, fn: Function): void;
1
+ import { IAction } from "../internal";
2
+ export interface IActionFactory {
3
+ <T extends Function | null | undefined>(fn: T): T & IAction;
4
+ <T extends Function | null | undefined>(name: string, fn: T): T & IAction;
5
+ (customName: string): (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor) => void;
6
+ (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor): void;
7
+ bound: (target: Object, propertyKey: string | symbol, descriptor?: PropertyDescriptor) => void;
8
+ }
9
+ export declare const action: IActionFactory;
10
+ export declare function runInAction<T>(block: () => T): T;
11
+ export declare function runInAction<T>(name: string, block: () => T): T;
12
+ export declare function isAction(thing: any): boolean;
13
+ export declare function defineBoundAction(target: any, propertyName: string, fn: Function): void;
@@ -1,27 +1,27 @@
1
- import { BabelDescriptor } from "../internal";
2
- declare function dontReassignFields(): void;
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
- };
15
- export declare function actionFieldDecorator(name: string): (target: any, prop: any, descriptor: any) => void;
16
- export declare function boundActionDecorator(target: any, propertyName: any, descriptor: any, applyToInstance?: boolean): {
17
- configurable: boolean;
18
- enumerable: boolean;
19
- get(): any;
20
- set: typeof dontReassignFields;
21
- } | {
22
- enumerable: boolean;
23
- configurable: boolean;
24
- set(v: any): void;
25
- get(): undefined;
26
- } | null;
27
- export {};
1
+ import { BabelDescriptor } from "../internal";
2
+ declare function dontReassignFields(): void;
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
+ };
15
+ export declare function actionFieldDecorator(name: string): (target: any, prop: any, descriptor: any) => void;
16
+ export declare function boundActionDecorator(target: any, propertyName: any, descriptor: any, applyToInstance?: boolean): {
17
+ configurable: boolean;
18
+ enumerable: boolean;
19
+ get(): any;
20
+ set: typeof dontReassignFields;
21
+ } | {
22
+ enumerable: boolean;
23
+ configurable: boolean;
24
+ set(v: any): void;
25
+ get(): undefined;
26
+ } | null;
27
+ export {};
@@ -1,24 +1,24 @@
1
- import { IReactionPublic, IReactionDisposer, IEqualsComparer } from "../internal";
2
- export interface IAutorunOptions {
3
- delay?: number;
4
- name?: string;
5
- /**
6
- * Experimental.
7
- * Warns if the view doesn't track observables
8
- */
9
- requiresObservable?: boolean;
10
- scheduler?: (callback: () => void) => any;
11
- onError?: (error: any) => void;
12
- }
13
- /**
14
- * Creates a named reactive view and keeps it alive, so that the view is always
15
- * updated if one of the dependencies changes, even when the view is not further used by something else.
16
- * @param view The reactive view
17
- * @returns disposer function, which can be used to stop the view from being updated in the future.
18
- */
19
- export declare function autorun(view: (r: IReactionPublic) => any, opts?: IAutorunOptions): IReactionDisposer;
20
- export declare type IReactionOptions = IAutorunOptions & {
21
- fireImmediately?: boolean;
22
- equals?: IEqualsComparer<any>;
23
- };
24
- export declare function reaction<T>(expression: (r: IReactionPublic) => T, effect: (arg: T, r: IReactionPublic) => void, opts?: IReactionOptions): IReactionDisposer;
1
+ import { IReactionPublic, IReactionDisposer, IEqualsComparer } from "../internal";
2
+ export interface IAutorunOptions {
3
+ delay?: number;
4
+ name?: string;
5
+ /**
6
+ * Experimental.
7
+ * Warns if the view doesn't track observables
8
+ */
9
+ requiresObservable?: boolean;
10
+ scheduler?: (callback: () => void) => any;
11
+ onError?: (error: any) => void;
12
+ }
13
+ /**
14
+ * Creates a named reactive view and keeps it alive, so that the view is always
15
+ * updated if one of the dependencies changes, even when the view is not further used by something else.
16
+ * @param view The reactive view
17
+ * @returns disposer function, which can be used to stop the view from being updated in the future.
18
+ */
19
+ export declare function autorun(view: (r: IReactionPublic) => any, opts?: IAutorunOptions): IReactionDisposer;
20
+ export declare type IReactionOptions = IAutorunOptions & {
21
+ fireImmediately?: boolean;
22
+ equals?: IEqualsComparer<any>;
23
+ };
24
+ export declare function reaction<T>(expression: (r: IReactionPublic) => T, effect: (arg: T, r: IReactionPublic) => void, opts?: IReactionOptions): IReactionDisposer;
@@ -1,5 +1,5 @@
1
- import { IObservableArray, IObservable, IComputedValue, ObservableMap, ObservableSet, Lambda } from "../internal";
2
- export declare function onBecomeObserved(value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any> | ObservableSet<any>, listener: Lambda): Lambda;
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> | ObservableSet<any>, listener: Lambda): Lambda;
5
- export declare function onBecomeUnobserved<K, V = any>(value: ObservableMap<K, V> | Object, property: K, listener: Lambda): Lambda;
1
+ import { IObservableArray, IObservable, IComputedValue, ObservableMap, ObservableSet, Lambda } from "../internal";
2
+ export declare function onBecomeObserved(value: IObservable | IComputedValue<any> | IObservableArray<any> | ObservableMap<any, any> | ObservableSet<any>, listener: Lambda): Lambda;
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> | ObservableSet<any>, listener: Lambda): Lambda;
5
+ export declare function onBecomeUnobserved<K, V = any>(value: ObservableMap<K, V> | Object, property: K, listener: Lambda): Lambda;
@@ -1,14 +1,14 @@
1
- import { IComputedValueOptions, IComputedValue } from "../internal";
2
- export interface IComputed {
3
- <T>(options: IComputedValueOptions<T>): any;
4
- <T>(func: () => T, setter: (v: T) => void): IComputedValue<T>;
5
- <T>(func: () => T, options?: IComputedValueOptions<T>): IComputedValue<T>;
6
- (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor): void;
7
- struct(target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor): void;
8
- }
9
- export declare const computedDecorator: Function;
10
- /**
11
- * Decorator for class properties: @computed get value() { return expr; }.
12
- * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
13
- */
14
- export declare const computed: IComputed;
1
+ import { IComputedValueOptions, IComputedValue } from "../internal";
2
+ export interface IComputed {
3
+ <T>(options: IComputedValueOptions<T>): any;
4
+ <T>(func: () => T, setter: (v: T) => void): IComputedValue<T>;
5
+ <T>(func: () => T, options?: IComputedValueOptions<T>): IComputedValue<T>;
6
+ (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor): void;
7
+ struct: (target: Object, key: string | symbol, baseDescriptor?: PropertyDescriptor) => void;
8
+ }
9
+ export declare const computedDecorator: Function;
10
+ /**
11
+ * Decorator for class properties: @computed get value() { return expr; }.
12
+ * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`;
13
+ */
14
+ export declare const computed: IComputed;
@@ -1,19 +1,19 @@
1
- export declare function configure(options: {
2
- enforceActions?: boolean | "strict" | "never" | "always" | "observed";
3
- computedRequiresReaction?: boolean;
4
- /**
5
- * (Experimental)
6
- * Warn if you try to create to derivation / reactive context without accessing any observable.
7
- */
8
- reactionRequiresObservable?: boolean;
9
- /**
10
- * (Experimental)
11
- * Warn if observables are accessed outside a reactive context
12
- */
13
- observableRequiresReaction?: boolean;
14
- computedConfigurable?: boolean;
15
- isolateGlobalState?: boolean;
16
- disableErrorBoundaries?: boolean;
17
- arrayBuffer?: number;
18
- reactionScheduler?: (f: () => void) => void;
19
- }): void;
1
+ export declare function configure(options: {
2
+ enforceActions?: boolean | "strict" | "never" | "always" | "observed";
3
+ computedRequiresReaction?: boolean;
4
+ /**
5
+ * (Experimental)
6
+ * Warn if you try to create to derivation / reactive context without accessing any observable.
7
+ */
8
+ reactionRequiresObservable?: boolean;
9
+ /**
10
+ * (Experimental)
11
+ * Warn if observables are accessed outside a reactive context
12
+ */
13
+ observableRequiresReaction?: boolean;
14
+ computedConfigurable?: boolean;
15
+ isolateGlobalState?: boolean;
16
+ disableErrorBoundaries?: boolean;
17
+ arrayBuffer?: number;
18
+ reactionScheduler?: (f: () => void) => void;
19
+ }): void;
@@ -1,6 +1,6 @@
1
- export declare function decorate<T>(clazz: new (...args: any[]) => T, decorators: {
2
- [P in keyof T]?: MethodDecorator | PropertyDecorator | Array<MethodDecorator> | Array<PropertyDecorator>;
3
- }): void;
4
- export declare function decorate<T>(object: T, decorators: {
5
- [P in keyof T]?: MethodDecorator | PropertyDecorator | Array<MethodDecorator> | Array<PropertyDecorator>;
6
- }): T;
1
+ export declare function decorate<T>(clazz: new (...args: any[]) => T, decorators: {
2
+ [P in keyof T]?: MethodDecorator | PropertyDecorator | Array<MethodDecorator> | Array<PropertyDecorator>;
3
+ }): void;
4
+ export declare function decorate<T>(object: T, decorators: {
5
+ [P in keyof T]?: MethodDecorator | PropertyDecorator | Array<MethodDecorator> | Array<PropertyDecorator>;
6
+ }): T;
@@ -1,7 +1,7 @@
1
- import { CreateObservableOptions } from "../internal";
2
- export declare function extendShallowObservable<A extends Object, B extends Object>(target: A, properties: B, decorators?: {
3
- [K in keyof B]?: Function;
4
- }): A & B;
5
- export declare function extendObservable<A extends Object, B extends Object>(target: A, properties: B, decorators?: {
6
- [K in keyof B]?: Function;
7
- }, options?: CreateObservableOptions): A & B;
1
+ import { CreateObservableOptions } from "../internal";
2
+ export declare function extendShallowObservable<A extends Object, B extends Object>(target: A, properties: B, decorators?: {
3
+ [K in keyof B]?: Function;
4
+ }): A & B;
5
+ export declare function extendObservable<A extends Object, B extends Object>(target: A, properties: B, decorators?: {
6
+ [K in keyof B]?: Function;
7
+ }, options?: CreateObservableOptions): A & B;
@@ -1,10 +1,10 @@
1
- export interface IDependencyTree {
2
- name: string;
3
- dependencies?: IDependencyTree[];
4
- }
5
- export interface IObserverTree {
6
- name: string;
7
- observers?: IObserverTree[];
8
- }
9
- export declare function getDependencyTree(thing: any, property?: string): IDependencyTree;
10
- export declare function getObserverTree(thing: any, property?: string): IObserverTree;
1
+ export interface IDependencyTree {
2
+ name: string;
3
+ dependencies?: IDependencyTree[];
4
+ }
5
+ export interface IObserverTree {
6
+ name: string;
7
+ observers?: IObserverTree[];
8
+ }
9
+ export declare function getDependencyTree(thing: any, property?: string): IDependencyTree;
10
+ export declare function getObserverTree(thing: any, property?: string): IObserverTree;
package/lib/api/flow.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export declare function FlowCancellationError(): void;
2
- export declare namespace FlowCancellationError {
3
- var prototype: any;
4
- }
5
- export declare function isFlowCancellationError(error: Error): boolean;
6
- export declare type CancellablePromise<T> = Promise<T> & {
7
- cancel(): void;
8
- };
9
- export declare function flow<R, Args extends any[]>(generator: (...args: Args) => Generator<any, R, any> | AsyncGenerator<any, R, any>): (...args: Args) => CancellablePromise<R>;
1
+ export declare function FlowCancellationError(): void;
2
+ export declare namespace FlowCancellationError {
3
+ var prototype: any;
4
+ }
5
+ export declare function isFlowCancellationError(error: Error): boolean;
6
+ export declare type CancellablePromise<T> = Promise<T> & {
7
+ cancel(): void;
8
+ };
9
+ export declare function flow<R, Args extends any[]>(generator: (...args: Args) => Generator<any, R, any> | AsyncGenerator<any, R, any>): (...args: Args) => CancellablePromise<R>;
@@ -1,8 +1,8 @@
1
- import { Lambda, IObservableValue, IObservableArray, ObservableMap, ObservableSet } from "../internal";
2
- export declare type ReadInterceptor<T> = (value: any) => T;
3
- /** Experimental feature right now, tested indirectly via Mobx-State-Tree */
4
- export declare function interceptReads<T>(value: IObservableValue<T>, handler: ReadInterceptor<T>): Lambda;
5
- export declare function interceptReads<T>(observableArray: IObservableArray<T>, handler: ReadInterceptor<T>): Lambda;
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;
8
- export declare function interceptReads(object: Object, property: string, handler: ReadInterceptor<any>): Lambda;
1
+ import { Lambda, IObservableValue, IObservableArray, ObservableMap, ObservableSet } from "../internal";
2
+ export declare type ReadInterceptor<T> = (value: any) => T;
3
+ /** Experimental feature right now, tested indirectly via Mobx-State-Tree */
4
+ export declare function interceptReads<T>(value: IObservableValue<T>, handler: ReadInterceptor<T>): Lambda;
5
+ export declare function interceptReads<T>(observableArray: IObservableArray<T>, handler: ReadInterceptor<T>): Lambda;
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;
8
+ export declare function interceptReads(object: Object, property: string, handler: ReadInterceptor<any>): Lambda;
@@ -1,8 +1,8 @@
1
- import { IInterceptor, IValueWillChange, IObservableValue, Lambda, IObservableArray, IArrayWillChange, IArrayWillSplice, ObservableMap, IMapWillChange, ObservableSet, ISetWillChange, IObjectWillChange } from "../internal";
2
- export declare function intercept<T>(value: IObservableValue<T>, handler: IInterceptor<IValueWillChange<T>>): Lambda;
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>(observableMap: ObservableSet<V>, handler: IInterceptor<ISetWillChange<V>>): Lambda;
6
- export declare function intercept<K, V>(observableMap: ObservableMap<K, V>, property: K, handler: IInterceptor<IValueWillChange<V>>): Lambda;
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<any>>): Lambda;
1
+ import { IInterceptor, IValueWillChange, IObservableValue, Lambda, IObservableArray, IArrayWillChange, IArrayWillSplice, ObservableMap, IMapWillChange, ObservableSet, ISetWillChange, IObjectWillChange } from "../internal";
2
+ export declare function intercept<T>(value: IObservableValue<T>, handler: IInterceptor<IValueWillChange<T>>): Lambda;
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>(observableMap: ObservableSet<V>, handler: IInterceptor<ISetWillChange<V>>): Lambda;
6
+ export declare function intercept<K, V>(observableMap: ObservableMap<K, V>, property: K, handler: IInterceptor<IValueWillChange<V>>): Lambda;
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<any>>): Lambda;
@@ -1,3 +1,3 @@
1
- export declare function _isComputed(value: any, property?: string): boolean;
2
- export declare function isComputed(value: any): boolean;
3
- export declare function isComputedProp(value: any, propName: string): boolean;
1
+ export declare function _isComputed(value: any, property?: string): boolean;
2
+ export declare function isComputed(value: any): boolean;
3
+ export declare function isComputedProp(value: any, propName: string): boolean;
@@ -1,2 +1,2 @@
1
- export declare function isObservable(value: any): boolean;
2
- export declare function isObservableProp(value: any, propName: string): boolean;
1
+ export declare function isObservable(value: any): boolean;
2
+ export declare function isObservableProp(value: any, propName: string): boolean;
@@ -1,34 +1,34 @@
1
- import { ObservableMap, IObservableArray, ObservableSet } from "../internal";
2
- export declare function keys<K>(map: ObservableMap<K, any>): ReadonlyArray<K>;
3
- export declare function keys<T>(ar: IObservableArray<T>): ReadonlyArray<number>;
4
- export declare function keys<T>(set: ObservableSet<T>): ReadonlyArray<T>;
5
- export declare function keys<T extends Object>(obj: T): ReadonlyArray<string>;
6
- export declare function values<K, T>(map: ObservableMap<K, T>): ReadonlyArray<T>;
7
- export declare function values<T>(set: ObservableSet<T>): ReadonlyArray<T>;
8
- export declare function values<T>(ar: IObservableArray<T>): ReadonlyArray<T>;
9
- export declare function values<T = any>(obj: T): ReadonlyArray<any>;
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]>;
12
- export declare function entries<T>(ar: IObservableArray<T>): ReadonlyArray<[number, T]>;
13
- export declare function entries<T = any>(obj: T): ReadonlyArray<[string, any]>;
14
- export declare function set<V>(obj: ObservableMap<string, V>, values: {
15
- [key: string]: V;
16
- }): any;
17
- export declare function set<K, V>(obj: ObservableMap<K, V>, key: K, value: V): any;
18
- export declare function set<T>(obj: ObservableSet<T>, value: T): any;
19
- export declare function set<T>(obj: IObservableArray<T>, index: number, value: T): any;
20
- export declare function set<T extends Object>(obj: T, values: {
21
- [key: string]: any;
22
- }): any;
23
- export declare function set<T extends Object>(obj: T, key: string, value: any): any;
24
- export declare function remove<K, V>(obj: ObservableMap<K, V>, key: K): any;
25
- export declare function remove<T>(obj: ObservableSet<T>, key: T): any;
26
- export declare function remove<T>(obj: IObservableArray<T>, index: number): any;
27
- export declare function remove<T extends Object>(obj: T, key: string): any;
28
- export declare function has<K>(obj: ObservableMap<K, any>, key: K): boolean;
29
- export declare function has<T>(obj: ObservableSet<T>, key: T): boolean;
30
- export declare function has<T>(obj: IObservableArray<T>, index: number): boolean;
31
- export declare function has<T extends Object>(obj: T, key: string): boolean;
32
- export declare function get<K, V>(obj: ObservableMap<K, V>, key: K): V | undefined;
33
- export declare function get<T>(obj: IObservableArray<T>, index: number): T | undefined;
34
- export declare function get<T extends Object>(obj: T, key: string): any;
1
+ import { ObservableMap, IObservableArray, ObservableSet } from "../internal";
2
+ export declare function keys<K>(map: ObservableMap<K, any>): ReadonlyArray<K>;
3
+ export declare function keys<T>(ar: IObservableArray<T>): ReadonlyArray<number>;
4
+ export declare function keys<T>(set: ObservableSet<T>): ReadonlyArray<T>;
5
+ export declare function keys<T extends Object>(obj: T): ReadonlyArray<string>;
6
+ export declare function values<K, T>(map: ObservableMap<K, T>): ReadonlyArray<T>;
7
+ export declare function values<T>(set: ObservableSet<T>): ReadonlyArray<T>;
8
+ export declare function values<T>(ar: IObservableArray<T>): ReadonlyArray<T>;
9
+ export declare function values<T = any>(obj: T): ReadonlyArray<any>;
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]>;
12
+ export declare function entries<T>(ar: IObservableArray<T>): ReadonlyArray<[number, T]>;
13
+ export declare function entries<T = any>(obj: T): ReadonlyArray<[string, any]>;
14
+ export declare function set<V>(obj: ObservableMap<string, V>, values: {
15
+ [key: string]: V;
16
+ }): any;
17
+ export declare function set<K, V>(obj: ObservableMap<K, V>, key: K, value: V): any;
18
+ export declare function set<T>(obj: ObservableSet<T>, value: T): any;
19
+ export declare function set<T>(obj: IObservableArray<T>, index: number, value: T): any;
20
+ export declare function set<T extends Object>(obj: T, values: {
21
+ [key: string]: any;
22
+ }): any;
23
+ export declare function set<T extends Object>(obj: T, key: string, value: any): any;
24
+ export declare function remove<K, V>(obj: ObservableMap<K, V>, key: K): any;
25
+ export declare function remove<T>(obj: ObservableSet<T>, key: T): any;
26
+ export declare function remove<T>(obj: IObservableArray<T>, index: number): any;
27
+ export declare function remove<T extends Object>(obj: T, key: string): any;
28
+ export declare function has<K>(obj: ObservableMap<K, any>, key: K): boolean;
29
+ export declare function has<T>(obj: ObservableSet<T>, key: T): boolean;
30
+ export declare function has<T>(obj: IObservableArray<T>, index: number): boolean;
31
+ export declare function has<T extends Object>(obj: T, key: string): boolean;
32
+ export declare function get<K, V>(obj: ObservableMap<K, V>, key: K): V | undefined;
33
+ export declare function get<T>(obj: IObservableArray<T>, index: number): T | undefined;
34
+ export declare function get<T extends Object>(obj: T, key: string): any;