mobx 6.11.0-pre → 6.11.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 +9 -0
- package/README.md +2 -2
- package/dist/mobx.cjs.development.js +8 -11
- 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 +8 -11
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +8 -11
- 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 +8 -11
- 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/observableobject.d.ts +0 -1
- package/package.json +1 -1
- package/src/api/decorators.ts +5 -1
- package/src/api/observable.ts +1 -0
- package/src/types/observableannotation.ts +12 -12
- package/src/types/observableobject.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# mobx
|
|
2
2
|
|
|
3
|
+
## 6.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c9260974`](https://github.com/mobxjs/mobx/commit/c9260974f726f58de0fd4974ea024c644d9b7c6f) [#3790](https://github.com/mobxjs/mobx/pull/3790) Thanks [@mweststrate](https://github.com/mweststrate)! - Added support for modern 2022.3 Decorators. [#3790](https://github.com/mobxjs/mobx/pull/3790)
|
|
8
|
+
- [Installation / usage instruction](https://mobx.js.org/enabling-decorators.html).
|
|
9
|
+
- [Introduction announcement](https://michel.codes/blogs/mobx-decorators)
|
|
10
|
+
- Original PR by [@Matchlighter](https://github.com/Matchlighter) in [#3638](https://github.com/mobxjs/mobx/pull/3638),
|
|
11
|
+
|
|
3
12
|
## 6.10.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ MobX is made possible by the generosity of the sponsors below, and many other [i
|
|
|
35
35
|
<a href="https://coinbase.com/"><img src="https://mobx.js.org/assets/coinbase.jpeg" align="center" width="100" title="Coinbase" alt="Coinbase" /></a>
|
|
36
36
|
<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>
|
|
37
37
|
<a href="https://opensource.facebook.com/"><img src="https://mobx.js.org/assets/fbos.jpeg" align="center" width="100" title="Facebook Open Source" alt="Facebook Open Source" /></a>
|
|
38
|
-
<a href="https://www.canva.com/"><img src="https://mobx.js.org/assets/canva.
|
|
38
|
+
<a href="https://www.canva.com/"><img src="https://mobx.js.org/assets/canva.svg" align="center" width="100" title="Canva" alt="Canva" /></a>
|
|
39
39
|
|
|
40
40
|
**🥈 Silver sponsors (\$100+ per month):**<br/>
|
|
41
41
|
|
|
@@ -58,7 +58,7 @@ MobX is made possible by the generosity of the sponsors below, and many other [i
|
|
|
58
58
|
|
|
59
59
|
_Anything that can be derived from the application state, should be. Automatically._
|
|
60
60
|
|
|
61
|
-
MobX is a battle-tested library that makes state management simple and scalable by transparently applying functional reactive programming.
|
|
61
|
+
MobX is a signal based, battle-tested library that makes state management simple and scalable by transparently applying functional reactive programming.
|
|
62
62
|
The philosophy behind MobX is simple:
|
|
63
63
|
|
|
64
64
|
<div class="benefits">
|
|
@@ -420,7 +420,7 @@ function is20223Decorator(context) {
|
|
|
420
420
|
}
|
|
421
421
|
function assert20223DecoratorType(context, types) {
|
|
422
422
|
if ( !types.includes(context.kind)) {
|
|
423
|
-
die("
|
|
423
|
+
die("The decorator applied to '" + String(context.name) + "' cannot be used on a " + context.kind + " element");
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
426
|
|
|
@@ -918,24 +918,21 @@ function extend_$4(adm, key, descriptor, proxyTrap) {
|
|
|
918
918
|
}
|
|
919
919
|
function decorate_20223_$4(desc, context) {
|
|
920
920
|
{
|
|
921
|
-
|
|
921
|
+
if (context.kind === "field") {
|
|
922
|
+
throw die("Please use `@observable accessor " + String(context.name) + "` instead of `@observable " + String(context.name) + "`");
|
|
923
|
+
}
|
|
924
|
+
assert20223DecoratorType(context, ["accessor"]);
|
|
922
925
|
}
|
|
923
926
|
var ann = this;
|
|
924
927
|
var kind = context.kind,
|
|
925
|
-
name = context.name
|
|
926
|
-
addInitializer = context.addInitializer;
|
|
927
|
-
// Backwards/Legacy behavior, expects makeObservable(this)
|
|
928
|
-
if (kind == "field") {
|
|
929
|
-
addInitializer(function () {
|
|
930
|
-
storeAnnotation(this, name, ann);
|
|
931
|
-
});
|
|
932
|
-
return;
|
|
933
|
-
}
|
|
928
|
+
name = context.name;
|
|
934
929
|
// The laziness here is not ideal... It's a workaround to how 2022.3 Decorators are implemented:
|
|
935
930
|
// `addInitializer` callbacks are executed _before_ any accessors are defined (instead of the ideal-for-us right after each).
|
|
936
931
|
// This means that, if we were to do our stuff in an `addInitializer`, we'd attempt to read a private slot
|
|
937
932
|
// before it has been initialized. The runtime doesn't like that and throws a `Cannot read private member
|
|
938
933
|
// from an object whose class did not declare it` error.
|
|
934
|
+
// TODO: it seems that this will not be required anymore in the final version of the spec
|
|
935
|
+
// See TODO: link
|
|
939
936
|
var initializedObjects = new WeakSet();
|
|
940
937
|
function initializeObservable(target, value) {
|
|
941
938
|
var _ann$options_$enhance, _ann$options_;
|