1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';
|
11 |
|
12 |
|
13 |
|
14 | if (process.env.NODE_ENV !== "production") {
|
15 | (function() {
|
16 | 'use strict';
|
17 |
|
18 | var _assign = require('object-assign');
|
19 | var invariant = require('fbjs/lib/invariant');
|
20 | var React = require('react');
|
21 | var emptyFunction = require('fbjs/lib/emptyFunction');
|
22 | var emptyObject = require('fbjs/lib/emptyObject');
|
23 | var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
|
24 | var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
|
25 | var warning = require('fbjs/lib/warning');
|
26 | var checkPropTypes = require('prop-types/checkPropTypes');
|
27 | var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
|
28 | var stream = require('stream');
|
29 |
|
30 |
|
31 |
|
32 | var ReactVersion = '16.4.0';
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | var lowPriorityWarning = function () {};
|
52 |
|
53 | {
|
54 | var printWarning = function (format) {
|
55 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
56 | args[_key - 1] = arguments[_key];
|
57 | }
|
58 |
|
59 | var argIndex = 0;
|
60 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
61 | return args[argIndex++];
|
62 | });
|
63 | if (typeof console !== 'undefined') {
|
64 | console.warn(message);
|
65 | }
|
66 | try {
|
67 |
|
68 |
|
69 |
|
70 | throw new Error(message);
|
71 | } catch (x) {}
|
72 | };
|
73 |
|
74 | lowPriorityWarning = function (condition, format) {
|
75 | if (format === undefined) {
|
76 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
77 | }
|
78 | if (!condition) {
|
79 | for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
80 | args[_key2 - 2] = arguments[_key2];
|
81 | }
|
82 |
|
83 | printWarning.apply(undefined, [format].concat(args));
|
84 | }
|
85 | };
|
86 | }
|
87 |
|
88 | var lowPriorityWarning$1 = lowPriorityWarning;
|
89 |
|
90 | var describeComponentFrame = function (name, source, ownerName) {
|
91 | return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
92 | };
|
93 |
|
94 | var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
95 |
|
96 | var ReactCurrentOwner = ReactInternals.ReactCurrentOwner;
|
97 | var ReactDebugCurrentFrame = ReactInternals.ReactDebugCurrentFrame;
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 | var warnAboutDeprecatedLifecycles = false;
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 | var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
137 |
|
138 |
|
139 | var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
140 | var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
141 | var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
142 | var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
143 | var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
144 | var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
145 | var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
146 | var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
147 |
|
148 |
|
149 |
|
150 | var RESERVED = 0;
|
151 |
|
152 |
|
153 |
|
154 | var STRING = 1;
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 | var BOOLEANISH_STRING = 2;
|
161 |
|
162 |
|
163 |
|
164 |
|
165 | var BOOLEAN = 3;
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | var OVERLOADED_BOOLEAN = 4;
|
172 |
|
173 |
|
174 |
|
175 | var NUMERIC = 5;
|
176 |
|
177 |
|
178 |
|
179 | var POSITIVE_NUMERIC = 6;
|
180 |
|
181 |
|
182 | var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
|
183 |
|
184 | var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
|
185 |
|
186 |
|
187 | var ROOT_ATTRIBUTE_NAME = 'data-reactroot';
|
188 | var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
189 |
|
190 | var illegalAttributeNameCache = {};
|
191 | var validatedAttributeNameCache = {};
|
192 |
|
193 | function isAttributeNameSafe(attributeName) {
|
194 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
|
195 | return true;
|
196 | }
|
197 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
|
198 | return false;
|
199 | }
|
200 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
201 | validatedAttributeNameCache[attributeName] = true;
|
202 | return true;
|
203 | }
|
204 | illegalAttributeNameCache[attributeName] = true;
|
205 | {
|
206 | warning(false, 'Invalid attribute name: `%s`', attributeName);
|
207 | }
|
208 | return false;
|
209 | }
|
210 |
|
211 | function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
|
212 | if (propertyInfo !== null) {
|
213 | return propertyInfo.type === RESERVED;
|
214 | }
|
215 | if (isCustomComponentTag) {
|
216 | return false;
|
217 | }
|
218 | if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) {
|
219 | return true;
|
220 | }
|
221 | return false;
|
222 | }
|
223 |
|
224 | function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
225 | if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
226 | return false;
|
227 | }
|
228 | switch (typeof value) {
|
229 | case 'function':
|
230 |
|
231 | case 'symbol':
|
232 |
|
233 | return true;
|
234 | case 'boolean':
|
235 | {
|
236 | if (isCustomComponentTag) {
|
237 | return false;
|
238 | }
|
239 | if (propertyInfo !== null) {
|
240 | return !propertyInfo.acceptsBooleans;
|
241 | } else {
|
242 | var prefix = name.toLowerCase().slice(0, 5);
|
243 | return prefix !== 'data-' && prefix !== 'aria-';
|
244 | }
|
245 | }
|
246 | default:
|
247 | return false;
|
248 | }
|
249 | }
|
250 |
|
251 | function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
|
252 | if (value === null || typeof value === 'undefined') {
|
253 | return true;
|
254 | }
|
255 | if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
256 | return true;
|
257 | }
|
258 | if (isCustomComponentTag) {
|
259 | return false;
|
260 | }
|
261 | if (propertyInfo !== null) {
|
262 | switch (propertyInfo.type) {
|
263 | case BOOLEAN:
|
264 | return !value;
|
265 | case OVERLOADED_BOOLEAN:
|
266 | return value === false;
|
267 | case NUMERIC:
|
268 | return isNaN(value);
|
269 | case POSITIVE_NUMERIC:
|
270 | return isNaN(value) || value < 1;
|
271 | }
|
272 | }
|
273 | return false;
|
274 | }
|
275 |
|
276 | function getPropertyInfo(name) {
|
277 | return properties.hasOwnProperty(name) ? properties[name] : null;
|
278 | }
|
279 |
|
280 | function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace) {
|
281 | this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
282 | this.attributeName = attributeName;
|
283 | this.attributeNamespace = attributeNamespace;
|
284 | this.mustUseProperty = mustUseProperty;
|
285 | this.propertyName = name;
|
286 | this.type = type;
|
287 | }
|
288 |
|
289 |
|
290 |
|
291 |
|
292 | var properties = {};
|
293 |
|
294 |
|
295 | ['children', 'dangerouslySetInnerHTML',
|
296 |
|
297 |
|
298 |
|
299 | 'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style'].forEach(function (name) {
|
300 | properties[name] = new PropertyInfoRecord(name, RESERVED, false,
|
301 | name,
|
302 | null);
|
303 | }
|
304 | );
|
305 |
|
306 |
|
307 |
|
308 | [['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) {
|
309 | var name = _ref[0],
|
310 | attributeName = _ref[1];
|
311 |
|
312 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
313 | attributeName,
|
314 | null);
|
315 | }
|
316 | );
|
317 |
|
318 |
|
319 |
|
320 |
|
321 | ['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) {
|
322 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
323 | name.toLowerCase(),
|
324 | null);
|
325 | }
|
326 | );
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 | ['autoReverse', 'externalResourcesRequired', 'preserveAlpha'].forEach(function (name) {
|
333 | properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false,
|
334 | name,
|
335 | null);
|
336 | }
|
337 | );
|
338 |
|
339 |
|
340 | ['allowFullScreen', 'async',
|
341 |
|
342 |
|
343 | 'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless',
|
344 |
|
345 | 'itemScope'].forEach(function (name) {
|
346 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, false,
|
347 | name.toLowerCase(),
|
348 | null);
|
349 | }
|
350 | );
|
351 |
|
352 |
|
353 |
|
354 | ['checked',
|
355 |
|
356 |
|
357 | 'multiple', 'muted', 'selected'].forEach(function (name) {
|
358 | properties[name] = new PropertyInfoRecord(name, BOOLEAN, true,
|
359 | name.toLowerCase(),
|
360 | null);
|
361 | }
|
362 | );
|
363 |
|
364 |
|
365 |
|
366 | ['capture', 'download'].forEach(function (name) {
|
367 | properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false,
|
368 | name.toLowerCase(),
|
369 | null);
|
370 | }
|
371 | );
|
372 |
|
373 |
|
374 | ['cols', 'rows', 'size', 'span'].forEach(function (name) {
|
375 | properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false,
|
376 | name.toLowerCase(),
|
377 | null);
|
378 | }
|
379 | );
|
380 |
|
381 |
|
382 | ['rowSpan', 'start'].forEach(function (name) {
|
383 | properties[name] = new PropertyInfoRecord(name, NUMERIC, false,
|
384 | name.toLowerCase(),
|
385 | null);
|
386 | }
|
387 | );
|
388 |
|
389 | var CAMELIZE = /[\-\:]([a-z])/g;
|
390 | var capitalize = function (token) {
|
391 | return token[1].toUpperCase();
|
392 | };
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 | ['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height'].forEach(function (attributeName) {
|
400 | var name = attributeName.replace(CAMELIZE, capitalize);
|
401 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
402 | attributeName, null);
|
403 | }
|
404 | );
|
405 |
|
406 |
|
407 | ['xlink:actuate', 'xlink:arcrole', 'xlink:href', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type'].forEach(function (attributeName) {
|
408 | var name = attributeName.replace(CAMELIZE, capitalize);
|
409 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
410 | attributeName, 'http://www.w3.org/1999/xlink');
|
411 | });
|
412 |
|
413 |
|
414 | ['xml:base', 'xml:lang', 'xml:space'].forEach(function (attributeName) {
|
415 | var name = attributeName.replace(CAMELIZE, capitalize);
|
416 | properties[name] = new PropertyInfoRecord(name, STRING, false,
|
417 | attributeName, 'http://www.w3.org/XML/1998/namespace');
|
418 | });
|
419 |
|
420 |
|
421 |
|
422 |
|
423 | properties.tabIndex = new PropertyInfoRecord('tabIndex', STRING, false,
|
424 | 'tabindex',
|
425 | null);
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 | var matchHtmlRegExp = /["'&<>]/;
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 | function escapeHtml(string) {
|
444 | var str = '' + string;
|
445 | var match = matchHtmlRegExp.exec(str);
|
446 |
|
447 | if (!match) {
|
448 | return str;
|
449 | }
|
450 |
|
451 | var escape = void 0;
|
452 | var html = '';
|
453 | var index = 0;
|
454 | var lastIndex = 0;
|
455 |
|
456 | for (index = match.index; index < str.length; index++) {
|
457 | switch (str.charCodeAt(index)) {
|
458 | case 34:
|
459 |
|
460 | escape = '"';
|
461 | break;
|
462 | case 38:
|
463 |
|
464 | escape = '&';
|
465 | break;
|
466 | case 39:
|
467 |
|
468 | escape = ''';
|
469 | break;
|
470 | case 60:
|
471 |
|
472 | escape = '<';
|
473 | break;
|
474 | case 62:
|
475 |
|
476 | escape = '>';
|
477 | break;
|
478 | default:
|
479 | continue;
|
480 | }
|
481 |
|
482 | if (lastIndex !== index) {
|
483 | html += str.substring(lastIndex, index);
|
484 | }
|
485 |
|
486 | lastIndex = index + 1;
|
487 | html += escape;
|
488 | }
|
489 |
|
490 | return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
491 | }
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 | function escapeTextForBrowser(text) {
|
501 | if (typeof text === 'boolean' || typeof text === 'number') {
|
502 |
|
503 |
|
504 |
|
505 | return '' + text;
|
506 | }
|
507 | return escapeHtml(text);
|
508 | }
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 | function quoteAttributeValueForBrowser(value) {
|
517 | return '"' + escapeTextForBrowser(value) + '"';
|
518 | }
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 | function createMarkupForRoot() {
|
533 | return ROOT_ATTRIBUTE_NAME + '=""';
|
534 | }
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 | function createMarkupForProperty(name, value) {
|
544 | var propertyInfo = getPropertyInfo(name);
|
545 | if (name !== 'style' && shouldIgnoreAttribute(name, propertyInfo, false)) {
|
546 | return '';
|
547 | }
|
548 | if (shouldRemoveAttribute(name, value, propertyInfo, false)) {
|
549 | return '';
|
550 | }
|
551 | if (propertyInfo !== null) {
|
552 | var attributeName = propertyInfo.attributeName;
|
553 | var type = propertyInfo.type;
|
554 |
|
555 | if (type === BOOLEAN || type === OVERLOADED_BOOLEAN && value === true) {
|
556 | return attributeName + '=""';
|
557 | } else {
|
558 | return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
559 | }
|
560 | } else {
|
561 | return name + '=' + quoteAttributeValueForBrowser(value);
|
562 | }
|
563 | }
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | function createMarkupForCustomAttribute(name, value) {
|
573 | if (!isAttributeNameSafe(name) || value == null) {
|
574 | return '';
|
575 | }
|
576 | return name + '=' + quoteAttributeValueForBrowser(value);
|
577 | }
|
578 |
|
579 | var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
580 | var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
581 | var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
582 |
|
583 | var Namespaces = {
|
584 | html: HTML_NAMESPACE,
|
585 | mathml: MATH_NAMESPACE,
|
586 | svg: SVG_NAMESPACE
|
587 | };
|
588 |
|
589 |
|
590 | function getIntrinsicNamespace(type) {
|
591 | switch (type) {
|
592 | case 'svg':
|
593 | return SVG_NAMESPACE;
|
594 | case 'math':
|
595 | return MATH_NAMESPACE;
|
596 | default:
|
597 | return HTML_NAMESPACE;
|
598 | }
|
599 | }
|
600 |
|
601 | function getChildNamespace(parentNamespace, type) {
|
602 | if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
|
603 |
|
604 | return getIntrinsicNamespace(type);
|
605 | }
|
606 | if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
|
607 |
|
608 | return HTML_NAMESPACE;
|
609 | }
|
610 |
|
611 | return parentNamespace;
|
612 | }
|
613 |
|
614 | var ReactControlledValuePropTypes = {
|
615 | checkPropTypes: null
|
616 | };
|
617 |
|
618 | {
|
619 | var hasReadOnlyValue = {
|
620 | button: true,
|
621 | checkbox: true,
|
622 | image: true,
|
623 | hidden: true,
|
624 | radio: true,
|
625 | reset: true,
|
626 | submit: true
|
627 | };
|
628 |
|
629 | var propTypes = {
|
630 | value: function (props, propName, componentName) {
|
631 | if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
|
632 | return null;
|
633 | }
|
634 | return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
635 | },
|
636 | checked: function (props, propName, componentName) {
|
637 | if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
|
638 | return null;
|
639 | }
|
640 | return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
641 | }
|
642 | };
|
643 |
|
644 | |
645 |
|
646 |
|
647 |
|
648 | ReactControlledValuePropTypes.checkPropTypes = function (tagName, props, getStack) {
|
649 | checkPropTypes(propTypes, props, 'prop', tagName, getStack);
|
650 | };
|
651 | }
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | var omittedCloseTags = {
|
657 | area: true,
|
658 | base: true,
|
659 | br: true,
|
660 | col: true,
|
661 | embed: true,
|
662 | hr: true,
|
663 | img: true,
|
664 | input: true,
|
665 | keygen: true,
|
666 | link: true,
|
667 | meta: true,
|
668 | param: true,
|
669 | source: true,
|
670 | track: true,
|
671 | wbr: true
|
672 |
|
673 | };
|
674 |
|
675 |
|
676 |
|
677 |
|
678 | var voidElementTags = _assign({
|
679 | menuitem: true
|
680 | }, omittedCloseTags);
|
681 |
|
682 | var HTML = '__html';
|
683 |
|
684 | function assertValidProps(tag, props, getStack) {
|
685 | if (!props) {
|
686 | return;
|
687 | }
|
688 |
|
689 | if (voidElementTags[tag]) {
|
690 | !(props.children == null && props.dangerouslySetInnerHTML == null) ? invariant(false, '%s is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.%s', tag, getStack()) : void 0;
|
691 | }
|
692 | if (props.dangerouslySetInnerHTML != null) {
|
693 | !(props.children == null) ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : void 0;
|
694 | !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://fb.me/react-invariant-dangerously-set-inner-html for more information.') : void 0;
|
695 | }
|
696 | {
|
697 | !(props.suppressContentEditableWarning || !props.contentEditable || props.children == null) ? warning(false, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.%s', getStack()) : void 0;
|
698 | }
|
699 | !(props.style == null || typeof props.style === 'object') ? invariant(false, 'The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + \'em\'}} when using JSX.%s', getStack()) : void 0;
|
700 | }
|
701 |
|
702 |
|
703 |
|
704 |
|
705 | var isUnitlessNumber = {
|
706 | animationIterationCount: true,
|
707 | borderImageOutset: true,
|
708 | borderImageSlice: true,
|
709 | borderImageWidth: true,
|
710 | boxFlex: true,
|
711 | boxFlexGroup: true,
|
712 | boxOrdinalGroup: true,
|
713 | columnCount: true,
|
714 | columns: true,
|
715 | flex: true,
|
716 | flexGrow: true,
|
717 | flexPositive: true,
|
718 | flexShrink: true,
|
719 | flexNegative: true,
|
720 | flexOrder: true,
|
721 | gridRow: true,
|
722 | gridRowEnd: true,
|
723 | gridRowSpan: true,
|
724 | gridRowStart: true,
|
725 | gridColumn: true,
|
726 | gridColumnEnd: true,
|
727 | gridColumnSpan: true,
|
728 | gridColumnStart: true,
|
729 | fontWeight: true,
|
730 | lineClamp: true,
|
731 | lineHeight: true,
|
732 | opacity: true,
|
733 | order: true,
|
734 | orphans: true,
|
735 | tabSize: true,
|
736 | widows: true,
|
737 | zIndex: true,
|
738 | zoom: true,
|
739 |
|
740 |
|
741 | fillOpacity: true,
|
742 | floodOpacity: true,
|
743 | stopOpacity: true,
|
744 | strokeDasharray: true,
|
745 | strokeDashoffset: true,
|
746 | strokeMiterlimit: true,
|
747 | strokeOpacity: true,
|
748 | strokeWidth: true
|
749 | };
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 | function prefixKey(prefix, key) {
|
758 | return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
759 | }
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 | var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
766 |
|
767 |
|
768 |
|
769 | Object.keys(isUnitlessNumber).forEach(function (prop) {
|
770 | prefixes.forEach(function (prefix) {
|
771 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
772 | });
|
773 | });
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 | function dangerousStyleValue(name, value, isCustomProperty) {
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 | var isEmpty = value == null || typeof value === 'boolean' || value === '';
|
796 | if (isEmpty) {
|
797 | return '';
|
798 | }
|
799 |
|
800 | if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
|
801 | return value + 'px';
|
802 | }
|
803 |
|
804 | return ('' + value).trim();
|
805 | }
|
806 |
|
807 | function isCustomComponent(tagName, props) {
|
808 | if (tagName.indexOf('-') === -1) {
|
809 | return typeof props.is === 'string';
|
810 | }
|
811 | switch (tagName) {
|
812 |
|
813 |
|
814 |
|
815 |
|
816 | case 'annotation-xml':
|
817 | case 'color-profile':
|
818 | case 'font-face':
|
819 | case 'font-face-src':
|
820 | case 'font-face-uri':
|
821 | case 'font-face-format':
|
822 | case 'font-face-name':
|
823 | case 'missing-glyph':
|
824 | return false;
|
825 | default:
|
826 | return true;
|
827 | }
|
828 | }
|
829 |
|
830 | var warnValidStyle = emptyFunction;
|
831 |
|
832 | {
|
833 |
|
834 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
835 |
|
836 |
|
837 | var badStyleValueWithSemicolonPattern = /;\s*$/;
|
838 |
|
839 | var warnedStyleNames = {};
|
840 | var warnedStyleValues = {};
|
841 | var warnedForNaNValue = false;
|
842 | var warnedForInfinityValue = false;
|
843 |
|
844 | var warnHyphenatedStyleName = function (name, getStack) {
|
845 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
846 | return;
|
847 | }
|
848 |
|
849 | warnedStyleNames[name] = true;
|
850 | warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), getStack());
|
851 | };
|
852 |
|
853 | var warnBadVendoredStyleName = function (name, getStack) {
|
854 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
855 | return;
|
856 | }
|
857 |
|
858 | warnedStyleNames[name] = true;
|
859 | warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), getStack());
|
860 | };
|
861 |
|
862 | var warnStyleValueWithSemicolon = function (name, value, getStack) {
|
863 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
864 | return;
|
865 | }
|
866 |
|
867 | warnedStyleValues[value] = true;
|
868 | warning(false, "Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.%s', name, value.replace(badStyleValueWithSemicolonPattern, ''), getStack());
|
869 | };
|
870 |
|
871 | var warnStyleValueIsNaN = function (name, value, getStack) {
|
872 | if (warnedForNaNValue) {
|
873 | return;
|
874 | }
|
875 |
|
876 | warnedForNaNValue = true;
|
877 | warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, getStack());
|
878 | };
|
879 |
|
880 | var warnStyleValueIsInfinity = function (name, value, getStack) {
|
881 | if (warnedForInfinityValue) {
|
882 | return;
|
883 | }
|
884 |
|
885 | warnedForInfinityValue = true;
|
886 | warning(false, '`Infinity` is an invalid value for the `%s` css style property.%s', name, getStack());
|
887 | };
|
888 |
|
889 | warnValidStyle = function (name, value, getStack) {
|
890 | if (name.indexOf('-') > -1) {
|
891 | warnHyphenatedStyleName(name, getStack);
|
892 | } else if (badVendoredStyleNamePattern.test(name)) {
|
893 | warnBadVendoredStyleName(name, getStack);
|
894 | } else if (badStyleValueWithSemicolonPattern.test(value)) {
|
895 | warnStyleValueWithSemicolon(name, value, getStack);
|
896 | }
|
897 |
|
898 | if (typeof value === 'number') {
|
899 | if (isNaN(value)) {
|
900 | warnStyleValueIsNaN(name, value, getStack);
|
901 | } else if (!isFinite(value)) {
|
902 | warnStyleValueIsInfinity(name, value, getStack);
|
903 | }
|
904 | }
|
905 | };
|
906 | }
|
907 |
|
908 | var warnValidStyle$1 = warnValidStyle;
|
909 |
|
910 | var ariaProperties = {
|
911 | 'aria-current': 0,
|
912 | 'aria-details': 0,
|
913 | 'aria-disabled': 0,
|
914 | 'aria-hidden': 0,
|
915 | 'aria-invalid': 0,
|
916 | 'aria-keyshortcuts': 0,
|
917 | 'aria-label': 0,
|
918 | 'aria-roledescription': 0,
|
919 |
|
920 | 'aria-autocomplete': 0,
|
921 | 'aria-checked': 0,
|
922 | 'aria-expanded': 0,
|
923 | 'aria-haspopup': 0,
|
924 | 'aria-level': 0,
|
925 | 'aria-modal': 0,
|
926 | 'aria-multiline': 0,
|
927 | 'aria-multiselectable': 0,
|
928 | 'aria-orientation': 0,
|
929 | 'aria-placeholder': 0,
|
930 | 'aria-pressed': 0,
|
931 | 'aria-readonly': 0,
|
932 | 'aria-required': 0,
|
933 | 'aria-selected': 0,
|
934 | 'aria-sort': 0,
|
935 | 'aria-valuemax': 0,
|
936 | 'aria-valuemin': 0,
|
937 | 'aria-valuenow': 0,
|
938 | 'aria-valuetext': 0,
|
939 |
|
940 | 'aria-atomic': 0,
|
941 | 'aria-busy': 0,
|
942 | 'aria-live': 0,
|
943 | 'aria-relevant': 0,
|
944 |
|
945 | 'aria-dropeffect': 0,
|
946 | 'aria-grabbed': 0,
|
947 |
|
948 | 'aria-activedescendant': 0,
|
949 | 'aria-colcount': 0,
|
950 | 'aria-colindex': 0,
|
951 | 'aria-colspan': 0,
|
952 | 'aria-controls': 0,
|
953 | 'aria-describedby': 0,
|
954 | 'aria-errormessage': 0,
|
955 | 'aria-flowto': 0,
|
956 | 'aria-labelledby': 0,
|
957 | 'aria-owns': 0,
|
958 | 'aria-posinset': 0,
|
959 | 'aria-rowcount': 0,
|
960 | 'aria-rowindex': 0,
|
961 | 'aria-rowspan': 0,
|
962 | 'aria-setsize': 0
|
963 | };
|
964 |
|
965 | var warnedProperties = {};
|
966 | var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
967 | var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
968 |
|
969 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
970 |
|
971 | function getStackAddendum$1() {
|
972 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
973 | return stack != null ? stack : '';
|
974 | }
|
975 |
|
976 | function validateProperty(tagName, name) {
|
977 | if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
|
978 | return true;
|
979 | }
|
980 |
|
981 | if (rARIACamel.test(name)) {
|
982 | var ariaName = 'aria-' + name.slice(4).toLowerCase();
|
983 | var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
|
984 |
|
985 |
|
986 |
|
987 | if (correctName == null) {
|
988 | warning(false, 'Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.%s', name, getStackAddendum$1());
|
989 | warnedProperties[name] = true;
|
990 | return true;
|
991 | }
|
992 |
|
993 | if (name !== correctName) {
|
994 | warning(false, 'Invalid ARIA attribute `%s`. Did you mean `%s`?%s', name, correctName, getStackAddendum$1());
|
995 | warnedProperties[name] = true;
|
996 | return true;
|
997 | }
|
998 | }
|
999 |
|
1000 | if (rARIA.test(name)) {
|
1001 | var lowerCasedName = name.toLowerCase();
|
1002 | var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
|
1003 |
|
1004 |
|
1005 |
|
1006 | if (standardName == null) {
|
1007 | warnedProperties[name] = true;
|
1008 | return false;
|
1009 | }
|
1010 |
|
1011 | if (name !== standardName) {
|
1012 | warning(false, 'Unknown ARIA attribute `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$1());
|
1013 | warnedProperties[name] = true;
|
1014 | return true;
|
1015 | }
|
1016 | }
|
1017 |
|
1018 | return true;
|
1019 | }
|
1020 |
|
1021 | function warnInvalidARIAProps(type, props) {
|
1022 | var invalidProps = [];
|
1023 |
|
1024 | for (var key in props) {
|
1025 | var isValid = validateProperty(type, key);
|
1026 | if (!isValid) {
|
1027 | invalidProps.push(key);
|
1028 | }
|
1029 | }
|
1030 |
|
1031 | var unknownPropString = invalidProps.map(function (prop) {
|
1032 | return '`' + prop + '`';
|
1033 | }).join(', ');
|
1034 |
|
1035 | if (invalidProps.length === 1) {
|
1036 | warning(false, 'Invalid aria prop %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
|
1037 | } else if (invalidProps.length > 1) {
|
1038 | warning(false, 'Invalid aria props %s on <%s> tag. ' + 'For details, see https://fb.me/invalid-aria-prop%s', unknownPropString, type, getStackAddendum$1());
|
1039 | }
|
1040 | }
|
1041 |
|
1042 | function validateProperties(type, props) {
|
1043 | if (isCustomComponent(type, props)) {
|
1044 | return;
|
1045 | }
|
1046 | warnInvalidARIAProps(type, props);
|
1047 | }
|
1048 |
|
1049 | var didWarnValueNull = false;
|
1050 |
|
1051 | function getStackAddendum$2() {
|
1052 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
1053 | return stack != null ? stack : '';
|
1054 | }
|
1055 |
|
1056 | function validateProperties$1(type, props) {
|
1057 | if (type !== 'input' && type !== 'textarea' && type !== 'select') {
|
1058 | return;
|
1059 | }
|
1060 |
|
1061 | if (props != null && props.value === null && !didWarnValueNull) {
|
1062 | didWarnValueNull = true;
|
1063 | if (type === 'select' && props.multiple) {
|
1064 | warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.%s', type, getStackAddendum$2());
|
1065 | } else {
|
1066 | warning(false, '`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.%s', type, getStackAddendum$2());
|
1067 | }
|
1068 | }
|
1069 | }
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 | var registrationNameModules = {};
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 | var possibleRegistrationNames = {};
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 | var possibleStandardNames = {
|
1132 |
|
1133 | accept: 'accept',
|
1134 | acceptcharset: 'acceptCharset',
|
1135 | 'accept-charset': 'acceptCharset',
|
1136 | accesskey: 'accessKey',
|
1137 | action: 'action',
|
1138 | allowfullscreen: 'allowFullScreen',
|
1139 | alt: 'alt',
|
1140 | as: 'as',
|
1141 | async: 'async',
|
1142 | autocapitalize: 'autoCapitalize',
|
1143 | autocomplete: 'autoComplete',
|
1144 | autocorrect: 'autoCorrect',
|
1145 | autofocus: 'autoFocus',
|
1146 | autoplay: 'autoPlay',
|
1147 | autosave: 'autoSave',
|
1148 | capture: 'capture',
|
1149 | cellpadding: 'cellPadding',
|
1150 | cellspacing: 'cellSpacing',
|
1151 | challenge: 'challenge',
|
1152 | charset: 'charSet',
|
1153 | checked: 'checked',
|
1154 | children: 'children',
|
1155 | cite: 'cite',
|
1156 | class: 'className',
|
1157 | classid: 'classID',
|
1158 | classname: 'className',
|
1159 | cols: 'cols',
|
1160 | colspan: 'colSpan',
|
1161 | content: 'content',
|
1162 | contenteditable: 'contentEditable',
|
1163 | contextmenu: 'contextMenu',
|
1164 | controls: 'controls',
|
1165 | controlslist: 'controlsList',
|
1166 | coords: 'coords',
|
1167 | crossorigin: 'crossOrigin',
|
1168 | dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
|
1169 | data: 'data',
|
1170 | datetime: 'dateTime',
|
1171 | default: 'default',
|
1172 | defaultchecked: 'defaultChecked',
|
1173 | defaultvalue: 'defaultValue',
|
1174 | defer: 'defer',
|
1175 | dir: 'dir',
|
1176 | disabled: 'disabled',
|
1177 | download: 'download',
|
1178 | draggable: 'draggable',
|
1179 | enctype: 'encType',
|
1180 | for: 'htmlFor',
|
1181 | form: 'form',
|
1182 | formmethod: 'formMethod',
|
1183 | formaction: 'formAction',
|
1184 | formenctype: 'formEncType',
|
1185 | formnovalidate: 'formNoValidate',
|
1186 | formtarget: 'formTarget',
|
1187 | frameborder: 'frameBorder',
|
1188 | headers: 'headers',
|
1189 | height: 'height',
|
1190 | hidden: 'hidden',
|
1191 | high: 'high',
|
1192 | href: 'href',
|
1193 | hreflang: 'hrefLang',
|
1194 | htmlfor: 'htmlFor',
|
1195 | httpequiv: 'httpEquiv',
|
1196 | 'http-equiv': 'httpEquiv',
|
1197 | icon: 'icon',
|
1198 | id: 'id',
|
1199 | innerhtml: 'innerHTML',
|
1200 | inputmode: 'inputMode',
|
1201 | integrity: 'integrity',
|
1202 | is: 'is',
|
1203 | itemid: 'itemID',
|
1204 | itemprop: 'itemProp',
|
1205 | itemref: 'itemRef',
|
1206 | itemscope: 'itemScope',
|
1207 | itemtype: 'itemType',
|
1208 | keyparams: 'keyParams',
|
1209 | keytype: 'keyType',
|
1210 | kind: 'kind',
|
1211 | label: 'label',
|
1212 | lang: 'lang',
|
1213 | list: 'list',
|
1214 | loop: 'loop',
|
1215 | low: 'low',
|
1216 | manifest: 'manifest',
|
1217 | marginwidth: 'marginWidth',
|
1218 | marginheight: 'marginHeight',
|
1219 | max: 'max',
|
1220 | maxlength: 'maxLength',
|
1221 | media: 'media',
|
1222 | mediagroup: 'mediaGroup',
|
1223 | method: 'method',
|
1224 | min: 'min',
|
1225 | minlength: 'minLength',
|
1226 | multiple: 'multiple',
|
1227 | muted: 'muted',
|
1228 | name: 'name',
|
1229 | nomodule: 'noModule',
|
1230 | nonce: 'nonce',
|
1231 | novalidate: 'noValidate',
|
1232 | open: 'open',
|
1233 | optimum: 'optimum',
|
1234 | pattern: 'pattern',
|
1235 | placeholder: 'placeholder',
|
1236 | playsinline: 'playsInline',
|
1237 | poster: 'poster',
|
1238 | preload: 'preload',
|
1239 | profile: 'profile',
|
1240 | radiogroup: 'radioGroup',
|
1241 | readonly: 'readOnly',
|
1242 | referrerpolicy: 'referrerPolicy',
|
1243 | rel: 'rel',
|
1244 | required: 'required',
|
1245 | reversed: 'reversed',
|
1246 | role: 'role',
|
1247 | rows: 'rows',
|
1248 | rowspan: 'rowSpan',
|
1249 | sandbox: 'sandbox',
|
1250 | scope: 'scope',
|
1251 | scoped: 'scoped',
|
1252 | scrolling: 'scrolling',
|
1253 | seamless: 'seamless',
|
1254 | selected: 'selected',
|
1255 | shape: 'shape',
|
1256 | size: 'size',
|
1257 | sizes: 'sizes',
|
1258 | span: 'span',
|
1259 | spellcheck: 'spellCheck',
|
1260 | src: 'src',
|
1261 | srcdoc: 'srcDoc',
|
1262 | srclang: 'srcLang',
|
1263 | srcset: 'srcSet',
|
1264 | start: 'start',
|
1265 | step: 'step',
|
1266 | style: 'style',
|
1267 | summary: 'summary',
|
1268 | tabindex: 'tabIndex',
|
1269 | target: 'target',
|
1270 | title: 'title',
|
1271 | type: 'type',
|
1272 | usemap: 'useMap',
|
1273 | value: 'value',
|
1274 | width: 'width',
|
1275 | wmode: 'wmode',
|
1276 | wrap: 'wrap',
|
1277 |
|
1278 |
|
1279 | about: 'about',
|
1280 | accentheight: 'accentHeight',
|
1281 | 'accent-height': 'accentHeight',
|
1282 | accumulate: 'accumulate',
|
1283 | additive: 'additive',
|
1284 | alignmentbaseline: 'alignmentBaseline',
|
1285 | 'alignment-baseline': 'alignmentBaseline',
|
1286 | allowreorder: 'allowReorder',
|
1287 | alphabetic: 'alphabetic',
|
1288 | amplitude: 'amplitude',
|
1289 | arabicform: 'arabicForm',
|
1290 | 'arabic-form': 'arabicForm',
|
1291 | ascent: 'ascent',
|
1292 | attributename: 'attributeName',
|
1293 | attributetype: 'attributeType',
|
1294 | autoreverse: 'autoReverse',
|
1295 | azimuth: 'azimuth',
|
1296 | basefrequency: 'baseFrequency',
|
1297 | baselineshift: 'baselineShift',
|
1298 | 'baseline-shift': 'baselineShift',
|
1299 | baseprofile: 'baseProfile',
|
1300 | bbox: 'bbox',
|
1301 | begin: 'begin',
|
1302 | bias: 'bias',
|
1303 | by: 'by',
|
1304 | calcmode: 'calcMode',
|
1305 | capheight: 'capHeight',
|
1306 | 'cap-height': 'capHeight',
|
1307 | clip: 'clip',
|
1308 | clippath: 'clipPath',
|
1309 | 'clip-path': 'clipPath',
|
1310 | clippathunits: 'clipPathUnits',
|
1311 | cliprule: 'clipRule',
|
1312 | 'clip-rule': 'clipRule',
|
1313 | color: 'color',
|
1314 | colorinterpolation: 'colorInterpolation',
|
1315 | 'color-interpolation': 'colorInterpolation',
|
1316 | colorinterpolationfilters: 'colorInterpolationFilters',
|
1317 | 'color-interpolation-filters': 'colorInterpolationFilters',
|
1318 | colorprofile: 'colorProfile',
|
1319 | 'color-profile': 'colorProfile',
|
1320 | colorrendering: 'colorRendering',
|
1321 | 'color-rendering': 'colorRendering',
|
1322 | contentscripttype: 'contentScriptType',
|
1323 | contentstyletype: 'contentStyleType',
|
1324 | cursor: 'cursor',
|
1325 | cx: 'cx',
|
1326 | cy: 'cy',
|
1327 | d: 'd',
|
1328 | datatype: 'datatype',
|
1329 | decelerate: 'decelerate',
|
1330 | descent: 'descent',
|
1331 | diffuseconstant: 'diffuseConstant',
|
1332 | direction: 'direction',
|
1333 | display: 'display',
|
1334 | divisor: 'divisor',
|
1335 | dominantbaseline: 'dominantBaseline',
|
1336 | 'dominant-baseline': 'dominantBaseline',
|
1337 | dur: 'dur',
|
1338 | dx: 'dx',
|
1339 | dy: 'dy',
|
1340 | edgemode: 'edgeMode',
|
1341 | elevation: 'elevation',
|
1342 | enablebackground: 'enableBackground',
|
1343 | 'enable-background': 'enableBackground',
|
1344 | end: 'end',
|
1345 | exponent: 'exponent',
|
1346 | externalresourcesrequired: 'externalResourcesRequired',
|
1347 | fill: 'fill',
|
1348 | fillopacity: 'fillOpacity',
|
1349 | 'fill-opacity': 'fillOpacity',
|
1350 | fillrule: 'fillRule',
|
1351 | 'fill-rule': 'fillRule',
|
1352 | filter: 'filter',
|
1353 | filterres: 'filterRes',
|
1354 | filterunits: 'filterUnits',
|
1355 | floodopacity: 'floodOpacity',
|
1356 | 'flood-opacity': 'floodOpacity',
|
1357 | floodcolor: 'floodColor',
|
1358 | 'flood-color': 'floodColor',
|
1359 | focusable: 'focusable',
|
1360 | fontfamily: 'fontFamily',
|
1361 | 'font-family': 'fontFamily',
|
1362 | fontsize: 'fontSize',
|
1363 | 'font-size': 'fontSize',
|
1364 | fontsizeadjust: 'fontSizeAdjust',
|
1365 | 'font-size-adjust': 'fontSizeAdjust',
|
1366 | fontstretch: 'fontStretch',
|
1367 | 'font-stretch': 'fontStretch',
|
1368 | fontstyle: 'fontStyle',
|
1369 | 'font-style': 'fontStyle',
|
1370 | fontvariant: 'fontVariant',
|
1371 | 'font-variant': 'fontVariant',
|
1372 | fontweight: 'fontWeight',
|
1373 | 'font-weight': 'fontWeight',
|
1374 | format: 'format',
|
1375 | from: 'from',
|
1376 | fx: 'fx',
|
1377 | fy: 'fy',
|
1378 | g1: 'g1',
|
1379 | g2: 'g2',
|
1380 | glyphname: 'glyphName',
|
1381 | 'glyph-name': 'glyphName',
|
1382 | glyphorientationhorizontal: 'glyphOrientationHorizontal',
|
1383 | 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
|
1384 | glyphorientationvertical: 'glyphOrientationVertical',
|
1385 | 'glyph-orientation-vertical': 'glyphOrientationVertical',
|
1386 | glyphref: 'glyphRef',
|
1387 | gradienttransform: 'gradientTransform',
|
1388 | gradientunits: 'gradientUnits',
|
1389 | hanging: 'hanging',
|
1390 | horizadvx: 'horizAdvX',
|
1391 | 'horiz-adv-x': 'horizAdvX',
|
1392 | horizoriginx: 'horizOriginX',
|
1393 | 'horiz-origin-x': 'horizOriginX',
|
1394 | ideographic: 'ideographic',
|
1395 | imagerendering: 'imageRendering',
|
1396 | 'image-rendering': 'imageRendering',
|
1397 | in2: 'in2',
|
1398 | in: 'in',
|
1399 | inlist: 'inlist',
|
1400 | intercept: 'intercept',
|
1401 | k1: 'k1',
|
1402 | k2: 'k2',
|
1403 | k3: 'k3',
|
1404 | k4: 'k4',
|
1405 | k: 'k',
|
1406 | kernelmatrix: 'kernelMatrix',
|
1407 | kernelunitlength: 'kernelUnitLength',
|
1408 | kerning: 'kerning',
|
1409 | keypoints: 'keyPoints',
|
1410 | keysplines: 'keySplines',
|
1411 | keytimes: 'keyTimes',
|
1412 | lengthadjust: 'lengthAdjust',
|
1413 | letterspacing: 'letterSpacing',
|
1414 | 'letter-spacing': 'letterSpacing',
|
1415 | lightingcolor: 'lightingColor',
|
1416 | 'lighting-color': 'lightingColor',
|
1417 | limitingconeangle: 'limitingConeAngle',
|
1418 | local: 'local',
|
1419 | markerend: 'markerEnd',
|
1420 | 'marker-end': 'markerEnd',
|
1421 | markerheight: 'markerHeight',
|
1422 | markermid: 'markerMid',
|
1423 | 'marker-mid': 'markerMid',
|
1424 | markerstart: 'markerStart',
|
1425 | 'marker-start': 'markerStart',
|
1426 | markerunits: 'markerUnits',
|
1427 | markerwidth: 'markerWidth',
|
1428 | mask: 'mask',
|
1429 | maskcontentunits: 'maskContentUnits',
|
1430 | maskunits: 'maskUnits',
|
1431 | mathematical: 'mathematical',
|
1432 | mode: 'mode',
|
1433 | numoctaves: 'numOctaves',
|
1434 | offset: 'offset',
|
1435 | opacity: 'opacity',
|
1436 | operator: 'operator',
|
1437 | order: 'order',
|
1438 | orient: 'orient',
|
1439 | orientation: 'orientation',
|
1440 | origin: 'origin',
|
1441 | overflow: 'overflow',
|
1442 | overlineposition: 'overlinePosition',
|
1443 | 'overline-position': 'overlinePosition',
|
1444 | overlinethickness: 'overlineThickness',
|
1445 | 'overline-thickness': 'overlineThickness',
|
1446 | paintorder: 'paintOrder',
|
1447 | 'paint-order': 'paintOrder',
|
1448 | panose1: 'panose1',
|
1449 | 'panose-1': 'panose1',
|
1450 | pathlength: 'pathLength',
|
1451 | patterncontentunits: 'patternContentUnits',
|
1452 | patterntransform: 'patternTransform',
|
1453 | patternunits: 'patternUnits',
|
1454 | pointerevents: 'pointerEvents',
|
1455 | 'pointer-events': 'pointerEvents',
|
1456 | points: 'points',
|
1457 | pointsatx: 'pointsAtX',
|
1458 | pointsaty: 'pointsAtY',
|
1459 | pointsatz: 'pointsAtZ',
|
1460 | prefix: 'prefix',
|
1461 | preservealpha: 'preserveAlpha',
|
1462 | preserveaspectratio: 'preserveAspectRatio',
|
1463 | primitiveunits: 'primitiveUnits',
|
1464 | property: 'property',
|
1465 | r: 'r',
|
1466 | radius: 'radius',
|
1467 | refx: 'refX',
|
1468 | refy: 'refY',
|
1469 | renderingintent: 'renderingIntent',
|
1470 | 'rendering-intent': 'renderingIntent',
|
1471 | repeatcount: 'repeatCount',
|
1472 | repeatdur: 'repeatDur',
|
1473 | requiredextensions: 'requiredExtensions',
|
1474 | requiredfeatures: 'requiredFeatures',
|
1475 | resource: 'resource',
|
1476 | restart: 'restart',
|
1477 | result: 'result',
|
1478 | results: 'results',
|
1479 | rotate: 'rotate',
|
1480 | rx: 'rx',
|
1481 | ry: 'ry',
|
1482 | scale: 'scale',
|
1483 | security: 'security',
|
1484 | seed: 'seed',
|
1485 | shaperendering: 'shapeRendering',
|
1486 | 'shape-rendering': 'shapeRendering',
|
1487 | slope: 'slope',
|
1488 | spacing: 'spacing',
|
1489 | specularconstant: 'specularConstant',
|
1490 | specularexponent: 'specularExponent',
|
1491 | speed: 'speed',
|
1492 | spreadmethod: 'spreadMethod',
|
1493 | startoffset: 'startOffset',
|
1494 | stddeviation: 'stdDeviation',
|
1495 | stemh: 'stemh',
|
1496 | stemv: 'stemv',
|
1497 | stitchtiles: 'stitchTiles',
|
1498 | stopcolor: 'stopColor',
|
1499 | 'stop-color': 'stopColor',
|
1500 | stopopacity: 'stopOpacity',
|
1501 | 'stop-opacity': 'stopOpacity',
|
1502 | strikethroughposition: 'strikethroughPosition',
|
1503 | 'strikethrough-position': 'strikethroughPosition',
|
1504 | strikethroughthickness: 'strikethroughThickness',
|
1505 | 'strikethrough-thickness': 'strikethroughThickness',
|
1506 | string: 'string',
|
1507 | stroke: 'stroke',
|
1508 | strokedasharray: 'strokeDasharray',
|
1509 | 'stroke-dasharray': 'strokeDasharray',
|
1510 | strokedashoffset: 'strokeDashoffset',
|
1511 | 'stroke-dashoffset': 'strokeDashoffset',
|
1512 | strokelinecap: 'strokeLinecap',
|
1513 | 'stroke-linecap': 'strokeLinecap',
|
1514 | strokelinejoin: 'strokeLinejoin',
|
1515 | 'stroke-linejoin': 'strokeLinejoin',
|
1516 | strokemiterlimit: 'strokeMiterlimit',
|
1517 | 'stroke-miterlimit': 'strokeMiterlimit',
|
1518 | strokewidth: 'strokeWidth',
|
1519 | 'stroke-width': 'strokeWidth',
|
1520 | strokeopacity: 'strokeOpacity',
|
1521 | 'stroke-opacity': 'strokeOpacity',
|
1522 | suppresscontenteditablewarning: 'suppressContentEditableWarning',
|
1523 | suppresshydrationwarning: 'suppressHydrationWarning',
|
1524 | surfacescale: 'surfaceScale',
|
1525 | systemlanguage: 'systemLanguage',
|
1526 | tablevalues: 'tableValues',
|
1527 | targetx: 'targetX',
|
1528 | targety: 'targetY',
|
1529 | textanchor: 'textAnchor',
|
1530 | 'text-anchor': 'textAnchor',
|
1531 | textdecoration: 'textDecoration',
|
1532 | 'text-decoration': 'textDecoration',
|
1533 | textlength: 'textLength',
|
1534 | textrendering: 'textRendering',
|
1535 | 'text-rendering': 'textRendering',
|
1536 | to: 'to',
|
1537 | transform: 'transform',
|
1538 | typeof: 'typeof',
|
1539 | u1: 'u1',
|
1540 | u2: 'u2',
|
1541 | underlineposition: 'underlinePosition',
|
1542 | 'underline-position': 'underlinePosition',
|
1543 | underlinethickness: 'underlineThickness',
|
1544 | 'underline-thickness': 'underlineThickness',
|
1545 | unicode: 'unicode',
|
1546 | unicodebidi: 'unicodeBidi',
|
1547 | 'unicode-bidi': 'unicodeBidi',
|
1548 | unicoderange: 'unicodeRange',
|
1549 | 'unicode-range': 'unicodeRange',
|
1550 | unitsperem: 'unitsPerEm',
|
1551 | 'units-per-em': 'unitsPerEm',
|
1552 | unselectable: 'unselectable',
|
1553 | valphabetic: 'vAlphabetic',
|
1554 | 'v-alphabetic': 'vAlphabetic',
|
1555 | values: 'values',
|
1556 | vectoreffect: 'vectorEffect',
|
1557 | 'vector-effect': 'vectorEffect',
|
1558 | version: 'version',
|
1559 | vertadvy: 'vertAdvY',
|
1560 | 'vert-adv-y': 'vertAdvY',
|
1561 | vertoriginx: 'vertOriginX',
|
1562 | 'vert-origin-x': 'vertOriginX',
|
1563 | vertoriginy: 'vertOriginY',
|
1564 | 'vert-origin-y': 'vertOriginY',
|
1565 | vhanging: 'vHanging',
|
1566 | 'v-hanging': 'vHanging',
|
1567 | videographic: 'vIdeographic',
|
1568 | 'v-ideographic': 'vIdeographic',
|
1569 | viewbox: 'viewBox',
|
1570 | viewtarget: 'viewTarget',
|
1571 | visibility: 'visibility',
|
1572 | vmathematical: 'vMathematical',
|
1573 | 'v-mathematical': 'vMathematical',
|
1574 | vocab: 'vocab',
|
1575 | widths: 'widths',
|
1576 | wordspacing: 'wordSpacing',
|
1577 | 'word-spacing': 'wordSpacing',
|
1578 | writingmode: 'writingMode',
|
1579 | 'writing-mode': 'writingMode',
|
1580 | x1: 'x1',
|
1581 | x2: 'x2',
|
1582 | x: 'x',
|
1583 | xchannelselector: 'xChannelSelector',
|
1584 | xheight: 'xHeight',
|
1585 | 'x-height': 'xHeight',
|
1586 | xlinkactuate: 'xlinkActuate',
|
1587 | 'xlink:actuate': 'xlinkActuate',
|
1588 | xlinkarcrole: 'xlinkArcrole',
|
1589 | 'xlink:arcrole': 'xlinkArcrole',
|
1590 | xlinkhref: 'xlinkHref',
|
1591 | 'xlink:href': 'xlinkHref',
|
1592 | xlinkrole: 'xlinkRole',
|
1593 | 'xlink:role': 'xlinkRole',
|
1594 | xlinkshow: 'xlinkShow',
|
1595 | 'xlink:show': 'xlinkShow',
|
1596 | xlinktitle: 'xlinkTitle',
|
1597 | 'xlink:title': 'xlinkTitle',
|
1598 | xlinktype: 'xlinkType',
|
1599 | 'xlink:type': 'xlinkType',
|
1600 | xmlbase: 'xmlBase',
|
1601 | 'xml:base': 'xmlBase',
|
1602 | xmllang: 'xmlLang',
|
1603 | 'xml:lang': 'xmlLang',
|
1604 | xmlns: 'xmlns',
|
1605 | 'xml:space': 'xmlSpace',
|
1606 | xmlnsxlink: 'xmlnsXlink',
|
1607 | 'xmlns:xlink': 'xmlnsXlink',
|
1608 | xmlspace: 'xmlSpace',
|
1609 | y1: 'y1',
|
1610 | y2: 'y2',
|
1611 | y: 'y',
|
1612 | ychannelselector: 'yChannelSelector',
|
1613 | z: 'z',
|
1614 | zoomandpan: 'zoomAndPan'
|
1615 | };
|
1616 |
|
1617 | function getStackAddendum$3() {
|
1618 | var stack = ReactDebugCurrentFrame.getStackAddendum();
|
1619 | return stack != null ? stack : '';
|
1620 | }
|
1621 |
|
1622 | var validateProperty$1 = function () {};
|
1623 |
|
1624 | {
|
1625 | var warnedProperties$1 = {};
|
1626 | var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
1627 | var EVENT_NAME_REGEX = /^on./;
|
1628 | var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
|
1629 | var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
|
1630 | var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
|
1631 |
|
1632 | validateProperty$1 = function (tagName, name, value, canUseEventSystem) {
|
1633 | if (_hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) {
|
1634 | return true;
|
1635 | }
|
1636 |
|
1637 | var lowerCasedName = name.toLowerCase();
|
1638 | if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') {
|
1639 | warning(false, 'React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.');
|
1640 | warnedProperties$1[name] = true;
|
1641 | return true;
|
1642 | }
|
1643 |
|
1644 |
|
1645 | if (canUseEventSystem) {
|
1646 | if (registrationNameModules.hasOwnProperty(name)) {
|
1647 | return true;
|
1648 | }
|
1649 | var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null;
|
1650 | if (registrationName != null) {
|
1651 | warning(false, 'Invalid event handler property `%s`. Did you mean `%s`?%s', name, registrationName, getStackAddendum$3());
|
1652 | warnedProperties$1[name] = true;
|
1653 | return true;
|
1654 | }
|
1655 | if (EVENT_NAME_REGEX.test(name)) {
|
1656 | warning(false, 'Unknown event handler property `%s`. It will be ignored.%s', name, getStackAddendum$3());
|
1657 | warnedProperties$1[name] = true;
|
1658 | return true;
|
1659 | }
|
1660 | } else if (EVENT_NAME_REGEX.test(name)) {
|
1661 |
|
1662 |
|
1663 |
|
1664 | if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
1665 | warning(false, 'Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.%s', name, getStackAddendum$3());
|
1666 | }
|
1667 | warnedProperties$1[name] = true;
|
1668 | return true;
|
1669 | }
|
1670 |
|
1671 |
|
1672 | if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
|
1673 | return true;
|
1674 | }
|
1675 |
|
1676 | if (lowerCasedName === 'innerhtml') {
|
1677 | warning(false, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.');
|
1678 | warnedProperties$1[name] = true;
|
1679 | return true;
|
1680 | }
|
1681 |
|
1682 | if (lowerCasedName === 'aria') {
|
1683 | warning(false, 'The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.');
|
1684 | warnedProperties$1[name] = true;
|
1685 | return true;
|
1686 | }
|
1687 |
|
1688 | if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') {
|
1689 | warning(false, 'Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.%s', typeof value, getStackAddendum$3());
|
1690 | warnedProperties$1[name] = true;
|
1691 | return true;
|
1692 | }
|
1693 |
|
1694 | if (typeof value === 'number' && isNaN(value)) {
|
1695 | warning(false, 'Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.%s', name, getStackAddendum$3());
|
1696 | warnedProperties$1[name] = true;
|
1697 | return true;
|
1698 | }
|
1699 |
|
1700 | var propertyInfo = getPropertyInfo(name);
|
1701 | var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED;
|
1702 |
|
1703 |
|
1704 | if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
1705 | var standardName = possibleStandardNames[lowerCasedName];
|
1706 | if (standardName !== name) {
|
1707 | warning(false, 'Invalid DOM property `%s`. Did you mean `%s`?%s', name, standardName, getStackAddendum$3());
|
1708 | warnedProperties$1[name] = true;
|
1709 | return true;
|
1710 | }
|
1711 | } else if (!isReserved && name !== lowerCasedName) {
|
1712 |
|
1713 |
|
1714 | warning(false, 'React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.%s', name, lowerCasedName, getStackAddendum$3());
|
1715 | warnedProperties$1[name] = true;
|
1716 | return true;
|
1717 | }
|
1718 |
|
1719 | if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
1720 | if (value) {
|
1721 | warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.%s', value, name, name, value, name, getStackAddendum$3());
|
1722 | } else {
|
1723 | warning(false, 'Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.%s', value, name, name, value, name, name, name, getStackAddendum$3());
|
1724 | }
|
1725 | warnedProperties$1[name] = true;
|
1726 | return true;
|
1727 | }
|
1728 |
|
1729 |
|
1730 |
|
1731 | if (isReserved) {
|
1732 | return true;
|
1733 | }
|
1734 |
|
1735 |
|
1736 | if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
1737 | warnedProperties$1[name] = true;
|
1738 | return false;
|
1739 | }
|
1740 |
|
1741 | return true;
|
1742 | };
|
1743 | }
|
1744 |
|
1745 | var warnUnknownProperties = function (type, props, canUseEventSystem) {
|
1746 | var unknownProps = [];
|
1747 | for (var key in props) {
|
1748 | var isValid = validateProperty$1(type, key, props[key], canUseEventSystem);
|
1749 | if (!isValid) {
|
1750 | unknownProps.push(key);
|
1751 | }
|
1752 | }
|
1753 |
|
1754 | var unknownPropString = unknownProps.map(function (prop) {
|
1755 | return '`' + prop + '`';
|
1756 | }).join(', ');
|
1757 | if (unknownProps.length === 1) {
|
1758 | warning(false, 'Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
|
1759 | } else if (unknownProps.length > 1) {
|
1760 | warning(false, 'Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://fb.me/react-attribute-behavior%s', unknownPropString, type, getStackAddendum$3());
|
1761 | }
|
1762 | };
|
1763 |
|
1764 | function validateProperties$2(type, props, canUseEventSystem) {
|
1765 | if (isCustomComponent(type, props)) {
|
1766 | return;
|
1767 | }
|
1768 | warnUnknownProperties(type, props, canUseEventSystem);
|
1769 | }
|
1770 |
|
1771 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1772 |
|
1773 |
|
1774 |
|
1775 | var toArray = React.Children.toArray;
|
1776 |
|
1777 | var currentDebugStack = void 0;
|
1778 | var currentDebugElementStack = void 0;
|
1779 |
|
1780 | var getStackAddendum = emptyFunction.thatReturns('');
|
1781 | var describeStackFrame = emptyFunction.thatReturns('');
|
1782 |
|
1783 | var validatePropertiesInDevelopment = function (type, props) {};
|
1784 | var setCurrentDebugStack = function (stack) {};
|
1785 | var pushElementToDebugStack = function (element) {};
|
1786 | var resetCurrentDebugStack = function () {};
|
1787 |
|
1788 | {
|
1789 | validatePropertiesInDevelopment = function (type, props) {
|
1790 | validateProperties(type, props);
|
1791 | validateProperties$1(type, props);
|
1792 | validateProperties$2(type, props, false);
|
1793 | };
|
1794 |
|
1795 | describeStackFrame = function (element) {
|
1796 | var source = element._source;
|
1797 | var type = element.type;
|
1798 | var name = getComponentName(type);
|
1799 | var ownerName = null;
|
1800 | return describeComponentFrame(name, source, ownerName);
|
1801 | };
|
1802 |
|
1803 | currentDebugStack = null;
|
1804 | currentDebugElementStack = null;
|
1805 | setCurrentDebugStack = function (stack) {
|
1806 | var frame = stack[stack.length - 1];
|
1807 | currentDebugElementStack = frame.debugElementStack;
|
1808 |
|
1809 | currentDebugElementStack.length = 0;
|
1810 | currentDebugStack = stack;
|
1811 | ReactDebugCurrentFrame.getCurrentStack = getStackAddendum;
|
1812 | };
|
1813 | pushElementToDebugStack = function (element) {
|
1814 | if (currentDebugElementStack !== null) {
|
1815 | currentDebugElementStack.push(element);
|
1816 | }
|
1817 | };
|
1818 | resetCurrentDebugStack = function () {
|
1819 | currentDebugElementStack = null;
|
1820 | currentDebugStack = null;
|
1821 | ReactDebugCurrentFrame.getCurrentStack = null;
|
1822 | };
|
1823 | getStackAddendum = function () {
|
1824 | if (currentDebugStack === null) {
|
1825 | return '';
|
1826 | }
|
1827 | var stack = '';
|
1828 | var debugStack = currentDebugStack;
|
1829 | for (var i = debugStack.length - 1; i >= 0; i--) {
|
1830 | var frame = debugStack[i];
|
1831 | var _debugElementStack = frame.debugElementStack;
|
1832 | for (var ii = _debugElementStack.length - 1; ii >= 0; ii--) {
|
1833 | stack += describeStackFrame(_debugElementStack[ii]);
|
1834 | }
|
1835 | }
|
1836 | return stack;
|
1837 | };
|
1838 | }
|
1839 |
|
1840 | var didWarnDefaultInputValue = false;
|
1841 | var didWarnDefaultChecked = false;
|
1842 | var didWarnDefaultSelectValue = false;
|
1843 | var didWarnDefaultTextareaValue = false;
|
1844 | var didWarnInvalidOptionChildren = false;
|
1845 | var didWarnAboutNoopUpdateForComponent = {};
|
1846 | var didWarnAboutBadClass = {};
|
1847 | var didWarnAboutDeprecatedWillMount = {};
|
1848 | var didWarnAboutUndefinedDerivedState = {};
|
1849 | var didWarnAboutUninitializedState = {};
|
1850 | var valuePropNames = ['value', 'defaultValue'];
|
1851 | var newlineEatingTags = {
|
1852 | listing: true,
|
1853 | pre: true,
|
1854 | textarea: true
|
1855 | };
|
1856 |
|
1857 | function getComponentName(type) {
|
1858 | return typeof type === 'string' ? type : typeof type === 'function' ? type.displayName || type.name : null;
|
1859 | }
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/;
|
1865 | var validatedTagCache = {};
|
1866 | function validateDangerousTag(tag) {
|
1867 | if (!validatedTagCache.hasOwnProperty(tag)) {
|
1868 | !VALID_TAG_REGEX.test(tag) ? invariant(false, 'Invalid tag: %s', tag) : void 0;
|
1869 | validatedTagCache[tag] = true;
|
1870 | }
|
1871 | }
|
1872 |
|
1873 | var processStyleName = memoizeStringOnly(function (styleName) {
|
1874 | return hyphenateStyleName(styleName);
|
1875 | });
|
1876 |
|
1877 | function createMarkupForStyles(styles) {
|
1878 | var serialized = '';
|
1879 | var delimiter = '';
|
1880 | for (var styleName in styles) {
|
1881 | if (!styles.hasOwnProperty(styleName)) {
|
1882 | continue;
|
1883 | }
|
1884 | var isCustomProperty = styleName.indexOf('--') === 0;
|
1885 | var styleValue = styles[styleName];
|
1886 | {
|
1887 | if (!isCustomProperty) {
|
1888 | warnValidStyle$1(styleName, styleValue, getStackAddendum);
|
1889 | }
|
1890 | }
|
1891 | if (styleValue != null) {
|
1892 | serialized += delimiter + processStyleName(styleName) + ':';
|
1893 | serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
|
1894 |
|
1895 | delimiter = ';';
|
1896 | }
|
1897 | }
|
1898 | return serialized || null;
|
1899 | }
|
1900 |
|
1901 | function warnNoop(publicInstance, callerName) {
|
1902 | {
|
1903 | var _constructor = publicInstance.constructor;
|
1904 | var componentName = _constructor && getComponentName(_constructor) || 'ReactClass';
|
1905 | var warningKey = componentName + '.' + callerName;
|
1906 | if (didWarnAboutNoopUpdateForComponent[warningKey]) {
|
1907 | return;
|
1908 | }
|
1909 |
|
1910 | warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
|
1911 | didWarnAboutNoopUpdateForComponent[warningKey] = true;
|
1912 | }
|
1913 | }
|
1914 |
|
1915 | function shouldConstruct(Component) {
|
1916 | return Component.prototype && Component.prototype.isReactComponent;
|
1917 | }
|
1918 |
|
1919 | function getNonChildrenInnerMarkup(props) {
|
1920 | var innerHTML = props.dangerouslySetInnerHTML;
|
1921 | if (innerHTML != null) {
|
1922 | if (innerHTML.__html != null) {
|
1923 | return innerHTML.__html;
|
1924 | }
|
1925 | } else {
|
1926 | var content = props.children;
|
1927 | if (typeof content === 'string' || typeof content === 'number') {
|
1928 | return escapeTextForBrowser(content);
|
1929 | }
|
1930 | }
|
1931 | return null;
|
1932 | }
|
1933 |
|
1934 | function flattenTopLevelChildren(children) {
|
1935 | if (!React.isValidElement(children)) {
|
1936 | return toArray(children);
|
1937 | }
|
1938 | var element = children;
|
1939 | if (element.type !== REACT_FRAGMENT_TYPE) {
|
1940 | return [element];
|
1941 | }
|
1942 | var fragmentChildren = element.props.children;
|
1943 | if (!React.isValidElement(fragmentChildren)) {
|
1944 | return toArray(fragmentChildren);
|
1945 | }
|
1946 | var fragmentChildElement = fragmentChildren;
|
1947 | return [fragmentChildElement];
|
1948 | }
|
1949 |
|
1950 | function flattenOptionChildren(children) {
|
1951 | var content = '';
|
1952 |
|
1953 |
|
1954 | React.Children.forEach(children, function (child) {
|
1955 | if (child == null) {
|
1956 | return;
|
1957 | }
|
1958 | if (typeof child === 'string' || typeof child === 'number') {
|
1959 | content += child;
|
1960 | } else {
|
1961 | {
|
1962 | if (!didWarnInvalidOptionChildren) {
|
1963 | didWarnInvalidOptionChildren = true;
|
1964 | warning(false, 'Only strings and numbers are supported as <option> children.');
|
1965 | }
|
1966 | }
|
1967 | }
|
1968 | });
|
1969 | return content;
|
1970 | }
|
1971 |
|
1972 | function maskContext(type, context) {
|
1973 | var contextTypes = type.contextTypes;
|
1974 | if (!contextTypes) {
|
1975 | return emptyObject;
|
1976 | }
|
1977 | var maskedContext = {};
|
1978 | for (var contextName in contextTypes) {
|
1979 | maskedContext[contextName] = context[contextName];
|
1980 | }
|
1981 | return maskedContext;
|
1982 | }
|
1983 |
|
1984 | function checkContextTypes(typeSpecs, values, location) {
|
1985 | {
|
1986 | checkPropTypes(typeSpecs, values, location, 'Component', getStackAddendum);
|
1987 | }
|
1988 | }
|
1989 |
|
1990 | function processContext(type, context) {
|
1991 | var maskedContext = maskContext(type, context);
|
1992 | {
|
1993 | if (type.contextTypes) {
|
1994 | checkContextTypes(type.contextTypes, maskedContext, 'context');
|
1995 | }
|
1996 | }
|
1997 | return maskedContext;
|
1998 | }
|
1999 |
|
2000 | var STYLE = 'style';
|
2001 | var RESERVED_PROPS = {
|
2002 | children: null,
|
2003 | dangerouslySetInnerHTML: null,
|
2004 | suppressContentEditableWarning: null,
|
2005 | suppressHydrationWarning: null
|
2006 | };
|
2007 |
|
2008 | function createOpenTagMarkup(tagVerbatim, tagLowercase, props, namespace, makeStaticMarkup, isRootElement) {
|
2009 | var ret = '<' + tagVerbatim;
|
2010 |
|
2011 | for (var propKey in props) {
|
2012 | if (!props.hasOwnProperty(propKey)) {
|
2013 | continue;
|
2014 | }
|
2015 | var propValue = props[propKey];
|
2016 | if (propValue == null) {
|
2017 | continue;
|
2018 | }
|
2019 | if (propKey === STYLE) {
|
2020 | propValue = createMarkupForStyles(propValue);
|
2021 | }
|
2022 | var markup = null;
|
2023 | if (isCustomComponent(tagLowercase, props)) {
|
2024 | if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
|
2025 | markup = createMarkupForCustomAttribute(propKey, propValue);
|
2026 | }
|
2027 | } else {
|
2028 | markup = createMarkupForProperty(propKey, propValue);
|
2029 | }
|
2030 | if (markup) {
|
2031 | ret += ' ' + markup;
|
2032 | }
|
2033 | }
|
2034 |
|
2035 |
|
2036 |
|
2037 | if (makeStaticMarkup) {
|
2038 | return ret;
|
2039 | }
|
2040 |
|
2041 | if (isRootElement) {
|
2042 | ret += ' ' + createMarkupForRoot();
|
2043 | }
|
2044 | return ret;
|
2045 | }
|
2046 |
|
2047 | function validateRenderResult(child, type) {
|
2048 | if (child === undefined) {
|
2049 | invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', getComponentName(type) || 'Component');
|
2050 | }
|
2051 | }
|
2052 |
|
2053 | function resolve(child, context) {
|
2054 | while (React.isValidElement(child)) {
|
2055 |
|
2056 | var element = child;
|
2057 | var Component = element.type;
|
2058 | {
|
2059 | pushElementToDebugStack(element);
|
2060 | }
|
2061 | if (typeof Component !== 'function') {
|
2062 | break;
|
2063 | }
|
2064 | processChild(element, Component);
|
2065 | }
|
2066 |
|
2067 |
|
2068 | function processChild(element, Component) {
|
2069 | var publicContext = processContext(Component, context);
|
2070 |
|
2071 | var queue = [];
|
2072 | var replace = false;
|
2073 | var updater = {
|
2074 | isMounted: function (publicInstance) {
|
2075 | return false;
|
2076 | },
|
2077 | enqueueForceUpdate: function (publicInstance) {
|
2078 | if (queue === null) {
|
2079 | warnNoop(publicInstance, 'forceUpdate');
|
2080 | return null;
|
2081 | }
|
2082 | },
|
2083 | enqueueReplaceState: function (publicInstance, completeState) {
|
2084 | replace = true;
|
2085 | queue = [completeState];
|
2086 | },
|
2087 | enqueueSetState: function (publicInstance, currentPartialState) {
|
2088 | if (queue === null) {
|
2089 | warnNoop(publicInstance, 'setState');
|
2090 | return null;
|
2091 | }
|
2092 | queue.push(currentPartialState);
|
2093 | }
|
2094 | };
|
2095 |
|
2096 | var inst = void 0;
|
2097 | if (shouldConstruct(Component)) {
|
2098 | inst = new Component(element.props, publicContext, updater);
|
2099 |
|
2100 | if (typeof Component.getDerivedStateFromProps === 'function') {
|
2101 | {
|
2102 | if (inst.state === null || inst.state === undefined) {
|
2103 | var componentName = getComponentName(Component) || 'Unknown';
|
2104 | if (!didWarnAboutUninitializedState[componentName]) {
|
2105 | warning(false, '%s: Did not properly initialize state during construction. ' + 'Expected state to be an object, but it was %s.', componentName, inst.state === null ? 'null' : 'undefined');
|
2106 | didWarnAboutUninitializedState[componentName] = true;
|
2107 | }
|
2108 | }
|
2109 | }
|
2110 |
|
2111 | var partialState = Component.getDerivedStateFromProps.call(null, element.props, inst.state);
|
2112 |
|
2113 | {
|
2114 | if (partialState === undefined) {
|
2115 | var _componentName = getComponentName(Component) || 'Unknown';
|
2116 | if (!didWarnAboutUndefinedDerivedState[_componentName]) {
|
2117 | warning(false, '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', _componentName);
|
2118 | didWarnAboutUndefinedDerivedState[_componentName] = true;
|
2119 | }
|
2120 | }
|
2121 | }
|
2122 |
|
2123 | if (partialState != null) {
|
2124 | inst.state = _assign({}, inst.state, partialState);
|
2125 | }
|
2126 | }
|
2127 | } else {
|
2128 | {
|
2129 | if (Component.prototype && typeof Component.prototype.render === 'function') {
|
2130 | var _componentName2 = getComponentName(Component) || 'Unknown';
|
2131 |
|
2132 | if (!didWarnAboutBadClass[_componentName2]) {
|
2133 | warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', _componentName2, _componentName2);
|
2134 | didWarnAboutBadClass[_componentName2] = true;
|
2135 | }
|
2136 | }
|
2137 | }
|
2138 | inst = Component(element.props, publicContext, updater);
|
2139 | if (inst == null || inst.render == null) {
|
2140 | child = inst;
|
2141 | validateRenderResult(child, Component);
|
2142 | return;
|
2143 | }
|
2144 | }
|
2145 |
|
2146 | inst.props = element.props;
|
2147 | inst.context = publicContext;
|
2148 | inst.updater = updater;
|
2149 |
|
2150 | var initialState = inst.state;
|
2151 | if (initialState === undefined) {
|
2152 | inst.state = initialState = null;
|
2153 | }
|
2154 | if (typeof inst.UNSAFE_componentWillMount === 'function' || typeof inst.componentWillMount === 'function') {
|
2155 | if (typeof inst.componentWillMount === 'function') {
|
2156 | {
|
2157 | if (warnAboutDeprecatedLifecycles && inst.componentWillMount.__suppressDeprecationWarning !== true) {
|
2158 | var _componentName3 = getComponentName(Component) || 'Unknown';
|
2159 |
|
2160 | if (!didWarnAboutDeprecatedWillMount[_componentName3]) {
|
2161 | lowPriorityWarning$1(false, '%s: componentWillMount() is deprecated and will be ' + 'removed in the next major version. Read about the motivations ' + 'behind this change: ' + 'https://fb.me/react-async-component-lifecycle-hooks' + '\n\n' + 'As a temporary workaround, you can rename to ' + 'UNSAFE_componentWillMount instead.', _componentName3);
|
2162 | didWarnAboutDeprecatedWillMount[_componentName3] = true;
|
2163 | }
|
2164 | }
|
2165 | }
|
2166 |
|
2167 |
|
2168 |
|
2169 | if (typeof Component.getDerivedStateFromProps !== 'function') {
|
2170 | inst.componentWillMount();
|
2171 | }
|
2172 | }
|
2173 | if (typeof inst.UNSAFE_componentWillMount === 'function' && typeof Component.getDerivedStateFromProps !== 'function') {
|
2174 |
|
2175 |
|
2176 | inst.UNSAFE_componentWillMount();
|
2177 | }
|
2178 | if (queue.length) {
|
2179 | var oldQueue = queue;
|
2180 | var oldReplace = replace;
|
2181 | queue = null;
|
2182 | replace = false;
|
2183 |
|
2184 | if (oldReplace && oldQueue.length === 1) {
|
2185 | inst.state = oldQueue[0];
|
2186 | } else {
|
2187 | var nextState = oldReplace ? oldQueue[0] : inst.state;
|
2188 | var dontMutate = true;
|
2189 | for (var i = oldReplace ? 1 : 0; i < oldQueue.length; i++) {
|
2190 | var partial = oldQueue[i];
|
2191 | var _partialState = typeof partial === 'function' ? partial.call(inst, nextState, element.props, publicContext) : partial;
|
2192 | if (_partialState != null) {
|
2193 | if (dontMutate) {
|
2194 | dontMutate = false;
|
2195 | nextState = _assign({}, nextState, _partialState);
|
2196 | } else {
|
2197 | _assign(nextState, _partialState);
|
2198 | }
|
2199 | }
|
2200 | }
|
2201 | inst.state = nextState;
|
2202 | }
|
2203 | } else {
|
2204 | queue = null;
|
2205 | }
|
2206 | }
|
2207 | child = inst.render();
|
2208 |
|
2209 | {
|
2210 | if (child === undefined && inst.render._isMockFunction) {
|
2211 |
|
2212 |
|
2213 | child = null;
|
2214 | }
|
2215 | }
|
2216 | validateRenderResult(child, Component);
|
2217 |
|
2218 | var childContext = void 0;
|
2219 | if (typeof inst.getChildContext === 'function') {
|
2220 | var childContextTypes = Component.childContextTypes;
|
2221 | if (typeof childContextTypes === 'object') {
|
2222 | childContext = inst.getChildContext();
|
2223 | for (var contextKey in childContext) {
|
2224 | !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(Component) || 'Unknown', contextKey) : void 0;
|
2225 | }
|
2226 | } else {
|
2227 | warning(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', getComponentName(Component) || 'Unknown');
|
2228 | }
|
2229 | }
|
2230 | if (childContext) {
|
2231 | context = _assign({}, context, childContext);
|
2232 | }
|
2233 | }
|
2234 | return { child: child, context: context };
|
2235 | }
|
2236 |
|
2237 | var ReactDOMServerRenderer = function () {
|
2238 | function ReactDOMServerRenderer(children, makeStaticMarkup) {
|
2239 | _classCallCheck(this, ReactDOMServerRenderer);
|
2240 |
|
2241 | var flatChildren = flattenTopLevelChildren(children);
|
2242 |
|
2243 | var topFrame = {
|
2244 | type: null,
|
2245 |
|
2246 |
|
2247 | domNamespace: Namespaces.html,
|
2248 | children: flatChildren,
|
2249 | childIndex: 0,
|
2250 | context: emptyObject,
|
2251 | footer: ''
|
2252 | };
|
2253 | {
|
2254 | topFrame.debugElementStack = [];
|
2255 | }
|
2256 | this.stack = [topFrame];
|
2257 | this.exhausted = false;
|
2258 | this.currentSelectValue = null;
|
2259 | this.previousWasTextNode = false;
|
2260 | this.makeStaticMarkup = makeStaticMarkup;
|
2261 |
|
2262 |
|
2263 | this.providerStack = [];
|
2264 | this.providerIndex = -1;
|
2265 | }
|
2266 |
|
2267 |
|
2268 |
|
2269 | ReactDOMServerRenderer.prototype.pushProvider = function pushProvider(provider) {
|
2270 | this.providerIndex += 1;
|
2271 | this.providerStack[this.providerIndex] = provider;
|
2272 | var context = provider.type._context;
|
2273 | context._currentValue = provider.props.value;
|
2274 | };
|
2275 |
|
2276 | ReactDOMServerRenderer.prototype.popProvider = function popProvider(provider) {
|
2277 | {
|
2278 | !(this.providerIndex > -1 && provider === this.providerStack[this.providerIndex]) ? warning(false, 'Unexpected pop.') : void 0;
|
2279 | }
|
2280 | this.providerStack[this.providerIndex] = null;
|
2281 | this.providerIndex -= 1;
|
2282 | var context = provider.type._context;
|
2283 | if (this.providerIndex < 0) {
|
2284 | context._currentValue = context._defaultValue;
|
2285 | } else {
|
2286 |
|
2287 | var previousProvider = this.providerStack[this.providerIndex];
|
2288 | context._currentValue = previousProvider.props.value;
|
2289 | }
|
2290 | };
|
2291 |
|
2292 | ReactDOMServerRenderer.prototype.read = function read(bytes) {
|
2293 | if (this.exhausted) {
|
2294 | return null;
|
2295 | }
|
2296 |
|
2297 | var out = '';
|
2298 | while (out.length < bytes) {
|
2299 | if (this.stack.length === 0) {
|
2300 | this.exhausted = true;
|
2301 | break;
|
2302 | }
|
2303 | var frame = this.stack[this.stack.length - 1];
|
2304 | if (frame.childIndex >= frame.children.length) {
|
2305 | var _footer = frame.footer;
|
2306 | out += _footer;
|
2307 | if (_footer !== '') {
|
2308 | this.previousWasTextNode = false;
|
2309 | }
|
2310 | this.stack.pop();
|
2311 | if (frame.type === 'select') {
|
2312 | this.currentSelectValue = null;
|
2313 | } else if (frame.type != null && frame.type.type != null && frame.type.type.$$typeof === REACT_PROVIDER_TYPE) {
|
2314 | var provider = frame.type;
|
2315 | this.popProvider(provider);
|
2316 | }
|
2317 | continue;
|
2318 | }
|
2319 | var child = frame.children[frame.childIndex++];
|
2320 | {
|
2321 | setCurrentDebugStack(this.stack);
|
2322 | }
|
2323 | out += this.render(child, frame.context, frame.domNamespace);
|
2324 | {
|
2325 |
|
2326 | resetCurrentDebugStack();
|
2327 | }
|
2328 | }
|
2329 | return out;
|
2330 | };
|
2331 |
|
2332 | ReactDOMServerRenderer.prototype.render = function render(child, context, parentNamespace) {
|
2333 | if (typeof child === 'string' || typeof child === 'number') {
|
2334 | var text = '' + child;
|
2335 | if (text === '') {
|
2336 | return '';
|
2337 | }
|
2338 | if (this.makeStaticMarkup) {
|
2339 | return escapeTextForBrowser(text);
|
2340 | }
|
2341 | if (this.previousWasTextNode) {
|
2342 | return '<!-- -->' + escapeTextForBrowser(text);
|
2343 | }
|
2344 | this.previousWasTextNode = true;
|
2345 | return escapeTextForBrowser(text);
|
2346 | } else {
|
2347 | var nextChild = void 0;
|
2348 |
|
2349 | var _resolve = resolve(child, context);
|
2350 |
|
2351 | nextChild = _resolve.child;
|
2352 | context = _resolve.context;
|
2353 |
|
2354 | if (nextChild === null || nextChild === false) {
|
2355 | return '';
|
2356 | } else if (!React.isValidElement(nextChild)) {
|
2357 | if (nextChild != null && nextChild.$$typeof != null) {
|
2358 |
|
2359 | var $$typeof = nextChild.$$typeof;
|
2360 | !($$typeof !== REACT_PORTAL_TYPE) ? invariant(false, 'Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render.') : void 0;
|
2361 |
|
2362 | invariant(false, 'Unknown element-like object type: %s. This is likely a bug in React. Please file an issue.', $$typeof.toString());
|
2363 | }
|
2364 | var nextChildren = toArray(nextChild);
|
2365 | var frame = {
|
2366 | type: null,
|
2367 | domNamespace: parentNamespace,
|
2368 | children: nextChildren,
|
2369 | childIndex: 0,
|
2370 | context: context,
|
2371 | footer: ''
|
2372 | };
|
2373 | {
|
2374 | frame.debugElementStack = [];
|
2375 | }
|
2376 | this.stack.push(frame);
|
2377 | return '';
|
2378 | }
|
2379 |
|
2380 | var nextElement = nextChild;
|
2381 | var elementType = nextElement.type;
|
2382 |
|
2383 | if (typeof elementType === 'string') {
|
2384 | return this.renderDOM(nextElement, context, parentNamespace);
|
2385 | }
|
2386 |
|
2387 | switch (elementType) {
|
2388 | case REACT_STRICT_MODE_TYPE:
|
2389 | case REACT_ASYNC_MODE_TYPE:
|
2390 | case REACT_PROFILER_TYPE:
|
2391 | case REACT_FRAGMENT_TYPE:
|
2392 | {
|
2393 | var _nextChildren = toArray(nextChild.props.children);
|
2394 | var _frame = {
|
2395 | type: null,
|
2396 | domNamespace: parentNamespace,
|
2397 | children: _nextChildren,
|
2398 | childIndex: 0,
|
2399 | context: context,
|
2400 | footer: ''
|
2401 | };
|
2402 | {
|
2403 | _frame.debugElementStack = [];
|
2404 | }
|
2405 | this.stack.push(_frame);
|
2406 | return '';
|
2407 | }
|
2408 |
|
2409 | default:
|
2410 | break;
|
2411 | }
|
2412 | if (typeof elementType === 'object' && elementType !== null) {
|
2413 | switch (elementType.$$typeof) {
|
2414 | case REACT_FORWARD_REF_TYPE:
|
2415 | {
|
2416 | var element = nextChild;
|
2417 | var _nextChildren2 = toArray(elementType.render(element.props, element.ref));
|
2418 | var _frame2 = {
|
2419 | type: null,
|
2420 | domNamespace: parentNamespace,
|
2421 | children: _nextChildren2,
|
2422 | childIndex: 0,
|
2423 | context: context,
|
2424 | footer: ''
|
2425 | };
|
2426 | {
|
2427 | _frame2.debugElementStack = [];
|
2428 | }
|
2429 | this.stack.push(_frame2);
|
2430 | return '';
|
2431 | }
|
2432 | case REACT_PROVIDER_TYPE:
|
2433 | {
|
2434 | var provider = nextChild;
|
2435 | var nextProps = provider.props;
|
2436 | var _nextChildren3 = toArray(nextProps.children);
|
2437 | var _frame3 = {
|
2438 | type: provider,
|
2439 | domNamespace: parentNamespace,
|
2440 | children: _nextChildren3,
|
2441 | childIndex: 0,
|
2442 | context: context,
|
2443 | footer: ''
|
2444 | };
|
2445 | {
|
2446 | _frame3.debugElementStack = [];
|
2447 | }
|
2448 |
|
2449 | this.pushProvider(provider);
|
2450 |
|
2451 | this.stack.push(_frame3);
|
2452 | return '';
|
2453 | }
|
2454 | case REACT_CONTEXT_TYPE:
|
2455 | {
|
2456 | var consumer = nextChild;
|
2457 | var _nextProps = consumer.props;
|
2458 | var nextValue = consumer.type._currentValue;
|
2459 |
|
2460 | var _nextChildren4 = toArray(_nextProps.children(nextValue));
|
2461 | var _frame4 = {
|
2462 | type: nextChild,
|
2463 | domNamespace: parentNamespace,
|
2464 | children: _nextChildren4,
|
2465 | childIndex: 0,
|
2466 | context: context,
|
2467 | footer: ''
|
2468 | };
|
2469 | {
|
2470 | _frame4.debugElementStack = [];
|
2471 | }
|
2472 | this.stack.push(_frame4);
|
2473 | return '';
|
2474 | }
|
2475 | default:
|
2476 | break;
|
2477 | }
|
2478 | }
|
2479 |
|
2480 | var info = '';
|
2481 | {
|
2482 | var owner = nextElement._owner;
|
2483 | if (elementType === undefined || typeof elementType === 'object' && elementType !== null && Object.keys(elementType).length === 0) {
|
2484 | 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.';
|
2485 | }
|
2486 | var ownerName = owner ? getComponentName(owner) : null;
|
2487 | if (ownerName) {
|
2488 | info += '\n\nCheck the render method of `' + ownerName + '`.';
|
2489 | }
|
2490 | }
|
2491 | invariant(false, 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s', elementType == null ? elementType : typeof elementType, info);
|
2492 | }
|
2493 | };
|
2494 |
|
2495 | ReactDOMServerRenderer.prototype.renderDOM = function renderDOM(element, context, parentNamespace) {
|
2496 | var tag = element.type.toLowerCase();
|
2497 |
|
2498 | var namespace = parentNamespace;
|
2499 | if (parentNamespace === Namespaces.html) {
|
2500 | namespace = getIntrinsicNamespace(tag);
|
2501 | }
|
2502 |
|
2503 | {
|
2504 | if (namespace === Namespaces.html) {
|
2505 |
|
2506 |
|
2507 | !(tag === element.type) ? warning(false, '<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', element.type) : void 0;
|
2508 | }
|
2509 | }
|
2510 |
|
2511 | validateDangerousTag(tag);
|
2512 |
|
2513 | var props = element.props;
|
2514 | if (tag === 'input') {
|
2515 | {
|
2516 | ReactControlledValuePropTypes.checkPropTypes('input', props, getStackAddendum);
|
2517 |
|
2518 | if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnDefaultChecked) {
|
2519 | warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
|
2520 | didWarnDefaultChecked = true;
|
2521 | }
|
2522 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultInputValue) {
|
2523 | warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', 'A component', props.type);
|
2524 | didWarnDefaultInputValue = true;
|
2525 | }
|
2526 | }
|
2527 |
|
2528 | props = _assign({
|
2529 | type: undefined
|
2530 | }, props, {
|
2531 | defaultChecked: undefined,
|
2532 | defaultValue: undefined,
|
2533 | value: props.value != null ? props.value : props.defaultValue,
|
2534 | checked: props.checked != null ? props.checked : props.defaultChecked
|
2535 | });
|
2536 | } else if (tag === 'textarea') {
|
2537 | {
|
2538 | ReactControlledValuePropTypes.checkPropTypes('textarea', props, getStackAddendum);
|
2539 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultTextareaValue) {
|
2540 | warning(false, 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
|
2541 | didWarnDefaultTextareaValue = true;
|
2542 | }
|
2543 | }
|
2544 |
|
2545 | var initialValue = props.value;
|
2546 | if (initialValue == null) {
|
2547 | var defaultValue = props.defaultValue;
|
2548 |
|
2549 | var textareaChildren = props.children;
|
2550 | if (textareaChildren != null) {
|
2551 | {
|
2552 | warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.');
|
2553 | }
|
2554 | !(defaultValue == null) ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : void 0;
|
2555 | if (Array.isArray(textareaChildren)) {
|
2556 | !(textareaChildren.length <= 1) ? invariant(false, '<textarea> can only have at most one child.') : void 0;
|
2557 | textareaChildren = textareaChildren[0];
|
2558 | }
|
2559 |
|
2560 | defaultValue = '' + textareaChildren;
|
2561 | }
|
2562 | if (defaultValue == null) {
|
2563 | defaultValue = '';
|
2564 | }
|
2565 | initialValue = defaultValue;
|
2566 | }
|
2567 |
|
2568 | props = _assign({}, props, {
|
2569 | value: undefined,
|
2570 | children: '' + initialValue
|
2571 | });
|
2572 | } else if (tag === 'select') {
|
2573 | {
|
2574 | ReactControlledValuePropTypes.checkPropTypes('select', props, getStackAddendum);
|
2575 |
|
2576 | for (var i = 0; i < valuePropNames.length; i++) {
|
2577 | var propName = valuePropNames[i];
|
2578 | if (props[propName] == null) {
|
2579 | continue;
|
2580 | }
|
2581 | var isArray = Array.isArray(props[propName]);
|
2582 | if (props.multiple && !isArray) {
|
2583 | warning(false, 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, ''
|
2584 | );
|
2585 | } else if (!props.multiple && isArray) {
|
2586 | warning(false, 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, ''
|
2587 | );
|
2588 | }
|
2589 | }
|
2590 |
|
2591 | if (props.value !== undefined && props.defaultValue !== undefined && !didWarnDefaultSelectValue) {
|
2592 | warning(false, 'Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components');
|
2593 | didWarnDefaultSelectValue = true;
|
2594 | }
|
2595 | }
|
2596 | this.currentSelectValue = props.value != null ? props.value : props.defaultValue;
|
2597 | props = _assign({}, props, {
|
2598 | value: undefined
|
2599 | });
|
2600 | } else if (tag === 'option') {
|
2601 | var selected = null;
|
2602 | var selectValue = this.currentSelectValue;
|
2603 | var optionChildren = flattenOptionChildren(props.children);
|
2604 | if (selectValue != null) {
|
2605 | var value = void 0;
|
2606 | if (props.value != null) {
|
2607 | value = props.value + '';
|
2608 | } else {
|
2609 | value = optionChildren;
|
2610 | }
|
2611 | selected = false;
|
2612 | if (Array.isArray(selectValue)) {
|
2613 |
|
2614 | for (var j = 0; j < selectValue.length; j++) {
|
2615 | if ('' + selectValue[j] === value) {
|
2616 | selected = true;
|
2617 | break;
|
2618 | }
|
2619 | }
|
2620 | } else {
|
2621 | selected = '' + selectValue === value;
|
2622 | }
|
2623 |
|
2624 | props = _assign({
|
2625 | selected: undefined,
|
2626 | children: undefined
|
2627 | }, props, {
|
2628 | selected: selected,
|
2629 | children: optionChildren
|
2630 | });
|
2631 | }
|
2632 | }
|
2633 |
|
2634 | {
|
2635 | validatePropertiesInDevelopment(tag, props);
|
2636 | }
|
2637 |
|
2638 | assertValidProps(tag, props, getStackAddendum);
|
2639 |
|
2640 | var out = createOpenTagMarkup(element.type, tag, props, namespace, this.makeStaticMarkup, this.stack.length === 1);
|
2641 | var footer = '';
|
2642 | if (omittedCloseTags.hasOwnProperty(tag)) {
|
2643 | out += '/>';
|
2644 | } else {
|
2645 | out += '>';
|
2646 | footer = '</' + element.type + '>';
|
2647 | }
|
2648 | var children = void 0;
|
2649 | var innerMarkup = getNonChildrenInnerMarkup(props);
|
2650 | if (innerMarkup != null) {
|
2651 | children = [];
|
2652 | if (newlineEatingTags[tag] && innerMarkup.charAt(0) === '\n') {
|
2653 |
|
2654 |
|
2655 |
|
2656 |
|
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 |
|
2663 | out += '\n';
|
2664 | }
|
2665 | out += innerMarkup;
|
2666 | } else {
|
2667 | children = toArray(props.children);
|
2668 | }
|
2669 | var frame = {
|
2670 | domNamespace: getChildNamespace(parentNamespace, element.type),
|
2671 | type: tag,
|
2672 | children: children,
|
2673 | childIndex: 0,
|
2674 | context: context,
|
2675 | footer: footer
|
2676 | };
|
2677 | {
|
2678 | frame.debugElementStack = [];
|
2679 | }
|
2680 | this.stack.push(frame);
|
2681 | this.previousWasTextNode = false;
|
2682 | return out;
|
2683 | };
|
2684 |
|
2685 | return ReactDOMServerRenderer;
|
2686 | }();
|
2687 |
|
2688 |
|
2689 |
|
2690 |
|
2691 |
|
2692 |
|
2693 | function renderToString(element) {
|
2694 | var renderer = new ReactDOMServerRenderer(element, false);
|
2695 | var markup = renderer.read(Infinity);
|
2696 | return markup;
|
2697 | }
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 |
|
2704 | function renderToStaticMarkup(element) {
|
2705 | var renderer = new ReactDOMServerRenderer(element, true);
|
2706 | var markup = renderer.read(Infinity);
|
2707 | return markup;
|
2708 | }
|
2709 |
|
2710 | function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
2711 |
|
2712 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
2713 |
|
2714 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
2715 |
|
2716 |
|
2717 |
|
2718 | var ReactMarkupReadableStream = function (_Readable) {
|
2719 | _inherits(ReactMarkupReadableStream, _Readable);
|
2720 |
|
2721 | function ReactMarkupReadableStream(element, makeStaticMarkup) {
|
2722 | _classCallCheck$1(this, ReactMarkupReadableStream);
|
2723 |
|
2724 | var _this = _possibleConstructorReturn(this, _Readable.call(this, {}));
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 | _this.partialRenderer = new ReactDOMServerRenderer(element, makeStaticMarkup);
|
2730 | return _this;
|
2731 | }
|
2732 |
|
2733 | ReactMarkupReadableStream.prototype._read = function _read(size) {
|
2734 | try {
|
2735 | this.push(this.partialRenderer.read(size));
|
2736 | } catch (err) {
|
2737 | this.emit('error', err);
|
2738 | }
|
2739 | };
|
2740 |
|
2741 | return ReactMarkupReadableStream;
|
2742 | }(stream.Readable);
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 |
|
2748 |
|
2749 |
|
2750 | function renderToNodeStream(element) {
|
2751 | return new ReactMarkupReadableStream(element, false);
|
2752 | }
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 | function renderToStaticNodeStream(element) {
|
2760 | return new ReactMarkupReadableStream(element, true);
|
2761 | }
|
2762 |
|
2763 |
|
2764 | var ReactDOMServerNode = {
|
2765 | renderToString: renderToString,
|
2766 | renderToStaticMarkup: renderToStaticMarkup,
|
2767 | renderToNodeStream: renderToNodeStream,
|
2768 | renderToStaticNodeStream: renderToStaticNodeStream,
|
2769 | version: ReactVersion
|
2770 | };
|
2771 |
|
2772 | var ReactDOMServerNode$1 = Object.freeze({
|
2773 | default: ReactDOMServerNode
|
2774 | });
|
2775 |
|
2776 | var ReactDOMServer = ( ReactDOMServerNode$1 && ReactDOMServerNode ) || ReactDOMServerNode$1;
|
2777 |
|
2778 |
|
2779 |
|
2780 | var server_node = ReactDOMServer.default ? ReactDOMServer.default : ReactDOMServer;
|
2781 |
|
2782 | module.exports = server_node;
|
2783 | })();
|
2784 | }
|