mobx-react 5.4.0 → 5.4.4
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 +8 -0
- package/README.md +3 -2
- package/custom.js +74 -68
- package/custom.module.js +71 -65
- package/dist/mobx-react.d.ts +105 -0
- package/dist/mobx-react.js +2 -0
- package/dist/mobx-react.js.map +1 -0
- package/dist/mobx-react.module.js +2 -0
- package/dist/mobx-react.module.js.map +1 -0
- package/dist/mobx-react.rn.module.js +2 -0
- package/dist/mobx-react.umd.js +2 -0
- package/dist/mobx-react.umd.js.map +1 -0
- package/index.js +74 -68
- package/index.min.js +9 -1
- package/index.module.js +71 -65
- package/native.js +71 -65
- package/package.json +4 -5
- package/yarn.lock +38 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# MobX-React Changelog
|
|
2
2
|
|
|
3
|
+
### 5.4.3
|
|
4
|
+
|
|
5
|
+
* Fixed [#612](https://github.com/mobxjs/mobx-react/issues/612), `contextType` was hoisted by `inject`, which shouldn't the case.
|
|
6
|
+
|
|
7
|
+
### 5.4.1 / 5.4.2
|
|
8
|
+
|
|
9
|
+
* Fixed issue where `react-is` wasn't properly rolled-up into the package. Fixes [#608](https://github.com/mobxjs/mobx-react/issues/608)
|
|
10
|
+
|
|
3
11
|
### 5.4.0
|
|
4
12
|
|
|
5
13
|
* Added support for forward refs, fixes [#602](https://github.com/mobxjs/mobx-react/issues/602)
|
package/README.md
CHANGED
|
@@ -34,6 +34,7 @@ If you are using [React hooks](https://reactjs.org/docs/hooks-intro.html) with l
|
|
|
34
34
|
* Minimal MobX, React, ES6(babel), JSPM with hot reloading modules:
|
|
35
35
|
[jspm-react](https://github.com/capaj/jspm-react)
|
|
36
36
|
* React Native Counter: [Mobx-React-Native-Counter](https://github.com/bartonhammond/mobx-react-native-counter)
|
|
37
|
+
* React Native, TypeScript, React Navigation: [Ignite Bowser](https://github.com/infinitered/ignite-bowser)
|
|
37
38
|
|
|
38
39
|
## API documentation
|
|
39
40
|
|
|
@@ -201,7 +202,7 @@ class TodoView extends React.Component {
|
|
|
201
202
|
```
|
|
202
203
|
|
|
203
204
|
* `componentWillReact` doesn't take arguments
|
|
204
|
-
* `componentWillReact` won't fire before the initial render (use
|
|
205
|
+
* `componentWillReact` won't fire before the initial render (use `componentDidMount` or `constructor` instead)
|
|
205
206
|
|
|
206
207
|
### `PropTypes`
|
|
207
208
|
|
|
@@ -441,7 +442,7 @@ class SomeComponent extends React.Component {
|
|
|
441
442
|
disposeOnUnmount(this, reaction(...))
|
|
442
443
|
|
|
443
444
|
// or function array
|
|
444
|
-
|
|
445
|
+
disposeOnUnmount(this, [
|
|
445
446
|
reaction(...),
|
|
446
447
|
reaction(...)
|
|
447
448
|
])
|
package/custom.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/** @license mobx-react v5.4.4
|
|
2
|
+
* custom.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 Michel Weststrate.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
1
9
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '
|
|
4
|
-
(factory((global.mobxReact = {}),global.
|
|
5
|
-
}(this, (function (exports,React
|
|
10
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('react')) :
|
|
11
|
+
typeof define === 'function' && define.amd ? define(['exports', 'mobx', 'react'], factory) :
|
|
12
|
+
(factory((global.mobxReact = {}),global.mobx,global.React));
|
|
13
|
+
}(this, (function (exports,mobx,React) { 'use strict';
|
|
6
14
|
|
|
7
15
|
var React__default = 'default' in React ? React['default'] : React;
|
|
8
16
|
|
|
@@ -57,25 +65,6 @@
|
|
|
57
65
|
return obj;
|
|
58
66
|
}
|
|
59
67
|
|
|
60
|
-
function _objectSpread(target) {
|
|
61
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
62
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
63
|
-
var ownKeys = Object.keys(source);
|
|
64
|
-
|
|
65
|
-
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
66
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
67
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
ownKeys.forEach(function (key) {
|
|
72
|
-
_defineProperty(target, key, source[key]);
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return target;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
68
|
function _inherits(subClass, superClass) {
|
|
80
69
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
81
70
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -135,33 +124,35 @@
|
|
|
135
124
|
|
|
136
125
|
var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
|
137
126
|
Object.defineProperty(exports,"__esModule",{value:!0});
|
|
138
|
-
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,
|
|
139
|
-
function
|
|
140
|
-
exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===
|
|
141
|
-
exports.isForwardRef=function(a){return
|
|
127
|
+
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"):
|
|
128
|
+
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;
|
|
129
|
+
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};
|
|
130
|
+
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};
|
|
142
131
|
});
|
|
143
132
|
|
|
144
133
|
unwrapExports(reactIs_production_min);
|
|
145
134
|
var reactIs_production_min_1 = reactIs_production_min.typeOf;
|
|
146
135
|
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
|
|
147
|
-
var reactIs_production_min_3 = reactIs_production_min.
|
|
148
|
-
var reactIs_production_min_4 = reactIs_production_min.
|
|
149
|
-
var reactIs_production_min_5 = reactIs_production_min.
|
|
150
|
-
var reactIs_production_min_6 = reactIs_production_min.
|
|
151
|
-
var reactIs_production_min_7 = reactIs_production_min.
|
|
152
|
-
var reactIs_production_min_8 = reactIs_production_min.
|
|
153
|
-
var reactIs_production_min_9 = reactIs_production_min.
|
|
154
|
-
var reactIs_production_min_10 = reactIs_production_min.
|
|
155
|
-
var reactIs_production_min_11 = reactIs_production_min.
|
|
156
|
-
var reactIs_production_min_12 = reactIs_production_min.
|
|
157
|
-
var reactIs_production_min_13 = reactIs_production_min.
|
|
158
|
-
var reactIs_production_min_14 = reactIs_production_min.
|
|
159
|
-
var reactIs_production_min_15 = reactIs_production_min.
|
|
160
|
-
var reactIs_production_min_16 = reactIs_production_min.
|
|
161
|
-
var reactIs_production_min_17 = reactIs_production_min.
|
|
162
|
-
var reactIs_production_min_18 = reactIs_production_min.
|
|
163
|
-
var reactIs_production_min_19 = reactIs_production_min.
|
|
164
|
-
var reactIs_production_min_20 = reactIs_production_min.
|
|
136
|
+
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
|
|
137
|
+
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
|
|
138
|
+
var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
|
|
139
|
+
var reactIs_production_min_6 = reactIs_production_min.Element;
|
|
140
|
+
var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
|
|
141
|
+
var reactIs_production_min_8 = reactIs_production_min.Fragment;
|
|
142
|
+
var reactIs_production_min_9 = reactIs_production_min.Profiler;
|
|
143
|
+
var reactIs_production_min_10 = reactIs_production_min.Portal;
|
|
144
|
+
var reactIs_production_min_11 = reactIs_production_min.StrictMode;
|
|
145
|
+
var reactIs_production_min_12 = reactIs_production_min.isValidElementType;
|
|
146
|
+
var reactIs_production_min_13 = reactIs_production_min.isAsyncMode;
|
|
147
|
+
var reactIs_production_min_14 = reactIs_production_min.isConcurrentMode;
|
|
148
|
+
var reactIs_production_min_15 = reactIs_production_min.isContextConsumer;
|
|
149
|
+
var reactIs_production_min_16 = reactIs_production_min.isContextProvider;
|
|
150
|
+
var reactIs_production_min_17 = reactIs_production_min.isElement;
|
|
151
|
+
var reactIs_production_min_18 = reactIs_production_min.isForwardRef;
|
|
152
|
+
var reactIs_production_min_19 = reactIs_production_min.isFragment;
|
|
153
|
+
var reactIs_production_min_20 = reactIs_production_min.isProfiler;
|
|
154
|
+
var reactIs_production_min_21 = reactIs_production_min.isPortal;
|
|
155
|
+
var reactIs_production_min_22 = reactIs_production_min.isStrictMode;
|
|
165
156
|
|
|
166
157
|
var reactIs = createCommonjsModule(function (module) {
|
|
167
158
|
|
|
@@ -170,22 +161,19 @@
|
|
|
170
161
|
}
|
|
171
162
|
});
|
|
172
163
|
|
|
173
|
-
var _ReactIs$ForwardRef;
|
|
174
|
-
|
|
175
|
-
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; }
|
|
176
|
-
|
|
177
164
|
/**
|
|
178
165
|
* Copyright 2015, Yahoo! Inc.
|
|
179
166
|
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
180
167
|
*/
|
|
181
168
|
|
|
182
|
-
|
|
183
169
|
var REACT_STATICS = {
|
|
184
170
|
childContextTypes: true,
|
|
171
|
+
contextType: true,
|
|
185
172
|
contextTypes: true,
|
|
186
173
|
defaultProps: true,
|
|
187
174
|
displayName: true,
|
|
188
175
|
getDefaultProps: true,
|
|
176
|
+
getDerivedStateFromError: true,
|
|
189
177
|
getDerivedStateFromProps: true,
|
|
190
178
|
mixins: true,
|
|
191
179
|
propTypes: true,
|
|
@@ -202,7 +190,16 @@
|
|
|
202
190
|
arity: true
|
|
203
191
|
};
|
|
204
192
|
|
|
205
|
-
var
|
|
193
|
+
var FORWARD_REF_STATICS = {
|
|
194
|
+
'$$typeof': true,
|
|
195
|
+
render: true,
|
|
196
|
+
defaultProps: true,
|
|
197
|
+
displayName: true,
|
|
198
|
+
propTypes: true
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
var TYPE_STATICS = {};
|
|
202
|
+
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
206
203
|
|
|
207
204
|
var defineProperty = Object.defineProperty;
|
|
208
205
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
@@ -457,7 +454,8 @@
|
|
|
457
454
|
return !(component.prototype && component.prototype.render);
|
|
458
455
|
}
|
|
459
456
|
var symbolId = 0;
|
|
460
|
-
|
|
457
|
+
|
|
458
|
+
function createSymbol(name) {
|
|
461
459
|
if (typeof Symbol === "function") {
|
|
462
460
|
return Symbol(name);
|
|
463
461
|
}
|
|
@@ -466,6 +464,15 @@
|
|
|
466
464
|
symbolId++;
|
|
467
465
|
return symbol;
|
|
468
466
|
}
|
|
467
|
+
|
|
468
|
+
var createdSymbols = {};
|
|
469
|
+
function newSymbol(name) {
|
|
470
|
+
if (!createdSymbols[name]) {
|
|
471
|
+
createdSymbols[name] = createSymbol(name);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return createdSymbols[name];
|
|
475
|
+
}
|
|
469
476
|
var mobxMixins = newSymbol("patchMixins");
|
|
470
477
|
var mobxPatchedDefinition = newSymbol("patchedDefinition");
|
|
471
478
|
|
|
@@ -711,8 +718,6 @@
|
|
|
711
718
|
}
|
|
712
719
|
}
|
|
713
720
|
|
|
714
|
-
var ReactIs = require("react-is");
|
|
715
|
-
|
|
716
721
|
var mobxAdminProperty = mobx.$mobx || "$mobx";
|
|
717
722
|
var mobxIsUnmounted = newSymbol("isUnmounted");
|
|
718
723
|
/**
|
|
@@ -726,7 +731,9 @@
|
|
|
726
731
|
var componentByNodeRegistry = typeof WeakMap !== "undefined" ? new WeakMap() : undefined;
|
|
727
732
|
var renderReporter = new EventEmitter();
|
|
728
733
|
var skipRenderKey = newSymbol("skipRender");
|
|
729
|
-
var isForcingUpdateKey = newSymbol("isForcingUpdate");
|
|
734
|
+
var isForcingUpdateKey = newSymbol("isForcingUpdate"); // Using react-is had some issues (and operates on elements, not on types), see #608 / #609
|
|
735
|
+
|
|
736
|
+
var ReactForwardRefSymbol = typeof React.forwardRef === "function" && React.forwardRef(function (_props, _ref) {})["$$typeof"];
|
|
730
737
|
/**
|
|
731
738
|
* Helper to set `prop` to `this` as non-enumerable (hidden prop)
|
|
732
739
|
* @param target
|
|
@@ -1022,16 +1029,15 @@
|
|
|
1022
1029
|
// not the ForwardRef HoC
|
|
1023
1030
|
|
|
1024
1031
|
|
|
1025
|
-
if (componentClass["$$typeof"] ===
|
|
1032
|
+
if (ReactForwardRefSymbol && componentClass["$$typeof"] === ReactForwardRefSymbol) {
|
|
1026
1033
|
var _baseRender = componentClass.render;
|
|
1027
|
-
if (typeof _baseRender !== "function") throw new Error("render property of ForwardRef was not a function");
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
}
|
|
1034
|
+
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?
|
|
1035
|
+
|
|
1036
|
+
return React.forwardRef(function ObserverForwardRef() {
|
|
1037
|
+
var _arguments = arguments;
|
|
1038
|
+
return React__default.createElement(Observer, null, function () {
|
|
1039
|
+
return _baseRender.apply(undefined, _arguments);
|
|
1040
|
+
});
|
|
1035
1041
|
});
|
|
1036
1042
|
} // Stateless function component:
|
|
1037
1043
|
// If it is function but doesn't seem to be a react class constructor,
|
|
@@ -1098,10 +1104,10 @@
|
|
|
1098
1104
|
}
|
|
1099
1105
|
}
|
|
1100
1106
|
|
|
1101
|
-
var Observer = observer(function (
|
|
1102
|
-
var children =
|
|
1103
|
-
observerInject =
|
|
1104
|
-
render =
|
|
1107
|
+
var Observer = observer(function (_ref2) {
|
|
1108
|
+
var children = _ref2.children,
|
|
1109
|
+
observerInject = _ref2.inject,
|
|
1110
|
+
render = _ref2.render;
|
|
1105
1111
|
var component = children || render;
|
|
1106
1112
|
|
|
1107
1113
|
if (typeof component === "undefined") {
|
package/custom.module.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/** @license mobx-react v5.4.4
|
|
2
|
+
* custom.module.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 Michel Weststrate.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
2
9
|
import { isObservableArray, isObservableObject, isObservableMap, untracked, createAtom, Reaction, _allowStateChanges, $mobx, spy, getDebugName } from 'mobx';
|
|
10
|
+
import React__default, { Component, createElement, PureComponent, forwardRef, Children } from 'react';
|
|
3
11
|
|
|
4
12
|
function _typeof(obj) {
|
|
5
13
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
@@ -52,25 +60,6 @@ function _defineProperty(obj, key, value) {
|
|
|
52
60
|
return obj;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
function _objectSpread(target) {
|
|
56
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
57
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
58
|
-
var ownKeys = Object.keys(source);
|
|
59
|
-
|
|
60
|
-
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
61
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
62
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
63
|
-
}));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
ownKeys.forEach(function (key) {
|
|
67
|
-
_defineProperty(target, key, source[key]);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return target;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
63
|
function _inherits(subClass, superClass) {
|
|
75
64
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
76
65
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -130,33 +119,35 @@ function createCommonjsModule(fn, module) {
|
|
|
130
119
|
|
|
131
120
|
var reactIs_production_min = createCommonjsModule(function (module, exports) {
|
|
132
121
|
Object.defineProperty(exports,"__esModule",{value:!0});
|
|
133
|
-
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,
|
|
134
|
-
function
|
|
135
|
-
exports.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===
|
|
136
|
-
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};
|
|
137
126
|
});
|
|
138
127
|
|
|
139
128
|
unwrapExports(reactIs_production_min);
|
|
140
129
|
var reactIs_production_min_1 = reactIs_production_min.typeOf;
|
|
141
130
|
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
|
|
142
|
-
var reactIs_production_min_3 = reactIs_production_min.
|
|
143
|
-
var reactIs_production_min_4 = reactIs_production_min.
|
|
144
|
-
var reactIs_production_min_5 = reactIs_production_min.
|
|
145
|
-
var reactIs_production_min_6 = reactIs_production_min.
|
|
146
|
-
var reactIs_production_min_7 = reactIs_production_min.
|
|
147
|
-
var reactIs_production_min_8 = reactIs_production_min.
|
|
148
|
-
var reactIs_production_min_9 = reactIs_production_min.
|
|
149
|
-
var reactIs_production_min_10 = reactIs_production_min.
|
|
150
|
-
var reactIs_production_min_11 = reactIs_production_min.
|
|
151
|
-
var reactIs_production_min_12 = reactIs_production_min.
|
|
152
|
-
var reactIs_production_min_13 = reactIs_production_min.
|
|
153
|
-
var reactIs_production_min_14 = reactIs_production_min.
|
|
154
|
-
var reactIs_production_min_15 = reactIs_production_min.
|
|
155
|
-
var reactIs_production_min_16 = reactIs_production_min.
|
|
156
|
-
var reactIs_production_min_17 = reactIs_production_min.
|
|
157
|
-
var reactIs_production_min_18 = reactIs_production_min.
|
|
158
|
-
var reactIs_production_min_19 = reactIs_production_min.
|
|
159
|
-
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;
|
|
160
151
|
|
|
161
152
|
var reactIs = createCommonjsModule(function (module) {
|
|
162
153
|
|
|
@@ -165,22 +156,19 @@ var reactIs = createCommonjsModule(function (module) {
|
|
|
165
156
|
}
|
|
166
157
|
});
|
|
167
158
|
|
|
168
|
-
var _ReactIs$ForwardRef;
|
|
169
|
-
|
|
170
|
-
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; }
|
|
171
|
-
|
|
172
159
|
/**
|
|
173
160
|
* Copyright 2015, Yahoo! Inc.
|
|
174
161
|
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
175
162
|
*/
|
|
176
163
|
|
|
177
|
-
|
|
178
164
|
var REACT_STATICS = {
|
|
179
165
|
childContextTypes: true,
|
|
166
|
+
contextType: true,
|
|
180
167
|
contextTypes: true,
|
|
181
168
|
defaultProps: true,
|
|
182
169
|
displayName: true,
|
|
183
170
|
getDefaultProps: true,
|
|
171
|
+
getDerivedStateFromError: true,
|
|
184
172
|
getDerivedStateFromProps: true,
|
|
185
173
|
mixins: true,
|
|
186
174
|
propTypes: true,
|
|
@@ -197,7 +185,16 @@ var KNOWN_STATICS = {
|
|
|
197
185
|
arity: true
|
|
198
186
|
};
|
|
199
187
|
|
|
200
|
-
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;
|
|
201
198
|
|
|
202
199
|
var defineProperty = Object.defineProperty;
|
|
203
200
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
@@ -452,7 +449,8 @@ function isStateless(component) {
|
|
|
452
449
|
return !(component.prototype && component.prototype.render);
|
|
453
450
|
}
|
|
454
451
|
var symbolId = 0;
|
|
455
|
-
|
|
452
|
+
|
|
453
|
+
function createSymbol(name) {
|
|
456
454
|
if (typeof Symbol === "function") {
|
|
457
455
|
return Symbol(name);
|
|
458
456
|
}
|
|
@@ -461,6 +459,15 @@ function newSymbol(name) {
|
|
|
461
459
|
symbolId++;
|
|
462
460
|
return symbol;
|
|
463
461
|
}
|
|
462
|
+
|
|
463
|
+
var createdSymbols = {};
|
|
464
|
+
function newSymbol(name) {
|
|
465
|
+
if (!createdSymbols[name]) {
|
|
466
|
+
createdSymbols[name] = createSymbol(name);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
return createdSymbols[name];
|
|
470
|
+
}
|
|
464
471
|
var mobxMixins = newSymbol("patchMixins");
|
|
465
472
|
var mobxPatchedDefinition = newSymbol("patchedDefinition");
|
|
466
473
|
|
|
@@ -706,8 +713,6 @@ function inject()
|
|
|
706
713
|
}
|
|
707
714
|
}
|
|
708
715
|
|
|
709
|
-
var ReactIs = require("react-is");
|
|
710
|
-
|
|
711
716
|
var mobxAdminProperty = $mobx || "$mobx";
|
|
712
717
|
var mobxIsUnmounted = newSymbol("isUnmounted");
|
|
713
718
|
/**
|
|
@@ -721,7 +726,9 @@ var warnedAboutObserverInjectDeprecation = false; // WeakMap<Node, Object>;
|
|
|
721
726
|
var componentByNodeRegistry = typeof WeakMap !== "undefined" ? new WeakMap() : undefined;
|
|
722
727
|
var renderReporter = new EventEmitter();
|
|
723
728
|
var skipRenderKey = newSymbol("skipRender");
|
|
724
|
-
var isForcingUpdateKey = newSymbol("isForcingUpdate");
|
|
729
|
+
var isForcingUpdateKey = newSymbol("isForcingUpdate"); // Using react-is had some issues (and operates on elements, not on types), see #608 / #609
|
|
730
|
+
|
|
731
|
+
var ReactForwardRefSymbol = typeof forwardRef === "function" && forwardRef(function (_props, _ref) {})["$$typeof"];
|
|
725
732
|
/**
|
|
726
733
|
* Helper to set `prop` to `this` as non-enumerable (hidden prop)
|
|
727
734
|
* @param target
|
|
@@ -1017,16 +1024,15 @@ function observer(arg1, arg2) {
|
|
|
1017
1024
|
// not the ForwardRef HoC
|
|
1018
1025
|
|
|
1019
1026
|
|
|
1020
|
-
if (componentClass["$$typeof"] ===
|
|
1027
|
+
if (ReactForwardRefSymbol && componentClass["$$typeof"] === ReactForwardRefSymbol) {
|
|
1021
1028
|
var _baseRender = componentClass.render;
|
|
1022
|
-
if (typeof _baseRender !== "function") throw new Error("render property of ForwardRef was not a function");
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1029
|
+
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?
|
|
1030
|
+
|
|
1031
|
+
return forwardRef(function ObserverForwardRef() {
|
|
1032
|
+
var _arguments = arguments;
|
|
1033
|
+
return React__default.createElement(Observer, null, function () {
|
|
1034
|
+
return _baseRender.apply(undefined, _arguments);
|
|
1035
|
+
});
|
|
1030
1036
|
});
|
|
1031
1037
|
} // Stateless function component:
|
|
1032
1038
|
// If it is function but doesn't seem to be a react class constructor,
|
|
@@ -1093,10 +1099,10 @@ function mixinLifecycleEvents(target) {
|
|
|
1093
1099
|
}
|
|
1094
1100
|
}
|
|
1095
1101
|
|
|
1096
|
-
var Observer = observer(function (
|
|
1097
|
-
var children =
|
|
1098
|
-
observerInject =
|
|
1099
|
-
render =
|
|
1102
|
+
var Observer = observer(function (_ref2) {
|
|
1103
|
+
var children = _ref2.children,
|
|
1104
|
+
observerInject = _ref2.inject,
|
|
1105
|
+
render = _ref2.render;
|
|
1100
1106
|
var component = children || render;
|
|
1101
1107
|
|
|
1102
1108
|
if (typeof component === "undefined") {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a React component or stateless render function into a reactive component.
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react"
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
useObservable,
|
|
8
|
+
useComputed,
|
|
9
|
+
useDisposable,
|
|
10
|
+
IObserverOptions,
|
|
11
|
+
useObserver,
|
|
12
|
+
Observer
|
|
13
|
+
} from "mobx-react-lite"
|
|
14
|
+
|
|
15
|
+
export type IReactComponent<P = any> =
|
|
16
|
+
| React.StatelessComponent<P>
|
|
17
|
+
| React.ComponentClass<P>
|
|
18
|
+
| React.ClassicComponentClass<P>
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Observer
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export function observer<T extends IReactComponent>(target: T): T
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Inject
|
|
28
|
+
*/
|
|
29
|
+
export type IValueMap = { [key: string]: any }
|
|
30
|
+
export type IStoresToProps<
|
|
31
|
+
S extends IValueMap = {},
|
|
32
|
+
P extends IValueMap = {},
|
|
33
|
+
I extends IValueMap = {},
|
|
34
|
+
C extends IValueMap = {}
|
|
35
|
+
> = (stores: S, nextProps: P, context: C) => I
|
|
36
|
+
|
|
37
|
+
export type IWrappedComponent<P> = {
|
|
38
|
+
wrappedComponent: IReactComponent<P>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Ideally we would want to return React.ComponentClass<Partial<P>>,
|
|
42
|
+
// but TS doesn't allow such things in decorators, like we do in the non-decorator version
|
|
43
|
+
// See also #256
|
|
44
|
+
export function inject(
|
|
45
|
+
...stores: string[]
|
|
46
|
+
): <T extends IReactComponent<any>>(
|
|
47
|
+
target: T
|
|
48
|
+
) => T & (T extends IReactComponent<infer P> ? IWrappedComponent<P> : never)
|
|
49
|
+
export function inject<S, P, I, C>(
|
|
50
|
+
fn: IStoresToProps<S, P, I, C>
|
|
51
|
+
): <T extends IReactComponent>(target: T) => T & IWrappedComponent<P>
|
|
52
|
+
|
|
53
|
+
// Ideal implementation:
|
|
54
|
+
// export function inject
|
|
55
|
+
// (
|
|
56
|
+
// fn: IStoresToProps
|
|
57
|
+
// ):
|
|
58
|
+
// <P>(target: IReactComponent<P>) => IReactComponent<Partial<P>> & IWrappedComponent<IReactComponent<Partial<P>>>
|
|
59
|
+
//
|
|
60
|
+
// Or even better: (but that would require type inference to work other way around)
|
|
61
|
+
// export function inject<P, I>
|
|
62
|
+
// (
|
|
63
|
+
// fn: IStoresToProps<any, P, I>
|
|
64
|
+
// ):
|
|
65
|
+
// <T extends IReactComponent<P & S>(target: T) => IReactComponent<P> & IWrappedComponent<T>
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* disposeOnUnmount
|
|
69
|
+
*/
|
|
70
|
+
type Disposer = () => void
|
|
71
|
+
export function disposeOnUnmount(target: React.Component<any, any>, propertyKey: string): void
|
|
72
|
+
export function disposeOnUnmount<TF extends Disposer | Disposer[]>(
|
|
73
|
+
target: React.Component<any, any>,
|
|
74
|
+
fn: TF
|
|
75
|
+
): TF
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Utilities
|
|
79
|
+
*/
|
|
80
|
+
export class Provider extends React.Component<any, {}> {}
|
|
81
|
+
|
|
82
|
+
export function useStaticRendering(value: boolean): void
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated, use PropTypes instead
|
|
86
|
+
*/
|
|
87
|
+
export const propTypes: {
|
|
88
|
+
observableArray: React.Requireable<any>
|
|
89
|
+
observableArrayOf: (type: React.Validator<any>) => React.Requireable<any>
|
|
90
|
+
observableMap: React.Requireable<any>
|
|
91
|
+
observableObject: React.Requireable<any>
|
|
92
|
+
arrayOrObservableArray: React.Requireable<any>
|
|
93
|
+
arrayOrObservableArrayOf: (type: React.Validator<any>) => React.Requireable<any>
|
|
94
|
+
objectOrObservableObject: React.Requireable<any>
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export const PropTypes: {
|
|
98
|
+
observableArray: React.Requireable<any>
|
|
99
|
+
observableArrayOf: (type: React.Validator<any>) => React.Requireable<any>
|
|
100
|
+
observableMap: React.Requireable<any>
|
|
101
|
+
observableObject: React.Requireable<any>
|
|
102
|
+
arrayOrObservableArray: React.Requireable<any>
|
|
103
|
+
arrayOrObservableArrayOf: (type: React.Validator<any>) => React.Requireable<any>
|
|
104
|
+
objectOrObservableObject: React.Requireable<any>
|
|
105
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e,r=require("react-dom"),t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("mobx");if(!t.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!o.spy)throw new Error("mobx-react-lite requires mobx at least version 4 to be available");var i=function(){},a=!1;function u(){return a}var c=function(){return(c=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function s(e){return e.current?o.getDependencyTree(e.current):"<unknown>"}var f=[];function p(e,r){if(void 0===r&&(r="observed"),u())return e();var n,i,a,c=(a=function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,o,i=t.call(e),a=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}(t.useState(0),2)[1],t.useCallback(function(){a(function(e){return e+1})},[])),p=t.useRef(null);if(p.current||(p.current=new o.Reaction("observer("+r+")",function(){c()})),t.useDebugValue(p,s),function(e){t.useEffect(function(){return e},f)}(function(){p.current.dispose()}),p.current.track(function(){try{n=e()}catch(e){i=e}}),i)throw p.current.dispose(),i;return n}var l={$$typeof:!0,render:!0,compare:!0,type:!0};function d(e){var r=e.children||e.render;return"function"!=typeof r?null:p(r)}function b(e,r,t,n,o){var i="function"==typeof e[r],a="function"==typeof e["children"===r?"render":"children"];return i&&a?new Error("MobX Observer: Do not use children and render in the same time in`"+t):i||a?null:new Error("Invalid prop `"+o+"` of type `"+typeof e[r]+"` supplied to `"+t+"`, expected `function`.")}d.propTypes={children:b,render:b},d.displayName="Observer";var y=0,v={};function h(e){return v[e]||(v[e]=function(e){if("function"==typeof Symbol)return Symbol(e);var r="__$mobx-react "+e+" ("+y+")";return y++,r}(e)),v[e]}function m(e,r){if(w(e,r))return!0;if("object"!=typeof e||null===e||"object"!=typeof r||null===r)return!1;var t=Object.keys(e),n=Object.keys(r);if(t.length!==n.length)return!1;for(var o=0;o<t.length;o++)if(!hasOwnProperty.call(r,t[o])||!w(e[t[o]],r[t[o]]))return!1;return!0}function w(e,r){return e===r?0!==e||1/e==1/r:e!=e&&r!=r}var O={$$typeof:1,render:1,compare:1,type:1,childContextTypes:1,contextType:1,contextTypes:1,defaultProps:1,getDefaultProps:1,getDerivedStateFromError:1,getDerivedStateFromProps:1,mixins:1,propTypes:1},g=!1,j=h("skipRender"),x=h("isForcingUpdate"),P="function"==typeof t.forwardRef&&t.forwardRef(function(e,r){}).$$typeof;function E(e,r,t){Object.hasOwnProperty.call(e,r)?e[r]=t:Object.defineProperty(e,r,{enumerable:!1,configurable:!0,writable:!0,value:t})}function R(e,r){return g&&console.warn("[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side."),this.state!==r||!m(this.props,e)}function C(e,r){var t=h("reactProp_"+r+"_valueHolder"),n=h("reactProp_"+r+"_atomHolder");function i(){return this[n]||E(this,n,o.createAtom("reactive "+r)),this[n]}Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get:function(){return i.call(this).reportObserved(),this[t]},set:function(e){this[x]||m(this[t],e)?E(this,t,e):(E(this,t,e),E(this,j,!0),i.call(this).reportChanged(),E(this,j,!1))}})}function k(e){if(!0===e.isMobxInjector&&console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"),P&&e.$$typeof===P){var r=e.render;if("function"!=typeof r)throw new Error("render property of ForwardRef was not a function");return t.forwardRef(function(){var e=arguments;return n.createElement(d,null,function(){return r.apply(void 0,e)})})}return"function"!=typeof e||e.prototype&&e.prototype.render||e.isReactClass||t.Component.isPrototypeOf(e)?function(e){var r=e.prototype||e;if(r.componentWillReact)throw new Error("The componentWillReact life-cycle event is no longer supported");if(e.__proto__!==t.PureComponent)if(r.shouldComponentUpdate){if(r.shouldComponentUpdate!==R)throw new Error("It is not allowed to use shouldComponentUpdate in observer based components.")}else r.shouldComponentUpdate=R;C(r,"props"),C(r,"state");var o=r.render;return r.render=function(){if(!this.baseRender){var e=o.bind(this);this.baseRender=function(){return e()}}return n.createElement(d,null,this.baseRender)},e}(e):function(e,r){if(u())return e;var n,o,i,a=c({forwardRef:!1},void 0),s=e.displayName||e.name,f=function(r,t){return p(function(){return e(r,t)},s)};return n=t.memo(a.forwardRef?t.forwardRef(f):f),o=e,i=n,Object.keys(o).forEach(function(e){o.hasOwnProperty(e)&&!l[e]&&Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(o,e))}),n.displayName=s,n}(e)}var _={children:!0,key:!0,ref:!0},S=t.createContext({}),U=function(e){function r(r,t){e.call(this,r,t),this.state=Object.assign({},t,T(r))}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.render=function(){return t.createElement(S.Provider,{value:this.state},t.Children.only(this.props.children))},r.getDerivedStateFromProps=function(e,r){if(!m(r,Object.assign({},r,T(e))))throw new Error("MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children");return r},r}(t.Component);function T(e){var r={};if(!e)return r;for(var t in e)A(t)&&(r[t]=e[t]);return r}function A(e){return!_[e]&&"suppressChangedStoreWarning"!==e}function M(e,r,o,i){var a=function(e,r){var t=e.displayName||e.name||e.constructor&&e.constructor.name||"Component";return r?"inject-with-"+r+"("+t+")":"inject("+t+")"}(r,o),u=function(n){function o(){n.apply(this,arguments)}return n&&(o.__proto__=n),(o.prototype=Object.create(n&&n.prototype)).constructor=o,o.prototype.render=function(){var n=this.props,o=n.forwardRef,i=function(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===r.indexOf(n)&&(t[n]=e[n]);return t}(n,["forwardRef"]);return Object.assign(i,e(this.context||{},i)||{}),o&&!function(e){return!(e.prototype&&e.prototype.render)}(r)&&(i.ref=this.props.forwardRef),t.createElement(r,i)},o}(t.Component);u.contextType=S,i&&(u=k(u)),u.isMobxInjector=!0;var c,s,f=n.forwardRef(function(e,r){return n.createElement(u,Object.assign({},e,{forwardRef:r}))});return c=r,s=f,Object.keys(c).forEach(function(e){c.hasOwnProperty(e)&&!O[e]&&Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(c,e))}),f.wrappedComponent=r,f.displayName=a,f}U.contextType=S;var D=h("disposeOnUnmount"),q=h("originalOnUnmount");function $(){var e=this;this[q]&&this[q](),this[D]&&(this[D].forEach(function(r){var t="string"==typeof r?e[r]:r;if(null!=t){if("function"!=typeof t)throw new Error("[mobx-react] disposeOnUnmount only works on functions such as disposers returned by reactions, autorun, etc.");t()}}),this[D]=[])}function I(e){function r(r,t,n,i,a,u){for(var c=[],s=arguments.length-6;s-- >0;)c[s]=arguments[s+6];return o.untracked(function(){return i=i||"<<anonymous>>",u=u||n,null==t[n]?r?new Error("The "+a+" `"+u+"` is marked as required in `"+i+"`, but its value is `"+(null===t[n]?"null":"undefined")+"`."):null:e.apply(void 0,[t,n,i,a,u].concat(c))})}var t=r.bind(null,!1);return t.isRequired=r.bind(null,!0),t}function W(e){var r=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,r){return"symbol"===e||"Symbol"===r["@@toStringTag"]||"function"==typeof Symbol&&r instanceof Symbol}(r,e)?"symbol":r}function F(e,r){return I(function(t,n,i,a,u){return o.untracked(function(){if(e&&W(t[n])===r.toLowerCase())return null;var a;switch(r){case"Array":a=o.isObservableArray;break;case"Object":a=o.isObservableObject;break;case"Map":a=o.isObservableMap;break;default:throw new Error("Unexpected mobxType: "+r)}var c=t[n];if(!a(c)){var s=function(e){var r=W(e);if("object"===r){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return r}(c),f=e?" or javascript `"+r.toLowerCase()+"`":"";return new Error("Invalid prop `"+u+"` of type `"+s+"` supplied to `"+i+"`, expected `mobx.Observable"+r+"`"+f+".")}return null})})}function N(e,r){return I(function(t,n,i,a,u){for(var c=[],s=arguments.length-5;s-- >0;)c[s]=arguments[s+5];return o.untracked(function(){if("function"!=typeof r)return new Error("Property `"+u+"` of component `"+i+"` has invalid PropType notation.");var o=F(e,"Array")(t,n,i);if(o instanceof Error)return o;for(var s=t[n],f=0;f<s.length;f++)if((o=r.apply(void 0,[s,f,i,a,u+"["+f+"]"].concat(c)))instanceof Error)return o;return null})})}var H={observableArray:F(!1,"Array"),observableArrayOf:N.bind(null,!1),observableMap:F(!1,"Map"),observableObject:F(!1,"Object"),arrayOrObservableArray:F(!0,"Array"),arrayOrObservableArrayOf:N.bind(null,!0),objectOrObservableObject:F(!0,"Object")};if(!t.Component)throw new Error("mobx-react requires React to be available");if(!o.observable)throw new Error("mobx-react requires mobx to be available");"function"==typeof r.unstable_batchedUpdates&&o.configure({reactionScheduler:r.unstable_batchedUpdates}),exports.useObservable=function(e){var r=t.useRef(null);return r.current||(r.current=o.observable(e)),r.current},exports.useComputed=function(e,r){return void 0===r&&(r=[]),t.useMemo(function(){return o.computed(e)},r).get()},exports.useDisposable=function(e,r){void 0===r&&(r=[]);var n=t.useRef(null),o=t.useRef(!1);function a(r){if(o.current)return i;if(!n.current){var t=e();if("function"!=typeof t){var a=new Error("generated disposer must be a function");return console.error(a),i}n.current=t}return function(){n.current&&(n.current(),n.current=null),r&&(o.current=!0)}}return t.useEffect(function(){return a(!1)},r),a(!0)},exports.useObserver=p,exports.Observer=d,exports.observer=k,exports.useStaticRendering=function(e){g=e,a=e},exports.Provider=U,exports.inject=function(){for(var e,r=[],t=arguments.length;t--;)r[t]=arguments[t];return"function"==typeof arguments[0]?(e=arguments[0],function(r){return M(e,r,e.name,!0)}):function(e){return M(function(e){return function(r,t){return e.forEach(function(e){if(!(e in t)){if(!(e in r))throw new Error("MobX injector: Store '"+e+"' is not available! Make sure it is provided by some Provider");t[e]=r[e]}}),t}}(r),e,r.join("-"),!1)}},exports.disposeOnUnmount=function e(r,n){if(Array.isArray(n))return n.map(function(t){return e(r,t)});var o=Object.getPrototypeOf(r).constructor||Object.getPrototypeOf(r.constructor),i=Object.getPrototypeOf(r.constructor);if(o!==t.Component&&o!==t.PureComponent&&i!==t.Component&&i!==t.PureComponent)throw new Error("[mobx-react] disposeOnUnmount only supports direct subclasses of React.Component or React.PureComponent.");if("string"!=typeof n&&"function"!=typeof n)throw new Error("[mobx-react] disposeOnUnmount only works if the parameter is either a property key or a function.");var a=!!r[D];return(r[D]||(r[D]=[])).push(n),a||(r.componentWillUnmount&&(r[q]=r.componentWillUnmount),Object.defineProperty(r,"componentWillUnmount",{get:function(){return $},set:function(e){this[D].push(e),this[q]=void 0},configurable:!1,enumerable:!1})),"string"!=typeof n?n:void 0},exports.PropTypes=H;
|
|
2
|
+
//# sourceMappingURL=mobx-react.js.map
|