mobx 6.3.11 → 6.4.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +28 -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/errors.d.ts +2 -2
  6. package/dist/mobx.cjs.development.js +991 -303
  7. package/dist/mobx.cjs.development.js.map +1 -1
  8. package/dist/mobx.cjs.production.min.js +1 -1
  9. package/dist/mobx.cjs.production.min.js.map +1 -1
  10. package/dist/mobx.esm.development.js +991 -303
  11. package/dist/mobx.esm.development.js.map +1 -1
  12. package/dist/mobx.esm.js +1006 -306
  13. package/dist/mobx.esm.js.map +1 -1
  14. package/dist/mobx.esm.production.min.js +1 -1
  15. package/dist/mobx.esm.production.min.js.map +1 -1
  16. package/dist/mobx.umd.development.js +991 -303
  17. package/dist/mobx.umd.development.js.map +1 -1
  18. package/dist/mobx.umd.production.min.js +1 -1
  19. package/dist/mobx.umd.production.min.js.map +1 -1
  20. package/dist/types/observablemap.d.ts +2 -2
  21. package/dist/utils/utils.d.ts +1 -1
  22. package/package.json +1 -1
  23. package/src/api/action.ts +8 -3
  24. package/src/api/annotation.ts +1 -2
  25. package/src/api/autorun.ts +22 -8
  26. package/src/api/computed.ts +5 -2
  27. package/src/api/configure.ts +6 -2
  28. package/src/api/extendobservable.ts +11 -5
  29. package/src/api/extras.ts +4 -2
  30. package/src/api/flow.ts +11 -4
  31. package/src/api/intercept-read.ts +4 -2
  32. package/src/api/intercept.ts +6 -3
  33. package/src/api/iscomputed.ts +10 -4
  34. package/src/api/isobservable.ts +10 -4
  35. package/src/api/makeObservable.ts +4 -2
  36. package/src/api/object-api.ts +30 -16
  37. package/src/api/observable.ts +23 -9
  38. package/src/api/observe.ts +5 -3
  39. package/src/api/tojs.ts +7 -3
  40. package/src/api/trace.ts +6 -2
  41. package/src/api/when.ts +12 -5
  42. package/src/core/action.ts +8 -3
  43. package/src/core/computedvalue.ts +29 -9
  44. package/src/core/derivation.ts +25 -9
  45. package/src/core/globalstate.ts +18 -7
  46. package/src/core/observable.ts +14 -5
  47. package/src/core/reaction.ts +15 -6
  48. package/src/core/spy.ts +20 -7
  49. package/src/errors.ts +2 -2
  50. package/src/types/actionannotation.ts +2 -2
  51. package/src/types/dynamicobject.ts +10 -4
  52. package/src/types/flowannotation.ts +14 -4
  53. package/src/types/intercept-utils.ts +9 -3
  54. package/src/types/legacyobservablearray.ts +5 -3
  55. package/src/types/listen-utils.ts +6 -2
  56. package/src/types/modifiers.ts +39 -14
  57. package/src/types/observablearray.ts +78 -30
  58. package/src/types/observablemap.ts +65 -26
  59. package/src/types/observableobject.ts +52 -18
  60. package/src/types/observableset.ts +29 -10
  61. package/src/types/observablevalue.ts +13 -5
  62. package/src/types/type-utils.ts +33 -11
  63. package/src/utils/comparer.ts +4 -4
  64. package/src/utils/eq.ts +45 -15
  65. package/src/utils/utils.ts +42 -20
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # mobx
2
2
 
3
+ ## 6.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`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
8
+
9
+ ## 6.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`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
14
+
15
+ ### Patch Changes
16
+
17
+ - [`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
18
+
19
+ ## 6.3.13
20
+
21
+ ### Patch Changes
22
+
23
+ - [`23803202`](https://github.com/mobxjs/mobx/commit/2380320263f5edcd06d7ba6bdf02aff3fd7d305a) [#3273](https://github.com/mobxjs/mobx/pull/3273) Thanks [@urugator](https://github.com/urugator)! - fix `flow.bound` #3271
24
+
25
+ ## 6.3.12
26
+
27
+ ### Patch Changes
28
+
29
+ - [`654a2013`](https://github.com/mobxjs/mobx/commit/654a2013107ac6e5bbe3851e4eed22f0c9130525) [#3257](https://github.com/mobxjs/mobx/pull/3257) Thanks [@urugator](https://github.com/urugator)! - fix: observable map initialization violates `enforceActions: "always"`
30
+
3
31
  ## 6.3.11
4
32
 
5
33
  ### 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;
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";