mobx 6.3.13 → 6.4.2

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 (66) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -0
  3. package/dist/api/intercept.d.ts +1 -1
  4. package/dist/api/observe.d.ts +1 -1
  5. package/dist/core/reaction.d.ts +2 -2
  6. package/dist/errors.d.ts +2 -2
  7. package/dist/mobx.cjs.development.js +941 -268
  8. package/dist/mobx.cjs.development.js.map +1 -1
  9. package/dist/mobx.cjs.production.min.js +1 -1
  10. package/dist/mobx.cjs.production.min.js.map +1 -1
  11. package/dist/mobx.esm.development.js +941 -268
  12. package/dist/mobx.esm.development.js.map +1 -1
  13. package/dist/mobx.esm.js +960 -275
  14. package/dist/mobx.esm.js.map +1 -1
  15. package/dist/mobx.esm.production.min.js +1 -1
  16. package/dist/mobx.esm.production.min.js.map +1 -1
  17. package/dist/mobx.umd.development.js +941 -268
  18. package/dist/mobx.umd.development.js.map +1 -1
  19. package/dist/mobx.umd.production.min.js +1 -1
  20. package/dist/mobx.umd.production.min.js.map +1 -1
  21. package/dist/types/observablemap.d.ts +2 -2
  22. package/dist/utils/utils.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/src/api/action.ts +8 -3
  25. package/src/api/annotation.ts +1 -2
  26. package/src/api/autorun.ts +22 -8
  27. package/src/api/computed.ts +5 -2
  28. package/src/api/configure.ts +6 -2
  29. package/src/api/extendobservable.ts +11 -5
  30. package/src/api/extras.ts +4 -2
  31. package/src/api/flow.ts +11 -4
  32. package/src/api/intercept-read.ts +4 -2
  33. package/src/api/intercept.ts +6 -3
  34. package/src/api/iscomputed.ts +10 -4
  35. package/src/api/isobservable.ts +10 -4
  36. package/src/api/makeObservable.ts +4 -2
  37. package/src/api/object-api.ts +30 -16
  38. package/src/api/observable.ts +23 -9
  39. package/src/api/observe.ts +5 -3
  40. package/src/api/tojs.ts +7 -3
  41. package/src/api/trace.ts +6 -2
  42. package/src/api/when.ts +12 -5
  43. package/src/core/action.ts +8 -3
  44. package/src/core/computedvalue.ts +29 -9
  45. package/src/core/derivation.ts +30 -10
  46. package/src/core/globalstate.ts +18 -7
  47. package/src/core/observable.ts +14 -5
  48. package/src/core/reaction.ts +16 -7
  49. package/src/core/spy.ts +20 -7
  50. package/src/errors.ts +2 -2
  51. package/src/types/actionannotation.ts +2 -2
  52. package/src/types/dynamicobject.ts +10 -4
  53. package/src/types/flowannotation.ts +3 -1
  54. package/src/types/intercept-utils.ts +9 -3
  55. package/src/types/legacyobservablearray.ts +5 -3
  56. package/src/types/listen-utils.ts +6 -2
  57. package/src/types/modifiers.ts +39 -14
  58. package/src/types/observablearray.ts +78 -30
  59. package/src/types/observablemap.ts +60 -24
  60. package/src/types/observableobject.ts +52 -18
  61. package/src/types/observableset.ts +29 -10
  62. package/src/types/observablevalue.ts +13 -5
  63. package/src/types/type-utils.ts +33 -11
  64. package/src/utils/comparer.ts +4 -4
  65. package/src/utils/eq.ts +45 -15
  66. package/src/utils/utils.ts +42 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # mobx
2
2
 
