mobx-react 5.3.6 → 5.4.3
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/.browserlistrc +6 -6
- package/.editorconfig +6 -6
- package/.prettierrc +4 -4
- package/.travis.yml +9 -9
- package/CHANGELOG.md +518 -505
- package/LICENSE +21 -21
- package/README.md +517 -515
- package/custom.d.ts +140 -140
- package/custom.js +91 -66
- package/custom.module.js +88 -63
- package/empty.js +3 -3
- package/index.d.ts +140 -140
- package/index.js +91 -66
- package/index.min.js +1 -1
- package/index.module.js +88 -63
- package/native.d.ts +140 -140
- package/native.js +88 -63
- package/package.json +7 -5
- package/yarn.lock +5886 -5863
package/native.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
+
var mobx = require('mobx');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var React__default = _interopDefault(React);
|
|
9
|
-
var mobx = require('mobx');
|
|
10
10
|
var reactNative = require('react-native');
|
|
11
11
|
|
|
12
12
|
function _typeof(obj) {
|
|
@@ -119,33 +119,35 @@ function createCommonjsModule(fn, module) {
|
|
|
119
119
|
|
|
120
120
|
var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
|
121
121
|
Object.defineProperty(exports,"__esModule",{value:!0});
|
|
122
|
-
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.forward_ref"):60112,
|
|
123
|
-
function
|
|
124
|
-
exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===
|
|
125
|
-
exports.isForwardRef=function(a){return
|
|
122
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,r=b?Symbol.for("react.memo"):
|
|
123
|
+
60115,t=b?Symbol.for("react.lazy"):60116;function u(a){if("object"===typeof a&&null!==a){var q=a.$$typeof;switch(q){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case h:return a;default:return q}}case d:return q}}}function v(a){return u(a)===m}exports.typeOf=u;exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;
|
|
124
|
+
exports.Profiler=g;exports.Portal=d;exports.StrictMode=f;exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n)};exports.isAsyncMode=function(a){return v(a)||u(a)===l};exports.isConcurrentMode=v;exports.isContextConsumer=function(a){return u(a)===k};exports.isContextProvider=function(a){return u(a)===h};
|
|
125
|
+
exports.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return u(a)===n};exports.isFragment=function(a){return u(a)===e};exports.isProfiler=function(a){return u(a)===g};exports.isPortal=function(a){return u(a)===d};exports.isStrictMode=function(a){return u(a)===f};
|
|
126
126
|
});
|
|
127
127
|
|
|
128
128
|
unwrapExports(reactIs_production_min);
|
|
129
129
|
var reactIs_production_min_1 = reactIs_production_min.typeOf;
|
|
130
130
|
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
|
|
131
|
-
var reactIs_production_min_3 = reactIs_production_min.
|
|
132
|
-
var reactIs_production_min_4 = reactIs_production_min.
|
|
133
|
-
var reactIs_production_min_5 = reactIs_production_min.
|
|
134
|
-
var reactIs_production_min_6 = reactIs_production_min.
|
|
135
|
-
var reactIs_production_min_7 = reactIs_production_min.
|
|
136
|
-
var reactIs_production_min_8 = reactIs_production_min.
|
|
137
|
-
var reactIs_production_min_9 = reactIs_production_min.
|
|
138
|
-
var reactIs_production_min_10 = reactIs_production_min.
|
|
139
|
-
var reactIs_production_min_11 = reactIs_production_min.
|
|
140
|
-
var reactIs_production_min_12 = reactIs_production_min.
|
|
141
|
-
var reactIs_production_min_13 = reactIs_production_min.
|
|
142
|
-
var reactIs_production_min_14 = reactIs_production_min.
|
|
143
|
-
var reactIs_production_min_15 = reactIs_production_min.
|
|
144
|
-
var reactIs_production_min_16 = reactIs_production_min.
|
|
145
|
-
var reactIs_production_min_17 = reactIs_production_min.
|
|
146
|
-
var reactIs_production_min_18 = reactIs_production_min.
|
|
147
|
-
var reactIs_production_min_19 = reactIs_production_min.
|
|
148
|
-
var reactIs_production_min_20 = reactIs_production_min.
|
|
131
|
+
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
|
|
132
|
+
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
|
|
133
|
+
var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
|
|
134
|
+
var reactIs_production_min_6 = reactIs_production_min.Element;
|
|
135
|
+
var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
|
|
136
|
+
var reactIs_production_min_8 = reactIs_production_min.Fragment;
|
|
137
|
+
var reactIs_production_min_9 = reactIs_production_min.Profiler;
|
|
138
|
+
var reactIs_production_min_10 = reactIs_production_min.Portal;
|
|
139
|
+
var reactIs_production_min_11 = reactIs_production_min.StrictMode;
|
|
140
|
+
var reactIs_production_min_12 = reactIs_production_min.isValidElementType;
|
|
141
|
+
var reactIs_production_min_13 = reactIs_production_min.isAsyncMode;
|
|
142
|
+
var reactIs_production_min_14 = reactIs_production_min.isConcurrentMode;
|
|
143
|
+
var reactIs_production_min_15 = reactIs_production_min.isContextConsumer;
|
|
144
|
+
var reactIs_production_min_16 = reactIs_production_min.isContextProvider;
|
|
145
|
+
var reactIs_production_min_17 = reactIs_production_min.isElement;
|
|
146
|
+
var reactIs_production_min_18 = reactIs_production_min.isForwardRef;
|
|
147
|
+
var reactIs_production_min_19 = reactIs_production_min.isFragment;
|
|
148
|
+
var reactIs_production_min_20 = reactIs_production_min.isProfiler;
|
|
149
|
+
var reactIs_production_min_21 = reactIs_production_min.isPortal;
|
|
150
|
+
var reactIs_production_min_22 = reactIs_production_min.isStrictMode;
|
|
149
151
|
|
|
150
152
|
var reactIs = createCommonjsModule(function (module) {
|
|
151
153
|
|
|
@@ -154,22 +156,19 @@ var reactIs = createCommonjsModule(function (module) {
|
|
|
154
156
|
}
|
|
155
157
|
});
|
|
156
158
|
|
|
157
|
-
var _ReactIs$ForwardRef;
|
|
158
|
-
|
|
159
|
-
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
160
|
-
|
|
161
159
|
/**
|
|
162
160
|
* Copyright 2015, Yahoo! Inc.
|
|
163
161
|
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
164
162
|
*/
|
|
165
163
|
|
|
166
|
-
|
|
167
164
|
var REACT_STATICS = {
|
|
168
165
|
childContextTypes: true,
|
|
166
|
+
contextType: true,
|
|
169
167
|
contextTypes: true,
|
|
170
168
|
defaultProps: true,
|
|
171
169
|
displayName: true,
|
|
172
170
|
getDefaultProps: true,
|
|
171
|
+
getDerivedStateFromError: true,
|
|
173
172
|
getDerivedStateFromProps: true,
|
|
174
173
|
mixins: true,
|
|
175
174
|
propTypes: true,
|
|
@@ -186,7 +185,16 @@ var KNOWN_STATICS = {
|
|
|
186
185
|
arity: true
|
|
187
186
|
};
|
|
188
187
|
|
|
189
|
-
var
|
|
188
|
+
var FORWARD_REF_STATICS = {
|
|
189
|
+
'$$typeof': true,
|
|
190
|
+
render: true,
|
|
191
|
+
defaultProps: true,
|
|
192
|
+
displayName: true,
|
|
193
|
+
propTypes: true
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
var TYPE_STATICS = {};
|
|
197
|
+
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
190
198
|
|
|
191
199
|
var defineProperty = Object.defineProperty;
|
|
192
200
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
@@ -570,8 +578,8 @@ var proxiedInjectorProps = {
|
|
|
570
578
|
configurable: true,
|
|
571
579
|
enumerable: true
|
|
572
580
|
}
|
|
573
|
-
/**
|
|
574
|
-
* Store Injection
|
|
581
|
+
/**
|
|
582
|
+
* Store Injection
|
|
575
583
|
*/
|
|
576
584
|
|
|
577
585
|
};
|
|
@@ -655,11 +663,11 @@ function grabStoresByName(storeNames) {
|
|
|
655
663
|
return nextProps;
|
|
656
664
|
};
|
|
657
665
|
}
|
|
658
|
-
/**
|
|
659
|
-
* higher order component that injects stores to a child.
|
|
660
|
-
* takes either a varargs list of strings, which are stores read from the context,
|
|
661
|
-
* or a function that manually maps the available stores from the context to props:
|
|
662
|
-
* storesToProps(mobxStores, props, context) => newProps
|
|
666
|
+
/**
|
|
667
|
+
* higher order component that injects stores to a child.
|
|
668
|
+
* takes either a varargs list of strings, which are stores read from the context,
|
|
669
|
+
* or a function that manually maps the available stores from the context to props:
|
|
670
|
+
* storesToProps(mobxStores, props, context) => newProps
|
|
663
671
|
*/
|
|
664
672
|
|
|
665
673
|
|
|
@@ -697,8 +705,8 @@ function inject()
|
|
|
697
705
|
|
|
698
706
|
var mobxAdminProperty = mobx.$mobx || "$mobx";
|
|
699
707
|
var mobxIsUnmounted = newSymbol("isUnmounted");
|
|
700
|
-
/**
|
|
701
|
-
* dev tool support
|
|
708
|
+
/**
|
|
709
|
+
* dev tool support
|
|
702
710
|
*/
|
|
703
711
|
|
|
704
712
|
var isDevtoolsEnabled = false;
|
|
@@ -708,12 +716,14 @@ var warnedAboutObserverInjectDeprecation = false; // WeakMap<Node, Object>;
|
|
|
708
716
|
var componentByNodeRegistry = typeof WeakMap !== "undefined" ? new WeakMap() : undefined;
|
|
709
717
|
var renderReporter = new EventEmitter();
|
|
710
718
|
var skipRenderKey = newSymbol("skipRender");
|
|
711
|
-
var isForcingUpdateKey = newSymbol("isForcingUpdate");
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
*
|
|
716
|
-
* @param
|
|
719
|
+
var isForcingUpdateKey = newSymbol("isForcingUpdate"); // Using react-is had some issues (and operates on elements, not on types), see #608 / #609
|
|
720
|
+
|
|
721
|
+
var ReactForwardRefSymbol = typeof React.forwardRef === "function" && React.forwardRef(function (_props, _ref) {})["$$typeof"];
|
|
722
|
+
/**
|
|
723
|
+
* Helper to set `prop` to `this` as non-enumerable (hidden prop)
|
|
724
|
+
* @param target
|
|
725
|
+
* @param prop
|
|
726
|
+
* @param value
|
|
717
727
|
*/
|
|
718
728
|
|
|
719
729
|
function setHiddenProp(target, prop, value) {
|
|
@@ -753,13 +763,13 @@ function trackComponents() {
|
|
|
753
763
|
function useStaticRendering(useStaticRendering) {
|
|
754
764
|
isUsingStaticRendering = useStaticRendering;
|
|
755
765
|
}
|
|
756
|
-
/**
|
|
757
|
-
* Errors reporter
|
|
766
|
+
/**
|
|
767
|
+
* Errors reporter
|
|
758
768
|
*/
|
|
759
769
|
|
|
760
770
|
var errorsReporter = new EventEmitter();
|
|
761
|
-
/**
|
|
762
|
-
* Utilities
|
|
771
|
+
/**
|
|
772
|
+
* Utilities
|
|
763
773
|
*/
|
|
764
774
|
|
|
765
775
|
function patch$1(target, funcName) {
|
|
@@ -834,15 +844,15 @@ function makeComponentReactive(render) {
|
|
|
834
844
|
|
|
835
845
|
var initialName = this.displayName || this.name || this.constructor && (this.constructor.displayName || this.constructor.name) || "<component>";
|
|
836
846
|
var rootNodeID = this._reactInternalInstance && this._reactInternalInstance._rootNodeID || this._reactInternalInstance && this._reactInternalInstance._debugID || this._reactInternalFiber && this._reactInternalFiber._debugID;
|
|
837
|
-
/**
|
|
838
|
-
* If props are shallowly modified, react will render anyway,
|
|
839
|
-
* so atom.reportChanged() should not result in yet another re-render
|
|
847
|
+
/**
|
|
848
|
+
* If props are shallowly modified, react will render anyway,
|
|
849
|
+
* so atom.reportChanged() should not result in yet another re-render
|
|
840
850
|
*/
|
|
841
851
|
|
|
842
852
|
setHiddenProp(this, skipRenderKey, false);
|
|
843
|
-
/**
|
|
844
|
-
* forceUpdate will re-assign this.props. We don't want that to cause a loop,
|
|
845
|
-
* so detect these changes
|
|
853
|
+
/**
|
|
854
|
+
* forceUpdate will re-assign this.props. We don't want that to cause a loop,
|
|
855
|
+
* so detect these changes
|
|
846
856
|
*/
|
|
847
857
|
|
|
848
858
|
setHiddenProp(this, isForcingUpdateKey, false); // wire up reactive render
|
|
@@ -860,7 +870,7 @@ function makeComponentReactive(render) {
|
|
|
860
870
|
if (_this2[mobxIsUnmounted] !== true) {
|
|
861
871
|
// If we are unmounted at this point, componentWillReact() had a side effect causing the component to unmounted
|
|
862
872
|
// TODO: remove this check? Then react will properly warn about the fact that this should not happen? See #73
|
|
863
|
-
// However, people also claim this
|
|
873
|
+
// However, people also claim this might happen during unit tests..
|
|
864
874
|
var hasError = true;
|
|
865
875
|
|
|
866
876
|
try {
|
|
@@ -879,8 +889,8 @@ function makeComponentReactive(render) {
|
|
|
879
889
|
this.render = reactiveRender;
|
|
880
890
|
return reactiveRender.call(this);
|
|
881
891
|
}
|
|
882
|
-
/**
|
|
883
|
-
* ReactiveMixin
|
|
892
|
+
/**
|
|
893
|
+
* ReactiveMixin
|
|
884
894
|
*/
|
|
885
895
|
|
|
886
896
|
|
|
@@ -963,8 +973,8 @@ function makeObservableProp(target, propName) {
|
|
|
963
973
|
}
|
|
964
974
|
});
|
|
965
975
|
}
|
|
966
|
-
/**
|
|
967
|
-
* Observer function / decorator
|
|
976
|
+
/**
|
|
977
|
+
* Observer function / decorator
|
|
968
978
|
*/
|
|
969
979
|
|
|
970
980
|
|
|
@@ -999,6 +1009,21 @@ function observer(arg1, arg2) {
|
|
|
999
1009
|
|
|
1000
1010
|
if (componentClass.__proto__ === React.PureComponent) {
|
|
1001
1011
|
console.warn("Mobx observer: You are using 'observer' on React.PureComponent. These two achieve two opposite goals and should not be used together");
|
|
1012
|
+
} // Unwrap forward refs into `<Observer>` component
|
|
1013
|
+
// we need to unwrap the render, because it is the inner render that needs to be tracked,
|
|
1014
|
+
// not the ForwardRef HoC
|
|
1015
|
+
|
|
1016
|
+
|
|
1017
|
+
if (ReactForwardRefSymbol && componentClass["$$typeof"] === ReactForwardRefSymbol) {
|
|
1018
|
+
var _baseRender = componentClass.render;
|
|
1019
|
+
if (typeof _baseRender !== "function") throw new Error("render property of ForwardRef was not a function"); // TODO: do we need to hoist statics from baseRender to the forward ref?
|
|
1020
|
+
|
|
1021
|
+
return React.forwardRef(function ObserverForwardRef() {
|
|
1022
|
+
var _arguments = arguments;
|
|
1023
|
+
return React__default.createElement(Observer, null, function () {
|
|
1024
|
+
return _baseRender.apply(undefined, _arguments);
|
|
1025
|
+
});
|
|
1026
|
+
});
|
|
1002
1027
|
} // Stateless function component:
|
|
1003
1028
|
// If it is function but doesn't seem to be a react class constructor,
|
|
1004
1029
|
// wrap it to a react class automatically
|
|
@@ -1064,10 +1089,10 @@ function mixinLifecycleEvents(target) {
|
|
|
1064
1089
|
}
|
|
1065
1090
|
}
|
|
1066
1091
|
|
|
1067
|
-
var Observer = observer(function (
|
|
1068
|
-
var children =
|
|
1069
|
-
observerInject =
|
|
1070
|
-
render =
|
|
1092
|
+
var Observer = observer(function (_ref2) {
|
|
1093
|
+
var children = _ref2.children,
|
|
1094
|
+
observerInject = _ref2.inject,
|
|
1095
|
+
render = _ref2.render;
|
|
1071
1096
|
var component = children || render;
|
|
1072
1097
|
|
|
1073
1098
|
if (typeof component === "undefined") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-react",
|
|
3
|
-
"version": "5.3
|
|
3
|
+
"version": "5.4.3",
|
|
4
4
|
"description": "React bindings for MobX. Create fully reactive components.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"jsnext:main": "index.module.js",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"opn-cli": "^3.1.0",
|
|
55
55
|
"prettier": "^1.7.2",
|
|
56
56
|
"prop-types": "^15.6.0",
|
|
57
|
-
"react": "^16.
|
|
58
|
-
"react-dom": "^16.
|
|
59
|
-
"react-test-renderer": "^16.
|
|
57
|
+
"react": "^16.6.3",
|
|
58
|
+
"react-dom": "^16.6.3",
|
|
59
|
+
"react-test-renderer": "^16.6.3",
|
|
60
60
|
"regenerator-runtime": "^0.12.1",
|
|
61
61
|
"request": "^2.83.0",
|
|
62
62
|
"rollup": "^0.66.2",
|
|
@@ -89,7 +89,9 @@
|
|
|
89
89
|
"git add"
|
|
90
90
|
]
|
|
91
91
|
},
|
|
92
|
-
"jest": {
|
|
92
|
+
"jest": {
|
|
93
|
+
"testURL": "http://127.0.0.1/"
|
|
94
|
+
},
|
|
93
95
|
"husky": {
|
|
94
96
|
"hooks": {
|
|
95
97
|
"pre-commit": "lint-staged"
|