Remove UMD builds from fixture directory (#10547)
Andrew Clark committed
Aug 25, 2017 at 17:17 UTC
b9c8e4e9df3a5a70267b40296be51b0977286558
5 files changed
+3
-24707
.eslintignore
-2
@@ -13,8 +13,6 @@ fixtures/
13
# Ignore built files.
14
build/
15
coverage/
16
-fixtures/attribute-behavior/public/react-dom.production.min.js
17
-fixtures/attribute-behavior/public/react.production.min.js
16
scripts/bench/benchmarks/**/*.js
17
scripts/bench/remote-repo/
18
vendor/*
fixtures/attribute-behavior/.gitignore
+2
@@ -8,6 +8,8 @@
8
9
# production
10
/build
11
+/public/react.development.js
12
+/public/react-dom.development.js
13
14
# misc
15
.DS_Store
fixtures/attribute-behavior/public/react-dom.development.js
deleted
-22296
@@ -1,22296 +0,0 @@
1
-/**
2
- * react-dom.development.js v16.0.0-beta.5
3
- */
4
-
5
-(function(global, factory) {
6
- typeof exports === 'object' && typeof module !== 'undefined'
7
- ? (module.exports = factory(require('react')))
8
- : typeof define === 'function' && define.amd
9
- ? define(['react'], factory)
10
- : (global.ReactDOM = factory(global.React));
11
-})(this, function(react) {
12
- 'use strict';
13
- /**
14
- * Copyright (c) 2013-present, Facebook, Inc.
15
- * All rights reserved.
16
- *
17
- * This source code is licensed under the BSD-style license found in the
18
- * LICENSE file in the root directory of this source tree. An additional grant
19
- * of patent rights can be found in the PATENTS file in the same directory.
20
- *
21
- * @providesModule reactProdInvariant
22
- *
23
- */
24
-
25
- /**
26
- * Copyright (c) 2013-present, Facebook, Inc.
27
- * All rights reserved.
28
- *
29
- * This source code is licensed under the BSD-style license found in the
30
- * LICENSE file in the root directory of this source tree. An additional grant
31
- * of patent rights can be found in the PATENTS file in the same directory.
32
- *
33
- */
34
-
35
- /**
36
- * Use invariant() to assert state which your program assumes to be true.
37
- *
38
- * Provide sprintf-style format (only %s is supported) and arguments
39
- * to provide information about what broke and what you were
40
- * expecting.
41
- *
42
- * The invariant message will be stripped in production, but the invariant
43
- * will remain to ensure logic does not differ in production.
44
- */
45
-
46
- var validateFormat = function validateFormat(format) {};
47
-
48
- {
49
- validateFormat = function validateFormat(format) {
50
- if (format === undefined) {
51
- throw new Error('invariant requires an error message argument');
52
- }
53
- };
54
- }
55
-
56
- function invariant(condition, format, a, b, c, d, e, f) {
57
- validateFormat(format);
58
-
59
- if (!condition) {
60
- var error;
61
- if (format === undefined) {
62
- error = new Error(
63
- 'Minified exception occurred; use the non-minified dev environment ' +
64
- 'for the full error message and additional helpful warnings.'
65
- );
66
- } else {
67
- var args = [a, b, c, d, e, f];
68
- var argIndex = 0;
69
- error = new Error(
70
- format.replace(/%s/g, function() {
71
- return args[argIndex++];
72
- })
73
- );
74
- error.name = 'Invariant Violation';
75
- }
76
-
77
- error.framesToPop = 1; // we don't care about invariant's own frame
78
- throw error;
79
- }
80
- }
81
-
82
- var invariant_1 = invariant;
83
-
84
- /**
85
- * Copyright 2013-present, Facebook, Inc.
86
- * All rights reserved.
87
- *
88
- * This source code is licensed under the BSD-style license found in the
89
- * LICENSE file in the root directory of this source tree. An additional grant
90
- * of patent rights can be found in the PATENTS file in the same directory.
91
- *
92
- * @providesModule checkReact
93
- *
94
- */
95
-
96
- invariant_1(
97
- react,
98
- 'ReactDOM was loaded before React. Make sure you load ' +
99
- 'the React package before loading ReactDOM.'
100
- );
101
-
102
- /**
103
- * Copyright 2013-present, Facebook, Inc.
104
- * All rights reserved.
105
- *
106
- * This source code is licensed under the BSD-style license found in the
107
- * LICENSE file in the root directory of this source tree. An additional grant
108
- * of patent rights can be found in the PATENTS file in the same directory.
109
- *
110
- * @providesModule DOMNamespaces
111
- */
112
-
113
- var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
114
- var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
115
- var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
116
-
117
- var Namespaces = {
118
- html: HTML_NAMESPACE,
119
- mathml: MATH_NAMESPACE,
120
- svg: SVG_NAMESPACE,
121
- };
122
-
123
- // Assumes there is no parent namespace.
124
- function getIntrinsicNamespace(type) {
125
- switch (type) {
126
- case 'svg':
127
- return SVG_NAMESPACE;
128
- case 'math':
129
- return MATH_NAMESPACE;
130
- default:
131
- return HTML_NAMESPACE;
132
- }
133
- }
134
-
135
- function getChildNamespace$1(parentNamespace, type) {
136
- if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
137
- // No (or default) parent namespace: potential entry point.
138
- return getIntrinsicNamespace(type);
139
- }
140
- if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') {
141
- // We're leaving SVG.
142
- return HTML_NAMESPACE;
143
- }
144
- // By default, pass namespace below.
145
- return parentNamespace;
146
- }
147
-
148
- var Namespaces_1 = Namespaces;
149
- var getIntrinsicNamespace_1 = getIntrinsicNamespace;
150
- var getChildNamespace_1 = getChildNamespace$1;
151
-
152
- var DOMNamespaces = {
153
- Namespaces: Namespaces_1,
154
- getIntrinsicNamespace: getIntrinsicNamespace_1,
155
- getChildNamespace: getChildNamespace_1,
156
- };
157
-
158
- /**
159
- * Copyright (c) 2013-present, Facebook, Inc.
160
- * All rights reserved.
161
- *
162
- * This source code is licensed under the BSD-style license found in the
163
- * LICENSE file in the root directory of this source tree. An additional grant
164
- * of patent rights can be found in the PATENTS file in the same directory.
165
- *
166
- */
167
-
168
- var canUseDOM = !!(typeof window !== 'undefined' &&
169
- window.document &&
170
- window.document.createElement);
171
-
172
- /**
173
- * Simple, lightweight module assisting with the detection and context of
174
- * Worker. Helps avoid circular dependencies and allows code to reason about
175
- * whether or not they are in a Worker, even if they never include the main
176
- * `ReactWorker` dependency.
177
- */
178
- var ExecutionEnvironment = {
179
- canUseDOM: canUseDOM,
180
-
181
- canUseWorkers: typeof Worker !== 'undefined',
182
-
183
- canUseEventListeners: canUseDOM &&
184
- !!(window.addEventListener || window.attachEvent),
185
-
186
- canUseViewport: canUseDOM && !!window.screen,
187
-
188
- isInWorker: !canUseDOM, // For now, this is true - might change in the future.
189
- };
190
-
191
- var ExecutionEnvironment_1 = ExecutionEnvironment;
192
-
193
- /*
194
-object-assign
195
-(c) Sindre Sorhus
196
-@license MIT
197
-*/
198
-
199
- /* eslint-disable no-unused-vars */
200
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
201
- var hasOwnProperty = Object.prototype.hasOwnProperty;
202
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
203
-
204
- function toObject(val) {
205
- if (val === null || val === undefined) {
206
- throw new TypeError(
207
- 'Object.assign cannot be called with null or undefined'
208
- );
209
- }
210
-
211
- return Object(val);
212
- }
213
-
214
- function shouldUseNative() {
215
- try {
216
- if (!Object.assign) {
217
- return false;
218
- }
219
-
220
- // Detect buggy property enumeration order in older V8 versions.
221
-
222
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
223
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
224
- test1[5] = 'de';
225
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
226
- return false;
227
- }
228
-
229
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
230
- var test2 = {};
231
- for (var i = 0; i < 10; i++) {
232
- test2['_' + String.fromCharCode(i)] = i;
233
- }
234
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
235
- return test2[n];
236
- });
237
- if (order2.join('') !== '0123456789') {
238
- return false;
239
- }
240
-
241
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
242
- var test3 = {};
243
- 'abcdefghijklmnopqrst'.split('').forEach(function(letter) {
244
- test3[letter] = letter;
245
- });
246
- if (
247
- Object.keys(Object.assign({}, test3)).join('') !==
248
- 'abcdefghijklmnopqrst'
249
- ) {
250
- return false;
251
- }
252
-
253
- return true;
254
- } catch (err) {
255
- // We don't expect any of the above to throw, but better to be safe.
256
- return false;
257
- }
258
- }
259
-
260
- var index = shouldUseNative()
261
- ? Object.assign
262
- : function(target, source) {
263
- var from;
264
- var to = toObject(target);
265
- var symbols;
266
-
267
- for (var s = 1; s < arguments.length; s++) {
268
- from = Object(arguments[s]);
269
-
270
- for (var key in from) {
271
- if (hasOwnProperty.call(from, key)) {
272
- to[key] = from[key];
273
- }
274
- }
275
-
276
- if (getOwnPropertySymbols) {
277
- symbols = getOwnPropertySymbols(from);
278
- for (var i = 0; i < symbols.length; i++) {
279
- if (propIsEnumerable.call(from, symbols[i])) {
280
- to[symbols[i]] = from[symbols[i]];
281
- }
282
- }
283
- }
284
- }
285
-
286
- return to;
287
- };
288
-
289
- /**
290
- * Injectable ordering of event plugins.
291
- */
292
- var eventPluginOrder = null;
293
-
294
- /**
295
- * Injectable mapping from names to event plugin modules.
296
- */
297
- var namesToPlugins = {};
298
-
299
- /**
300
- * Recomputes the plugin list using the injected plugins and plugin ordering.
301
- *
302
- * @private
303
- */
304
- function recomputePluginOrdering() {
305
- if (!eventPluginOrder) {
306
- // Wait until an `eventPluginOrder` is injected.
307
- return;
308
- }
309
- for (var pluginName in namesToPlugins) {
310
- var pluginModule = namesToPlugins[pluginName];
311
- var pluginIndex = eventPluginOrder.indexOf(pluginName);
312
- !(pluginIndex > -1)
313
- ? invariant_1(
314
- false,
315
- 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.',
316
- pluginName
317
- )
318
- : void 0;
319
- if (EventPluginRegistry.plugins[pluginIndex]) {
320
- continue;
321
- }
322
- !pluginModule.extractEvents
323
- ? invariant_1(
324
- false,
325
- 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.',
326
- pluginName
327
- )
328
- : void 0;
329
- EventPluginRegistry.plugins[pluginIndex] = pluginModule;
330
- var publishedEvents = pluginModule.eventTypes;
331
- for (var eventName in publishedEvents) {
332
- !publishEventForPlugin(
333
- publishedEvents[eventName],
334
- pluginModule,
335
- eventName
336
- )
337
- ? invariant_1(
338
- false,
339
- 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
340
- eventName,
341
- pluginName
342
- )
343
- : void 0;
344
- }
345
- }
346
- }
347
-
348
- /**
349
- * Publishes an event so that it can be dispatched by the supplied plugin.
350
- *
351
- * @param {object} dispatchConfig Dispatch configuration for the event.
352
- * @param {object} PluginModule Plugin publishing the event.
353
- * @return {boolean} True if the event was successfully published.
354
- * @private
355
- */
356
- function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
357
- !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)
358
- ? invariant_1(
359
- false,
360
- 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.',
361
- eventName
362
- )
363
- : void 0;
364
- EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
365
-
366
- var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
367
- if (phasedRegistrationNames) {
368
- for (var phaseName in phasedRegistrationNames) {
369
- if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
370
- var phasedRegistrationName = phasedRegistrationNames[phaseName];
371
- publishRegistrationName(
372
- phasedRegistrationName,
373
- pluginModule,
374
- eventName
375
- );
376
- }
377
- }
378
- return true;
379
- } else if (dispatchConfig.registrationName) {
380
- publishRegistrationName(
381
- dispatchConfig.registrationName,
382
- pluginModule,
383
- eventName
384
- );
385
- return true;
386
- }
387
- return false;
388
- }
389
-
390
- /**
391
- * Publishes a registration name that is used to identify dispatched events.
392
- *
393
- * @param {string} registrationName Registration name to add.
394
- * @param {object} PluginModule Plugin publishing the event.
395
- * @private
396
- */
397
- function publishRegistrationName(registrationName, pluginModule, eventName) {
398
- !!EventPluginRegistry.registrationNameModules[registrationName]
399
- ? invariant_1(
400
- false,
401
- 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.',
402
- registrationName
403
- )
404
- : void 0;
405
- EventPluginRegistry.registrationNameModules[
406
- registrationName
407
- ] = pluginModule;
408
- EventPluginRegistry.registrationNameDependencies[registrationName] =
409
- pluginModule.eventTypes[eventName].dependencies;
410
-
411
- {
412
- var lowerCasedName = registrationName.toLowerCase();
413
- EventPluginRegistry.possibleRegistrationNames[
414
- lowerCasedName
415
- ] = registrationName;
416
-
417
- if (registrationName === 'onDoubleClick') {
418
- EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName;
419
- }
420
- }
421
- }
422
-
423
- /**
424
- * Registers plugins so that they can extract and dispatch events.
425
- *
426
- * @see {EventPluginHub}
427
- */
428
- var EventPluginRegistry = {
429
- /**
430
- * Ordered list of injected plugins.
431
- */
432
- plugins: [],
433
-
434
- /**
435
- * Mapping from event name to dispatch config
436
- */
437
- eventNameDispatchConfigs: {},
438
-
439
- /**
440
- * Mapping from registration name to plugin module
441
- */
442
- registrationNameModules: {},
443
-
444
- /**
445
- * Mapping from registration name to event name
446
- */
447
- registrationNameDependencies: {},
448
-
449
- /**
450
- * Mapping from lowercase registration names to the properly cased version,
451
- * used to warn in the case of missing event handlers. Available
452
- * only in true.
453
- * @type {Object}
454
- */
455
- possibleRegistrationNames: {},
456
- // Trust the developer to only use possibleRegistrationNames in true
457
-
458
- /**
459
- * Injects an ordering of plugins (by plugin name). This allows the ordering
460
- * to be decoupled from injection of the actual plugins so that ordering is
461
- * always deterministic regardless of packaging, on-the-fly injection, etc.
462
- *
463
- * @param {array} InjectedEventPluginOrder
464
- * @internal
465
- * @see {EventPluginHub.injection.injectEventPluginOrder}
466
- */
467
- injectEventPluginOrder: function(injectedEventPluginOrder) {
468
- !!eventPluginOrder
469
- ? invariant_1(
470
- false,
471
- 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.'
472
- )
473
- : void 0;
474
- // Clone the ordering so it cannot be dynamically mutated.
475
- eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
476
- recomputePluginOrdering();
477
- },
478
-
479
- /**
480
- * Injects plugins to be used by `EventPluginHub`. The plugin names must be
481
- * in the ordering injected by `injectEventPluginOrder`.
482
- *
483
- * Plugins can be injected as part of page initialization or on-the-fly.
484
- *
485
- * @param {object} injectedNamesToPlugins Map from names to plugin modules.
486
- * @internal
487
- * @see {EventPluginHub.injection.injectEventPluginsByName}
488
- */
489
- injectEventPluginsByName: function(injectedNamesToPlugins) {
490
- var isOrderingDirty = false;
491
- for (var pluginName in injectedNamesToPlugins) {
492
- if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
493
- continue;
494
- }
495
- var pluginModule = injectedNamesToPlugins[pluginName];
496
- if (
497
- !namesToPlugins.hasOwnProperty(pluginName) ||
498
- namesToPlugins[pluginName] !== pluginModule
499
- ) {
500
- !!namesToPlugins[pluginName]
501
- ? invariant_1(
502
- false,
503
- 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.',
504
- pluginName
505
- )
506
- : void 0;
507
- namesToPlugins[pluginName] = pluginModule;
508
- isOrderingDirty = true;
509
- }
510
- }
511
- if (isOrderingDirty) {
512
- recomputePluginOrdering();
513
- }
514
- },
515
- };
516
-
517
- var EventPluginRegistry_1 = EventPluginRegistry;
518
-
519
- /**
520
- * Copyright (c) 2013-present, Facebook, Inc.
521
- * All rights reserved.
522
- *
523
- * This source code is licensed under the BSD-style license found in the
524
- * LICENSE file in the root directory of this source tree. An additional grant
525
- * of patent rights can be found in the PATENTS file in the same directory.
526
- *
527
- *
528
- */
529
-
530
- function makeEmptyFunction(arg) {
531
- return function() {
532
- return arg;
533
- };
534
- }
535
-
536
- /**
537
- * This function accepts and discards inputs; it has no side effects. This is
538
- * primarily useful idiomatically for overridable function endpoints which
539
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
540
- */
541
- var emptyFunction = function emptyFunction() {};
542
-
543
- emptyFunction.thatReturns = makeEmptyFunction;
544
- emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
545
- emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
546
- emptyFunction.thatReturnsNull = makeEmptyFunction(null);
547
- emptyFunction.thatReturnsThis = function() {
548
- return this;
549
- };
550
- emptyFunction.thatReturnsArgument = function(arg) {
551
- return arg;
552
- };
553
-
554
- var emptyFunction_1 = emptyFunction;
555
-
556
- /**
557
- * Copyright (c) 2013-present, Facebook, Inc.
558
- *
559
- * Licensed under the Apache License, Version 2.0 (the "License");
560
- * you may not use this file except in compliance with the License.
561
- * You may obtain a copy of the License at
562
- *
563
- * http://www.apache.org/licenses/LICENSE-2.0
564
- *
565
- * Unless required by applicable law or agreed to in writing, software
566
- * distributed under the License is distributed on an "AS IS" BASIS,
567
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
568
- * See the License for the specific language governing permissions and
569
- * limitations under the License.
570
- *
571
- * @typechecks
572
- */
573
-
574
- /**
575
- * Upstream version of event listener. Does not take into account specific
576
- * nature of platform.
577
- */
578
- var EventListener = {
579
- /**
580
- * Listen to DOM events during the bubble phase.
581
- *
582
- * @param {DOMEventTarget} target DOM element to register listener on.
583
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
584
- * @param {function} callback Callback function.
585
- * @return {object} Object with a `remove` method.
586
- */
587
- listen: function listen(target, eventType, callback) {
588
- if (target.addEventListener) {
589
- target.addEventListener(eventType, callback, false);
590
- return {
591
- remove: function remove() {
592
- target.removeEventListener(eventType, callback, false);
593
- },
594
- };
595
- } else if (target.attachEvent) {
596
- target.attachEvent('on' + eventType, callback);
597
- return {
598
- remove: function remove() {
599
- target.detachEvent('on' + eventType, callback);
600
- },
601
- };
602
- }
603
- },
604
-
605
- /**
606
- * Listen to DOM events during the capture phase.
607
- *
608
- * @param {DOMEventTarget} target DOM element to register listener on.
609
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
610
- * @param {function} callback Callback function.
611
- * @return {object} Object with a `remove` method.
612
- */
613
- capture: function capture(target, eventType, callback) {
614
- if (target.addEventListener) {
615
- target.addEventListener(eventType, callback, true);
616
- return {
617
- remove: function remove() {
618
- target.removeEventListener(eventType, callback, true);
619
- },
620
- };
621
- } else {
622
- {
623
- console.error(
624
- 'Attempted to listen to events during the capture phase on a ' +
625
- 'browser that does not support the capture phase. Your application ' +
626
- 'will not receive some events.'
627
- );
628
- }
629
- return {
630
- remove: emptyFunction_1,
631
- };
632
- }
633
- },
634
-
635
- registerDefault: function registerDefault() {},
636
- };
637
-
638
- var EventListener_1 = EventListener;
639
-
640
- // These attributes should be all lowercase to allow for
641
- // case insensitive checks
642
- var RESERVED_PROPS = {
643
- children: true,
644
- dangerouslysetinnerhtml: true,
645
- autofocus: true,
646
- defaultvalue: true,
647
- defaultchecked: true,
648
- innerhtml: true,
649
- suppresscontenteditablewarning: true,
650
- onfocusin: true,
651
- onfocusout: true,
652
- style: true,
653
- };
654
-
655
- function checkMask(value, bitmask) {
656
- return (value & bitmask) === bitmask;
657
- }
658
-
659
- var DOMPropertyInjection = {
660
- /**
661
- * Mapping from normalized, camelcased property names to a configuration that
662
- * specifies how the associated DOM property should be accessed or rendered.
663
- */
664
- MUST_USE_PROPERTY: 0x1,
665
- HAS_BOOLEAN_VALUE: 0x4,
666
- HAS_NUMERIC_VALUE: 0x8,
667
- HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8,
668
- HAS_OVERLOADED_BOOLEAN_VALUE: 0x20,
669
-
670
- /**
671
- * Inject some specialized knowledge about the DOM. This takes a config object
672
- * with the following properties:
673
- *
674
- * Properties: object mapping DOM property name to one of the
675
- * DOMPropertyInjection constants or null. If your attribute isn't in here,
676
- * it won't get written to the DOM.
677
- *
678
- * DOMAttributeNames: object mapping React attribute name to the DOM
679
- * attribute name. Attribute names not specified use the **lowercase**
680
- * normalized name.
681
- *
682
- * DOMAttributeNamespaces: object mapping React attribute name to the DOM
683
- * attribute namespace URL. (Attribute names not specified use no namespace.)
684
- *
685
- * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
686
- * Property names not specified use the normalized name.
687
- *
688
- * DOMMutationMethods: Properties that require special mutation methods. If
689
- * `value` is undefined, the mutation method should unset the property.
690
- *
691
- * @param {object} domPropertyConfig the config as described above.
692
- */
693
- injectDOMPropertyConfig: function(domPropertyConfig) {
694
- var Injection = DOMPropertyInjection;
695
- var Properties = domPropertyConfig.Properties || {};
696
- var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {
697
- };
698
- var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
699
- var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
700
-
701
- for (var propName in Properties) {
702
- !!DOMProperty.properties.hasOwnProperty(propName)
703
- ? invariant_1(
704
- false,
705
- "injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",
706
- propName
707
- )
708
- : void 0;
709
-
710
- var lowerCased = propName.toLowerCase();
711
- var propConfig = Properties[propName];
712
-
713
- var propertyInfo = {
714
- attributeName: lowerCased,
715
- attributeNamespace: null,
716
- propertyName: propName,
717
- mutationMethod: null,
718
-
719
- mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
720
- hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
721
- hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
722
- hasPositiveNumericValue: checkMask(
723
- propConfig,
724
- Injection.HAS_POSITIVE_NUMERIC_VALUE
725
- ),
726
- hasOverloadedBooleanValue: checkMask(
727
- propConfig,
728
- Injection.HAS_OVERLOADED_BOOLEAN_VALUE
729
- ),
730
- };
731
- !(propertyInfo.hasBooleanValue +
732
- propertyInfo.hasNumericValue +
733
- propertyInfo.hasOverloadedBooleanValue <=
734
- 1)
735
- ? invariant_1(
736
- false,
737
- 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s',
738
- propName
739
- )
740
- : void 0;
741
-
742
- if (DOMAttributeNames.hasOwnProperty(propName)) {
743
- var attributeName = DOMAttributeNames[propName];
744
-
745
- propertyInfo.attributeName = attributeName;
746
- }
747
-
748
- if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
749
- propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
750
- }
751
-
752
- if (DOMMutationMethods.hasOwnProperty(propName)) {
753
- propertyInfo.mutationMethod = DOMMutationMethods[propName];
754
- }
755
-
756
- // Downcase references to whitelist properties to check for membership
757
- // without case-sensitivity. This allows the whitelist to pick up
758
- // `allowfullscreen`, which should be written using the property configuration
759
- // for `allowFullscreen`
760
- DOMProperty.properties[propName] = propertyInfo;
761
- }
762
- },
763
- };
764
-
765
- /* eslint-disable max-len */
766
- var ATTRIBUTE_NAME_START_CHAR =
767
- ':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';
768
- /* eslint-enable max-len */
769
-
770
- /**
771
- * DOMProperty exports lookup objects that can be used like functions:
772
- *
773
- * > DOMProperty.isValid['id']
774
- * true
775
- * > DOMProperty.isValid['foobar']
776
- * undefined
777
- *
778
- * Although this may be confusing, it performs better in general.
779
- *
780
- * @see http://jsperf.com/key-exists
781
- * @see http://jsperf.com/key-missing
782
- */
783
- var DOMProperty = {
784
- ID_ATTRIBUTE_NAME: 'data-reactid',
785
- ROOT_ATTRIBUTE_NAME: 'data-reactroot',
786
-
787
- ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR,
788
- ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR +
789
- '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040',
790
-
791
- /**
792
- * Map from property "standard name" to an object with info about how to set
793
- * the property in the DOM. Each object contains:
794
- *
795
- * attributeName:
796
- * Used when rendering markup or with `*Attribute()`.
797
- * attributeNamespace
798
- * propertyName:
799
- * Used on DOM node instances. (This includes properties that mutate due to
800
- * external factors.)
801
- * mutationMethod:
802
- * If non-null, used instead of the property or `setAttribute()` after
803
- * initial render.
804
- * mustUseProperty:
805
- * Whether the property must be accessed and mutated as an object property.
806
- * hasBooleanValue:
807
- * Whether the property should be removed when set to a falsey value.
808
- * hasNumericValue:
809
- * Whether the property must be numeric or parse as a numeric and should be
810
- * removed when set to a falsey value.
811
- * hasPositiveNumericValue:
812
- * Whether the property must be positive numeric or parse as a positive
813
- * numeric and should be removed when set to a falsey value.
814
- * hasOverloadedBooleanValue:
815
- * Whether the property can be used as a flag as well as with a value.
816
- * Removed when strictly equal to false; present without a value when
817
- * strictly equal to true; present with a value otherwise.
818
- */
819
- properties: {},
820
-
821
- /**
822
- * Checks whether a property name is a writeable attribute.
823
- * @method
824
- */
825
- shouldSetAttribute: function(name, value) {
826
- if (DOMProperty.isReservedProp(name)) {
827
- return false;
828
- }
829
-
830
- if (value === null) {
831
- return true;
832
- }
833
-
834
- var lowerCased = name.toLowerCase();
835
-
836
- var propertyInfo = DOMProperty.properties[name];
837
-
838
- switch (typeof value) {
839
- case 'boolean':
840
- if (propertyInfo) {
841
- return true;
842
- }
843
- var prefix = lowerCased.slice(0, 5);
844
- return prefix === 'data-' || prefix === 'aria-';
845
- case 'undefined':
846
- case 'number':
847
- case 'string':
848
- return true;
849
- case 'object':
850
- return true;
851
- default:
852
- // function, symbol
853
- return false;
854
- }
855
- },
856
-
857
- getPropertyInfo: function(name) {
858
- return DOMProperty.properties.hasOwnProperty(name)
859
- ? DOMProperty.properties[name]
860
- : null;
861
- },
862
-
863
- /**
864
- * Checks to see if a property name is within the list of properties
865
- * reserved for internal React operations. These properties should
866
- * not be set on an HTML element.
867
- *
868
- * @private
869
- * @param {string} name
870
- * @return {boolean} If the name is within reserved props
871
- */
872
- isReservedProp: function(name) {
873
- return RESERVED_PROPS.hasOwnProperty(name.toLowerCase());
874
- },
875
-
876
- injection: DOMPropertyInjection,
877
- };
878
-
879
- var DOMProperty_1 = DOMProperty;
880
-
881
- /**
882
- * Copyright 2015-present, Facebook, Inc.
883
- * All rights reserved.
884
- *
885
- * This source code is licensed under the BSD-style license found in the
886
- * LICENSE file in the root directory of this source tree. An additional grant
887
- * of patent rights can be found in the PATENTS file in the same directory.
888
- *
889
- * @providesModule ReactDOMComponentFlags
890
- */
891
-
892
- var ReactDOMComponentFlags = {
893
- hasCachedChildNodes: 1 << 0,
894
- };
895
-
896
- var ReactDOMComponentFlags_1 = ReactDOMComponentFlags;
897
-
898
- /**
899
- * Copyright 2013-present, Facebook, Inc.
900
- * All rights reserved.
901
- *
902
- * This source code is licensed under the BSD-style license found in the
903
- * LICENSE file in the root directory of this source tree. An additional grant
904
- * of patent rights can be found in the PATENTS file in the same directory.
905
- *
906
- * @providesModule ReactTypeOfWork
907
- *
908
- */
909
-
910
- var ReactTypeOfWork = {
911
- IndeterminateComponent: 0, // Before we know whether it is functional or class
912
- FunctionalComponent: 1,
913
- ClassComponent: 2,
914
- HostRoot: 3, // Root of a host tree. Could be nested inside another node.
915
- HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
916
- HostComponent: 5,
917
- HostText: 6,
918
- CoroutineComponent: 7,
919
- CoroutineHandlerPhase: 8,
920
- YieldComponent: 9,
921
- Fragment: 10,
922
- };
923
-
924
- /**
925
- * Copyright 2013-present, Facebook, Inc.
926
- * All rights reserved.
927
- *
928
- * This source code is licensed under the BSD-style license found in the
929
- * LICENSE file in the root directory of this source tree. An additional grant
930
- * of patent rights can be found in the PATENTS file in the same directory.
931
- *
932
- * @providesModule HTMLNodeType
933
- */
934
-
935
- /**
936
- * HTML nodeType values that represent the type of the node
937
- */
938
-
939
- var HTMLNodeType = {
940
- ELEMENT_NODE: 1,
941
- TEXT_NODE: 3,
942
- COMMENT_NODE: 8,
943
- DOCUMENT_NODE: 9,
944
- DOCUMENT_FRAGMENT_NODE: 11,
945
- };
946
-
947
- var HTMLNodeType_1 = HTMLNodeType;
948
-
949
- var HostComponent = ReactTypeOfWork.HostComponent;
950
- var HostText = ReactTypeOfWork.HostText;
951
-
952
- var ELEMENT_NODE$1 = HTMLNodeType_1.ELEMENT_NODE;
953
- var COMMENT_NODE$1 = HTMLNodeType_1.COMMENT_NODE;
954
-
955
- var ATTR_NAME = DOMProperty_1.ID_ATTRIBUTE_NAME;
956
- var Flags = ReactDOMComponentFlags_1;
957
-
958
- var randomKey = Math.random().toString(36).slice(2);
959
-
960
- var internalInstanceKey = '__reactInternalInstance$' + randomKey;
961
-
962
- var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
963
-
964
- /**
965
- * Check if a given node should be cached.
966
- */
967
- function shouldPrecacheNode(node, nodeID) {
968
- return (
969
- (node.nodeType === ELEMENT_NODE$1 &&
970
- node.getAttribute(ATTR_NAME) === '' + nodeID) ||
971
- (node.nodeType === COMMENT_NODE$1 &&
972
- node.nodeValue === ' react-text: ' + nodeID + ' ') ||
973
- (node.nodeType === COMMENT_NODE$1 &&
974
- node.nodeValue === ' react-empty: ' + nodeID + ' ')
975
- );
976
- }
977
-
978
- /**
979
- * Drill down (through composites and empty components) until we get a host or
980
- * host text component.
981
- *
982
- * This is pretty polymorphic but unavoidable with the current structure we have
983
- * for `_renderedChildren`.
984
- */
985
- function getRenderedHostOrTextFromComponent(component) {
986
- var rendered;
987
- while ((rendered = component._renderedComponent)) {
988
- component = rendered;
989
- }
990
- return component;
991
- }
992
-
993
- /**
994
- * Populate `_hostNode` on the rendered host/text component with the given
995
- * DOM node. The passed `inst` can be a composite.
996
- */
997
- function precacheNode(inst, node) {
998
- var hostInst = getRenderedHostOrTextFromComponent(inst);
999
- hostInst._hostNode = node;
1000
- node[internalInstanceKey] = hostInst;
1001
- }
1002
-
1003
- function precacheFiberNode$1(hostInst, node) {
1004
- node[internalInstanceKey] = hostInst;
1005
- }
1006
-
1007
- function uncacheNode(inst) {
1008
- var node = inst._hostNode;
1009
- if (node) {
1010
- delete node[internalInstanceKey];
1011
- inst._hostNode = null;
1012
- }
1013
- }
1014
-
1015
- /**
1016
- * Populate `_hostNode` on each child of `inst`, assuming that the children
1017
- * match up with the DOM (element) children of `node`.
1018
- *
1019
- * We cache entire levels at once to avoid an n^2 problem where we access the
1020
- * children of a node sequentially and have to walk from the start to our target
1021
- * node every time.
1022
- *
1023
- * Since we update `_renderedChildren` and the actual DOM at (slightly)
1024
- * different times, we could race here and see a newer `_renderedChildren` than
1025
- * the DOM nodes we see. To avoid this, ReactMultiChild calls
1026
- * `prepareToManageChildren` before we change `_renderedChildren`, at which
1027
- * time the container's child nodes are always cached (until it unmounts).
1028
- */
1029
- function precacheChildNodes(inst, node) {
1030
- if (inst._flags & Flags.hasCachedChildNodes) {
1031
- return;
1032
- }
1033
- var children = inst._renderedChildren;
1034
- var childNode = node.firstChild;
1035
- outer: for (var name in children) {
1036
- if (!children.hasOwnProperty(name)) {
1037
- continue;
1038
- }
1039
- var childInst = children[name];
1040
- var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
1041
- if (childID === 0) {
1042
- // We're currently unmounting this child in ReactMultiChild; skip it.
1043
- continue;
1044
- }
1045
- // We assume the child nodes are in the same order as the child instances.
1046
- for (; childNode !== null; childNode = childNode.nextSibling) {
1047
- if (shouldPrecacheNode(childNode, childID)) {
1048
- precacheNode(childInst, childNode);
1049
- continue outer;
1050
- }
1051
- }
1052
- // We reached the end of the DOM children without finding an ID match.
1053
- invariant_1(false, 'Unable to find element with ID %s.', childID);
1054
- }
1055
- inst._flags |= Flags.hasCachedChildNodes;
1056
- }
1057
-
1058
- /**
1059
- * Given a DOM node, return the closest ReactDOMComponent or
1060
- * ReactDOMTextComponent instance ancestor.
1061
- */
1062
- function getClosestInstanceFromNode(node) {
1063
- if (node[internalInstanceKey]) {
1064
- return node[internalInstanceKey];
1065
- }
1066
-
1067
- // Walk up the tree until we find an ancestor whose instance we have cached.
1068
- var parents = [];
1069
- while (!node[internalInstanceKey]) {
1070
- parents.push(node);
1071
- if (node.parentNode) {
1072
- node = node.parentNode;
1073
- } else {
1074
- // Top of the tree. This node must not be part of a React tree (or is
1075
- // unmounted, potentially).
1076
- return null;
1077
- }
1078
- }
1079
-
1080
- var closest;
1081
- var inst = node[internalInstanceKey];
1082
- if (inst.tag === HostComponent || inst.tag === HostText) {
1083
- // In Fiber, this will always be the deepest root.
1084
- return inst;
1085
- }
1086
- for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
1087
- closest = inst;
1088
- if (parents.length) {
1089
- precacheChildNodes(inst, node);
1090
- }
1091
- }
1092
-
1093
- return closest;
1094
- }
1095
-
1096
- /**
1097
- * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
1098
- * instance, or null if the node was not rendered by this React.
1099
- */
1100
- function getInstanceFromNode(node) {
1101
- var inst = node[internalInstanceKey];
1102
- if (inst) {
1103
- if (inst.tag === HostComponent || inst.tag === HostText) {
1104
- return inst;
1105
- } else if (inst._hostNode === node) {
1106
- return inst;
1107
- } else {
1108
- return null;
1109
- }
1110
- }
1111
- inst = getClosestInstanceFromNode(node);
1112
- if (inst != null && inst._hostNode === node) {
1113
- return inst;
1114
- } else {
1115
- return null;
1116
- }
1117
- }
1118
-
1119
- /**
1120
- * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
1121
- * DOM node.
1122
- */
1123
- function getNodeFromInstance(inst) {
1124
- if (inst.tag === HostComponent || inst.tag === HostText) {
1125
- // In Fiber this, is just the state node right now. We assume it will be
1126
- // a host component or host text.
1127
- return inst.stateNode;
1128
- }
1129
-
1130
- // Without this first invariant, passing a non-DOM-component triggers the next
1131
- // invariant for a missing parent, which is super confusing.
1132
- !(inst._hostNode !== undefined)
1133
- ? invariant_1(false, 'getNodeFromInstance: Invalid argument.')
1134
- : void 0;
1135
-
1136
- if (inst._hostNode) {
1137
- return inst._hostNode;
1138
- }
1139
-
1140
- // Walk up the tree until we find an ancestor whose DOM node we have cached.
1141
- var parents = [];
1142
- while (!inst._hostNode) {
1143
- parents.push(inst);
1144
- !inst._hostParent
1145
- ? invariant_1(
1146
- false,
1147
- 'React DOM tree root should always have a node reference.'
1148
- )
1149
- : void 0;
1150
- inst = inst._hostParent;
1151
- }
1152
-
1153
- // Now parents contains each ancestor that does *not* have a cached native
1154
- // node, and `inst` is the deepest ancestor that does.
1155
- for (; parents.length; inst = parents.pop()) {
1156
- precacheChildNodes(inst, inst._hostNode);
1157
- }
1158
-
1159
- return inst._hostNode;
1160
- }
1161
-
1162
- function getFiberCurrentPropsFromNode(node) {
1163
- return node[internalEventHandlersKey] || null;
1164
- }
1165
-
1166
- function updateFiberProps$1(node, props) {
1167
- node[internalEventHandlersKey] = props;
1168
- }
1169
-
1170
- var ReactDOMComponentTree = {
1171
- getClosestInstanceFromNode: getClosestInstanceFromNode,
1172
- getInstanceFromNode: getInstanceFromNode,
1173
- getNodeFromInstance: getNodeFromInstance,
1174
- precacheChildNodes: precacheChildNodes,
1175
- precacheNode: precacheNode,
1176
- uncacheNode: uncacheNode,
1177
- precacheFiberNode: precacheFiberNode$1,
1178
- getFiberCurrentPropsFromNode: getFiberCurrentPropsFromNode,
1179
- updateFiberProps: updateFiberProps$1,
1180
- };
1181
-
1182
- var ReactDOMComponentTree_1 = ReactDOMComponentTree;
1183
-
1184
- /**
1185
- * Copyright 2013-present, Facebook, Inc.
1186
- * All rights reserved.
1187
- *
1188
- * This source code is licensed under the BSD-style license found in the
1189
- * LICENSE file in the root directory of this source tree. An additional grant
1190
- * of patent rights can be found in the PATENTS file in the same directory.
1191
- *
1192
- * @providesModule ReactInstanceMap
1193
- */
1194
-
1195
- /**
1196
- * `ReactInstanceMap` maintains a mapping from a public facing stateful
1197
- * instance (key) and the internal representation (value). This allows public
1198
- * methods to accept the user facing instance as an argument and map them back
1199
- * to internal methods.
1200
- */
1201
-
1202
- // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
1203
-
1204
- var ReactInstanceMap = {
1205
- /**
1206
- * This API should be called `delete` but we'd have to make sure to always
1207
- * transform these to strings for IE support. When this transform is fully
1208
- * supported we can rename it.
1209
- */
1210
- remove: function(key) {
1211
- key._reactInternalFiber = undefined;
1212
- },
1213
-
1214
- get: function(key) {
1215
- return key._reactInternalFiber;
1216
- },
1217
-
1218
- has: function(key) {
1219
- return key._reactInternalFiber !== undefined;
1220
- },
1221
-
1222
- set: function(key, value) {
1223
- key._reactInternalFiber = value;
1224
- },
1225
- };
1226
-
1227
- var ReactInstanceMap_1 = ReactInstanceMap;
1228
-
1229
- var ReactInternals = react.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
1230
-
1231
- var ReactGlobalSharedState = {
1232
- ReactCurrentOwner: ReactInternals.ReactCurrentOwner,
1233
- };
1234
-
1235
- {
1236
- index(ReactGlobalSharedState, {
1237
- ReactComponentTreeHook: ReactInternals.ReactComponentTreeHook,
1238
- ReactDebugCurrentFrame: ReactInternals.ReactDebugCurrentFrame,
1239
- });
1240
- }
1241
-
1242
- var ReactGlobalSharedState_1 = ReactGlobalSharedState;
1243
-
1244
- /**
1245
- * Copyright 2013-present, Facebook, Inc.
1246
- * All rights reserved.
1247
- *
1248
- * This source code is licensed under the BSD-style license found in the
1249
- * LICENSE file in the root directory of this source tree. An additional grant
1250
- * of patent rights can be found in the PATENTS file in the same directory.
1251
- *
1252
- * @providesModule getComponentName
1253
- *
1254
- */
1255
-
1256
- function getComponentName(instanceOrFiber) {
1257
- if (typeof instanceOrFiber.getName === 'function') {
1258
- // Stack reconciler
1259
- var instance = instanceOrFiber;
1260
- return instance.getName();
1261
- }
1262
- if (typeof instanceOrFiber.tag === 'number') {
1263
- // Fiber reconciler
1264
- var fiber = instanceOrFiber;
1265
- var type = fiber.type;
1266
-
1267
- if (typeof type === 'string') {
1268
- return type;
1269
- }
1270
- if (typeof type === 'function') {
1271
- return type.displayName || type.name;
1272
- }
1273
- }
1274
- return null;
1275
- }
1276
-
1277
- var getComponentName_1 = getComponentName;
1278
-
1279
- /**
1280
- * Similar to invariant but only logs a warning if the condition is not met.
1281
- * This can be used to log issues in development environments in critical
1282
- * paths. Removing the logging code for production environments will keep the
1283
- * same logic and follow the same code paths.
1284
- */
1285
-
1286
- var warning$2 = emptyFunction_1;
1287
-
1288
- {
1289
- (function() {
1290
- var printWarning = function printWarning(format) {
1291
- for (
1292
- var _len = arguments.length,
1293
- args = Array(_len > 1 ? _len - 1 : 0),
1294
- _key = 1;
1295
- _key < _len;
1296
- _key++
1297
- ) {
1298
- args[_key - 1] = arguments[_key];
1299
- }
1300
-
1301
- var argIndex = 0;
1302
- var message =
1303
- 'Warning: ' +
1304
- format.replace(/%s/g, function() {
1305
- return args[argIndex++];
1306
- });
1307
- if (typeof console !== 'undefined') {
1308
- console.error(message);
1309
- }
1310
- try {
1311
- // --- Welcome to debugging React ---
1312
- // This error was thrown as a convenience so that you can use this stack
1313
- // to find the callsite that caused this warning to fire.
1314
- throw new Error(message);
1315
- } catch (x) {}
1316
- };
1317
-
1318
- warning$2 = function warning(condition, format) {
1319
- if (format === undefined) {
1320
- throw new Error(
1321
- '`warning(condition, format, ...args)` requires a warning ' +
1322
- 'message argument'
1323
- );
1324
- }
1325
-
1326
- if (format.indexOf('Failed Composite propType: ') === 0) {
1327
- return; // Ignore CompositeComponent proptype check.
1328
- }
1329
-
1330
- if (!condition) {
1331
- for (
1332
- var _len2 = arguments.length,
1333
- args = Array(_len2 > 2 ? _len2 - 2 : 0),
1334
- _key2 = 2;
1335
- _key2 < _len2;
1336
- _key2++
1337
- ) {
1338
- args[_key2 - 2] = arguments[_key2];
1339
- }
1340
-
1341
- printWarning.apply(undefined, [format].concat(args));
1342
- }
1343
- };
1344
- })();
1345
- }
1346
-
1347
- var warning_1 = warning$2;
1348
-
1349
- /**
1350
- * Copyright 2013-present, Facebook, Inc.
1351
- * All rights reserved.
1352
- *
1353
- * This source code is licensed under the BSD-style license found in the
1354
- * LICENSE file in the root directory of this source tree. An additional grant
1355
- * of patent rights can be found in the PATENTS file in the same directory.
1356
- *
1357
- * @providesModule ReactTypeOfSideEffect
1358
- *
1359
- */
1360
-
1361
- var ReactTypeOfSideEffect = {
1362
- // Don't change these two values:
1363
- NoEffect: 0, // 0b00000000
1364
- PerformedWork: 1, // 0b00000001
1365
- // You can change the rest (and add more).
1366
- Placement: 2, // 0b00000010
1367
- Update: 4, // 0b00000100
1368
- PlacementAndUpdate: 6, // 0b00000110
1369
- Deletion: 8, // 0b00001000
1370
- ContentReset: 16, // 0b00010000
1371
- Callback: 32, // 0b00100000
1372
- Err: 64, // 0b01000000
1373
- Ref: 128,
1374
- };
1375
-
1376
- var ReactCurrentOwner = ReactGlobalSharedState_1.ReactCurrentOwner;
1377
-
1378
- {
1379
- var warning$1 = warning_1;
1380
- }
1381
-
1382
- var ClassComponent = ReactTypeOfWork.ClassComponent;
1383
- var HostComponent$1 = ReactTypeOfWork.HostComponent;
1384
- var HostRoot$1 = ReactTypeOfWork.HostRoot;
1385
- var HostPortal = ReactTypeOfWork.HostPortal;
1386
- var HostText$1 = ReactTypeOfWork.HostText;
1387
-
1388
- var NoEffect = ReactTypeOfSideEffect.NoEffect;
1389
- var Placement = ReactTypeOfSideEffect.Placement;
1390
-
1391
- var MOUNTING = 1;
1392
- var MOUNTED = 2;
1393
- var UNMOUNTED = 3;
1394
-
1395
- function isFiberMountedImpl(fiber) {
1396
- var node = fiber;
1397
- if (!fiber.alternate) {
1398
- // If there is no alternate, this might be a new tree that isn't inserted
1399
- // yet. If it is, then it will have a pending insertion effect on it.
1400
- if ((node.effectTag & Placement) !== NoEffect) {
1401
- return MOUNTING;
1402
- }
1403
- while (node['return']) {
1404
- node = node['return'];
1405
- if ((node.effectTag & Placement) !== NoEffect) {
1406
- return MOUNTING;
1407
- }
1408
- }
1409
- } else {
1410
- while (node['return']) {
1411
- node = node['return'];
1412
- }
1413
- }
1414
- if (node.tag === HostRoot$1) {
1415
- // TODO: Check if this was a nested HostRoot when used with
1416
- // renderContainerIntoSubtree.
1417
- return MOUNTED;
1418
- }
1419
- // If we didn't hit the root, that means that we're in an disconnected tree
1420
- // that has been unmounted.
1421
- return UNMOUNTED;
1422
- }
1423
- var isFiberMounted = function(fiber) {
1424
- return isFiberMountedImpl(fiber) === MOUNTED;
1425
- };
1426
-
1427
- var isMounted = function(component) {
1428
- {
1429
- var owner = ReactCurrentOwner.current;
1430
- if (owner !== null && owner.tag === ClassComponent) {
1431
- var ownerFiber = owner;
1432
- var instance = ownerFiber.stateNode;
1433
- warning$1(
1434
- instance._warnedAboutRefsInRender,
1435
- '%s is accessing isMounted inside its render() function. ' +
1436
- 'render() should be a pure function of props and state. It should ' +
1437
- 'never access something that requires stale data from the previous ' +
1438
- 'render, such as refs. Move this logic to componentDidMount and ' +
1439
- 'componentDidUpdate instead.',
1440
- getComponentName_1(ownerFiber) || 'A component'
1441
- );
1442
- instance._warnedAboutRefsInRender = true;
1443
- }
1444
- }
1445
-
1446
- var fiber = ReactInstanceMap_1.get(component);
1447
- if (!fiber) {
1448
- return false;
1449
- }
1450
- return isFiberMountedImpl(fiber) === MOUNTED;
1451
- };
1452
-
1453
- function assertIsMounted(fiber) {
1454
- !(isFiberMountedImpl(fiber) === MOUNTED)
1455
- ? invariant_1(false, 'Unable to find node on an unmounted component.')
1456
- : void 0;
1457
- }
1458
-
1459
- function findCurrentFiberUsingSlowPath(fiber) {
1460
- var alternate = fiber.alternate;
1461
- if (!alternate) {
1462
- // If there is no alternate, then we only need to check if it is mounted.
1463
- var state = isFiberMountedImpl(fiber);
1464
- !(state !== UNMOUNTED)
1465
- ? invariant_1(false, 'Unable to find node on an unmounted component.')
1466
- : void 0;
1467
- if (state === MOUNTING) {
1468
- return null;
1469
- }
1470
- return fiber;
1471
- }
1472
- // If we have two possible branches, we'll walk backwards up to the root
1473
- // to see what path the root points to. On the way we may hit one of the
1474
- // special cases and we'll deal with them.
1475
- var a = fiber;
1476
- var b = alternate;
1477
- while (true) {
1478
- var parentA = a['return'];
1479
- var parentB = parentA ? parentA.alternate : null;
1480
- if (!parentA || !parentB) {
1481
- // We're at the root.
1482
- break;
1483
- }
1484
-
1485
- // If both copies of the parent fiber point to the same child, we can
1486
- // assume that the child is current. This happens when we bailout on low
1487
- // priority: the bailed out fiber's child reuses the current child.
1488
- if (parentA.child === parentB.child) {
1489
- var child = parentA.child;
1490
- while (child) {
1491
- if (child === a) {
1492
- // We've determined that A is the current branch.
1493
- assertIsMounted(parentA);
1494
- return fiber;
1495
- }
1496
- if (child === b) {
1497
- // We've determined that B is the current branch.
1498
- assertIsMounted(parentA);
1499
- return alternate;
1500
- }
1501
- child = child.sibling;
1502
- }
1503
- // We should never have an alternate for any mounting node. So the only
1504
- // way this could possibly happen is if this was unmounted, if at all.
1505
- invariant_1(false, 'Unable to find node on an unmounted component.');
1506
- }
1507
-
1508
- if (a['return'] !== b['return']) {
1509
- // The return pointer of A and the return pointer of B point to different
1510
- // fibers. We assume that return pointers never criss-cross, so A must
1511
- // belong to the child set of A.return, and B must belong to the child
1512
- // set of B.return.
1513
- a = parentA;
1514
- b = parentB;
1515
- } else {
1516
- // The return pointers point to the same fiber. We'll have to use the
1517
- // default, slow path: scan the child sets of each parent alternate to see
1518
- // which child belongs to which set.
1519
- //
1520
- // Search parent A's child set
1521
- var didFindChild = false;
1522
- var _child = parentA.child;
1523
- while (_child) {
1524
- if (_child === a) {
1525
- didFindChild = true;
1526
- a = parentA;
1527
- b = parentB;
1528
- break;
1529
- }
1530
- if (_child === b) {
1531
- didFindChild = true;
1532
- b = parentA;
1533
- a = parentB;
1534
- break;
1535
- }
1536
- _child = _child.sibling;
1537
- }
1538
- if (!didFindChild) {
1539
- // Search parent B's child set
1540
- _child = parentB.child;
1541
- while (_child) {
1542
- if (_child === a) {
1543
- didFindChild = true;
1544
- a = parentB;
1545
- b = parentA;
1546
- break;
1547
- }
1548
- if (_child === b) {
1549
- didFindChild = true;
1550
- b = parentB;
1551
- a = parentA;
1552
- break;
1553
- }
1554
- _child = _child.sibling;
1555
- }
1556
- !didFindChild
1557
- ? invariant_1(
1558
- false,
1559
- 'Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.'
1560
- )
1561
- : void 0;
1562
- }
1563
- }
1564
-
1565
- !(a.alternate === b)
1566
- ? invariant_1(
1567
- false,
1568
- "Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue."
1569
- )
1570
- : void 0;
1571
- }
1572
- // If the root is not a host container, we're in a disconnected tree. I.e.
1573
- // unmounted.
1574
- !(a.tag === HostRoot$1)
1575
- ? invariant_1(false, 'Unable to find node on an unmounted component.')
1576
- : void 0;
1577
- if (a.stateNode.current === a) {
1578
- // We've determined that A is the current branch.
1579
- return fiber;
1580
- }
1581
- // Otherwise B has to be current branch.
1582
- return alternate;
1583
- }
1584
- var findCurrentFiberUsingSlowPath_1 = findCurrentFiberUsingSlowPath;
1585
-
1586
- var findCurrentHostFiber = function(parent) {
1587
- var currentParent = findCurrentFiberUsingSlowPath(parent);
1588
- if (!currentParent) {
1589
- return null;
1590
- }
1591
-
1592
- // Next we'll drill down this component to find the first HostComponent/Text.
1593
- var node = currentParent;
1594
- while (true) {
1595
- if (node.tag === HostComponent$1 || node.tag === HostText$1) {
1596
- return node;
1597
- } else if (node.child) {
1598
- node.child['return'] = node;
1599
- node = node.child;
1600
- continue;
1601
- }
1602
- if (node === currentParent) {
1603
- return null;
1604
- }
1605
- while (!node.sibling) {
1606
- if (!node['return'] || node['return'] === currentParent) {
1607
- return null;
1608
- }
1609
- node = node['return'];
1610
- }
1611
- node.sibling['return'] = node['return'];
1612
- node = node.sibling;
1613
- }
1614
- // Flow needs the return null here, but ESLint complains about it.
1615
- // eslint-disable-next-line no-unreachable
1616
- return null;
1617
- };
1618
-
1619
- var findCurrentHostFiberWithNoPortals = function(parent) {
1620
- var currentParent = findCurrentFiberUsingSlowPath(parent);
1621
- if (!currentParent) {
1622
- return null;
1623
- }
1624
-
1625
- // Next we'll drill down this component to find the first HostComponent/Text.
1626
- var node = currentParent;
1627
- while (true) {
1628
- if (node.tag === HostComponent$1 || node.tag === HostText$1) {
1629
- return node;
1630
- } else if (node.child && node.tag !== HostPortal) {
1631
- node.child['return'] = node;
1632
- node = node.child;
1633
- continue;
1634
- }
1635
- if (node === currentParent) {
1636
- return null;
1637
- }
1638
- while (!node.sibling) {
1639
- if (!node['return'] || node['return'] === currentParent) {
1640
- return null;
1641
- }
1642
- node = node['return'];
1643
- }
1644
- node.sibling['return'] = node['return'];
1645
- node = node.sibling;
1646
- }
1647
- // Flow needs the return null here, but ESLint complains about it.
1648
- // eslint-disable-next-line no-unreachable
1649
- return null;
1650
- };
1651
-
1652
- var ReactFiberTreeReflection = {
1653
- isFiberMounted: isFiberMounted,
1654
- isMounted: isMounted,
1655
- findCurrentFiberUsingSlowPath: findCurrentFiberUsingSlowPath_1,
1656
- findCurrentHostFiber: findCurrentHostFiber,
1657
- findCurrentHostFiberWithNoPortals: findCurrentHostFiberWithNoPortals,
1658
- };
1659
-
1660
- var ReactErrorUtils = {
1661
- // Used by Fiber to simulate a try-catch.
1662
- _caughtError: null,
1663
- _hasCaughtError: false,
1664
-
1665
- // Used by event system to capture/rethrow the first error.
1666
- _rethrowError: null,
1667
- _hasRethrowError: false,
1668
-
1669
- injection: {
1670
- injectErrorUtils: function(injectedErrorUtils) {
1671
- !(typeof injectedErrorUtils.invokeGuardedCallback === 'function')
1672
- ? invariant_1(
1673
- false,
1674
- 'Injected invokeGuardedCallback() must be a function.'
1675
- )
1676
- : void 0;
1677
- invokeGuardedCallback = injectedErrorUtils.invokeGuardedCallback;
1678
- },
1679
- },
1680
-
1681
- /**
1682
- * Call a function while guarding against errors that happens within it.
1683
- * Returns an error if it throws, otherwise null.
1684
- *
1685
- * In production, this is implemented using a try-catch. The reason we don't
1686
- * use a try-catch directly is so that we can swap out a different
1687
- * implementation in DEV mode.
1688
- *
1689
- * @param {String} name of the guard to use for logging or debugging
1690
- * @param {Function} func The function to invoke
1691
- * @param {*} context The context to use when calling the function
1692
- * @param {...*} args Arguments for function
1693
- */
1694
- invokeGuardedCallback: function(name, func, context, a, b, c, d, e, f) {
1695
- invokeGuardedCallback.apply(ReactErrorUtils, arguments);
1696
- },
1697
-
1698
- /**
1699
- * Same as invokeGuardedCallback, but instead of returning an error, it stores
1700
- * it in a global so it can be rethrown by `rethrowCaughtError` later.
1701
- * TODO: See if _caughtError and _rethrowError can be unified.
1702
- *
1703
- * @param {String} name of the guard to use for logging or debugging
1704
- * @param {Function} func The function to invoke
1705
- * @param {*} context The context to use when calling the function
1706
- * @param {...*} args Arguments for function
1707
- */
1708
- invokeGuardedCallbackAndCatchFirstError: function(
1709
- name,
1710
- func,
1711
- context,
1712
- a,
1713
- b,
1714
- c,
1715
- d,
1716
- e,
1717
- f
1718
- ) {
1719
- ReactErrorUtils.invokeGuardedCallback.apply(this, arguments);
1720
- if (ReactErrorUtils.hasCaughtError()) {
1721
- var error = ReactErrorUtils.clearCaughtError();
1722
- if (!ReactErrorUtils._hasRethrowError) {
1723
- ReactErrorUtils._hasRethrowError = true;
1724
- ReactErrorUtils._rethrowError = error;
1725
- }
1726
- }
1727
- },
1728
-
1729
- /**
1730
- * During execution of guarded functions we will capture the first error which
1731
- * we will rethrow to be handled by the top level error handler.
1732
- */
1733
- rethrowCaughtError: function() {
1734
- return rethrowCaughtError.apply(ReactErrorUtils, arguments);
1735
- },
1736
-
1737
- hasCaughtError: function() {
1738
- return ReactErrorUtils._hasCaughtError;
1739
- },
1740
-
1741
- clearCaughtError: function() {
1742
- if (ReactErrorUtils._hasCaughtError) {
1743
- var error = ReactErrorUtils._caughtError;
1744
- ReactErrorUtils._caughtError = null;
1745
- ReactErrorUtils._hasCaughtError = false;
1746
- return error;
1747
- } else {
1748
- invariant_1(
1749
- false,
1750
- 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.'
1751
- );
1752
- }
1753
- },
1754
- };
1755
-
1756
- var invokeGuardedCallback = function(name, func, context, a, b, c, d, e, f) {
1757
- ReactErrorUtils._hasCaughtError = false;
1758
- ReactErrorUtils._caughtError = null;
1759
- var funcArgs = Array.prototype.slice.call(arguments, 3);
1760
- try {
1761
- func.apply(context, funcArgs);
1762
- } catch (error) {
1763
- ReactErrorUtils._caughtError = error;
1764
- ReactErrorUtils._hasCaughtError = true;
1765
- }
1766
- };
1767
-
1768
- {
1769
- // In DEV mode, we swap out invokeGuardedCallback for a special version
1770
- // that plays more nicely with the browser's DevTools. The idea is to preserve
1771
- // "Pause on exceptions" behavior. Because React wraps all user-provided
1772
- // functions in invokeGuardedCallback, and the production version of
1773
- // invokeGuardedCallback uses a try-catch, all user exceptions are treated
1774
- // like caught exceptions, and the DevTools won't pause unless the developer
1775
- // takes the extra step of enabling pause on caught exceptions. This is
1776
- // untintuitive, though, because even though React has caught the error, from
1777
- // the developer's perspective, the error is uncaught.
1778
- //
1779
- // To preserve the expected "Pause on exceptions" behavior, we don't use a
1780
- // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
1781
- // DOM node, and call the user-provided callback from inside an event handler
1782
- // for that fake event. If the callback throws, the error is "captured" using
1783
- // a global event handler. But because the error happens in a different
1784
- // event loop context, it does not interrupt the normal program flow.
1785
- // Effectively, this gives us try-catch behavior without actually using
1786
- // try-catch. Neat!
1787
-
1788
- // Check that the browser supports the APIs we need to implement our special
1789
- // DEV version of invokeGuardedCallback
1790
- if (
1791
- typeof window !== 'undefined' &&
1792
- typeof window.dispatchEvent === 'function' &&
1793
- typeof document !== 'undefined' &&
1794
- typeof document.createEvent === 'function'
1795
- ) {
1796
- var fakeNode = document.createElement('react');
1797
-
1798
- var invokeGuardedCallbackDev = function(
1799
- name,
1800
- func,
1801
- context,
1802
- a,
1803
- b,
1804
- c,
1805
- d,
1806
- e,
1807
- f
1808
- ) {
1809
- // Keeps track of whether the user-provided callback threw an error. We
1810
- // set this to true at the beginning, then set it to false right after
1811
- // calling the function. If the function errors, `didError` will never be
1812
- // set to false. This strategy works even if the browser is flaky and
1813
- // fails to call our global error handler, because it doesn't rely on
1814
- // the error event at all.
1815
- var didError = true;
1816
-
1817
- // Create an event handler for our fake event. We will synchronously
1818
- // dispatch our fake event using `dispatchEvent`. Inside the handler, we
1819
- // call the user-provided callback.
1820
- var funcArgs = Array.prototype.slice.call(arguments, 3);
1821
- function callCallback() {
1822
- // We immediately remove the callback from event listeners so that
1823
- // nested `invokeGuardedCallback` calls do not clash. Otherwise, a
1824
- // nested call would trigger the fake event handlers of any call higher
1825
- // in the stack.
1826
- fakeNode.removeEventListener(evtType, callCallback, false);
1827
- func.apply(context, funcArgs);
1828
- didError = false;
1829
- }
1830
-
1831
- // Create a global error event handler. We use this to capture the value
1832
- // that was thrown. It's possible that this error handler will fire more
1833
- // than once; for example, if non-React code also calls `dispatchEvent`
1834
- // and a handler for that event throws. We should be resilient to most of
1835
- // those cases. Even if our error event handler fires more than once, the
1836
- // last error event is always used. If the callback actually does error,
1837
- // we know that the last error event is the correct one, because it's not
1838
- // possible for anything else to have happened in between our callback
1839
- // erroring and the code that follows the `dispatchEvent` call below. If
1840
- // the callback doesn't error, but the error event was fired, we know to
1841
- // ignore it because `didError` will be false, as described above.
1842
- var error = void 0;
1843
- // Use this to track whether the error event is ever called.
1844
- var didSetError = false;
1845
- var isCrossOriginError = false;
1846
-
1847
- function onError(event) {
1848
- error = event.error;
1849
- didSetError = true;
1850
- if (error === null && event.colno === 0 && event.lineno === 0) {
1851
- isCrossOriginError = true;
1852
- }
1853
- }
1854
-
1855
- // Create a fake event type.
1856
- var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
1857
-
1858
- // Attach our event handlers
1859
- window.addEventListener('error', onError);
1860
- fakeNode.addEventListener(evtType, callCallback, false);
1861
-
1862
- // Synchronously dispatch our fake event. If the user-provided function
1863
- // errors, it will trigger our global error handler.
1864
- var evt = document.createEvent('Event');
1865
- evt.initEvent(evtType, false, false);
1866
- fakeNode.dispatchEvent(evt);
1867
-
1868
- if (didError) {
1869
- if (!didSetError) {
1870
- // The callback errored, but the error event never fired.
1871
- error = new Error(
1872
- 'An error was thrown inside one of your components, but React ' +
1873
- "doesn't know what it was. This is likely due to browser " +
1874
- 'flakiness. React does its best to preserve the "Pause on ' +
1875
- 'exceptions" behavior of the DevTools, which requires some ' +
1876
- "DEV-mode only tricks. It's possible that these don't work in " +
1877
- 'your browser. Try triggering the error in production mode, ' +
1878
- 'or switching to a modern browser. If you suspect that this is ' +
1879
- 'actually an issue with React, please file an issue.'
1880
- );
1881
- } else if (isCrossOriginError) {
1882
- error = new Error(
1883
- "A cross-origin error was thrown. React doesn't have access to " +
1884
- 'the actual error object in development. ' +
1885
- 'See https://fb.me/react-crossorigin-error for more information.'
1886
- );
1887
- }
1888
- ReactErrorUtils._hasCaughtError = true;
1889
- ReactErrorUtils._caughtError = error;
1890
- } else {
1891
- ReactErrorUtils._hasCaughtError = false;
1892
- ReactErrorUtils._caughtError = null;
1893
- }
1894
-
1895
- // Remove our event listeners
1896
- window.removeEventListener('error', onError);
1897
- };
1898
-
1899
- invokeGuardedCallback = invokeGuardedCallbackDev;
1900
- }
1901
- }
1902
-
1903
- var rethrowCaughtError = function() {
1904
- if (ReactErrorUtils._hasRethrowError) {
1905
- var error = ReactErrorUtils._rethrowError;
1906
- ReactErrorUtils._rethrowError = null;
1907
- ReactErrorUtils._hasRethrowError = false;
1908
- throw error;
1909
- }
1910
- };
1911
-
1912
- var ReactErrorUtils_1 = ReactErrorUtils;
1913
-
1914
- {
1915
- var warning$3 = warning_1;
1916
- }
1917
-
1918
- /**
1919
- * Injected dependencies:
1920
- */
1921
-
1922
- /**
1923
- * - `ComponentTree`: [required] Module that can convert between React instances
1924
- * and actual node references.
1925
- */
1926
- var ComponentTree;
1927
- var injection = {
1928
- injectComponentTree: function(Injected) {
1929
- ComponentTree = Injected;
1930
- {
1931
- warning$3(
1932
- Injected &&
1933
- Injected.getNodeFromInstance &&
1934
- Injected.getInstanceFromNode,
1935
- 'EventPluginUtils.injection.injectComponentTree(...): Injected ' +
1936
- 'module is missing getNodeFromInstance or getInstanceFromNode.'
1937
- );
1938
- }
1939
- },
1940
- };
1941
-
1942
- function isEndish(topLevelType) {
1943
- return (
1944
- topLevelType === 'topMouseUp' ||
1945
- topLevelType === 'topTouchEnd' ||
1946
- topLevelType === 'topTouchCancel'
1947
- );
1948
- }
1949
-
1950
- function isMoveish(topLevelType) {
1951
- return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
1952
- }
1953
- function isStartish(topLevelType) {
1954
- return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
1955
- }
1956
-
1957
- var validateEventDispatches;
1958
- {
1959
- validateEventDispatches = function(event) {
1960
- var dispatchListeners = event._dispatchListeners;
1961
- var dispatchInstances = event._dispatchInstances;
1962
-
1963
- var listenersIsArr = Array.isArray(dispatchListeners);
1964
- var listenersLen = listenersIsArr
1965
- ? dispatchListeners.length
1966
- : dispatchListeners ? 1 : 0;
1967
-
1968
- var instancesIsArr = Array.isArray(dispatchInstances);
1969
- var instancesLen = instancesIsArr
1970
- ? dispatchInstances.length
1971
- : dispatchInstances ? 1 : 0;
1972
-
1973
- warning$3(
1974
- instancesIsArr === listenersIsArr && instancesLen === listenersLen,
1975
- 'EventPluginUtils: Invalid `event`.'
1976
- );
1977
- };
1978
- }
1979
-
1980
- /**
1981
- * Dispatch the event to the listener.
1982
- * @param {SyntheticEvent} event SyntheticEvent to handle
1983
- * @param {boolean} simulated If the event is simulated (changes exn behavior)
1984
- * @param {function} listener Application-level callback
1985
- * @param {*} inst Internal component instance
1986
- */
1987
- function executeDispatch(event, simulated, listener, inst) {
1988
- var type = event.type || 'unknown-event';
1989
- event.currentTarget = EventPluginUtils.getNodeFromInstance(inst);
1990
- ReactErrorUtils_1.invokeGuardedCallbackAndCatchFirstError(
1991
- type,
1992
- listener,
1993
- undefined,
1994
- event
1995
- );
1996
- event.currentTarget = null;
1997
- }
1998
-
1999
- /**
2000
- * Standard/simple iteration through an event's collected dispatches.
2001
- */
2002
- function executeDispatchesInOrder(event, simulated) {
2003
- var dispatchListeners = event._dispatchListeners;
2004
- var dispatchInstances = event._dispatchInstances;
2005
- {
2006
- validateEventDispatches(event);
2007
- }
2008
- if (Array.isArray(dispatchListeners)) {
2009
- for (var i = 0; i < dispatchListeners.length; i++) {
2010
- if (event.isPropagationStopped()) {
2011
- break;
2012
- }
2013
- // Listeners and Instances are two parallel arrays that are always in sync.
2014
- executeDispatch(
2015
- event,
2016
- simulated,
2017
- dispatchListeners[i],
2018
- dispatchInstances[i]
2019
- );
2020
- }
2021
- } else if (dispatchListeners) {
2022
- executeDispatch(event, simulated, dispatchListeners, dispatchInstances);
2023
- }
2024
- event._dispatchListeners = null;
2025
- event._dispatchInstances = null;
2026
- }
2027
-
2028
- /**
2029
- * Standard/simple iteration through an event's collected dispatches, but stops
2030
- * at the first dispatch execution returning true, and returns that id.
2031
- *
2032
- * @return {?string} id of the first dispatch execution who's listener returns
2033
- * true, or null if no listener returned true.
2034
- */
2035
- function executeDispatchesInOrderStopAtTrueImpl(event) {
2036
- var dispatchListeners = event._dispatchListeners;
2037
- var dispatchInstances = event._dispatchInstances;
2038
- {
2039
- validateEventDispatches(event);
2040
- }
2041
- if (Array.isArray(dispatchListeners)) {
2042
- for (var i = 0; i < dispatchListeners.length; i++) {
2043
- if (event.isPropagationStopped()) {
2044
- break;
2045
- }
2046
- // Listeners and Instances are two parallel arrays that are always in sync.
2047
- if (dispatchListeners[i](event, dispatchInstances[i])) {
2048
- return dispatchInstances[i];
2049
- }
2050
- }
2051
- } else if (dispatchListeners) {
2052
- if (dispatchListeners(event, dispatchInstances)) {
2053
- return dispatchInstances;
2054
- }
2055
- }
2056
- return null;
2057
- }
2058
-
2059
- /**
2060
- * @see executeDispatchesInOrderStopAtTrueImpl
2061
- */
2062
- function executeDispatchesInOrderStopAtTrue(event) {
2063
- var ret = executeDispatchesInOrderStopAtTrueImpl(event);
2064
- event._dispatchInstances = null;
2065
- event._dispatchListeners = null;
2066
- return ret;
2067
- }
2068
-
2069
- /**
2070
- * Execution of a "direct" dispatch - there must be at most one dispatch
2071
- * accumulated on the event or it is considered an error. It doesn't really make
2072
- * sense for an event with multiple dispatches (bubbled) to keep track of the
2073
- * return values at each dispatch execution, but it does tend to make sense when
2074
- * dealing with "direct" dispatches.
2075
- *
2076
- * @return {*} The return value of executing the single dispatch.
2077
- */
2078
- function executeDirectDispatch(event) {
2079
- {
2080
- validateEventDispatches(event);
2081
- }
2082
- var dispatchListener = event._dispatchListeners;
2083
- var dispatchInstance = event._dispatchInstances;
2084
- !!Array.isArray(dispatchListener)
2085
- ? invariant_1(false, 'executeDirectDispatch(...): Invalid `event`.')
2086
- : void 0;
2087
- event.currentTarget = dispatchListener
2088
- ? EventPluginUtils.getNodeFromInstance(dispatchInstance)
2089
- : null;
2090
- var res = dispatchListener ? dispatchListener(event) : null;
2091
- event.currentTarget = null;
2092
- event._dispatchListeners = null;
2093
- event._dispatchInstances = null;
2094
- return res;
2095
- }
2096
-
2097
- /**
2098
- * @param {SyntheticEvent} event
2099
- * @return {boolean} True iff number of dispatches accumulated is greater than 0.
2100
- */
2101
- function hasDispatches(event) {
2102
- return !!event._dispatchListeners;
2103
- }
2104
-
2105
- /**
2106
- * General utilities that are useful in creating custom Event Plugins.
2107
- */
2108
- var EventPluginUtils = {
2109
- isEndish: isEndish,
2110
- isMoveish: isMoveish,
2111
- isStartish: isStartish,
2112
-
2113
- executeDirectDispatch: executeDirectDispatch,
2114
- executeDispatchesInOrder: executeDispatchesInOrder,
2115
- executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
2116
- hasDispatches: hasDispatches,
2117
-
2118
- getFiberCurrentPropsFromNode: function(node) {
2119
- return ComponentTree.getFiberCurrentPropsFromNode(node);
2120
- },
2121
- getInstanceFromNode: function(node) {
2122
- return ComponentTree.getInstanceFromNode(node);
2123
- },
2124
- getNodeFromInstance: function(node) {
2125
- return ComponentTree.getNodeFromInstance(node);
2126
- },
2127
-
2128
- injection: injection,
2129
- };
2130
-
2131
- var EventPluginUtils_1 = EventPluginUtils;
2132
-
2133
- // Use to restore controlled state after a change event has fired.
2134
-
2135
- var fiberHostComponent = null;
2136
-
2137
- var ReactControlledComponentInjection = {
2138
- injectFiberControlledHostComponent: function(hostComponentImpl) {
2139
- // The fiber implementation doesn't use dynamic dispatch so we need to
2140
- // inject the implementation.
2141
- fiberHostComponent = hostComponentImpl;
2142
- },
2143
- };
2144
-
2145
- var restoreTarget = null;
2146
- var restoreQueue = null;
2147
-
2148
- function restoreStateOfTarget(target) {
2149
- // We perform this translation at the end of the event loop so that we
2150
- // always receive the correct fiber here
2151
- var internalInstance = EventPluginUtils_1.getInstanceFromNode(target);
2152
- if (!internalInstance) {
2153
- // Unmounted
2154
- return;
2155
- }
2156
- if (typeof internalInstance.tag === 'number') {
2157
- !(fiberHostComponent &&
2158
- typeof fiberHostComponent.restoreControlledState === 'function')
2159
- ? invariant_1(
2160
- false,
2161
- 'Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue.'
2162
- )
2163
- : void 0;
2164
- var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(
2165
- internalInstance.stateNode
2166
- );
2167
- fiberHostComponent.restoreControlledState(
2168
- internalInstance.stateNode,
2169
- internalInstance.type,
2170
- props
2171
- );
2172
- return;
2173
- }
2174
- !(typeof internalInstance.restoreControlledState === 'function')
2175
- ? invariant_1(
2176
- false,
2177
- 'The internal instance must be a React host component. This error is likely caused by a bug in React. Please file an issue.'
2178
- )
2179
- : void 0;
2180
- // If it is not a Fiber, we can just use dynamic dispatch.
2181
- internalInstance.restoreControlledState();
2182
- }
2183
-
2184
- var ReactControlledComponent = {
2185
- injection: ReactControlledComponentInjection,
2186
-
2187
- enqueueStateRestore: function(target) {
2188
- if (restoreTarget) {
2189
- if (restoreQueue) {
2190
- restoreQueue.push(target);
2191
- } else {
2192
- restoreQueue = [target];
2193
- }
2194
- } else {
2195
- restoreTarget = target;
2196
- }
2197
- },
2198
- restoreStateIfNeeded: function() {
2199
- if (!restoreTarget) {
2200
- return;
2201
- }
2202
- var target = restoreTarget;
2203
- var queuedTargets = restoreQueue;
2204
- restoreTarget = null;
2205
- restoreQueue = null;
2206
-
2207
- restoreStateOfTarget(target);
2208
- if (queuedTargets) {
2209
- for (var i = 0; i < queuedTargets.length; i++) {
2210
- restoreStateOfTarget(queuedTargets[i]);
2211
- }
2212
- }
2213
- },
2214
- };
2215
-
2216
- var ReactControlledComponent_1 = ReactControlledComponent;
2217
-
2218
- // Used as a way to call batchedUpdates when we don't know if we're in a Fiber
2219
- // or Stack context. Such as when we're dispatching events or if third party
2220
- // libraries need to call batchedUpdates. Eventually, this API will go away when
2221
- // everything is batched by default. We'll then have a similar API to opt-out of
2222
- // scheduled work and instead do synchronous work.
2223
-
2224
- // Defaults
2225
- var stackBatchedUpdates = function(fn, a, b, c, d, e) {
2226
- return fn(a, b, c, d, e);
2227
- };
2228
- var fiberBatchedUpdates = function(fn, bookkeeping) {
2229
- return fn(bookkeeping);
2230
- };
2231
-
2232
- function performFiberBatchedUpdates(fn, bookkeeping) {
2233
- // If we have Fiber loaded, we need to wrap this in a batching call so that
2234
- // Fiber can apply its default priority for this call.
2235
- return fiberBatchedUpdates(fn, bookkeeping);
2236
- }
2237
- function batchedUpdates(fn, bookkeeping) {
2238
- // We first perform work with the stack batching strategy, by passing our
2239
- // indirection to it.
2240
- return stackBatchedUpdates(performFiberBatchedUpdates, fn, bookkeeping);
2241
- }
2242
-
2243
- var isNestingBatched = false;
2244
- function batchedUpdatesWithControlledComponents(fn, bookkeeping) {
2245
- if (isNestingBatched) {
2246
- // If we are currently inside another batch, we need to wait until it
2247
- // fully completes before restoring state. Therefore, we add the target to
2248
- // a queue of work.
2249
- return batchedUpdates(fn, bookkeeping);
2250
- }
2251
- isNestingBatched = true;
2252
- try {
2253
- return batchedUpdates(fn, bookkeeping);
2254
- } finally {
2255
- // Here we wait until all updates have propagated, which is important
2256
- // when using controlled components within layers:
2257
- // https://github.com/facebook/react/issues/1698
2258
- // Then we restore state of any controlled component.
2259
- isNestingBatched = false;
2260
- ReactControlledComponent_1.restoreStateIfNeeded();
2261
- }
2262
- }
2263
-
2264
- var ReactGenericBatchingInjection = {
2265
- injectStackBatchedUpdates: function(_batchedUpdates) {
2266
- stackBatchedUpdates = _batchedUpdates;
2267
- },
2268
- injectFiberBatchedUpdates: function(_batchedUpdates) {
2269
- fiberBatchedUpdates = _batchedUpdates;
2270
- },
2271
- };
2272
-
2273
- var ReactGenericBatching = {
2274
- batchedUpdates: batchedUpdatesWithControlledComponents,
2275
- injection: ReactGenericBatchingInjection,
2276
- };
2277
-
2278
- var ReactGenericBatching_1 = ReactGenericBatching;
2279
-
2280
- var TEXT_NODE$1 = HTMLNodeType_1.TEXT_NODE;
2281
-
2282
- /**
2283
- * Gets the target node from a native browser event by accounting for
2284
- * inconsistencies in browser DOM APIs.
2285
- *
2286
- * @param {object} nativeEvent Native browser event.
2287
- * @return {DOMEventTarget} Target node.
2288
- */
2289
-
2290
- function getEventTarget(nativeEvent) {
2291
- var target = nativeEvent.target || nativeEvent.srcElement || window;
2292
-
2293
- // Normalize SVG <use> element events #4963
2294
- if (target.correspondingUseElement) {
2295
- target = target.correspondingUseElement;
2296
- }
2297
-
2298
- // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
2299
- // @see http://www.quirksmode.org/js/events_properties.html
2300
- return target.nodeType === TEXT_NODE$1 ? target.parentNode : target;
2301
- }
2302
-
2303
- var getEventTarget_1 = getEventTarget;
2304
-
2305
- var HostRoot = ReactTypeOfWork.HostRoot;
2306
-
2307
- var CALLBACK_BOOKKEEPING_POOL_SIZE = 10;
2308
- var callbackBookkeepingPool = [];
2309
-
2310
- /**
2311
- * Find the deepest React component completely containing the root of the
2312
- * passed-in instance (for use when entire React trees are nested within each
2313
- * other). If React trees are not nested, returns null.
2314
- */
2315
- function findRootContainerNode(inst) {
2316
- // TODO: It may be a good idea to cache this to prevent unnecessary DOM
2317
- // traversal, but caching is difficult to do correctly without using a
2318
- // mutation observer to listen for all DOM changes.
2319
- if (typeof inst.tag === 'number') {
2320
- while (inst['return']) {
2321
- inst = inst['return'];
2322
- }
2323
- if (inst.tag !== HostRoot) {
2324
- // This can happen if we're in a detached tree.
2325
- return null;
2326
- }
2327
- return inst.stateNode.containerInfo;
2328
- } else {
2329
- while (inst._hostParent) {
2330
- inst = inst._hostParent;
2331
- }
2332
- var rootNode = ReactDOMComponentTree_1.getNodeFromInstance(inst);
2333
- return rootNode.parentNode;
2334
- }
2335
- }
2336
-
2337
- // Used to store ancestor hierarchy in top level callback
2338
- function getTopLevelCallbackBookKeeping(
2339
- topLevelType,
2340
- nativeEvent,
2341
- targetInst
2342
- ) {
2343
- if (callbackBookkeepingPool.length) {
2344
- var instance = callbackBookkeepingPool.pop();
2345
- instance.topLevelType = topLevelType;
2346
- instance.nativeEvent = nativeEvent;
2347
- instance.targetInst = targetInst;
2348
- return instance;
2349
- }
2350
- return {
2351
- topLevelType: topLevelType,
2352
- nativeEvent: nativeEvent,
2353
- targetInst: targetInst,
2354
- ancestors: [],
2355
- };
2356
- }
2357
-
2358
- function releaseTopLevelCallbackBookKeeping(instance) {
2359
- instance.topLevelType = null;
2360
- instance.nativeEvent = null;
2361
- instance.targetInst = null;
2362
- instance.ancestors.length = 0;
2363
- if (callbackBookkeepingPool.length < CALLBACK_BOOKKEEPING_POOL_SIZE) {
2364
- callbackBookkeepingPool.push(instance);
2365
- }
2366
- }
2367
-
2368
- function handleTopLevelImpl(bookKeeping) {
2369
- var targetInst = bookKeeping.targetInst;
2370
-
2371
- // Loop through the hierarchy, in case there's any nested components.
2372
- // It's important that we build the array of ancestors before calling any
2373
- // event handlers, because event handlers can modify the DOM, leading to
2374
- // inconsistencies with ReactMount's node cache. See #1105.
2375
- var ancestor = targetInst;
2376
- do {
2377
- if (!ancestor) {
2378
- bookKeeping.ancestors.push(ancestor);
2379
- break;
2380
- }
2381
- var root = findRootContainerNode(ancestor);
2382
- if (!root) {
2383
- break;
2384
- }
2385
- bookKeeping.ancestors.push(ancestor);
2386
- ancestor = ReactDOMComponentTree_1.getClosestInstanceFromNode(root);
2387
- } while (ancestor);
2388
-
2389
- for (var i = 0; i < bookKeeping.ancestors.length; i++) {
2390
- targetInst = bookKeeping.ancestors[i];
2391
- ReactDOMEventListener._handleTopLevel(
2392
- bookKeeping.topLevelType,
2393
- targetInst,
2394
- bookKeeping.nativeEvent,
2395
- getEventTarget_1(bookKeeping.nativeEvent)
2396
- );
2397
- }
2398
- }
2399
-
2400
- var ReactDOMEventListener = {
2401
- _enabled: true,
2402
- _handleTopLevel: null,
2403
-
2404
- setHandleTopLevel: function(handleTopLevel) {
2405
- ReactDOMEventListener._handleTopLevel = handleTopLevel;
2406
- },
2407
-
2408
- setEnabled: function(enabled) {
2409
- ReactDOMEventListener._enabled = !!enabled;
2410
- },
2411
-
2412
- isEnabled: function() {
2413
- return ReactDOMEventListener._enabled;
2414
- },
2415
-
2416
- /**
2417
- * Traps top-level events by using event bubbling.
2418
- *
2419
- * @param {string} topLevelType Record from `BrowserEventConstants`.
2420
- * @param {string} handlerBaseName Event name (e.g. "click").
2421
- * @param {object} element Element on which to attach listener.
2422
- * @return {?object} An object with a remove function which will forcefully
2423
- * remove the listener.
2424
- * @internal
2425
- */
2426
- trapBubbledEvent: function(topLevelType, handlerBaseName, element) {
2427
- if (!element) {
2428
- return null;
2429
- }
2430
- return EventListener_1.listen(
2431
- element,
2432
- handlerBaseName,
2433
- ReactDOMEventListener.dispatchEvent.bind(null, topLevelType)
2434
- );
2435
- },
2436
-
2437
- /**
2438
- * Traps a top-level event by using event capturing.
2439
- *
2440
- * @param {string} topLevelType Record from `BrowserEventConstants`.
2441
- * @param {string} handlerBaseName Event name (e.g. "click").
2442
- * @param {object} element Element on which to attach listener.
2443
- * @return {?object} An object with a remove function which will forcefully
2444
- * remove the listener.
2445
- * @internal
2446
- */
2447
- trapCapturedEvent: function(topLevelType, handlerBaseName, element) {
2448
- if (!element) {
2449
- return null;
2450
- }
2451
- return EventListener_1.capture(
2452
- element,
2453
- handlerBaseName,
2454
- ReactDOMEventListener.dispatchEvent.bind(null, topLevelType)
2455
- );
2456
- },
2457
-
2458
- dispatchEvent: function(topLevelType, nativeEvent) {
2459
- if (!ReactDOMEventListener._enabled) {
2460
- return;
2461
- }
2462
-
2463
- var nativeEventTarget = getEventTarget_1(nativeEvent);
2464
- var targetInst = ReactDOMComponentTree_1.getClosestInstanceFromNode(
2465
- nativeEventTarget
2466
- );
2467
- if (
2468
- targetInst !== null &&
2469
- typeof targetInst.tag === 'number' &&
2470
- !ReactFiberTreeReflection.isFiberMounted(targetInst)
2471
- ) {
2472
- // If we get an event (ex: img onload) before committing that
2473
- // component's mount, ignore it for now (that is, treat it as if it was an
2474
- // event on a non-React tree). We might also consider queueing events and
2475
- // dispatching them after the mount.
2476
- targetInst = null;
2477
- }
2478
-
2479
- var bookKeeping = getTopLevelCallbackBookKeeping(
2480
- topLevelType,
2481
- nativeEvent,
2482
- targetInst
2483
- );
2484
-
2485
- try {
2486
- // Event queue being processed in the same cycle allows
2487
- // `preventDefault`.
2488
- ReactGenericBatching_1.batchedUpdates(handleTopLevelImpl, bookKeeping);
2489
- } finally {
2490
- releaseTopLevelCallbackBookKeeping(bookKeeping);
2491
- }
2492
- },
2493
- };
2494
-
2495
- var ReactDOMEventListener_1 = ReactDOMEventListener;
2496
-
2497
- /**
2498
- * Accumulates items that must not be null or undefined into the first one. This
2499
- * is used to conserve memory by avoiding array allocations, and thus sacrifices
2500
- * API cleanness. Since `current` can be null before being passed in and not
2501
- * null after this function, make sure to assign it back to `current`:
2502
- *
2503
- * `a = accumulateInto(a, b);`
2504
- *
2505
- * This API should be sparingly used. Try `accumulate` for something cleaner.
2506
- *
2507
- * @return {*|array<*>} An accumulation of items.
2508
- */
2509
-
2510
- function accumulateInto(current, next) {
2511
- !(next != null)
2512
- ? invariant_1(
2513
- false,
2514
- 'accumulateInto(...): Accumulated items must not be null or undefined.'
2515
- )
2516
- : void 0;
2517
-
2518
- if (current == null) {
2519
- return next;
2520
- }
2521
-
2522
- // Both are not empty. Warning: Never call x.concat(y) when you are not
2523
- // certain that x is an Array (x could be a string with concat method).
2524
- if (Array.isArray(current)) {
2525
- if (Array.isArray(next)) {
2526
- current.push.apply(current, next);
2527
- return current;
2528
- }
2529
- current.push(next);
2530
- return current;
2531
- }
2532
-
2533
- if (Array.isArray(next)) {
2534
- // A bit too dangerous to mutate `next`.
2535
- return [current].concat(next);
2536
- }
2537
-
2538
- return [current, next];
2539
- }
2540
-
2541
- var accumulateInto_1 = accumulateInto;
2542
-
2543
- /**
2544
- * Copyright 2013-present, Facebook, Inc.
2545
- * All rights reserved.
2546
- *
2547
- * This source code is licensed under the BSD-style license found in the
2548
- * LICENSE file in the root directory of this source tree. An additional grant
2549
- * of patent rights can be found in the PATENTS file in the same directory.
2550
- *
2551
- * @providesModule forEachAccumulated
2552
- *
2553
- */
2554
-
2555
- /**
2556
- * @param {array} arr an "accumulation" of items which is either an Array or
2557
- * a single item. Useful when paired with the `accumulate` module. This is a
2558
- * simple utility that allows us to reason about a collection of items, but
2559
- * handling the case when there is exactly one item (and we do not need to
2560
- * allocate an array).
2561
- * @param {function} cb Callback invoked with each element or a collection.
2562
- * @param {?} [scope] Scope used as `this` in a callback.
2563
- */
2564
-
2565
- function forEachAccumulated(arr, cb, scope) {
2566
- if (Array.isArray(arr)) {
2567
- arr.forEach(cb, scope);
2568
- } else if (arr) {
2569
- cb.call(scope, arr);
2570
- }
2571
- }
2572
-
2573
- var forEachAccumulated_1 = forEachAccumulated;
2574
-
2575
- /**
2576
- * Internal queue of events that have accumulated their dispatches and are
2577
- * waiting to have their dispatches executed.
2578
- */
2579
- var eventQueue = null;
2580
-
2581
- /**
2582
- * Dispatches an event and releases it back into the pool, unless persistent.
2583
- *
2584
- * @param {?object} event Synthetic event to be dispatched.
2585
- * @param {boolean} simulated If the event is simulated (changes exn behavior)
2586
- * @private
2587
- */
2588
- var executeDispatchesAndRelease = function(event, simulated) {
2589
- if (event) {
2590
- EventPluginUtils_1.executeDispatchesInOrder(event, simulated);
2591
-
2592
- if (!event.isPersistent()) {
2593
- event.constructor.release(event);
2594
- }
2595
- }
2596
- };
2597
- var executeDispatchesAndReleaseSimulated = function(e) {
2598
- return executeDispatchesAndRelease(e, true);
2599
- };
2600
- var executeDispatchesAndReleaseTopLevel = function(e) {
2601
- return executeDispatchesAndRelease(e, false);
2602
- };
2603
-
2604
- function isInteractive(tag) {
2605
- return (
2606
- tag === 'button' ||
2607
- tag === 'input' ||
2608
- tag === 'select' ||
2609
- tag === 'textarea'
2610
- );
2611
- }
2612
-
2613
- function shouldPreventMouseEvent(name, type, props) {
2614
- switch (name) {
2615
- case 'onClick':
2616
- case 'onClickCapture':
2617
- case 'onDoubleClick':
2618
- case 'onDoubleClickCapture':
2619
- case 'onMouseDown':
2620
- case 'onMouseDownCapture':
2621
- case 'onMouseMove':
2622
- case 'onMouseMoveCapture':
2623
- case 'onMouseUp':
2624
- case 'onMouseUpCapture':
2625
- return !!(props.disabled && isInteractive(type));
2626
- default:
2627
- return false;
2628
- }
2629
- }
2630
-
2631
- /**
2632
- * This is a unified interface for event plugins to be installed and configured.
2633
- *
2634
- * Event plugins can implement the following properties:
2635
- *
2636
- * `extractEvents` {function(string, DOMEventTarget, string, object): *}
2637
- * Required. When a top-level event is fired, this method is expected to
2638
- * extract synthetic events that will in turn be queued and dispatched.
2639
- *
2640
- * `eventTypes` {object}
2641
- * Optional, plugins that fire events must publish a mapping of registration
2642
- * names that are used to register listeners. Values of this mapping must
2643
- * be objects that contain `registrationName` or `phasedRegistrationNames`.
2644
- *
2645
- * `executeDispatch` {function(object, function, string)}
2646
- * Optional, allows plugins to override how an event gets dispatched. By
2647
- * default, the listener is simply invoked.
2648
- *
2649
- * Each plugin that is injected into `EventsPluginHub` is immediately operable.
2650
- *
2651
- * @public
2652
- */
2653
- var EventPluginHub = {
2654
- /**
2655
- * Methods for injecting dependencies.
2656
- */
2657
- injection: {
2658
- /**
2659
- * @param {array} InjectedEventPluginOrder
2660
- * @public
2661
- */
2662
- injectEventPluginOrder: EventPluginRegistry_1.injectEventPluginOrder,
2663
-
2664
- /**
2665
- * @param {object} injectedNamesToPlugins Map from names to plugin modules.
2666
- */
2667
- injectEventPluginsByName: EventPluginRegistry_1.injectEventPluginsByName,
2668
- },
2669
-
2670
- /**
2671
- * @param {object} inst The instance, which is the source of events.
2672
- * @param {string} registrationName Name of listener (e.g. `onClick`).
2673
- * @return {?function} The stored callback.
2674
- */
2675
- getListener: function(inst, registrationName) {
2676
- var listener;
2677
-
2678
- // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
2679
- // live here; needs to be moved to a better place soon
2680
- if (typeof inst.tag === 'number') {
2681
- var stateNode = inst.stateNode;
2682
- if (!stateNode) {
2683
- // Work in progress (ex: onload events in incremental mode).
2684
- return null;
2685
- }
2686
- var props = EventPluginUtils_1.getFiberCurrentPropsFromNode(stateNode);
2687
- if (!props) {
2688
- // Work in progress.
2689
- return null;
2690
- }
2691
- listener = props[registrationName];
2692
- if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
2693
- return null;
2694
- }
2695
- } else {
2696
- var currentElement = inst._currentElement;
2697
- if (
2698
- typeof currentElement === 'string' ||
2699
- typeof currentElement === 'number'
2700
- ) {
2701
- // Text node, let it bubble through.
2702
- return null;
2703
- }
2704
- if (!inst._rootNodeID) {
2705
- // If the instance is already unmounted, we have no listeners.
2706
- return null;
2707
- }
2708
- var _props = currentElement.props;
2709
- listener = _props[registrationName];
2710
- if (
2711
- shouldPreventMouseEvent(registrationName, currentElement.type, _props)
2712
- ) {
2713
- return null;
2714
- }
2715
- }
2716
-
2717
- invariant_1(
2718
- !listener || typeof listener === 'function',
2719
- 'Expected `%s` listener to be a function, instead got a value of `%s` type.',
2720
- registrationName,
2721
- typeof listener
2722
- );
2723
- return listener;
2724
- },
2725
-
2726
- /**
2727
- * Allows registered plugins an opportunity to extract events from top-level
2728
- * native browser events.
2729
- *
2730
- * @return {*} An accumulation of synthetic events.
2731
- * @internal
2732
- */
2733
- extractEvents: function(
2734
- topLevelType,
2735
- targetInst,
2736
- nativeEvent,
2737
- nativeEventTarget
2738
- ) {
2739
- var events;
2740
- var plugins = EventPluginRegistry_1.plugins;
2741
- for (var i = 0; i < plugins.length; i++) {
2742
- // Not every plugin in the ordering may be loaded at runtime.
2743
- var possiblePlugin = plugins[i];
2744
- if (possiblePlugin) {
2745
- var extractedEvents = possiblePlugin.extractEvents(
2746
- topLevelType,
2747
- targetInst,
2748
- nativeEvent,
2749
- nativeEventTarget
2750
- );
2751
- if (extractedEvents) {
2752
- events = accumulateInto_1(events, extractedEvents);
2753
- }
2754
- }
2755
- }
2756
- return events;
2757
- },
2758
-
2759
- /**
2760
- * Enqueues a synthetic event that should be dispatched when
2761
- * `processEventQueue` is invoked.
2762
- *
2763
- * @param {*} events An accumulation of synthetic events.
2764
- * @internal
2765
- */
2766
- enqueueEvents: function(events) {
2767
- if (events) {
2768
- eventQueue = accumulateInto_1(eventQueue, events);
2769
- }
2770
- },
2771
-
2772
- /**
2773
- * Dispatches all synthetic events on the event queue.
2774
- *
2775
- * @internal
2776
- */
2777
- processEventQueue: function(simulated) {
2778
- // Set `eventQueue` to null before processing it so that we can tell if more
2779
- // events get enqueued while processing.
2780
- var processingEventQueue = eventQueue;
2781
- eventQueue = null;
2782
- if (simulated) {
2783
- forEachAccumulated_1(
2784
- processingEventQueue,
2785
- executeDispatchesAndReleaseSimulated
2786
- );
2787
- } else {
2788
- forEachAccumulated_1(
2789
- processingEventQueue,
2790
- executeDispatchesAndReleaseTopLevel
2791
- );
2792
- }
2793
- !!eventQueue
2794
- ? invariant_1(
2795
- false,
2796
- 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.'
2797
- )
2798
- : void 0;
2799
- // This would be a good time to rethrow if any of the event handlers threw.
2800
- ReactErrorUtils_1.rethrowCaughtError();
2801
- },
2802
- };
2803
-
2804
- var EventPluginHub_1 = EventPluginHub;
2805
-
2806
- function runEventQueueInBatch(events) {
2807
- EventPluginHub_1.enqueueEvents(events);
2808
- EventPluginHub_1.processEventQueue(false);
2809
- }
2810
-
2811
- var ReactEventEmitterMixin = {
2812
- /**
2813
- * Streams a fired top-level event to `EventPluginHub` where plugins have the
2814
- * opportunity to create `ReactEvent`s to be dispatched.
2815
- */
2816
- handleTopLevel: function(
2817
- topLevelType,
2818
- targetInst,
2819
- nativeEvent,
2820
- nativeEventTarget
2821
- ) {
2822
- var events = EventPluginHub_1.extractEvents(
2823
- topLevelType,
2824
- targetInst,
2825
- nativeEvent,
2826
- nativeEventTarget
2827
- );
2828
- runEventQueueInBatch(events);
2829
- },
2830
- };
2831
-
2832
- var ReactEventEmitterMixin_1 = ReactEventEmitterMixin;
2833
-
2834
- var useHasFeature;
2835
- if (ExecutionEnvironment_1.canUseDOM) {
2836
- useHasFeature =
2837
- document.implementation &&
2838
- document.implementation.hasFeature &&
2839
- // always returns true in newer browsers as per the standard.
2840
- // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
2841
- document.implementation.hasFeature('', '') !== true;
2842
- }
2843
-
2844
- /**
2845
- * Checks if an event is supported in the current execution environment.
2846
- *
2847
- * NOTE: This will not work correctly for non-generic events such as `change`,
2848
- * `reset`, `load`, `error`, and `select`.
2849
- *
2850
- * Borrows from Modernizr.
2851
- *
2852
- * @param {string} eventNameSuffix Event name, e.g. "click".
2853
- * @param {?boolean} capture Check if the capture phase is supported.
2854
- * @return {boolean} True if the event is supported.
2855
- * @internal
2856
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
2857
- */
2858
- function isEventSupported(eventNameSuffix, capture) {
2859
- if (
2860
- !ExecutionEnvironment_1.canUseDOM ||
2861
- (capture && !('addEventListener' in document))
2862
- ) {
2863
- return false;
2864
- }
2865
-
2866
- var eventName = 'on' + eventNameSuffix;
2867
- var isSupported = eventName in document;
2868
-
2869
- if (!isSupported) {
2870
- var element = document.createElement('div');
2871
- element.setAttribute(eventName, 'return;');
2872
- isSupported = typeof element[eventName] === 'function';
2873
- }
2874
-
2875
- if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
2876
- // This is the only way to test support for the `wheel` event in IE9+.
2877
- isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
2878
- }
2879
-
2880
- return isSupported;
2881
- }
2882
-
2883
- var isEventSupported_1 = isEventSupported;
2884
-
2885
- /**
2886
- * Generate a mapping of standard vendor prefixes using the defined style property and event name.
2887
- *
2888
- * @param {string} styleProp
2889
- * @param {string} eventName
2890
- * @returns {object}
2891
- */
2892
- function makePrefixMap(styleProp, eventName) {
2893
- var prefixes = {};
2894
-
2895
- prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
2896
- prefixes['Webkit' + styleProp] = 'webkit' + eventName;
2897
- prefixes['Moz' + styleProp] = 'moz' + eventName;
2898
- prefixes['ms' + styleProp] = 'MS' + eventName;
2899
- prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
2900
-
2901
- return prefixes;
2902
- }
2903
-
2904
- /**
2905
- * A list of event names to a configurable list of vendor prefixes.
2906
- */
2907
- var vendorPrefixes = {
2908
- animationend: makePrefixMap('Animation', 'AnimationEnd'),
2909
- animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
2910
- animationstart: makePrefixMap('Animation', 'AnimationStart'),
2911
- transitionend: makePrefixMap('Transition', 'TransitionEnd'),
2912
- };
2913
-
2914
- /**
2915
- * Event names that have already been detected and prefixed (if applicable).
2916
- */
2917
- var prefixedEventNames = {};
2918
-
2919
- /**
2920
- * Element to check for prefixes on.
2921
- */
2922
- var style = {};
2923
-
2924
- /**
2925
- * Bootstrap if a DOM exists.
2926
- */
2927
- if (ExecutionEnvironment_1.canUseDOM) {
2928
- style = document.createElement('div').style;
2929
-
2930
- // On some platforms, in particular some releases of Android 4.x,
2931
- // the un-prefixed "animation" and "transition" properties are defined on the
2932
- // style object but the events that fire will still be prefixed, so we need
2933
- // to check if the un-prefixed events are usable, and if not remove them from the map.
2934
- if (!('AnimationEvent' in window)) {
2935
- delete vendorPrefixes.animationend.animation;
2936
- delete vendorPrefixes.animationiteration.animation;
2937
- delete vendorPrefixes.animationstart.animation;
2938
- }
2939
-
2940
- // Same as above
2941
- if (!('TransitionEvent' in window)) {
2942
- delete vendorPrefixes.transitionend.transition;
2943
- }
2944
- }
2945
-
2946
- /**
2947
- * Attempts to determine the correct vendor prefixed event name.
2948
- *
2949
- * @param {string} eventName
2950
- * @returns {string}
2951
- */
2952
- function getVendorPrefixedEventName(eventName) {
2953
- if (prefixedEventNames[eventName]) {
2954
- return prefixedEventNames[eventName];
2955
- } else if (!vendorPrefixes[eventName]) {
2956
- return eventName;
2957
- }
2958
-
2959
- var prefixMap = vendorPrefixes[eventName];
2960
-
2961
- for (var styleProp in prefixMap) {
2962
- if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
2963
- return (prefixedEventNames[eventName] = prefixMap[styleProp]);
2964
- }
2965
- }
2966
-
2967
- return '';
2968
- }
2969
-
2970
- var getVendorPrefixedEventName_1 = getVendorPrefixedEventName;
2971
-
2972
- /**
2973
- * Types of raw signals from the browser caught at the top level.
2974
- *
2975
- * For events like 'submit' which don't consistently bubble (which we
2976
- * trap at a lower node than `document`), binding at `document` would
2977
- * cause duplicate events so we don't include them here.
2978
- */
2979
- var topLevelTypes$1 = {
2980
- topAbort: 'abort',
2981
- topAnimationEnd: getVendorPrefixedEventName_1('animationend') ||
2982
- 'animationend',
2983
- topAnimationIteration: getVendorPrefixedEventName_1('animationiteration') ||
2984
- 'animationiteration',
2985
- topAnimationStart: getVendorPrefixedEventName_1('animationstart') ||
2986
- 'animationstart',
2987
- topBlur: 'blur',
2988
- topCancel: 'cancel',
2989
- topCanPlay: 'canplay',
2990
- topCanPlayThrough: 'canplaythrough',
2991
- topChange: 'change',
2992
- topClick: 'click',
2993
- topClose: 'close',
2994
- topCompositionEnd: 'compositionend',
2995
- topCompositionStart: 'compositionstart',
2996
- topCompositionUpdate: 'compositionupdate',
2997
- topContextMenu: 'contextmenu',
2998
- topCopy: 'copy',
2999
- topCut: 'cut',
3000
- topDoubleClick: 'dblclick',
3001
- topDrag: 'drag',
3002
- topDragEnd: 'dragend',
3003
- topDragEnter: 'dragenter',
3004
- topDragExit: 'dragexit',
3005
- topDragLeave: 'dragleave',
3006
- topDragOver: 'dragover',
3007
- topDragStart: 'dragstart',
3008
- topDrop: 'drop',
3009
- topDurationChange: 'durationchange',
3010
- topEmptied: 'emptied',
3011
- topEncrypted: 'encrypted',
3012
- topEnded: 'ended',
3013
- topError: 'error',
3014
- topFocus: 'focus',
3015
- topInput: 'input',
3016
- topKeyDown: 'keydown',
3017
- topKeyPress: 'keypress',
3018
- topKeyUp: 'keyup',
3019
- topLoadedData: 'loadeddata',
3020
- topLoad: 'load',
3021
- topLoadedMetadata: 'loadedmetadata',
3022
- topLoadStart: 'loadstart',
3023
- topMouseDown: 'mousedown',
3024
- topMouseMove: 'mousemove',
3025
- topMouseOut: 'mouseout',
3026
- topMouseOver: 'mouseover',
3027
- topMouseUp: 'mouseup',
3028
- topPaste: 'paste',
3029
- topPause: 'pause',
3030
- topPlay: 'play',
3031
- topPlaying: 'playing',
3032
- topProgress: 'progress',
3033
- topRateChange: 'ratechange',
3034
- topScroll: 'scroll',
3035
- topSeeked: 'seeked',
3036
- topSeeking: 'seeking',
3037
- topSelectionChange: 'selectionchange',
3038
- topStalled: 'stalled',
3039
- topSuspend: 'suspend',
3040
- topTextInput: 'textInput',
3041
- topTimeUpdate: 'timeupdate',
3042
- topToggle: 'toggle',
3043
- topTouchCancel: 'touchcancel',
3044
- topTouchEnd: 'touchend',
3045
- topTouchMove: 'touchmove',
3046
- topTouchStart: 'touchstart',
3047
- topTransitionEnd: getVendorPrefixedEventName_1('transitionend') ||
3048
- 'transitionend',
3049
- topVolumeChange: 'volumechange',
3050
- topWaiting: 'waiting',
3051
- topWheel: 'wheel',
3052
- };
3053
-
3054
- var BrowserEventConstants = {
3055
- topLevelTypes: topLevelTypes$1,
3056
- };
3057
-
3058
- var BrowserEventConstants_1 = BrowserEventConstants;
3059
-
3060
- var topLevelTypes = BrowserEventConstants_1.topLevelTypes;
3061
-
3062
- /**
3063
- * Summary of `ReactBrowserEventEmitter` event handling:
3064
- *
3065
- * - Top-level delegation is used to trap most native browser events. This
3066
- * may only occur in the main thread and is the responsibility of
3067
- * ReactDOMEventListener, which is injected and can therefore support
3068
- * pluggable event sources. This is the only work that occurs in the main
3069
- * thread.
3070
- *
3071
- * - We normalize and de-duplicate events to account for browser quirks. This
3072
- * may be done in the worker thread.
3073
- *
3074
- * - Forward these native events (with the associated top-level type used to
3075
- * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
3076
- * to extract any synthetic events.
3077
- *
3078
- * - The `EventPluginHub` will then process each event by annotating them with
3079
- * "dispatches", a sequence of listeners and IDs that care about that event.
3080
- *
3081
- * - The `EventPluginHub` then dispatches the events.
3082
- *
3083
- * Overview of React and the event system:
3084
- *
3085
- * +------------+ .
3086
- * | DOM | .
3087
- * +------------+ .
3088
- * | .
3089
- * v .
3090
- * +------------+ .
3091
- * | ReactEvent | .
3092
- * | Listener | .
3093
- * +------------+ . +-----------+
3094
- * | . +--------+|SimpleEvent|
3095
- * | . | |Plugin |
3096
- * +-----|------+ . v +-----------+
3097
- * | | | . +--------------+ +------------+
3098
- * | +-----------.--->|EventPluginHub| | Event |
3099
- * | | . | | +-----------+ | Propagators|
3100
- * | ReactEvent | . | | |TapEvent | |------------|
3101
- * | Emitter | . | |<---+|Plugin | |other plugin|
3102
- * | | . | | +-----------+ | utilities |
3103
- * | +-----------.--->| | +------------+
3104
- * | | | . +--------------+
3105
- * +-----|------+ . ^ +-----------+
3106
- * | . | |Enter/Leave|
3107
- * + . +-------+|Plugin |
3108
- * +-------------+ . +-----------+
3109
- * | application | .
3110
- * |-------------| .
3111
- * | | .
3112
- * | | .
3113
- * +-------------+ .
3114
- * .
3115
- * React Core . General Purpose Event Plugin System
3116
- */
3117
-
3118
- var alreadyListeningTo = {};
3119
- var reactTopListenersCounter = 0;
3120
-
3121
- /**
3122
- * To ensure no conflicts with other potential React instances on the page
3123
- */
3124
- var topListenersIDKey = '_reactListenersID' + ('' + Math.random()).slice(2);
3125
-
3126
- function getListeningForDocument(mountAt) {
3127
- // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
3128
- // directly.
3129
- if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
3130
- mountAt[topListenersIDKey] = reactTopListenersCounter++;
3131
- alreadyListeningTo[mountAt[topListenersIDKey]] = {};
3132
- }
3133
- return alreadyListeningTo[mountAt[topListenersIDKey]];
3134
- }
3135
-
3136
- var ReactBrowserEventEmitter = index({}, ReactEventEmitterMixin_1, {
3137
- /**
3138
- * Sets whether or not any created callbacks should be enabled.
3139
- *
3140
- * @param {boolean} enabled True if callbacks should be enabled.
3141
- */
3142
- setEnabled: function(enabled) {
3143
- if (ReactDOMEventListener_1) {
3144
- ReactDOMEventListener_1.setEnabled(enabled);
3145
- }
3146
- },
3147
-
3148
- /**
3149
- * @return {boolean} True if callbacks are enabled.
3150
- */
3151
- isEnabled: function() {
3152
- return !!(ReactDOMEventListener_1 && ReactDOMEventListener_1.isEnabled());
3153
- },
3154
-
3155
- /**
3156
- * We listen for bubbled touch events on the document object.
3157
- *
3158
- * Firefox v8.01 (and possibly others) exhibited strange behavior when
3159
- * mounting `onmousemove` events at some node that was not the document
3160
- * element. The symptoms were that if your mouse is not moving over something
3161
- * contained within that mount point (for example on the background) the
3162
- * top-level listeners for `onmousemove` won't be called. However, if you
3163
- * register the `mousemove` on the document object, then it will of course
3164
- * catch all `mousemove`s. This along with iOS quirks, justifies restricting
3165
- * top-level listeners to the document object only, at least for these
3166
- * movement types of events and possibly all events.
3167
- *
3168
- * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
3169
- *
3170
- * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
3171
- * they bubble to document.
3172
- *
3173
- * @param {string} registrationName Name of listener (e.g. `onClick`).
3174
- * @param {object} contentDocumentHandle Document which owns the container
3175
- */
3176
- listenTo: function(registrationName, contentDocumentHandle) {
3177
- var mountAt = contentDocumentHandle;
3178
- var isListening = getListeningForDocument(mountAt);
3179
- var dependencies =
3180
- EventPluginRegistry_1.registrationNameDependencies[registrationName];
3181
-
3182
- for (var i = 0; i < dependencies.length; i++) {
3183
- var dependency = dependencies[i];
3184
- if (
3185
- !(isListening.hasOwnProperty(dependency) && isListening[dependency])
3186
- ) {
3187
- if (dependency === 'topWheel') {
3188
- if (isEventSupported_1('wheel')) {
3189
- ReactDOMEventListener_1.trapBubbledEvent(
3190
- 'topWheel',
3191
- 'wheel',
3192
- mountAt
3193
- );
3194
- } else if (isEventSupported_1('mousewheel')) {
3195
- ReactDOMEventListener_1.trapBubbledEvent(
3196
- 'topWheel',
3197
- 'mousewheel',
3198
- mountAt
3199
- );
3200
- } else {
3201
- // Firefox needs to capture a different mouse scroll event.
3202
- // @see http://www.quirksmode.org/dom/events/tests/scroll.html
3203
- ReactDOMEventListener_1.trapBubbledEvent(
3204
- 'topWheel',
3205
- 'DOMMouseScroll',
3206
- mountAt
3207
- );
3208
- }
3209
- } else if (dependency === 'topScroll') {
3210
- ReactDOMEventListener_1.trapCapturedEvent(
3211
- 'topScroll',
3212
- 'scroll',
3213
- mountAt
3214
- );
3215
- } else if (dependency === 'topFocus' || dependency === 'topBlur') {
3216
- ReactDOMEventListener_1.trapCapturedEvent(
3217
- 'topFocus',
3218
- 'focus',
3219
- mountAt
3220
- );
3221
- ReactDOMEventListener_1.trapCapturedEvent(
3222
- 'topBlur',
3223
- 'blur',
3224
- mountAt
3225
- );
3226
-
3227
- // to make sure blur and focus event listeners are only attached once
3228
- isListening.topBlur = true;
3229
- isListening.topFocus = true;
3230
- } else if (dependency === 'topCancel') {
3231
- if (isEventSupported_1('cancel', true)) {
3232
- ReactDOMEventListener_1.trapCapturedEvent(
3233
- 'topCancel',
3234
- 'cancel',
3235
- mountAt
3236
- );
3237
- }
3238
- isListening.topCancel = true;
3239
- } else if (dependency === 'topClose') {
3240
- if (isEventSupported_1('close', true)) {
3241
- ReactDOMEventListener_1.trapCapturedEvent(
3242
- 'topClose',
3243
- 'close',
3244
- mountAt
3245
- );
3246
- }
3247
- isListening.topClose = true;
3248
- } else if (topLevelTypes.hasOwnProperty(dependency)) {
3249
- ReactDOMEventListener_1.trapBubbledEvent(
3250
- dependency,
3251
- topLevelTypes[dependency],
3252
- mountAt
3253
- );
3254
- }
3255
-
3256
- isListening[dependency] = true;
3257
- }
3258
- }
3259
- },
3260
-
3261
- isListeningToAllDependencies: function(registrationName, mountAt) {
3262
- var isListening = getListeningForDocument(mountAt);
3263
- var dependencies =
3264
- EventPluginRegistry_1.registrationNameDependencies[registrationName];
3265
- for (var i = 0; i < dependencies.length; i++) {
3266
- var dependency = dependencies[i];
3267
- if (
3268
- !(isListening.hasOwnProperty(dependency) && isListening[dependency])
3269
- ) {
3270
- return false;
3271
- }
3272
- }
3273
- return true;
3274
- },
3275
-
3276
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
3277
- return ReactDOMEventListener_1.trapBubbledEvent(
3278
- topLevelType,
3279
- handlerBaseName,
3280
- handle
3281
- );
3282
- },
3283
-
3284
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
3285
- return ReactDOMEventListener_1.trapCapturedEvent(
3286
- topLevelType,
3287
- handlerBaseName,
3288
- handle
3289
- );
3290
- },
3291
- });
3292
-
3293
- var ReactBrowserEventEmitter_1 = ReactBrowserEventEmitter;
3294
-
3295
- /**
3296
- * Copyright 2013-present, Facebook, Inc.
3297
- * All rights reserved.
3298
- *
3299
- * This source code is licensed under the BSD-style license found in the
3300
- * LICENSE file in the root directory of this source tree. An additional grant
3301
- * of patent rights can be found in the PATENTS file in the same directory.
3302
- *
3303
- * @providesModule ReactFeatureFlags
3304
- *
3305
- */
3306
-
3307
- var ReactFeatureFlags = {
3308
- disableNewFiberFeatures: false,
3309
- enableAsyncSubtreeAPI: true,
3310
- };
3311
-
3312
- var ReactFeatureFlags_1 = ReactFeatureFlags;
3313
-
3314
- /**
3315
- * Copyright 2013-present, Facebook, Inc.
3316
- * All rights reserved.
3317
- *
3318
- * This source code is licensed under the BSD-style license found in the
3319
- * LICENSE file in the root directory of this source tree. An additional grant
3320
- * of patent rights can be found in the PATENTS file in the same directory.
3321
- *
3322
- * @providesModule ReactDOMFeatureFlags
3323
- */
3324
-
3325
- var ReactDOMFeatureFlags = {
3326
- fiberAsyncScheduling: false,
3327
- useFiber: true,
3328
- };
3329
-
3330
- var ReactDOMFeatureFlags_1 = ReactDOMFeatureFlags;
3331
-
3332
- /**
3333
- * Copyright 2013-present, Facebook, Inc.
3334
- * All rights reserved.
3335
- *
3336
- * This source code is licensed under the BSD-style license found in the
3337
- * LICENSE file in the root directory of this source tree. An additional grant
3338
- * of patent rights can be found in the PATENTS file in the same directory.
3339
- *
3340
- * @providesModule CSSProperty
3341
- */
3342
-
3343
- /**
3344
- * CSS properties which accept numbers but are not in units of "px".
3345
- */
3346
-
3347
- var isUnitlessNumber = {
3348
- animationIterationCount: true,
3349
- borderImageOutset: true,
3350
- borderImageSlice: true,
3351
- borderImageWidth: true,
3352
- boxFlex: true,
3353
- boxFlexGroup: true,
3354
- boxOrdinalGroup: true,
3355
- columnCount: true,
3356
- columns: true,
3357
- flex: true,
3358
- flexGrow: true,
3359
- flexPositive: true,
3360
- flexShrink: true,
3361
- flexNegative: true,
3362
- flexOrder: true,
3363
- gridRow: true,
3364
- gridRowEnd: true,
3365
- gridRowSpan: true,
3366
- gridRowStart: true,
3367
- gridColumn: true,
3368
- gridColumnEnd: true,
3369
- gridColumnSpan: true,
3370
- gridColumnStart: true,
3371
- fontWeight: true,
3372
- lineClamp: true,
3373
- lineHeight: true,
3374
- opacity: true,
3375
- order: true,
3376
- orphans: true,
3377
- tabSize: true,
3378
- widows: true,
3379
- zIndex: true,
3380
- zoom: true,
3381
-
3382
- // SVG-related properties
3383
- fillOpacity: true,
3384
- floodOpacity: true,
3385
- stopOpacity: true,
3386
- strokeDasharray: true,
3387
- strokeDashoffset: true,
3388
- strokeMiterlimit: true,
3389
- strokeOpacity: true,
3390
- strokeWidth: true,
3391
- };
3392
-
3393
- /**
3394
- * @param {string} prefix vendor-specific prefix, eg: Webkit
3395
- * @param {string} key style name, eg: transitionDuration
3396
- * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
3397
- * WebkitTransitionDuration
3398
- */
3399
- function prefixKey(prefix, key) {
3400
- return prefix + key.charAt(0).toUpperCase() + key.substring(1);
3401
- }
3402
-
3403
- /**
3404
- * Support style names that may come passed in prefixed by adding permutations
3405
- * of vendor prefixes.
3406
- */
3407
- var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
3408
-
3409
- // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
3410
- // infinite loop, because it iterates over the newly added props too.
3411
- Object.keys(isUnitlessNumber).forEach(function(prop) {
3412
- prefixes.forEach(function(prefix) {
3413
- isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
3414
- });
3415
- });
3416
-
3417
- /**
3418
- * Most style properties can be unset by doing .style[prop] = '' but IE8
3419
- * doesn't like doing that with shorthand properties so for the properties that
3420
- * IE8 breaks on, which are listed here, we instead unset each of the
3421
- * individual properties. See http://bugs.jquery.com/ticket/12385.
3422
- * The 4-value 'clock' properties like margin, padding, border-width seem to
3423
- * behave without any problems. Curiously, list-style works too without any
3424
- * special prodding.
3425
- */
3426
- var shorthandPropertyExpansions = {
3427
- background: {
3428
- backgroundAttachment: true,
3429
- backgroundColor: true,
3430
- backgroundImage: true,
3431
- backgroundPositionX: true,
3432
- backgroundPositionY: true,
3433
- backgroundRepeat: true,
3434
- },
3435
- backgroundPosition: {
3436
- backgroundPositionX: true,
3437
- backgroundPositionY: true,
3438
- },
3439
- border: {
3440
- borderWidth: true,
3441
- borderStyle: true,
3442
- borderColor: true,
3443
- },
3444
- borderBottom: {
3445
- borderBottomWidth: true,
3446
- borderBottomStyle: true,
3447
- borderBottomColor: true,
3448
- },
3449
- borderLeft: {
3450
- borderLeftWidth: true,
3451
- borderLeftStyle: true,
3452
- borderLeftColor: true,
3453
- },
3454
- borderRight: {
3455
- borderRightWidth: true,
3456
- borderRightStyle: true,
3457
- borderRightColor: true,
3458
- },
3459
- borderTop: {
3460
- borderTopWidth: true,
3461
- borderTopStyle: true,
3462
- borderTopColor: true,
3463
- },
3464
- font: {
3465
- fontStyle: true,
3466
- fontVariant: true,
3467
- fontWeight: true,
3468
- fontSize: true,
3469
- lineHeight: true,
3470
- fontFamily: true,
3471
- },
3472
- outline: {
3473
- outlineWidth: true,
3474
- outlineStyle: true,
3475
- outlineColor: true,
3476
- },
3477
- };
3478
-
3479
- var CSSProperty = {
3480
- isUnitlessNumber: isUnitlessNumber,
3481
- shorthandPropertyExpansions: shorthandPropertyExpansions,
3482
- };
3483
-
3484
- var CSSProperty_1 = CSSProperty;
3485
-
3486
- var isUnitlessNumber$1 = CSSProperty_1.isUnitlessNumber;
3487
-
3488
- /**
3489
- * Convert a value into the proper css writable value. The style name `name`
3490
- * should be logical (no hyphens), as specified
3491
- * in `CSSProperty.isUnitlessNumber`.
3492
- *
3493
- * @param {string} name CSS property name such as `topMargin`.
3494
- * @param {*} value CSS property value such as `10px`.
3495
- * @return {string} Normalized style value with dimensions applied.
3496
- */
3497
- function dangerousStyleValue(name, value, isCustomProperty) {
3498
- // Note that we've removed escapeTextForBrowser() calls here since the
3499
- // whole string will be escaped when the attribute is injected into
3500
- // the markup. If you provide unsafe user data here they can inject
3501
- // arbitrary CSS which may be problematic (I couldn't repro this):
3502
- // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
3503
- // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
3504
- // This is not an XSS hole but instead a potential CSS injection issue
3505
- // which has lead to a greater discussion about how we're going to
3506
- // trust URLs moving forward. See #2115901
3507
-
3508
- var isEmpty = value == null || typeof value === 'boolean' || value === '';
3509
- if (isEmpty) {
3510
- return '';
3511
- }
3512
-
3513
- if (
3514
- !isCustomProperty &&
3515
- typeof value === 'number' &&
3516
- value !== 0 &&
3517
- !(isUnitlessNumber$1.hasOwnProperty(name) && isUnitlessNumber$1[name])
3518
- ) {
3519
- return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
3520
- }
3521
-
3522
- return ('' + value).trim();
3523
- }
3524
-
3525
- var dangerousStyleValue_1 = dangerousStyleValue;
3526
-
3527
- /**
3528
- * Copyright (c) 2013-present, Facebook, Inc.
3529
- * All rights reserved.
3530
- *
3531
- * This source code is licensed under the BSD-style license found in the
3532
- * LICENSE file in the root directory of this source tree. An additional grant
3533
- * of patent rights can be found in the PATENTS file in the same directory.
3534
- *
3535
- * @typechecks
3536
- */
3537
-
3538
- var _uppercasePattern = /([A-Z])/g;
3539
-
3540
- /**
3541
- * Hyphenates a camelcased string, for example:
3542
- *
3543
- * > hyphenate('backgroundColor')
3544
- * < "background-color"
3545
- *
3546
- * For CSS style names, use `hyphenateStyleName` instead which works properly
3547
- * with all vendor prefixes, including `ms`.
3548
- *
3549
- * @param {string} string
3550
- * @return {string}
3551
- */
3552
- function hyphenate(string) {
3553
- return string.replace(_uppercasePattern, '-$1').toLowerCase();
3554
- }
3555
-
3556
- var hyphenate_1 = hyphenate;
3557
-
3558
- var msPattern = /^ms-/;
3559
-
3560
- /**
3561
- * Hyphenates a camelcased CSS property name, for example:
3562
- *
3563
- * > hyphenateStyleName('backgroundColor')
3564
- * < "background-color"
3565
- * > hyphenateStyleName('MozTransition')
3566
- * < "-moz-transition"
3567
- * > hyphenateStyleName('msTransition')
3568
- * < "-ms-transition"
3569
- *
3570
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
3571
- * is converted to `-ms-`.
3572
- *
3573
- * @param {string} string
3574
- * @return {string}
3575
- */
3576
- function hyphenateStyleName$1(string) {
3577
- return hyphenate_1(string).replace(msPattern, '-ms-');
3578
- }
3579
-
3580
- var hyphenateStyleName_1 = hyphenateStyleName$1;
3581
-
3582
- /**
3583
- * Copyright (c) 2013-present, Facebook, Inc.
3584
- * All rights reserved.
3585
- *
3586
- * This source code is licensed under the BSD-style license found in the
3587
- * LICENSE file in the root directory of this source tree. An additional grant
3588
- * of patent rights can be found in the PATENTS file in the same directory.
3589
- *
3590
- * @typechecks
3591
- */
3592
-
3593
- var _hyphenPattern = /-(.)/g;
3594
-
3595
- /**
3596
- * Camelcases a hyphenated string, for example:
3597
- *
3598
- * > camelize('background-color')
3599
- * < "backgroundColor"
3600
- *
3601
- * @param {string} string
3602
- * @return {string}
3603
- */
3604
- function camelize(string) {
3605
- return string.replace(_hyphenPattern, function(_, character) {
3606
- return character.toUpperCase();
3607
- });
3608
- }
3609
-
3610
- var camelize_1 = camelize;
3611
-
3612
- var msPattern$1 = /^-ms-/;
3613
-
3614
- /**
3615
- * Camelcases a hyphenated CSS property name, for example:
3616
- *
3617
- * > camelizeStyleName('background-color')
3618
- * < "backgroundColor"
3619
- * > camelizeStyleName('-moz-transition')
3620
- * < "MozTransition"
3621
- * > camelizeStyleName('-ms-transition')
3622
- * < "msTransition"
3623
- *
3624
- * As Andi Smith suggests
3625
- * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
3626
- * is converted to lowercase `ms`.
3627
- *
3628
- * @param {string} string
3629
- * @return {string}
3630
- */
3631
- function camelizeStyleName$1(string) {
3632
- return camelize_1(string.replace(msPattern$1, 'ms-'));
3633
- }
3634
-
3635
- var camelizeStyleName_1 = camelizeStyleName$1;
3636
-
3637
- /**
3638
- * Copyright 2016-present, Facebook, Inc.
3639
- * All rights reserved.
3640
- *
3641
- * This source code is licensed under the BSD-style license found in the
3642
- * LICENSE file in the root directory of this source tree. An additional grant
3643
- * of patent rights can be found in the PATENTS file in the same directory.
3644
- *
3645
- *
3646
- * @providesModule describeComponentFrame
3647
- */
3648
-
3649
- var describeComponentFrame = function(name, source, ownerName) {
3650
- return (
3651
- '\n in ' +
3652
- (name || 'Unknown') +
3653
- (source
3654
- ? ' (at ' +
3655
- source.fileName.replace(/^.*[\\\/]/, '') +
3656
- ':' +
3657
- source.lineNumber +
3658
- ')'
3659
- : ownerName ? ' (created by ' + ownerName + ')' : '')
3660
- );
3661
- };
3662
-
3663
- var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent;
3664
- var FunctionalComponent = ReactTypeOfWork.FunctionalComponent;
3665
- var ClassComponent$1 = ReactTypeOfWork.ClassComponent;
3666
- var HostComponent$2 = ReactTypeOfWork.HostComponent;
3667
-
3668
- function describeFiber(fiber) {
3669
- switch (fiber.tag) {
3670
- case IndeterminateComponent:
3671
- case FunctionalComponent:
3672
- case ClassComponent$1:
3673
- case HostComponent$2:
3674
- var owner = fiber._debugOwner;
3675
- var source = fiber._debugSource;
3676
- var name = getComponentName_1(fiber);
3677
- var ownerName = null;
3678
- if (owner) {
3679
- ownerName = getComponentName_1(owner);
3680
- }
3681
- return describeComponentFrame(name, source, ownerName);
3682
- default:
3683
- return '';
3684
- }
3685
- }
3686
-
3687
- // This function can only be called with a work-in-progress fiber and
3688
- // only during begin or complete phase. Do not call it under any other
3689
- // circumstances.
3690
- function getStackAddendumByWorkInProgressFiber$1(workInProgress) {
3691
- var info = '';
3692
- var node = workInProgress;
3693
- do {
3694
- info += describeFiber(node);
3695
- // Otherwise this return pointer might point to the wrong tree:
3696
- node = node['return'];
3697
- } while (node);
3698
- return info;
3699
- }
3700
-
3701
- var ReactFiberComponentTreeHook = {
3702
- getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$1,
3703
- };
3704
-
3705
- var ReactDebugCurrentFrame = ReactGlobalSharedState_1.ReactDebugCurrentFrame;
3706
-
3707
- {
3708
- var getComponentName$3 = getComponentName_1;
3709
-
3710
- var _require2$2 = ReactFiberComponentTreeHook,
3711
- getStackAddendumByWorkInProgressFiber =
3712
- _require2$2.getStackAddendumByWorkInProgressFiber;
3713
- }
3714
-
3715
- function getCurrentFiberOwnerName$2() {
3716
- {
3717
- var fiber = ReactDebugCurrentFiber.current;
3718
- if (fiber === null) {
3719
- return null;
3720
- }
3721
- if (fiber._debugOwner != null) {
3722
- return getComponentName$3(fiber._debugOwner);
3723
- }
3724
- }
3725
- return null;
3726
- }
3727
-
3728
- function getCurrentFiberStackAddendum$1() {
3729
- {
3730
- var fiber = ReactDebugCurrentFiber.current;
3731
- if (fiber === null) {
3732
- return null;
3733
- }
3734
- // Safe because if current fiber exists, we are reconciling,
3735
- // and it is guaranteed to be the work-in-progress version.
3736
- return getStackAddendumByWorkInProgressFiber(fiber);
3737
- }
3738
- return null;
3739
- }
3740
-
3741
- function resetCurrentFiber() {
3742
- ReactDebugCurrentFrame.getCurrentStack = null;
3743
- ReactDebugCurrentFiber.current = null;
3744
- ReactDebugCurrentFiber.phase = null;
3745
- }
3746
-
3747
- function setCurrentFiber(fiber, phase) {
3748
- ReactDebugCurrentFrame.getCurrentStack = getCurrentFiberStackAddendum$1;
3749
- ReactDebugCurrentFiber.current = fiber;
3750
- ReactDebugCurrentFiber.phase = phase;
3751
- }
3752
-
3753
- var ReactDebugCurrentFiber = {
3754
- current: null,
3755
- phase: null,
3756
- resetCurrentFiber: resetCurrentFiber,
3757
- setCurrentFiber: setCurrentFiber,
3758
- getCurrentFiberOwnerName: getCurrentFiberOwnerName$2,
3759
- getCurrentFiberStackAddendum: getCurrentFiberStackAddendum$1,
3760
- };
3761
-
3762
- var ReactDebugCurrentFiber_1 = ReactDebugCurrentFiber;
3763
-
3764
- var warnValidStyle$1 = emptyFunction_1;
3765
-
3766
- {
3767
- var camelizeStyleName = camelizeStyleName_1;
3768
- var getComponentName$2 = getComponentName_1;
3769
- var warning$5 = warning_1;
3770
-
3771
- var _require$3 = ReactDebugCurrentFiber_1,
3772
- getCurrentFiberOwnerName$1 = _require$3.getCurrentFiberOwnerName;
3773
-
3774
- // 'msTransform' is correct, but the other prefixes should be capitalized
3775
-
3776
- var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
3777
-
3778
- // style values shouldn't contain a semicolon
3779
- var badStyleValueWithSemicolonPattern = /;\s*$/;
3780
-
3781
- var warnedStyleNames = {};
3782
- var warnedStyleValues = {};
3783
- var warnedForNaNValue = false;
3784
- var warnedForInfinityValue = false;
3785
-
3786
- var warnHyphenatedStyleName = function(name, owner) {
3787
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
3788
- return;
3789
- }
3790
-
3791
- warnedStyleNames[name] = true;
3792
- warning$5(
3793
- false,
3794
- 'Unsupported style property %s. Did you mean %s?%s',
3795
- name,
3796
- camelizeStyleName(name),
3797
- checkRenderMessage(owner)
3798
- );
3799
- };
3800
-
3801
- var warnBadVendoredStyleName = function(name, owner) {
3802
- if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
3803
- return;
3804
- }
3805
-
3806
- warnedStyleNames[name] = true;
3807
- warning$5(
3808
- false,
3809
- 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s',
3810
- name,
3811
- name.charAt(0).toUpperCase() + name.slice(1),
3812
- checkRenderMessage(owner)
3813
- );
3814
- };
3815
-
3816
- var warnStyleValueWithSemicolon = function(name, value, owner) {
3817
- if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
3818
- return;
3819
- }
3820
-
3821
- warnedStyleValues[value] = true;
3822
- warning$5(
3823
- false,
3824
- "Style property values shouldn't contain a semicolon.%s " +
3825
- 'Try "%s: %s" instead.',
3826
- checkRenderMessage(owner),
3827
- name,
3828
- value.replace(badStyleValueWithSemicolonPattern, '')
3829
- );
3830
- };
3831
-
3832
- var warnStyleValueIsNaN = function(name, value, owner) {
3833
- if (warnedForNaNValue) {
3834
- return;
3835
- }
3836
-
3837
- warnedForNaNValue = true;
3838
- warning$5(
3839
- false,
3840
- '`NaN` is an invalid value for the `%s` css style property.%s',
3841
- name,
3842
- checkRenderMessage(owner)
3843
- );
3844
- };
3845
-
3846
- var warnStyleValueIsInfinity = function(name, value, owner) {
3847
- if (warnedForInfinityValue) {
3848
- return;
3849
- }
3850
-
3851
- warnedForInfinityValue = true;
3852
- warning$5(
3853
- false,
3854
- '`Infinity` is an invalid value for the `%s` css style property.%s',
3855
- name,
3856
- checkRenderMessage(owner)
3857
- );
3858
- };
3859
-
3860
- var checkRenderMessage = function(owner) {
3861
- var ownerName;
3862
- if (owner != null) {
3863
- // Stack passes the owner manually all the way to CSSPropertyOperations.
3864
- ownerName = getComponentName$2(owner);
3865
- } else {
3866
- // Fiber doesn't pass it but uses ReactDebugCurrentFiber to track it.
3867
- // It is only enabled in development and tracks host components too.
3868
- ownerName = getCurrentFiberOwnerName$1();
3869
- // TODO: also report the stack.
3870
- }
3871
- if (ownerName) {
3872
- return '\n\nCheck the render method of `' + ownerName + '`.';
3873
- }
3874
- return '';
3875
- };
3876
-
3877
- warnValidStyle$1 = function(name, value, component) {
3878
- var owner;
3879
- if (component) {
3880
- // TODO: this only works with Stack. Seems like we need to add unit tests?
3881
- owner = component._currentElement._owner;
3882
- }
3883
- if (name.indexOf('-') > -1) {
3884
- warnHyphenatedStyleName(name, owner);
3885
- } else if (badVendoredStyleNamePattern.test(name)) {
3886
- warnBadVendoredStyleName(name, owner);
3887
- } else if (badStyleValueWithSemicolonPattern.test(value)) {
3888
- warnStyleValueWithSemicolon(name, value, owner);
3889
- }
3890
-
3891
- if (typeof value === 'number') {
3892
- if (isNaN(value)) {
3893
- warnStyleValueIsNaN(name, value, owner);
3894
- } else if (!isFinite(value)) {
3895
- warnStyleValueIsInfinity(name, value, owner);
3896
- }
3897
- }
3898
- };
3899
- }
3900
-
3901
- var warnValidStyle_1 = warnValidStyle$1;
3902
-
3903
- {
3904
- var hyphenateStyleName = hyphenateStyleName_1;
3905
- var warnValidStyle = warnValidStyle_1;
3906
- }
3907
-
3908
- var hasShorthandPropertyBug = false;
3909
- if (ExecutionEnvironment_1.canUseDOM) {
3910
- var tempStyle = document.createElement('div').style;
3911
- try {
3912
- // IE8 throws "Invalid argument." if resetting shorthand style properties.
3913
- tempStyle.font = '';
3914
- } catch (e) {
3915
- hasShorthandPropertyBug = true;
3916
- }
3917
- }
3918
-
3919
- /**
3920
- * Operations for dealing with CSS properties.
3921
- */
3922
- var CSSPropertyOperations = {
3923
- /**
3924
- * This creates a string that is expected to be equivalent to the style
3925
- * attribute generated by server-side rendering. It by-passes warnings and
3926
- * security checks so it's not safe to use this value for anything other than
3927
- * comparison. It is only used in DEV for SSR validation.
3928
- */
3929
- createDangerousStringForStyles: function(styles) {
3930
- {
3931
- var serialized = '';
3932
- var delimiter = '';
3933
- for (var styleName in styles) {
3934
- if (!styles.hasOwnProperty(styleName)) {
3935
- continue;
3936
- }
3937
- var styleValue = styles[styleName];
3938
- if (styleValue != null) {
3939
- var isCustomProperty = styleName.indexOf('--') === 0;
3940
- serialized += delimiter + hyphenateStyleName(styleName) + ':';
3941
- serialized += dangerousStyleValue_1(
3942
- styleName,
3943
- styleValue,
3944
- isCustomProperty
3945
- );
3946
-
3947
- delimiter = ';';
3948
- }
3949
- }
3950
- return serialized || null;
3951
- }
3952
- },
3953
-
3954
- /**
3955
- * Sets the value for multiple styles on a node. If a value is specified as
3956
- * '' (empty string), the corresponding style property will be unset.
3957
- *
3958
- * @param {DOMElement} node
3959
- * @param {object} styles
3960
- * @param {ReactDOMComponent} component
3961
- */
3962
- setValueForStyles: function(node, styles, component) {
3963
- var style = node.style;
3964
- for (var styleName in styles) {
3965
- if (!styles.hasOwnProperty(styleName)) {
3966
- continue;
3967
- }
3968
- var isCustomProperty = styleName.indexOf('--') === 0;
3969
- {
3970
- if (!isCustomProperty) {
3971
- warnValidStyle(styleName, styles[styleName], component);
3972
- }
3973
- }
3974
- var styleValue = dangerousStyleValue_1(
3975
- styleName,
3976
- styles[styleName],
3977
- isCustomProperty
3978
- );
3979
- if (styleName === 'float') {
3980
- styleName = 'cssFloat';
3981
- }
3982
- if (isCustomProperty) {
3983
- style.setProperty(styleName, styleValue);
3984
- } else if (styleValue) {
3985
- style[styleName] = styleValue;
3986
- } else {
3987
- var expansion =
3988
- hasShorthandPropertyBug &&
3989
- CSSProperty_1.shorthandPropertyExpansions[styleName];
3990
- if (expansion) {
3991
- // Shorthand property that IE8 won't like unsetting, so unset each
3992
- // component to placate it
3993
- for (var individualStyleName in expansion) {
3994
- style[individualStyleName] = '';
3995
- }
3996
- } else {
3997
- style[styleName] = '';
3998
- }
3999
- }
4000
- }
4001
- },
4002
- };
4003
-
4004
- var CSSPropertyOperations_1 = CSSPropertyOperations;
4005
-
4006
- var ReactInvalidSetStateWarningHook = {};
4007
-
4008
- {
4009
- var warning$8 = warning_1;
4010
- var processingChildContext = false;
4011
-
4012
- var warnInvalidSetState = function() {
4013
- warning$8(
4014
- !processingChildContext,
4015
- 'setState(...): Cannot call setState() inside getChildContext()'
4016
- );
4017
- };
4018
-
4019
- ReactInvalidSetStateWarningHook = {
4020
- onBeginProcessingChildContext: function() {
4021
- processingChildContext = true;
4022
- },
4023
- onEndProcessingChildContext: function() {
4024
- processingChildContext = false;
4025
- },
4026
- onSetState: function() {
4027
- warnInvalidSetState();
4028
- },
4029
- };
4030
- }
4031
-
4032
- var ReactInvalidSetStateWarningHook_1 = ReactInvalidSetStateWarningHook;
4033
-
4034
- /**
4035
- * Copyright 2016-present, Facebook, Inc.
4036
- * All rights reserved.
4037
- *
4038
- * This source code is licensed under the BSD-style license found in the
4039
- * LICENSE file in the root directory of this source tree. An additional grant
4040
- * of patent rights can be found in the PATENTS file in the same directory.
4041
- *
4042
- * @providesModule ReactHostOperationHistoryHook
4043
- *
4044
- */
4045
-
4046
- // Trust the developer to only use this with a true check
4047
- var ReactHostOperationHistoryHook = null;
4048
-
4049
- {
4050
- var history = [];
4051
-
4052
- ReactHostOperationHistoryHook = {
4053
- onHostOperation: function(operation) {
4054
- history.push(operation);
4055
- },
4056
- clearHistory: function() {
4057
- if (ReactHostOperationHistoryHook._preventClearing) {
4058
- // Should only be used for tests.
4059
- return;
4060
- }
4061
-
4062
- history = [];
4063
- },
4064
- getHistory: function() {
4065
- return history;
4066
- },
4067
- };
4068
- }
4069
-
4070
- var ReactHostOperationHistoryHook_1 = ReactHostOperationHistoryHook;
4071
-
4072
- var performance$1;
4073
-
4074
- if (ExecutionEnvironment_1.canUseDOM) {
4075
- performance$1 =
4076
- window.performance || window.msPerformance || window.webkitPerformance;
4077
- }
4078
-
4079
- var performance_1 = performance$1 || {};
4080
-
4081
- /**
4082
- * Copyright (c) 2013-present, Facebook, Inc.
4083
- * All rights reserved.
4084
- *
4085
- * This source code is licensed under the BSD-style license found in the
4086
- * LICENSE file in the root directory of this source tree. An additional grant
4087
- * of patent rights can be found in the PATENTS file in the same directory.
4088
- *
4089
- * @typechecks
4090
- */
4091
-
4092
- var performanceNow;
4093
-
4094
- /**
4095
- * Detect if we can use `window.performance.now()` and gracefully fallback to
4096
- * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
4097
- * because of Facebook's testing infrastructure.
4098
- */
4099
- if (performance_1.now) {
4100
- performanceNow = function performanceNow() {
4101
- return performance_1.now();
4102
- };
4103
- } else {
4104
- performanceNow = function performanceNow() {
4105
- return Date.now();
4106
- };
4107
- }
4108
-
4109
- var performanceNow_1 = performanceNow;
4110
-
4111
- var ReactComponentTreeHook = ReactGlobalSharedState_1.ReactComponentTreeHook;
4112
-
4113
- {
4114
- var warning$7 = warning_1;
4115
- }
4116
-
4117
- // Trust the developer to only use this with a true check
4118
- var ReactDebugTool$1 = null;
4119
-
4120
- {
4121
- var hooks = [];
4122
- var didHookThrowForEvent = {};
4123
-
4124
- var callHook = function(event, fn, context, arg1, arg2, arg3, arg4, arg5) {
4125
- try {
4126
- fn.call(context, arg1, arg2, arg3, arg4, arg5);
4127
- } catch (e) {
4128
- warning$7(
4129
- didHookThrowForEvent[event],
4130
- 'Exception thrown by hook while handling %s: %s',
4131
- event,
4132
- e + '\n' + e.stack
4133
- );
4134
- didHookThrowForEvent[event] = true;
4135
- }
4136
- };
4137
-
4138
- var emitEvent = function(event, arg1, arg2, arg3, arg4, arg5) {
4139
- for (var i = 0; i < hooks.length; i++) {
4140
- var hook = hooks[i];
4141
- var fn = hook[event];
4142
- if (fn) {
4143
- callHook(event, fn, hook, arg1, arg2, arg3, arg4, arg5);
4144
- }
4145
- }
4146
- };
4147
-
4148
- var isProfiling = false;
4149
- var flushHistory = [];
4150
- var lifeCycleTimerStack = [];
4151
- var currentFlushNesting = 0;
4152
- var currentFlushMeasurements = [];
4153
- var currentFlushStartTime = 0;
4154
- var currentTimerDebugID = null;
4155
- var currentTimerStartTime = 0;
4156
- var currentTimerNestedFlushDuration = 0;
4157
- var currentTimerType = null;
4158
-
4159
- var lifeCycleTimerHasWarned = false;
4160
-
4161
- var clearHistory = function() {
4162
- ReactComponentTreeHook.purgeUnmountedComponents();
4163
- ReactHostOperationHistoryHook_1.clearHistory();
4164
- };
4165
-
4166
- var getTreeSnapshot = function(registeredIDs) {
4167
- return registeredIDs.reduce(function(tree, id) {
4168
- var ownerID = ReactComponentTreeHook.getOwnerID(id);
4169
- var parentID = ReactComponentTreeHook.getParentID(id);
4170
- tree[id] = {
4171
- displayName: ReactComponentTreeHook.getDisplayName(id),
4172
- text: ReactComponentTreeHook.getText(id),
4173
- updateCount: ReactComponentTreeHook.getUpdateCount(id),
4174
- childIDs: ReactComponentTreeHook.getChildIDs(id),
4175
- // Text nodes don't have owners but this is close enough.
4176
- ownerID: ownerID ||
4177
- (parentID && ReactComponentTreeHook.getOwnerID(parentID)) ||
4178
- 0,
4179
- parentID: parentID,
4180
- };
4181
- return tree;
4182
- }, {});
4183
- };
4184
-
4185
- var resetMeasurements = function() {
4186
- var previousStartTime = currentFlushStartTime;
4187
- var previousMeasurements = currentFlushMeasurements;
4188
- var previousOperations = ReactHostOperationHistoryHook_1.getHistory();
4189
-
4190
- if (currentFlushNesting === 0) {
4191
- currentFlushStartTime = 0;
4192
- currentFlushMeasurements = [];
4193
- clearHistory();
4194
- return;
4195
- }
4196
-
4197
- if (previousMeasurements.length || previousOperations.length) {
4198
- var registeredIDs = ReactComponentTreeHook.getRegisteredIDs();
4199
- flushHistory.push({
4200
- duration: performanceNow_1() - previousStartTime,
4201
- measurements: previousMeasurements || [],
4202
- operations: previousOperations || [],
4203
- treeSnapshot: getTreeSnapshot(registeredIDs),
4204
- });
4205
- }
4206
-
4207
- clearHistory();
4208
- currentFlushStartTime = performanceNow_1();
4209
- currentFlushMeasurements = [];
4210
- };
4211
-
4212
- var checkDebugID = function(debugID) {
4213
- var allowRoot = arguments.length > 1 && arguments[1] !== undefined
4214
- ? arguments[1]
4215
- : false;
4216
-
4217
- if (allowRoot && debugID === 0) {
4218
- return;
4219
- }
4220
- if (!debugID) {
4221
- warning$7(false, 'ReactDebugTool: debugID may not be empty.');
4222
- }
4223
- };
4224
-
4225
- var beginLifeCycleTimer = function(debugID, timerType) {
4226
- if (currentFlushNesting === 0) {
4227
- return;
4228
- }
4229
- if (currentTimerType && !lifeCycleTimerHasWarned) {
4230
- warning$7(
4231
- false,
4232
- 'There is an internal error in the React performance measurement code.' +
4233
- '\n\nDid not expect %s timer to start while %s timer is still in ' +
4234
- 'progress for %s instance.',
4235
- timerType,
4236
- currentTimerType || 'no',
4237
- debugID === currentTimerDebugID ? 'the same' : 'another'
4238
- );
4239
- lifeCycleTimerHasWarned = true;
4240
- }
4241
- currentTimerStartTime = performanceNow_1();
4242
- currentTimerNestedFlushDuration = 0;
4243
- currentTimerDebugID = debugID;
4244
- currentTimerType = timerType;
4245
- };
4246
-
4247
- var endLifeCycleTimer = function(debugID, timerType) {
4248
- if (currentFlushNesting === 0) {
4249
- return;
4250
- }
4251
- if (currentTimerType !== timerType && !lifeCycleTimerHasWarned) {
4252
- warning$7(
4253
- false,
4254
- 'There is an internal error in the React performance measurement code. ' +
4255
- 'We did not expect %s timer to stop while %s timer is still in ' +
4256
- 'progress for %s instance. Please report this as a bug in React.',
4257
- timerType,
4258
- currentTimerType || 'no',
4259
- debugID === currentTimerDebugID ? 'the same' : 'another'
4260
- );
4261
- lifeCycleTimerHasWarned = true;
4262
- }
4263
- if (isProfiling) {
4264
- currentFlushMeasurements.push({
4265
- timerType: timerType,
4266
- instanceID: debugID,
4267
- duration: performanceNow_1() -
4268
- currentTimerStartTime -
4269
- currentTimerNestedFlushDuration,
4270
- });
4271
- }
4272
- currentTimerStartTime = 0;
4273
- currentTimerNestedFlushDuration = 0;
4274
- currentTimerDebugID = null;
4275
- currentTimerType = null;
4276
- };
4277
-
4278
- var pauseCurrentLifeCycleTimer = function() {
4279
- var currentTimer = {
4280
- startTime: currentTimerStartTime,
4281
- nestedFlushStartTime: performanceNow_1(),
4282
- debugID: currentTimerDebugID,
4283
- timerType: currentTimerType,
4284
- };
4285
- lifeCycleTimerStack.push(currentTimer);
4286
- currentTimerStartTime = 0;
4287
- currentTimerNestedFlushDuration = 0;
4288
- currentTimerDebugID = null;
4289
- currentTimerType = null;
4290
- };
4291
-
4292
- var resumeCurrentLifeCycleTimer = function() {
4293
- var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(),
4294
- startTime = _lifeCycleTimerStack$.startTime,
4295
- nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime,
4296
- debugID = _lifeCycleTimerStack$.debugID,
4297
- timerType = _lifeCycleTimerStack$.timerType;
4298
-
4299
- var nestedFlushDuration = performanceNow_1() - nestedFlushStartTime;
4300
- currentTimerStartTime = startTime;
4301
- currentTimerNestedFlushDuration += nestedFlushDuration;
4302
- currentTimerDebugID = debugID;
4303
- currentTimerType = timerType;
4304
- };
4305
-
4306
- var lastMarkTimeStamp = 0;
4307
- var canUsePerformanceMeasure =
4308
- typeof performance !== 'undefined' &&
4309
- typeof performance.mark === 'function' &&
4310
- typeof performance.clearMarks === 'function' &&
4311
- typeof performance.measure === 'function' &&
4312
- typeof performance.clearMeasures === 'function';
4313
-
4314
- var shouldMark = function(debugID) {
4315
- if (!isProfiling || !canUsePerformanceMeasure) {
4316
- return false;
4317
- }
4318
- var element = ReactComponentTreeHook.getElement(debugID);
4319
- if (element == null || typeof element !== 'object') {
4320
- return false;
4321
- }
4322
- var isHostElement = typeof element.type === 'string';
4323
- if (isHostElement) {
4324
- return false;
4325
- }
4326
- return true;
4327
- };
4328
-
4329
- var markBegin = function(debugID, markType) {
4330
- if (!shouldMark(debugID)) {
4331
- return;
4332
- }
4333
-
4334
- var markName = debugID + '::' + markType;
4335
- lastMarkTimeStamp = performanceNow_1();
4336
- performance.mark(markName);
4337
- };
4338
-
4339
- var markEnd = function(debugID, markType) {
4340
- if (!shouldMark(debugID)) {
4341
- return;
4342
- }
4343
-
4344
- var markName = debugID + '::' + markType;
4345
- var displayName =
4346
- ReactComponentTreeHook.getDisplayName(debugID) || 'Unknown';
4347
-
4348
- // Chrome has an issue of dropping markers recorded too fast:
4349
- // https://bugs.chromium.org/p/chromium/issues/detail?id=640652
4350
- // To work around this, we will not report very small measurements.
4351
- // I determined the magic number by tweaking it back and forth.
4352
- // 0.05ms was enough to prevent the issue, but I set it to 0.1ms to be safe.
4353
- // When the bug is fixed, we can `measure()` unconditionally if we want to.
4354
- var timeStamp = performanceNow_1();
4355
- if (timeStamp - lastMarkTimeStamp > 0.1) {
4356
- var measurementName = displayName + ' [' + markType + ']';
4357
- performance.measure(measurementName, markName);
4358
- }
4359
-
4360
- performance.clearMarks(markName);
4361
- if (measurementName) {
4362
- performance.clearMeasures(measurementName);
4363
- }
4364
- };
4365
-
4366
- ReactDebugTool$1 = {
4367
- addHook: function(hook) {
4368
- hooks.push(hook);
4369
- },
4370
- removeHook: function(hook) {
4371
- for (var i = 0; i < hooks.length; i++) {
4372
- if (hooks[i] === hook) {
4373
- hooks.splice(i, 1);
4374
- i--;
4375
- }
4376
- }
4377
- },
4378
- isProfiling: function() {
4379
- return isProfiling;
4380
- },
4381
- beginProfiling: function() {
4382
- if (isProfiling) {
4383
- return;
4384
- }
4385
-
4386
- isProfiling = true;
4387
- flushHistory.length = 0;
4388
- resetMeasurements();
4389
- ReactDebugTool$1.addHook(ReactHostOperationHistoryHook_1);
4390
- },
4391
- endProfiling: function() {
4392
- if (!isProfiling) {
4393
- return;
4394
- }
4395
-
4396
- isProfiling = false;
4397
- resetMeasurements();
4398
- ReactDebugTool$1.removeHook(ReactHostOperationHistoryHook_1);
4399
- },
4400
- getFlushHistory: function() {
4401
- return flushHistory;
4402
- },
4403
- onBeginFlush: function() {
4404
- currentFlushNesting++;
4405
- resetMeasurements();
4406
- pauseCurrentLifeCycleTimer();
4407
- emitEvent('onBeginFlush');
4408
- },
4409
- onEndFlush: function() {
4410
- resetMeasurements();
4411
- currentFlushNesting--;
4412
- resumeCurrentLifeCycleTimer();
4413
- emitEvent('onEndFlush');
4414
- },
4415
- onBeginLifeCycleTimer: function(debugID, timerType) {
4416
- checkDebugID(debugID);
4417
- emitEvent('onBeginLifeCycleTimer', debugID, timerType);
4418
- markBegin(debugID, timerType);
4419
- beginLifeCycleTimer(debugID, timerType);
4420
- },
4421
- onEndLifeCycleTimer: function(debugID, timerType) {
4422
- checkDebugID(debugID);
4423
- endLifeCycleTimer(debugID, timerType);
4424
- markEnd(debugID, timerType);
4425
- emitEvent('onEndLifeCycleTimer', debugID, timerType);
4426
- },
4427
- onBeginProcessingChildContext: function() {
4428
- emitEvent('onBeginProcessingChildContext');
4429
- },
4430
- onEndProcessingChildContext: function() {
4431
- emitEvent('onEndProcessingChildContext');
4432
- },
4433
- onHostOperation: function(operation) {
4434
- checkDebugID(operation.instanceID);
4435
- emitEvent('onHostOperation', operation);
4436
- },
4437
- onSetState: function() {
4438
- emitEvent('onSetState');
4439
- },
4440
- onSetChildren: function(debugID, childDebugIDs) {
4441
- checkDebugID(debugID);
4442
- childDebugIDs.forEach(checkDebugID);
4443
- emitEvent('onSetChildren', debugID, childDebugIDs);
4444
- },
4445
- onBeforeMountComponent: function(debugID, element, parentDebugID) {
4446
- checkDebugID(debugID);
4447
- checkDebugID(parentDebugID, true);
4448
- emitEvent('onBeforeMountComponent', debugID, element, parentDebugID);
4449
- markBegin(debugID, 'mount');
4450
- },
4451
- onMountComponent: function(debugID) {
4452
- checkDebugID(debugID);
4453
- markEnd(debugID, 'mount');
4454
- emitEvent('onMountComponent', debugID);
4455
- },
4456
- onBeforeUpdateComponent: function(debugID, element) {
4457
- checkDebugID(debugID);
4458
- emitEvent('onBeforeUpdateComponent', debugID, element);
4459
- markBegin(debugID, 'update');
4460
- },
4461
- onUpdateComponent: function(debugID) {
4462
- checkDebugID(debugID);
4463
- markEnd(debugID, 'update');
4464
- emitEvent('onUpdateComponent', debugID);
4465
- },
4466
- onBeforeUnmountComponent: function(debugID) {
4467
- checkDebugID(debugID);
4468
- emitEvent('onBeforeUnmountComponent', debugID);
4469
- markBegin(debugID, 'unmount');
4470
- },
4471
- onUnmountComponent: function(debugID) {
4472
- checkDebugID(debugID);
4473
- markEnd(debugID, 'unmount');
4474
- emitEvent('onUnmountComponent', debugID);
4475
- },
4476
- onTestEvent: function() {
4477
- emitEvent('onTestEvent');
4478
- },
4479
- };
4480
-
4481
- ReactDebugTool$1.addHook(ReactInvalidSetStateWarningHook_1);
4482
- ReactDebugTool$1.addHook(ReactComponentTreeHook);
4483
- var url = (ExecutionEnvironment_1.canUseDOM && window.location.href) || '';
4484
- if (/[?&]react_perf\b/.test(url)) {
4485
- ReactDebugTool$1.beginProfiling();
4486
- }
4487
- }
4488
-
4489
- var ReactDebugTool_1 = ReactDebugTool$1;
4490
-
4491
- // Trust the developer to only use ReactInstrumentation with a true check
4492
-
4493
- var debugTool = null;
4494
-
4495
- {
4496
- var ReactDebugTool = ReactDebugTool_1;
4497
- debugTool = ReactDebugTool;
4498
- }
4499
-
4500
- var ReactInstrumentation = {debugTool: debugTool};
4501
-
4502
- {
4503
- var warning$6 = warning_1;
4504
- }
4505
-
4506
- // isAttributeNameSafe() is currently duplicated in DOMMarkupOperations.
4507
- // TODO: Find a better place for this.
4508
- var VALID_ATTRIBUTE_NAME_REGEX = new RegExp(
4509
- '^[' +
4510
- DOMProperty_1.ATTRIBUTE_NAME_START_CHAR +
4511
- '][' +
4512
- DOMProperty_1.ATTRIBUTE_NAME_CHAR +
4513
- ']*$'
4514
- );
4515
- var illegalAttributeNameCache = {};
4516
- var validatedAttributeNameCache = {};
4517
- function isAttributeNameSafe(attributeName) {
4518
- if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
4519
- return true;
4520
- }
4521
- if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
4522
- return false;
4523
- }
4524
- if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
4525
- validatedAttributeNameCache[attributeName] = true;
4526
- return true;
4527
- }
4528
- illegalAttributeNameCache[attributeName] = true;
4529
- {
4530
- warning$6(false, 'Invalid attribute name: `%s`', attributeName);
4531
- }
4532
- return false;
4533
- }
4534
-
4535
- // shouldIgnoreValue() is currently duplicated in DOMMarkupOperations.
4536
- // TODO: Find a better place for this.
4537
- function shouldIgnoreValue(propertyInfo, value) {
4538
- return (
4539
- value == null ||
4540
- (propertyInfo.hasBooleanValue && !value) ||
4541
- (propertyInfo.hasNumericValue && isNaN(value)) ||
4542
- (propertyInfo.hasPositiveNumericValue && value < 1) ||
4543
- (propertyInfo.hasOverloadedBooleanValue && value === false)
4544
- );
4545
- }
4546
-
4547
- /**
4548
- * Operations for dealing with DOM properties.
4549
- */
4550
- var DOMPropertyOperations = {
4551
- setAttributeForID: function(node, id) {
4552
- node.setAttribute(DOMProperty_1.ID_ATTRIBUTE_NAME, id);
4553
- },
4554
-
4555
- setAttributeForRoot: function(node) {
4556
- node.setAttribute(DOMProperty_1.ROOT_ATTRIBUTE_NAME, '');
4557
- },
4558
-
4559
- /**
4560
- * Get the value for a property on a node. Only used in DEV for SSR validation.
4561
- * The "expected" argument is used as a hint of what the expected value is.
4562
- * Some properties have multiple equivalent values.
4563
- */
4564
- getValueForProperty: function(node, name, expected) {
4565
- {
4566
- var propertyInfo = DOMProperty_1.getPropertyInfo(name);
4567
- if (propertyInfo) {
4568
- var mutationMethod = propertyInfo.mutationMethod;
4569
- if (mutationMethod || propertyInfo.mustUseProperty) {
4570
- return node[propertyInfo.propertyName];
4571
- } else {
4572
- var attributeName = propertyInfo.attributeName;
4573
-
4574
- var stringValue = null;
4575
-
4576
- if (propertyInfo.hasOverloadedBooleanValue) {
4577
- if (node.hasAttribute(attributeName)) {
4578
- var value = node.getAttribute(attributeName);
4579
- if (value === '') {
4580
- return true;
4581
- }
4582
- if (shouldIgnoreValue(propertyInfo, expected)) {
4583
- return value;
4584
- }
4585
- if (value === '' + expected) {
4586
- return expected;
4587
- }
4588
- return value;
4589
- }
4590
- } else if (node.hasAttribute(attributeName)) {
4591
- if (shouldIgnoreValue(propertyInfo, expected)) {
4592
- // We had an attribute but shouldn't have had one, so read it
4593
- // for the error message.
4594
- return node.getAttribute(attributeName);
4595
- }
4596
- if (propertyInfo.hasBooleanValue) {
4597
- // If this was a boolean, it doesn't matter what the value is
4598
- // the fact that we have it is the same as the expected.
4599
- return expected;
4600
- }
4601
- // Even if this property uses a namespace we use getAttribute
4602
- // because we assume its namespaced name is the same as our config.
4603
- // To use getAttributeNS we need the local name which we don't have
4604
- // in our config atm.
4605
- stringValue = node.getAttribute(attributeName);
4606
- }
4607
-
4608
- if (shouldIgnoreValue(propertyInfo, expected)) {
4609
- return stringValue === null ? expected : stringValue;
4610
- } else if (stringValue === '' + expected) {
4611
- return expected;
4612
- } else {
4613
- return stringValue;
4614
- }
4615
- }
4616
- }
4617
- }
4618
- },
4619
-
4620
- /**
4621
- * Get the value for a attribute on a node. Only used in DEV for SSR validation.
4622
- * The third argument is used as a hint of what the expected value is. Some
4623
- * attributes have multiple equivalent values.
4624
- */
4625
- getValueForAttribute: function(node, name, expected) {
4626
- {
4627
- if (!isAttributeNameSafe(name)) {
4628
- return;
4629
- }
4630
- if (!node.hasAttribute(name)) {
4631
- return expected === undefined ? undefined : null;
4632
- }
4633
- var value = node.getAttribute(name);
4634
- if (value === '' + expected) {
4635
- return expected;
4636
- }
4637
- return value;
4638
- }
4639
- },
4640
-
4641
- /**
4642
- * Sets the value for a property on a node.
4643
- *
4644
- * @param {DOMElement} node
4645
- * @param {string} name
4646
- * @param {*} value
4647
- */
4648
- setValueForProperty: function(node, name, value) {
4649
- var propertyInfo = DOMProperty_1.getPropertyInfo(name);
4650
-
4651
- if (propertyInfo && DOMProperty_1.shouldSetAttribute(name, value)) {
4652
- var mutationMethod = propertyInfo.mutationMethod;
4653
- if (mutationMethod) {
4654
- mutationMethod(node, value);
4655
- } else if (shouldIgnoreValue(propertyInfo, value)) {
4656
- DOMPropertyOperations.deleteValueForProperty(node, name);
4657
- return;
4658
- } else if (propertyInfo.mustUseProperty) {
4659
- // Contrary to `setAttribute`, object properties are properly
4660
- // `toString`ed by IE8/9.
4661
- node[propertyInfo.propertyName] = value;
4662
- } else {
4663
- var attributeName = propertyInfo.attributeName;
4664
- var namespace = propertyInfo.attributeNamespace;
4665
- // `setAttribute` with objects becomes only `[object]` in IE8/9,
4666
- // ('' + value) makes it output the correct toString()-value.
4667
- if (namespace) {
4668
- node.setAttributeNS(namespace, attributeName, '' + value);
4669
- } else if (
4670
- propertyInfo.hasBooleanValue ||
4671
- (propertyInfo.hasOverloadedBooleanValue && value === true)
4672
- ) {
4673
- node.setAttribute(attributeName, '');
4674
- } else {
4675
- node.setAttribute(attributeName, '' + value);
4676
- }
4677
- }
4678
- } else {
4679
- DOMPropertyOperations.setValueForAttribute(
4680
- node,
4681
- name,
4682
- DOMProperty_1.shouldSetAttribute(name, value) ? value : null
4683
- );
4684
- return;
4685
- }
4686
-
4687
- {
4688
- var payload = {};
4689
- payload[name] = value;
4690
- ReactInstrumentation.debugTool.onHostOperation({
4691
- instanceID: ReactDOMComponentTree_1.getInstanceFromNode(node)
4692
- ._debugID,
4693
- type: 'update attribute',
4694
- payload: payload,
4695
- });
4696
- }
4697
- },
4698
-
4699
- setValueForAttribute: function(node, name, value) {
4700
- if (!isAttributeNameSafe(name)) {
4701
- return;
4702
- }
4703
- if (value == null) {
4704
- node.removeAttribute(name);
4705
- } else {
4706
- node.setAttribute(name, '' + value);
4707
- }
4708
-
4709
- {
4710
- var payload = {};
4711
- payload[name] = value;
4712
- ReactInstrumentation.debugTool.onHostOperation({
4713
- instanceID: ReactDOMComponentTree_1.getInstanceFromNode(node)
4714
- ._debugID,
4715
- type: 'update attribute',
4716
- payload: payload,
4717
- });
4718
- }
4719
- },
4720
-
4721
- /**
4722
- * Deletes an attributes from a node.
4723
- *
4724
- * @param {DOMElement} node
4725
- * @param {string} name
4726
- */
4727
- deleteValueForAttribute: function(node, name) {
4728
- node.removeAttribute(name);
4729
- {
4730
- ReactInstrumentation.debugTool.onHostOperation({
4731
- instanceID: ReactDOMComponentTree_1.getInstanceFromNode(node)
4732
- ._debugID,
4733
- type: 'remove attribute',
4734
- payload: name,
4735
- });
4736
- }
4737
- },
4738
-
4739
- /**
4740
- * Deletes the value for a property on a node.
4741
- *
4742
- * @param {DOMElement} node
4743
- * @param {string} name
4744
- */
4745
- deleteValueForProperty: function(node, name) {
4746
- var propertyInfo = DOMProperty_1.getPropertyInfo(name);
4747
- if (propertyInfo) {
4748
- var mutationMethod = propertyInfo.mutationMethod;
4749
- if (mutationMethod) {
4750
- mutationMethod(node, undefined);
4751
- } else if (propertyInfo.mustUseProperty) {
4752
- var propName = propertyInfo.propertyName;
4753
- if (propertyInfo.hasBooleanValue) {
4754
- node[propName] = false;
4755
- } else {
4756
- node[propName] = '';
4757
- }
4758
- } else {
4759
- node.removeAttribute(propertyInfo.attributeName);
4760
- }
4761
- } else {
4762
- node.removeAttribute(name);
4763
- }
4764
-
4765
- {
4766
- ReactInstrumentation.debugTool.onHostOperation({
4767
- instanceID: ReactDOMComponentTree_1.getInstanceFromNode(node)
4768
- ._debugID,
4769
- type: 'remove attribute',
4770
- payload: name,
4771
- });
4772
- }
4773
- },
4774
- };
4775
-
4776
- var DOMPropertyOperations_1 = DOMPropertyOperations;
4777
-
4778
- function createCommonjsModule(fn, module) {
4779
- return (module = {exports: {}}), fn(module, module.exports), module.exports;
4780
- }
4781
-
4782
- /**
4783
- * Copyright 2013-present, Facebook, Inc.
4784
- * All rights reserved.
4785
- *
4786
- * This source code is licensed under the BSD-style license found in the
4787
- * LICENSE file in the root directory of this source tree. An additional grant
4788
- * of patent rights can be found in the PATENTS file in the same directory.
4789
- */
4790
-
4791
- var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
4792
-
4793
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
4794
-
4795
- {
4796
- var invariant$2 = invariant_1;
4797
- var warning$11 = warning_1;
4798
- var ReactPropTypesSecret$2 = ReactPropTypesSecret_1;
4799
- var loggedTypeFailures$1 = {};
4800
- }
4801
-
4802
- /**
4803
- * Assert that the values match with the type specs.
4804
- * Error messages are memorized and will only be shown once.
4805
- *
4806
- * @param {object} typeSpecs Map of name to a ReactPropType
4807
- * @param {object} values Runtime values that need to be type-checked
4808
- * @param {string} location e.g. "prop", "context", "child context"
4809
- * @param {string} componentName Name of the component for error messages.
4810
- * @param {?Function} getStack Returns the component stack.
4811
- * @private
4812
- */
4813
- function checkPropTypes(
4814
- typeSpecs,
4815
- values,
4816
- location,
4817
- componentName,
4818
- getStack
4819
- ) {
4820
- {
4821
- for (var typeSpecName in typeSpecs) {
4822
- if (typeSpecs.hasOwnProperty(typeSpecName)) {
4823
- var error;
4824
- // Prop type validation may throw. In case they do, we don't want to
4825
- // fail the render phase where it didn't fail before. So we log it.
4826
- // After these have been cleaned up, we'll let them throw.
4827
- try {
4828
- // This is intentionally an invariant that gets caught. It's the same
4829
- // behavior as without this statement except with a better message.
4830
- invariant$2(
4831
- typeof typeSpecs[typeSpecName] === 'function',
4832
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
4833
- 'React.PropTypes.',
4834
- componentName || 'React class',
4835
- location,
4836
- typeSpecName
4837
- );
4838
- error = typeSpecs[typeSpecName](
4839
- values,
4840
- typeSpecName,
4841
- componentName,
4842
- location,
4843
- null,
4844
- ReactPropTypesSecret$2
4845
- );
4846
- } catch (ex) {
4847
- error = ex;
4848
- }
4849
- warning$11(
4850
- !error || error instanceof Error,
4851
- '%s: type specification of %s `%s` is invalid; the type checker ' +
4852
- 'function must return `null` or an `Error` but returned a %s. ' +
4853
- 'You may have forgotten to pass an argument to the type checker ' +
4854
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
4855
- 'shape all require an argument).',
4856
- componentName || 'React class',
4857
- location,
4858
- typeSpecName,
4859
- typeof error
4860
- );
4861
- if (
4862
- error instanceof Error &&
4863
- !(error.message in loggedTypeFailures$1)
4864
- ) {
4865
- // Only monitor this failure once because there tends to be a lot of the
4866
- // same error.
4867
- loggedTypeFailures$1[error.message] = true;
4868
-
4869
- var stack = getStack ? getStack() : '';
4870
-
4871
- warning$11(
4872
- false,
4873
- 'Failed %s type: %s%s',
4874
- location,
4875
- error.message,
4876
- stack != null ? stack : ''
4877
- );
4878
- }
4879
- }
4880
- }
4881
- }
4882
- }
4883
-
4884
- var checkPropTypes_1 = checkPropTypes;
4885
-
4886
- var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
4887
- /* global Symbol */
4888
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
4889
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
4890
-
4891
- /**
4892
- * Returns the iterator method function contained on the iterable object.
4893
- *
4894
- * Be sure to invoke the function with the iterable as context:
4895
- *
4896
- * var iteratorFn = getIteratorFn(myIterable);
4897
- * if (iteratorFn) {
4898
- * var iterator = iteratorFn.call(myIterable);
4899
- * ...
4900
- * }
4901
- *
4902
- * @param {?object} maybeIterable
4903
- * @return {?function}
4904
- */
4905
- function getIteratorFn(maybeIterable) {
4906
- var iteratorFn =
4907
- maybeIterable &&
4908
- ((ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL]) ||
4909
- maybeIterable[FAUX_ITERATOR_SYMBOL]);
4910
- if (typeof iteratorFn === 'function') {
4911
- return iteratorFn;
4912
- }
4913
- }
4914
-
4915
- /**
4916
- * Collection of methods that allow declaration and validation of props that are
4917
- * supplied to React components. Example usage:
4918
- *
4919
- * var Props = require('ReactPropTypes');
4920
- * var MyArticle = React.createClass({
4921
- * propTypes: {
4922
- * // An optional string prop named "description".
4923
- * description: Props.string,
4924
- *
4925
- * // A required enum prop named "category".
4926
- * category: Props.oneOf(['News','Photos']).isRequired,
4927
- *
4928
- * // A prop named "dialog" that requires an instance of Dialog.
4929
- * dialog: Props.instanceOf(Dialog).isRequired
4930
- * },
4931
- * render: function() { ... }
4932
- * });
4933
- *
4934
- * A more formal specification of how these methods are used:
4935
- *
4936
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
4937
- * decl := ReactPropTypes.{type}(.isRequired)?
4938
- *
4939
- * Each and every declaration produces a function with the same signature. This
4940
- * allows the creation of custom validation functions. For example:
4941
- *
4942
- * var MyLink = React.createClass({
4943
- * propTypes: {
4944
- * // An optional string or URI prop named "href".
4945
- * href: function(props, propName, componentName) {
4946
- * var propValue = props[propName];
4947
- * if (propValue != null && typeof propValue !== 'string' &&
4948
- * !(propValue instanceof URI)) {
4949
- * return new Error(
4950
- * 'Expected a string or an URI for ' + propName + ' in ' +
4951
- * componentName
4952
- * );
4953
- * }
4954
- * }
4955
- * },
4956
- * render: function() {...}
4957
- * });
4958
- *
4959
- * @internal
4960
- */
4961
-
4962
- var ANONYMOUS = '<<anonymous>>';
4963
-
4964
- // Important!
4965
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
4966
- var ReactPropTypes = {
4967
- array: createPrimitiveTypeChecker('array'),
4968
- bool: createPrimitiveTypeChecker('boolean'),
4969
- func: createPrimitiveTypeChecker('function'),
4970
- number: createPrimitiveTypeChecker('number'),
4971
- object: createPrimitiveTypeChecker('object'),
4972
- string: createPrimitiveTypeChecker('string'),
4973
- symbol: createPrimitiveTypeChecker('symbol'),
4974
-
4975
- any: createAnyTypeChecker(),
4976
- arrayOf: createArrayOfTypeChecker,
4977
- element: createElementTypeChecker(),
4978
- instanceOf: createInstanceTypeChecker,
4979
- node: createNodeChecker(),
4980
- objectOf: createObjectOfTypeChecker,
4981
- oneOf: createEnumTypeChecker,
4982
- oneOfType: createUnionTypeChecker,
4983
- shape: createShapeTypeChecker,
4984
- };
4985
-
4986
- /**
4987
- * inlined Object.is polyfill to avoid requiring consumers ship their own
4988
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
4989
- */
4990
- /*eslint-disable no-self-compare*/
4991
- function is(x, y) {
4992
- // SameValue algorithm
4993
- if (x === y) {
4994
- // Steps 1-5, 7-10
4995
- // Steps 6.b-6.e: +0 != -0
4996
- return x !== 0 || 1 / x === 1 / y;
4997
- } else {
4998
- // Step 6.a: NaN == NaN
4999
- return x !== x && y !== y;
This file is too large to show in full.
fixtures/attribute-behavior/public/react.development.js
deleted
-2404
@@ -1,2404 +0,0 @@
1
-/**
2
- * react.development.js v16.0.0-beta.5
3
- */
4
-
5
-(function(global, factory) {
6
- typeof exports === 'object' && typeof module !== 'undefined'
7
- ? (module.exports = factory())
8
- : typeof define === 'function' && define.amd
9
- ? define(factory)
10
- : (global.React = factory());
11
-})(this, function() {
12
- 'use strict';
13
- /*
14
-object-assign
15
-(c) Sindre Sorhus
16
-@license MIT
17
-*/
18
-
19
- /* eslint-disable no-unused-vars */
20
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
21
- var hasOwnProperty = Object.prototype.hasOwnProperty;
22
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
23
-
24
- function toObject(val) {
25
- if (val === null || val === undefined) {
26
- throw new TypeError(
27
- 'Object.assign cannot be called with null or undefined'
28
- );
29
- }
30
-
31
- return Object(val);
32
- }
33
-
34
- function shouldUseNative() {
35
- try {
36
- if (!Object.assign) {
37
- return false;
38
- }
39
-
40
- // Detect buggy property enumeration order in older V8 versions.
41
-
42
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
43
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
44
- test1[5] = 'de';
45
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
46
- return false;
47
- }
48
-
49
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
50
- var test2 = {};
51
- for (var i = 0; i < 10; i++) {
52
- test2['_' + String.fromCharCode(i)] = i;
53
- }
54
- var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
55
- return test2[n];
56
- });
57
- if (order2.join('') !== '0123456789') {
58
- return false;
59
- }
60
-
61
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
62
- var test3 = {};
63
- 'abcdefghijklmnopqrst'.split('').forEach(function(letter) {
64
- test3[letter] = letter;
65
- });
66
- if (
67
- Object.keys(Object.assign({}, test3)).join('') !==
68
- 'abcdefghijklmnopqrst'
69
- ) {
70
- return false;
71
- }
72
-
73
- return true;
74
- } catch (err) {
75
- // We don't expect any of the above to throw, but better to be safe.
76
- return false;
77
- }
78
- }
79
-
80
- var index = shouldUseNative()
81
- ? Object.assign
82
- : function(target, source) {
83
- var from;
84
- var to = toObject(target);
85
- var symbols;
86
-
87
- for (var s = 1; s < arguments.length; s++) {
88
- from = Object(arguments[s]);
89
-
90
- for (var key in from) {
91
- if (hasOwnProperty.call(from, key)) {
92
- to[key] = from[key];
93
- }
94
- }
95
-
96
- if (getOwnPropertySymbols) {
97
- symbols = getOwnPropertySymbols(from);
98
- for (var i = 0; i < symbols.length; i++) {
99
- if (propIsEnumerable.call(from, symbols[i])) {
100
- to[symbols[i]] = from[symbols[i]];
101
- }
102
- }
103
- }
104
- }
105
-
106
- return to;
107
- };
108
-
109
- /**
110
- * Copyright (c) 2013-present, Facebook, Inc.
111
- * All rights reserved.
112
- *
113
- * This source code is licensed under the BSD-style license found in the
114
- * LICENSE file in the root directory of this source tree. An additional grant
115
- * of patent rights can be found in the PATENTS file in the same directory.
116
- *
117
- * @providesModule reactProdInvariant
118
- *
119
- */
120
-
121
- /**
122
- * Copyright (c) 2013-present, Facebook, Inc.
123
- * All rights reserved.
124
- *
125
- * This source code is licensed under the BSD-style license found in the
126
- * LICENSE file in the root directory of this source tree. An additional grant
127
- * of patent rights can be found in the PATENTS file in the same directory.
128
- *
129
- *
130
- */
131
-
132
- function makeEmptyFunction(arg) {
133
- return function() {
134
- return arg;
135
- };
136
- }
137
-
138
- /**
139
- * This function accepts and discards inputs; it has no side effects. This is
140
- * primarily useful idiomatically for overridable function endpoints which
141
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
142
- */
143
- var emptyFunction = function emptyFunction() {};
144
-
145
- emptyFunction.thatReturns = makeEmptyFunction;
146
- emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
147
- emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
148
- emptyFunction.thatReturnsNull = makeEmptyFunction(null);
149
- emptyFunction.thatReturnsThis = function() {
150
- return this;
151
- };
152
- emptyFunction.thatReturnsArgument = function(arg) {
153
- return arg;
154
- };
155
-
156
- var emptyFunction_1 = emptyFunction;
157
-
158
- /**
159
- * Similar to invariant but only logs a warning if the condition is not met.
160
- * This can be used to log issues in development environments in critical
161
- * paths. Removing the logging code for production environments will keep the
162
- * same logic and follow the same code paths.
163
- */
164
-
165
- var warning$1 = emptyFunction_1;
166
-
167
- {
168
- (function() {
169
- var printWarning = function printWarning(format) {
170
- for (
171
- var _len = arguments.length,
172
- args = Array(_len > 1 ? _len - 1 : 0),
173
- _key = 1;
174
- _key < _len;
175
- _key++
176
- ) {
177
- args[_key - 1] = arguments[_key];
178
- }
179
-
180
- var argIndex = 0;
181
- var message =
182
- 'Warning: ' +
183
- format.replace(/%s/g, function() {
184
- return args[argIndex++];
185
- });
186
- if (typeof console !== 'undefined') {
187
- console.error(message);
188
- }
189
- try {
190
- // --- Welcome to debugging React ---
191
- // This error was thrown as a convenience so that you can use this stack
192
- // to find the callsite that caused this warning to fire.
193
- throw new Error(message);
194
- } catch (x) {}
195
- };
196
-
197
- warning$1 = function warning(condition, format) {
198
- if (format === undefined) {
199
- throw new Error(
200
- '`warning(condition, format, ...args)` requires a warning ' +
201
- 'message argument'
202
- );
203
- }
204
-
205
- if (format.indexOf('Failed Composite propType: ') === 0) {
206
- return; // Ignore CompositeComponent proptype check.
207
- }
208
-
209
- if (!condition) {
210
- for (
211
- var _len2 = arguments.length,
212
- args = Array(_len2 > 2 ? _len2 - 2 : 0),
213
- _key2 = 2;
214
- _key2 < _len2;
215
- _key2++
216
- ) {
217
- args[_key2 - 2] = arguments[_key2];
218
- }
219
-
220
- printWarning.apply(undefined, [format].concat(args));
221
- }
222
- };
223
- })();
224
- }
225
-
226
- var warning_1 = warning$1;
227
-
228
- {
229
- var warning = warning_1;
230
- }
231
-
232
- function warnNoop(publicInstance, callerName) {
233
- {
234
- var constructor = publicInstance.constructor;
235
- warning(
236
- false,
237
- '%s(...): Can only update a mounted or mounting component. ' +
238
- 'This usually means you called %s() on an unmounted component. ' +
239
- 'This is a no-op.\n\nPlease check the code for the %s component.',
240
- callerName,
241
- callerName,
242
- (constructor && (constructor.displayName || constructor.name)) ||
243
- 'ReactClass'
244
- );
245
- }
246
- }
247
-
248
- /**
249
- * This is the abstract API for an update queue.
250
- */
251
- var ReactNoopUpdateQueue = {
252
- /**
253
- * Checks whether or not this composite component is mounted.
254
- * @param {ReactClass} publicInstance The instance we want to test.
255
- * @return {boolean} True if mounted, false otherwise.
256
- * @protected
257
- * @final
258
- */
259
- isMounted: function(publicInstance) {
260
- return false;
261
- },
262
-
263
- /**
264
- * Forces an update. This should only be invoked when it is known with
265
- * certainty that we are **not** in a DOM transaction.
266
- *
267
- * You may want to call this when you know that some deeper aspect of the
268
- * component's state has changed but `setState` was not called.
269
- *
270
- * This will not invoke `shouldComponentUpdate`, but it will invoke
271
- * `componentWillUpdate` and `componentDidUpdate`.
272
- *
273
- * @param {ReactClass} publicInstance The instance that should rerender.
274
- * @param {?function} callback Called after component is updated.
275
- * @param {?string} callerName name of the calling function in the public API.
276
- * @internal
277
- */
278
- enqueueForceUpdate: function(publicInstance, callback, callerName) {
279
- warnNoop(publicInstance, 'forceUpdate');
280
- },
281
-
282
- /**
283
- * Replaces all of the state. Always use this or `setState` to mutate state.
284
- * You should treat `this.state` as immutable.
285
- *
286
- * There is no guarantee that `this.state` will be immediately updated, so
287
- * accessing `this.state` after calling this method may return the old value.
288
- *
289
- * @param {ReactClass} publicInstance The instance that should rerender.
290
- * @param {object} completeState Next state.
291
- * @param {?function} callback Called after component is updated.
292
- * @param {?string} callerName name of the calling function in the public API.
293
- * @internal
294
- */
295
- enqueueReplaceState: function(
296
- publicInstance,
297
- completeState,
298
- callback,
299
- callerName
300
- ) {
301
- warnNoop(publicInstance, 'replaceState');
302
- },
303
-
304
- /**
305
- * Sets a subset of the state. This only exists because _pendingState is
306
- * internal. This provides a merging strategy that is not available to deep
307
- * properties which is confusing. TODO: Expose pendingState or don't use it
308
- * during the merge.
309
- *
310
- * @param {ReactClass} publicInstance The instance that should rerender.
311
- * @param {object} partialState Next partial state to be merged with state.
312
- * @param {?function} callback Called after component is updated.
313
- * @param {?string} Name of the calling function in the public API.
314
- * @internal
315
- */
316
- enqueueSetState: function(
317
- publicInstance,
318
- partialState,
319
- callback,
320
- callerName
321
- ) {
322
- warnNoop(publicInstance, 'setState');
323
- },
324
- };
325
-
326
- var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
327
-
328
- /**
329
- * Copyright (c) 2013-present, Facebook, Inc.
330
- * All rights reserved.
331
- *
332
- * This source code is licensed under the BSD-style license found in the
333
- * LICENSE file in the root directory of this source tree. An additional grant
334
- * of patent rights can be found in the PATENTS file in the same directory.
335
- *
336
- */
337
-
338
- var emptyObject = {};
339
-
340
- {
341
- Object.freeze(emptyObject);
342
- }
343
-
344
- var emptyObject_1 = emptyObject;
345
-
346
- /**
347
- * Copyright (c) 2013-present, Facebook, Inc.
348
- * All rights reserved.
349
- *
350
- * This source code is licensed under the BSD-style license found in the
351
- * LICENSE file in the root directory of this source tree. An additional grant
352
- * of patent rights can be found in the PATENTS file in the same directory.
353
- *
354
- */
355
-
356
- /**
357
- * Use invariant() to assert state which your program assumes to be true.
358
- *
359
- * Provide sprintf-style format (only %s is supported) and arguments
360
- * to provide information about what broke and what you were
361
- * expecting.
362
- *
363
- * The invariant message will be stripped in production, but the invariant
364
- * will remain to ensure logic does not differ in production.
365
- */
366
-
367
- var validateFormat = function validateFormat(format) {};
368
-
369
- {
370
- validateFormat = function validateFormat(format) {
371
- if (format === undefined) {
372
- throw new Error('invariant requires an error message argument');
373
- }
374
- };
375
- }
376
-
377
- function invariant(condition, format, a, b, c, d, e, f) {
378
- validateFormat(format);
379
-
380
- if (!condition) {
381
- var error;
382
- if (format === undefined) {
383
- error = new Error(
384
- 'Minified exception occurred; use the non-minified dev environment ' +
385
- 'for the full error message and additional helpful warnings.'
386
- );
387
- } else {
388
- var args = [a, b, c, d, e, f];
389
- var argIndex = 0;
390
- error = new Error(
391
- format.replace(/%s/g, function() {
392
- return args[argIndex++];
393
- })
394
- );
395
- error.name = 'Invariant Violation';
396
- }
397
-
398
- error.framesToPop = 1; // we don't care about invariant's own frame
399
- throw error;
400
- }
401
- }
402
-
403
- var invariant_1 = invariant;
404
-
405
- /**
406
- * Copyright 2014-2015, Facebook, Inc.
407
- * All rights reserved.
408
- *
409
- * This source code is licensed under the BSD-style license found in the
410
- * LICENSE file in the root directory of this source tree. An additional grant
411
- * of patent rights can be found in the PATENTS file in the same directory.
412
- *
413
- * @providesModule lowPriorityWarning
414
- */
415
-
416
- /**
417
- * Forked from fbjs/warning:
418
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
419
- *
420
- * Only change is we use console.warn instead of console.error,
421
- * and do nothing when 'console' is not supported.
422
- * This really simplifies the code.
423
- * ---
424
- * Similar to invariant but only logs a warning if the condition is not met.
425
- * This can be used to log issues in development environments in critical
426
- * paths. Removing the logging code for production environments will keep the
427
- * same logic and follow the same code paths.
428
- */
429
-
430
- var lowPriorityWarning = function() {};
431
-
432
- {
433
- var printWarning = function(format) {
434
- for (
435
- var _len = arguments.length,
436
- args = Array(_len > 1 ? _len - 1 : 0),
437
- _key = 1;
438
- _key < _len;
439
- _key++
440
- ) {
441
- args[_key - 1] = arguments[_key];
442
- }
443
-
444
- var argIndex = 0;
445
- var message =
446
- 'Warning: ' +
447
- format.replace(/%s/g, function() {
448
- return args[argIndex++];
449
- });
450
- if (typeof console !== 'undefined') {
451
- console.warn(message);
452
- }
453
- try {
454
- // --- Welcome to debugging React ---
455
- // This error was thrown as a convenience so that you can use this stack
456
- // to find the callsite that caused this warning to fire.
457
- throw new Error(message);
458
- } catch (x) {}
459
- };
460
-
461
- lowPriorityWarning = function(condition, format) {
462
- if (format === undefined) {
463
- throw new Error(
464
- '`warning(condition, format, ...args)` requires a warning ' +
465
- 'message argument'
466
- );
467
- }
468
- if (!condition) {
469
- for (
470
- var _len2 = arguments.length,
471
- args = Array(_len2 > 2 ? _len2 - 2 : 0),
472
- _key2 = 2;
473
- _key2 < _len2;
474
- _key2++
475
- ) {
476
- args[_key2 - 2] = arguments[_key2];
477
- }
478
-
479
- printWarning.apply(undefined, [format].concat(args));
480
- }
481
- };
482
- }
483
-
484
- var lowPriorityWarning_1 = lowPriorityWarning;
485
-
486
- /**
487
- * Base class helpers for the updating state of a component.
488
- */
489
- function ReactComponent(props, context, updater) {
490
- this.props = props;
491
- this.context = context;
492
- this.refs = emptyObject_1;
493
- // We initialize the default updater but the real one gets injected by the
494
- // renderer.
495
- this.updater = updater || ReactNoopUpdateQueue_1;
496
- }
497
-
498
- ReactComponent.prototype.isReactComponent = {};
499
-
500
- /**
501
- * Sets a subset of the state. Always use this to mutate
502
- * state. You should treat `this.state` as immutable.
503
- *
504
- * There is no guarantee that `this.state` will be immediately updated, so
505
- * accessing `this.state` after calling this method may return the old value.
506
- *
507
- * There is no guarantee that calls to `setState` will run synchronously,
508
- * as they may eventually be batched together. You can provide an optional
509
- * callback that will be executed when the call to setState is actually
510
- * completed.
511
- *
512
- * When a function is provided to setState, it will be called at some point in
513
- * the future (not synchronously). It will be called with the up to date
514
- * component arguments (state, props, context). These values can be different
515
- * from this.* because your function may be called after receiveProps but before
516
- * shouldComponentUpdate, and this new state, props, and context will not yet be
517
- * assigned to this.
518
- *
519
- * @param {object|function} partialState Next partial state or function to
520
- * produce next partial state to be merged with current state.
521
- * @param {?function} callback Called after state is updated.
522
- * @final
523
- * @protected
524
- */
525
- ReactComponent.prototype.setState = function(partialState, callback) {
526
- !(typeof partialState === 'object' ||
527
- typeof partialState === 'function' ||
528
- partialState == null)
529
- ? invariant_1(
530
- false,
531
- 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.'
532
- )
533
- : void 0;
534
- this.updater.enqueueSetState(this, partialState, callback, 'setState');
535
- };
536
-
537
- /**
538
- * Forces an update. This should only be invoked when it is known with
539
- * certainty that we are **not** in a DOM transaction.
540
- *
541
- * You may want to call this when you know that some deeper aspect of the
542
- * component's state has changed but `setState` was not called.
543
- *
544
- * This will not invoke `shouldComponentUpdate`, but it will invoke
545
- * `componentWillUpdate` and `componentDidUpdate`.
546
- *
547
- * @param {?function} callback Called after update is complete.
548
- * @final
549
- * @protected
550
- */
551
- ReactComponent.prototype.forceUpdate = function(callback) {
552
- this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
553
- };
554
-
555
- /**
556
- * Deprecated APIs. These APIs used to exist on classic React classes but since
557
- * we would like to deprecate them, we're not going to move them over to this
558
- * modern base class. Instead, we define a getter that warns if it's accessed.
559
- */
560
- {
561
- var deprecatedAPIs = {
562
- isMounted: [
563
- 'isMounted',
564
- 'Instead, make sure to clean up subscriptions and pending requests in ' +
565
- 'componentWillUnmount to prevent memory leaks.',
566
- ],
567
- replaceState: [
568
- 'replaceState',
569
- 'Refactor your code to use setState instead (see ' +
570
- 'https://github.com/facebook/react/issues/3236).',
571
- ],
572
- };
573
- var defineDeprecationWarning = function(methodName, info) {
574
- Object.defineProperty(ReactComponent.prototype, methodName, {
575
- get: function() {
576
- lowPriorityWarning_1(
577
- false,
578
- '%s(...) is deprecated in plain JavaScript React classes. %s',
579
- info[0],
580
- info[1]
581
- );
582
- return undefined;
583
- },
584
- });
585
- };
586
- for (var fnName in deprecatedAPIs) {
587
- if (deprecatedAPIs.hasOwnProperty(fnName)) {
588
- defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
589
- }
590
- }
591
- }
592
-
593
- /**
594
- * Base class helpers for the updating state of a component.
595
- */
596
- function ReactPureComponent(props, context, updater) {
597
- // Duplicated from ReactComponent.
598
- this.props = props;
599
- this.context = context;
600
- this.refs = emptyObject_1;
601
- // We initialize the default updater but the real one gets injected by the
602
- // renderer.
603
- this.updater = updater || ReactNoopUpdateQueue_1;
604
- }
605
-
606
- function ComponentDummy() {}
607
- ComponentDummy.prototype = ReactComponent.prototype;
608
- var pureComponentPrototype = (ReactPureComponent.prototype = new ComponentDummy());
609
- pureComponentPrototype.constructor = ReactPureComponent;
610
- // Avoid an extra prototype jump for these methods.
611
- index(pureComponentPrototype, ReactComponent.prototype);
612
- pureComponentPrototype.isPureReactComponent = true;
613
-
614
- function ReactAsyncComponent(props, context, updater) {
615
- // Duplicated from ReactComponent.
616
- this.props = props;
617
- this.context = context;
618
- this.refs = emptyObject_1;
619
- // We initialize the default updater but the real one gets injected by the
620
- // renderer.
621
- this.updater = updater || ReactNoopUpdateQueue_1;
622
- }
623
-
624
- var asyncComponentPrototype = (ReactAsyncComponent.prototype = new ComponentDummy());
625
- asyncComponentPrototype.constructor = ReactAsyncComponent;
626
- // Avoid an extra prototype jump for these methods.
627
- index(asyncComponentPrototype, ReactComponent.prototype);
628
- asyncComponentPrototype.unstable_isAsyncReactComponent = true;
629
- asyncComponentPrototype.render = function() {
630
- return this.props.children;
631
- };
632
-
633
- var ReactBaseClasses = {
634
- Component: ReactComponent,
635
- PureComponent: ReactPureComponent,
636
- AsyncComponent: ReactAsyncComponent,
637
- };
638
-
639
- /**
640
- * Copyright 2013-present, Facebook, Inc.
641
- * All rights reserved.
642
- *
643
- * This source code is licensed under the BSD-style license found in the
644
- * LICENSE file in the root directory of this source tree. An additional grant
645
- * of patent rights can be found in the PATENTS file in the same directory.
646
- *
647
- * @providesModule ReactCurrentOwner
648
- *
649
- */
650
-
651
- /**
652
- * Keeps track of the current owner.
653
- *
654
- * The current owner is the component who should own any components that are
655
- * currently being constructed.
656
- */
657
- var ReactCurrentOwner = {
658
- /**
659
- * @internal
660
- * @type {ReactComponent}
661
- */
662
- current: null,
663
- };
664
-
665
- var ReactCurrentOwner_1 = ReactCurrentOwner;
666
-
667
- var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
668
-
669
- {
670
- var warning$3 = warning_1;
671
- }
672
-
673
- // The Symbol used to tag the ReactElement type. If there is no native Symbol
674
- // nor polyfill, then a plain number is used for performance.
675
- var REACT_ELEMENT_TYPE$1 =
676
- (typeof Symbol === 'function' &&
677
- Symbol['for'] &&
678
- Symbol['for']('react.element')) ||
679
- 0xeac7;
680
-
681
- var RESERVED_PROPS = {
682
- key: true,
683
- ref: true,
684
- __self: true,
685
- __source: true,
686
- };
687
-
688
- var specialPropKeyWarningShown;
689
- var specialPropRefWarningShown;
690
-
691
- function hasValidRef(config) {
692
- {
693
- if (hasOwnProperty$1.call(config, 'ref')) {
694
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
695
- if (getter && getter.isReactWarning) {
696
- return false;
697
- }
698
- }
699
- }
700
- return config.ref !== undefined;
701
- }
702
-
703
- function hasValidKey(config) {
704
- {
705
- if (hasOwnProperty$1.call(config, 'key')) {
706
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
707
- if (getter && getter.isReactWarning) {
708
- return false;
709
- }
710
- }
711
- }
712
- return config.key !== undefined;
713
- }
714
-
715
- function defineKeyPropWarningGetter(props, displayName) {
716
- var warnAboutAccessingKey = function() {
717
- if (!specialPropKeyWarningShown) {
718
- specialPropKeyWarningShown = true;
719
- warning$3(
720
- false,
721
- '%s: `key` is not a prop. Trying to access it will result ' +
722
- 'in `undefined` being returned. If you need to access the same ' +
723
- 'value within the child component, you should pass it as a different ' +
724
- 'prop. (https://fb.me/react-special-props)',
725
- displayName
726
- );
727
- }
728
- };
729
- warnAboutAccessingKey.isReactWarning = true;
730
- Object.defineProperty(props, 'key', {
731
- get: warnAboutAccessingKey,
732
- configurable: true,
733
- });
734
- }
735
-
736
- function defineRefPropWarningGetter(props, displayName) {
737
- var warnAboutAccessingRef = function() {
738
- if (!specialPropRefWarningShown) {
739
- specialPropRefWarningShown = true;
740
- warning$3(
741
- false,
742
- '%s: `ref` is not a prop. Trying to access it will result ' +
743
- 'in `undefined` being returned. If you need to access the same ' +
744
- 'value within the child component, you should pass it as a different ' +
745
- 'prop. (https://fb.me/react-special-props)',
746
- displayName
747
- );
748
- }
749
- };
750
- warnAboutAccessingRef.isReactWarning = true;
751
- Object.defineProperty(props, 'ref', {
752
- get: warnAboutAccessingRef,
753
- configurable: true,
754
- });
755
- }
756
-
757
- /**
758
- * Factory method to create a new React element. This no longer adheres to
759
- * the class pattern, so do not use new to call it. Also, no instanceof check
760
- * will work. Instead test $$typeof field against Symbol.for('react.element') to check
761
- * if something is a React Element.
762
- *
763
- * @param {*} type
764
- * @param {*} key
765
- * @param {string|object} ref
766
- * @param {*} self A *temporary* helper to detect places where `this` is
767
- * different from the `owner` when React.createElement is called, so that we
768
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
769
- * functions, and as long as `this` and owner are the same, there will be no
770
- * change in behavior.
771
- * @param {*} source An annotation object (added by a transpiler or otherwise)
772
- * indicating filename, line number, and/or other information.
773
- * @param {*} owner
774
- * @param {*} props
775
- * @internal
776
- */
777
- var ReactElement = function(type, key, ref, self, source, owner, props) {
778
- var element = {
779
- // This tag allow us to uniquely identify this as a React Element
780
- $$typeof: REACT_ELEMENT_TYPE$1,
781
-
782
- // Built-in properties that belong on the element
783
- type: type,
784
- key: key,
785
- ref: ref,
786
- props: props,
787
-
788
- // Record the component responsible for creating this element.
789
- _owner: owner,
790
- };
791
-
792
- {
793
- // The validation flag is currently mutative. We put it on
794
- // an external backing store so that we can freeze the whole object.
795
- // This can be replaced with a WeakMap once they are implemented in
796
- // commonly used development environments.
797
- element._store = {};
798
-
799
- // To make comparing ReactElements easier for testing purposes, we make
800
- // the validation flag non-enumerable (where possible, which should
801
- // include every environment we run tests in), so the test framework
802
- // ignores it.
803
- Object.defineProperty(element._store, 'validated', {
804
- configurable: false,
805
- enumerable: false,
806
- writable: true,
807
- value: false,
808
- });
809
- // self and source are DEV only properties.
810
- Object.defineProperty(element, '_self', {
811
- configurable: false,
812
- enumerable: false,
813
- writable: false,
814
- value: self,
815
- });
816
- // Two elements created in two different places should be considered
817
- // equal for testing purposes and therefore we hide it from enumeration.
818
- Object.defineProperty(element, '_source', {
819
- configurable: false,
820
- enumerable: false,
821
- writable: false,
822
- value: source,
823
- });
824
- if (Object.freeze) {
825
- Object.freeze(element.props);
826
- Object.freeze(element);
827
- }
828
- }
829
-
830
- return element;
831
- };
832
-
833
- /**
834
- * Create and return a new ReactElement of the given type.
835
- * See https://facebook.github.io/react/docs/react-api.html#createelement
836
- */
837
- ReactElement.createElement = function(type, config, children) {
838
- var propName;
839
-
840
- // Reserved names are extracted
841
- var props = {};
842
-
843
- var key = null;
844
- var ref = null;
845
- var self = null;
846
- var source = null;
847
-
848
- if (config != null) {
849
- if (hasValidRef(config)) {
850
- ref = config.ref;
851
- }
852
- if (hasValidKey(config)) {
853
- key = '' + config.key;
854
- }
855
-
856
- self = config.__self === undefined ? null : config.__self;
857
- source = config.__source === undefined ? null : config.__source;
858
- // Remaining properties are added to a new props object
859
- for (propName in config) {
860
- if (
861
- hasOwnProperty$1.call(config, propName) &&
862
- !RESERVED_PROPS.hasOwnProperty(propName)
863
- ) {
864
- props[propName] = config[propName];
865
- }
866
- }
867
- }
868
-
869
- // Children can be more than one argument, and those are transferred onto
870
- // the newly allocated props object.
871
- var childrenLength = arguments.length - 2;
872
- if (childrenLength === 1) {
873
- props.children = children;
874
- } else if (childrenLength > 1) {
875
- var childArray = Array(childrenLength);
876
- for (var i = 0; i < childrenLength; i++) {
877
- childArray[i] = arguments[i + 2];
878
- }
879
- {
880
- if (Object.freeze) {
881
- Object.freeze(childArray);
882
- }
883
- }
884
- props.children = childArray;
885
- }
886
-
887
- // Resolve default props
888
- if (type && type.defaultProps) {
889
- var defaultProps = type.defaultProps;
890
- for (propName in defaultProps) {
891
- if (props[propName] === undefined) {
892
- props[propName] = defaultProps[propName];
893
- }
894
- }
895
- }
896
- {
897
- if (key || ref) {
898
- if (
899
- typeof props.$$typeof === 'undefined' ||
900
- props.$$typeof !== REACT_ELEMENT_TYPE$1
901
- ) {
902
- var displayName = typeof type === 'function'
903
- ? type.displayName || type.name || 'Unknown'
904
- : type;
905
- if (key) {
906
- defineKeyPropWarningGetter(props, displayName);
907
- }
908
- if (ref) {
909
- defineRefPropWarningGetter(props, displayName);
910
- }
911
- }
912
- }
913
- }
914
- return ReactElement(
915
- type,
916
- key,
917
- ref,
918
- self,
919
- source,
920
- ReactCurrentOwner_1.current,
921
- props
922
- );
923
- };
924
-
925
- /**
926
- * Return a function that produces ReactElements of a given type.
927
- * See https://facebook.github.io/react/docs/react-api.html#createfactory
928
- */
929
- ReactElement.createFactory = function(type) {
930
- var factory = ReactElement.createElement.bind(null, type);
931
- // Expose the type on the factory and the prototype so that it can be
932
- // easily accessed on elements. E.g. `<Foo />.type === Foo`.
933
- // This should not be named `constructor` since this may not be the function
934
- // that created the element, and it may not even be a constructor.
935
- // Legacy hook TODO: Warn if this is accessed
936
- factory.type = type;
937
- return factory;
938
- };
939
-
940
- ReactElement.cloneAndReplaceKey = function(oldElement, newKey) {
941
- var newElement = ReactElement(
942
- oldElement.type,
943
- newKey,
944
- oldElement.ref,
945
- oldElement._self,
946
- oldElement._source,
947
- oldElement._owner,
948
- oldElement.props
949
- );
950
-
951
- return newElement;
952
- };
953
-
954
- /**
955
- * Clone and return a new ReactElement using element as the starting point.
956
- * See https://facebook.github.io/react/docs/react-api.html#cloneelement
957
- */
958
- ReactElement.cloneElement = function(element, config, children) {
959
- var propName;
960
-
961
- // Original props are copied
962
- var props = index({}, element.props);
963
-
964
- // Reserved names are extracted
965
- var key = element.key;
966
- var ref = element.ref;
967
- // Self is preserved since the owner is preserved.
968
- var self = element._self;
969
- // Source is preserved since cloneElement is unlikely to be targeted by a
970
- // transpiler, and the original source is probably a better indicator of the
971
- // true owner.
972
- var source = element._source;
973
-
974
- // Owner will be preserved, unless ref is overridden
975
- var owner = element._owner;
976
-
977
- if (config != null) {
978
- if (hasValidRef(config)) {
979
- // Silently steal the ref from the parent.
980
- ref = config.ref;
981
- owner = ReactCurrentOwner_1.current;
982
- }
983
- if (hasValidKey(config)) {
984
- key = '' + config.key;
985
- }
986
-
987
- // Remaining properties override existing props
988
- var defaultProps;
989
- if (element.type && element.type.defaultProps) {
990
- defaultProps = element.type.defaultProps;
991
- }
992
- for (propName in config) {
993
- if (
994
- hasOwnProperty$1.call(config, propName) &&
995
- !RESERVED_PROPS.hasOwnProperty(propName)
996
- ) {
997
- if (config[propName] === undefined && defaultProps !== undefined) {
998
- // Resolve default props
999
- props[propName] = defaultProps[propName];
1000
- } else {
1001
- props[propName] = config[propName];
1002
- }
1003
- }
1004
- }
1005
- }
1006
-
1007
- // Children can be more than one argument, and those are transferred onto
1008
- // the newly allocated props object.
1009
- var childrenLength = arguments.length - 2;
1010
- if (childrenLength === 1) {
1011
- props.children = children;
1012
- } else if (childrenLength > 1) {
1013
- var childArray = Array(childrenLength);
1014
- for (var i = 0; i < childrenLength; i++) {
1015
- childArray[i] = arguments[i + 2];
1016
- }
1017
- props.children = childArray;
1018
- }
1019
-
1020
- return ReactElement(element.type, key, ref, self, source, owner, props);
1021
- };
1022
-
1023
- /**
1024
- * Verifies the object is a ReactElement.
1025
- * See https://facebook.github.io/react/docs/react-api.html#isvalidelement
1026
- * @param {?object} object
1027
- * @return {boolean} True if `object` is a valid component.
1028
- * @final
1029
- */
1030
- ReactElement.isValidElement = function(object) {
1031
- return (
1032
- typeof object === 'object' &&
1033
- object !== null &&
1034
- object.$$typeof === REACT_ELEMENT_TYPE$1
1035
- );
1036
- };
1037
-
1038
- var ReactElement_1 = ReactElement;
1039
-
1040
- /**
1041
- * Copyright 2013-present, Facebook, Inc.
1042
- * All rights reserved.
1043
- *
1044
- * This source code is licensed under the BSD-style license found in the
1045
- * LICENSE file in the root directory of this source tree. An additional grant
1046
- * of patent rights can be found in the PATENTS file in the same directory.
1047
- *
1048
- * @providesModule ReactDebugCurrentFrame
1049
- *
1050
- */
1051
-
1052
- var ReactDebugCurrentFrame = {};
1053
-
1054
- {
1055
- // Component that is being worked on
1056
- ReactDebugCurrentFrame.getCurrentStack = null;
1057
-
1058
- ReactDebugCurrentFrame.getStackAddendum = function() {
1059
- var impl = ReactDebugCurrentFrame.getCurrentStack;
1060
- if (impl) {
1061
- return impl();
1062
- }
1063
- return null;
1064
- };
1065
- }
1066
-
1067
- var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame;
1068
-
1069
- {
1070
- var warning$2 = warning_1;
1071
-
1072
- var _require = ReactDebugCurrentFrame_1,
1073
- getStackAddendum = _require.getStackAddendum;
1074
- }
1075
-
1076
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
1077
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
1078
- // The Symbol used to tag the ReactElement type. If there is no native Symbol
1079
- // nor polyfill, then a plain number is used for performance.
1080
- var REACT_ELEMENT_TYPE =
1081
- (typeof Symbol === 'function' &&
1082
- Symbol['for'] &&
1083
- Symbol['for']('react.element')) ||
1084
- 0xeac7;
1085
-
1086
- var SEPARATOR = '.';
1087
- var SUBSEPARATOR = ':';
1088
-
1089
- /**
1090
- * Escape and wrap key so it is safe to use as a reactid
1091
- *
1092
- * @param {string} key to be escaped.
1093
- * @return {string} the escaped key.
1094
- */
1095
- function escape(key) {
1096
- var escapeRegex = /[=:]/g;
1097
- var escaperLookup = {
1098
- '=': '=0',
1099
- ':': '=2',
1100
- };
1101
- var escapedString = ('' + key).replace(escapeRegex, function(match) {
1102
- return escaperLookup[match];
1103
- });
1104
-
1105
- return '$' + escapedString;
1106
- }
1107
-
1108
- /**
1109
- * TODO: Test that a single child and an array with one item have the same key
1110
- * pattern.
1111
- */
1112
-
1113
- var didWarnAboutMaps = false;
1114
-
1115
- var userProvidedKeyEscapeRegex = /\/+/g;
1116
- function escapeUserProvidedKey(text) {
1117
- return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
1118
- }
1119
-
1120
- var POOL_SIZE = 10;
1121
- var traverseContextPool = [];
1122
- function getPooledTraverseContext(
1123
- mapResult,
1124
- keyPrefix,
1125
- mapFunction,
1126
- mapContext
1127
- ) {
1128
- if (traverseContextPool.length) {
1129
- var traverseContext = traverseContextPool.pop();
1130
- traverseContext.result = mapResult;
1131
- traverseContext.keyPrefix = keyPrefix;
1132
- traverseContext.func = mapFunction;
1133
- traverseContext.context = mapContext;
1134
- traverseContext.count = 0;
1135
- return traverseContext;
1136
- } else {
1137
- return {
1138
- result: mapResult,
1139
- keyPrefix: keyPrefix,
1140
- func: mapFunction,
1141
- context: mapContext,
1142
- count: 0,
1143
- };
1144
- }
1145
- }
1146
-
1147
- function releaseTraverseContext(traverseContext) {
1148
- traverseContext.result = null;
1149
- traverseContext.keyPrefix = null;
1150
- traverseContext.func = null;
1151
- traverseContext.context = null;
1152
- traverseContext.count = 0;
1153
- if (traverseContextPool.length < POOL_SIZE) {
1154
- traverseContextPool.push(traverseContext);
1155
- }
1156
- }
1157
-
1158
- /**
1159
- * @param {?*} children Children tree container.
1160
- * @param {!string} nameSoFar Name of the key path so far.
1161
- * @param {!function} callback Callback to invoke with each child found.
1162
- * @param {?*} traverseContext Used to pass information throughout the traversal
1163
- * process.
1164
- * @return {!number} The number of children in this subtree.
1165
- */
1166
- function traverseAllChildrenImpl(
1167
- children,
1168
- nameSoFar,
1169
- callback,
1170
- traverseContext
1171
- ) {
1172
- var type = typeof children;
1173
-
1174
- if (type === 'undefined' || type === 'boolean') {
1175
- // All of the above are perceived as null.
1176
- children = null;
1177
- }
1178
-
1179
- if (
1180
- children === null ||
1181
- type === 'string' ||
1182
- type === 'number' ||
1183
- // The following is inlined from ReactElement. This means we can optimize
1184
- // some checks. React Fiber also inlines this logic for similar purposes.
1185
- (type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE)
1186
- ) {
1187
- callback(
1188
- traverseContext,
1189
- children,
1190
- // If it's the only child, treat the name as if it was wrapped in an array
1191
- // so that it's consistent if the number of children grows.
1192
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar
1193
- );
1194
- return 1;
1195
- }
1196
-
1197
- var child;
1198
- var nextName;
1199
- var subtreeCount = 0; // Count of children found in the current subtree.
1200
- var nextNamePrefix = nameSoFar === ''
1201
- ? SEPARATOR
1202
- : nameSoFar + SUBSEPARATOR;
1203
-
1204
- if (Array.isArray(children)) {
1205
- for (var i = 0; i < children.length; i++) {
1206
- child = children[i];
1207
- nextName = nextNamePrefix + getComponentKey(child, i);
1208
- subtreeCount += traverseAllChildrenImpl(
1209
- child,
1210
- nextName,
1211
- callback,
1212
- traverseContext
1213
- );
1214
- }
1215
- } else {
1216
- var iteratorFn =
1217
- (ITERATOR_SYMBOL && children[ITERATOR_SYMBOL]) ||
1218
- children[FAUX_ITERATOR_SYMBOL];
1219
- if (typeof iteratorFn === 'function') {
1220
- {
1221
- // Warn about using Maps as children
1222
- if (iteratorFn === children.entries) {
1223
- warning$2(
1224
- didWarnAboutMaps,
1225
- 'Using Maps as children is unsupported and will likely yield ' +
1226
- 'unexpected results. Convert it to a sequence/iterable of keyed ' +
1227
- 'ReactElements instead.%s',
1228
- getStackAddendum()
1229
- );
1230
- didWarnAboutMaps = true;
1231
- }
1232
- }
1233
-
1234
- var iterator = iteratorFn.call(children);
1235
- var step;
1236
- var ii = 0;
1237
- while (!(step = iterator.next()).done) {
1238
- child = step.value;
1239
- nextName = nextNamePrefix + getComponentKey(child, ii++);
1240
- subtreeCount += traverseAllChildrenImpl(
1241
- child,
1242
- nextName,
1243
- callback,
1244
- traverseContext
1245
- );
1246
- }
1247
- } else if (type === 'object') {
1248
- var addendum = '';
1249
- {
1250
- addendum =
1251
- ' If you meant to render a collection of children, use an array ' +
1252
- 'instead.' +
1253
- getStackAddendum();
1254
- }
1255
- var childrenString = '' + children;
1256
- invariant_1(
1257
- false,
1258
- 'Objects are not valid as a React child (found: %s).%s',
1259
- childrenString === '[object Object]'
1260
- ? 'object with keys {' + Object.keys(children).join(', ') + '}'
1261
- : childrenString,
1262
- addendum
1263
- );
1264
- }
1265
- }
1266
-
1267
- return subtreeCount;
1268
- }
1269
-
1270
- /**
1271
- * Traverses children that are typically specified as `props.children`, but
1272
- * might also be specified through attributes:
1273
- *
1274
- * - `traverseAllChildren(this.props.children, ...)`
1275
- * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
1276
- *
1277
- * The `traverseContext` is an optional argument that is passed through the
1278
- * entire traversal. It can be used to store accumulations or anything else that
1279
- * the callback might find relevant.
1280
- *
1281
- * @param {?*} children Children tree object.
1282
- * @param {!function} callback To invoke upon traversing each child.
1283
- * @param {?*} traverseContext Context for traversal.
1284
- * @return {!number} The number of children in this subtree.
1285
- */
1286
- function traverseAllChildren(children, callback, traverseContext) {
1287
- if (children == null) {
1288
- return 0;
1289
- }
1290
-
1291
- return traverseAllChildrenImpl(children, '', callback, traverseContext);
1292
- }
1293
-
1294
- /**
1295
- * Generate a key string that identifies a component within a set.
1296
- *
1297
- * @param {*} component A component that could contain a manual key.
1298
- * @param {number} index Index that is used if a manual key is not provided.
1299
- * @return {string}
1300
- */
1301
- function getComponentKey(component, index) {
1302
- // Do some typechecking here since we call this blindly. We want to ensure
1303
- // that we don't block potential future ES APIs.
1304
- if (
1305
- typeof component === 'object' &&
1306
- component !== null &&
1307
- component.key != null
1308
- ) {
1309
- // Explicit key
1310
- return escape(component.key);
1311
- }
1312
- // Implicit key determined by the index in the set
1313
- return index.toString(36);
1314
- }
1315
-
1316
- function forEachSingleChild(bookKeeping, child, name) {
1317
- var func = bookKeeping.func, context = bookKeeping.context;
1318
-
1319
- func.call(context, child, bookKeeping.count++);
1320
- }
1321
-
1322
- /**
1323
- * Iterates through children that are typically specified as `props.children`.
1324
- *
1325
- * See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
1326
- *
1327
- * The provided forEachFunc(child, index) will be called for each
1328
- * leaf child.
1329
- *
1330
- * @param {?*} children Children tree container.
1331
- * @param {function(*, int)} forEachFunc
1332
- * @param {*} forEachContext Context for forEachContext.
1333
- */
1334
- function forEachChildren(children, forEachFunc, forEachContext) {
1335
- if (children == null) {
1336
- return children;
1337
- }
1338
- var traverseContext = getPooledTraverseContext(
1339
- null,
1340
- null,
1341
- forEachFunc,
1342
- forEachContext
1343
- );
1344
- traverseAllChildren(children, forEachSingleChild, traverseContext);
1345
- releaseTraverseContext(traverseContext);
1346
- }
1347
-
1348
- function mapSingleChildIntoContext(bookKeeping, child, childKey) {
1349
- var result = bookKeeping.result,
1350
- keyPrefix = bookKeeping.keyPrefix,
1351
- func = bookKeeping.func,
1352
- context = bookKeeping.context;
1353
-
1354
- var mappedChild = func.call(context, child, bookKeeping.count++);
1355
- if (Array.isArray(mappedChild)) {
1356
- mapIntoWithKeyPrefixInternal(
1357
- mappedChild,
1358
- result,
1359
- childKey,
1360
- emptyFunction_1.thatReturnsArgument
1361
- );
1362
- } else if (mappedChild != null) {
1363
- if (ReactElement_1.isValidElement(mappedChild)) {
1364
- mappedChild = ReactElement_1.cloneAndReplaceKey(
1365
- mappedChild,
1366
- // Keep both the (mapped) and old keys if they differ, just as
1367
- // traverseAllChildren used to do for objects as children
1368
- keyPrefix +
1369
- (mappedChild.key && (!child || child.key !== mappedChild.key)
1370
- ? escapeUserProvidedKey(mappedChild.key) + '/'
1371
- : '') +
1372
- childKey
1373
- );
1374
- }
1375
- result.push(mappedChild);
1376
- }
1377
- }
1378
-
1379
- function mapIntoWithKeyPrefixInternal(
1380
- children,
1381
- array,
1382
- prefix,
1383
- func,
1384
- context
1385
- ) {
1386
- var escapedPrefix = '';
1387
- if (prefix != null) {
1388
- escapedPrefix = escapeUserProvidedKey(prefix) + '/';
1389
- }
1390
- var traverseContext = getPooledTraverseContext(
1391
- array,
1392
- escapedPrefix,
1393
- func,
1394
- context
1395
- );
1396
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
1397
- releaseTraverseContext(traverseContext);
1398
- }
1399
-
1400
- /**
1401
- * Maps children that are typically specified as `props.children`.
1402
- *
1403
- * See https://facebook.github.io/react/docs/react-api.html#react.children.map
1404
- *
1405
- * The provided mapFunction(child, key, index) will be called for each
1406
- * leaf child.
1407
- *
1408
- * @param {?*} children Children tree container.
1409
- * @param {function(*, int)} func The map function.
1410
- * @param {*} context Context for mapFunction.
1411
- * @return {object} Object containing the ordered map of results.
1412
- */
1413
- function mapChildren(children, func, context) {
1414
- if (children == null) {
1415
- return children;
1416
- }
1417
- var result = [];
1418
- mapIntoWithKeyPrefixInternal(children, result, null, func, context);
1419
- return result;
1420
- }
1421
-
1422
- /**
1423
- * Count the number of children that are typically specified as
1424
- * `props.children`.
1425
- *
1426
- * See https://facebook.github.io/react/docs/react-api.html#react.children.count
1427
- *
1428
- * @param {?*} children Children tree container.
1429
- * @return {number} The number of children.
1430
- */
1431
- function countChildren(children, context) {
1432
- return traverseAllChildren(children, emptyFunction_1.thatReturnsNull, null);
1433
- }
1434
-
1435
- /**
1436
- * Flatten a children object (typically specified as `props.children`) and
1437
- * return an array with appropriately re-keyed children.
1438
- *
1439
- * See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
1440
- */
1441
- function toArray(children) {
1442
- var result = [];
1443
- mapIntoWithKeyPrefixInternal(
1444
- children,
1445
- result,
1446
- null,
1447
- emptyFunction_1.thatReturnsArgument
1448
- );
1449
- return result;
1450
- }
1451
-
1452
- var ReactChildren = {
1453
- forEach: forEachChildren,
1454
- map: mapChildren,
1455
- count: countChildren,
1456
- toArray: toArray,
1457
- };
1458
-
1459
- var ReactChildren_1 = ReactChildren;
1460
-
1461
- /**
1462
- * Copyright 2013-present, Facebook, Inc.
1463
- * All rights reserved.
1464
- *
1465
- * This source code is licensed under the BSD-style license found in the
1466
- * LICENSE file in the root directory of this source tree. An additional grant
1467
- * of patent rights can be found in the PATENTS file in the same directory.
1468
- *
1469
- * @providesModule ReactVersion
1470
- */
1471
-
1472
- var ReactVersion = '16.0.0-beta.5';
1473
-
1474
- /**
1475
- * Returns the first child in a collection of children and verifies that there
1476
- * is only one child in the collection.
1477
- *
1478
- * See https://facebook.github.io/react/docs/react-api.html#react.children.only
1479
- *
1480
- * The current implementation of this function assumes that a single child gets
1481
- * passed without a wrapper, but the purpose of this helper function is to
1482
- * abstract away the particular structure of children.
1483
- *
1484
- * @param {?object} children Child collection structure.
1485
- * @return {ReactElement} The first and only `ReactElement` contained in the
1486
- * structure.
1487
- */
1488
- function onlyChild(children) {
1489
- !ReactElement_1.isValidElement(children)
1490
- ? invariant_1(
1491
- false,
1492
- 'React.Children.only expected to receive a single React element child.'
1493
- )
1494
- : void 0;
1495
- return children;
1496
- }
1497
-
1498
- var onlyChild_1 = onlyChild;
1499
-
1500
- /**
1501
- * Copyright 2013-present, Facebook, Inc.
1502
- * All rights reserved.
1503
- *
1504
- * This source code is licensed under the BSD-style license found in the
1505
- * LICENSE file in the root directory of this source tree. An additional grant
1506
- * of patent rights can be found in the PATENTS file in the same directory.
1507
- */
1508
-
1509
- var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1510
-
1511
- var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
1512
-
1513
- {
1514
- var invariant$2 = invariant_1;
1515
- var warning$5 = warning_1;
1516
- var ReactPropTypesSecret = ReactPropTypesSecret_1;
1517
- var loggedTypeFailures = {};
1518
- }
1519
-
1520
- /**
1521
- * Assert that the values match with the type specs.
1522
- * Error messages are memorized and will only be shown once.
1523
- *
1524
- * @param {object} typeSpecs Map of name to a ReactPropType
1525
- * @param {object} values Runtime values that need to be type-checked
1526
- * @param {string} location e.g. "prop", "context", "child context"
1527
- * @param {string} componentName Name of the component for error messages.
1528
- * @param {?Function} getStack Returns the component stack.
1529
- * @private
1530
- */
1531
- function checkPropTypes$1(
1532
- typeSpecs,
1533
- values,
1534
- location,
1535
- componentName,
1536
- getStack
1537
- ) {
1538
- {
1539
- for (var typeSpecName in typeSpecs) {
1540
- if (typeSpecs.hasOwnProperty(typeSpecName)) {
1541
- var error;
1542
- // Prop type validation may throw. In case they do, we don't want to
1543
- // fail the render phase where it didn't fail before. So we log it.
1544
- // After these have been cleaned up, we'll let them throw.
1545
- try {
1546
- // This is intentionally an invariant that gets caught. It's the same
1547
- // behavior as without this statement except with a better message.
1548
- invariant$2(
1549
- typeof typeSpecs[typeSpecName] === 'function',
1550
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
1551
- 'React.PropTypes.',
1552
- componentName || 'React class',
1553
- location,
1554
- typeSpecName
1555
- );
1556
- error = typeSpecs[typeSpecName](
1557
- values,
1558
- typeSpecName,
1559
- componentName,
1560
- location,
1561
- null,
1562
- ReactPropTypesSecret
1563
- );
1564
- } catch (ex) {
1565
- error = ex;
1566
- }
1567
- warning$5(
1568
- !error || error instanceof Error,
1569
- '%s: type specification of %s `%s` is invalid; the type checker ' +
1570
- 'function must return `null` or an `Error` but returned a %s. ' +
1571
- 'You may have forgotten to pass an argument to the type checker ' +
1572
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
1573
- 'shape all require an argument).',
1574
- componentName || 'React class',
1575
- location,
1576
- typeSpecName,
1577
- typeof error
1578
- );
1579
- if (
1580
- error instanceof Error &&
1581
- !(error.message in loggedTypeFailures)
1582
- ) {
1583
- // Only monitor this failure once because there tends to be a lot of the
1584
- // same error.
1585
- loggedTypeFailures[error.message] = true;
1586
-
1587
- var stack = getStack ? getStack() : '';
1588
-
1589
- warning$5(
1590
- false,
1591
- 'Failed %s type: %s%s',
1592
- location,
1593
- error.message,
1594
- stack != null ? stack : ''
1595
- );
1596
- }
1597
- }
1598
- }
1599
- }
1600
- }
1601
-
1602
- var checkPropTypes_1 = checkPropTypes$1;
1603
-
1604
- /**
1605
- * Copyright 2016-present, Facebook, Inc.
1606
- * All rights reserved.
1607
- *
1608
- * This source code is licensed under the BSD-style license found in the
1609
- * LICENSE file in the root directory of this source tree. An additional grant
1610
- * of patent rights can be found in the PATENTS file in the same directory.
1611
- *
1612
- *
1613
- * @providesModule describeComponentFrame
1614
- */
1615
-
1616
- var describeComponentFrame$1 = function(name, source, ownerName) {
1617
- return (
1618
- '\n in ' +
1619
- (name || 'Unknown') +
1620
- (source
1621
- ? ' (at ' +
1622
- source.fileName.replace(/^.*[\\\/]/, '') +
1623
- ':' +
1624
- source.lineNumber +
1625
- ')'
1626
- : ownerName ? ' (created by ' + ownerName + ')' : '')
1627
- );
1628
- };
1629
-
1630
- /**
1631
- * Copyright 2013-present, Facebook, Inc.
1632
- * All rights reserved.
1633
- *
1634
- * This source code is licensed under the BSD-style license found in the
1635
- * LICENSE file in the root directory of this source tree. An additional grant
1636
- * of patent rights can be found in the PATENTS file in the same directory.
1637
- *
1638
- * @providesModule getComponentName
1639
- *
1640
- */
1641
-
1642
- function getComponentName$1(instanceOrFiber) {
1643
- if (typeof instanceOrFiber.getName === 'function') {
1644
- // Stack reconciler
1645
- var instance = instanceOrFiber;
1646
- return instance.getName();
1647
- }
1648
- if (typeof instanceOrFiber.tag === 'number') {
1649
- // Fiber reconciler
1650
- var fiber = instanceOrFiber;
1651
- var type = fiber.type;
1652
-
1653
- if (typeof type === 'string') {
1654
- return type;
1655
- }
1656
- if (typeof type === 'function') {
1657
- return type.displayName || type.name;
1658
- }
1659
- }
1660
- return null;
1661
- }
1662
-
1663
- var getComponentName_1 = getComponentName$1;
1664
-
1665
- {
1666
- var checkPropTypes = checkPropTypes_1;
1667
- var lowPriorityWarning$1 = lowPriorityWarning_1;
1668
- var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1;
1669
- var warning$4 = warning_1;
1670
- var describeComponentFrame = describeComponentFrame$1;
1671
- var getComponentName = getComponentName_1;
1672
-
1673
- var currentlyValidatingElement = null;
1674
-
1675
- var getDisplayName = function(element) {
1676
- if (element == null) {
1677
- return '#empty';
1678
- } else if (typeof element === 'string' || typeof element === 'number') {
1679
- return '#text';
1680
- } else if (typeof element.type === 'string') {
1681
- return element.type;
1682
- } else {
1683
- return element.type.displayName || element.type.name || 'Unknown';
1684
- }
1685
- };
1686
-
1687
- var getStackAddendum$1 = function() {
1688
- var stack = '';
1689
- if (currentlyValidatingElement) {
1690
- var name = getDisplayName(currentlyValidatingElement);
1691
- var owner = currentlyValidatingElement._owner;
1692
- stack += describeComponentFrame(
1693
- name,
1694
- currentlyValidatingElement._source,
1695
- owner && getComponentName(owner)
1696
- );
1697
- }
1698
- stack += ReactDebugCurrentFrame$1.getStackAddendum() || '';
1699
- return stack;
1700
- };
1701
- }
1702
-
1703
- var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
1704
- var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
1705
-
1706
- function getDeclarationErrorAddendum() {
1707
- if (ReactCurrentOwner_1.current) {
1708
- var name = getComponentName(ReactCurrentOwner_1.current);
1709
- if (name) {
1710
- return '\n\nCheck the render method of `' + name + '`.';
1711
- }
1712
- }
1713
- return '';
1714
- }
1715
-
1716
- function getSourceInfoErrorAddendum(elementProps) {
1717
- if (
1718
- elementProps !== null &&
1719
- elementProps !== undefined &&
1720
- elementProps.__source !== undefined
1721
- ) {
1722
- var source = elementProps.__source;
1723
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1724
- var lineNumber = source.lineNumber;
1725
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1726
- }
1727
- return '';
1728
- }
1729
-
1730
- /**
1731
- * Warn if there's no key explicitly set on dynamic arrays of children or
1732
- * object keys are not valid. This allows us to keep track of children between
1733
- * updates.
1734
- */
1735
- var ownerHasKeyUseWarning = {};
1736
-
1737
- function getCurrentComponentErrorInfo(parentType) {
1738
- var info = getDeclarationErrorAddendum();
1739
-
1740
- if (!info) {
1741
- var parentName = typeof parentType === 'string'
1742
- ? parentType
1743
- : parentType.displayName || parentType.name;
1744
- if (parentName) {
1745
- info =
1746
- '\n\nCheck the top-level render call using <' + parentName + '>.';
1747
- }
1748
- }
1749
- return info;
1750
- }
1751
-
1752
- /**
1753
- * Warn if the element doesn't have an explicit key assigned to it.
1754
- * This element is in an array. The array could grow and shrink or be
1755
- * reordered. All children that haven't already been validated are required to
1756
- * have a "key" property assigned to it. Error statuses are cached so a warning
1757
- * will only be shown once.
1758
- *
1759
- * @internal
1760
- * @param {ReactElement} element Element that requires a key.
1761
- * @param {*} parentType element's parent's type.
1762
- */
1763
- function validateExplicitKey(element, parentType) {
1764
- if (!element._store || element._store.validated || element.key != null) {
1765
- return;
1766
- }
1767
- element._store.validated = true;
1768
-
1769
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1770
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1771
- return;
1772
- }
1773
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
1774
-
1775
- // Usually the current owner is the offender, but if it accepts children as a
1776
- // property, it may be the creator of the child that's responsible for
1777
- // assigning it a key.
1778
- var childOwner = '';
1779
- if (
1780
- element &&
1781
- element._owner &&
1782
- element._owner !== ReactCurrentOwner_1.current
1783
- ) {
1784
- // Give the component that originally created this child.
1785
- childOwner =
1786
- ' It was passed a child from ' + getComponentName(element._owner) + '.';
1787
- }
1788
-
1789
- currentlyValidatingElement = element;
1790
- {
1791
- warning$4(
1792
- false,
1793
- 'Each child in an array or iterator should have a unique "key" prop.' +
1794
- '%s%s See https://fb.me/react-warning-keys for more information.%s',
1795
- currentComponentErrorInfo,
1796
- childOwner,
1797
- getStackAddendum$1()
1798
- );
1799
- }
1800
- currentlyValidatingElement = null;
1801
- }
1802
-
1803
- /**
1804
- * Ensure that every element either is passed in a static location, in an
1805
- * array with an explicit keys property defined, or in an object literal
1806
- * with valid key property.
1807
- *
1808
- * @internal
1809
- * @param {ReactNode} node Statically passed child of any type.
1810
- * @param {*} parentType node's parent's type.
1811
- */
1812
- function validateChildKeys(node, parentType) {
1813
- if (typeof node !== 'object') {
1814
- return;
1815
- }
1816
- if (Array.isArray(node)) {
1817
- for (var i = 0; i < node.length; i++) {
1818
- var child = node[i];
1819
- if (ReactElement_1.isValidElement(child)) {
1820
- validateExplicitKey(child, parentType);
1821
- }
1822
- }
1823
- } else if (ReactElement_1.isValidElement(node)) {
1824
- // This element was passed in a valid location.
1825
- if (node._store) {
1826
- node._store.validated = true;
1827
- }
1828
- } else if (node) {
1829
- var iteratorFn =
1830
- (ITERATOR_SYMBOL$1 && node[ITERATOR_SYMBOL$1]) ||
1831
- node[FAUX_ITERATOR_SYMBOL$1];
1832
- if (typeof iteratorFn === 'function') {
1833
- // Entry iterators used to provide implicit keys,
1834
- // but now we print a separate warning for them later.
1835
- if (iteratorFn !== node.entries) {
1836
- var iterator = iteratorFn.call(node);
1837
- var step;
1838
- while (!(step = iterator.next()).done) {
1839
- if (ReactElement_1.isValidElement(step.value)) {
1840
- validateExplicitKey(step.value, parentType);
1841
- }
1842
- }
1843
- }
1844
- }
1845
- }
1846
- }
1847
-
1848
- /**
1849
- * Given an element, validate that its props follow the propTypes definition,
1850
- * provided by the type.
1851
- *
1852
- * @param {ReactElement} element
1853
- */
1854
- function validatePropTypes(element) {
1855
- var componentClass = element.type;
1856
- if (typeof componentClass !== 'function') {
1857
- return;
1858
- }
1859
- var name = componentClass.displayName || componentClass.name;
1860
-
1861
- // ReactNative `View.propTypes` have been deprecated in favor of `ViewPropTypes`.
1862
- // In their place a temporary getter has been added with a deprecated warning message.
1863
- // Avoid triggering that warning during validation using the temporary workaround,
1864
- // __propTypesSecretDontUseThesePlease.
1865
- // TODO (bvaughn) Revert this particular change any time after April 1 ReactNative tag.
1866
- var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease ===
1867
- 'object'
1868
- ? componentClass.__propTypesSecretDontUseThesePlease
1869
- : componentClass.propTypes;
1870
-
1871
- if (propTypes) {
1872
- currentlyValidatingElement = element;
1873
- checkPropTypes(
1874
- propTypes,
1875
- element.props,
1876
- 'prop',
1877
- name,
1878
- getStackAddendum$1
1879
- );
1880
- currentlyValidatingElement = null;
1881
- }
1882
- if (typeof componentClass.getDefaultProps === 'function') {
1883
- warning$4(
1884
- componentClass.getDefaultProps.isReactClassApproved,
1885
- 'getDefaultProps is only used on classic React.createClass ' +
1886
- 'definitions. Use a static property named `defaultProps` instead.'
1887
- );
1888
- }
1889
- }
1890
-
1891
- var ReactElementValidator$1 = {
1892
- createElement: function(type, props, children) {
1893
- var validType = typeof type === 'string' || typeof type === 'function';
1894
- // We warn in this case but don't throw. We expect the element creation to
1895
- // succeed and there will likely be errors in render.
1896
- if (!validType) {
1897
- var info = '';
1898
- if (
1899
- type === undefined ||
1900
- (typeof type === 'object' &&
1901
- type !== null &&
1902
- Object.keys(type).length === 0)
1903
- ) {
1904
- info +=
1905
- ' You likely forgot to export your component from the file ' +
1906
- "it's defined in.";
1907
- }
1908
-
1909
- var sourceInfo = getSourceInfoErrorAddendum(props);
1910
- if (sourceInfo) {
1911
- info += sourceInfo;
1912
- } else {
1913
- info += getDeclarationErrorAddendum();
1914
- }
1915
-
1916
- info += ReactDebugCurrentFrame$1.getStackAddendum() || '';
1917
-
1918
- warning$4(
1919
- false,
1920
- 'React.createElement: type is invalid -- expected a string (for ' +
1921
- 'built-in components) or a class/function (for composite ' +
1922
- 'components) but got: %s.%s',
1923
- type == null ? type : typeof type,
1924
- info
1925
- );
1926
- }
1927
-
1928
- var element = ReactElement_1.createElement.apply(this, arguments);
1929
-
1930
- // The result can be nullish if a mock or a custom function is used.
1931
- // TODO: Drop this when these are no longer allowed as the type argument.
1932
- if (element == null) {
1933
- return element;
1934
- }
1935
-
1936
- // Skip key warning if the type isn't valid since our key validation logic
1937
- // doesn't expect a non-string/function type and can throw confusing errors.
1938
- // We don't want exception behavior to differ between dev and prod.
1939
- // (Rendering will throw with a helpful message and as soon as the type is
1940
- // fixed, the key warnings will appear.)
1941
- if (validType) {
1942
- for (var i = 2; i < arguments.length; i++) {
1943
- validateChildKeys(arguments[i], type);
1944
- }
1945
- }
1946
-
1947
- validatePropTypes(element);
1948
-
1949
- return element;
1950
- },
1951
-
1952
- createFactory: function(type) {
1953
- var validatedFactory = ReactElementValidator$1.createElement.bind(
1954
- null,
1955
- type
1956
- );
1957
- // Legacy hook TODO: Warn if this is accessed
1958
- validatedFactory.type = type;
1959
-
1960
- {
1961
- Object.defineProperty(validatedFactory, 'type', {
1962
- enumerable: false,
1963
- get: function() {
1964
- lowPriorityWarning$1(
1965
- false,
1966
- 'Factory.type is deprecated. Access the class directly ' +
1967
- 'before passing it to createFactory.'
1968
- );
1969
- Object.defineProperty(this, 'type', {
1970
- value: type,
1971
- });
1972
- return type;
1973
- },
1974
- });
1975
- }
1976
-
1977
- return validatedFactory;
1978
- },
1979
-
1980
- cloneElement: function(element, props, children) {
1981
- var newElement = ReactElement_1.cloneElement.apply(this, arguments);
1982
- for (var i = 2; i < arguments.length; i++) {
1983
- validateChildKeys(arguments[i], newElement.type);
1984
- }
1985
- validatePropTypes(newElement);
1986
- return newElement;
1987
- },
1988
- };
1989
-
1990
- var ReactElementValidator_1 = ReactElementValidator$1;
1991
-
1992
- {
1993
- var warning$6 = warning_1;
1994
- }
1995
-
1996
- function isNative(fn) {
1997
- // Based on isNative() from Lodash
1998
- var funcToString = Function.prototype.toString;
1999
- var reIsNative = RegExp(
2000
- '^' +
2001
- funcToString
2002
- // Take an example native function source for comparison
2003
- .call(Object.prototype.hasOwnProperty)
2004
- // Strip regex characters so we can use it for regex
2005
- .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
2006
- // Remove hasOwnProperty from the template to make it generic
2007
- .replace(
2008
- /hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,
2009
- '$1.*?'
2010
- ) +
2011
- '$'
2012
- );
2013
- try {
2014
- var source = funcToString.call(fn);
2015
- return reIsNative.test(source);
2016
- } catch (err) {
2017
- return false;
2018
- }
2019
- }
2020
-
2021
- var canUseCollections =
2022
- // Array.from
2023
- typeof Array.from === 'function' &&
2024
- // Map
2025
- typeof Map === 'function' &&
2026
- isNative(Map) &&
2027
- // Map.prototype.keys
2028
- Map.prototype != null &&
2029
- typeof Map.prototype.keys === 'function' &&
2030
- isNative(Map.prototype.keys) &&
2031
- // Set
2032
- typeof Set === 'function' &&
2033
- isNative(Set) &&
2034
- // Set.prototype.keys
2035
- Set.prototype != null &&
2036
- typeof Set.prototype.keys === 'function' &&
2037
- isNative(Set.prototype.keys);
2038
-
2039
- var setItem;
2040
- var getItem;
2041
- var removeItem;
2042
- var getItemIDs;
2043
- var addRoot;
2044
- var removeRoot;
2045
- var getRootIDs;
2046
-
2047
- if (canUseCollections) {
2048
- var itemMap = new Map();
2049
- var rootIDSet = new Set();
2050
-
2051
- setItem = function(id, item) {
2052
- itemMap.set(id, item);
2053
- };
2054
- getItem = function(id) {
2055
- return itemMap.get(id);
2056
- };
2057
- removeItem = function(id) {
2058
- itemMap['delete'](id);
2059
- };
2060
- getItemIDs = function() {
2061
- return Array.from(itemMap.keys());
2062
- };
2063
-
2064
- addRoot = function(id) {
2065
- rootIDSet.add(id);
2066
- };
2067
- removeRoot = function(id) {
2068
- rootIDSet['delete'](id);
2069
- };
2070
- getRootIDs = function() {
2071
- return Array.from(rootIDSet.keys());
2072
- };
2073
- } else {
2074
- var itemByKey = {};
2075
- var rootByKey = {};
2076
-
2077
- // Use non-numeric keys to prevent V8 performance issues:
2078
- // https://github.com/facebook/react/pull/7232
2079
- var getKeyFromID = function(id) {
2080
- return '.' + id;
2081
- };
2082
- var getIDFromKey = function(key) {
2083
- return parseInt(key.substr(1), 10);
2084
- };
2085
-
2086
- setItem = function(id, item) {
2087
- var key = getKeyFromID(id);
2088
- itemByKey[key] = item;
2089
- };
2090
- getItem = function(id) {
2091
- var key = getKeyFromID(id);
2092
- return itemByKey[key];
2093
- };
2094
- removeItem = function(id) {
2095
- var key = getKeyFromID(id);
2096
- delete itemByKey[key];
2097
- };
2098
- getItemIDs = function() {
2099
- return Object.keys(itemByKey).map(getIDFromKey);
2100
- };
2101
-
2102
- addRoot = function(id) {
2103
- var key = getKeyFromID(id);
2104
- rootByKey[key] = true;
2105
- };
2106
- removeRoot = function(id) {
2107
- var key = getKeyFromID(id);
2108
- delete rootByKey[key];
2109
- };
2110
- getRootIDs = function() {
2111
- return Object.keys(rootByKey).map(getIDFromKey);
2112
- };
2113
- }
2114
-
2115
- var unmountedIDs = [];
2116
-
2117
- function purgeDeep(id) {
2118
- var item = getItem(id);
2119
- if (item) {
2120
- var childIDs = item.childIDs;
2121
-
2122
- removeItem(id);
2123
- childIDs.forEach(purgeDeep);
2124
- }
2125
- }
2126
-
2127
- function getDisplayName$1(element) {
2128
- if (element == null) {
2129
- return '#empty';
2130
- } else if (typeof element === 'string' || typeof element === 'number') {
2131
- return '#text';
2132
- } else if (typeof element.type === 'string') {
2133
- return element.type;
2134
- } else {
2135
- return element.type.displayName || element.type.name || 'Unknown';
2136
- }
2137
- }
2138
-
2139
- function describeID(id) {
2140
- var name = ReactComponentTreeHook.getDisplayName(id);
2141
- var element = ReactComponentTreeHook.getElement(id);
2142
- var ownerID = ReactComponentTreeHook.getOwnerID(id);
2143
- var ownerName = void 0;
2144
-
2145
- if (ownerID) {
2146
- ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
2147
- }
2148
- warning$6(
2149
- element,
2150
- 'ReactComponentTreeHook: Missing React element for debugID %s when ' +
2151
- 'building stack',
2152
- id
2153
- );
2154
- return describeComponentFrame$1(
2155
- name || '',
2156
- element && element._source,
2157
- ownerName || ''
2158
- );
2159
- }
2160
-
2161
- var ReactComponentTreeHook = {
2162
- onSetChildren: function(id, nextChildIDs) {
2163
- var item = getItem(id);
2164
- !item ? invariant_1(false, 'Item must have been set') : void 0;
2165
- item.childIDs = nextChildIDs;
2166
-
2167
- for (var i = 0; i < nextChildIDs.length; i++) {
2168
- var nextChildID = nextChildIDs[i];
2169
- var nextChild = getItem(nextChildID);
2170
- !nextChild
2171
- ? invariant_1(
2172
- false,
2173
- 'Expected hook events to fire for the child before its parent includes it in onSetChildren().'
2174
- )
2175
- : void 0;
2176
- !(nextChild.childIDs != null ||
2177
- typeof nextChild.element !== 'object' ||
2178
- nextChild.element == null)
2179
- ? invariant_1(
2180
- false,
2181
- 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().'
2182
- )
2183
- : void 0;
2184
- !nextChild.isMounted
2185
- ? invariant_1(
2186
- false,
2187
- 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().'
2188
- )
2189
- : void 0;
2190
- if (nextChild.parentID == null) {
2191
- nextChild.parentID = id;
2192
- // TODO: This shouldn't be necessary but mounting a new root during in
2193
- // componentWillMount currently causes not-yet-mounted components to
2194
- // be purged from our tree data so their parent id is missing.
2195
- }
2196
- !(nextChild.parentID === id)
2197
- ? invariant_1(
2198
- false,
2199
- 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).',
2200
- nextChildID,
2201
- nextChild.parentID,
2202
- id
2203
- )
2204
- : void 0;
2205
- }
2206
- },
2207
- onBeforeMountComponent: function(id, element, parentID) {
2208
- var item = {
2209
- element: element,
2210
- parentID: parentID,
2211
- text: null,
2212
- childIDs: [],
2213
- isMounted: false,
2214
- updateCount: 0,
2215
- };
2216
- setItem(id, item);
2217
- },
2218
- onBeforeUpdateComponent: function(id, element) {
2219
- var item = getItem(id);
2220
- if (!item || !item.isMounted) {
2221
- // We may end up here as a result of setState() in componentWillUnmount().
2222
- // In this case, ignore the element.
2223
- return;
2224
- }
2225
- item.element = element;
2226
- },
2227
- onMountComponent: function(id) {
2228
- var item = getItem(id);
2229
- !item ? invariant_1(false, 'Item must have been set') : void 0;
2230
- item.isMounted = true;
2231
- var isRoot = item.parentID === 0;
2232
- if (isRoot) {
2233
- addRoot(id);
2234
- }
2235
- },
2236
- onUpdateComponent: function(id) {
2237
- var item = getItem(id);
2238
- if (!item || !item.isMounted) {
2239
- // We may end up here as a result of setState() in componentWillUnmount().
2240
- // In this case, ignore the element.
2241
- return;
2242
- }
2243
- item.updateCount++;
2244
- },
2245
- onUnmountComponent: function(id) {
2246
- var item = getItem(id);
2247
- if (item) {
2248
- // We need to check if it exists.
2249
- // `item` might not exist if it is inside an error boundary, and a sibling
2250
- // error boundary child threw while mounting. Then this instance never
2251
- // got a chance to mount, but it still gets an unmounting event during
2252
- // the error boundary cleanup.
2253
- item.isMounted = false;
2254
- var isRoot = item.parentID === 0;
2255
- if (isRoot) {
2256
- removeRoot(id);
2257
- }
2258
- }
2259
- unmountedIDs.push(id);
2260
- },
2261
- purgeUnmountedComponents: function() {
2262
- if (ReactComponentTreeHook._preventPurging) {
2263
- // Should only be used for testing.
2264
- return;
2265
- }
2266
-
2267
- for (var i = 0; i < unmountedIDs.length; i++) {
2268
- var id = unmountedIDs[i];
2269
- purgeDeep(id);
2270
- }
2271
- unmountedIDs.length = 0;
2272
- },
2273
- isMounted: function(id) {
2274
- var item = getItem(id);
2275
- return item ? item.isMounted : false;
2276
- },
2277
- getCurrentStackAddendum: function() {
2278
- var info = '';
2279
- var currentOwner = ReactCurrentOwner_1.current;
2280
- if (currentOwner) {
2281
- !(typeof currentOwner.tag !== 'number')
2282
- ? invariant_1(
2283
- false,
2284
- 'Fiber owners should not show up in Stack stack traces.'
2285
- )
2286
- : void 0;
2287
- if (typeof currentOwner._debugID === 'number') {
2288
- info += ReactComponentTreeHook.getStackAddendumByID(
2289
- currentOwner._debugID
2290
- );
2291
- }
2292
- }
2293
- return info;
2294
- },
2295
- getStackAddendumByID: function(id) {
2296
- var info = '';
2297
- while (id) {
2298
- info += describeID(id);
2299
- id = ReactComponentTreeHook.getParentID(id);
2300
- }
2301
- return info;
2302
- },
2303
- getChildIDs: function(id) {
2304
- var item = getItem(id);
2305
- return item ? item.childIDs : [];
2306
- },
2307
- getDisplayName: function(id) {
2308
- var element = ReactComponentTreeHook.getElement(id);
2309
- if (!element) {
2310
- return null;
2311
- }
2312
- return getDisplayName$1(element);
2313
- },
2314
- getElement: function(id) {
2315
- var item = getItem(id);
2316
- return item ? item.element : null;
2317
- },
2318
- getOwnerID: function(id) {
2319
- var element = ReactComponentTreeHook.getElement(id);
2320
- if (!element || !element._owner) {
2321
- return null;
2322
- }
2323
- return element._owner._debugID;
2324
- },
2325
- getParentID: function(id) {
2326
- var item = getItem(id);
2327
- return item ? item.parentID : null;
2328
- },
2329
- getSource: function(id) {
2330
- var item = getItem(id);
2331
- var element = item ? item.element : null;
2332
- var source = element != null ? element._source : null;
2333
- return source;
2334
- },
2335
- getText: function(id) {
2336
- var element = ReactComponentTreeHook.getElement(id);
2337
- if (typeof element === 'string') {
2338
- return element;
2339
- } else if (typeof element === 'number') {
2340
- return '' + element;
2341
- } else {
2342
- return null;
2343
- }
2344
- },
2345
- getUpdateCount: function(id) {
2346
- var item = getItem(id);
2347
- return item ? item.updateCount : 0;
2348
- },
2349
-
2350
- getRootIDs: getRootIDs,
2351
- getRegisteredIDs: getItemIDs,
2352
- };
2353
-
2354
- var ReactComponentTreeHook_1 = ReactComponentTreeHook;
2355
-
2356
- var createElement = ReactElement_1.createElement;
2357
- var createFactory = ReactElement_1.createFactory;
2358
- var cloneElement = ReactElement_1.cloneElement;
2359
-
2360
- {
2361
- var ReactElementValidator = ReactElementValidator_1;
2362
- createElement = ReactElementValidator.createElement;
2363
- createFactory = ReactElementValidator.createFactory;
2364
- cloneElement = ReactElementValidator.cloneElement;
2365
- }
2366
-
2367
- var React = {
2368
- Children: {
2369
- map: ReactChildren_1.map,
2370
- forEach: ReactChildren_1.forEach,
2371
- count: ReactChildren_1.count,
2372
- toArray: ReactChildren_1.toArray,
2373
- only: onlyChild_1,
2374
- },
2375
-
2376
- Component: ReactBaseClasses.Component,
2377
- PureComponent: ReactBaseClasses.PureComponent,
2378
- unstable_AsyncComponent: ReactBaseClasses.AsyncComponent,
2379
-
2380
- createElement: createElement,
2381
- cloneElement: cloneElement,
2382
- isValidElement: ReactElement_1.isValidElement,
2383
-
2384
- createFactory: createFactory,
2385
-
2386
- version: ReactVersion,
2387
-
2388
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
2389
- ReactCurrentOwner: ReactCurrentOwner_1,
2390
- },
2391
- };
2392
-
2393
- {
2394
- index(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
2395
- // These should not be included in production.
2396
- ReactComponentTreeHook: ReactComponentTreeHook_1,
2397
- ReactDebugCurrentFrame: ReactDebugCurrentFrame_1,
2398
- });
2399
- }
2400
-
2401
- var ReactEntry = React;
2402
-
2403
- return ReactEntry;
2404
-});
scripts/prettier/index.js
+1
-5
@@ -39,11 +39,7 @@ const config = {
39
},
40
scripts: {
41
patterns: ['scripts/**/*.js', 'fixtures/**/*.js'],
42
- ignore: [
43
- 'scripts/bench/benchmarks/**',
44
- 'fixtures/attribute-behavior/public/react.production.min.js',
45
- 'fixtures/attribute-behavior/public/react-dom.production.min.js',
46
- ],
42
+ ignore: ['scripts/bench/benchmarks/**'],
43
options: {
44
'trailing-comma': 'es5',
45
},