react 0.0.0-experimental-235a6c4af → 0.0.0-experimental-e5d06e34b
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/build-info.json +4 -4
- package/cjs/react-jsx-dev-runtime.development.js +819 -0
- package/cjs/react-jsx-dev-runtime.production.min.js +10 -0
- package/cjs/react-jsx-dev-runtime.profiling.min.js +10 -0
- package/cjs/react-jsx-runtime.development.js +837 -0
- package/cjs/react-jsx-runtime.production.min.js +11 -0
- package/cjs/react-jsx-runtime.profiling.min.js +11 -0
- package/cjs/react.development.js +450 -455
- package/cjs/react.production.min.js +18 -19
- package/jsx-dev-runtime.js +7 -0
- package/jsx-runtime.js +7 -0
- package/package.json +4 -2
- package/umd/react.development.js +451 -455
- package/umd/react.production.min.js +25 -26
- package/umd/react.profiling.min.js +32 -33
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @license React v0.0.0-experimental-e5d06e34b
|
|
2
|
+
* react-jsx-runtime.production.min.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';var f=require("react"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
11
|
+
function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @license React v0.0.0-experimental-e5d06e34b
|
|
2
|
+
* react-jsx-runtime.profiling.min.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
'use strict';var f=require("react"),g=60103;exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var h=Symbol.for;g=h("react.element");exports.Fragment=h("react.fragment")}var m=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,n=Object.prototype.hasOwnProperty,p={key:!0,ref:!0,__self:!0,__source:!0};
|
|
11
|
+
function q(c,a,k){var b,d={},e=null,l=null;void 0!==k&&(e=""+k);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(l=a.ref);for(b in a)n.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:g,type:c,key:e,ref:l,props:d,_owner:m.current}}exports.jsx=q;exports.jsxs=q;
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.0.0-experimental-
|
|
1
|
+
/** @license React v0.0.0-experimental-e5d06e34b
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -18,28 +18,51 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
18
18
|
var _assign = require('object-assign');
|
|
19
19
|
|
|
20
20
|
// TODO: this is special because it gets imported during build.
|
|
21
|
-
var ReactVersion = '16.13.
|
|
21
|
+
var ReactVersion = '16.13.1-experimental-e5d06e34b';
|
|
22
22
|
|
|
23
23
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
24
24
|
// nor polyfill, then a plain number is used for performance.
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
25
|
+
var REACT_ELEMENT_TYPE = 0xeac7;
|
|
26
|
+
var REACT_PORTAL_TYPE = 0xeaca;
|
|
27
|
+
exports.Fragment = 0xeacb;
|
|
28
|
+
exports.StrictMode = 0xeacc;
|
|
29
|
+
exports.Profiler = 0xead2;
|
|
30
|
+
var REACT_PROVIDER_TYPE = 0xeacd;
|
|
31
|
+
var REACT_CONTEXT_TYPE = 0xeace;
|
|
32
|
+
var REACT_FORWARD_REF_TYPE = 0xead0;
|
|
33
|
+
exports.Suspense = 0xead1;
|
|
34
|
+
exports.SuspenseList = 0xead8;
|
|
35
|
+
var REACT_MEMO_TYPE = 0xead3;
|
|
36
|
+
var REACT_LAZY_TYPE = 0xead4;
|
|
37
|
+
var REACT_BLOCK_TYPE = 0xead9;
|
|
38
|
+
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
39
|
+
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
40
|
+
var REACT_RESPONDER_TYPE = 0xead6;
|
|
41
|
+
var REACT_SCOPE_TYPE = 0xead7;
|
|
42
|
+
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
|
43
|
+
|
|
44
|
+
if (typeof Symbol === 'function' && Symbol.for) {
|
|
45
|
+
var symbolFor = Symbol.for;
|
|
46
|
+
REACT_ELEMENT_TYPE = symbolFor('react.element');
|
|
47
|
+
REACT_PORTAL_TYPE = symbolFor('react.portal');
|
|
48
|
+
exports.Fragment = symbolFor('react.fragment');
|
|
49
|
+
exports.StrictMode = symbolFor('react.strict_mode');
|
|
50
|
+
exports.Profiler = symbolFor('react.profiler');
|
|
51
|
+
REACT_PROVIDER_TYPE = symbolFor('react.provider');
|
|
52
|
+
REACT_CONTEXT_TYPE = symbolFor('react.context');
|
|
53
|
+
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
|
|
54
|
+
exports.Suspense = symbolFor('react.suspense');
|
|
55
|
+
exports.SuspenseList = symbolFor('react.suspense_list');
|
|
56
|
+
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
57
|
+
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
58
|
+
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
59
|
+
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
60
|
+
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
61
|
+
REACT_RESPONDER_TYPE = symbolFor('react.responder');
|
|
62
|
+
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
|
63
|
+
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
|
64
|
+
}
|
|
65
|
+
|
|
43
66
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
44
67
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
45
68
|
function getIteratorFn(maybeIterable) {
|
|
@@ -90,26 +113,24 @@ var ReactCurrentOwner = {
|
|
|
90
113
|
};
|
|
91
114
|
|
|
92
115
|
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
93
|
-
|
|
116
|
+
|
|
117
|
+
function describeComponentFrame(name, source, ownerName) {
|
|
94
118
|
var sourceInfo = '';
|
|
95
119
|
|
|
96
|
-
if (source) {
|
|
120
|
+
if ( source) {
|
|
97
121
|
var path = source.fileName;
|
|
98
|
-
var fileName = path.replace(BEFORE_SLASH_RE, '');
|
|
122
|
+
var fileName = path.replace(BEFORE_SLASH_RE, ''); // In DEV, include code for a common special case:
|
|
123
|
+
// prefer "folder/index.js" instead of just "index.js".
|
|
99
124
|
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
// prefer "folder/index.js" instead of just "index.js".
|
|
103
|
-
if (/^index\./.test(fileName)) {
|
|
104
|
-
var match = path.match(BEFORE_SLASH_RE);
|
|
125
|
+
if (/^index\./.test(fileName)) {
|
|
126
|
+
var match = path.match(BEFORE_SLASH_RE);
|
|
105
127
|
|
|
106
|
-
|
|
107
|
-
|
|
128
|
+
if (match) {
|
|
129
|
+
var pathBeforeSlash = match[1];
|
|
108
130
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
131
|
+
if (pathBeforeSlash) {
|
|
132
|
+
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
|
|
133
|
+
fileName = folderName + '/' + fileName;
|
|
113
134
|
}
|
|
114
135
|
}
|
|
115
136
|
}
|
|
@@ -122,96 +143,91 @@ function describeComponentFrame (name, source, ownerName) {
|
|
|
122
143
|
return '\n in ' + (name || 'Unknown') + sourceInfo;
|
|
123
144
|
}
|
|
124
145
|
|
|
125
|
-
|
|
126
|
-
var
|
|
146
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
147
|
+
var ownerName = null;
|
|
127
148
|
|
|
128
|
-
|
|
129
|
-
|
|
149
|
+
if ( ownerFn) {
|
|
150
|
+
ownerName = ownerFn.displayName || ownerFn.name || null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return describeComponentFrame(name, source, ownerName);
|
|
154
|
+
}
|
|
155
|
+
function describeClassComponentFrame(ctor, source, ownerFn) {
|
|
156
|
+
return describeFunctionComponentFrame(ctor, source, ownerFn);
|
|
130
157
|
}
|
|
158
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
159
|
+
if (!fn) {
|
|
160
|
+
return '';
|
|
161
|
+
}
|
|
131
162
|
|
|
132
|
-
|
|
133
|
-
var
|
|
134
|
-
|
|
163
|
+
var name = fn.displayName || fn.name || null;
|
|
164
|
+
var ownerName = null;
|
|
165
|
+
|
|
166
|
+
if ( ownerFn) {
|
|
167
|
+
ownerName = ownerFn.displayName || ownerFn.name || null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return describeComponentFrame(name, source, ownerName);
|
|
135
171
|
}
|
|
136
172
|
|
|
137
|
-
function
|
|
138
|
-
|
|
173
|
+
function shouldConstruct(Component) {
|
|
174
|
+
var prototype = Component.prototype;
|
|
175
|
+
return !!(prototype && prototype.isReactComponent);
|
|
139
176
|
}
|
|
140
177
|
|
|
141
|
-
function
|
|
178
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
179
|
+
|
|
142
180
|
if (type == null) {
|
|
143
|
-
|
|
144
|
-
return null;
|
|
181
|
+
return '';
|
|
145
182
|
}
|
|
146
183
|
|
|
147
|
-
{
|
|
148
|
-
if (
|
|
149
|
-
|
|
184
|
+
if (typeof type === 'function') {
|
|
185
|
+
if (shouldConstruct(type)) {
|
|
186
|
+
return describeClassComponentFrame(type, source, ownerFn);
|
|
150
187
|
}
|
|
151
|
-
}
|
|
152
188
|
|
|
153
|
-
|
|
154
|
-
return type.displayName || type.name || null;
|
|
189
|
+
return describeFunctionComponentFrame(type, source, ownerFn);
|
|
155
190
|
}
|
|
156
191
|
|
|
157
192
|
if (typeof type === 'string') {
|
|
158
|
-
return type;
|
|
193
|
+
return describeBuiltInComponentFrame(type, source, ownerFn);
|
|
159
194
|
}
|
|
160
195
|
|
|
161
196
|
switch (type) {
|
|
162
|
-
case
|
|
163
|
-
return '
|
|
164
|
-
|
|
165
|
-
case REACT_PORTAL_TYPE:
|
|
166
|
-
return 'Portal';
|
|
167
|
-
|
|
168
|
-
case REACT_PROFILER_TYPE:
|
|
169
|
-
return "Profiler";
|
|
170
|
-
|
|
171
|
-
case REACT_STRICT_MODE_TYPE:
|
|
172
|
-
return 'StrictMode';
|
|
173
|
-
|
|
174
|
-
case REACT_SUSPENSE_TYPE:
|
|
175
|
-
return 'Suspense';
|
|
197
|
+
case exports.Suspense:
|
|
198
|
+
return describeBuiltInComponentFrame('Suspense', source, ownerFn);
|
|
176
199
|
|
|
177
|
-
case
|
|
178
|
-
return 'SuspenseList';
|
|
200
|
+
case exports.SuspenseList:
|
|
201
|
+
return describeBuiltInComponentFrame('SuspenseList', source, ownerFn);
|
|
179
202
|
}
|
|
180
203
|
|
|
181
204
|
if (typeof type === 'object') {
|
|
182
205
|
switch (type.$$typeof) {
|
|
183
|
-
case REACT_CONTEXT_TYPE:
|
|
184
|
-
var context = type;
|
|
185
|
-
return getContextName(context) + '.Consumer';
|
|
186
|
-
|
|
187
|
-
case REACT_PROVIDER_TYPE:
|
|
188
|
-
var provider = type;
|
|
189
|
-
return getContextName(provider._context) + '.Provider';
|
|
190
|
-
|
|
191
206
|
case REACT_FORWARD_REF_TYPE:
|
|
192
|
-
return
|
|
207
|
+
return describeFunctionComponentFrame(type.render, source, ownerFn);
|
|
193
208
|
|
|
194
209
|
case REACT_MEMO_TYPE:
|
|
195
|
-
|
|
210
|
+
// Memo may contain any component type so we recursively resolve it.
|
|
211
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
196
212
|
|
|
197
213
|
case REACT_BLOCK_TYPE:
|
|
198
|
-
return
|
|
214
|
+
return describeFunctionComponentFrame(type._render, source, ownerFn);
|
|
199
215
|
|
|
200
216
|
case REACT_LAZY_TYPE:
|
|
201
217
|
{
|
|
202
|
-
var
|
|
203
|
-
var
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
218
|
+
var lazyComponent = type;
|
|
219
|
+
var payload = lazyComponent._payload;
|
|
220
|
+
var init = lazyComponent._init;
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
224
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
225
|
+
} catch (x) {}
|
|
210
226
|
}
|
|
211
227
|
}
|
|
212
228
|
}
|
|
213
229
|
|
|
214
|
-
return
|
|
230
|
+
return '';
|
|
215
231
|
}
|
|
216
232
|
|
|
217
233
|
var ReactDebugCurrentFrame = {};
|
|
@@ -223,16 +239,21 @@ function setCurrentlyValidatingElement(element) {
|
|
|
223
239
|
}
|
|
224
240
|
|
|
225
241
|
{
|
|
226
|
-
|
|
242
|
+
ReactDebugCurrentFrame.setCurrentlyValidatingElement = function (element) {
|
|
243
|
+
{
|
|
244
|
+
currentlyValidatingElement = element;
|
|
245
|
+
}
|
|
246
|
+
}; // Stack implementation injected by the current renderer.
|
|
247
|
+
|
|
248
|
+
|
|
227
249
|
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
228
250
|
|
|
229
251
|
ReactDebugCurrentFrame.getStackAddendum = function () {
|
|
230
252
|
var stack = ''; // Add an extra top frame while an element is being validated
|
|
231
253
|
|
|
232
254
|
if (currentlyValidatingElement) {
|
|
233
|
-
var name = getComponentName(currentlyValidatingElement.type);
|
|
234
255
|
var owner = currentlyValidatingElement._owner;
|
|
235
|
-
stack +=
|
|
256
|
+
stack += describeUnknownElementTypeFrameInDEV(currentlyValidatingElement.type, currentlyValidatingElement._source, owner ? owner.type : null);
|
|
236
257
|
} // Delegate to the injected renderer-specific implementation
|
|
237
258
|
|
|
238
259
|
|
|
@@ -562,6 +583,92 @@ function createRef() {
|
|
|
562
583
|
return refObject;
|
|
563
584
|
}
|
|
564
585
|
|
|
586
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
587
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
588
|
+
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
function getContextName(type) {
|
|
592
|
+
return type.displayName || 'Context';
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function getComponentName(type) {
|
|
596
|
+
if (type == null) {
|
|
597
|
+
// Host root, text node or just invalid type.
|
|
598
|
+
return null;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
{
|
|
602
|
+
if (typeof type.tag === 'number') {
|
|
603
|
+
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
if (typeof type === 'function') {
|
|
608
|
+
return type.displayName || type.name || null;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
if (typeof type === 'string') {
|
|
612
|
+
return type;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
switch (type) {
|
|
616
|
+
case exports.Fragment:
|
|
617
|
+
return 'Fragment';
|
|
618
|
+
|
|
619
|
+
case REACT_PORTAL_TYPE:
|
|
620
|
+
return 'Portal';
|
|
621
|
+
|
|
622
|
+
case exports.Profiler:
|
|
623
|
+
return "Profiler";
|
|
624
|
+
|
|
625
|
+
case exports.StrictMode:
|
|
626
|
+
return 'StrictMode';
|
|
627
|
+
|
|
628
|
+
case exports.Suspense:
|
|
629
|
+
return 'Suspense';
|
|
630
|
+
|
|
631
|
+
case exports.SuspenseList:
|
|
632
|
+
return 'SuspenseList';
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
if (typeof type === 'object') {
|
|
636
|
+
switch (type.$$typeof) {
|
|
637
|
+
case REACT_CONTEXT_TYPE:
|
|
638
|
+
var context = type;
|
|
639
|
+
return getContextName(context) + '.Consumer';
|
|
640
|
+
|
|
641
|
+
case REACT_PROVIDER_TYPE:
|
|
642
|
+
var provider = type;
|
|
643
|
+
return getContextName(provider._context) + '.Provider';
|
|
644
|
+
|
|
645
|
+
case REACT_FORWARD_REF_TYPE:
|
|
646
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
647
|
+
|
|
648
|
+
case REACT_MEMO_TYPE:
|
|
649
|
+
return getComponentName(type.type);
|
|
650
|
+
|
|
651
|
+
case REACT_BLOCK_TYPE:
|
|
652
|
+
return getComponentName(type._render);
|
|
653
|
+
|
|
654
|
+
case REACT_LAZY_TYPE:
|
|
655
|
+
{
|
|
656
|
+
var lazyComponent = type;
|
|
657
|
+
var payload = lazyComponent._payload;
|
|
658
|
+
var init = lazyComponent._init;
|
|
659
|
+
|
|
660
|
+
try {
|
|
661
|
+
return getComponentName(init(payload));
|
|
662
|
+
} catch (x) {
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return null;
|
|
670
|
+
}
|
|
671
|
+
|
|
565
672
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
566
673
|
var RESERVED_PROPS = {
|
|
567
674
|
key: true,
|
|
@@ -645,7 +752,7 @@ function warnIfStringRefCannotBeAutoConverted(config) {
|
|
|
645
752
|
var componentName = getComponentName(ReactCurrentOwner.current.type);
|
|
646
753
|
|
|
647
754
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
648
|
-
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',
|
|
755
|
+
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', componentName, config.ref);
|
|
649
756
|
|
|
650
757
|
didWarnAboutStringRefs[componentName] = true;
|
|
651
758
|
}
|
|
@@ -727,70 +834,6 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
727
834
|
|
|
728
835
|
return element;
|
|
729
836
|
};
|
|
730
|
-
/**
|
|
731
|
-
* https://github.com/reactjs/rfcs/pull/107
|
|
732
|
-
* @param {*} type
|
|
733
|
-
* @param {object} props
|
|
734
|
-
* @param {string} key
|
|
735
|
-
*/
|
|
736
|
-
|
|
737
|
-
function jsxDEV(type, config, maybeKey, source, self) {
|
|
738
|
-
var propName; // Reserved names are extracted
|
|
739
|
-
|
|
740
|
-
var props = {};
|
|
741
|
-
var key = null;
|
|
742
|
-
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
743
|
-
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
744
|
-
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
745
|
-
// but as an intermediary step, we will use jsxDEV for everything except
|
|
746
|
-
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
747
|
-
// key is explicitly declared to be undefined or not.
|
|
748
|
-
|
|
749
|
-
if (maybeKey !== undefined) {
|
|
750
|
-
key = '' + maybeKey;
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
if (hasValidKey(config)) {
|
|
754
|
-
key = '' + config.key;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
if (hasValidRef(config)) {
|
|
758
|
-
ref = config.ref;
|
|
759
|
-
warnIfStringRefCannotBeAutoConverted(config);
|
|
760
|
-
} // Remaining properties are added to a new props object
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
for (propName in config) {
|
|
764
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
765
|
-
props[propName] = config[propName];
|
|
766
|
-
}
|
|
767
|
-
} // Resolve default props
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
if (type && type.defaultProps) {
|
|
771
|
-
var defaultProps = type.defaultProps;
|
|
772
|
-
|
|
773
|
-
for (propName in defaultProps) {
|
|
774
|
-
if (props[propName] === undefined) {
|
|
775
|
-
props[propName] = defaultProps[propName];
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
if (key || ref) {
|
|
781
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
782
|
-
|
|
783
|
-
if (key) {
|
|
784
|
-
defineKeyPropWarningGetter(props, displayName);
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
if (ref) {
|
|
788
|
-
defineRefPropWarningGetter(props, displayName);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
793
|
-
}
|
|
794
837
|
/**
|
|
795
838
|
* Create and return a new ReactElement of the given type.
|
|
796
839
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
@@ -984,7 +1027,7 @@ function escape(key) {
|
|
|
984
1027
|
'=': '=0',
|
|
985
1028
|
':': '=2'
|
|
986
1029
|
};
|
|
987
|
-
var escapedString =
|
|
1030
|
+
var escapedString = key.replace(escapeRegex, function (match) {
|
|
988
1031
|
return escaperLookup[match];
|
|
989
1032
|
});
|
|
990
1033
|
return '$' + escapedString;
|
|
@@ -999,54 +1042,30 @@ var didWarnAboutMaps = false;
|
|
|
999
1042
|
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1000
1043
|
|
|
1001
1044
|
function escapeUserProvidedKey(text) {
|
|
1002
|
-
return
|
|
1045
|
+
return text.replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1003
1046
|
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Generate a key string that identifies a element within a set.
|
|
1049
|
+
*
|
|
1050
|
+
* @param {*} element A element that could contain a manual key.
|
|
1051
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1052
|
+
* @return {string}
|
|
1053
|
+
*/
|
|
1004
1054
|
|
|
1005
|
-
var POOL_SIZE = 10;
|
|
1006
|
-
var traverseContextPool = [];
|
|
1007
1055
|
|
|
1008
|
-
function
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
traverseContext.count = 0;
|
|
1016
|
-
return traverseContext;
|
|
1017
|
-
} else {
|
|
1018
|
-
return {
|
|
1019
|
-
result: mapResult,
|
|
1020
|
-
keyPrefix: keyPrefix,
|
|
1021
|
-
func: mapFunction,
|
|
1022
|
-
context: mapContext,
|
|
1023
|
-
count: 0
|
|
1024
|
-
};
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1056
|
+
function getElementKey(element, index) {
|
|
1057
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1058
|
+
// that we don't block potential future ES APIs.
|
|
1059
|
+
if (typeof element === 'object' && element !== null && element.key != null) {
|
|
1060
|
+
// Explicit key
|
|
1061
|
+
return escape('' + element.key);
|
|
1062
|
+
} // Implicit key determined by the index in the set
|
|
1027
1063
|
|
|
1028
|
-
function releaseTraverseContext(traverseContext) {
|
|
1029
|
-
traverseContext.result = null;
|
|
1030
|
-
traverseContext.keyPrefix = null;
|
|
1031
|
-
traverseContext.func = null;
|
|
1032
|
-
traverseContext.context = null;
|
|
1033
|
-
traverseContext.count = 0;
|
|
1034
1064
|
|
|
1035
|
-
|
|
1036
|
-
traverseContextPool.push(traverseContext);
|
|
1037
|
-
}
|
|
1065
|
+
return index.toString(36);
|
|
1038
1066
|
}
|
|
1039
|
-
/**
|
|
1040
|
-
* @param {?*} children Children tree container.
|
|
1041
|
-
* @param {!string} nameSoFar Name of the key path so far.
|
|
1042
|
-
* @param {!function} callback Callback to invoke with each child found.
|
|
1043
|
-
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1044
|
-
* process.
|
|
1045
|
-
* @return {!number} The number of children in this subtree.
|
|
1046
|
-
*/
|
|
1047
|
-
|
|
1048
1067
|
|
|
1049
|
-
function
|
|
1068
|
+
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
1050
1069
|
var type = typeof children;
|
|
1051
1070
|
|
|
1052
1071
|
if (type === 'undefined' || type === 'boolean') {
|
|
@@ -1076,9 +1095,34 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1076
1095
|
}
|
|
1077
1096
|
|
|
1078
1097
|
if (invokeCallback) {
|
|
1079
|
-
|
|
1080
|
-
//
|
|
1081
|
-
|
|
1098
|
+
var _child = children;
|
|
1099
|
+
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
|
|
1100
|
+
// so that it's consistent if the number of children grows:
|
|
1101
|
+
|
|
1102
|
+
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
1103
|
+
|
|
1104
|
+
if (Array.isArray(mappedChild)) {
|
|
1105
|
+
var escapedChildKey = '';
|
|
1106
|
+
|
|
1107
|
+
if (childKey != null) {
|
|
1108
|
+
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
|
|
1112
|
+
return c;
|
|
1113
|
+
});
|
|
1114
|
+
} else if (mappedChild != null) {
|
|
1115
|
+
if (isValidElement(mappedChild)) {
|
|
1116
|
+
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1117
|
+
// traverseAllChildren used to do for objects as children
|
|
1118
|
+
escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
|
|
1119
|
+
mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
|
|
1120
|
+
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
array.push(mappedChild);
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1082
1126
|
return 1;
|
|
1083
1127
|
}
|
|
1084
1128
|
|
|
@@ -1091,33 +1135,34 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1091
1135
|
if (Array.isArray(children)) {
|
|
1092
1136
|
for (var i = 0; i < children.length; i++) {
|
|
1093
1137
|
child = children[i];
|
|
1094
|
-
nextName = nextNamePrefix +
|
|
1095
|
-
subtreeCount +=
|
|
1138
|
+
nextName = nextNamePrefix + getElementKey(child, i);
|
|
1139
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1096
1140
|
}
|
|
1097
1141
|
} else {
|
|
1098
1142
|
var iteratorFn = getIteratorFn(children);
|
|
1099
1143
|
|
|
1100
1144
|
if (typeof iteratorFn === 'function') {
|
|
1145
|
+
var iterableChildren = children;
|
|
1101
1146
|
|
|
1102
1147
|
{
|
|
1103
1148
|
// Warn about using Maps as children
|
|
1104
|
-
if (iteratorFn ===
|
|
1149
|
+
if (iteratorFn === iterableChildren.entries) {
|
|
1105
1150
|
if (!didWarnAboutMaps) {
|
|
1106
|
-
warn('Using Maps as children is
|
|
1151
|
+
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
|
|
1107
1152
|
}
|
|
1108
1153
|
|
|
1109
1154
|
didWarnAboutMaps = true;
|
|
1110
1155
|
}
|
|
1111
1156
|
}
|
|
1112
1157
|
|
|
1113
|
-
var iterator = iteratorFn.call(
|
|
1158
|
+
var iterator = iteratorFn.call(iterableChildren);
|
|
1114
1159
|
var step;
|
|
1115
1160
|
var ii = 0;
|
|
1116
1161
|
|
|
1117
1162
|
while (!(step = iterator.next()).done) {
|
|
1118
1163
|
child = step.value;
|
|
1119
|
-
nextName = nextNamePrefix +
|
|
1120
|
-
subtreeCount +=
|
|
1164
|
+
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
1165
|
+
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
1121
1166
|
}
|
|
1122
1167
|
} else if (type === 'object') {
|
|
1123
1168
|
var addendum = '';
|
|
@@ -1138,114 +1183,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1138
1183
|
|
|
1139
1184
|
return subtreeCount;
|
|
1140
1185
|
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Traverses children that are typically specified as `props.children`, but
|
|
1143
|
-
* might also be specified through attributes:
|
|
1144
|
-
*
|
|
1145
|
-
* - `traverseAllChildren(this.props.children, ...)`
|
|
1146
|
-
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1147
|
-
*
|
|
1148
|
-
* The `traverseContext` is an optional argument that is passed through the
|
|
1149
|
-
* entire traversal. It can be used to store accumulations or anything else that
|
|
1150
|
-
* the callback might find relevant.
|
|
1151
|
-
*
|
|
1152
|
-
* @param {?*} children Children tree object.
|
|
1153
|
-
* @param {!function} callback To invoke upon traversing each child.
|
|
1154
|
-
* @param {?*} traverseContext Context for traversal.
|
|
1155
|
-
* @return {!number} The number of children in this subtree.
|
|
1156
|
-
*/
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
function traverseAllChildren(children, callback, traverseContext) {
|
|
1160
|
-
if (children == null) {
|
|
1161
|
-
return 0;
|
|
1162
|
-
}
|
|
1163
1186
|
|
|
1164
|
-
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1165
|
-
}
|
|
1166
|
-
/**
|
|
1167
|
-
* Generate a key string that identifies a component within a set.
|
|
1168
|
-
*
|
|
1169
|
-
* @param {*} component A component that could contain a manual key.
|
|
1170
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
|
1171
|
-
* @return {string}
|
|
1172
|
-
*/
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
function getComponentKey(component, index) {
|
|
1176
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1177
|
-
// that we don't block potential future ES APIs.
|
|
1178
|
-
if (typeof component === 'object' && component !== null && component.key != null) {
|
|
1179
|
-
// Explicit key
|
|
1180
|
-
return escape(component.key);
|
|
1181
|
-
} // Implicit key determined by the index in the set
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
return index.toString(36);
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
function forEachSingleChild(bookKeeping, child, name) {
|
|
1188
|
-
var func = bookKeeping.func,
|
|
1189
|
-
context = bookKeeping.context;
|
|
1190
|
-
func.call(context, child, bookKeeping.count++);
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* Iterates through children that are typically specified as `props.children`.
|
|
1194
|
-
*
|
|
1195
|
-
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1196
|
-
*
|
|
1197
|
-
* The provided forEachFunc(child, index) will be called for each
|
|
1198
|
-
* leaf child.
|
|
1199
|
-
*
|
|
1200
|
-
* @param {?*} children Children tree container.
|
|
1201
|
-
* @param {function(*, int)} forEachFunc
|
|
1202
|
-
* @param {*} forEachContext Context for forEachContext.
|
|
1203
|
-
*/
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1207
|
-
if (children == null) {
|
|
1208
|
-
return children;
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
|
1212
|
-
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
|
1213
|
-
releaseTraverseContext(traverseContext);
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1217
|
-
var result = bookKeeping.result,
|
|
1218
|
-
keyPrefix = bookKeeping.keyPrefix,
|
|
1219
|
-
func = bookKeeping.func,
|
|
1220
|
-
context = bookKeeping.context;
|
|
1221
|
-
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1222
|
-
|
|
1223
|
-
if (Array.isArray(mappedChild)) {
|
|
1224
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
|
|
1225
|
-
return c;
|
|
1226
|
-
});
|
|
1227
|
-
} else if (mappedChild != null) {
|
|
1228
|
-
if (isValidElement(mappedChild)) {
|
|
1229
|
-
mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
|
|
1230
|
-
// traverseAllChildren used to do for objects as children
|
|
1231
|
-
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
result.push(mappedChild);
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1239
|
-
var escapedPrefix = '';
|
|
1240
|
-
|
|
1241
|
-
if (prefix != null) {
|
|
1242
|
-
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1243
|
-
}
|
|
1244
|
-
|
|
1245
|
-
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
|
1246
|
-
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
|
1247
|
-
releaseTraverseContext(traverseContext);
|
|
1248
|
-
}
|
|
1249
1187
|
/**
|
|
1250
1188
|
* Maps children that are typically specified as `props.children`.
|
|
1251
1189
|
*
|
|
@@ -1259,15 +1197,16 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
|
1259
1197
|
* @param {*} context Context for mapFunction.
|
|
1260
1198
|
* @return {object} Object containing the ordered map of results.
|
|
1261
1199
|
*/
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
1200
|
function mapChildren(children, func, context) {
|
|
1265
1201
|
if (children == null) {
|
|
1266
1202
|
return children;
|
|
1267
1203
|
}
|
|
1268
1204
|
|
|
1269
1205
|
var result = [];
|
|
1270
|
-
|
|
1206
|
+
var count = 0;
|
|
1207
|
+
mapIntoArray(children, result, '', '', function (child) {
|
|
1208
|
+
return func.call(context, child, count++);
|
|
1209
|
+
});
|
|
1271
1210
|
return result;
|
|
1272
1211
|
}
|
|
1273
1212
|
/**
|
|
@@ -1282,9 +1221,29 @@ function mapChildren(children, func, context) {
|
|
|
1282
1221
|
|
|
1283
1222
|
|
|
1284
1223
|
function countChildren(children) {
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1224
|
+
var n = 0;
|
|
1225
|
+
mapChildren(children, function () {
|
|
1226
|
+
n++; // Don't return anything
|
|
1227
|
+
});
|
|
1228
|
+
return n;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1233
|
+
*
|
|
1234
|
+
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
|
|
1235
|
+
*
|
|
1236
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1237
|
+
* leaf child.
|
|
1238
|
+
*
|
|
1239
|
+
* @param {?*} children Children tree container.
|
|
1240
|
+
* @param {function(*, int)} forEachFunc
|
|
1241
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1242
|
+
*/
|
|
1243
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1244
|
+
mapChildren(children, function () {
|
|
1245
|
+
forEachFunc.apply(this, arguments); // Don't return anything.
|
|
1246
|
+
}, forEachContext);
|
|
1288
1247
|
}
|
|
1289
1248
|
/**
|
|
1290
1249
|
* Flatten a children object (typically specified as `props.children`) and
|
|
@@ -1295,11 +1254,9 @@ function countChildren(children) {
|
|
|
1295
1254
|
|
|
1296
1255
|
|
|
1297
1256
|
function toArray(children) {
|
|
1298
|
-
|
|
1299
|
-
mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
|
|
1257
|
+
return mapChildren(children, function (child) {
|
|
1300
1258
|
return child;
|
|
1301
|
-
});
|
|
1302
|
-
return result;
|
|
1259
|
+
}) || [];
|
|
1303
1260
|
}
|
|
1304
1261
|
/**
|
|
1305
1262
|
* Returns the first child in a collection of children and verifies that there
|
|
@@ -1427,9 +1384,9 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1427
1384
|
get: function () {
|
|
1428
1385
|
return context.displayName;
|
|
1429
1386
|
},
|
|
1430
|
-
set: function () {
|
|
1387
|
+
set: function (displayName) {
|
|
1431
1388
|
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
1432
|
-
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '
|
|
1389
|
+
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
1433
1390
|
|
|
1434
1391
|
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
1435
1392
|
}
|
|
@@ -1448,13 +1405,63 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
1448
1405
|
return context;
|
|
1449
1406
|
}
|
|
1450
1407
|
|
|
1408
|
+
var Uninitialized = -1;
|
|
1409
|
+
var Pending = 0;
|
|
1410
|
+
var Resolved = 1;
|
|
1411
|
+
var Rejected = 2;
|
|
1412
|
+
|
|
1413
|
+
function lazyInitializer(payload) {
|
|
1414
|
+
if (payload._status === Uninitialized) {
|
|
1415
|
+
var ctor = payload._result;
|
|
1416
|
+
var thenable = ctor(); // Transition to the next state.
|
|
1417
|
+
|
|
1418
|
+
var pending = payload;
|
|
1419
|
+
pending._status = Pending;
|
|
1420
|
+
pending._result = thenable;
|
|
1421
|
+
thenable.then(function (moduleObject) {
|
|
1422
|
+
if (payload._status === Pending) {
|
|
1423
|
+
var defaultExport = moduleObject.default;
|
|
1424
|
+
|
|
1425
|
+
{
|
|
1426
|
+
if (defaultExport === undefined) {
|
|
1427
|
+
error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
|
|
1428
|
+
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
|
|
1429
|
+
}
|
|
1430
|
+
} // Transition to the next state.
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
var resolved = payload;
|
|
1434
|
+
resolved._status = Resolved;
|
|
1435
|
+
resolved._result = defaultExport;
|
|
1436
|
+
}
|
|
1437
|
+
}, function (error) {
|
|
1438
|
+
if (payload._status === Pending) {
|
|
1439
|
+
// Transition to the next state.
|
|
1440
|
+
var rejected = payload;
|
|
1441
|
+
rejected._status = Rejected;
|
|
1442
|
+
rejected._result = error;
|
|
1443
|
+
}
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
if (payload._status === Resolved) {
|
|
1448
|
+
return payload._result;
|
|
1449
|
+
} else {
|
|
1450
|
+
throw payload._result;
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1451
1454
|
function lazy(ctor) {
|
|
1452
|
-
var
|
|
1453
|
-
|
|
1454
|
-
// React uses these fields to store the result.
|
|
1455
|
+
var payload = {
|
|
1456
|
+
// We use these fields to store the result.
|
|
1455
1457
|
_status: -1,
|
|
1456
1458
|
_result: ctor
|
|
1457
1459
|
};
|
|
1460
|
+
var lazyType = {
|
|
1461
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
1462
|
+
_payload: payload,
|
|
1463
|
+
_init: lazyInitializer
|
|
1464
|
+
};
|
|
1458
1465
|
|
|
1459
1466
|
{
|
|
1460
1467
|
// In production, this would just set it on the object.
|
|
@@ -1519,15 +1526,35 @@ function forwardRef(render) {
|
|
|
1519
1526
|
}
|
|
1520
1527
|
}
|
|
1521
1528
|
|
|
1522
|
-
|
|
1529
|
+
var elementType = {
|
|
1523
1530
|
$$typeof: REACT_FORWARD_REF_TYPE,
|
|
1524
1531
|
render: render
|
|
1525
1532
|
};
|
|
1533
|
+
|
|
1534
|
+
{
|
|
1535
|
+
var ownName;
|
|
1536
|
+
Object.defineProperty(elementType, 'displayName', {
|
|
1537
|
+
enumerable: false,
|
|
1538
|
+
configurable: true,
|
|
1539
|
+
get: function () {
|
|
1540
|
+
return ownName;
|
|
1541
|
+
},
|
|
1542
|
+
set: function (name) {
|
|
1543
|
+
ownName = name;
|
|
1544
|
+
|
|
1545
|
+
if (render.displayName == null) {
|
|
1546
|
+
render.displayName = name;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
return elementType;
|
|
1526
1553
|
}
|
|
1527
1554
|
|
|
1528
1555
|
function isValidElementType(type) {
|
|
1529
1556
|
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1530
|
-
type ===
|
|
1557
|
+
type === exports.Fragment || type === exports.Profiler || type === exports.StrictMode || type === exports.Suspense || type === exports.SuspenseList || 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 || type[0] === REACT_SERVER_BLOCK_TYPE);
|
|
1531
1558
|
}
|
|
1532
1559
|
|
|
1533
1560
|
function memo(type, compare) {
|
|
@@ -1537,17 +1564,45 @@ function memo(type, compare) {
|
|
|
1537
1564
|
}
|
|
1538
1565
|
}
|
|
1539
1566
|
|
|
1540
|
-
|
|
1567
|
+
var elementType = {
|
|
1541
1568
|
$$typeof: REACT_MEMO_TYPE,
|
|
1542
1569
|
type: type,
|
|
1543
1570
|
compare: compare === undefined ? null : compare
|
|
1544
1571
|
};
|
|
1572
|
+
|
|
1573
|
+
{
|
|
1574
|
+
var ownName;
|
|
1575
|
+
Object.defineProperty(elementType, 'displayName', {
|
|
1576
|
+
enumerable: false,
|
|
1577
|
+
configurable: true,
|
|
1578
|
+
get: function () {
|
|
1579
|
+
return ownName;
|
|
1580
|
+
},
|
|
1581
|
+
set: function (name) {
|
|
1582
|
+
ownName = name;
|
|
1583
|
+
|
|
1584
|
+
if (type.displayName == null) {
|
|
1585
|
+
type.displayName = name;
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
return elementType;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
function lazyInitializer$1(payload) {
|
|
1595
|
+
return {
|
|
1596
|
+
$$typeof: REACT_BLOCK_TYPE,
|
|
1597
|
+
_data: payload.load.apply(null, payload.args),
|
|
1598
|
+
_render: payload.render
|
|
1599
|
+
};
|
|
1545
1600
|
}
|
|
1546
1601
|
|
|
1547
|
-
function block(
|
|
1602
|
+
function block(render, load) {
|
|
1548
1603
|
{
|
|
1549
|
-
if (typeof
|
|
1550
|
-
error('Blocks require a
|
|
1604
|
+
if (load !== undefined && typeof load !== 'function') {
|
|
1605
|
+
error('Blocks require a load function, if provided, but was given %s.', load === null ? 'null' : typeof load);
|
|
1551
1606
|
}
|
|
1552
1607
|
|
|
1553
1608
|
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
@@ -1558,7 +1613,7 @@ function block(query, render) {
|
|
|
1558
1613
|
error('Blocks require a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
1559
1614
|
} else if (render.length !== 0 && render.length !== 2) {
|
|
1560
1615
|
// Warn if it's not accepting two args.
|
|
1561
|
-
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
|
|
1616
|
+
// Do not warn for 0 arguments because it could be due to usage of the 'arguments' object.
|
|
1562
1617
|
error('Block render functions accept exactly two parameters: props and data. %s', render.length === 1 ? 'Did you forget to use the data parameter?' : 'Any additional parameter will be undefined.');
|
|
1563
1618
|
}
|
|
1564
1619
|
|
|
@@ -1567,15 +1622,35 @@ function block(query, render) {
|
|
|
1567
1622
|
}
|
|
1568
1623
|
}
|
|
1569
1624
|
|
|
1625
|
+
if (load === undefined) {
|
|
1626
|
+
return function () {
|
|
1627
|
+
var blockComponent = {
|
|
1628
|
+
$$typeof: REACT_BLOCK_TYPE,
|
|
1629
|
+
_data: undefined,
|
|
1630
|
+
// $FlowFixMe: Data must be void in this scenario.
|
|
1631
|
+
_render: render
|
|
1632
|
+
}; // $FlowFixMe: Upstream BlockComponent to Flow as a valid Node.
|
|
1633
|
+
|
|
1634
|
+
return blockComponent;
|
|
1635
|
+
};
|
|
1636
|
+
} // Trick to let Flow refine this.
|
|
1637
|
+
|
|
1638
|
+
|
|
1639
|
+
var loadFn = load;
|
|
1570
1640
|
return function () {
|
|
1571
1641
|
var args = arguments;
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
return query.apply(null, args);
|
|
1576
|
-
},
|
|
1642
|
+
var payload = {
|
|
1643
|
+
load: loadFn,
|
|
1644
|
+
args: args,
|
|
1577
1645
|
render: render
|
|
1578
1646
|
};
|
|
1647
|
+
var lazyType = {
|
|
1648
|
+
$$typeof: REACT_LAZY_TYPE,
|
|
1649
|
+
_payload: payload,
|
|
1650
|
+
_init: lazyInitializer$1
|
|
1651
|
+
}; // $FlowFixMe: Upstream BlockComponent to Flow as a valid Node.
|
|
1652
|
+
|
|
1653
|
+
return lazyType;
|
|
1579
1654
|
};
|
|
1580
1655
|
}
|
|
1581
1656
|
|
|
@@ -1660,6 +1735,14 @@ function useDeferredValue(value, config) {
|
|
|
1660
1735
|
var dispatcher = resolveDispatcher();
|
|
1661
1736
|
return dispatcher.useDeferredValue(value, config);
|
|
1662
1737
|
}
|
|
1738
|
+
function useOpaqueIdentifier() {
|
|
1739
|
+
var dispatcher = resolveDispatcher();
|
|
1740
|
+
return dispatcher.useOpaqueIdentifier();
|
|
1741
|
+
}
|
|
1742
|
+
function useMutableSource(source, getSnapshot, subscribe) {
|
|
1743
|
+
var dispatcher = resolveDispatcher();
|
|
1744
|
+
return dispatcher.useMutableSource(source, getSnapshot, subscribe);
|
|
1745
|
+
}
|
|
1663
1746
|
|
|
1664
1747
|
function withSuspenseConfig(scope, config) {
|
|
1665
1748
|
var previousConfig = ReactCurrentBatchConfig.suspense;
|
|
@@ -1935,98 +2018,6 @@ function validateFragmentProps(fragment) {
|
|
|
1935
2018
|
setCurrentlyValidatingElement(null);
|
|
1936
2019
|
}
|
|
1937
2020
|
}
|
|
1938
|
-
|
|
1939
|
-
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1940
|
-
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1941
|
-
// succeed and there will likely be errors in render.
|
|
1942
|
-
|
|
1943
|
-
if (!validType) {
|
|
1944
|
-
var info = '';
|
|
1945
|
-
|
|
1946
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1947
|
-
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.";
|
|
1948
|
-
}
|
|
1949
|
-
|
|
1950
|
-
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1951
|
-
|
|
1952
|
-
if (sourceInfo) {
|
|
1953
|
-
info += sourceInfo;
|
|
1954
|
-
} else {
|
|
1955
|
-
info += getDeclarationErrorAddendum();
|
|
1956
|
-
}
|
|
1957
|
-
|
|
1958
|
-
var typeString;
|
|
1959
|
-
|
|
1960
|
-
if (type === null) {
|
|
1961
|
-
typeString = 'null';
|
|
1962
|
-
} else if (Array.isArray(type)) {
|
|
1963
|
-
typeString = 'array';
|
|
1964
|
-
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1965
|
-
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
|
|
1966
|
-
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1967
|
-
} else {
|
|
1968
|
-
typeString = typeof type;
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
{
|
|
1972
|
-
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
|
|
1976
|
-
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1977
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1978
|
-
|
|
1979
|
-
if (element == null) {
|
|
1980
|
-
return element;
|
|
1981
|
-
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1982
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1983
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
1984
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1985
|
-
// fixed, the key warnings will appear.)
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
if (validType) {
|
|
1989
|
-
var children = props.children;
|
|
1990
|
-
|
|
1991
|
-
if (children !== undefined) {
|
|
1992
|
-
if (isStaticChildren) {
|
|
1993
|
-
if (Array.isArray(children)) {
|
|
1994
|
-
for (var i = 0; i < children.length; i++) {
|
|
1995
|
-
validateChildKeys(children[i], type);
|
|
1996
|
-
}
|
|
1997
|
-
|
|
1998
|
-
if (Object.freeze) {
|
|
1999
|
-
Object.freeze(children);
|
|
2000
|
-
}
|
|
2001
|
-
} else {
|
|
2002
|
-
{
|
|
2003
|
-
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
2006
|
-
} else {
|
|
2007
|
-
validateChildKeys(children, type);
|
|
2008
|
-
}
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
if (type === REACT_FRAGMENT_TYPE) {
|
|
2013
|
-
validateFragmentProps(element);
|
|
2014
|
-
} else {
|
|
2015
|
-
validatePropTypes(element);
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
return element;
|
|
2019
|
-
} // These two functions exist to still get child warnings in dev
|
|
2020
|
-
// even with the prod transform. This means that jsxDEV is purely
|
|
2021
|
-
// opt-in behavior for better messages but that we won't stop
|
|
2022
|
-
// giving you warnings if you use production apis.
|
|
2023
|
-
|
|
2024
|
-
function jsxWithValidationStatic(type, props, key) {
|
|
2025
|
-
return jsxWithValidation(type, props, key, true);
|
|
2026
|
-
}
|
|
2027
|
-
function jsxWithValidationDynamic(type, props, key) {
|
|
2028
|
-
return jsxWithValidation(type, props, key, false);
|
|
2029
|
-
}
|
|
2030
2021
|
function createElementWithValidation(type, props, children) {
|
|
2031
2022
|
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
2032
2023
|
// succeed and there will likely be errors in render.
|
|
@@ -2082,7 +2073,7 @@ function createElementWithValidation(type, props, children) {
|
|
|
2082
2073
|
}
|
|
2083
2074
|
}
|
|
2084
2075
|
|
|
2085
|
-
if (type ===
|
|
2076
|
+
if (type === exports.Fragment) {
|
|
2086
2077
|
validateFragmentProps(element);
|
|
2087
2078
|
} else {
|
|
2088
2079
|
validatePropTypes(element);
|
|
@@ -2129,17 +2120,31 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
2129
2120
|
return newElement;
|
|
2130
2121
|
}
|
|
2131
2122
|
|
|
2123
|
+
function createMutableSource(source, getVersion) {
|
|
2124
|
+
var mutableSource = {
|
|
2125
|
+
_getVersion: getVersion,
|
|
2126
|
+
_source: source,
|
|
2127
|
+
_workInProgressVersionPrimary: null,
|
|
2128
|
+
_workInProgressVersionSecondary: null
|
|
2129
|
+
};
|
|
2130
|
+
|
|
2131
|
+
{
|
|
2132
|
+
mutableSource._currentPrimaryRenderer = null;
|
|
2133
|
+
mutableSource._currentSecondaryRenderer = null;
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
return mutableSource;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2132
2139
|
{
|
|
2133
2140
|
|
|
2134
2141
|
try {
|
|
2135
2142
|
var frozenObject = Object.freeze({});
|
|
2136
|
-
|
|
2137
|
-
var testSet = new Set([frozenObject]); // This is necessary for Rollup to not consider these unused.
|
|
2138
|
-
// https://github.com/rollup/rollup/issues/1771
|
|
2139
|
-
// TODO: we can remove these if Rollup fixes the bug.
|
|
2143
|
+
/* eslint-disable no-new */
|
|
2140
2144
|
|
|
2141
|
-
|
|
2142
|
-
|
|
2145
|
+
new Map([[frozenObject, null]]);
|
|
2146
|
+
new Set([frozenObject]);
|
|
2147
|
+
/* eslint-enable no-new */
|
|
2143
2148
|
} catch (e) {
|
|
2144
2149
|
}
|
|
2145
2150
|
}
|
|
@@ -2147,11 +2152,6 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
2147
2152
|
var createElement$1 = createElementWithValidation ;
|
|
2148
2153
|
var cloneElement$1 = cloneElementWithValidation ;
|
|
2149
2154
|
var createFactory = createFactoryWithValidation ;
|
|
2150
|
-
var jsxDEV$1 = jsxWithValidation ;
|
|
2151
|
-
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
2152
|
-
// for now we can ship identical prod functions
|
|
2153
|
-
|
|
2154
|
-
var jsxs = jsxWithValidationStatic ;
|
|
2155
2155
|
var Children = {
|
|
2156
2156
|
map: mapChildren,
|
|
2157
2157
|
forEach: forEachChildren,
|
|
@@ -2162,26 +2162,20 @@ var Children = {
|
|
|
2162
2162
|
|
|
2163
2163
|
exports.Children = Children;
|
|
2164
2164
|
exports.Component = Component;
|
|
2165
|
-
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
2166
|
-
exports.Profiler = REACT_PROFILER_TYPE;
|
|
2167
2165
|
exports.PureComponent = PureComponent;
|
|
2168
|
-
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2169
|
-
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
2170
|
-
exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
2171
2166
|
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
2172
2167
|
exports.block = block;
|
|
2173
2168
|
exports.cloneElement = cloneElement$1;
|
|
2174
2169
|
exports.createContext = createContext;
|
|
2175
2170
|
exports.createElement = createElement$1;
|
|
2176
2171
|
exports.createFactory = createFactory;
|
|
2172
|
+
exports.createMutableSource = createMutableSource;
|
|
2177
2173
|
exports.createRef = createRef;
|
|
2178
2174
|
exports.forwardRef = forwardRef;
|
|
2179
2175
|
exports.isValidElement = isValidElement;
|
|
2180
|
-
exports.jsx = jsx;
|
|
2181
|
-
exports.jsxDEV = jsxDEV$1;
|
|
2182
|
-
exports.jsxs = jsxs;
|
|
2183
2176
|
exports.lazy = lazy;
|
|
2184
2177
|
exports.memo = memo;
|
|
2178
|
+
exports.unstable_useOpaqueIdentifier = useOpaqueIdentifier;
|
|
2185
2179
|
exports.unstable_withSuspenseConfig = withSuspenseConfig;
|
|
2186
2180
|
exports.useCallback = useCallback;
|
|
2187
2181
|
exports.useContext = useContext;
|
|
@@ -2191,6 +2185,7 @@ exports.useEffect = useEffect;
|
|
|
2191
2185
|
exports.useImperativeHandle = useImperativeHandle;
|
|
2192
2186
|
exports.useLayoutEffect = useLayoutEffect;
|
|
2193
2187
|
exports.useMemo = useMemo;
|
|
2188
|
+
exports.useMutableSource = useMutableSource;
|
|
2194
2189
|
exports.useReducer = useReducer;
|
|
2195
2190
|
exports.useRef = useRef;
|
|
2196
2191
|
exports.useState = useState;
|