3
+ ## 6.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2caf7e1a`](https://github.com/mobxjs/mobx/commit/2caf7e1a3504dde3d7c9bde3c6fb56ca85168018) [#3316](https://github.com/mobxjs/mobx/pull/3316) Thanks [@urugator](https://github.com/urugator)! - `requiresObservable` always takes precedence over global `reactionRequiresObservable`
8
+
9
+ ## 6.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`d6fa9a19`](https://github.com/mobxjs/mobx/commit/d6fa9a1970ebfb8a8adaf5bf0dc73125acec2dee) [#3306](https://github.com/mobxjs/mobx/pull/3306) Thanks [@urugator](https://github.com/urugator)! - fix missing type inferrence of `observe` and `intercept` for arrays
14
+
15
+ ## 6.4.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [`6b926833`](https://github.com/mobxjs/mobx/commit/6b926833ac7abbf92ff5c309613d2345f72527ee) [#3287](https://github.com/mobxjs/mobx/pull/3287) Thanks [@kubk](https://github.com/kubk)! - Remove any from 'merge' and 'replace' methods of ObservableMap
20
+
21
+ ### Patch Changes
22
+
23
+ - [`dee35be4`](https://github.com/mobxjs/mobx/commit/dee35be427989b6adc3c8f7ae8dc632ea66f3538) [#3300](https://github.com/mobxjs/mobx/pull/3300) Thanks [@kubk](https://github.com/kubk)! - Make the error message about Object.freeze more informative
24
+
3
25
  ## 6.3.13
4
26
 
5
27
  ### Patch Changes
package/README.md CHANGED
@@ -33,6 +33,7 @@ MobX is made possible by the generosity of the sponsors below, and many other [i
33
33
  <a href="https://curology.com/blog/tech"><img src="https://mobx.js.org/assets/curology.png" align="center" width="100" title="Curology" alt="Curology"/></a>
34
34
  <a href="https://modulz.app/"><img src="https://mobx.js.org/assets/modulz.png" align="center" width="100" title="Modulz" alt="Modulz"/></a>
35
35
  <a href="https://space307.com/?utm_source=sponsorship&utm_medium=mobx&utm_campaign=readme"><img src="https://mobx.js.org/assets/space307.png" align="center" width="100" title="Space307" alt="Space307"/></a>
36
+ <a href="https://casinosites.ltd.uk/?utm_source=sponsorship&utm_medium=mobx&utm_campaign=readme"><img src="https://mobx.js.org/assets/casino2.png" align="center" width="100" title="Casino Sites" alt="Casino Sites"/></a>
36
37
 
37
38
  **🥉 Bronze sponsors (\$500+ total contributions):**<br/>
38
39
  <a href="https://mantro.net/jobs/warlock"><img src="https://mobx.js.org/assets/mantro.png" align="center" width="100" title="mantro GmbH" alt="mantro GmbH"></a>
@@ -1,6 +1,6 @@
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
- export declare function intercept<T>(observableArray: IObservableArray<T>, handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;
3
+ export declare function intercept<T>(observableArray: IObservableArray<T> | Array<T>, handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>): Lambda;
4
4
  export declare function intercept<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, handler: IInterceptor<IMapWillChange<K, V>>): Lambda;
5
5
  export declare function intercept<V>(observableSet: ObservableSet<V> | Set<V>, handler: IInterceptor<ISetWillChange<V>>): Lambda;
6
6
  export declare function intercept<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, property: K, handler: IInterceptor<IValueWillChange<V>>): Lambda;
@@ -1,6 +1,6 @@
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
- export declare function observe<T>(observableArray: IObservableArray<T>, listener: (change: IArrayDidChange<T>) => void, fireImmediately?: boolean): Lambda;
3
+ export declare function observe<T>(observableArray: IObservableArray<T> | Array<T>, listener: (change: IArrayDidChange<T>) => void, fireImmediately?: boolean): Lambda;
4
4
  export declare function observe<V>(observableSet: ObservableSet<V> | Set<V>, listener: (change: ISetDidChange<V>) => void, fireImmediately?: boolean): Lambda;
5
5
  export declare function observe<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, listener: (change: IMapDidChange<K, V>) => void, fireImmediately?: boolean): Lambda;
6
6
  export declare function observe<K, V>(observableMap: ObservableMap<K, V> | Map<K, V>, property: K, listener: (change: IValueDidChange<V>) => void, fireImmediately?: boolean): Lambda;
@@ -29,7 +29,7 @@ export declare class Reaction implements IDerivation, IReactionPublic {
29
29
  name_: string;
30
30
  private onInvalidate_;
31
31
  private errorHandler_?;
32
- requiresObservable_: boolean;
32
+ requiresObservable_?: any;
33
33
  observing_: IObservable[];
34
34
  newObserving_: IObservable[];
35
35
  dependenciesState_: IDerivationState_;
@@ -41,7 +41,7 @@ export declare class Reaction implements IDerivation, IReactionPublic {
41
41
  isTrackPending_: boolean;
42
42
  isRunning_: boolean;
43
43
  isTracing_: TraceMode;
44
- constructor(name_: string, onInvalidate_: () => void, errorHandler_?: ((error: any, derivation: IDerivation) => void) | undefined, requiresObservable_?: boolean);
44
+ constructor(name_: string, onInvalidate_: () => void, errorHandler_?: ((error: any, derivation: IDerivation) => void) | undefined, requiresObservable_?: any);
45
45
  onBecomeStale_(): void;
46
46
  schedule_(): void;
47
47
  isScheduled(): boolean;
package/dist/errors.d.ts CHANGED
@@ -9,9 +9,9 @@ declare const niceErrors: {
9
9
  readonly 10: "'has()' can only be used on observable objects, arrays and maps";
10
10
  readonly 11: "'get()' can only be used on observable objects, arrays and maps";
11
11
  readonly 12: "Invalid annotation";
12
- readonly 13: "Dynamic observable objects cannot be frozen";
12
+ readonly 13: "Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)";
13
13
  readonly 14: "Intercept handlers should return nothing or a change object";
14
- readonly 15: "Observable arrays cannot be frozen";
14
+ readonly 15: "Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)";
15
15
  readonly 16: "Modification exception: the internal structure of an observable array was changed.";
16
16
  readonly 17: (index: any, length: any) => string;
17
17
  readonly 18: "mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js";