@pie-element/ebsr 12.0.1-esmbeta.0 → 12.0.1-esmbeta.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.
- package/configure/package.json +1 -1
- package/controller/package.json +1 -1
- package/esm/configure.js +2148 -200
- package/esm/configure.js.map +1 -1
- package/module/index.html +1 -1
- package/module/manifest.json +1 -1
- package/module/print.html +1 -1
- package/package.json +2 -2
package/esm/configure.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ModelUpdatedEvent } from '@pie-framework/pie-configure-events';
|
|
3
2
|
import MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';
|
|
4
3
|
import { layout, settings } from '@pie-lib/config-ui';
|
|
@@ -53,99 +52,2163 @@ function getAugmentedNamespace(n) {
|
|
|
53
52
|
return a;
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
var
|
|
55
|
+
var react = {exports: {}};
|
|
56
|
+
|
|
57
|
+
var react_production_min = {};
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
object-assign
|
|
61
|
+
(c) Sindre Sorhus
|
|
62
|
+
@license MIT
|
|
63
|
+
*/
|
|
64
|
+
/* eslint-disable no-unused-vars */
|
|
65
|
+
var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
|
|
66
|
+
var hasOwnProperty$b = Object.prototype.hasOwnProperty;
|
|
67
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
68
|
+
|
|
69
|
+
function toObject(val) {
|
|
70
|
+
if (val === null || val === undefined) {
|
|
71
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return Object(val);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function shouldUseNative() {
|
|
78
|
+
try {
|
|
79
|
+
if (!Object.assign) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
84
|
+
|
|
85
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
86
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
87
|
+
test1[5] = 'de';
|
|
88
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
93
|
+
var test2 = {};
|
|
94
|
+
for (var i = 0; i < 10; i++) {
|
|
95
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
96
|
+
}
|
|
97
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
98
|
+
return test2[n];
|
|
99
|
+
});
|
|
100
|
+
if (order2.join('') !== '0123456789') {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
105
|
+
var test3 = {};
|
|
106
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
107
|
+
test3[letter] = letter;
|
|
108
|
+
});
|
|
109
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
110
|
+
'abcdefghijklmnopqrst') {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return true;
|
|
115
|
+
} catch (err) {
|
|
116
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
122
|
+
var from;
|
|
123
|
+
var to = toObject(target);
|
|
124
|
+
var symbols;
|
|
125
|
+
|
|
126
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
127
|
+
from = Object(arguments[s]);
|
|
128
|
+
|
|
129
|
+
for (var key in from) {
|
|
130
|
+
if (hasOwnProperty$b.call(from, key)) {
|
|
131
|
+
to[key] = from[key];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (getOwnPropertySymbols$1) {
|
|
136
|
+
symbols = getOwnPropertySymbols$1(from);
|
|
137
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
138
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
139
|
+
to[symbols[i]] = from[symbols[i]];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return to;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** @license React v16.14.0
|
|
149
|
+
* react.production.min.js
|
|
150
|
+
*
|
|
151
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
152
|
+
*
|
|
153
|
+
* This source code is licensed under the MIT license found in the
|
|
154
|
+
* LICENSE file in the root directory of this source tree.
|
|
155
|
+
*/
|
|
156
|
+
var l$1=objectAssign,n$2="function"===typeof Symbol&&Symbol.for,p$1=n$2?Symbol.for("react.element"):60103,q$1=n$2?Symbol.for("react.portal"):60106,r$2=n$2?Symbol.for("react.fragment"):60107,t$1=n$2?Symbol.for("react.strict_mode"):60108,u$1=n$2?Symbol.for("react.profiler"):60114,v$2=n$2?Symbol.for("react.provider"):60109,w$1=n$2?Symbol.for("react.context"):60110,x$1=n$2?Symbol.for("react.forward_ref"):60112,y$1=n$2?Symbol.for("react.suspense"):60113,z$1=n$2?Symbol.for("react.memo"):60115,A$1=n$2?Symbol.for("react.lazy"):
|
|
157
|
+
60116,B="function"===typeof Symbol&&Symbol.iterator;function C$1(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}
|
|
158
|
+
var D={isMounted:function(){return !1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E$1={};function F$1(a,b,c){this.props=a;this.context=b;this.refs=E$1;this.updater=c||D;}F$1.prototype.isReactComponent={};F$1.prototype.setState=function(a,b){if("object"!==typeof a&&"function"!==typeof a&&null!=a)throw Error(C$1(85));this.updater.enqueueSetState(this,a,b,"setState");};F$1.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate");};
|
|
159
|
+
function G$1(){}G$1.prototype=F$1.prototype;function H$1(a,b,c){this.props=a;this.context=b;this.refs=E$1;this.updater=c||D;}var I$1=H$1.prototype=new G$1;I$1.constructor=H$1;l$1(I$1,F$1.prototype);I$1.isPureReactComponent=!0;var J$1={current:null},K$1=Object.prototype.hasOwnProperty,L$1={key:!0,ref:!0,__self:!0,__source:!0};
|
|
160
|
+
function M$1(a,b,c){var e,d={},g=null,k=null;if(null!=b)for(e in void 0!==b.ref&&(k=b.ref),void 0!==b.key&&(g=""+b.key),b)K$1.call(b,e)&&!L$1.hasOwnProperty(e)&&(d[e]=b[e]);var f=arguments.length-2;if(1===f)d.children=c;else if(1<f){for(var h=Array(f),m=0;m<f;m++)h[m]=arguments[m+2];d.children=h;}if(a&&a.defaultProps)for(e in f=a.defaultProps,f)void 0===d[e]&&(d[e]=f[e]);return {$$typeof:p$1,type:a,key:g,ref:k,props:d,_owner:J$1.current}}
|
|
161
|
+
function N$1(a,b){return {$$typeof:p$1,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O$1(a){return "object"===typeof a&&null!==a&&a.$$typeof===p$1}function escape(a){var b={"=":"=0",":":"=2"};return "$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var P$1=/\/+/g,Q$1=[];function R$1(a,b,c,e){if(Q$1.length){var d=Q$1.pop();d.result=a;d.keyPrefix=b;d.func=c;d.context=e;d.count=0;return d}return {result:a,keyPrefix:b,func:c,context:e,count:0}}
|
|
162
|
+
function S$1(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>Q$1.length&&Q$1.push(a);}
|
|
163
|
+
function T$1(a,b,c,e){var d=typeof a;if("undefined"===d||"boolean"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case p$1:case q$1:g=!0;}}if(g)return c(e,a,""===b?"."+U$1(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var k=0;k<a.length;k++){d=a[k];var f=b+U$1(d,k);g+=T$1(d,f,c,e);}else if(null===a||"object"!==typeof a?f=null:(f=B&&a[B]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),k=
|
|
164
|
+
0;!(d=a.next()).done;)d=d.value,f=b+U$1(d,k++),g+=T$1(d,f,c,e);else if("object"===d)throw c=""+a,Error(C$1(31,"[object Object]"===c?"object with keys {"+Object.keys(a).join(", ")+"}":c,""));return g}function V$1(a,b,c){return null==a?0:T$1(a,"",b,c)}function U$1(a,b){return "object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function W$1(a,b){a.func.call(a.context,b,a.count++);}
|
|
165
|
+
function aa$1(a,b,c){var e=a.result,d=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?X$1(a,e,c,function(a){return a}):null!=a&&(O$1(a)&&(a=N$1(a,d+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(P$1,"$&/")+"/")+c)),e.push(a));}function X$1(a,b,c,e,d){var g="";null!=c&&(g=(""+c).replace(P$1,"$&/")+"/");b=R$1(b,g,e,d);V$1(a,aa$1,b);S$1(b);}var Y$1={current:null};function Z$1(){var a=Y$1.current;if(null===a)throw Error(C$1(321));return a}
|
|
166
|
+
var ba$1={ReactCurrentDispatcher:Y$1,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:J$1,IsSomeRendererActing:{current:!1},assign:l$1};react_production_min.Children={map:function(a,b,c){if(null==a)return a;var e=[];X$1(a,e,null,b,c);return e},forEach:function(a,b,c){if(null==a)return a;b=R$1(null,null,b,c);V$1(a,W$1,b);S$1(b);},count:function(a){return V$1(a,function(){return null},null)},toArray:function(a){var b=[];X$1(a,b,null,function(a){return a});return b},only:function(a){if(!O$1(a))throw Error(C$1(143));return a}};
|
|
167
|
+
react_production_min.Component=F$1;react_production_min.Fragment=r$2;react_production_min.Profiler=u$1;react_production_min.PureComponent=H$1;react_production_min.StrictMode=t$1;react_production_min.Suspense=y$1;react_production_min.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ba$1;
|
|
168
|
+
react_production_min.cloneElement=function(a,b,c){if(null===a||void 0===a)throw Error(C$1(267,a));var e=l$1({},a.props),d=a.key,g=a.ref,k=a._owner;if(null!=b){void 0!==b.ref&&(g=b.ref,k=J$1.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var f=a.type.defaultProps;for(h in b)K$1.call(b,h)&&!L$1.hasOwnProperty(h)&&(e[h]=void 0===b[h]&&void 0!==f?f[h]:b[h]);}var h=arguments.length-2;if(1===h)e.children=c;else if(1<h){f=Array(h);for(var m=0;m<h;m++)f[m]=arguments[m+2];e.children=f;}return {$$typeof:p$1,type:a.type,
|
|
169
|
+
key:d,ref:g,props:e,_owner:k}};react_production_min.createContext=function(a,b){void 0===b&&(b=null);a={$$typeof:w$1,_calculateChangedBits:b,_currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:v$2,_context:a};return a.Consumer=a};react_production_min.createElement=M$1;react_production_min.createFactory=function(a){var b=M$1.bind(null,a);b.type=a;return b};react_production_min.createRef=function(){return {current:null}};react_production_min.forwardRef=function(a){return {$$typeof:x$1,render:a}};react_production_min.isValidElement=O$1;
|
|
170
|
+
react_production_min.lazy=function(a){return {$$typeof:A$1,_ctor:a,_status:-1,_result:null}};react_production_min.memo=function(a,b){return {$$typeof:z$1,type:a,compare:void 0===b?null:b}};react_production_min.useCallback=function(a,b){return Z$1().useCallback(a,b)};react_production_min.useContext=function(a,b){return Z$1().useContext(a,b)};react_production_min.useDebugValue=function(){};react_production_min.useEffect=function(a,b){return Z$1().useEffect(a,b)};react_production_min.useImperativeHandle=function(a,b,c){return Z$1().useImperativeHandle(a,b,c)};
|
|
171
|
+
react_production_min.useLayoutEffect=function(a,b){return Z$1().useLayoutEffect(a,b)};react_production_min.useMemo=function(a,b){return Z$1().useMemo(a,b)};react_production_min.useReducer=function(a,b,c){return Z$1().useReducer(a,b,c)};react_production_min.useRef=function(a){return Z$1().useRef(a)};react_production_min.useState=function(a){return Z$1().useState(a)};react_production_min.version="16.14.0";
|
|
172
|
+
|
|
173
|
+
var react_development = {};
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the MIT license found in the
|
|
179
|
+
* LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/
|
|
181
|
+
|
|
182
|
+
var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
183
|
+
|
|
184
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
|
|
185
|
+
|
|
186
|
+
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
190
|
+
*
|
|
191
|
+
* This source code is licensed under the MIT license found in the
|
|
192
|
+
* LICENSE file in the root directory of this source tree.
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
var printWarning$2 = function() {};
|
|
196
|
+
|
|
197
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
198
|
+
var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
|
|
199
|
+
var loggedTypeFailures = {};
|
|
200
|
+
var has$1 = has$2;
|
|
201
|
+
|
|
202
|
+
printWarning$2 = function(text) {
|
|
203
|
+
var message = 'Warning: ' + text;
|
|
204
|
+
if (typeof console !== 'undefined') {
|
|
205
|
+
console.error(message);
|
|
206
|
+
}
|
|
207
|
+
try {
|
|
208
|
+
// --- Welcome to debugging React ---
|
|
209
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
210
|
+
// to find the callsite that caused this warning to fire.
|
|
211
|
+
throw new Error(message);
|
|
212
|
+
} catch (x) { /**/ }
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Assert that the values match with the type specs.
|
|
218
|
+
* Error messages are memorized and will only be shown once.
|
|
219
|
+
*
|
|
220
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
221
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
222
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
223
|
+
* @param {string} componentName Name of the component for error messages.
|
|
224
|
+
* @param {?Function} getStack Returns the component stack.
|
|
225
|
+
* @private
|
|
226
|
+
*/
|
|
227
|
+
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
228
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
229
|
+
for (var typeSpecName in typeSpecs) {
|
|
230
|
+
if (has$1(typeSpecs, typeSpecName)) {
|
|
231
|
+
var error;
|
|
232
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
233
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
234
|
+
// After these have been cleaned up, we'll let them throw.
|
|
235
|
+
try {
|
|
236
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
237
|
+
// behavior as without this statement except with a better message.
|
|
238
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
239
|
+
var err = Error(
|
|
240
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
241
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
242
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
243
|
+
);
|
|
244
|
+
err.name = 'Invariant Violation';
|
|
245
|
+
throw err;
|
|
246
|
+
}
|
|
247
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
|
|
248
|
+
} catch (ex) {
|
|
249
|
+
error = ex;
|
|
250
|
+
}
|
|
251
|
+
if (error && !(error instanceof Error)) {
|
|
252
|
+
printWarning$2(
|
|
253
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
254
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
255
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
256
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
257
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
258
|
+
'shape all require an argument).'
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
262
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
263
|
+
// same error.
|
|
264
|
+
loggedTypeFailures[error.message] = true;
|
|
265
|
+
|
|
266
|
+
var stack = getStack ? getStack() : '';
|
|
267
|
+
|
|
268
|
+
printWarning$2(
|
|
269
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Resets warning cache when testing.
|
|
279
|
+
*
|
|
280
|
+
* @private
|
|
281
|
+
*/
|
|
282
|
+
checkPropTypes$1.resetWarningCache = function() {
|
|
283
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
284
|
+
loggedTypeFailures = {};
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
var checkPropTypes_1 = checkPropTypes$1;
|
|
289
|
+
|
|
290
|
+
/** @license React v16.14.0
|
|
291
|
+
* react.development.js
|
|
292
|
+
*
|
|
293
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
294
|
+
*
|
|
295
|
+
* This source code is licensed under the MIT license found in the
|
|
296
|
+
* LICENSE file in the root directory of this source tree.
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
if (process.env.NODE_ENV !== "production") {
|
|
302
|
+
(function() {
|
|
303
|
+
|
|
304
|
+
var _assign = objectAssign;
|
|
305
|
+
var checkPropTypes = checkPropTypes_1;
|
|
306
|
+
|
|
307
|
+
var ReactVersion = '16.14.0';
|
|
308
|
+
|
|
309
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
310
|
+
// nor polyfill, then a plain number is used for performance.
|
|
311
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
312
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
313
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
314
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
315
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
316
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
317
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
318
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
319
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
320
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
321
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
322
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
323
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
324
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
325
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
326
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
327
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
328
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
329
|
+
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
330
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
331
|
+
function getIteratorFn(maybeIterable) {
|
|
332
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
337
|
+
|
|
338
|
+
if (typeof maybeIterator === 'function') {
|
|
339
|
+
return maybeIterator;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return null;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Keeps track of the current dispatcher.
|
|
347
|
+
*/
|
|
348
|
+
var ReactCurrentDispatcher = {
|
|
349
|
+
/**
|
|
350
|
+
* @internal
|
|
351
|
+
* @type {ReactComponent}
|
|
352
|
+
*/
|
|
353
|
+
current: null
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
358
|
+
* should suspend for if it needs to.
|
|
359
|
+
*/
|
|
360
|
+
var ReactCurrentBatchConfig = {
|
|
361
|
+
suspense: null
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Keeps track of the current owner.
|
|
366
|
+
*
|
|
367
|
+
* The current owner is the component who should own any components that are
|
|
368
|
+
* currently being constructed.
|
|
369
|
+
*/
|
|
370
|
+
var ReactCurrentOwner = {
|
|
371
|
+
/**
|
|
372
|
+
* @internal
|
|
373
|
+
* @type {ReactComponent}
|
|
374
|
+
*/
|
|
375
|
+
current: null
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
379
|
+
function describeComponentFrame (name, source, ownerName) {
|
|
380
|
+
var sourceInfo = '';
|
|
381
|
+
|
|
382
|
+
if (source) {
|
|
383
|
+
var path = source.fileName;
|
|
384
|
+
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
385
|
+
|
|
386
|
+
{
|
|
387
|
+
// In DEV, include code for a common special case:
|
|
388
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
389
|
+
if (/^index\./.test(fileName)) {
|
|
390
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
391
|
+
|
|
392
|
+
if (match) {
|
|
393
|
+
var pathBeforeSlash = match[1];
|
|
394
|
+
|
|
395
|
+
if (pathBeforeSlash) {
|
|
396
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
397
|
+
fileName = folderName + '/' + fileName;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
|
|
404
|
+
} else if (ownerName) {
|
|
405
|
+
sourceInfo = ' (created by ' + ownerName + ')';
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
var Resolved = 1;
|
|
412
|
+
function refineResolvedLazyComponent(lazyComponent) {
|
|
413
|
+
return lazyComponent._status === Resolved ? lazyComponent._result : null;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
417
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
418
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function getComponentName(type) {
|
|
422
|
+
if (type == null) {
|
|
423
|
+
// Host root, text node or just invalid type.
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
{
|
|
428
|
+
if (typeof type.tag === 'number') {
|
|
429
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (typeof type === 'function') {
|
|
434
|
+
return type.displayName || type.name || null;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (typeof type === 'string') {
|
|
438
|
+
return type;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
switch (type) {
|
|
442
|
+
case REACT_FRAGMENT_TYPE:
|
|
443
|
+
return 'Fragment';
|
|
444
|
+
|
|
445
|
+
case REACT_PORTAL_TYPE:
|
|
446
|
+
return 'Portal';
|
|
447
|
+
|
|
448
|
+
case REACT_PROFILER_TYPE:
|
|
449
|
+
return "Profiler";
|
|
450
|
+
|
|
451
|
+
case REACT_STRICT_MODE_TYPE:
|
|
452
|
+
return 'StrictMode';
|
|
453
|
+
|
|
454
|
+
case REACT_SUSPENSE_TYPE:
|
|
455
|
+
return 'Suspense';
|
|
456
|
+
|
|
457
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
458
|
+
return 'SuspenseList';
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (typeof type === 'object') {
|
|
462
|
+
switch (type.$$typeof) {
|
|
463
|
+
case REACT_CONTEXT_TYPE:
|
|
464
|
+
return 'Context.Consumer';
|
|
465
|
+
|
|
466
|
+
case REACT_PROVIDER_TYPE:
|
|
467
|
+
return 'Context.Provider';
|
|
468
|
+
|
|
469
|
+
case REACT_FORWARD_REF_TYPE:
|
|
470
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
471
|
+
|
|
472
|
+
case REACT_MEMO_TYPE:
|
|
473
|
+
return getComponentName(type.type);
|
|
474
|
+
|
|
475
|
+
case REACT_BLOCK_TYPE:
|
|
476
|
+
return getComponentName(type.render);
|
|
477
|
+
|
|
478
|
+
case REACT_LAZY_TYPE:
|
|
479
|
+
{
|
|
480
|
+
var thenable = type;
|
|
481
|
+
var resolvedThenable = refineResolvedLazyComponent(thenable);
|
|
482
|
+
|
|
483
|
+
if (resolvedThenable) {
|
|
484
|
+
return getComponentName(resolvedThenable);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
var ReactDebugCurrentFrame = {};
|
|
496
|
+
var currentlyValidatingElement = null;
|
|
497
|
+
function setCurrentlyValidatingElement(element) {
|
|
498
|
+
{
|
|
499
|
+
currentlyValidatingElement = element;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
{
|
|
504
|
+
// Stack implementation injected by the current renderer.
|
|
505
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
506
|
+
|
|
507
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
508
|
+
var stack = ''; // Add an extra top frame while an element is being validated
|
|
509
|
+
|
|
510
|
+
if (currentlyValidatingElement) {
|
|
511
|
+
var name = getComponentName(currentlyValidatingElement.type);
|
|
512
|
+
var owner = currentlyValidatingElement._owner;
|
|
513
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
|
|
514
|
+
} // Delegate to the injected renderer-specific implementation
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
518
|
+
|
|
519
|
+
if (impl) {
|
|
520
|
+
stack += impl() || '';
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
return stack;
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
529
|
+
*/
|
|
530
|
+
var IsSomeRendererActing = {
|
|
531
|
+
current: false
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
var ReactSharedInternals = {
|
|
535
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
536
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
537
|
+
ReactCurrentOwner: ReactCurrentOwner,
|
|
538
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
539
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
540
|
+
assign: _assign
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
{
|
|
544
|
+
_assign(ReactSharedInternals, {
|
|
545
|
+
// These should not be included in production.
|
|
546
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
|
547
|
+
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
|
548
|
+
// TODO: remove in React 17.0.
|
|
549
|
+
ReactComponentTreeHook: {}
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// by calls to these methods by a Babel plugin.
|
|
554
|
+
//
|
|
555
|
+
// In PROD (or in packages without access to React internals),
|
|
556
|
+
// they are left as they are instead.
|
|
557
|
+
|
|
558
|
+
function warn(format) {
|
|
559
|
+
{
|
|
560
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
561
|
+
args[_key - 1] = arguments[_key];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
printWarning('warn', format, args);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function error(format) {
|
|
568
|
+
{
|
|
569
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
570
|
+
args[_key2 - 1] = arguments[_key2];
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
printWarning('error', format, args);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function printWarning(level, format, args) {
|
|
578
|
+
// When changing this logic, you might want to also
|
|
579
|
+
// update consoleWithStackDev.www.js as well.
|
|
580
|
+
{
|
|
581
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
582
|
+
|
|
583
|
+
if (!hasExistingStack) {
|
|
584
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
585
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
586
|
+
|
|
587
|
+
if (stack !== '') {
|
|
588
|
+
format += '%s';
|
|
589
|
+
args = args.concat([stack]);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
var argsWithFormat = args.map(function (item) {
|
|
594
|
+
return '' + item;
|
|
595
|
+
}); // Careful: RN currently depends on this prefix
|
|
596
|
+
|
|
597
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
598
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
599
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
600
|
+
|
|
601
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
602
|
+
|
|
603
|
+
try {
|
|
604
|
+
// --- Welcome to debugging React ---
|
|
605
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
606
|
+
// to find the callsite that caused this warning to fire.
|
|
607
|
+
var argIndex = 0;
|
|
608
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
609
|
+
return args[argIndex++];
|
|
610
|
+
});
|
|
611
|
+
throw new Error(message);
|
|
612
|
+
} catch (x) {}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
var didWarnStateUpdateForUnmountedComponent = {};
|
|
617
|
+
|
|
618
|
+
function warnNoop(publicInstance, callerName) {
|
|
619
|
+
{
|
|
620
|
+
var _constructor = publicInstance.constructor;
|
|
621
|
+
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
|
|
622
|
+
var warningKey = componentName + "." + callerName;
|
|
623
|
+
|
|
624
|
+
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
|
|
629
|
+
|
|
630
|
+
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* This is the abstract API for an update queue.
|
|
635
|
+
*/
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
var ReactNoopUpdateQueue = {
|
|
639
|
+
/**
|
|
640
|
+
* Checks whether or not this composite component is mounted.
|
|
641
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
|
642
|
+
* @return {boolean} True if mounted, false otherwise.
|
|
643
|
+
* @protected
|
|
644
|
+
* @final
|
|
645
|
+
*/
|
|
646
|
+
isMounted: function (publicInstance) {
|
|
647
|
+
return false;
|
|
648
|
+
},
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Forces an update. This should only be invoked when it is known with
|
|
652
|
+
* certainty that we are **not** in a DOM transaction.
|
|
653
|
+
*
|
|
654
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
655
|
+
* component's state has changed but `setState` was not called.
|
|
656
|
+
*
|
|
657
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
658
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
659
|
+
*
|
|
660
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
661
|
+
* @param {?function} callback Called after component is updated.
|
|
662
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
663
|
+
* @internal
|
|
664
|
+
*/
|
|
665
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
666
|
+
warnNoop(publicInstance, 'forceUpdate');
|
|
667
|
+
},
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
671
|
+
* You should treat `this.state` as immutable.
|
|
672
|
+
*
|
|
673
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
674
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
675
|
+
*
|
|
676
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
677
|
+
* @param {object} completeState Next state.
|
|
678
|
+
* @param {?function} callback Called after component is updated.
|
|
679
|
+
* @param {?string} callerName name of the calling function in the public API.
|
|
680
|
+
* @internal
|
|
681
|
+
*/
|
|
682
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
683
|
+
warnNoop(publicInstance, 'replaceState');
|
|
684
|
+
},
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
|
688
|
+
* internal. This provides a merging strategy that is not available to deep
|
|
689
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
690
|
+
* during the merge.
|
|
691
|
+
*
|
|
692
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
693
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
694
|
+
* @param {?function} callback Called after component is updated.
|
|
695
|
+
* @param {?string} Name of the calling function in the public API.
|
|
696
|
+
* @internal
|
|
697
|
+
*/
|
|
698
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
699
|
+
warnNoop(publicInstance, 'setState');
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
var emptyObject = {};
|
|
704
|
+
|
|
705
|
+
{
|
|
706
|
+
Object.freeze(emptyObject);
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Base class helpers for the updating state of a component.
|
|
710
|
+
*/
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
function Component(props, context, updater) {
|
|
714
|
+
this.props = props;
|
|
715
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
716
|
+
|
|
717
|
+
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
|
|
718
|
+
// renderer.
|
|
719
|
+
|
|
720
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
Component.prototype.isReactComponent = {};
|
|
724
|
+
/**
|
|
725
|
+
* Sets a subset of the state. Always use this to mutate
|
|
726
|
+
* state. You should treat `this.state` as immutable.
|
|
727
|
+
*
|
|
728
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
729
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
730
|
+
*
|
|
731
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
|
732
|
+
* as they may eventually be batched together. You can provide an optional
|
|
733
|
+
* callback that will be executed when the call to setState is actually
|
|
734
|
+
* completed.
|
|
735
|
+
*
|
|
736
|
+
* When a function is provided to setState, it will be called at some point in
|
|
737
|
+
* the future (not synchronously). It will be called with the up to date
|
|
738
|
+
* component arguments (state, props, context). These values can be different
|
|
739
|
+
* from this.* because your function may be called after receiveProps but before
|
|
740
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
741
|
+
* assigned to this.
|
|
742
|
+
*
|
|
743
|
+
* @param {object|function} partialState Next partial state or function to
|
|
744
|
+
* produce next partial state to be merged with current state.
|
|
745
|
+
* @param {?function} callback Called after state is updated.
|
|
746
|
+
* @final
|
|
747
|
+
* @protected
|
|
748
|
+
*/
|
|
749
|
+
|
|
750
|
+
Component.prototype.setState = function (partialState, callback) {
|
|
751
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
752
|
+
{
|
|
753
|
+
throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* Forces an update. This should only be invoked when it is known with
|
|
761
|
+
* certainty that we are **not** in a DOM transaction.
|
|
762
|
+
*
|
|
763
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
764
|
+
* component's state has changed but `setState` was not called.
|
|
765
|
+
*
|
|
766
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
767
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
768
|
+
*
|
|
769
|
+
* @param {?function} callback Called after update is complete.
|
|
770
|
+
* @final
|
|
771
|
+
* @protected
|
|
772
|
+
*/
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
Component.prototype.forceUpdate = function (callback) {
|
|
776
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
777
|
+
};
|
|
778
|
+
/**
|
|
779
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
780
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
781
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
782
|
+
*/
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
{
|
|
786
|
+
var deprecatedAPIs = {
|
|
787
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
788
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
var defineDeprecationWarning = function (methodName, info) {
|
|
792
|
+
Object.defineProperty(Component.prototype, methodName, {
|
|
793
|
+
get: function () {
|
|
794
|
+
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
795
|
+
|
|
796
|
+
return undefined;
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
for (var fnName in deprecatedAPIs) {
|
|
802
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
803
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
function ComponentDummy() {}
|
|
809
|
+
|
|
810
|
+
ComponentDummy.prototype = Component.prototype;
|
|
811
|
+
/**
|
|
812
|
+
* Convenience component with default shallow equality check for sCU.
|
|
813
|
+
*/
|
|
814
|
+
|
|
815
|
+
function PureComponent(props, context, updater) {
|
|
816
|
+
this.props = props;
|
|
817
|
+
this.context = context; // If a component has string refs, we will assign a different object later.
|
|
818
|
+
|
|
819
|
+
this.refs = emptyObject;
|
|
820
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
824
|
+
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
|
|
825
|
+
|
|
826
|
+
_assign(pureComponentPrototype, Component.prototype);
|
|
827
|
+
|
|
828
|
+
pureComponentPrototype.isPureReactComponent = true;
|
|
829
|
+
|
|
830
|
+
// an immutable object with a single mutable value
|
|
831
|
+
function createRef() {
|
|
832
|
+
var refObject = {
|
|
833
|
+
current: null
|
|
834
|
+
};
|
|
835
|
+
|
|
836
|
+
{
|
|
837
|
+
Object.seal(refObject);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
return refObject;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
844
|
+
var RESERVED_PROPS = {
|
|
845
|
+
key: true,
|
|
846
|
+
ref: true,
|
|
847
|
+
__self: true,
|
|
848
|
+
__source: true
|
|
849
|
+
};
|
|
850
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
851
|
+
|
|
852
|
+
{
|
|
853
|
+
didWarnAboutStringRefs = {};
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
function hasValidRef(config) {
|
|
857
|
+
{
|
|
858
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
859
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
860
|
+
|
|
861
|
+
if (getter && getter.isReactWarning) {
|
|
862
|
+
return false;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
return config.ref !== undefined;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
function hasValidKey(config) {
|
|
871
|
+
{
|
|
872
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
873
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
874
|
+
|
|
875
|
+
if (getter && getter.isReactWarning) {
|
|
876
|
+
return false;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
return config.key !== undefined;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
885
|
+
var warnAboutAccessingKey = function () {
|
|
886
|
+
{
|
|
887
|
+
if (!specialPropKeyWarningShown) {
|
|
888
|
+
specialPropKeyWarningShown = true;
|
|
889
|
+
|
|
890
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
896
|
+
Object.defineProperty(props, 'key', {
|
|
897
|
+
get: warnAboutAccessingKey,
|
|
898
|
+
configurable: true
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
903
|
+
var warnAboutAccessingRef = function () {
|
|
904
|
+
{
|
|
905
|
+
if (!specialPropRefWarningShown) {
|
|
906
|
+
specialPropRefWarningShown = true;
|
|
907
|
+
|
|
908
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
};
|
|
912
|
+
|
|
913
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
914
|
+
Object.defineProperty(props, 'ref', {
|
|
915
|
+
get: warnAboutAccessingRef,
|
|
916
|
+
configurable: true
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
function warnIfStringRefCannotBeAutoConverted(config) {
|
|
921
|
+
{
|
|
922
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
|
|
923
|
+
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
924
|
+
|
|
925
|
+
if (!didWarnAboutStringRefs[componentName]) {
|
|
926
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://fb.me/react-strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref);
|
|
927
|
+
|
|
928
|
+
didWarnAboutStringRefs[componentName] = true;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
935
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
936
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
937
|
+
* if something is a React Element.
|
|
938
|
+
*
|
|
939
|
+
* @param {*} type
|
|
940
|
+
* @param {*} props
|
|
941
|
+
* @param {*} key
|
|
942
|
+
* @param {string|object} ref
|
|
943
|
+
* @param {*} owner
|
|
944
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
945
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
946
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
947
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
948
|
+
* change in behavior.
|
|
949
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
950
|
+
* indicating filename, line number, and/or other information.
|
|
951
|
+
* @internal
|
|
952
|
+
*/
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
956
|
+
var element = {
|
|
957
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
958
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
959
|
+
// Built-in properties that belong on the element
|
|
960
|
+
type: type,
|
|
961
|
+
key: key,
|
|
962
|
+
ref: ref,
|
|
963
|
+
props: props,
|
|
964
|
+
// Record the component responsible for creating this element.
|
|
965
|
+
_owner: owner
|
|
966
|
+
};
|
|
967
|
+
|
|
968
|
+
{
|
|
969
|
+
// The validation flag is currently mutative. We put it on
|
|
970
|
+
// an external backing store so that we can freeze the whole object.
|
|
971
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
972
|
+
// commonly used development environments.
|
|
973
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
974
|
+
// the validation flag non-enumerable (where possible, which should
|
|
975
|
+
// include every environment we run tests in), so the test framework
|
|
976
|
+
// ignores it.
|
|
977
|
+
|
|
978
|
+
Object.defineProperty(element._store, 'validated', {
|
|
979
|
+
configurable: false,
|
|
980
|
+
enumerable: false,
|
|
981
|
+
writable: true,
|
|
982
|
+
value: false
|
|
983
|
+
}); // self and source are DEV only properties.
|
|
984
|
+
|
|
985
|
+
Object.defineProperty(element, '_self', {
|
|
986
|
+
configurable: false,
|
|
987
|
+
enumerable: false,
|
|
988
|
+
writable: false,
|
|
989
|
+
value: self
|
|
990
|
+
}); // Two elements created in two different places should be considered
|
|
991
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
992
|
+
|
|
993
|
+
Object.defineProperty(element, '_source', {
|
|
994
|
+
configurable: false,
|
|
995
|
+
enumerable: false,
|
|
996
|
+
writable: false,
|
|
997
|
+
value: source
|
|
998
|
+
});
|
|
999
|
+
|
|
1000
|
+
if (Object.freeze) {
|
|
1001
|
+
Object.freeze(element.props);
|
|
1002
|
+
Object.freeze(element);
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
return element;
|
|
1007
|
+
};
|
|
1008
|
+
/**
|
|
1009
|
+
* Create and return a new ReactElement of the given type.
|
|
1010
|
+
* See https://reactjs.org/docs/react-api.html#createelement
|
|
1011
|
+
*/
|
|
1012
|
+
|
|
1013
|
+
function createElement(type, config, children) {
|
|
1014
|
+
var propName; // Reserved names are extracted
|
|
1015
|
+
|
|
1016
|
+
var props = {};
|
|
1017
|
+
var key = null;
|
|
1018
|
+
var ref = null;
|
|
1019
|
+
var self = null;
|
|
1020
|
+
var source = null;
|
|
1021
|
+
|
|
1022
|
+
if (config != null) {
|
|
1023
|
+
if (hasValidRef(config)) {
|
|
1024
|
+
ref = config.ref;
|
|
1025
|
+
|
|
1026
|
+
{
|
|
1027
|
+
warnIfStringRefCannotBeAutoConverted(config);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
if (hasValidKey(config)) {
|
|
1032
|
+
key = '' + config.key;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
self = config.__self === undefined ? null : config.__self;
|
|
1036
|
+
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
|
|
1037
|
+
|
|
1038
|
+
for (propName in config) {
|
|
1039
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1040
|
+
props[propName] = config[propName];
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
1044
|
+
// the newly allocated props object.
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
var childrenLength = arguments.length - 2;
|
|
1048
|
+
|
|
1049
|
+
if (childrenLength === 1) {
|
|
1050
|
+
props.children = children;
|
|
1051
|
+
} else if (childrenLength > 1) {
|
|
1052
|
+
var childArray = Array(childrenLength);
|
|
1053
|
+
|
|
1054
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
1055
|
+
childArray[i] = arguments[i + 2];
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
{
|
|
1059
|
+
if (Object.freeze) {
|
|
1060
|
+
Object.freeze(childArray);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
props.children = childArray;
|
|
1065
|
+
} // Resolve default props
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
if (type && type.defaultProps) {
|
|
1069
|
+
var defaultProps = type.defaultProps;
|
|
1070
|
+
|
|
1071
|
+
for (propName in defaultProps) {
|
|
1072
|
+
if (props[propName] === undefined) {
|
|
1073
|
+
props[propName] = defaultProps[propName];
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
{
|
|
1079
|
+
if (key || ref) {
|
|
1080
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
1081
|
+
|
|
1082
|
+
if (key) {
|
|
1083
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
if (ref) {
|
|
1087
|
+
defineRefPropWarningGetter(props, displayName);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
1093
|
+
}
|
|
1094
|
+
function cloneAndReplaceKey(oldElement, newKey) {
|
|
1095
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
1096
|
+
return newElement;
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Clone and return a new ReactElement using element as the starting point.
|
|
1100
|
+
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
1101
|
+
*/
|
|
1102
|
+
|
|
1103
|
+
function cloneElement(element, config, children) {
|
|
1104
|
+
if (!!(element === null || element === undefined)) {
|
|
1105
|
+
{
|
|
1106
|
+
throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
var propName; // Original props are copied
|
|
1111
|
+
|
|
1112
|
+
var props = _assign({}, element.props); // Reserved names are extracted
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
var key = element.key;
|
|
1116
|
+
var ref = element.ref; // Self is preserved since the owner is preserved.
|
|
1117
|
+
|
|
1118
|
+
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
|
|
1119
|
+
// transpiler, and the original source is probably a better indicator of the
|
|
1120
|
+
// true owner.
|
|
1121
|
+
|
|
1122
|
+
var source = element._source; // Owner will be preserved, unless ref is overridden
|
|
1123
|
+
|
|
1124
|
+
var owner = element._owner;
|
|
1125
|
+
|
|
1126
|
+
if (config != null) {
|
|
1127
|
+
if (hasValidRef(config)) {
|
|
1128
|
+
// Silently steal the ref from the parent.
|
|
1129
|
+
ref = config.ref;
|
|
1130
|
+
owner = ReactCurrentOwner.current;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
if (hasValidKey(config)) {
|
|
1134
|
+
key = '' + config.key;
|
|
1135
|
+
} // Remaining properties override existing props
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
var defaultProps;
|
|
1139
|
+
|
|
1140
|
+
if (element.type && element.type.defaultProps) {
|
|
1141
|
+
defaultProps = element.type.defaultProps;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
for (propName in config) {
|
|
1145
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
1146
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
1147
|
+
// Resolve default props
|
|
1148
|
+
props[propName] = defaultProps[propName];
|
|
1149
|
+
} else {
|
|
1150
|
+
props[propName] = config[propName];
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
} // Children can be more than one argument, and those are transferred onto
|
|
1155
|
+
// the newly allocated props object.
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
var childrenLength = arguments.length - 2;
|
|
1159
|
+
|
|
1160
|
+
if (childrenLength === 1) {
|
|
1161
|
+
props.children = children;
|
|
1162
|
+
} else if (childrenLength > 1) {
|
|
1163
|
+
var childArray = Array(childrenLength);
|
|
1164
|
+
|
|
1165
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
1166
|
+
childArray[i] = arguments[i + 2];
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
props.children = childArray;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Verifies the object is a ReactElement.
|
|
1176
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
1177
|
+
* @param {?object} object
|
|
1178
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
1179
|
+
* @final
|
|
1180
|
+
*/
|
|
1181
|
+
|
|
1182
|
+
function isValidElement(object) {
|
|
1183
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
var SEPARATOR = '.';
|
|
1187
|
+
var SUBSEPARATOR = ':';
|
|
1188
|
+
/**
|
|
1189
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
1190
|
+
*
|
|
1191
|
+
* @param {string} key to be escaped.
|
|
1192
|
+
* @return {string} the escaped key.
|
|
1193
|
+
*/
|
|
1194
|
+
|
|
1195
|
+
function escape(key) {
|
|
1196
|
+
var escapeRegex = /[=:]/g;
|
|
1197
|
+
var escaperLookup = {
|
|
1198
|
+
'=': '=0',
|
|
1199
|
+
':': '=2'
|
|
1200
|
+
};
|
|
1201
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
1202
|
+
return escaperLookup[match];
|
|
1203
|
+
});
|
|
1204
|
+
return '$' + escapedString;
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
1208
|
+
* pattern.
|
|
1209
|
+
*/
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
var didWarnAboutMaps = false;
|
|
1213
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1214
|
+
|
|
1215
|
+
function escapeUserProvidedKey(text) {
|
|
1216
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
var POOL_SIZE = 10;
|
|
1220
|
+
var traverseContextPool = [];
|
|
1221
|
+
|
|
1222
|
+
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1223
|
+
if (traverseContextPool.length) {
|
|
1224
|
+
var traverseContext = traverseContextPool.pop();
|
|
1225
|
+
traverseContext.result = mapResult;
|
|
1226
|
+
traverseContext.keyPrefix = keyPrefix;
|
|
1227
|
+
traverseContext.func = mapFunction;
|
|
1228
|
+
traverseContext.context = mapContext;
|
|
1229
|
+
traverseContext.count = 0;
|
|
1230
|
+
return traverseContext;
|
|
1231
|
+
} else {
|
|
1232
|
+
return {
|
|
1233
|
+
result: mapResult,
|
|
1234
|
+
keyPrefix: keyPrefix,
|
|
1235
|
+
func: mapFunction,
|
|
1236
|
+
context: mapContext,
|
|
1237
|
+
count: 0
|
|
1238
|
+
};
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
function releaseTraverseContext(traverseContext) {
|
|
1243
|
+
traverseContext.result = null;
|
|
1244
|
+
traverseContext.keyPrefix = null;
|
|
1245
|
+
traverseContext.func = null;
|
|
1246
|
+
traverseContext.context = null;
|
|
1247
|
+
traverseContext.count = 0;
|
|
1248
|
+
|
|
1249
|
+
if (traverseContextPool.length < POOL_SIZE) {
|
|
1250
|
+
traverseContextPool.push(traverseContext);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* @param {?*} children Children tree container.
|
|
1255
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
1256
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
1257
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1258
|
+
* process.
|
|
1259
|
+
* @return {!number} The number of children in this subtree.
|
|
1260
|
+
*/
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
1264
|
+
var type = typeof children;
|
|
1265
|
+
|
|
1266
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
1267
|
+
// All of the above are perceived as null.
|
|
1268
|
+
children = null;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
var invokeCallback = false;
|
|
1272
|
+
|
|
1273
|
+
if (children === null) {
|
|
1274
|
+
invokeCallback = true;
|
|
1275
|
+
} else {
|
|
1276
|
+
switch (type) {
|
|
1277
|
+
case 'string':
|
|
1278
|
+
case 'number':
|
|
1279
|
+
invokeCallback = true;
|
|
1280
|
+
break;
|
|
1281
|
+
|
|
1282
|
+
case 'object':
|
|
1283
|
+
switch (children.$$typeof) {
|
|
1284
|
+
case REACT_ELEMENT_TYPE:
|
|
1285
|
+
case REACT_PORTAL_TYPE:
|
|
1286
|
+
invokeCallback = true;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
if (invokeCallback) {
|
|
1293
|
+
callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array
|
|
1294
|
+
// so that it's consistent if the number of children grows.
|
|
1295
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1296
|
+
return 1;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
var child;
|
|
1300
|
+
var nextName;
|
|
1301
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1302
|
+
|
|
1303
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1304
|
+
|
|
1305
|
+
if (Array.isArray(children)) {
|
|
1306
|
+
for (var i = 0; i < children.length; i++) {
|
|
1307
|
+
child = children[i];
|
|
1308
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1309
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1310
|
+
}
|
|
1311
|
+
} else {
|
|
1312
|
+
var iteratorFn = getIteratorFn(children);
|
|
1313
|
+
|
|
1314
|
+
if (typeof iteratorFn === 'function') {
|
|
1315
|
+
|
|
1316
|
+
{
|
|
1317
|
+
// Warn about using Maps as children
|
|
1318
|
+
if (iteratorFn === children.entries) {
|
|
1319
|
+
if (!didWarnAboutMaps) {
|
|
1320
|
+
warn('Using Maps as children is deprecated and will be removed in ' + 'a future major release. Consider converting children to ' + 'an array of keyed ReactElements instead.');
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
didWarnAboutMaps = true;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
var iterator = iteratorFn.call(children);
|
|
1328
|
+
var step;
|
|
1329
|
+
var ii = 0;
|
|
1330
|
+
|
|
1331
|
+
while (!(step = iterator.next()).done) {
|
|
1332
|
+
child = step.value;
|
|
1333
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1334
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1335
|
+
}
|
|
1336
|
+
} else if (type === 'object') {
|
|
1337
|
+
var addendum = '';
|
|
1338
|
+
|
|
1339
|
+
{
|
|
1340
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
var childrenString = '' + children;
|
|
1344
|
+
|
|
1345
|
+
{
|
|
1346
|
+
{
|
|
1347
|
+
throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ")." + addendum );
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
return subtreeCount;
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1357
|
+
* might also be specified through attributes:
|
|
1358
|
+
*
|
|
1359
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1360
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1361
|
+
*
|
|
1362
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1363
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1364
|
+
* the callback might find relevant.
|
|
1365
|
+
*
|
|
1366
|
+
* @param {?*} children Children tree object.
|
|
1367
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1368
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1369
|
+
* @return {!number} The number of children in this subtree.
|
|
1370
|
+
*/
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1374
|
+
if (children == null) {
|
|
1375
|
+
return 0;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Generate a key string that identifies a component within a set.
|
|
1382
|
+
*
|
|
1383
|
+
* @param {*} component A component that could contain a manual key.
|
|
1384
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1385
|
+
* @return {string}
|
|
1386
|
+
*/
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
function getComponentKey(component, index) {
|
|
1390
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1391
|
+
// that we don't block potential future ES APIs.
|
|
1392
|
+
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1393
|
+
// Explicit key
|
|
1394
|
+
return escape(component.key);
|
|
1395
|
+
} // Implicit key determined by the index in the set
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
return index.toString(36);
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1402
|
+
var func = bookKeeping.func,
|
|
1403
|
+
context = bookKeeping.context;
|
|
1404
|
+
func.call(context, child, bookKeeping.count++);
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1408
|
+
*
|
|
1409
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1410
|
+
*
|
|
1411
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1412
|
+
* leaf child.
|
|
1413
|
+
*
|
|
1414
|
+
* @param {?*} children Children tree container.
|
|
1415
|
+
* @param {function(*, int)} forEachFunc
|
|
1416
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1417
|
+
*/
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1421
|
+
if (children == null) {
|
|
1422
|
+
return children;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
|
1426
|
+
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
|
1427
|
+
releaseTraverseContext(traverseContext);
|
|
1428
|
+
}
|
|
57
1429
|
|
|
58
|
-
|
|
1430
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1431
|
+
var result = bookKeeping.result,
|
|
1432
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1433
|
+
func = bookKeeping.func,
|
|
1434
|
+
context = bookKeeping.context;
|
|
1435
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
59
1436
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
1437
|
+
if (Array.isArray(mappedChild)) {
|
|
1438
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
1439
|
+
return c;
|
|
1440
|
+
});
|
|
1441
|
+
} else if (mappedChild != null) {
|
|
1442
|
+
if (isValidElement(mappedChild)) {
|
|
1443
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1444
|
+
// traverseAllChildren used to do for objects as children
|
|
1445
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1446
|
+
}
|
|
69
1447
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
1448
|
+
result.push(mappedChild);
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
74
1451
|
|
|
75
|
-
|
|
1452
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1453
|
+
var escapedPrefix = '';
|
|
1454
|
+
|
|
1455
|
+
if (prefix != null) {
|
|
1456
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
|
1460
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
|
1461
|
+
releaseTraverseContext(traverseContext);
|
|
76
1462
|
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Maps children that are typically specified as `props.children`.
|
|
1465
|
+
*
|
|
1466
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
|
|
1467
|
+
*
|
|
1468
|
+
* The provided mapFunction(child, key, index) will be called for each
|
|
1469
|
+
* leaf child.
|
|
1470
|
+
*
|
|
1471
|
+
* @param {?*} children Children tree container.
|
|
1472
|
+
* @param {function(*, int)} func The map function.
|
|
1473
|
+
* @param {*} context Context for mapFunction.
|
|
1474
|
+
* @return {object} Object containing the ordered map of results.
|
|
1475
|
+
*/
|
|
77
1476
|
|
|
78
|
-
function shouldUseNative() {
|
|
79
|
-
try {
|
|
80
|
-
if (!Object.assign) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
1477
|
|
|
84
|
-
|
|
1478
|
+
function mapChildren(children, func, context) {
|
|
1479
|
+
if (children == null) {
|
|
1480
|
+
return children;
|
|
1481
|
+
}
|
|
85
1482
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
1483
|
+
var result = [];
|
|
1484
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1485
|
+
return result;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Count the number of children that are typically specified as
|
|
1489
|
+
* `props.children`.
|
|
1490
|
+
*
|
|
1491
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrencount
|
|
1492
|
+
*
|
|
1493
|
+
* @param {?*} children Children tree container.
|
|
1494
|
+
* @return {number} The number of children.
|
|
1495
|
+
*/
|
|
92
1496
|
|
|
93
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
94
|
-
var test2 = {};
|
|
95
|
-
for (var i = 0; i < 10; i++) {
|
|
96
|
-
test2['_' + String.fromCharCode(i)] = i;
|
|
97
|
-
}
|
|
98
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
99
|
-
return test2[n];
|
|
100
|
-
});
|
|
101
|
-
if (order2.join('') !== '0123456789') {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
1497
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
1498
|
+
function countChildren(children) {
|
|
1499
|
+
return traverseAllChildren(children, function () {
|
|
1500
|
+
return null;
|
|
1501
|
+
}, null);
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Flatten a children object (typically specified as `props.children`) and
|
|
1505
|
+
* return an array with appropriately re-keyed children.
|
|
1506
|
+
*
|
|
1507
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
|
|
1508
|
+
*/
|
|
114
1509
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
1510
|
+
|
|
1511
|
+
function toArray(children) {
|
|
1512
|
+
var result = [];
|
|
1513
|
+
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
1514
|
+
return child;
|
|
1515
|
+
});
|
|
1516
|
+
return result;
|
|
120
1517
|
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Returns the first child in a collection of children and verifies that there
|
|
1520
|
+
* is only one child in the collection.
|
|
1521
|
+
*
|
|
1522
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
|
|
1523
|
+
*
|
|
1524
|
+
* The current implementation of this function assumes that a single child gets
|
|
1525
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
|
1526
|
+
* abstract away the particular structure of children.
|
|
1527
|
+
*
|
|
1528
|
+
* @param {?object} children Child collection structure.
|
|
1529
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
1530
|
+
* structure.
|
|
1531
|
+
*/
|
|
121
1532
|
|
|
122
|
-
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
123
|
-
var from;
|
|
124
|
-
var to = toObject(target);
|
|
125
|
-
var symbols;
|
|
126
1533
|
|
|
127
|
-
|
|
128
|
-
|
|
1534
|
+
function onlyChild(children) {
|
|
1535
|
+
if (!isValidElement(children)) {
|
|
1536
|
+
{
|
|
1537
|
+
throw Error( "React.Children.only expected to receive a single React element child." );
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
129
1540
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
to[key] = from[key];
|
|
133
|
-
}
|
|
134
|
-
}
|
|
1541
|
+
return children;
|
|
1542
|
+
}
|
|
135
1543
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
1544
|
+
function createContext(defaultValue, calculateChangedBits) {
|
|
1545
|
+
if (calculateChangedBits === undefined) {
|
|
1546
|
+
calculateChangedBits = null;
|
|
1547
|
+
} else {
|
|
1548
|
+
{
|
|
1549
|
+
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
|
|
1550
|
+
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
var context = {
|
|
1556
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
1557
|
+
_calculateChangedBits: calculateChangedBits,
|
|
1558
|
+
// As a workaround to support multiple concurrent renderers, we categorize
|
|
1559
|
+
// some renderers as primary and others as secondary. We only expect
|
|
1560
|
+
// there to be two concurrent renderers at most: React Native (primary) and
|
|
1561
|
+
// Fabric (secondary); React DOM (primary) and React ART (secondary).
|
|
1562
|
+
// Secondary renderers store their context values on separate fields.
|
|
1563
|
+
_currentValue: defaultValue,
|
|
1564
|
+
_currentValue2: defaultValue,
|
|
1565
|
+
// Used to track how many concurrent renderers this context currently
|
|
1566
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
|
1567
|
+
_threadCount: 0,
|
|
1568
|
+
// These are circular
|
|
1569
|
+
Provider: null,
|
|
1570
|
+
Consumer: null
|
|
1571
|
+
};
|
|
1572
|
+
context.Provider = {
|
|
1573
|
+
$$typeof: REACT_PROVIDER_TYPE,
|
|
1574
|
+
_context: context
|
|
1575
|
+
};
|
|
1576
|
+
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
1577
|
+
var hasWarnedAboutUsingConsumerProvider = false;
|
|
145
1578
|
|
|
146
|
-
|
|
1579
|
+
{
|
|
1580
|
+
// A separate object, but proxies back to the original context object for
|
|
1581
|
+
// backwards compatibility. It has a different $$typeof, so we can properly
|
|
1582
|
+
// warn for the incorrect usage of Context as a Consumer.
|
|
1583
|
+
var Consumer = {
|
|
1584
|
+
$$typeof: REACT_CONTEXT_TYPE,
|
|
1585
|
+
_context: context,
|
|
1586
|
+
_calculateChangedBits: context._calculateChangedBits
|
|
1587
|
+
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
|
|
1588
|
+
|
|
1589
|
+
Object.defineProperties(Consumer, {
|
|
1590
|
+
Provider: {
|
|
1591
|
+
get: function () {
|
|
1592
|
+
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
1593
|
+
hasWarnedAboutUsingConsumerProvider = true;
|
|
1594
|
+
|
|
1595
|
+
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
return context.Provider;
|
|
1599
|
+
},
|
|
1600
|
+
set: function (_Provider) {
|
|
1601
|
+
context.Provider = _Provider;
|
|
1602
|
+
}
|
|
1603
|
+
},
|
|
1604
|
+
_currentValue: {
|
|
1605
|
+
get: function () {
|
|
1606
|
+
return context._currentValue;
|
|
1607
|
+
},
|
|
1608
|
+
set: function (_currentValue) {
|
|
1609
|
+
context._currentValue = _currentValue;
|
|
1610
|
+
}
|
|
1611
|
+
},
|
|
1612
|
+
_currentValue2: {
|
|
1613
|
+
get: function () {
|
|
1614
|
+
return context._currentValue2;
|
|
1615
|
+
},
|
|
1616
|
+
set: function (_currentValue2) {
|
|
1617
|
+
context._currentValue2 = _currentValue2;
|
|
1618
|
+
}
|
|
1619
|
+
},
|
|
1620
|
+
_threadCount: {
|
|
1621
|
+
get: function () {
|
|
1622
|
+
return context._threadCount;
|
|
1623
|
+
},
|
|
1624
|
+
set: function (_threadCount) {
|
|
1625
|
+
context._threadCount = _threadCount;
|
|
1626
|
+
}
|
|
1627
|
+
},
|
|
1628
|
+
Consumer: {
|
|
1629
|
+
get: function () {
|
|
1630
|
+
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
1631
|
+
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
1632
|
+
|
|
1633
|
+
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
return context.Consumer;
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
|
|
1640
|
+
|
|
1641
|
+
context.Consumer = Consumer;
|
|
1642
|
+
}
|
|
1643
|
+
|
|
1644
|
+
{
|
|
1645
|
+
context._currentRenderer = null;
|
|
1646
|
+
context._currentRenderer2 = null;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
return context;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
function lazy(ctor) {
|
|
1653
|
+
var lazyType = {
|
|
1654
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
1655
|
+
_ctor: ctor,
|
|
1656
|
+
// React uses these fields to store the result.
|
|
1657
|
+
_status: -1,
|
|
1658
|
+
_result: null
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1661
|
+
{
|
|
1662
|
+
// In production, this would just set it on the object.
|
|
1663
|
+
var defaultProps;
|
|
1664
|
+
var propTypes;
|
|
1665
|
+
Object.defineProperties(lazyType, {
|
|
1666
|
+
defaultProps: {
|
|
1667
|
+
configurable: true,
|
|
1668
|
+
get: function () {
|
|
1669
|
+
return defaultProps;
|
|
1670
|
+
},
|
|
1671
|
+
set: function (newDefaultProps) {
|
|
1672
|
+
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1673
|
+
|
|
1674
|
+
defaultProps = newDefaultProps; // Match production behavior more closely:
|
|
1675
|
+
|
|
1676
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
|
1677
|
+
enumerable: true
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
},
|
|
1681
|
+
propTypes: {
|
|
1682
|
+
configurable: true,
|
|
1683
|
+
get: function () {
|
|
1684
|
+
return propTypes;
|
|
1685
|
+
},
|
|
1686
|
+
set: function (newPropTypes) {
|
|
1687
|
+
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
1688
|
+
|
|
1689
|
+
propTypes = newPropTypes; // Match production behavior more closely:
|
|
1690
|
+
|
|
1691
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
|
1692
|
+
enumerable: true
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
return lazyType;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
function forwardRef(render) {
|
|
1703
|
+
{
|
|
1704
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
1705
|
+
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
1706
|
+
} else if (typeof render !== 'function') {
|
|
1707
|
+
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1708
|
+
} else {
|
|
1709
|
+
if (render.length !== 0 && render.length !== 2) {
|
|
1710
|
+
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
if (render != null) {
|
|
1715
|
+
if (render.defaultProps != null || render.propTypes != null) {
|
|
1716
|
+
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
return {
|
|
1722
|
+
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1723
|
+
render: render
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1727
|
+
function isValidElementType(type) {
|
|
1728
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1729
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
function memo(type, compare) {
|
|
1733
|
+
{
|
|
1734
|
+
if (!isValidElementType(type)) {
|
|
1735
|
+
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
return {
|
|
1740
|
+
$$typeof: REACT_MEMO_TYPE,
|
|
1741
|
+
type: type,
|
|
1742
|
+
compare: compare === undefined ? null : compare
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
function resolveDispatcher() {
|
|
1747
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
|
1748
|
+
|
|
1749
|
+
if (!(dispatcher !== null)) {
|
|
1750
|
+
{
|
|
1751
|
+
throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem." );
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
return dispatcher;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
function useContext(Context, unstable_observedBits) {
|
|
1759
|
+
var dispatcher = resolveDispatcher();
|
|
1760
|
+
|
|
1761
|
+
{
|
|
1762
|
+
if (unstable_observedBits !== undefined) {
|
|
1763
|
+
error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '');
|
|
1764
|
+
} // TODO: add a more generic warning for invalid values.
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
if (Context._context !== undefined) {
|
|
1768
|
+
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
|
|
1769
|
+
// and nobody should be using this in existing code.
|
|
1770
|
+
|
|
1771
|
+
if (realContext.Consumer === Context) {
|
|
1772
|
+
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
|
|
1773
|
+
} else if (realContext.Provider === Context) {
|
|
1774
|
+
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
return dispatcher.useContext(Context, unstable_observedBits);
|
|
1780
|
+
}
|
|
1781
|
+
function useState(initialState) {
|
|
1782
|
+
var dispatcher = resolveDispatcher();
|
|
1783
|
+
return dispatcher.useState(initialState);
|
|
1784
|
+
}
|
|
1785
|
+
function useReducer(reducer, initialArg, init) {
|
|
1786
|
+
var dispatcher = resolveDispatcher();
|
|
1787
|
+
return dispatcher.useReducer(reducer, initialArg, init);
|
|
1788
|
+
}
|
|
1789
|
+
function useRef(initialValue) {
|
|
1790
|
+
var dispatcher = resolveDispatcher();
|
|
1791
|
+
return dispatcher.useRef(initialValue);
|
|
1792
|
+
}
|
|
1793
|
+
function useEffect(create, deps) {
|
|
1794
|
+
var dispatcher = resolveDispatcher();
|
|
1795
|
+
return dispatcher.useEffect(create, deps);
|
|
1796
|
+
}
|
|
1797
|
+
function useLayoutEffect(create, deps) {
|
|
1798
|
+
var dispatcher = resolveDispatcher();
|
|
1799
|
+
return dispatcher.useLayoutEffect(create, deps);
|
|
1800
|
+
}
|
|
1801
|
+
function useCallback(callback, deps) {
|
|
1802
|
+
var dispatcher = resolveDispatcher();
|
|
1803
|
+
return dispatcher.useCallback(callback, deps);
|
|
1804
|
+
}
|
|
1805
|
+
function useMemo(create, deps) {
|
|
1806
|
+
var dispatcher = resolveDispatcher();
|
|
1807
|
+
return dispatcher.useMemo(create, deps);
|
|
1808
|
+
}
|
|
1809
|
+
function useImperativeHandle(ref, create, deps) {
|
|
1810
|
+
var dispatcher = resolveDispatcher();
|
|
1811
|
+
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
1812
|
+
}
|
|
1813
|
+
function useDebugValue(value, formatterFn) {
|
|
1814
|
+
{
|
|
1815
|
+
var dispatcher = resolveDispatcher();
|
|
1816
|
+
return dispatcher.useDebugValue(value, formatterFn);
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
var propTypesMisspellWarningShown;
|
|
1821
|
+
|
|
1822
|
+
{
|
|
1823
|
+
propTypesMisspellWarningShown = false;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1826
|
+
function getDeclarationErrorAddendum() {
|
|
1827
|
+
if (ReactCurrentOwner.current) {
|
|
1828
|
+
var name = getComponentName(ReactCurrentOwner.current.type);
|
|
1829
|
+
|
|
1830
|
+
if (name) {
|
|
1831
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
return '';
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
function getSourceInfoErrorAddendum(source) {
|
|
1839
|
+
if (source !== undefined) {
|
|
1840
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1841
|
+
var lineNumber = source.lineNumber;
|
|
1842
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
return '';
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
1849
|
+
if (elementProps !== null && elementProps !== undefined) {
|
|
1850
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
return '';
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1857
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
1858
|
+
* updates.
|
|
1859
|
+
*/
|
|
1860
|
+
|
|
1861
|
+
|
|
1862
|
+
var ownerHasKeyUseWarning = {};
|
|
1863
|
+
|
|
1864
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
1865
|
+
var info = getDeclarationErrorAddendum();
|
|
1866
|
+
|
|
1867
|
+
if (!info) {
|
|
1868
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1869
|
+
|
|
1870
|
+
if (parentName) {
|
|
1871
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1872
|
+
}
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
return info;
|
|
1876
|
+
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1879
|
+
* This element is in an array. The array could grow and shrink or be
|
|
1880
|
+
* reordered. All children that haven't already been validated are required to
|
|
1881
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1882
|
+
* will only be shown once.
|
|
1883
|
+
*
|
|
1884
|
+
* @internal
|
|
1885
|
+
* @param {ReactElement} element Element that requires a key.
|
|
1886
|
+
* @param {*} parentType element's parent's type.
|
|
1887
|
+
*/
|
|
1888
|
+
|
|
1889
|
+
|
|
1890
|
+
function validateExplicitKey(element, parentType) {
|
|
1891
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
1892
|
+
return;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
element._store.validated = true;
|
|
1896
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1897
|
+
|
|
1898
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1899
|
+
return;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1903
|
+
// property, it may be the creator of the child that's responsible for
|
|
1904
|
+
// assigning it a key.
|
|
1905
|
+
|
|
1906
|
+
var childOwner = '';
|
|
1907
|
+
|
|
1908
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
1909
|
+
// Give the component that originally created this child.
|
|
1910
|
+
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
|
|
1911
|
+
}
|
|
1912
|
+
|
|
1913
|
+
setCurrentlyValidatingElement(element);
|
|
1914
|
+
|
|
1915
|
+
{
|
|
1916
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
setCurrentlyValidatingElement(null);
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Ensure that every element either is passed in a static location, in an
|
|
1923
|
+
* array with an explicit keys property defined, or in an object literal
|
|
1924
|
+
* with valid key property.
|
|
1925
|
+
*
|
|
1926
|
+
* @internal
|
|
1927
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
1928
|
+
* @param {*} parentType node's parent's type.
|
|
1929
|
+
*/
|
|
1930
|
+
|
|
1931
|
+
|
|
1932
|
+
function validateChildKeys(node, parentType) {
|
|
1933
|
+
if (typeof node !== 'object') {
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
if (Array.isArray(node)) {
|
|
1938
|
+
for (var i = 0; i < node.length; i++) {
|
|
1939
|
+
var child = node[i];
|
|
1940
|
+
|
|
1941
|
+
if (isValidElement(child)) {
|
|
1942
|
+
validateExplicitKey(child, parentType);
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
} else if (isValidElement(node)) {
|
|
1946
|
+
// This element was passed in a valid location.
|
|
1947
|
+
if (node._store) {
|
|
1948
|
+
node._store.validated = true;
|
|
1949
|
+
}
|
|
1950
|
+
} else if (node) {
|
|
1951
|
+
var iteratorFn = getIteratorFn(node);
|
|
1952
|
+
|
|
1953
|
+
if (typeof iteratorFn === 'function') {
|
|
1954
|
+
// Entry iterators used to provide implicit keys,
|
|
1955
|
+
// but now we print a separate warning for them later.
|
|
1956
|
+
if (iteratorFn !== node.entries) {
|
|
1957
|
+
var iterator = iteratorFn.call(node);
|
|
1958
|
+
var step;
|
|
1959
|
+
|
|
1960
|
+
while (!(step = iterator.next()).done) {
|
|
1961
|
+
if (isValidElement(step.value)) {
|
|
1962
|
+
validateExplicitKey(step.value, parentType);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
1971
|
+
* provided by the type.
|
|
1972
|
+
*
|
|
1973
|
+
* @param {ReactElement} element
|
|
1974
|
+
*/
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
function validatePropTypes(element) {
|
|
1978
|
+
{
|
|
1979
|
+
var type = element.type;
|
|
1980
|
+
|
|
1981
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
var name = getComponentName(type);
|
|
1986
|
+
var propTypes;
|
|
1987
|
+
|
|
1988
|
+
if (typeof type === 'function') {
|
|
1989
|
+
propTypes = type.propTypes;
|
|
1990
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1991
|
+
// Inner props are checked in the reconciler.
|
|
1992
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1993
|
+
propTypes = type.propTypes;
|
|
1994
|
+
} else {
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
if (propTypes) {
|
|
1999
|
+
setCurrentlyValidatingElement(element);
|
|
2000
|
+
checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
2001
|
+
setCurrentlyValidatingElement(null);
|
|
2002
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
2003
|
+
propTypesMisspellWarningShown = true;
|
|
2004
|
+
|
|
2005
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
2009
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
2015
|
+
* @param {ReactElement} fragment
|
|
2016
|
+
*/
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
function validateFragmentProps(fragment) {
|
|
2020
|
+
{
|
|
2021
|
+
setCurrentlyValidatingElement(fragment);
|
|
2022
|
+
var keys = Object.keys(fragment.props);
|
|
2023
|
+
|
|
2024
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2025
|
+
var key = keys[i];
|
|
2026
|
+
|
|
2027
|
+
if (key !== 'children' && key !== 'key') {
|
|
2028
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
2029
|
+
|
|
2030
|
+
break;
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
if (fragment.ref !== null) {
|
|
2035
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
setCurrentlyValidatingElement(null);
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
function createElementWithValidation(type, props, children) {
|
|
2042
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2043
|
+
// succeed and there will likely be errors in render.
|
|
2044
|
+
|
|
2045
|
+
if (!validType) {
|
|
2046
|
+
var info = '';
|
|
2047
|
+
|
|
2048
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
2049
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
2053
|
+
|
|
2054
|
+
if (sourceInfo) {
|
|
2055
|
+
info += sourceInfo;
|
|
2056
|
+
} else {
|
|
2057
|
+
info += getDeclarationErrorAddendum();
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
var typeString;
|
|
2061
|
+
|
|
2062
|
+
if (type === null) {
|
|
2063
|
+
typeString = 'null';
|
|
2064
|
+
} else if (Array.isArray(type)) {
|
|
2065
|
+
typeString = 'array';
|
|
2066
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
2067
|
+
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
2068
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
2069
|
+
} else {
|
|
2070
|
+
typeString = typeof type;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
{
|
|
2074
|
+
error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
|
|
2079
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
2080
|
+
|
|
2081
|
+
if (element == null) {
|
|
2082
|
+
return element;
|
|
2083
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
2084
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
2085
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
2086
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
2087
|
+
// fixed, the key warnings will appear.)
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
if (validType) {
|
|
2091
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
2092
|
+
validateChildKeys(arguments[i], type);
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
|
|
2096
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
2097
|
+
validateFragmentProps(element);
|
|
2098
|
+
} else {
|
|
2099
|
+
validatePropTypes(element);
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
return element;
|
|
2103
|
+
}
|
|
2104
|
+
var didWarnAboutDeprecatedCreateFactory = false;
|
|
2105
|
+
function createFactoryWithValidation(type) {
|
|
2106
|
+
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
2107
|
+
validatedFactory.type = type;
|
|
2108
|
+
|
|
2109
|
+
{
|
|
2110
|
+
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
2111
|
+
didWarnAboutDeprecatedCreateFactory = true;
|
|
2112
|
+
|
|
2113
|
+
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
|
|
2114
|
+
} // Legacy hook: remove it
|
|
2115
|
+
|
|
2116
|
+
|
|
2117
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
2118
|
+
enumerable: false,
|
|
2119
|
+
get: function () {
|
|
2120
|
+
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
2121
|
+
|
|
2122
|
+
Object.defineProperty(this, 'type', {
|
|
2123
|
+
value: type
|
|
2124
|
+
});
|
|
2125
|
+
return type;
|
|
2126
|
+
}
|
|
2127
|
+
});
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
return validatedFactory;
|
|
2131
|
+
}
|
|
2132
|
+
function cloneElementWithValidation(element, props, children) {
|
|
2133
|
+
var newElement = cloneElement.apply(this, arguments);
|
|
2134
|
+
|
|
2135
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
2136
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
validatePropTypes(newElement);
|
|
2140
|
+
return newElement;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
{
|
|
2144
|
+
|
|
2145
|
+
try {
|
|
2146
|
+
var frozenObject = Object.freeze({});
|
|
2147
|
+
var testMap = new Map([[frozenObject, null]]);
|
|
2148
|
+
var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
|
|
2149
|
+
// https://github.com/rollup/rollup/issues/1771
|
|
2150
|
+
// TODO: we can remove these if Rollup fixes the bug.
|
|
2151
|
+
|
|
2152
|
+
testMap.set(0, 0);
|
|
2153
|
+
testSet.add(0);
|
|
2154
|
+
} catch (e) {
|
|
2155
|
+
}
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
var createElement$1 = createElementWithValidation ;
|
|
2159
|
+
var cloneElement$1 = cloneElementWithValidation ;
|
|
2160
|
+
var createFactory = createFactoryWithValidation ;
|
|
2161
|
+
var Children = {
|
|
2162
|
+
map: mapChildren,
|
|
2163
|
+
forEach: forEachChildren,
|
|
2164
|
+
count: countChildren,
|
|
2165
|
+
toArray: toArray,
|
|
2166
|
+
only: onlyChild
|
|
147
2167
|
};
|
|
148
2168
|
|
|
2169
|
+
react_development.Children = Children;
|
|
2170
|
+
react_development.Component = Component;
|
|
2171
|
+
react_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
2172
|
+
react_development.Profiler = REACT_PROFILER_TYPE;
|
|
2173
|
+
react_development.PureComponent = PureComponent;
|
|
2174
|
+
react_development.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2175
|
+
react_development.Suspense = REACT_SUSPENSE_TYPE;
|
|
2176
|
+
react_development.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2177
|
+
react_development.cloneElement = cloneElement$1;
|
|
2178
|
+
react_development.createContext = createContext;
|
|
2179
|
+
react_development.createElement = createElement$1;
|
|
2180
|
+
react_development.createFactory = createFactory;
|
|
2181
|
+
react_development.createRef = createRef;
|
|
2182
|
+
react_development.forwardRef = forwardRef;
|
|
2183
|
+
react_development.isValidElement = isValidElement;
|
|
2184
|
+
react_development.lazy = lazy;
|
|
2185
|
+
react_development.memo = memo;
|
|
2186
|
+
react_development.useCallback = useCallback;
|
|
2187
|
+
react_development.useContext = useContext;
|
|
2188
|
+
react_development.useDebugValue = useDebugValue;
|
|
2189
|
+
react_development.useEffect = useEffect;
|
|
2190
|
+
react_development.useImperativeHandle = useImperativeHandle;
|
|
2191
|
+
react_development.useLayoutEffect = useLayoutEffect;
|
|
2192
|
+
react_development.useMemo = useMemo;
|
|
2193
|
+
react_development.useReducer = useReducer;
|
|
2194
|
+
react_development.useRef = useRef;
|
|
2195
|
+
react_development.useState = useState;
|
|
2196
|
+
react_development.version = ReactVersion;
|
|
2197
|
+
})();
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
if (process.env.NODE_ENV === 'production') {
|
|
2201
|
+
react.exports = react_production_min;
|
|
2202
|
+
} else {
|
|
2203
|
+
react.exports = react_development;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
var React = react.exports;
|
|
2207
|
+
|
|
2208
|
+
var reactDom = {exports: {}};
|
|
2209
|
+
|
|
2210
|
+
var reactDom_production_min = {};
|
|
2211
|
+
|
|
149
2212
|
var scheduler = {exports: {}};
|
|
150
2213
|
|
|
151
2214
|
var scheduler_production_min = {};
|
|
@@ -1046,7 +3109,7 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
1046
3109
|
* This source code is licensed under the MIT license found in the
|
|
1047
3110
|
* LICENSE file in the root directory of this source tree.
|
|
1048
3111
|
*/
|
|
1049
|
-
var aa=
|
|
3112
|
+
var aa=react.exports,n$1=objectAssign,r$1=scheduler.exports;function u(a){for(var b="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=1;c<arguments.length;c++)b+="&args[]="+encodeURIComponent(arguments[c]);return "Minified React error #"+a+"; visit "+b+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!aa)throw Error(u(227));
|
|
1050
3113
|
function ba(a,b,c,d,e,f,g,h,k){var l=Array.prototype.slice.call(arguments,3);try{b.apply(c,l);}catch(m){this.onError(m);}}var da=!1,ea=null,fa=!1,ha=null,ia={onError:function(a){da=!0;ea=a;}};function ja(a,b,c,d,e,f,g,h,k){da=!1;ea=null;ba.apply(ia,arguments);}function ka(a,b,c,d,e,f,g,h,k){ja.apply(this,arguments);if(da){if(da){var l=ea;da=!1;ea=null;}else throw Error(u(198));fa||(fa=!0,ha=l);}}var la=null,ma=null,na=null;
|
|
1051
3114
|
function oa(a,b,c){var d=a.type||"unknown-event";a.currentTarget=na(c);ka(d,b,void 0,a);a.currentTarget=null;}var pa=null,qa={};
|
|
1052
3115
|
function ra(){if(pa)for(var a in qa){var b=qa[a],c=pa.indexOf(a);if(!(-1<c))throw Error(u(96,a));if(!sa[c]){if(!b.extractEvents)throw Error(u(97,a));sa[c]=b;c=b.eventTypes;for(var d in c){var e=void 0;var f=c[d],g=b,h=d;if(ta.hasOwnProperty(h))throw Error(u(99,h));ta[h]=f;var k=f.phasedRegistrationNames;if(k){for(e in k)k.hasOwnProperty(e)&&ua(k[e],g,h);e=!0;}else f.registrationName?(ua(f.registrationName,g,h),e=!0):e=!1;if(!e)throw Error(u(98,d,a));}}}}
|
|
@@ -1329,121 +3392,6 @@ reactDom_production_min.unstable_renderSubtreeIntoContainer=function(a,b,c,d){if
|
|
|
1329
3392
|
|
|
1330
3393
|
var reactDom_development = {};
|
|
1331
3394
|
|
|
1332
|
-
/**
|
|
1333
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1334
|
-
*
|
|
1335
|
-
* This source code is licensed under the MIT license found in the
|
|
1336
|
-
* LICENSE file in the root directory of this source tree.
|
|
1337
|
-
*/
|
|
1338
|
-
|
|
1339
|
-
var ReactPropTypesSecret$3 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
1340
|
-
|
|
1341
|
-
var ReactPropTypesSecret_1 = ReactPropTypesSecret$3;
|
|
1342
|
-
|
|
1343
|
-
var has$2 = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1347
|
-
*
|
|
1348
|
-
* This source code is licensed under the MIT license found in the
|
|
1349
|
-
* LICENSE file in the root directory of this source tree.
|
|
1350
|
-
*/
|
|
1351
|
-
|
|
1352
|
-
var printWarning$2 = function() {};
|
|
1353
|
-
|
|
1354
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1355
|
-
var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
|
|
1356
|
-
var loggedTypeFailures = {};
|
|
1357
|
-
var has$1 = has$2;
|
|
1358
|
-
|
|
1359
|
-
printWarning$2 = function(text) {
|
|
1360
|
-
var message = 'Warning: ' + text;
|
|
1361
|
-
if (typeof console !== 'undefined') {
|
|
1362
|
-
console.error(message);
|
|
1363
|
-
}
|
|
1364
|
-
try {
|
|
1365
|
-
// --- Welcome to debugging React ---
|
|
1366
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
1367
|
-
// to find the callsite that caused this warning to fire.
|
|
1368
|
-
throw new Error(message);
|
|
1369
|
-
} catch (x) { /**/ }
|
|
1370
|
-
};
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
/**
|
|
1374
|
-
* Assert that the values match with the type specs.
|
|
1375
|
-
* Error messages are memorized and will only be shown once.
|
|
1376
|
-
*
|
|
1377
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
1378
|
-
* @param {object} values Runtime values that need to be type-checked
|
|
1379
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
|
1380
|
-
* @param {string} componentName Name of the component for error messages.
|
|
1381
|
-
* @param {?Function} getStack Returns the component stack.
|
|
1382
|
-
* @private
|
|
1383
|
-
*/
|
|
1384
|
-
function checkPropTypes$1(typeSpecs, values, location, componentName, getStack) {
|
|
1385
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1386
|
-
for (var typeSpecName in typeSpecs) {
|
|
1387
|
-
if (has$1(typeSpecs, typeSpecName)) {
|
|
1388
|
-
var error;
|
|
1389
|
-
// Prop type validation may throw. In case they do, we don't want to
|
|
1390
|
-
// fail the render phase where it didn't fail before. So we log it.
|
|
1391
|
-
// After these have been cleaned up, we'll let them throw.
|
|
1392
|
-
try {
|
|
1393
|
-
// This is intentionally an invariant that gets caught. It's the same
|
|
1394
|
-
// behavior as without this statement except with a better message.
|
|
1395
|
-
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
1396
|
-
var err = Error(
|
|
1397
|
-
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
1398
|
-
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
1399
|
-
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
1400
|
-
);
|
|
1401
|
-
err.name = 'Invariant Violation';
|
|
1402
|
-
throw err;
|
|
1403
|
-
}
|
|
1404
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$2);
|
|
1405
|
-
} catch (ex) {
|
|
1406
|
-
error = ex;
|
|
1407
|
-
}
|
|
1408
|
-
if (error && !(error instanceof Error)) {
|
|
1409
|
-
printWarning$2(
|
|
1410
|
-
(componentName || 'React class') + ': type specification of ' +
|
|
1411
|
-
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
1412
|
-
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
1413
|
-
'You may have forgotten to pass an argument to the type checker ' +
|
|
1414
|
-
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
1415
|
-
'shape all require an argument).'
|
|
1416
|
-
);
|
|
1417
|
-
}
|
|
1418
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
1419
|
-
// Only monitor this failure once because there tends to be a lot of the
|
|
1420
|
-
// same error.
|
|
1421
|
-
loggedTypeFailures[error.message] = true;
|
|
1422
|
-
|
|
1423
|
-
var stack = getStack ? getStack() : '';
|
|
1424
|
-
|
|
1425
|
-
printWarning$2(
|
|
1426
|
-
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
1427
|
-
);
|
|
1428
|
-
}
|
|
1429
|
-
}
|
|
1430
|
-
}
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
/**
|
|
1435
|
-
* Resets warning cache when testing.
|
|
1436
|
-
*
|
|
1437
|
-
* @private
|
|
1438
|
-
*/
|
|
1439
|
-
checkPropTypes$1.resetWarningCache = function() {
|
|
1440
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
1441
|
-
loggedTypeFailures = {};
|
|
1442
|
-
}
|
|
1443
|
-
};
|
|
1444
|
-
|
|
1445
|
-
var checkPropTypes_1 = checkPropTypes$1;
|
|
1446
|
-
|
|
1447
3395
|
var tracing = {exports: {}};
|
|
1448
3396
|
|
|
1449
3397
|
var schedulerTracing_production_min = {};
|
|
@@ -1830,13 +3778,13 @@ if (process.env.NODE_ENV === 'production') {
|
|
|
1830
3778
|
if (process.env.NODE_ENV !== "production") {
|
|
1831
3779
|
(function() {
|
|
1832
3780
|
|
|
1833
|
-
var React
|
|
3781
|
+
var React = react.exports;
|
|
1834
3782
|
var _assign = objectAssign;
|
|
1835
3783
|
var Scheduler = scheduler.exports;
|
|
1836
3784
|
var checkPropTypes = checkPropTypes_1;
|
|
1837
3785
|
var tracing$1 = tracing.exports;
|
|
1838
3786
|
|
|
1839
|
-
var ReactSharedInternals = React
|
|
3787
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
|
|
1840
3788
|
// Current owner and dispatcher used to share the same ref,
|
|
1841
3789
|
// but PR #14548 split them out to better support the react-debug-tools package.
|
|
1842
3790
|
|
|
@@ -1915,7 +3863,7 @@ function printWarning(level, format, args) {
|
|
|
1915
3863
|
}
|
|
1916
3864
|
}
|
|
1917
3865
|
|
|
1918
|
-
if (!React
|
|
3866
|
+
if (!React) {
|
|
1919
3867
|
{
|
|
1920
3868
|
throw Error( "ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM." );
|
|
1921
3869
|
}
|
|
@@ -3882,7 +5830,7 @@ function flattenChildren(children) {
|
|
|
3882
5830
|
// Elements are stringified (which is normally irrelevant
|
|
3883
5831
|
// but matters for <fbt>).
|
|
3884
5832
|
|
|
3885
|
-
React
|
|
5833
|
+
React.Children.forEach(children, function (child) {
|
|
3886
5834
|
if (child == null) {
|
|
3887
5835
|
return;
|
|
3888
5836
|
}
|
|
@@ -3905,7 +5853,7 @@ function validateProps(element, props) {
|
|
|
3905
5853
|
// TODO: this seems like it could cause a DEV-only throw for hydration
|
|
3906
5854
|
// if children contains a non-element object. We should try to avoid that.
|
|
3907
5855
|
if (typeof props.children === 'object' && props.children !== null) {
|
|
3908
|
-
React
|
|
5856
|
+
React.Children.forEach(props.children, function (child) {
|
|
3909
5857
|
if (child == null) {
|
|
3910
5858
|
return;
|
|
3911
5859
|
}
|
|
@@ -14336,7 +16284,7 @@ var fakeInternalInstance = {};
|
|
|
14336
16284
|
var isArray = Array.isArray; // React.Component uses a shared frozen object by default.
|
|
14337
16285
|
// We'll use it to determine whether we need to initialize legacy refs.
|
|
14338
16286
|
|
|
14339
|
-
var emptyRefsObject = new React
|
|
16287
|
+
var emptyRefsObject = new React.Component().refs;
|
|
14340
16288
|
var didWarnAboutStateAssignmentForComponent;
|
|
14341
16289
|
var didWarnAboutUninitializedState;
|
|
14342
16290
|
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
|
@@ -35121,7 +37069,7 @@ var _getPrototypeOf2$2 = _interopRequireDefault$4(getPrototypeOf$1.exports);
|
|
|
35121
37069
|
|
|
35122
37070
|
var _inherits2$2 = _interopRequireDefault$4(inherits.exports);
|
|
35123
37071
|
|
|
35124
|
-
var _react$2 = _interopRequireDefault$4(
|
|
37072
|
+
var _react$2 = _interopRequireDefault$4(react.exports);
|
|
35125
37073
|
|
|
35126
37074
|
var _propTypes$2 = _interopRequireDefault$4(propTypes.exports);
|
|
35127
37075
|
|
|
@@ -35625,7 +37573,7 @@ var _inherits2$1 = _interopRequireDefault$1(inherits.exports);
|
|
|
35625
37573
|
|
|
35626
37574
|
var _objectWithoutProperties2$1 = _interopRequireDefault$1(objectWithoutProperties.exports);
|
|
35627
37575
|
|
|
35628
|
-
var _react$1 = _interopRequireDefault$1(
|
|
37576
|
+
var _react$1 = _interopRequireDefault$1(react.exports);
|
|
35629
37577
|
|
|
35630
37578
|
var _propTypes$1 = _interopRequireDefault$1(propTypes.exports);
|
|
35631
37579
|
|
|
@@ -36016,7 +37964,7 @@ var _getPrototypeOf2 = _interopRequireDefault(getPrototypeOf$1.exports);
|
|
|
36016
37964
|
|
|
36017
37965
|
var _inherits2 = _interopRequireDefault(inherits.exports);
|
|
36018
37966
|
|
|
36019
|
-
var _react = _interopRequireDefault(
|
|
37967
|
+
var _react = _interopRequireDefault(react.exports);
|
|
36020
37968
|
|
|
36021
37969
|
var _propTypes = _interopRequireDefault(propTypes.exports);
|
|
36022
37970
|
|