Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80756 views
1
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
// shim for using process in browser
3
4
var process = module.exports = {};
5
6
process.nextTick = (function () {
7
var canSetImmediate = typeof window !== 'undefined'
8
&& window.setImmediate;
9
var canPost = typeof window !== 'undefined'
10
&& window.postMessage && window.addEventListener
11
;
12
13
if (canSetImmediate) {
14
return function (f) { return window.setImmediate(f) };
15
}
16
17
if (canPost) {
18
var queue = [];
19
window.addEventListener('message', function (ev) {
20
var source = ev.source;
21
if ((source === window || source === null) && ev.data === 'process-tick') {
22
ev.stopPropagation();
23
if (queue.length > 0) {
24
var fn = queue.shift();
25
fn();
26
}
27
}
28
}, true);
29
30
return function nextTick(fn) {
31
queue.push(fn);
32
window.postMessage('process-tick', '*');
33
};
34
}
35
36
return function nextTick(fn) {
37
setTimeout(fn, 0);
38
};
39
})();
40
41
process.title = 'browser';
42
process.browser = true;
43
process.env = {};
44
process.argv = [];
45
46
function noop() {}
47
48
process.on = noop;
49
process.addListener = noop;
50
process.once = noop;
51
process.off = noop;
52
process.removeListener = noop;
53
process.removeAllListeners = noop;
54
process.emit = noop;
55
56
process.binding = function (name) {
57
throw new Error('process.binding is not supported');
58
}
59
60
// TODO(shtylman)
61
process.cwd = function () { return '/' };
62
process.chdir = function (dir) {
63
throw new Error('process.chdir is not supported');
64
};
65
66
},{}],2:[function(require,module,exports){
67
/**
68
* Copyright 2013-2015, Facebook, Inc.
69
* All rights reserved.
70
*
71
* This source code is licensed under the BSD-style license found in the
72
* LICENSE file in the root directory of this source tree. An additional grant
73
* of patent rights can be found in the PATENTS file in the same directory.
74
*
75
* @providesModule AutoFocusMixin
76
* @typechecks static-only
77
*/
78
79
'use strict';
80
81
var focusNode = require("./focusNode");
82
83
var AutoFocusMixin = {
84
componentDidMount: function() {
85
if (this.props.autoFocus) {
86
focusNode(this.getDOMNode());
87
}
88
}
89
};
90
91
module.exports = AutoFocusMixin;
92
93
94
},{"./focusNode":120}],3:[function(require,module,exports){
95
/**
96
* Copyright 2013-2015 Facebook, Inc.
97
* All rights reserved.
98
*
99
* This source code is licensed under the BSD-style license found in the
100
* LICENSE file in the root directory of this source tree. An additional grant
101
* of patent rights can be found in the PATENTS file in the same directory.
102
*
103
* @providesModule BeforeInputEventPlugin
104
* @typechecks static-only
105
*/
106
107
'use strict';
108
109
var EventConstants = require("./EventConstants");
110
var EventPropagators = require("./EventPropagators");
111
var ExecutionEnvironment = require("./ExecutionEnvironment");
112
var FallbackCompositionState = require("./FallbackCompositionState");
113
var SyntheticCompositionEvent = require("./SyntheticCompositionEvent");
114
var SyntheticInputEvent = require("./SyntheticInputEvent");
115
116
var keyOf = require("./keyOf");
117
118
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
119
var START_KEYCODE = 229;
120
121
var canUseCompositionEvent = (
122
ExecutionEnvironment.canUseDOM &&
123
'CompositionEvent' in window
124
);
125
126
var documentMode = null;
127
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
128
documentMode = document.documentMode;
129
}
130
131
// Webkit offers a very useful `textInput` event that can be used to
132
// directly represent `beforeInput`. The IE `textinput` event is not as
133
// useful, so we don't use it.
134
var canUseTextInputEvent = (
135
ExecutionEnvironment.canUseDOM &&
136
'TextEvent' in window &&
137
!documentMode &&
138
!isPresto()
139
);
140
141
// In IE9+, we have access to composition events, but the data supplied
142
// by the native compositionend event may be incorrect. Japanese ideographic
143
// spaces, for instance (\u3000) are not recorded correctly.
144
var useFallbackCompositionData = (
145
ExecutionEnvironment.canUseDOM &&
146
(
147
(!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
148
)
149
);
150
151
/**
152
* Opera <= 12 includes TextEvent in window, but does not fire
153
* text input events. Rely on keypress instead.
154
*/
155
function isPresto() {
156
var opera = window.opera;
157
return (
158
typeof opera === 'object' &&
159
typeof opera.version === 'function' &&
160
parseInt(opera.version(), 10) <= 12
161
);
162
}
163
164
var SPACEBAR_CODE = 32;
165
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
166
167
var topLevelTypes = EventConstants.topLevelTypes;
168
169
// Events and their corresponding property names.
170
var eventTypes = {
171
beforeInput: {
172
phasedRegistrationNames: {
173
bubbled: keyOf({onBeforeInput: null}),
174
captured: keyOf({onBeforeInputCapture: null})
175
},
176
dependencies: [
177
topLevelTypes.topCompositionEnd,
178
topLevelTypes.topKeyPress,
179
topLevelTypes.topTextInput,
180
topLevelTypes.topPaste
181
]
182
},
183
compositionEnd: {
184
phasedRegistrationNames: {
185
bubbled: keyOf({onCompositionEnd: null}),
186
captured: keyOf({onCompositionEndCapture: null})
187
},
188
dependencies: [
189
topLevelTypes.topBlur,
190
topLevelTypes.topCompositionEnd,
191
topLevelTypes.topKeyDown,
192
topLevelTypes.topKeyPress,
193
topLevelTypes.topKeyUp,
194
topLevelTypes.topMouseDown
195
]
196
},
197
compositionStart: {
198
phasedRegistrationNames: {
199
bubbled: keyOf({onCompositionStart: null}),
200
captured: keyOf({onCompositionStartCapture: null})
201
},
202
dependencies: [
203
topLevelTypes.topBlur,
204
topLevelTypes.topCompositionStart,
205
topLevelTypes.topKeyDown,
206
topLevelTypes.topKeyPress,
207
topLevelTypes.topKeyUp,
208
topLevelTypes.topMouseDown
209
]
210
},
211
compositionUpdate: {
212
phasedRegistrationNames: {
213
bubbled: keyOf({onCompositionUpdate: null}),
214
captured: keyOf({onCompositionUpdateCapture: null})
215
},
216
dependencies: [
217
topLevelTypes.topBlur,
218
topLevelTypes.topCompositionUpdate,
219
topLevelTypes.topKeyDown,
220
topLevelTypes.topKeyPress,
221
topLevelTypes.topKeyUp,
222
topLevelTypes.topMouseDown
223
]
224
}
225
};
226
227
// Track whether we've ever handled a keypress on the space key.
228
var hasSpaceKeypress = false;
229
230
/**
231
* Return whether a native keypress event is assumed to be a command.
232
* This is required because Firefox fires `keypress` events for key commands
233
* (cut, copy, select-all, etc.) even though no character is inserted.
234
*/
235
function isKeypressCommand(nativeEvent) {
236
return (
237
(nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
238
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
239
!(nativeEvent.ctrlKey && nativeEvent.altKey)
240
);
241
}
242
243
244
/**
245
* Translate native top level events into event types.
246
*
247
* @param {string} topLevelType
248
* @return {object}
249
*/
250
function getCompositionEventType(topLevelType) {
251
switch (topLevelType) {
252
case topLevelTypes.topCompositionStart:
253
return eventTypes.compositionStart;
254
case topLevelTypes.topCompositionEnd:
255
return eventTypes.compositionEnd;
256
case topLevelTypes.topCompositionUpdate:
257
return eventTypes.compositionUpdate;
258
}
259
}
260
261
/**
262
* Does our fallback best-guess model think this event signifies that
263
* composition has begun?
264
*
265
* @param {string} topLevelType
266
* @param {object} nativeEvent
267
* @return {boolean}
268
*/
269
function isFallbackCompositionStart(topLevelType, nativeEvent) {
270
return (
271
topLevelType === topLevelTypes.topKeyDown &&
272
nativeEvent.keyCode === START_KEYCODE
273
);
274
}
275
276
/**
277
* Does our fallback mode think that this event is the end of composition?
278
*
279
* @param {string} topLevelType
280
* @param {object} nativeEvent
281
* @return {boolean}
282
*/
283
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
284
switch (topLevelType) {
285
case topLevelTypes.topKeyUp:
286
// Command keys insert or clear IME input.
287
return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
288
case topLevelTypes.topKeyDown:
289
// Expect IME keyCode on each keydown. If we get any other
290
// code we must have exited earlier.
291
return (nativeEvent.keyCode !== START_KEYCODE);
292
case topLevelTypes.topKeyPress:
293
case topLevelTypes.topMouseDown:
294
case topLevelTypes.topBlur:
295
// Events are not possible without cancelling IME.
296
return true;
297
default:
298
return false;
299
}
300
}
301
302
/**
303
* Google Input Tools provides composition data via a CustomEvent,
304
* with the `data` property populated in the `detail` object. If this
305
* is available on the event object, use it. If not, this is a plain
306
* composition event and we have nothing special to extract.
307
*
308
* @param {object} nativeEvent
309
* @return {?string}
310
*/
311
function getDataFromCustomEvent(nativeEvent) {
312
var detail = nativeEvent.detail;
313
if (typeof detail === 'object' && 'data' in detail) {
314
return detail.data;
315
}
316
return null;
317
}
318
319
// Track the current IME composition fallback object, if any.
320
var currentComposition = null;
321
322
/**
323
* @param {string} topLevelType Record from `EventConstants`.
324
* @param {DOMEventTarget} topLevelTarget The listening component root node.
325
* @param {string} topLevelTargetID ID of `topLevelTarget`.
326
* @param {object} nativeEvent Native browser event.
327
* @return {?object} A SyntheticCompositionEvent.
328
*/
329
function extractCompositionEvent(
330
topLevelType,
331
topLevelTarget,
332
topLevelTargetID,
333
nativeEvent
334
) {
335
var eventType;
336
var fallbackData;
337
338
if (canUseCompositionEvent) {
339
eventType = getCompositionEventType(topLevelType);
340
} else if (!currentComposition) {
341
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
342
eventType = eventTypes.compositionStart;
343
}
344
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
345
eventType = eventTypes.compositionEnd;
346
}
347
348
if (!eventType) {
349
return null;
350
}
351
352
if (useFallbackCompositionData) {
353
// The current composition is stored statically and must not be
354
// overwritten while composition continues.
355
if (!currentComposition && eventType === eventTypes.compositionStart) {
356
currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
357
} else if (eventType === eventTypes.compositionEnd) {
358
if (currentComposition) {
359
fallbackData = currentComposition.getData();
360
}
361
}
362
}
363
364
var event = SyntheticCompositionEvent.getPooled(
365
eventType,
366
topLevelTargetID,
367
nativeEvent
368
);
369
370
if (fallbackData) {
371
// Inject data generated from fallback path into the synthetic event.
372
// This matches the property of native CompositionEventInterface.
373
event.data = fallbackData;
374
} else {
375
var customData = getDataFromCustomEvent(nativeEvent);
376
if (customData !== null) {
377
event.data = customData;
378
}
379
}
380
381
EventPropagators.accumulateTwoPhaseDispatches(event);
382
return event;
383
}
384
385
/**
386
* @param {string} topLevelType Record from `EventConstants`.
387
* @param {object} nativeEvent Native browser event.
388
* @return {?string} The string corresponding to this `beforeInput` event.
389
*/
390
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
391
switch (topLevelType) {
392
case topLevelTypes.topCompositionEnd:
393
return getDataFromCustomEvent(nativeEvent);
394
case topLevelTypes.topKeyPress:
395
/**
396
* If native `textInput` events are available, our goal is to make
397
* use of them. However, there is a special case: the spacebar key.
398
* In Webkit, preventing default on a spacebar `textInput` event
399
* cancels character insertion, but it *also* causes the browser
400
* to fall back to its default spacebar behavior of scrolling the
401
* page.
402
*
403
* Tracking at:
404
* https://code.google.com/p/chromium/issues/detail?id=355103
405
*
406
* To avoid this issue, use the keypress event as if no `textInput`
407
* event is available.
408
*/
409
var which = nativeEvent.which;
410
if (which !== SPACEBAR_CODE) {
411
return null;
412
}
413
414
hasSpaceKeypress = true;
415
return SPACEBAR_CHAR;
416
417
case topLevelTypes.topTextInput:
418
// Record the characters to be added to the DOM.
419
var chars = nativeEvent.data;
420
421
// If it's a spacebar character, assume that we have already handled
422
// it at the keypress level and bail immediately. Android Chrome
423
// doesn't give us keycodes, so we need to blacklist it.
424
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
425
return null;
426
}
427
428
return chars;
429
430
default:
431
// For other native event types, do nothing.
432
return null;
433
}
434
}
435
436
/**
437
* For browsers that do not provide the `textInput` event, extract the
438
* appropriate string to use for SyntheticInputEvent.
439
*
440
* @param {string} topLevelType Record from `EventConstants`.
441
* @param {object} nativeEvent Native browser event.
442
* @return {?string} The fallback string for this `beforeInput` event.
443
*/
444
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
445
// If we are currently composing (IME) and using a fallback to do so,
446
// try to extract the composed characters from the fallback object.
447
if (currentComposition) {
448
if (
449
topLevelType === topLevelTypes.topCompositionEnd ||
450
isFallbackCompositionEnd(topLevelType, nativeEvent)
451
) {
452
var chars = currentComposition.getData();
453
FallbackCompositionState.release(currentComposition);
454
currentComposition = null;
455
return chars;
456
}
457
return null;
458
}
459
460
switch (topLevelType) {
461
case topLevelTypes.topPaste:
462
// If a paste event occurs after a keypress, throw out the input
463
// chars. Paste events should not lead to BeforeInput events.
464
return null;
465
case topLevelTypes.topKeyPress:
466
/**
467
* As of v27, Firefox may fire keypress events even when no character
468
* will be inserted. A few possibilities:
469
*
470
* - `which` is `0`. Arrow keys, Esc key, etc.
471
*
472
* - `which` is the pressed key code, but no char is available.
473
* Ex: 'AltGr + d` in Polish. There is no modified character for
474
* this key combination and no character is inserted into the
475
* document, but FF fires the keypress for char code `100` anyway.
476
* No `input` event will occur.
477
*
478
* - `which` is the pressed key code, but a command combination is
479
* being used. Ex: `Cmd+C`. No character is inserted, and no
480
* `input` event will occur.
481
*/
482
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
483
return String.fromCharCode(nativeEvent.which);
484
}
485
return null;
486
case topLevelTypes.topCompositionEnd:
487
return useFallbackCompositionData ? null : nativeEvent.data;
488
default:
489
return null;
490
}
491
}
492
493
/**
494
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
495
* `textInput` or fallback behavior.
496
*
497
* @param {string} topLevelType Record from `EventConstants`.
498
* @param {DOMEventTarget} topLevelTarget The listening component root node.
499
* @param {string} topLevelTargetID ID of `topLevelTarget`.
500
* @param {object} nativeEvent Native browser event.
501
* @return {?object} A SyntheticInputEvent.
502
*/
503
function extractBeforeInputEvent(
504
topLevelType,
505
topLevelTarget,
506
topLevelTargetID,
507
nativeEvent
508
) {
509
var chars;
510
511
if (canUseTextInputEvent) {
512
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
513
} else {
514
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
515
}
516
517
// If no characters are being inserted, no BeforeInput event should
518
// be fired.
519
if (!chars) {
520
return null;
521
}
522
523
var event = SyntheticInputEvent.getPooled(
524
eventTypes.beforeInput,
525
topLevelTargetID,
526
nativeEvent
527
);
528
529
event.data = chars;
530
EventPropagators.accumulateTwoPhaseDispatches(event);
531
return event;
532
}
533
534
/**
535
* Create an `onBeforeInput` event to match
536
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
537
*
538
* This event plugin is based on the native `textInput` event
539
* available in Chrome, Safari, Opera, and IE. This event fires after
540
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
541
*
542
* `beforeInput` is spec'd but not implemented in any browsers, and
543
* the `input` event does not provide any useful information about what has
544
* actually been added, contrary to the spec. Thus, `textInput` is the best
545
* available event to identify the characters that have actually been inserted
546
* into the target node.
547
*
548
* This plugin is also responsible for emitting `composition` events, thus
549
* allowing us to share composition fallback code for both `beforeInput` and
550
* `composition` event types.
551
*/
552
var BeforeInputEventPlugin = {
553
554
eventTypes: eventTypes,
555
556
/**
557
* @param {string} topLevelType Record from `EventConstants`.
558
* @param {DOMEventTarget} topLevelTarget The listening component root node.
559
* @param {string} topLevelTargetID ID of `topLevelTarget`.
560
* @param {object} nativeEvent Native browser event.
561
* @return {*} An accumulation of synthetic events.
562
* @see {EventPluginHub.extractEvents}
563
*/
564
extractEvents: function(
565
topLevelType,
566
topLevelTarget,
567
topLevelTargetID,
568
nativeEvent
569
) {
570
return [
571
extractCompositionEvent(
572
topLevelType,
573
topLevelTarget,
574
topLevelTargetID,
575
nativeEvent
576
),
577
extractBeforeInputEvent(
578
topLevelType,
579
topLevelTarget,
580
topLevelTargetID,
581
nativeEvent
582
)
583
];
584
}
585
};
586
587
module.exports = BeforeInputEventPlugin;
588
589
590
},{"./EventConstants":15,"./EventPropagators":20,"./ExecutionEnvironment":21,"./FallbackCompositionState":22,"./SyntheticCompositionEvent":94,"./SyntheticInputEvent":98,"./keyOf":142}],4:[function(require,module,exports){
591
/**
592
* Copyright 2013-2015, Facebook, Inc.
593
* All rights reserved.
594
*
595
* This source code is licensed under the BSD-style license found in the
596
* LICENSE file in the root directory of this source tree. An additional grant
597
* of patent rights can be found in the PATENTS file in the same directory.
598
*
599
* @providesModule CSSProperty
600
*/
601
602
'use strict';
603
604
/**
605
* CSS properties which accept numbers but are not in units of "px".
606
*/
607
var isUnitlessNumber = {
608
boxFlex: true,
609
boxFlexGroup: true,
610
columnCount: true,
611
flex: true,
612
flexGrow: true,
613
flexShrink: true,
614
fontWeight: true,
615
lineClamp: true,
616
lineHeight: true,
617
opacity: true,
618
order: true,
619
orphans: true,
620
widows: true,
621
zIndex: true,
622
zoom: true,
623
624
// SVG-related properties
625
fillOpacity: true,
626
strokeOpacity: true
627
};
628
629
/**
630
* @param {string} prefix vendor-specific prefix, eg: Webkit
631
* @param {string} key style name, eg: transitionDuration
632
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
633
* WebkitTransitionDuration
634
*/
635
function prefixKey(prefix, key) {
636
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
637
}
638
639
/**
640
* Support style names that may come passed in prefixed by adding permutations
641
* of vendor prefixes.
642
*/
643
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
644
645
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
646
// infinite loop, because it iterates over the newly added props too.
647
Object.keys(isUnitlessNumber).forEach(function(prop) {
648
prefixes.forEach(function(prefix) {
649
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
650
});
651
});
652
653
/**
654
* Most style properties can be unset by doing .style[prop] = '' but IE8
655
* doesn't like doing that with shorthand properties so for the properties that
656
* IE8 breaks on, which are listed here, we instead unset each of the
657
* individual properties. See http://bugs.jquery.com/ticket/12385.
658
* The 4-value 'clock' properties like margin, padding, border-width seem to
659
* behave without any problems. Curiously, list-style works too without any
660
* special prodding.
661
*/
662
var shorthandPropertyExpansions = {
663
background: {
664
backgroundImage: true,
665
backgroundPosition: true,
666
backgroundRepeat: true,
667
backgroundColor: true
668
},
669
border: {
670
borderWidth: true,
671
borderStyle: true,
672
borderColor: true
673
},
674
borderBottom: {
675
borderBottomWidth: true,
676
borderBottomStyle: true,
677
borderBottomColor: true
678
},
679
borderLeft: {
680
borderLeftWidth: true,
681
borderLeftStyle: true,
682
borderLeftColor: true
683
},
684
borderRight: {
685
borderRightWidth: true,
686
borderRightStyle: true,
687
borderRightColor: true
688
},
689
borderTop: {
690
borderTopWidth: true,
691
borderTopStyle: true,
692
borderTopColor: true
693
},
694
font: {
695
fontStyle: true,
696
fontVariant: true,
697
fontWeight: true,
698
fontSize: true,
699
lineHeight: true,
700
fontFamily: true
701
}
702
};
703
704
var CSSProperty = {
705
isUnitlessNumber: isUnitlessNumber,
706
shorthandPropertyExpansions: shorthandPropertyExpansions
707
};
708
709
module.exports = CSSProperty;
710
711
712
},{}],5:[function(require,module,exports){
713
(function (process){
714
/**
715
* Copyright 2013-2015, Facebook, Inc.
716
* All rights reserved.
717
*
718
* This source code is licensed under the BSD-style license found in the
719
* LICENSE file in the root directory of this source tree. An additional grant
720
* of patent rights can be found in the PATENTS file in the same directory.
721
*
722
* @providesModule CSSPropertyOperations
723
* @typechecks static-only
724
*/
725
726
'use strict';
727
728
var CSSProperty = require("./CSSProperty");
729
var ExecutionEnvironment = require("./ExecutionEnvironment");
730
731
var camelizeStyleName = require("./camelizeStyleName");
732
var dangerousStyleValue = require("./dangerousStyleValue");
733
var hyphenateStyleName = require("./hyphenateStyleName");
734
var memoizeStringOnly = require("./memoizeStringOnly");
735
var warning = require("./warning");
736
737
var processStyleName = memoizeStringOnly(function(styleName) {
738
return hyphenateStyleName(styleName);
739
});
740
741
var styleFloatAccessor = 'cssFloat';
742
if (ExecutionEnvironment.canUseDOM) {
743
// IE8 only supports accessing cssFloat (standard) as styleFloat
744
if (document.documentElement.style.cssFloat === undefined) {
745
styleFloatAccessor = 'styleFloat';
746
}
747
}
748
749
if ("production" !== process.env.NODE_ENV) {
750
// 'msTransform' is correct, but the other prefixes should be capitalized
751
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
752
753
// style values shouldn't contain a semicolon
754
var badStyleValueWithSemicolonPattern = /;\s*$/;
755
756
var warnedStyleNames = {};
757
var warnedStyleValues = {};
758
759
var warnHyphenatedStyleName = function(name) {
760
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
761
return;
762
}
763
764
warnedStyleNames[name] = true;
765
("production" !== process.env.NODE_ENV ? warning(
766
false,
767
'Unsupported style property %s. Did you mean %s?',
768
name,
769
camelizeStyleName(name)
770
) : null);
771
};
772
773
var warnBadVendoredStyleName = function(name) {
774
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
775
return;
776
}
777
778
warnedStyleNames[name] = true;
779
("production" !== process.env.NODE_ENV ? warning(
780
false,
781
'Unsupported vendor-prefixed style property %s. Did you mean %s?',
782
name,
783
name.charAt(0).toUpperCase() + name.slice(1)
784
) : null);
785
};
786
787
var warnStyleValueWithSemicolon = function(name, value) {
788
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
789
return;
790
}
791
792
warnedStyleValues[value] = true;
793
("production" !== process.env.NODE_ENV ? warning(
794
false,
795
'Style property values shouldn\'t contain a semicolon. ' +
796
'Try "%s: %s" instead.',
797
name,
798
value.replace(badStyleValueWithSemicolonPattern, '')
799
) : null);
800
};
801
802
/**
803
* @param {string} name
804
* @param {*} value
805
*/
806
var warnValidStyle = function(name, value) {
807
if (name.indexOf('-') > -1) {
808
warnHyphenatedStyleName(name);
809
} else if (badVendoredStyleNamePattern.test(name)) {
810
warnBadVendoredStyleName(name);
811
} else if (badStyleValueWithSemicolonPattern.test(value)) {
812
warnStyleValueWithSemicolon(name, value);
813
}
814
};
815
}
816
817
/**
818
* Operations for dealing with CSS properties.
819
*/
820
var CSSPropertyOperations = {
821
822
/**
823
* Serializes a mapping of style properties for use as inline styles:
824
*
825
* > createMarkupForStyles({width: '200px', height: 0})
826
* "width:200px;height:0;"
827
*
828
* Undefined values are ignored so that declarative programming is easier.
829
* The result should be HTML-escaped before insertion into the DOM.
830
*
831
* @param {object} styles
832
* @return {?string}
833
*/
834
createMarkupForStyles: function(styles) {
835
var serialized = '';
836
for (var styleName in styles) {
837
if (!styles.hasOwnProperty(styleName)) {
838
continue;
839
}
840
var styleValue = styles[styleName];
841
if ("production" !== process.env.NODE_ENV) {
842
warnValidStyle(styleName, styleValue);
843
}
844
if (styleValue != null) {
845
serialized += processStyleName(styleName) + ':';
846
serialized += dangerousStyleValue(styleName, styleValue) + ';';
847
}
848
}
849
return serialized || null;
850
},
851
852
/**
853
* Sets the value for multiple styles on a node. If a value is specified as
854
* '' (empty string), the corresponding style property will be unset.
855
*
856
* @param {DOMElement} node
857
* @param {object} styles
858
*/
859
setValueForStyles: function(node, styles) {
860
var style = node.style;
861
for (var styleName in styles) {
862
if (!styles.hasOwnProperty(styleName)) {
863
continue;
864
}
865
if ("production" !== process.env.NODE_ENV) {
866
warnValidStyle(styleName, styles[styleName]);
867
}
868
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
869
if (styleName === 'float') {
870
styleName = styleFloatAccessor;
871
}
872
if (styleValue) {
873
style[styleName] = styleValue;
874
} else {
875
var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
876
if (expansion) {
877
// Shorthand property that IE8 won't like unsetting, so unset each
878
// component to placate it
879
for (var individualStyleName in expansion) {
880
style[individualStyleName] = '';
881
}
882
} else {
883
style[styleName] = '';
884
}
885
}
886
}
887
}
888
889
};
890
891
module.exports = CSSPropertyOperations;
892
893
894
}).call(this,require("FWaASH"))
895
},{"./CSSProperty":4,"./ExecutionEnvironment":21,"./camelizeStyleName":109,"./dangerousStyleValue":114,"./hyphenateStyleName":134,"./memoizeStringOnly":144,"./warning":155,"FWaASH":1}],6:[function(require,module,exports){
896
(function (process){
897
/**
898
* Copyright 2013-2015, Facebook, Inc.
899
* All rights reserved.
900
*
901
* This source code is licensed under the BSD-style license found in the
902
* LICENSE file in the root directory of this source tree. An additional grant
903
* of patent rights can be found in the PATENTS file in the same directory.
904
*
905
* @providesModule CallbackQueue
906
*/
907
908
'use strict';
909
910
var PooledClass = require("./PooledClass");
911
912
var assign = require("./Object.assign");
913
var invariant = require("./invariant");
914
915
/**
916
* A specialized pseudo-event module to help keep track of components waiting to
917
* be notified when their DOM representations are available for use.
918
*
919
* This implements `PooledClass`, so you should never need to instantiate this.
920
* Instead, use `CallbackQueue.getPooled()`.
921
*
922
* @class ReactMountReady
923
* @implements PooledClass
924
* @internal
925
*/
926
function CallbackQueue() {
927
this._callbacks = null;
928
this._contexts = null;
929
}
930
931
assign(CallbackQueue.prototype, {
932
933
/**
934
* Enqueues a callback to be invoked when `notifyAll` is invoked.
935
*
936
* @param {function} callback Invoked when `notifyAll` is invoked.
937
* @param {?object} context Context to call `callback` with.
938
* @internal
939
*/
940
enqueue: function(callback, context) {
941
this._callbacks = this._callbacks || [];
942
this._contexts = this._contexts || [];
943
this._callbacks.push(callback);
944
this._contexts.push(context);
945
},
946
947
/**
948
* Invokes all enqueued callbacks and clears the queue. This is invoked after
949
* the DOM representation of a component has been created or updated.
950
*
951
* @internal
952
*/
953
notifyAll: function() {
954
var callbacks = this._callbacks;
955
var contexts = this._contexts;
956
if (callbacks) {
957
("production" !== process.env.NODE_ENV ? invariant(
958
callbacks.length === contexts.length,
959
'Mismatched list of contexts in callback queue'
960
) : invariant(callbacks.length === contexts.length));
961
this._callbacks = null;
962
this._contexts = null;
963
for (var i = 0, l = callbacks.length; i < l; i++) {
964
callbacks[i].call(contexts[i]);
965
}
966
callbacks.length = 0;
967
contexts.length = 0;
968
}
969
},
970
971
/**
972
* Resets the internal queue.
973
*
974
* @internal
975
*/
976
reset: function() {
977
this._callbacks = null;
978
this._contexts = null;
979
},
980
981
/**
982
* `PooledClass` looks for this.
983
*/
984
destructor: function() {
985
this.reset();
986
}
987
988
});
989
990
PooledClass.addPoolingTo(CallbackQueue);
991
992
module.exports = CallbackQueue;
993
994
995
}).call(this,require("FWaASH"))
996
},{"./Object.assign":27,"./PooledClass":28,"./invariant":136,"FWaASH":1}],7:[function(require,module,exports){
997
/**
998
* Copyright 2013-2015, Facebook, Inc.
999
* All rights reserved.
1000
*
1001
* This source code is licensed under the BSD-style license found in the
1002
* LICENSE file in the root directory of this source tree. An additional grant
1003
* of patent rights can be found in the PATENTS file in the same directory.
1004
*
1005
* @providesModule ChangeEventPlugin
1006
*/
1007
1008
'use strict';
1009
1010
var EventConstants = require("./EventConstants");
1011
var EventPluginHub = require("./EventPluginHub");
1012
var EventPropagators = require("./EventPropagators");
1013
var ExecutionEnvironment = require("./ExecutionEnvironment");
1014
var ReactUpdates = require("./ReactUpdates");
1015
var SyntheticEvent = require("./SyntheticEvent");
1016
1017
var isEventSupported = require("./isEventSupported");
1018
var isTextInputElement = require("./isTextInputElement");
1019
var keyOf = require("./keyOf");
1020
1021
var topLevelTypes = EventConstants.topLevelTypes;
1022
1023
var eventTypes = {
1024
change: {
1025
phasedRegistrationNames: {
1026
bubbled: keyOf({onChange: null}),
1027
captured: keyOf({onChangeCapture: null})
1028
},
1029
dependencies: [
1030
topLevelTypes.topBlur,
1031
topLevelTypes.topChange,
1032
topLevelTypes.topClick,
1033
topLevelTypes.topFocus,
1034
topLevelTypes.topInput,
1035
topLevelTypes.topKeyDown,
1036
topLevelTypes.topKeyUp,
1037
topLevelTypes.topSelectionChange
1038
]
1039
}
1040
};
1041
1042
/**
1043
* For IE shims
1044
*/
1045
var activeElement = null;
1046
var activeElementID = null;
1047
var activeElementValue = null;
1048
var activeElementValueProp = null;
1049
1050
/**
1051
* SECTION: handle `change` event
1052
*/
1053
function shouldUseChangeEvent(elem) {
1054
return (
1055
elem.nodeName === 'SELECT' ||
1056
(elem.nodeName === 'INPUT' && elem.type === 'file')
1057
);
1058
}
1059
1060
var doesChangeEventBubble = false;
1061
if (ExecutionEnvironment.canUseDOM) {
1062
// See `handleChange` comment below
1063
doesChangeEventBubble = isEventSupported('change') && (
1064
(!('documentMode' in document) || document.documentMode > 8)
1065
);
1066
}
1067
1068
function manualDispatchChangeEvent(nativeEvent) {
1069
var event = SyntheticEvent.getPooled(
1070
eventTypes.change,
1071
activeElementID,
1072
nativeEvent
1073
);
1074
EventPropagators.accumulateTwoPhaseDispatches(event);
1075
1076
// If change and propertychange bubbled, we'd just bind to it like all the
1077
// other events and have it go through ReactBrowserEventEmitter. Since it
1078
// doesn't, we manually listen for the events and so we have to enqueue and
1079
// process the abstract event manually.
1080
//
1081
// Batching is necessary here in order to ensure that all event handlers run
1082
// before the next rerender (including event handlers attached to ancestor
1083
// elements instead of directly on the input). Without this, controlled
1084
// components don't work properly in conjunction with event bubbling because
1085
// the component is rerendered and the value reverted before all the event
1086
// handlers can run. See https://github.com/facebook/react/issues/708.
1087
ReactUpdates.batchedUpdates(runEventInBatch, event);
1088
}
1089
1090
function runEventInBatch(event) {
1091
EventPluginHub.enqueueEvents(event);
1092
EventPluginHub.processEventQueue();
1093
}
1094
1095
function startWatchingForChangeEventIE8(target, targetID) {
1096
activeElement = target;
1097
activeElementID = targetID;
1098
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
1099
}
1100
1101
function stopWatchingForChangeEventIE8() {
1102
if (!activeElement) {
1103
return;
1104
}
1105
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
1106
activeElement = null;
1107
activeElementID = null;
1108
}
1109
1110
function getTargetIDForChangeEvent(
1111
topLevelType,
1112
topLevelTarget,
1113
topLevelTargetID) {
1114
if (topLevelType === topLevelTypes.topChange) {
1115
return topLevelTargetID;
1116
}
1117
}
1118
function handleEventsForChangeEventIE8(
1119
topLevelType,
1120
topLevelTarget,
1121
topLevelTargetID) {
1122
if (topLevelType === topLevelTypes.topFocus) {
1123
// stopWatching() should be a noop here but we call it just in case we
1124
// missed a blur event somehow.
1125
stopWatchingForChangeEventIE8();
1126
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
1127
} else if (topLevelType === topLevelTypes.topBlur) {
1128
stopWatchingForChangeEventIE8();
1129
}
1130
}
1131
1132
1133
/**
1134
* SECTION: handle `input` event
1135
*/
1136
var isInputEventSupported = false;
1137
if (ExecutionEnvironment.canUseDOM) {
1138
// IE9 claims to support the input event but fails to trigger it when
1139
// deleting text, so we ignore its input events
1140
isInputEventSupported = isEventSupported('input') && (
1141
(!('documentMode' in document) || document.documentMode > 9)
1142
);
1143
}
1144
1145
/**
1146
* (For old IE.) Replacement getter/setter for the `value` property that gets
1147
* set on the active element.
1148
*/
1149
var newValueProp = {
1150
get: function() {
1151
return activeElementValueProp.get.call(this);
1152
},
1153
set: function(val) {
1154
// Cast to a string so we can do equality checks.
1155
activeElementValue = '' + val;
1156
activeElementValueProp.set.call(this, val);
1157
}
1158
};
1159
1160
/**
1161
* (For old IE.) Starts tracking propertychange events on the passed-in element
1162
* and override the value property so that we can distinguish user events from
1163
* value changes in JS.
1164
*/
1165
function startWatchingForValueChange(target, targetID) {
1166
activeElement = target;
1167
activeElementID = targetID;
1168
activeElementValue = target.value;
1169
activeElementValueProp = Object.getOwnPropertyDescriptor(
1170
target.constructor.prototype,
1171
'value'
1172
);
1173
1174
Object.defineProperty(activeElement, 'value', newValueProp);
1175
activeElement.attachEvent('onpropertychange', handlePropertyChange);
1176
}
1177
1178
/**
1179
* (For old IE.) Removes the event listeners from the currently-tracked element,
1180
* if any exists.
1181
*/
1182
function stopWatchingForValueChange() {
1183
if (!activeElement) {
1184
return;
1185
}
1186
1187
// delete restores the original property definition
1188
delete activeElement.value;
1189
activeElement.detachEvent('onpropertychange', handlePropertyChange);
1190
1191
activeElement = null;
1192
activeElementID = null;
1193
activeElementValue = null;
1194
activeElementValueProp = null;
1195
}
1196
1197
/**
1198
* (For old IE.) Handles a propertychange event, sending a `change` event if
1199
* the value of the active element has changed.
1200
*/
1201
function handlePropertyChange(nativeEvent) {
1202
if (nativeEvent.propertyName !== 'value') {
1203
return;
1204
}
1205
var value = nativeEvent.srcElement.value;
1206
if (value === activeElementValue) {
1207
return;
1208
}
1209
activeElementValue = value;
1210
1211
manualDispatchChangeEvent(nativeEvent);
1212
}
1213
1214
/**
1215
* If a `change` event should be fired, returns the target's ID.
1216
*/
1217
function getTargetIDForInputEvent(
1218
topLevelType,
1219
topLevelTarget,
1220
topLevelTargetID) {
1221
if (topLevelType === topLevelTypes.topInput) {
1222
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
1223
// what we want so fall through here and trigger an abstract event
1224
return topLevelTargetID;
1225
}
1226
}
1227
1228
// For IE8 and IE9.
1229
function handleEventsForInputEventIE(
1230
topLevelType,
1231
topLevelTarget,
1232
topLevelTargetID) {
1233
if (topLevelType === topLevelTypes.topFocus) {
1234
// In IE8, we can capture almost all .value changes by adding a
1235
// propertychange handler and looking for events with propertyName
1236
// equal to 'value'
1237
// In IE9, propertychange fires for most input events but is buggy and
1238
// doesn't fire when text is deleted, but conveniently, selectionchange
1239
// appears to fire in all of the remaining cases so we catch those and
1240
// forward the event if the value has changed
1241
// In either case, we don't want to call the event handler if the value
1242
// is changed from JS so we redefine a setter for `.value` that updates
1243
// our activeElementValue variable, allowing us to ignore those changes
1244
//
1245
// stopWatching() should be a noop here but we call it just in case we
1246
// missed a blur event somehow.
1247
stopWatchingForValueChange();
1248
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
1249
} else if (topLevelType === topLevelTypes.topBlur) {
1250
stopWatchingForValueChange();
1251
}
1252
}
1253
1254
// For IE8 and IE9.
1255
function getTargetIDForInputEventIE(
1256
topLevelType,
1257
topLevelTarget,
1258
topLevelTargetID) {
1259
if (topLevelType === topLevelTypes.topSelectionChange ||
1260
topLevelType === topLevelTypes.topKeyUp ||
1261
topLevelType === topLevelTypes.topKeyDown) {
1262
// On the selectionchange event, the target is just document which isn't
1263
// helpful for us so just check activeElement instead.
1264
//
1265
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
1266
// propertychange on the first input event after setting `value` from a
1267
// script and fires only keydown, keypress, keyup. Catching keyup usually
1268
// gets it and catching keydown lets us fire an event for the first
1269
// keystroke if user does a key repeat (it'll be a little delayed: right
1270
// before the second keystroke). Other input methods (e.g., paste) seem to
1271
// fire selectionchange normally.
1272
if (activeElement && activeElement.value !== activeElementValue) {
1273
activeElementValue = activeElement.value;
1274
return activeElementID;
1275
}
1276
}
1277
}
1278
1279
1280
/**
1281
* SECTION: handle `click` event
1282
*/
1283
function shouldUseClickEvent(elem) {
1284
// Use the `click` event to detect changes to checkbox and radio inputs.
1285
// This approach works across all browsers, whereas `change` does not fire
1286
// until `blur` in IE8.
1287
return (
1288
elem.nodeName === 'INPUT' &&
1289
(elem.type === 'checkbox' || elem.type === 'radio')
1290
);
1291
}
1292
1293
function getTargetIDForClickEvent(
1294
topLevelType,
1295
topLevelTarget,
1296
topLevelTargetID) {
1297
if (topLevelType === topLevelTypes.topClick) {
1298
return topLevelTargetID;
1299
}
1300
}
1301
1302
/**
1303
* This plugin creates an `onChange` event that normalizes change events
1304
* across form elements. This event fires at a time when it's possible to
1305
* change the element's value without seeing a flicker.
1306
*
1307
* Supported elements are:
1308
* - input (see `isTextInputElement`)
1309
* - textarea
1310
* - select
1311
*/
1312
var ChangeEventPlugin = {
1313
1314
eventTypes: eventTypes,
1315
1316
/**
1317
* @param {string} topLevelType Record from `EventConstants`.
1318
* @param {DOMEventTarget} topLevelTarget The listening component root node.
1319
* @param {string} topLevelTargetID ID of `topLevelTarget`.
1320
* @param {object} nativeEvent Native browser event.
1321
* @return {*} An accumulation of synthetic events.
1322
* @see {EventPluginHub.extractEvents}
1323
*/
1324
extractEvents: function(
1325
topLevelType,
1326
topLevelTarget,
1327
topLevelTargetID,
1328
nativeEvent) {
1329
1330
var getTargetIDFunc, handleEventFunc;
1331
if (shouldUseChangeEvent(topLevelTarget)) {
1332
if (doesChangeEventBubble) {
1333
getTargetIDFunc = getTargetIDForChangeEvent;
1334
} else {
1335
handleEventFunc = handleEventsForChangeEventIE8;
1336
}
1337
} else if (isTextInputElement(topLevelTarget)) {
1338
if (isInputEventSupported) {
1339
getTargetIDFunc = getTargetIDForInputEvent;
1340
} else {
1341
getTargetIDFunc = getTargetIDForInputEventIE;
1342
handleEventFunc = handleEventsForInputEventIE;
1343
}
1344
} else if (shouldUseClickEvent(topLevelTarget)) {
1345
getTargetIDFunc = getTargetIDForClickEvent;
1346
}
1347
1348
if (getTargetIDFunc) {
1349
var targetID = getTargetIDFunc(
1350
topLevelType,
1351
topLevelTarget,
1352
topLevelTargetID
1353
);
1354
if (targetID) {
1355
var event = SyntheticEvent.getPooled(
1356
eventTypes.change,
1357
targetID,
1358
nativeEvent
1359
);
1360
EventPropagators.accumulateTwoPhaseDispatches(event);
1361
return event;
1362
}
1363
}
1364
1365
if (handleEventFunc) {
1366
handleEventFunc(
1367
topLevelType,
1368
topLevelTarget,
1369
topLevelTargetID
1370
);
1371
}
1372
}
1373
1374
};
1375
1376
module.exports = ChangeEventPlugin;
1377
1378
1379
},{"./EventConstants":15,"./EventPluginHub":17,"./EventPropagators":20,"./ExecutionEnvironment":21,"./ReactUpdates":88,"./SyntheticEvent":96,"./isEventSupported":137,"./isTextInputElement":139,"./keyOf":142}],8:[function(require,module,exports){
1380
/**
1381
* Copyright 2013-2015, Facebook, Inc.
1382
* All rights reserved.
1383
*
1384
* This source code is licensed under the BSD-style license found in the
1385
* LICENSE file in the root directory of this source tree. An additional grant
1386
* of patent rights can be found in the PATENTS file in the same directory.
1387
*
1388
* @providesModule ClientReactRootIndex
1389
* @typechecks
1390
*/
1391
1392
'use strict';
1393
1394
var nextReactRootIndex = 0;
1395
1396
var ClientReactRootIndex = {
1397
createReactRootIndex: function() {
1398
return nextReactRootIndex++;
1399
}
1400
};
1401
1402
module.exports = ClientReactRootIndex;
1403
1404
1405
},{}],9:[function(require,module,exports){
1406
(function (process){
1407
/**
1408
* Copyright 2013-2015, Facebook, Inc.
1409
* All rights reserved.
1410
*
1411
* This source code is licensed under the BSD-style license found in the
1412
* LICENSE file in the root directory of this source tree. An additional grant
1413
* of patent rights can be found in the PATENTS file in the same directory.
1414
*
1415
* @providesModule DOMChildrenOperations
1416
* @typechecks static-only
1417
*/
1418
1419
'use strict';
1420
1421
var Danger = require("./Danger");
1422
var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
1423
1424
var setTextContent = require("./setTextContent");
1425
var invariant = require("./invariant");
1426
1427
/**
1428
* Inserts `childNode` as a child of `parentNode` at the `index`.
1429
*
1430
* @param {DOMElement} parentNode Parent node in which to insert.
1431
* @param {DOMElement} childNode Child node to insert.
1432
* @param {number} index Index at which to insert the child.
1433
* @internal
1434
*/
1435
function insertChildAt(parentNode, childNode, index) {
1436
// By exploiting arrays returning `undefined` for an undefined index, we can
1437
// rely exclusively on `insertBefore(node, null)` instead of also using
1438
// `appendChild(node)`. However, using `undefined` is not allowed by all
1439
// browsers so we must replace it with `null`.
1440
parentNode.insertBefore(
1441
childNode,
1442
parentNode.childNodes[index] || null
1443
);
1444
}
1445
1446
/**
1447
* Operations for updating with DOM children.
1448
*/
1449
var DOMChildrenOperations = {
1450
1451
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
1452
1453
updateTextContent: setTextContent,
1454
1455
/**
1456
* Updates a component's children by processing a series of updates. The
1457
* update configurations are each expected to have a `parentNode` property.
1458
*
1459
* @param {array<object>} updates List of update configurations.
1460
* @param {array<string>} markupList List of markup strings.
1461
* @internal
1462
*/
1463
processUpdates: function(updates, markupList) {
1464
var update;
1465
// Mapping from parent IDs to initial child orderings.
1466
var initialChildren = null;
1467
// List of children that will be moved or removed.
1468
var updatedChildren = null;
1469
1470
for (var i = 0; i < updates.length; i++) {
1471
update = updates[i];
1472
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
1473
update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
1474
var updatedIndex = update.fromIndex;
1475
var updatedChild = update.parentNode.childNodes[updatedIndex];
1476
var parentID = update.parentID;
1477
1478
("production" !== process.env.NODE_ENV ? invariant(
1479
updatedChild,
1480
'processUpdates(): Unable to find child %s of element. This ' +
1481
'probably means the DOM was unexpectedly mutated (e.g., by the ' +
1482
'browser), usually due to forgetting a <tbody> when using tables, ' +
1483
'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
1484
'in an <svg> parent. Try inspecting the child nodes of the element ' +
1485
'with React ID `%s`.',
1486
updatedIndex,
1487
parentID
1488
) : invariant(updatedChild));
1489
1490
initialChildren = initialChildren || {};
1491
initialChildren[parentID] = initialChildren[parentID] || [];
1492
initialChildren[parentID][updatedIndex] = updatedChild;
1493
1494
updatedChildren = updatedChildren || [];
1495
updatedChildren.push(updatedChild);
1496
}
1497
}
1498
1499
var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
1500
1501
// Remove updated children first so that `toIndex` is consistent.
1502
if (updatedChildren) {
1503
for (var j = 0; j < updatedChildren.length; j++) {
1504
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
1505
}
1506
}
1507
1508
for (var k = 0; k < updates.length; k++) {
1509
update = updates[k];
1510
switch (update.type) {
1511
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
1512
insertChildAt(
1513
update.parentNode,
1514
renderedMarkup[update.markupIndex],
1515
update.toIndex
1516
);
1517
break;
1518
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
1519
insertChildAt(
1520
update.parentNode,
1521
initialChildren[update.parentID][update.fromIndex],
1522
update.toIndex
1523
);
1524
break;
1525
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
1526
setTextContent(
1527
update.parentNode,
1528
update.textContent
1529
);
1530
break;
1531
case ReactMultiChildUpdateTypes.REMOVE_NODE:
1532
// Already removed by the for-loop above.
1533
break;
1534
}
1535
}
1536
}
1537
1538
};
1539
1540
module.exports = DOMChildrenOperations;
1541
1542
1543
}).call(this,require("FWaASH"))
1544
},{"./Danger":12,"./ReactMultiChildUpdateTypes":73,"./invariant":136,"./setTextContent":150,"FWaASH":1}],10:[function(require,module,exports){
1545
(function (process){
1546
/**
1547
* Copyright 2013-2015, Facebook, Inc.
1548
* All rights reserved.
1549
*
1550
* This source code is licensed under the BSD-style license found in the
1551
* LICENSE file in the root directory of this source tree. An additional grant
1552
* of patent rights can be found in the PATENTS file in the same directory.
1553
*
1554
* @providesModule DOMProperty
1555
* @typechecks static-only
1556
*/
1557
1558
/*jslint bitwise: true */
1559
1560
'use strict';
1561
1562
var invariant = require("./invariant");
1563
1564
function checkMask(value, bitmask) {
1565
return (value & bitmask) === bitmask;
1566
}
1567
1568
var DOMPropertyInjection = {
1569
/**
1570
* Mapping from normalized, camelcased property names to a configuration that
1571
* specifies how the associated DOM property should be accessed or rendered.
1572
*/
1573
MUST_USE_ATTRIBUTE: 0x1,
1574
MUST_USE_PROPERTY: 0x2,
1575
HAS_SIDE_EFFECTS: 0x4,
1576
HAS_BOOLEAN_VALUE: 0x8,
1577
HAS_NUMERIC_VALUE: 0x10,
1578
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
1579
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
1580
1581
/**
1582
* Inject some specialized knowledge about the DOM. This takes a config object
1583
* with the following properties:
1584
*
1585
* isCustomAttribute: function that given an attribute name will return true
1586
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
1587
* attributes where it's impossible to enumerate all of the possible
1588
* attribute names,
1589
*
1590
* Properties: object mapping DOM property name to one of the
1591
* DOMPropertyInjection constants or null. If your attribute isn't in here,
1592
* it won't get written to the DOM.
1593
*
1594
* DOMAttributeNames: object mapping React attribute name to the DOM
1595
* attribute name. Attribute names not specified use the **lowercase**
1596
* normalized name.
1597
*
1598
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
1599
* Property names not specified use the normalized name.
1600
*
1601
* DOMMutationMethods: Properties that require special mutation methods. If
1602
* `value` is undefined, the mutation method should unset the property.
1603
*
1604
* @param {object} domPropertyConfig the config as described above.
1605
*/
1606
injectDOMPropertyConfig: function(domPropertyConfig) {
1607
var Properties = domPropertyConfig.Properties || {};
1608
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
1609
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
1610
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
1611
1612
if (domPropertyConfig.isCustomAttribute) {
1613
DOMProperty._isCustomAttributeFunctions.push(
1614
domPropertyConfig.isCustomAttribute
1615
);
1616
}
1617
1618
for (var propName in Properties) {
1619
("production" !== process.env.NODE_ENV ? invariant(
1620
!DOMProperty.isStandardName.hasOwnProperty(propName),
1621
'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
1622
'\'%s\' which has already been injected. You may be accidentally ' +
1623
'injecting the same DOM property config twice, or you may be ' +
1624
'injecting two configs that have conflicting property names.',
1625
propName
1626
) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
1627
1628
DOMProperty.isStandardName[propName] = true;
1629
1630
var lowerCased = propName.toLowerCase();
1631
DOMProperty.getPossibleStandardName[lowerCased] = propName;
1632
1633
if (DOMAttributeNames.hasOwnProperty(propName)) {
1634
var attributeName = DOMAttributeNames[propName];
1635
DOMProperty.getPossibleStandardName[attributeName] = propName;
1636
DOMProperty.getAttributeName[propName] = attributeName;
1637
} else {
1638
DOMProperty.getAttributeName[propName] = lowerCased;
1639
}
1640
1641
DOMProperty.getPropertyName[propName] =
1642
DOMPropertyNames.hasOwnProperty(propName) ?
1643
DOMPropertyNames[propName] :
1644
propName;
1645
1646
if (DOMMutationMethods.hasOwnProperty(propName)) {
1647
DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
1648
} else {
1649
DOMProperty.getMutationMethod[propName] = null;
1650
}
1651
1652
var propConfig = Properties[propName];
1653
DOMProperty.mustUseAttribute[propName] =
1654
checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
1655
DOMProperty.mustUseProperty[propName] =
1656
checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
1657
DOMProperty.hasSideEffects[propName] =
1658
checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
1659
DOMProperty.hasBooleanValue[propName] =
1660
checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
1661
DOMProperty.hasNumericValue[propName] =
1662
checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
1663
DOMProperty.hasPositiveNumericValue[propName] =
1664
checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
1665
DOMProperty.hasOverloadedBooleanValue[propName] =
1666
checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
1667
1668
("production" !== process.env.NODE_ENV ? invariant(
1669
!DOMProperty.mustUseAttribute[propName] ||
1670
!DOMProperty.mustUseProperty[propName],
1671
'DOMProperty: Cannot require using both attribute and property: %s',
1672
propName
1673
) : invariant(!DOMProperty.mustUseAttribute[propName] ||
1674
!DOMProperty.mustUseProperty[propName]));
1675
("production" !== process.env.NODE_ENV ? invariant(
1676
DOMProperty.mustUseProperty[propName] ||
1677
!DOMProperty.hasSideEffects[propName],
1678
'DOMProperty: Properties that have side effects must use property: %s',
1679
propName
1680
) : invariant(DOMProperty.mustUseProperty[propName] ||
1681
!DOMProperty.hasSideEffects[propName]));
1682
("production" !== process.env.NODE_ENV ? invariant(
1683
!!DOMProperty.hasBooleanValue[propName] +
1684
!!DOMProperty.hasNumericValue[propName] +
1685
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
1686
'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
1687
'numeric value, but not a combination: %s',
1688
propName
1689
) : invariant(!!DOMProperty.hasBooleanValue[propName] +
1690
!!DOMProperty.hasNumericValue[propName] +
1691
!!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
1692
}
1693
}
1694
};
1695
var defaultValueCache = {};
1696
1697
/**
1698
* DOMProperty exports lookup objects that can be used like functions:
1699
*
1700
* > DOMProperty.isValid['id']
1701
* true
1702
* > DOMProperty.isValid['foobar']
1703
* undefined
1704
*
1705
* Although this may be confusing, it performs better in general.
1706
*
1707
* @see http://jsperf.com/key-exists
1708
* @see http://jsperf.com/key-missing
1709
*/
1710
var DOMProperty = {
1711
1712
ID_ATTRIBUTE_NAME: 'data-reactid',
1713
1714
/**
1715
* Checks whether a property name is a standard property.
1716
* @type {Object}
1717
*/
1718
isStandardName: {},
1719
1720
/**
1721
* Mapping from lowercase property names to the properly cased version, used
1722
* to warn in the case of missing properties.
1723
* @type {Object}
1724
*/
1725
getPossibleStandardName: {},
1726
1727
/**
1728
* Mapping from normalized names to attribute names that differ. Attribute
1729
* names are used when rendering markup or with `*Attribute()`.
1730
* @type {Object}
1731
*/
1732
getAttributeName: {},
1733
1734
/**
1735
* Mapping from normalized names to properties on DOM node instances.
1736
* (This includes properties that mutate due to external factors.)
1737
* @type {Object}
1738
*/
1739
getPropertyName: {},
1740
1741
/**
1742
* Mapping from normalized names to mutation methods. This will only exist if
1743
* mutation cannot be set simply by the property or `setAttribute()`.
1744
* @type {Object}
1745
*/
1746
getMutationMethod: {},
1747
1748
/**
1749
* Whether the property must be accessed and mutated as an object property.
1750
* @type {Object}
1751
*/
1752
mustUseAttribute: {},
1753
1754
/**
1755
* Whether the property must be accessed and mutated using `*Attribute()`.
1756
* (This includes anything that fails `<propName> in <element>`.)
1757
* @type {Object}
1758
*/
1759
mustUseProperty: {},
1760
1761
/**
1762
* Whether or not setting a value causes side effects such as triggering
1763
* resources to be loaded or text selection changes. We must ensure that
1764
* the value is only set if it has changed.
1765
* @type {Object}
1766
*/
1767
hasSideEffects: {},
1768
1769
/**
1770
* Whether the property should be removed when set to a falsey value.
1771
* @type {Object}
1772
*/
1773
hasBooleanValue: {},
1774
1775
/**
1776
* Whether the property must be numeric or parse as a
1777
* numeric and should be removed when set to a falsey value.
1778
* @type {Object}
1779
*/
1780
hasNumericValue: {},
1781
1782
/**
1783
* Whether the property must be positive numeric or parse as a positive
1784
* numeric and should be removed when set to a falsey value.
1785
* @type {Object}
1786
*/
1787
hasPositiveNumericValue: {},
1788
1789
/**
1790
* Whether the property can be used as a flag as well as with a value. Removed
1791
* when strictly equal to false; present without a value when strictly equal
1792
* to true; present with a value otherwise.
1793
* @type {Object}
1794
*/
1795
hasOverloadedBooleanValue: {},
1796
1797
/**
1798
* All of the isCustomAttribute() functions that have been injected.
1799
*/
1800
_isCustomAttributeFunctions: [],
1801
1802
/**
1803
* Checks whether a property name is a custom attribute.
1804
* @method
1805
*/
1806
isCustomAttribute: function(attributeName) {
1807
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
1808
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
1809
if (isCustomAttributeFn(attributeName)) {
1810
return true;
1811
}
1812
}
1813
return false;
1814
},
1815
1816
/**
1817
* Returns the default property value for a DOM property (i.e., not an
1818
* attribute). Most default values are '' or false, but not all. Worse yet,
1819
* some (in particular, `type`) vary depending on the type of element.
1820
*
1821
* TODO: Is it better to grab all the possible properties when creating an
1822
* element to avoid having to create the same element twice?
1823
*/
1824
getDefaultValueForProperty: function(nodeName, prop) {
1825
var nodeDefaults = defaultValueCache[nodeName];
1826
var testElement;
1827
if (!nodeDefaults) {
1828
defaultValueCache[nodeName] = nodeDefaults = {};
1829
}
1830
if (!(prop in nodeDefaults)) {
1831
testElement = document.createElement(nodeName);
1832
nodeDefaults[prop] = testElement[prop];
1833
}
1834
return nodeDefaults[prop];
1835
},
1836
1837
injection: DOMPropertyInjection
1838
};
1839
1840
module.exports = DOMProperty;
1841
1842
1843
}).call(this,require("FWaASH"))
1844
},{"./invariant":136,"FWaASH":1}],11:[function(require,module,exports){
1845
(function (process){
1846
/**
1847
* Copyright 2013-2015, Facebook, Inc.
1848
* All rights reserved.
1849
*
1850
* This source code is licensed under the BSD-style license found in the
1851
* LICENSE file in the root directory of this source tree. An additional grant
1852
* of patent rights can be found in the PATENTS file in the same directory.
1853
*
1854
* @providesModule DOMPropertyOperations
1855
* @typechecks static-only
1856
*/
1857
1858
'use strict';
1859
1860
var DOMProperty = require("./DOMProperty");
1861
1862
var quoteAttributeValueForBrowser = require("./quoteAttributeValueForBrowser");
1863
var warning = require("./warning");
1864
1865
function shouldIgnoreValue(name, value) {
1866
return value == null ||
1867
(DOMProperty.hasBooleanValue[name] && !value) ||
1868
(DOMProperty.hasNumericValue[name] && isNaN(value)) ||
1869
(DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
1870
(DOMProperty.hasOverloadedBooleanValue[name] && value === false);
1871
}
1872
1873
if ("production" !== process.env.NODE_ENV) {
1874
var reactProps = {
1875
children: true,
1876
dangerouslySetInnerHTML: true,
1877
key: true,
1878
ref: true
1879
};
1880
var warnedProperties = {};
1881
1882
var warnUnknownProperty = function(name) {
1883
if (reactProps.hasOwnProperty(name) && reactProps[name] ||
1884
warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
1885
return;
1886
}
1887
1888
warnedProperties[name] = true;
1889
var lowerCasedName = name.toLowerCase();
1890
1891
// data-* attributes should be lowercase; suggest the lowercase version
1892
var standardName = (
1893
DOMProperty.isCustomAttribute(lowerCasedName) ?
1894
lowerCasedName :
1895
DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
1896
DOMProperty.getPossibleStandardName[lowerCasedName] :
1897
null
1898
);
1899
1900
// For now, only warn when we have a suggested correction. This prevents
1901
// logging too much when using transferPropsTo.
1902
("production" !== process.env.NODE_ENV ? warning(
1903
standardName == null,
1904
'Unknown DOM property %s. Did you mean %s?',
1905
name,
1906
standardName
1907
) : null);
1908
1909
};
1910
}
1911
1912
/**
1913
* Operations for dealing with DOM properties.
1914
*/
1915
var DOMPropertyOperations = {
1916
1917
/**
1918
* Creates markup for the ID property.
1919
*
1920
* @param {string} id Unescaped ID.
1921
* @return {string} Markup string.
1922
*/
1923
createMarkupForID: function(id) {
1924
return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
1925
quoteAttributeValueForBrowser(id);
1926
},
1927
1928
/**
1929
* Creates markup for a property.
1930
*
1931
* @param {string} name
1932
* @param {*} value
1933
* @return {?string} Markup string, or null if the property was invalid.
1934
*/
1935
createMarkupForProperty: function(name, value) {
1936
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
1937
DOMProperty.isStandardName[name]) {
1938
if (shouldIgnoreValue(name, value)) {
1939
return '';
1940
}
1941
var attributeName = DOMProperty.getAttributeName[name];
1942
if (DOMProperty.hasBooleanValue[name] ||
1943
(DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
1944
return attributeName;
1945
}
1946
return attributeName + '=' + quoteAttributeValueForBrowser(value);
1947
} else if (DOMProperty.isCustomAttribute(name)) {
1948
if (value == null) {
1949
return '';
1950
}
1951
return name + '=' + quoteAttributeValueForBrowser(value);
1952
} else if ("production" !== process.env.NODE_ENV) {
1953
warnUnknownProperty(name);
1954
}
1955
return null;
1956
},
1957
1958
/**
1959
* Sets the value for a property on a node.
1960
*
1961
* @param {DOMElement} node
1962
* @param {string} name
1963
* @param {*} value
1964
*/
1965
setValueForProperty: function(node, name, value) {
1966
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
1967
DOMProperty.isStandardName[name]) {
1968
var mutationMethod = DOMProperty.getMutationMethod[name];
1969
if (mutationMethod) {
1970
mutationMethod(node, value);
1971
} else if (shouldIgnoreValue(name, value)) {
1972
this.deleteValueForProperty(node, name);
1973
} else if (DOMProperty.mustUseAttribute[name]) {
1974
// `setAttribute` with objects becomes only `[object]` in IE8/9,
1975
// ('' + value) makes it output the correct toString()-value.
1976
node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
1977
} else {
1978
var propName = DOMProperty.getPropertyName[name];
1979
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
1980
// property type before comparing; only `value` does and is string.
1981
if (!DOMProperty.hasSideEffects[name] ||
1982
('' + node[propName]) !== ('' + value)) {
1983
// Contrary to `setAttribute`, object properties are properly
1984
// `toString`ed by IE8/9.
1985
node[propName] = value;
1986
}
1987
}
1988
} else if (DOMProperty.isCustomAttribute(name)) {
1989
if (value == null) {
1990
node.removeAttribute(name);
1991
} else {
1992
node.setAttribute(name, '' + value);
1993
}
1994
} else if ("production" !== process.env.NODE_ENV) {
1995
warnUnknownProperty(name);
1996
}
1997
},
1998
1999
/**
2000
* Deletes the value for a property on a node.
2001
*
2002
* @param {DOMElement} node
2003
* @param {string} name
2004
*/
2005
deleteValueForProperty: function(node, name) {
2006
if (DOMProperty.isStandardName.hasOwnProperty(name) &&
2007
DOMProperty.isStandardName[name]) {
2008
var mutationMethod = DOMProperty.getMutationMethod[name];
2009
if (mutationMethod) {
2010
mutationMethod(node, undefined);
2011
} else if (DOMProperty.mustUseAttribute[name]) {
2012
node.removeAttribute(DOMProperty.getAttributeName[name]);
2013
} else {
2014
var propName = DOMProperty.getPropertyName[name];
2015
var defaultValue = DOMProperty.getDefaultValueForProperty(
2016
node.nodeName,
2017
propName
2018
);
2019
if (!DOMProperty.hasSideEffects[name] ||
2020
('' + node[propName]) !== defaultValue) {
2021
node[propName] = defaultValue;
2022
}
2023
}
2024
} else if (DOMProperty.isCustomAttribute(name)) {
2025
node.removeAttribute(name);
2026
} else if ("production" !== process.env.NODE_ENV) {
2027
warnUnknownProperty(name);
2028
}
2029
}
2030
2031
};
2032
2033
module.exports = DOMPropertyOperations;
2034
2035
2036
}).call(this,require("FWaASH"))
2037
},{"./DOMProperty":10,"./quoteAttributeValueForBrowser":148,"./warning":155,"FWaASH":1}],12:[function(require,module,exports){
2038
(function (process){
2039
/**
2040
* Copyright 2013-2015, Facebook, Inc.
2041
* All rights reserved.
2042
*
2043
* This source code is licensed under the BSD-style license found in the
2044
* LICENSE file in the root directory of this source tree. An additional grant
2045
* of patent rights can be found in the PATENTS file in the same directory.
2046
*
2047
* @providesModule Danger
2048
* @typechecks static-only
2049
*/
2050
2051
/*jslint evil: true, sub: true */
2052
2053
'use strict';
2054
2055
var ExecutionEnvironment = require("./ExecutionEnvironment");
2056
2057
var createNodesFromMarkup = require("./createNodesFromMarkup");
2058
var emptyFunction = require("./emptyFunction");
2059
var getMarkupWrap = require("./getMarkupWrap");
2060
var invariant = require("./invariant");
2061
2062
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
2063
var RESULT_INDEX_ATTR = 'data-danger-index';
2064
2065
/**
2066
* Extracts the `nodeName` from a string of markup.
2067
*
2068
* NOTE: Extracting the `nodeName` does not require a regular expression match
2069
* because we make assumptions about React-generated markup (i.e. there are no
2070
* spaces surrounding the opening tag and there is at least one attribute).
2071
*
2072
* @param {string} markup String of markup.
2073
* @return {string} Node name of the supplied markup.
2074
* @see http://jsperf.com/extract-nodename
2075
*/
2076
function getNodeName(markup) {
2077
return markup.substring(1, markup.indexOf(' '));
2078
}
2079
2080
var Danger = {
2081
2082
/**
2083
* Renders markup into an array of nodes. The markup is expected to render
2084
* into a list of root nodes. Also, the length of `resultList` and
2085
* `markupList` should be the same.
2086
*
2087
* @param {array<string>} markupList List of markup strings to render.
2088
* @return {array<DOMElement>} List of rendered nodes.
2089
* @internal
2090
*/
2091
dangerouslyRenderMarkup: function(markupList) {
2092
("production" !== process.env.NODE_ENV ? invariant(
2093
ExecutionEnvironment.canUseDOM,
2094
'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
2095
'thread. Make sure `window` and `document` are available globally ' +
2096
'before requiring React when unit testing or use ' +
2097
'React.renderToString for server rendering.'
2098
) : invariant(ExecutionEnvironment.canUseDOM));
2099
var nodeName;
2100
var markupByNodeName = {};
2101
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
2102
for (var i = 0; i < markupList.length; i++) {
2103
("production" !== process.env.NODE_ENV ? invariant(
2104
markupList[i],
2105
'dangerouslyRenderMarkup(...): Missing markup.'
2106
) : invariant(markupList[i]));
2107
nodeName = getNodeName(markupList[i]);
2108
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
2109
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
2110
markupByNodeName[nodeName][i] = markupList[i];
2111
}
2112
var resultList = [];
2113
var resultListAssignmentCount = 0;
2114
for (nodeName in markupByNodeName) {
2115
if (!markupByNodeName.hasOwnProperty(nodeName)) {
2116
continue;
2117
}
2118
var markupListByNodeName = markupByNodeName[nodeName];
2119
2120
// This for-in loop skips the holes of the sparse array. The order of
2121
// iteration should follow the order of assignment, which happens to match
2122
// numerical index order, but we don't rely on that.
2123
var resultIndex;
2124
for (resultIndex in markupListByNodeName) {
2125
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
2126
var markup = markupListByNodeName[resultIndex];
2127
2128
// Push the requested markup with an additional RESULT_INDEX_ATTR
2129
// attribute. If the markup does not start with a < character, it
2130
// will be discarded below (with an appropriate console.error).
2131
markupListByNodeName[resultIndex] = markup.replace(
2132
OPEN_TAG_NAME_EXP,
2133
// This index will be parsed back out below.
2134
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
2135
);
2136
}
2137
}
2138
2139
// Render each group of markup with similar wrapping `nodeName`.
2140
var renderNodes = createNodesFromMarkup(
2141
markupListByNodeName.join(''),
2142
emptyFunction // Do nothing special with <script> tags.
2143
);
2144
2145
for (var j = 0; j < renderNodes.length; ++j) {
2146
var renderNode = renderNodes[j];
2147
if (renderNode.hasAttribute &&
2148
renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
2149
2150
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
2151
renderNode.removeAttribute(RESULT_INDEX_ATTR);
2152
2153
("production" !== process.env.NODE_ENV ? invariant(
2154
!resultList.hasOwnProperty(resultIndex),
2155
'Danger: Assigning to an already-occupied result index.'
2156
) : invariant(!resultList.hasOwnProperty(resultIndex)));
2157
2158
resultList[resultIndex] = renderNode;
2159
2160
// This should match resultList.length and markupList.length when
2161
// we're done.
2162
resultListAssignmentCount += 1;
2163
2164
} else if ("production" !== process.env.NODE_ENV) {
2165
console.error(
2166
'Danger: Discarding unexpected node:',
2167
renderNode
2168
);
2169
}
2170
}
2171
}
2172
2173
// Although resultList was populated out of order, it should now be a dense
2174
// array.
2175
("production" !== process.env.NODE_ENV ? invariant(
2176
resultListAssignmentCount === resultList.length,
2177
'Danger: Did not assign to every index of resultList.'
2178
) : invariant(resultListAssignmentCount === resultList.length));
2179
2180
("production" !== process.env.NODE_ENV ? invariant(
2181
resultList.length === markupList.length,
2182
'Danger: Expected markup to render %s nodes, but rendered %s.',
2183
markupList.length,
2184
resultList.length
2185
) : invariant(resultList.length === markupList.length));
2186
2187
return resultList;
2188
},
2189
2190
/**
2191
* Replaces a node with a string of markup at its current position within its
2192
* parent. The markup must render into a single root node.
2193
*
2194
* @param {DOMElement} oldChild Child node to replace.
2195
* @param {string} markup Markup to render in place of the child node.
2196
* @internal
2197
*/
2198
dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
2199
("production" !== process.env.NODE_ENV ? invariant(
2200
ExecutionEnvironment.canUseDOM,
2201
'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
2202
'worker thread. Make sure `window` and `document` are available ' +
2203
'globally before requiring React when unit testing or use ' +
2204
'React.renderToString for server rendering.'
2205
) : invariant(ExecutionEnvironment.canUseDOM));
2206
("production" !== process.env.NODE_ENV ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
2207
("production" !== process.env.NODE_ENV ? invariant(
2208
oldChild.tagName.toLowerCase() !== 'html',
2209
'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
2210
'<html> node. This is because browser quirks make this unreliable ' +
2211
'and/or slow. If you want to render to the root you must use ' +
2212
'server rendering. See React.renderToString().'
2213
) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
2214
2215
var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
2216
oldChild.parentNode.replaceChild(newChild, oldChild);
2217
}
2218
2219
};
2220
2221
module.exports = Danger;
2222
2223
2224
}).call(this,require("FWaASH"))
2225
},{"./ExecutionEnvironment":21,"./createNodesFromMarkup":113,"./emptyFunction":115,"./getMarkupWrap":128,"./invariant":136,"FWaASH":1}],13:[function(require,module,exports){
2226
/**
2227
* Copyright 2013-2015, Facebook, Inc.
2228
* All rights reserved.
2229
*
2230
* This source code is licensed under the BSD-style license found in the
2231
* LICENSE file in the root directory of this source tree. An additional grant
2232
* of patent rights can be found in the PATENTS file in the same directory.
2233
*
2234
* @providesModule DefaultEventPluginOrder
2235
*/
2236
2237
'use strict';
2238
2239
var keyOf = require("./keyOf");
2240
2241
/**
2242
* Module that is injectable into `EventPluginHub`, that specifies a
2243
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
2244
* plugins, without having to package every one of them. This is better than
2245
* having plugins be ordered in the same order that they are injected because
2246
* that ordering would be influenced by the packaging order.
2247
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
2248
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
2249
*/
2250
var DefaultEventPluginOrder = [
2251
keyOf({ResponderEventPlugin: null}),
2252
keyOf({SimpleEventPlugin: null}),
2253
keyOf({TapEventPlugin: null}),
2254
keyOf({EnterLeaveEventPlugin: null}),
2255
keyOf({ChangeEventPlugin: null}),
2256
keyOf({SelectEventPlugin: null}),
2257
keyOf({BeforeInputEventPlugin: null}),
2258
keyOf({AnalyticsEventPlugin: null}),
2259
keyOf({MobileSafariClickEventPlugin: null})
2260
];
2261
2262
module.exports = DefaultEventPluginOrder;
2263
2264
2265
},{"./keyOf":142}],14:[function(require,module,exports){
2266
/**
2267
* Copyright 2013-2015, Facebook, Inc.
2268
* All rights reserved.
2269
*
2270
* This source code is licensed under the BSD-style license found in the
2271
* LICENSE file in the root directory of this source tree. An additional grant
2272
* of patent rights can be found in the PATENTS file in the same directory.
2273
*
2274
* @providesModule EnterLeaveEventPlugin
2275
* @typechecks static-only
2276
*/
2277
2278
'use strict';
2279
2280
var EventConstants = require("./EventConstants");
2281
var EventPropagators = require("./EventPropagators");
2282
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
2283
2284
var ReactMount = require("./ReactMount");
2285
var keyOf = require("./keyOf");
2286
2287
var topLevelTypes = EventConstants.topLevelTypes;
2288
var getFirstReactDOM = ReactMount.getFirstReactDOM;
2289
2290
var eventTypes = {
2291
mouseEnter: {
2292
registrationName: keyOf({onMouseEnter: null}),
2293
dependencies: [
2294
topLevelTypes.topMouseOut,
2295
topLevelTypes.topMouseOver
2296
]
2297
},
2298
mouseLeave: {
2299
registrationName: keyOf({onMouseLeave: null}),
2300
dependencies: [
2301
topLevelTypes.topMouseOut,
2302
topLevelTypes.topMouseOver
2303
]
2304
}
2305
};
2306
2307
var extractedEvents = [null, null];
2308
2309
var EnterLeaveEventPlugin = {
2310
2311
eventTypes: eventTypes,
2312
2313
/**
2314
* For almost every interaction we care about, there will be both a top-level
2315
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
2316
* we do not extract duplicate events. However, moving the mouse into the
2317
* browser from outside will not fire a `mouseout` event. In this case, we use
2318
* the `mouseover` top-level event.
2319
*
2320
* @param {string} topLevelType Record from `EventConstants`.
2321
* @param {DOMEventTarget} topLevelTarget The listening component root node.
2322
* @param {string} topLevelTargetID ID of `topLevelTarget`.
2323
* @param {object} nativeEvent Native browser event.
2324
* @return {*} An accumulation of synthetic events.
2325
* @see {EventPluginHub.extractEvents}
2326
*/
2327
extractEvents: function(
2328
topLevelType,
2329
topLevelTarget,
2330
topLevelTargetID,
2331
nativeEvent) {
2332
if (topLevelType === topLevelTypes.topMouseOver &&
2333
(nativeEvent.relatedTarget || nativeEvent.fromElement)) {
2334
return null;
2335
}
2336
if (topLevelType !== topLevelTypes.topMouseOut &&
2337
topLevelType !== topLevelTypes.topMouseOver) {
2338
// Must not be a mouse in or mouse out - ignoring.
2339
return null;
2340
}
2341
2342
var win;
2343
if (topLevelTarget.window === topLevelTarget) {
2344
// `topLevelTarget` is probably a window object.
2345
win = topLevelTarget;
2346
} else {
2347
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
2348
var doc = topLevelTarget.ownerDocument;
2349
if (doc) {
2350
win = doc.defaultView || doc.parentWindow;
2351
} else {
2352
win = window;
2353
}
2354
}
2355
2356
var from, to;
2357
if (topLevelType === topLevelTypes.topMouseOut) {
2358
from = topLevelTarget;
2359
to =
2360
getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
2361
win;
2362
} else {
2363
from = win;
2364
to = topLevelTarget;
2365
}
2366
2367
if (from === to) {
2368
// Nothing pertains to our managed components.
2369
return null;
2370
}
2371
2372
var fromID = from ? ReactMount.getID(from) : '';
2373
var toID = to ? ReactMount.getID(to) : '';
2374
2375
var leave = SyntheticMouseEvent.getPooled(
2376
eventTypes.mouseLeave,
2377
fromID,
2378
nativeEvent
2379
);
2380
leave.type = 'mouseleave';
2381
leave.target = from;
2382
leave.relatedTarget = to;
2383
2384
var enter = SyntheticMouseEvent.getPooled(
2385
eventTypes.mouseEnter,
2386
toID,
2387
nativeEvent
2388
);
2389
enter.type = 'mouseenter';
2390
enter.target = to;
2391
enter.relatedTarget = from;
2392
2393
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
2394
2395
extractedEvents[0] = leave;
2396
extractedEvents[1] = enter;
2397
2398
return extractedEvents;
2399
}
2400
2401
};
2402
2403
module.exports = EnterLeaveEventPlugin;
2404
2405
2406
},{"./EventConstants":15,"./EventPropagators":20,"./ReactMount":71,"./SyntheticMouseEvent":100,"./keyOf":142}],15:[function(require,module,exports){
2407
/**
2408
* Copyright 2013-2015, Facebook, Inc.
2409
* All rights reserved.
2410
*
2411
* This source code is licensed under the BSD-style license found in the
2412
* LICENSE file in the root directory of this source tree. An additional grant
2413
* of patent rights can be found in the PATENTS file in the same directory.
2414
*
2415
* @providesModule EventConstants
2416
*/
2417
2418
'use strict';
2419
2420
var keyMirror = require("./keyMirror");
2421
2422
var PropagationPhases = keyMirror({bubbled: null, captured: null});
2423
2424
/**
2425
* Types of raw signals from the browser caught at the top level.
2426
*/
2427
var topLevelTypes = keyMirror({
2428
topBlur: null,
2429
topChange: null,
2430
topClick: null,
2431
topCompositionEnd: null,
2432
topCompositionStart: null,
2433
topCompositionUpdate: null,
2434
topContextMenu: null,
2435
topCopy: null,
2436
topCut: null,
2437
topDoubleClick: null,
2438
topDrag: null,
2439
topDragEnd: null,
2440
topDragEnter: null,
2441
topDragExit: null,
2442
topDragLeave: null,
2443
topDragOver: null,
2444
topDragStart: null,
2445
topDrop: null,
2446
topError: null,
2447
topFocus: null,
2448
topInput: null,
2449
topKeyDown: null,
2450
topKeyPress: null,
2451
topKeyUp: null,
2452
topLoad: null,
2453
topMouseDown: null,
2454
topMouseMove: null,
2455
topMouseOut: null,
2456
topMouseOver: null,
2457
topMouseUp: null,
2458
topPaste: null,
2459
topReset: null,
2460
topScroll: null,
2461
topSelectionChange: null,
2462
topSubmit: null,
2463
topTextInput: null,
2464
topTouchCancel: null,
2465
topTouchEnd: null,
2466
topTouchMove: null,
2467
topTouchStart: null,
2468
topWheel: null
2469
});
2470
2471
var EventConstants = {
2472
topLevelTypes: topLevelTypes,
2473
PropagationPhases: PropagationPhases
2474
};
2475
2476
module.exports = EventConstants;
2477
2478
2479
},{"./keyMirror":141}],16:[function(require,module,exports){
2480
(function (process){
2481
/**
2482
* Copyright 2013-2015, Facebook, Inc.
2483
*
2484
* Licensed under the Apache License, Version 2.0 (the "License");
2485
* you may not use this file except in compliance with the License.
2486
* You may obtain a copy of the License at
2487
*
2488
* http://www.apache.org/licenses/LICENSE-2.0
2489
*
2490
* Unless required by applicable law or agreed to in writing, software
2491
* distributed under the License is distributed on an "AS IS" BASIS,
2492
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2493
* See the License for the specific language governing permissions and
2494
* limitations under the License.
2495
*
2496
* @providesModule EventListener
2497
* @typechecks
2498
*/
2499
2500
var emptyFunction = require("./emptyFunction");
2501
2502
/**
2503
* Upstream version of event listener. Does not take into account specific
2504
* nature of platform.
2505
*/
2506
var EventListener = {
2507
/**
2508
* Listen to DOM events during the bubble phase.
2509
*
2510
* @param {DOMEventTarget} target DOM element to register listener on.
2511
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
2512
* @param {function} callback Callback function.
2513
* @return {object} Object with a `remove` method.
2514
*/
2515
listen: function(target, eventType, callback) {
2516
if (target.addEventListener) {
2517
target.addEventListener(eventType, callback, false);
2518
return {
2519
remove: function() {
2520
target.removeEventListener(eventType, callback, false);
2521
}
2522
};
2523
} else if (target.attachEvent) {
2524
target.attachEvent('on' + eventType, callback);
2525
return {
2526
remove: function() {
2527
target.detachEvent('on' + eventType, callback);
2528
}
2529
};
2530
}
2531
},
2532
2533
/**
2534
* Listen to DOM events during the capture phase.
2535
*
2536
* @param {DOMEventTarget} target DOM element to register listener on.
2537
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
2538
* @param {function} callback Callback function.
2539
* @return {object} Object with a `remove` method.
2540
*/
2541
capture: function(target, eventType, callback) {
2542
if (!target.addEventListener) {
2543
if ("production" !== process.env.NODE_ENV) {
2544
console.error(
2545
'Attempted to listen to events during the capture phase on a ' +
2546
'browser that does not support the capture phase. Your application ' +
2547
'will not receive some events.'
2548
);
2549
}
2550
return {
2551
remove: emptyFunction
2552
};
2553
} else {
2554
target.addEventListener(eventType, callback, true);
2555
return {
2556
remove: function() {
2557
target.removeEventListener(eventType, callback, true);
2558
}
2559
};
2560
}
2561
},
2562
2563
registerDefault: function() {}
2564
};
2565
2566
module.exports = EventListener;
2567
2568
2569
}).call(this,require("FWaASH"))
2570
},{"./emptyFunction":115,"FWaASH":1}],17:[function(require,module,exports){
2571
(function (process){
2572
/**
2573
* Copyright 2013-2015, Facebook, Inc.
2574
* All rights reserved.
2575
*
2576
* This source code is licensed under the BSD-style license found in the
2577
* LICENSE file in the root directory of this source tree. An additional grant
2578
* of patent rights can be found in the PATENTS file in the same directory.
2579
*
2580
* @providesModule EventPluginHub
2581
*/
2582
2583
'use strict';
2584
2585
var EventPluginRegistry = require("./EventPluginRegistry");
2586
var EventPluginUtils = require("./EventPluginUtils");
2587
2588
var accumulateInto = require("./accumulateInto");
2589
var forEachAccumulated = require("./forEachAccumulated");
2590
var invariant = require("./invariant");
2591
2592
/**
2593
* Internal store for event listeners
2594
*/
2595
var listenerBank = {};
2596
2597
/**
2598
* Internal queue of events that have accumulated their dispatches and are
2599
* waiting to have their dispatches executed.
2600
*/
2601
var eventQueue = null;
2602
2603
/**
2604
* Dispatches an event and releases it back into the pool, unless persistent.
2605
*
2606
* @param {?object} event Synthetic event to be dispatched.
2607
* @private
2608
*/
2609
var executeDispatchesAndRelease = function(event) {
2610
if (event) {
2611
var executeDispatch = EventPluginUtils.executeDispatch;
2612
// Plugins can provide custom behavior when dispatching events.
2613
var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
2614
if (PluginModule && PluginModule.executeDispatch) {
2615
executeDispatch = PluginModule.executeDispatch;
2616
}
2617
EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
2618
2619
if (!event.isPersistent()) {
2620
event.constructor.release(event);
2621
}
2622
}
2623
};
2624
2625
/**
2626
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
2627
* hierarchy given ids of the logical DOM elements involved.
2628
*/
2629
var InstanceHandle = null;
2630
2631
function validateInstanceHandle() {
2632
var valid =
2633
InstanceHandle &&
2634
InstanceHandle.traverseTwoPhase &&
2635
InstanceHandle.traverseEnterLeave;
2636
("production" !== process.env.NODE_ENV ? invariant(
2637
valid,
2638
'InstanceHandle not injected before use!'
2639
) : invariant(valid));
2640
}
2641
2642
/**
2643
* This is a unified interface for event plugins to be installed and configured.
2644
*
2645
* Event plugins can implement the following properties:
2646
*
2647
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
2648
* Required. When a top-level event is fired, this method is expected to
2649
* extract synthetic events that will in turn be queued and dispatched.
2650
*
2651
* `eventTypes` {object}
2652
* Optional, plugins that fire events must publish a mapping of registration
2653
* names that are used to register listeners. Values of this mapping must
2654
* be objects that contain `registrationName` or `phasedRegistrationNames`.
2655
*
2656
* `executeDispatch` {function(object, function, string)}
2657
* Optional, allows plugins to override how an event gets dispatched. By
2658
* default, the listener is simply invoked.
2659
*
2660
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
2661
*
2662
* @public
2663
*/
2664
var EventPluginHub = {
2665
2666
/**
2667
* Methods for injecting dependencies.
2668
*/
2669
injection: {
2670
2671
/**
2672
* @param {object} InjectedMount
2673
* @public
2674
*/
2675
injectMount: EventPluginUtils.injection.injectMount,
2676
2677
/**
2678
* @param {object} InjectedInstanceHandle
2679
* @public
2680
*/
2681
injectInstanceHandle: function(InjectedInstanceHandle) {
2682
InstanceHandle = InjectedInstanceHandle;
2683
if ("production" !== process.env.NODE_ENV) {
2684
validateInstanceHandle();
2685
}
2686
},
2687
2688
getInstanceHandle: function() {
2689
if ("production" !== process.env.NODE_ENV) {
2690
validateInstanceHandle();
2691
}
2692
return InstanceHandle;
2693
},
2694
2695
/**
2696
* @param {array} InjectedEventPluginOrder
2697
* @public
2698
*/
2699
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
2700
2701
/**
2702
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
2703
*/
2704
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
2705
2706
},
2707
2708
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
2709
2710
registrationNameModules: EventPluginRegistry.registrationNameModules,
2711
2712
/**
2713
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
2714
*
2715
* @param {string} id ID of the DOM element.
2716
* @param {string} registrationName Name of listener (e.g. `onClick`).
2717
* @param {?function} listener The callback to store.
2718
*/
2719
putListener: function(id, registrationName, listener) {
2720
("production" !== process.env.NODE_ENV ? invariant(
2721
!listener || typeof listener === 'function',
2722
'Expected %s listener to be a function, instead got type %s',
2723
registrationName, typeof listener
2724
) : invariant(!listener || typeof listener === 'function'));
2725
2726
var bankForRegistrationName =
2727
listenerBank[registrationName] || (listenerBank[registrationName] = {});
2728
bankForRegistrationName[id] = listener;
2729
},
2730
2731
/**
2732
* @param {string} id ID of the DOM element.
2733
* @param {string} registrationName Name of listener (e.g. `onClick`).
2734
* @return {?function} The stored callback.
2735
*/
2736
getListener: function(id, registrationName) {
2737
var bankForRegistrationName = listenerBank[registrationName];
2738
return bankForRegistrationName && bankForRegistrationName[id];
2739
},
2740
2741
/**
2742
* Deletes a listener from the registration bank.
2743
*
2744
* @param {string} id ID of the DOM element.
2745
* @param {string} registrationName Name of listener (e.g. `onClick`).
2746
*/
2747
deleteListener: function(id, registrationName) {
2748
var bankForRegistrationName = listenerBank[registrationName];
2749
if (bankForRegistrationName) {
2750
delete bankForRegistrationName[id];
2751
}
2752
},
2753
2754
/**
2755
* Deletes all listeners for the DOM element with the supplied ID.
2756
*
2757
* @param {string} id ID of the DOM element.
2758
*/
2759
deleteAllListeners: function(id) {
2760
for (var registrationName in listenerBank) {
2761
delete listenerBank[registrationName][id];
2762
}
2763
},
2764
2765
/**
2766
* Allows registered plugins an opportunity to extract events from top-level
2767
* native browser events.
2768
*
2769
* @param {string} topLevelType Record from `EventConstants`.
2770
* @param {DOMEventTarget} topLevelTarget The listening component root node.
2771
* @param {string} topLevelTargetID ID of `topLevelTarget`.
2772
* @param {object} nativeEvent Native browser event.
2773
* @return {*} An accumulation of synthetic events.
2774
* @internal
2775
*/
2776
extractEvents: function(
2777
topLevelType,
2778
topLevelTarget,
2779
topLevelTargetID,
2780
nativeEvent) {
2781
var events;
2782
var plugins = EventPluginRegistry.plugins;
2783
for (var i = 0, l = plugins.length; i < l; i++) {
2784
// Not every plugin in the ordering may be loaded at runtime.
2785
var possiblePlugin = plugins[i];
2786
if (possiblePlugin) {
2787
var extractedEvents = possiblePlugin.extractEvents(
2788
topLevelType,
2789
topLevelTarget,
2790
topLevelTargetID,
2791
nativeEvent
2792
);
2793
if (extractedEvents) {
2794
events = accumulateInto(events, extractedEvents);
2795
}
2796
}
2797
}
2798
return events;
2799
},
2800
2801
/**
2802
* Enqueues a synthetic event that should be dispatched when
2803
* `processEventQueue` is invoked.
2804
*
2805
* @param {*} events An accumulation of synthetic events.
2806
* @internal
2807
*/
2808
enqueueEvents: function(events) {
2809
if (events) {
2810
eventQueue = accumulateInto(eventQueue, events);
2811
}
2812
},
2813
2814
/**
2815
* Dispatches all synthetic events on the event queue.
2816
*
2817
* @internal
2818
*/
2819
processEventQueue: function() {
2820
// Set `eventQueue` to null before processing it so that we can tell if more
2821
// events get enqueued while processing.
2822
var processingEventQueue = eventQueue;
2823
eventQueue = null;
2824
forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
2825
("production" !== process.env.NODE_ENV ? invariant(
2826
!eventQueue,
2827
'processEventQueue(): Additional events were enqueued while processing ' +
2828
'an event queue. Support for this has not yet been implemented.'
2829
) : invariant(!eventQueue));
2830
},
2831
2832
/**
2833
* These are needed for tests only. Do not use!
2834
*/
2835
__purge: function() {
2836
listenerBank = {};
2837
},
2838
2839
__getListenerBank: function() {
2840
return listenerBank;
2841
}
2842
2843
};
2844
2845
module.exports = EventPluginHub;
2846
2847
2848
}).call(this,require("FWaASH"))
2849
},{"./EventPluginRegistry":18,"./EventPluginUtils":19,"./accumulateInto":106,"./forEachAccumulated":121,"./invariant":136,"FWaASH":1}],18:[function(require,module,exports){
2850
(function (process){
2851
/**
2852
* Copyright 2013-2015, Facebook, Inc.
2853
* All rights reserved.
2854
*
2855
* This source code is licensed under the BSD-style license found in the
2856
* LICENSE file in the root directory of this source tree. An additional grant
2857
* of patent rights can be found in the PATENTS file in the same directory.
2858
*
2859
* @providesModule EventPluginRegistry
2860
* @typechecks static-only
2861
*/
2862
2863
'use strict';
2864
2865
var invariant = require("./invariant");
2866
2867
/**
2868
* Injectable ordering of event plugins.
2869
*/
2870
var EventPluginOrder = null;
2871
2872
/**
2873
* Injectable mapping from names to event plugin modules.
2874
*/
2875
var namesToPlugins = {};
2876
2877
/**
2878
* Recomputes the plugin list using the injected plugins and plugin ordering.
2879
*
2880
* @private
2881
*/
2882
function recomputePluginOrdering() {
2883
if (!EventPluginOrder) {
2884
// Wait until an `EventPluginOrder` is injected.
2885
return;
2886
}
2887
for (var pluginName in namesToPlugins) {
2888
var PluginModule = namesToPlugins[pluginName];
2889
var pluginIndex = EventPluginOrder.indexOf(pluginName);
2890
("production" !== process.env.NODE_ENV ? invariant(
2891
pluginIndex > -1,
2892
'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
2893
'the plugin ordering, `%s`.',
2894
pluginName
2895
) : invariant(pluginIndex > -1));
2896
if (EventPluginRegistry.plugins[pluginIndex]) {
2897
continue;
2898
}
2899
("production" !== process.env.NODE_ENV ? invariant(
2900
PluginModule.extractEvents,
2901
'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
2902
'method, but `%s` does not.',
2903
pluginName
2904
) : invariant(PluginModule.extractEvents));
2905
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
2906
var publishedEvents = PluginModule.eventTypes;
2907
for (var eventName in publishedEvents) {
2908
("production" !== process.env.NODE_ENV ? invariant(
2909
publishEventForPlugin(
2910
publishedEvents[eventName],
2911
PluginModule,
2912
eventName
2913
),
2914
'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
2915
eventName,
2916
pluginName
2917
) : invariant(publishEventForPlugin(
2918
publishedEvents[eventName],
2919
PluginModule,
2920
eventName
2921
)));
2922
}
2923
}
2924
}
2925
2926
/**
2927
* Publishes an event so that it can be dispatched by the supplied plugin.
2928
*
2929
* @param {object} dispatchConfig Dispatch configuration for the event.
2930
* @param {object} PluginModule Plugin publishing the event.
2931
* @return {boolean} True if the event was successfully published.
2932
* @private
2933
*/
2934
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
2935
("production" !== process.env.NODE_ENV ? invariant(
2936
!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
2937
'EventPluginHub: More than one plugin attempted to publish the same ' +
2938
'event name, `%s`.',
2939
eventName
2940
) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
2941
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
2942
2943
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
2944
if (phasedRegistrationNames) {
2945
for (var phaseName in phasedRegistrationNames) {
2946
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
2947
var phasedRegistrationName = phasedRegistrationNames[phaseName];
2948
publishRegistrationName(
2949
phasedRegistrationName,
2950
PluginModule,
2951
eventName
2952
);
2953
}
2954
}
2955
return true;
2956
} else if (dispatchConfig.registrationName) {
2957
publishRegistrationName(
2958
dispatchConfig.registrationName,
2959
PluginModule,
2960
eventName
2961
);
2962
return true;
2963
}
2964
return false;
2965
}
2966
2967
/**
2968
* Publishes a registration name that is used to identify dispatched events and
2969
* can be used with `EventPluginHub.putListener` to register listeners.
2970
*
2971
* @param {string} registrationName Registration name to add.
2972
* @param {object} PluginModule Plugin publishing the event.
2973
* @private
2974
*/
2975
function publishRegistrationName(registrationName, PluginModule, eventName) {
2976
("production" !== process.env.NODE_ENV ? invariant(
2977
!EventPluginRegistry.registrationNameModules[registrationName],
2978
'EventPluginHub: More than one plugin attempted to publish the same ' +
2979
'registration name, `%s`.',
2980
registrationName
2981
) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
2982
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
2983
EventPluginRegistry.registrationNameDependencies[registrationName] =
2984
PluginModule.eventTypes[eventName].dependencies;
2985
}
2986
2987
/**
2988
* Registers plugins so that they can extract and dispatch events.
2989
*
2990
* @see {EventPluginHub}
2991
*/
2992
var EventPluginRegistry = {
2993
2994
/**
2995
* Ordered list of injected plugins.
2996
*/
2997
plugins: [],
2998
2999
/**
3000
* Mapping from event name to dispatch config
3001
*/
3002
eventNameDispatchConfigs: {},
3003
3004
/**
3005
* Mapping from registration name to plugin module
3006
*/
3007
registrationNameModules: {},
3008
3009
/**
3010
* Mapping from registration name to event name
3011
*/
3012
registrationNameDependencies: {},
3013
3014
/**
3015
* Injects an ordering of plugins (by plugin name). This allows the ordering
3016
* to be decoupled from injection of the actual plugins so that ordering is
3017
* always deterministic regardless of packaging, on-the-fly injection, etc.
3018
*
3019
* @param {array} InjectedEventPluginOrder
3020
* @internal
3021
* @see {EventPluginHub.injection.injectEventPluginOrder}
3022
*/
3023
injectEventPluginOrder: function(InjectedEventPluginOrder) {
3024
("production" !== process.env.NODE_ENV ? invariant(
3025
!EventPluginOrder,
3026
'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
3027
'once. You are likely trying to load more than one copy of React.'
3028
) : invariant(!EventPluginOrder));
3029
// Clone the ordering so it cannot be dynamically mutated.
3030
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
3031
recomputePluginOrdering();
3032
},
3033
3034
/**
3035
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
3036
* in the ordering injected by `injectEventPluginOrder`.
3037
*
3038
* Plugins can be injected as part of page initialization or on-the-fly.
3039
*
3040
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
3041
* @internal
3042
* @see {EventPluginHub.injection.injectEventPluginsByName}
3043
*/
3044
injectEventPluginsByName: function(injectedNamesToPlugins) {
3045
var isOrderingDirty = false;
3046
for (var pluginName in injectedNamesToPlugins) {
3047
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
3048
continue;
3049
}
3050
var PluginModule = injectedNamesToPlugins[pluginName];
3051
if (!namesToPlugins.hasOwnProperty(pluginName) ||
3052
namesToPlugins[pluginName] !== PluginModule) {
3053
("production" !== process.env.NODE_ENV ? invariant(
3054
!namesToPlugins[pluginName],
3055
'EventPluginRegistry: Cannot inject two different event plugins ' +
3056
'using the same name, `%s`.',
3057
pluginName
3058
) : invariant(!namesToPlugins[pluginName]));
3059
namesToPlugins[pluginName] = PluginModule;
3060
isOrderingDirty = true;
3061
}
3062
}
3063
if (isOrderingDirty) {
3064
recomputePluginOrdering();
3065
}
3066
},
3067
3068
/**
3069
* Looks up the plugin for the supplied event.
3070
*
3071
* @param {object} event A synthetic event.
3072
* @return {?object} The plugin that created the supplied event.
3073
* @internal
3074
*/
3075
getPluginModuleForEvent: function(event) {
3076
var dispatchConfig = event.dispatchConfig;
3077
if (dispatchConfig.registrationName) {
3078
return EventPluginRegistry.registrationNameModules[
3079
dispatchConfig.registrationName
3080
] || null;
3081
}
3082
for (var phase in dispatchConfig.phasedRegistrationNames) {
3083
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
3084
continue;
3085
}
3086
var PluginModule = EventPluginRegistry.registrationNameModules[
3087
dispatchConfig.phasedRegistrationNames[phase]
3088
];
3089
if (PluginModule) {
3090
return PluginModule;
3091
}
3092
}
3093
return null;
3094
},
3095
3096
/**
3097
* Exposed for unit testing.
3098
* @private
3099
*/
3100
_resetEventPlugins: function() {
3101
EventPluginOrder = null;
3102
for (var pluginName in namesToPlugins) {
3103
if (namesToPlugins.hasOwnProperty(pluginName)) {
3104
delete namesToPlugins[pluginName];
3105
}
3106
}
3107
EventPluginRegistry.plugins.length = 0;
3108
3109
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
3110
for (var eventName in eventNameDispatchConfigs) {
3111
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
3112
delete eventNameDispatchConfigs[eventName];
3113
}
3114
}
3115
3116
var registrationNameModules = EventPluginRegistry.registrationNameModules;
3117
for (var registrationName in registrationNameModules) {
3118
if (registrationNameModules.hasOwnProperty(registrationName)) {
3119
delete registrationNameModules[registrationName];
3120
}
3121
}
3122
}
3123
3124
};
3125
3126
module.exports = EventPluginRegistry;
3127
3128
3129
}).call(this,require("FWaASH"))
3130
},{"./invariant":136,"FWaASH":1}],19:[function(require,module,exports){
3131
(function (process){
3132
/**
3133
* Copyright 2013-2015, Facebook, Inc.
3134
* All rights reserved.
3135
*
3136
* This source code is licensed under the BSD-style license found in the
3137
* LICENSE file in the root directory of this source tree. An additional grant
3138
* of patent rights can be found in the PATENTS file in the same directory.
3139
*
3140
* @providesModule EventPluginUtils
3141
*/
3142
3143
'use strict';
3144
3145
var EventConstants = require("./EventConstants");
3146
3147
var invariant = require("./invariant");
3148
3149
/**
3150
* Injected dependencies:
3151
*/
3152
3153
/**
3154
* - `Mount`: [required] Module that can convert between React dom IDs and
3155
* actual node references.
3156
*/
3157
var injection = {
3158
Mount: null,
3159
injectMount: function(InjectedMount) {
3160
injection.Mount = InjectedMount;
3161
if ("production" !== process.env.NODE_ENV) {
3162
("production" !== process.env.NODE_ENV ? invariant(
3163
InjectedMount && InjectedMount.getNode,
3164
'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
3165
'is missing getNode.'
3166
) : invariant(InjectedMount && InjectedMount.getNode));
3167
}
3168
}
3169
};
3170
3171
var topLevelTypes = EventConstants.topLevelTypes;
3172
3173
function isEndish(topLevelType) {
3174
return topLevelType === topLevelTypes.topMouseUp ||
3175
topLevelType === topLevelTypes.topTouchEnd ||
3176
topLevelType === topLevelTypes.topTouchCancel;
3177
}
3178
3179
function isMoveish(topLevelType) {
3180
return topLevelType === topLevelTypes.topMouseMove ||
3181
topLevelType === topLevelTypes.topTouchMove;
3182
}
3183
function isStartish(topLevelType) {
3184
return topLevelType === topLevelTypes.topMouseDown ||
3185
topLevelType === topLevelTypes.topTouchStart;
3186
}
3187
3188
3189
var validateEventDispatches;
3190
if ("production" !== process.env.NODE_ENV) {
3191
validateEventDispatches = function(event) {
3192
var dispatchListeners = event._dispatchListeners;
3193
var dispatchIDs = event._dispatchIDs;
3194
3195
var listenersIsArr = Array.isArray(dispatchListeners);
3196
var idsIsArr = Array.isArray(dispatchIDs);
3197
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
3198
var listenersLen = listenersIsArr ?
3199
dispatchListeners.length :
3200
dispatchListeners ? 1 : 0;
3201
3202
("production" !== process.env.NODE_ENV ? invariant(
3203
idsIsArr === listenersIsArr && IDsLen === listenersLen,
3204
'EventPluginUtils: Invalid `event`.'
3205
) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
3206
};
3207
}
3208
3209
/**
3210
* Invokes `cb(event, listener, id)`. Avoids using call if no scope is
3211
* provided. The `(listener,id)` pair effectively forms the "dispatch" but are
3212
* kept separate to conserve memory.
3213
*/
3214
function forEachEventDispatch(event, cb) {
3215
var dispatchListeners = event._dispatchListeners;
3216
var dispatchIDs = event._dispatchIDs;
3217
if ("production" !== process.env.NODE_ENV) {
3218
validateEventDispatches(event);
3219
}
3220
if (Array.isArray(dispatchListeners)) {
3221
for (var i = 0; i < dispatchListeners.length; i++) {
3222
if (event.isPropagationStopped()) {
3223
break;
3224
}
3225
// Listeners and IDs are two parallel arrays that are always in sync.
3226
cb(event, dispatchListeners[i], dispatchIDs[i]);
3227
}
3228
} else if (dispatchListeners) {
3229
cb(event, dispatchListeners, dispatchIDs);
3230
}
3231
}
3232
3233
/**
3234
* Default implementation of PluginModule.executeDispatch().
3235
* @param {SyntheticEvent} SyntheticEvent to handle
3236
* @param {function} Application-level callback
3237
* @param {string} domID DOM id to pass to the callback.
3238
*/
3239
function executeDispatch(event, listener, domID) {
3240
event.currentTarget = injection.Mount.getNode(domID);
3241
var returnValue = listener(event, domID);
3242
event.currentTarget = null;
3243
return returnValue;
3244
}
3245
3246
/**
3247
* Standard/simple iteration through an event's collected dispatches.
3248
*/
3249
function executeDispatchesInOrder(event, cb) {
3250
forEachEventDispatch(event, cb);
3251
event._dispatchListeners = null;
3252
event._dispatchIDs = null;
3253
}
3254
3255
/**
3256
* Standard/simple iteration through an event's collected dispatches, but stops
3257
* at the first dispatch execution returning true, and returns that id.
3258
*
3259
* @return id of the first dispatch execution who's listener returns true, or
3260
* null if no listener returned true.
3261
*/
3262
function executeDispatchesInOrderStopAtTrueImpl(event) {
3263
var dispatchListeners = event._dispatchListeners;
3264
var dispatchIDs = event._dispatchIDs;
3265
if ("production" !== process.env.NODE_ENV) {
3266
validateEventDispatches(event);
3267
}
3268
if (Array.isArray(dispatchListeners)) {
3269
for (var i = 0; i < dispatchListeners.length; i++) {
3270
if (event.isPropagationStopped()) {
3271
break;
3272
}
3273
// Listeners and IDs are two parallel arrays that are always in sync.
3274
if (dispatchListeners[i](event, dispatchIDs[i])) {
3275
return dispatchIDs[i];
3276
}
3277
}
3278
} else if (dispatchListeners) {
3279
if (dispatchListeners(event, dispatchIDs)) {
3280
return dispatchIDs;
3281
}
3282
}
3283
return null;
3284
}
3285
3286
/**
3287
* @see executeDispatchesInOrderStopAtTrueImpl
3288
*/
3289
function executeDispatchesInOrderStopAtTrue(event) {
3290
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
3291
event._dispatchIDs = null;
3292
event._dispatchListeners = null;
3293
return ret;
3294
}
3295
3296
/**
3297
* Execution of a "direct" dispatch - there must be at most one dispatch
3298
* accumulated on the event or it is considered an error. It doesn't really make
3299
* sense for an event with multiple dispatches (bubbled) to keep track of the
3300
* return values at each dispatch execution, but it does tend to make sense when
3301
* dealing with "direct" dispatches.
3302
*
3303
* @return The return value of executing the single dispatch.
3304
*/
3305
function executeDirectDispatch(event) {
3306
if ("production" !== process.env.NODE_ENV) {
3307
validateEventDispatches(event);
3308
}
3309
var dispatchListener = event._dispatchListeners;
3310
var dispatchID = event._dispatchIDs;
3311
("production" !== process.env.NODE_ENV ? invariant(
3312
!Array.isArray(dispatchListener),
3313
'executeDirectDispatch(...): Invalid `event`.'
3314
) : invariant(!Array.isArray(dispatchListener)));
3315
var res = dispatchListener ?
3316
dispatchListener(event, dispatchID) :
3317
null;
3318
event._dispatchListeners = null;
3319
event._dispatchIDs = null;
3320
return res;
3321
}
3322
3323
/**
3324
* @param {SyntheticEvent} event
3325
* @return {bool} True iff number of dispatches accumulated is greater than 0.
3326
*/
3327
function hasDispatches(event) {
3328
return !!event._dispatchListeners;
3329
}
3330
3331
/**
3332
* General utilities that are useful in creating custom Event Plugins.
3333
*/
3334
var EventPluginUtils = {
3335
isEndish: isEndish,
3336
isMoveish: isMoveish,
3337
isStartish: isStartish,
3338
3339
executeDirectDispatch: executeDirectDispatch,
3340
executeDispatch: executeDispatch,
3341
executeDispatchesInOrder: executeDispatchesInOrder,
3342
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
3343
hasDispatches: hasDispatches,
3344
injection: injection,
3345
useTouchEvents: false
3346
};
3347
3348
module.exports = EventPluginUtils;
3349
3350
3351
}).call(this,require("FWaASH"))
3352
},{"./EventConstants":15,"./invariant":136,"FWaASH":1}],20:[function(require,module,exports){
3353
(function (process){
3354
/**
3355
* Copyright 2013-2015, Facebook, Inc.
3356
* All rights reserved.
3357
*
3358
* This source code is licensed under the BSD-style license found in the
3359
* LICENSE file in the root directory of this source tree. An additional grant
3360
* of patent rights can be found in the PATENTS file in the same directory.
3361
*
3362
* @providesModule EventPropagators
3363
*/
3364
3365
'use strict';
3366
3367
var EventConstants = require("./EventConstants");
3368
var EventPluginHub = require("./EventPluginHub");
3369
3370
var accumulateInto = require("./accumulateInto");
3371
var forEachAccumulated = require("./forEachAccumulated");
3372
3373
var PropagationPhases = EventConstants.PropagationPhases;
3374
var getListener = EventPluginHub.getListener;
3375
3376
/**
3377
* Some event types have a notion of different registration names for different
3378
* "phases" of propagation. This finds listeners by a given phase.
3379
*/
3380
function listenerAtPhase(id, event, propagationPhase) {
3381
var registrationName =
3382
event.dispatchConfig.phasedRegistrationNames[propagationPhase];
3383
return getListener(id, registrationName);
3384
}
3385
3386
/**
3387
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function
3388
* here, allows us to not have to bind or create functions for each event.
3389
* Mutating the event's members allows us to not have to create a wrapping
3390
* "dispatch" object that pairs the event with the listener.
3391
*/
3392
function accumulateDirectionalDispatches(domID, upwards, event) {
3393
if ("production" !== process.env.NODE_ENV) {
3394
if (!domID) {
3395
throw new Error('Dispatching id must not be null');
3396
}
3397
}
3398
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
3399
var listener = listenerAtPhase(domID, event, phase);
3400
if (listener) {
3401
event._dispatchListeners =
3402
accumulateInto(event._dispatchListeners, listener);
3403
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
3404
}
3405
}
3406
3407
/**
3408
* Collect dispatches (must be entirely collected before dispatching - see unit
3409
* tests). Lazily allocate the array to conserve memory. We must loop through
3410
* each event and perform the traversal for each one. We can not perform a
3411
* single traversal for the entire collection of events because each event may
3412
* have a different target.
3413
*/
3414
function accumulateTwoPhaseDispatchesSingle(event) {
3415
if (event && event.dispatchConfig.phasedRegistrationNames) {
3416
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
3417
event.dispatchMarker,
3418
accumulateDirectionalDispatches,
3419
event
3420
);
3421
}
3422
}
3423
3424
3425
/**
3426
* Accumulates without regard to direction, does not look for phased
3427
* registration names. Same as `accumulateDirectDispatchesSingle` but without
3428
* requiring that the `dispatchMarker` be the same as the dispatched ID.
3429
*/
3430
function accumulateDispatches(id, ignoredDirection, event) {
3431
if (event && event.dispatchConfig.registrationName) {
3432
var registrationName = event.dispatchConfig.registrationName;
3433
var listener = getListener(id, registrationName);
3434
if (listener) {
3435
event._dispatchListeners =
3436
accumulateInto(event._dispatchListeners, listener);
3437
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
3438
}
3439
}
3440
}
3441
3442
/**
3443
* Accumulates dispatches on an `SyntheticEvent`, but only for the
3444
* `dispatchMarker`.
3445
* @param {SyntheticEvent} event
3446
*/
3447
function accumulateDirectDispatchesSingle(event) {
3448
if (event && event.dispatchConfig.registrationName) {
3449
accumulateDispatches(event.dispatchMarker, null, event);
3450
}
3451
}
3452
3453
function accumulateTwoPhaseDispatches(events) {
3454
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
3455
}
3456
3457
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
3458
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
3459
fromID,
3460
toID,
3461
accumulateDispatches,
3462
leave,
3463
enter
3464
);
3465
}
3466
3467
3468
function accumulateDirectDispatches(events) {
3469
forEachAccumulated(events, accumulateDirectDispatchesSingle);
3470
}
3471
3472
3473
3474
/**
3475
* A small set of propagation patterns, each of which will accept a small amount
3476
* of information, and generate a set of "dispatch ready event objects" - which
3477
* are sets of events that have already been annotated with a set of dispatched
3478
* listener functions/ids. The API is designed this way to discourage these
3479
* propagation strategies from actually executing the dispatches, since we
3480
* always want to collect the entire set of dispatches before executing event a
3481
* single one.
3482
*
3483
* @constructor EventPropagators
3484
*/
3485
var EventPropagators = {
3486
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
3487
accumulateDirectDispatches: accumulateDirectDispatches,
3488
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
3489
};
3490
3491
module.exports = EventPropagators;
3492
3493
3494
}).call(this,require("FWaASH"))
3495
},{"./EventConstants":15,"./EventPluginHub":17,"./accumulateInto":106,"./forEachAccumulated":121,"FWaASH":1}],21:[function(require,module,exports){
3496
/**
3497
* Copyright 2013-2015, Facebook, Inc.
3498
* All rights reserved.
3499
*
3500
* This source code is licensed under the BSD-style license found in the
3501
* LICENSE file in the root directory of this source tree. An additional grant
3502
* of patent rights can be found in the PATENTS file in the same directory.
3503
*
3504
* @providesModule ExecutionEnvironment
3505
*/
3506
3507
/*jslint evil: true */
3508
3509
"use strict";
3510
3511
var canUseDOM = !!(
3512
(typeof window !== 'undefined' &&
3513
window.document && window.document.createElement)
3514
);
3515
3516
/**
3517
* Simple, lightweight module assisting with the detection and context of
3518
* Worker. Helps avoid circular dependencies and allows code to reason about
3519
* whether or not they are in a Worker, even if they never include the main
3520
* `ReactWorker` dependency.
3521
*/
3522
var ExecutionEnvironment = {
3523
3524
canUseDOM: canUseDOM,
3525
3526
canUseWorkers: typeof Worker !== 'undefined',
3527
3528
canUseEventListeners:
3529
canUseDOM && !!(window.addEventListener || window.attachEvent),
3530
3531
canUseViewport: canUseDOM && !!window.screen,
3532
3533
isInWorker: !canUseDOM // For now, this is true - might change in the future.
3534
3535
};
3536
3537
module.exports = ExecutionEnvironment;
3538
3539
3540
},{}],22:[function(require,module,exports){
3541
/**
3542
* Copyright 2013-2015, Facebook, Inc.
3543
* All rights reserved.
3544
*
3545
* This source code is licensed under the BSD-style license found in the
3546
* LICENSE file in the root directory of this source tree. An additional grant
3547
* of patent rights can be found in the PATENTS file in the same directory.
3548
*
3549
* @providesModule FallbackCompositionState
3550
* @typechecks static-only
3551
*/
3552
3553
'use strict';
3554
3555
var PooledClass = require("./PooledClass");
3556
3557
var assign = require("./Object.assign");
3558
var getTextContentAccessor = require("./getTextContentAccessor");
3559
3560
/**
3561
* This helper class stores information about text content of a target node,
3562
* allowing comparison of content before and after a given event.
3563
*
3564
* Identify the node where selection currently begins, then observe
3565
* both its text content and its current position in the DOM. Since the
3566
* browser may natively replace the target node during composition, we can
3567
* use its position to find its replacement.
3568
*
3569
* @param {DOMEventTarget} root
3570
*/
3571
function FallbackCompositionState(root) {
3572
this._root = root;
3573
this._startText = this.getText();
3574
this._fallbackText = null;
3575
}
3576
3577
assign(FallbackCompositionState.prototype, {
3578
/**
3579
* Get current text of input.
3580
*
3581
* @return {string}
3582
*/
3583
getText: function() {
3584
if ('value' in this._root) {
3585
return this._root.value;
3586
}
3587
return this._root[getTextContentAccessor()];
3588
},
3589
3590
/**
3591
* Determine the differing substring between the initially stored
3592
* text content and the current content.
3593
*
3594
* @return {string}
3595
*/
3596
getData: function() {
3597
if (this._fallbackText) {
3598
return this._fallbackText;
3599
}
3600
3601
var start;
3602
var startValue = this._startText;
3603
var startLength = startValue.length;
3604
var end;
3605
var endValue = this.getText();
3606
var endLength = endValue.length;
3607
3608
for (start = 0; start < startLength; start++) {
3609
if (startValue[start] !== endValue[start]) {
3610
break;
3611
}
3612
}
3613
3614
var minEnd = startLength - start;
3615
for (end = 1; end <= minEnd; end++) {
3616
if (startValue[startLength - end] !== endValue[endLength - end]) {
3617
break;
3618
}
3619
}
3620
3621
var sliceTail = end > 1 ? 1 - end : undefined;
3622
this._fallbackText = endValue.slice(start, sliceTail);
3623
return this._fallbackText;
3624
}
3625
});
3626
3627
PooledClass.addPoolingTo(FallbackCompositionState);
3628
3629
module.exports = FallbackCompositionState;
3630
3631
3632
},{"./Object.assign":27,"./PooledClass":28,"./getTextContentAccessor":131}],23:[function(require,module,exports){
3633
/**
3634
* Copyright 2013-2015, Facebook, Inc.
3635
* All rights reserved.
3636
*
3637
* This source code is licensed under the BSD-style license found in the
3638
* LICENSE file in the root directory of this source tree. An additional grant
3639
* of patent rights can be found in the PATENTS file in the same directory.
3640
*
3641
* @providesModule HTMLDOMPropertyConfig
3642
*/
3643
3644
/*jslint bitwise: true*/
3645
3646
'use strict';
3647
3648
var DOMProperty = require("./DOMProperty");
3649
var ExecutionEnvironment = require("./ExecutionEnvironment");
3650
3651
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
3652
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
3653
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
3654
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
3655
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
3656
var HAS_POSITIVE_NUMERIC_VALUE =
3657
DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
3658
var HAS_OVERLOADED_BOOLEAN_VALUE =
3659
DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
3660
3661
var hasSVG;
3662
if (ExecutionEnvironment.canUseDOM) {
3663
var implementation = document.implementation;
3664
hasSVG = (
3665
implementation &&
3666
implementation.hasFeature &&
3667
implementation.hasFeature(
3668
'http://www.w3.org/TR/SVG11/feature#BasicStructure',
3669
'1.1'
3670
)
3671
);
3672
}
3673
3674
3675
var HTMLDOMPropertyConfig = {
3676
isCustomAttribute: RegExp.prototype.test.bind(
3677
/^(data|aria)-[a-z_][a-z\d_.\-]*$/
3678
),
3679
Properties: {
3680
/**
3681
* Standard Properties
3682
*/
3683
accept: null,
3684
acceptCharset: null,
3685
accessKey: null,
3686
action: null,
3687
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3688
allowTransparency: MUST_USE_ATTRIBUTE,
3689
alt: null,
3690
async: HAS_BOOLEAN_VALUE,
3691
autoComplete: null,
3692
// autoFocus is polyfilled/normalized by AutoFocusMixin
3693
// autoFocus: HAS_BOOLEAN_VALUE,
3694
autoPlay: HAS_BOOLEAN_VALUE,
3695
cellPadding: null,
3696
cellSpacing: null,
3697
charSet: MUST_USE_ATTRIBUTE,
3698
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3699
classID: MUST_USE_ATTRIBUTE,
3700
// To set className on SVG elements, it's necessary to use .setAttribute;
3701
// this works on HTML elements too in all browsers except IE8. Conveniently,
3702
// IE8 doesn't support SVG and so we can simply use the attribute in
3703
// browsers that support SVG and the property in browsers that don't,
3704
// regardless of whether the element is HTML or SVG.
3705
className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
3706
cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
3707
colSpan: null,
3708
content: null,
3709
contentEditable: null,
3710
contextMenu: MUST_USE_ATTRIBUTE,
3711
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3712
coords: null,
3713
crossOrigin: null,
3714
data: null, // For `<object />` acts as `src`.
3715
dateTime: MUST_USE_ATTRIBUTE,
3716
defer: HAS_BOOLEAN_VALUE,
3717
dir: null,
3718
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3719
download: HAS_OVERLOADED_BOOLEAN_VALUE,
3720
draggable: null,
3721
encType: null,
3722
form: MUST_USE_ATTRIBUTE,
3723
formAction: MUST_USE_ATTRIBUTE,
3724
formEncType: MUST_USE_ATTRIBUTE,
3725
formMethod: MUST_USE_ATTRIBUTE,
3726
formNoValidate: HAS_BOOLEAN_VALUE,
3727
formTarget: MUST_USE_ATTRIBUTE,
3728
frameBorder: MUST_USE_ATTRIBUTE,
3729
headers: null,
3730
height: MUST_USE_ATTRIBUTE,
3731
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3732
href: null,
3733
hrefLang: null,
3734
htmlFor: null,
3735
httpEquiv: null,
3736
icon: null,
3737
id: MUST_USE_PROPERTY,
3738
label: null,
3739
lang: null,
3740
list: MUST_USE_ATTRIBUTE,
3741
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3742
manifest: MUST_USE_ATTRIBUTE,
3743
marginHeight: null,
3744
marginWidth: null,
3745
max: null,
3746
maxLength: MUST_USE_ATTRIBUTE,
3747
media: MUST_USE_ATTRIBUTE,
3748
mediaGroup: null,
3749
method: null,
3750
min: null,
3751
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3752
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3753
name: null,
3754
noValidate: HAS_BOOLEAN_VALUE,
3755
open: HAS_BOOLEAN_VALUE,
3756
pattern: null,
3757
placeholder: null,
3758
poster: null,
3759
preload: null,
3760
radioGroup: null,
3761
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3762
rel: null,
3763
required: HAS_BOOLEAN_VALUE,
3764
role: MUST_USE_ATTRIBUTE,
3765
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
3766
rowSpan: null,
3767
sandbox: null,
3768
scope: null,
3769
scrolling: null,
3770
seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3771
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
3772
shape: null,
3773
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
3774
sizes: MUST_USE_ATTRIBUTE,
3775
span: HAS_POSITIVE_NUMERIC_VALUE,
3776
spellCheck: null,
3777
src: null,
3778
srcDoc: MUST_USE_PROPERTY,
3779
srcSet: MUST_USE_ATTRIBUTE,
3780
start: HAS_NUMERIC_VALUE,
3781
step: null,
3782
style: null,
3783
tabIndex: null,
3784
target: null,
3785
title: null,
3786
type: null,
3787
useMap: null,
3788
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
3789
width: MUST_USE_ATTRIBUTE,
3790
wmode: MUST_USE_ATTRIBUTE,
3791
3792
/**
3793
* Non-standard Properties
3794
*/
3795
// autoCapitalize and autoCorrect are supported in Mobile Safari for
3796
// keyboard hints.
3797
autoCapitalize: null,
3798
autoCorrect: null,
3799
// itemProp, itemScope, itemType are for
3800
// Microdata support. See http://schema.org/docs/gs.html
3801
itemProp: MUST_USE_ATTRIBUTE,
3802
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
3803
itemType: MUST_USE_ATTRIBUTE,
3804
// itemID and itemRef are for Microdata support as well but
3805
// only specified in the the WHATWG spec document. See
3806
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
3807
itemID: MUST_USE_ATTRIBUTE,
3808
itemRef: MUST_USE_ATTRIBUTE,
3809
// property is supported for OpenGraph in meta tags.
3810
property: null
3811
},
3812
DOMAttributeNames: {
3813
acceptCharset: 'accept-charset',
3814
className: 'class',
3815
htmlFor: 'for',
3816
httpEquiv: 'http-equiv'
3817
},
3818
DOMPropertyNames: {
3819
autoCapitalize: 'autocapitalize',
3820
autoComplete: 'autocomplete',
3821
autoCorrect: 'autocorrect',
3822
autoFocus: 'autofocus',
3823
autoPlay: 'autoplay',
3824
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
3825
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
3826
encType: 'encoding',
3827
hrefLang: 'hreflang',
3828
radioGroup: 'radiogroup',
3829
spellCheck: 'spellcheck',
3830
srcDoc: 'srcdoc',
3831
srcSet: 'srcset'
3832
}
3833
};
3834
3835
module.exports = HTMLDOMPropertyConfig;
3836
3837
3838
},{"./DOMProperty":10,"./ExecutionEnvironment":21}],24:[function(require,module,exports){
3839
(function (process){
3840
/**
3841
* Copyright 2013-2015, Facebook, Inc.
3842
* All rights reserved.
3843
*
3844
* This source code is licensed under the BSD-style license found in the
3845
* LICENSE file in the root directory of this source tree. An additional grant
3846
* of patent rights can be found in the PATENTS file in the same directory.
3847
*
3848
* @providesModule LinkedValueUtils
3849
* @typechecks static-only
3850
*/
3851
3852
'use strict';
3853
3854
var ReactPropTypes = require("./ReactPropTypes");
3855
3856
var invariant = require("./invariant");
3857
3858
var hasReadOnlyValue = {
3859
'button': true,
3860
'checkbox': true,
3861
'image': true,
3862
'hidden': true,
3863
'radio': true,
3864
'reset': true,
3865
'submit': true
3866
};
3867
3868
function _assertSingleLink(input) {
3869
("production" !== process.env.NODE_ENV ? invariant(
3870
input.props.checkedLink == null || input.props.valueLink == null,
3871
'Cannot provide a checkedLink and a valueLink. If you want to use ' +
3872
'checkedLink, you probably don\'t want to use valueLink and vice versa.'
3873
) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
3874
}
3875
function _assertValueLink(input) {
3876
_assertSingleLink(input);
3877
("production" !== process.env.NODE_ENV ? invariant(
3878
input.props.value == null && input.props.onChange == null,
3879
'Cannot provide a valueLink and a value or onChange event. If you want ' +
3880
'to use value or onChange, you probably don\'t want to use valueLink.'
3881
) : invariant(input.props.value == null && input.props.onChange == null));
3882
}
3883
3884
function _assertCheckedLink(input) {
3885
_assertSingleLink(input);
3886
("production" !== process.env.NODE_ENV ? invariant(
3887
input.props.checked == null && input.props.onChange == null,
3888
'Cannot provide a checkedLink and a checked property or onChange event. ' +
3889
'If you want to use checked or onChange, you probably don\'t want to ' +
3890
'use checkedLink'
3891
) : invariant(input.props.checked == null && input.props.onChange == null));
3892
}
3893
3894
/**
3895
* @param {SyntheticEvent} e change event to handle
3896
*/
3897
function _handleLinkedValueChange(e) {
3898
/*jshint validthis:true */
3899
this.props.valueLink.requestChange(e.target.value);
3900
}
3901
3902
/**
3903
* @param {SyntheticEvent} e change event to handle
3904
*/
3905
function _handleLinkedCheckChange(e) {
3906
/*jshint validthis:true */
3907
this.props.checkedLink.requestChange(e.target.checked);
3908
}
3909
3910
/**
3911
* Provide a linked `value` attribute for controlled forms. You should not use
3912
* this outside of the ReactDOM controlled form components.
3913
*/
3914
var LinkedValueUtils = {
3915
Mixin: {
3916
propTypes: {
3917
value: function(props, propName, componentName) {
3918
if (!props[propName] ||
3919
hasReadOnlyValue[props.type] ||
3920
props.onChange ||
3921
props.readOnly ||
3922
props.disabled) {
3923
return null;
3924
}
3925
return new Error(
3926
'You provided a `value` prop to a form field without an ' +
3927
'`onChange` handler. This will render a read-only field. If ' +
3928
'the field should be mutable use `defaultValue`. Otherwise, ' +
3929
'set either `onChange` or `readOnly`.'
3930
);
3931
},
3932
checked: function(props, propName, componentName) {
3933
if (!props[propName] ||
3934
props.onChange ||
3935
props.readOnly ||
3936
props.disabled) {
3937
return null;
3938
}
3939
return new Error(
3940
'You provided a `checked` prop to a form field without an ' +
3941
'`onChange` handler. This will render a read-only field. If ' +
3942
'the field should be mutable use `defaultChecked`. Otherwise, ' +
3943
'set either `onChange` or `readOnly`.'
3944
);
3945
},
3946
onChange: ReactPropTypes.func
3947
}
3948
},
3949
3950
/**
3951
* @param {ReactComponent} input Form component
3952
* @return {*} current value of the input either from value prop or link.
3953
*/
3954
getValue: function(input) {
3955
if (input.props.valueLink) {
3956
_assertValueLink(input);
3957
return input.props.valueLink.value;
3958
}
3959
return input.props.value;
3960
},
3961
3962
/**
3963
* @param {ReactComponent} input Form component
3964
* @return {*} current checked status of the input either from checked prop
3965
* or link.
3966
*/
3967
getChecked: function(input) {
3968
if (input.props.checkedLink) {
3969
_assertCheckedLink(input);
3970
return input.props.checkedLink.value;
3971
}
3972
return input.props.checked;
3973
},
3974
3975
/**
3976
* @param {ReactComponent} input Form component
3977
* @return {function} change callback either from onChange prop or link.
3978
*/
3979
getOnChange: function(input) {
3980
if (input.props.valueLink) {
3981
_assertValueLink(input);
3982
return _handleLinkedValueChange;
3983
} else if (input.props.checkedLink) {
3984
_assertCheckedLink(input);
3985
return _handleLinkedCheckChange;
3986
}
3987
return input.props.onChange;
3988
}
3989
};
3990
3991
module.exports = LinkedValueUtils;
3992
3993
3994
}).call(this,require("FWaASH"))
3995
},{"./ReactPropTypes":79,"./invariant":136,"FWaASH":1}],25:[function(require,module,exports){
3996
(function (process){
3997
/**
3998
* Copyright 2014-2015, Facebook, Inc.
3999
* All rights reserved.
4000
*
4001
* This source code is licensed under the BSD-style license found in the
4002
* LICENSE file in the root directory of this source tree. An additional grant
4003
* of patent rights can be found in the PATENTS file in the same directory.
4004
*
4005
* @providesModule LocalEventTrapMixin
4006
*/
4007
4008
'use strict';
4009
4010
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
4011
4012
var accumulateInto = require("./accumulateInto");
4013
var forEachAccumulated = require("./forEachAccumulated");
4014
var invariant = require("./invariant");
4015
4016
function remove(event) {
4017
event.remove();
4018
}
4019
4020
var LocalEventTrapMixin = {
4021
trapBubbledEvent:function(topLevelType, handlerBaseName) {
4022
("production" !== process.env.NODE_ENV ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
4023
// If a component renders to null or if another component fatals and causes
4024
// the state of the tree to be corrupted, `node` here can be null.
4025
var node = this.getDOMNode();
4026
("production" !== process.env.NODE_ENV ? invariant(
4027
node,
4028
'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
4029
) : invariant(node));
4030
var listener = ReactBrowserEventEmitter.trapBubbledEvent(
4031
topLevelType,
4032
handlerBaseName,
4033
node
4034
);
4035
this._localEventListeners =
4036
accumulateInto(this._localEventListeners, listener);
4037
},
4038
4039
// trapCapturedEvent would look nearly identical. We don't implement that
4040
// method because it isn't currently needed.
4041
4042
componentWillUnmount:function() {
4043
if (this._localEventListeners) {
4044
forEachAccumulated(this._localEventListeners, remove);
4045
}
4046
}
4047
};
4048
4049
module.exports = LocalEventTrapMixin;
4050
4051
4052
}).call(this,require("FWaASH"))
4053
},{"./ReactBrowserEventEmitter":31,"./accumulateInto":106,"./forEachAccumulated":121,"./invariant":136,"FWaASH":1}],26:[function(require,module,exports){
4054
/**
4055
* Copyright 2013-2015, Facebook, Inc.
4056
* All rights reserved.
4057
*
4058
* This source code is licensed under the BSD-style license found in the
4059
* LICENSE file in the root directory of this source tree. An additional grant
4060
* of patent rights can be found in the PATENTS file in the same directory.
4061
*
4062
* @providesModule MobileSafariClickEventPlugin
4063
* @typechecks static-only
4064
*/
4065
4066
'use strict';
4067
4068
var EventConstants = require("./EventConstants");
4069
4070
var emptyFunction = require("./emptyFunction");
4071
4072
var topLevelTypes = EventConstants.topLevelTypes;
4073
4074
/**
4075
* Mobile Safari does not fire properly bubble click events on non-interactive
4076
* elements, which means delegated click listeners do not fire. The workaround
4077
* for this bug involves attaching an empty click listener on the target node.
4078
*
4079
* This particular plugin works around the bug by attaching an empty click
4080
* listener on `touchstart` (which does fire on every element).
4081
*/
4082
var MobileSafariClickEventPlugin = {
4083
4084
eventTypes: null,
4085
4086
/**
4087
* @param {string} topLevelType Record from `EventConstants`.
4088
* @param {DOMEventTarget} topLevelTarget The listening component root node.
4089
* @param {string} topLevelTargetID ID of `topLevelTarget`.
4090
* @param {object} nativeEvent Native browser event.
4091
* @return {*} An accumulation of synthetic events.
4092
* @see {EventPluginHub.extractEvents}
4093
*/
4094
extractEvents: function(
4095
topLevelType,
4096
topLevelTarget,
4097
topLevelTargetID,
4098
nativeEvent) {
4099
if (topLevelType === topLevelTypes.topTouchStart) {
4100
var target = nativeEvent.target;
4101
if (target && !target.onclick) {
4102
target.onclick = emptyFunction;
4103
}
4104
}
4105
}
4106
4107
};
4108
4109
module.exports = MobileSafariClickEventPlugin;
4110
4111
4112
},{"./EventConstants":15,"./emptyFunction":115}],27:[function(require,module,exports){
4113
/**
4114
* Copyright 2014-2015, Facebook, Inc.
4115
* All rights reserved.
4116
*
4117
* This source code is licensed under the BSD-style license found in the
4118
* LICENSE file in the root directory of this source tree. An additional grant
4119
* of patent rights can be found in the PATENTS file in the same directory.
4120
*
4121
* @providesModule Object.assign
4122
*/
4123
4124
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
4125
4126
'use strict';
4127
4128
function assign(target, sources) {
4129
if (target == null) {
4130
throw new TypeError('Object.assign target cannot be null or undefined');
4131
}
4132
4133
var to = Object(target);
4134
var hasOwnProperty = Object.prototype.hasOwnProperty;
4135
4136
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
4137
var nextSource = arguments[nextIndex];
4138
if (nextSource == null) {
4139
continue;
4140
}
4141
4142
var from = Object(nextSource);
4143
4144
// We don't currently support accessors nor proxies. Therefore this
4145
// copy cannot throw. If we ever supported this then we must handle
4146
// exceptions and side-effects. We don't support symbols so they won't
4147
// be transferred.
4148
4149
for (var key in from) {
4150
if (hasOwnProperty.call(from, key)) {
4151
to[key] = from[key];
4152
}
4153
}
4154
}
4155
4156
return to;
4157
}
4158
4159
module.exports = assign;
4160
4161
4162
},{}],28:[function(require,module,exports){
4163
(function (process){
4164
/**
4165
* Copyright 2013-2015, Facebook, Inc.
4166
* All rights reserved.
4167
*
4168
* This source code is licensed under the BSD-style license found in the
4169
* LICENSE file in the root directory of this source tree. An additional grant
4170
* of patent rights can be found in the PATENTS file in the same directory.
4171
*
4172
* @providesModule PooledClass
4173
*/
4174
4175
'use strict';
4176
4177
var invariant = require("./invariant");
4178
4179
/**
4180
* Static poolers. Several custom versions for each potential number of
4181
* arguments. A completely generic pooler is easy to implement, but would
4182
* require accessing the `arguments` object. In each of these, `this` refers to
4183
* the Class itself, not an instance. If any others are needed, simply add them
4184
* here, or in their own files.
4185
*/
4186
var oneArgumentPooler = function(copyFieldsFrom) {
4187
var Klass = this;
4188
if (Klass.instancePool.length) {
4189
var instance = Klass.instancePool.pop();
4190
Klass.call(instance, copyFieldsFrom);
4191
return instance;
4192
} else {
4193
return new Klass(copyFieldsFrom);
4194
}
4195
};
4196
4197
var twoArgumentPooler = function(a1, a2) {
4198
var Klass = this;
4199
if (Klass.instancePool.length) {
4200
var instance = Klass.instancePool.pop();
4201
Klass.call(instance, a1, a2);
4202
return instance;
4203
} else {
4204
return new Klass(a1, a2);
4205
}
4206
};
4207
4208
var threeArgumentPooler = function(a1, a2, a3) {
4209
var Klass = this;
4210
if (Klass.instancePool.length) {
4211
var instance = Klass.instancePool.pop();
4212
Klass.call(instance, a1, a2, a3);
4213
return instance;
4214
} else {
4215
return new Klass(a1, a2, a3);
4216
}
4217
};
4218
4219
var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
4220
var Klass = this;
4221
if (Klass.instancePool.length) {
4222
var instance = Klass.instancePool.pop();
4223
Klass.call(instance, a1, a2, a3, a4, a5);
4224
return instance;
4225
} else {
4226
return new Klass(a1, a2, a3, a4, a5);
4227
}
4228
};
4229
4230
var standardReleaser = function(instance) {
4231
var Klass = this;
4232
("production" !== process.env.NODE_ENV ? invariant(
4233
instance instanceof Klass,
4234
'Trying to release an instance into a pool of a different type.'
4235
) : invariant(instance instanceof Klass));
4236
if (instance.destructor) {
4237
instance.destructor();
4238
}
4239
if (Klass.instancePool.length < Klass.poolSize) {
4240
Klass.instancePool.push(instance);
4241
}
4242
};
4243
4244
var DEFAULT_POOL_SIZE = 10;
4245
var DEFAULT_POOLER = oneArgumentPooler;
4246
4247
/**
4248
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
4249
* itself (statically) not adding any prototypical fields. Any CopyConstructor
4250
* you give this may have a `poolSize` property, and will look for a
4251
* prototypical `destructor` on instances (optional).
4252
*
4253
* @param {Function} CopyConstructor Constructor that can be used to reset.
4254
* @param {Function} pooler Customizable pooler.
4255
*/
4256
var addPoolingTo = function(CopyConstructor, pooler) {
4257
var NewKlass = CopyConstructor;
4258
NewKlass.instancePool = [];
4259
NewKlass.getPooled = pooler || DEFAULT_POOLER;
4260
if (!NewKlass.poolSize) {
4261
NewKlass.poolSize = DEFAULT_POOL_SIZE;
4262
}
4263
NewKlass.release = standardReleaser;
4264
return NewKlass;
4265
};
4266
4267
var PooledClass = {
4268
addPoolingTo: addPoolingTo,
4269
oneArgumentPooler: oneArgumentPooler,
4270
twoArgumentPooler: twoArgumentPooler,
4271
threeArgumentPooler: threeArgumentPooler,
4272
fiveArgumentPooler: fiveArgumentPooler
4273
};
4274
4275
module.exports = PooledClass;
4276
4277
4278
}).call(this,require("FWaASH"))
4279
},{"./invariant":136,"FWaASH":1}],29:[function(require,module,exports){
4280
(function (process){
4281
/**
4282
* Copyright 2013-2015, Facebook, Inc.
4283
* All rights reserved.
4284
*
4285
* This source code is licensed under the BSD-style license found in the
4286
* LICENSE file in the root directory of this source tree. An additional grant
4287
* of patent rights can be found in the PATENTS file in the same directory.
4288
*
4289
* @providesModule React
4290
*/
4291
4292
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
4293
4294
'use strict';
4295
4296
var EventPluginUtils = require("./EventPluginUtils");
4297
var ReactChildren = require("./ReactChildren");
4298
var ReactComponent = require("./ReactComponent");
4299
var ReactClass = require("./ReactClass");
4300
var ReactContext = require("./ReactContext");
4301
var ReactCurrentOwner = require("./ReactCurrentOwner");
4302
var ReactElement = require("./ReactElement");
4303
var ReactElementValidator = require("./ReactElementValidator");
4304
var ReactDOM = require("./ReactDOM");
4305
var ReactDOMTextComponent = require("./ReactDOMTextComponent");
4306
var ReactDefaultInjection = require("./ReactDefaultInjection");
4307
var ReactInstanceHandles = require("./ReactInstanceHandles");
4308
var ReactMount = require("./ReactMount");
4309
var ReactPerf = require("./ReactPerf");
4310
var ReactPropTypes = require("./ReactPropTypes");
4311
var ReactReconciler = require("./ReactReconciler");
4312
var ReactServerRendering = require("./ReactServerRendering");
4313
4314
var assign = require("./Object.assign");
4315
var findDOMNode = require("./findDOMNode");
4316
var onlyChild = require("./onlyChild");
4317
4318
ReactDefaultInjection.inject();
4319
4320
var createElement = ReactElement.createElement;
4321
var createFactory = ReactElement.createFactory;
4322
var cloneElement = ReactElement.cloneElement;
4323
4324
if ("production" !== process.env.NODE_ENV) {
4325
createElement = ReactElementValidator.createElement;
4326
createFactory = ReactElementValidator.createFactory;
4327
cloneElement = ReactElementValidator.cloneElement;
4328
}
4329
4330
var render = ReactPerf.measure('React', 'render', ReactMount.render);
4331
4332
var React = {
4333
Children: {
4334
map: ReactChildren.map,
4335
forEach: ReactChildren.forEach,
4336
count: ReactChildren.count,
4337
only: onlyChild
4338
},
4339
Component: ReactComponent,
4340
DOM: ReactDOM,
4341
PropTypes: ReactPropTypes,
4342
initializeTouchEvents: function(shouldUseTouch) {
4343
EventPluginUtils.useTouchEvents = shouldUseTouch;
4344
},
4345
createClass: ReactClass.createClass,
4346
createElement: createElement,
4347
cloneElement: cloneElement,
4348
createFactory: createFactory,
4349
createMixin: function(mixin) {
4350
// Currently a noop. Will be used to validate and trace mixins.
4351
return mixin;
4352
},
4353
constructAndRenderComponent: ReactMount.constructAndRenderComponent,
4354
constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
4355
findDOMNode: findDOMNode,
4356
render: render,
4357
renderToString: ReactServerRendering.renderToString,
4358
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
4359
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
4360
isValidElement: ReactElement.isValidElement,
4361
withContext: ReactContext.withContext,
4362
4363
// Hook for JSX spread, don't use this for anything else.
4364
__spread: assign
4365
};
4366
4367
// Inject the runtime into a devtools global hook regardless of browser.
4368
// Allows for debugging when the hook is injected on the page.
4369
if (
4370
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
4371
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
4372
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
4373
CurrentOwner: ReactCurrentOwner,
4374
InstanceHandles: ReactInstanceHandles,
4375
Mount: ReactMount,
4376
Reconciler: ReactReconciler,
4377
TextComponent: ReactDOMTextComponent
4378
});
4379
}
4380
4381
if ("production" !== process.env.NODE_ENV) {
4382
var ExecutionEnvironment = require("./ExecutionEnvironment");
4383
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
4384
4385
// If we're in Chrome, look for the devtools marker and provide a download
4386
// link if not installed.
4387
if (navigator.userAgent.indexOf('Chrome') > -1) {
4388
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
4389
console.debug(
4390
'Download the React DevTools for a better development experience: ' +
4391
'http://fb.me/react-devtools'
4392
);
4393
}
4394
}
4395
4396
var expectedFeatures = [
4397
// shims
4398
Array.isArray,
4399
Array.prototype.every,
4400
Array.prototype.forEach,
4401
Array.prototype.indexOf,
4402
Array.prototype.map,
4403
Date.now,
4404
Function.prototype.bind,
4405
Object.keys,
4406
String.prototype.split,
4407
String.prototype.trim,
4408
4409
// shams
4410
Object.create,
4411
Object.freeze
4412
];
4413
4414
for (var i = 0; i < expectedFeatures.length; i++) {
4415
if (!expectedFeatures[i]) {
4416
console.error(
4417
'One or more ES5 shim/shams expected by React are not available: ' +
4418
'http://fb.me/react-warning-polyfills'
4419
);
4420
break;
4421
}
4422
}
4423
}
4424
}
4425
4426
React.version = '0.13.0-rc2';
4427
4428
module.exports = React;
4429
4430
4431
}).call(this,require("FWaASH"))
4432
},{"./EventPluginUtils":19,"./ExecutionEnvironment":21,"./Object.assign":27,"./ReactChildren":33,"./ReactClass":34,"./ReactComponent":35,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactDOM":41,"./ReactDOMTextComponent":52,"./ReactDefaultInjection":55,"./ReactElement":58,"./ReactElementValidator":59,"./ReactInstanceHandles":67,"./ReactMount":71,"./ReactPerf":76,"./ReactPropTypes":79,"./ReactReconciler":82,"./ReactServerRendering":85,"./findDOMNode":118,"./onlyChild":145,"FWaASH":1}],30:[function(require,module,exports){
4433
/**
4434
* Copyright 2013-2015, Facebook, Inc.
4435
* All rights reserved.
4436
*
4437
* This source code is licensed under the BSD-style license found in the
4438
* LICENSE file in the root directory of this source tree. An additional grant
4439
* of patent rights can be found in the PATENTS file in the same directory.
4440
*
4441
* @providesModule ReactBrowserComponentMixin
4442
*/
4443
4444
'use strict';
4445
4446
var findDOMNode = require("./findDOMNode");
4447
4448
var ReactBrowserComponentMixin = {
4449
/**
4450
* Returns the DOM node rendered by this component.
4451
*
4452
* @return {DOMElement} The root node of this component.
4453
* @final
4454
* @protected
4455
*/
4456
getDOMNode: function() {
4457
return findDOMNode(this);
4458
}
4459
};
4460
4461
module.exports = ReactBrowserComponentMixin;
4462
4463
4464
},{"./findDOMNode":118}],31:[function(require,module,exports){
4465
/**
4466
* Copyright 2013-2015, Facebook, Inc.
4467
* All rights reserved.
4468
*
4469
* This source code is licensed under the BSD-style license found in the
4470
* LICENSE file in the root directory of this source tree. An additional grant
4471
* of patent rights can be found in the PATENTS file in the same directory.
4472
*
4473
* @providesModule ReactBrowserEventEmitter
4474
* @typechecks static-only
4475
*/
4476
4477
'use strict';
4478
4479
var EventConstants = require("./EventConstants");
4480
var EventPluginHub = require("./EventPluginHub");
4481
var EventPluginRegistry = require("./EventPluginRegistry");
4482
var ReactEventEmitterMixin = require("./ReactEventEmitterMixin");
4483
var ViewportMetrics = require("./ViewportMetrics");
4484
4485
var assign = require("./Object.assign");
4486
var isEventSupported = require("./isEventSupported");
4487
4488
/**
4489
* Summary of `ReactBrowserEventEmitter` event handling:
4490
*
4491
* - Top-level delegation is used to trap most native browser events. This
4492
* may only occur in the main thread and is the responsibility of
4493
* ReactEventListener, which is injected and can therefore support pluggable
4494
* event sources. This is the only work that occurs in the main thread.
4495
*
4496
* - We normalize and de-duplicate events to account for browser quirks. This
4497
* may be done in the worker thread.
4498
*
4499
* - Forward these native events (with the associated top-level type used to
4500
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want
4501
* to extract any synthetic events.
4502
*
4503
* - The `EventPluginHub` will then process each event by annotating them with
4504
* "dispatches", a sequence of listeners and IDs that care about that event.
4505
*
4506
* - The `EventPluginHub` then dispatches the events.
4507
*
4508
* Overview of React and the event system:
4509
*
4510
* +------------+ .
4511
* | DOM | .
4512
* +------------+ .
4513
* | .
4514
* v .
4515
* +------------+ .
4516
* | ReactEvent | .
4517
* | Listener | .
4518
* +------------+ . +-----------+
4519
* | . +--------+|SimpleEvent|
4520
* | . | |Plugin |
4521
* +-----|------+ . v +-----------+
4522
* | | | . +--------------+ +------------+
4523
* | +-----------.--->|EventPluginHub| | Event |
4524
* | | . | | +-----------+ | Propagators|
4525
* | ReactEvent | . | | |TapEvent | |------------|
4526
* | Emitter | . | |<---+|Plugin | |other plugin|
4527
* | | . | | +-----------+ | utilities |
4528
* | +-----------.--->| | +------------+
4529
* | | | . +--------------+
4530
* +-----|------+ . ^ +-----------+
4531
* | . | |Enter/Leave|
4532
* + . +-------+|Plugin |
4533
* +-------------+ . +-----------+
4534
* | application | .
4535
* |-------------| .
4536
* | | .
4537
* | | .
4538
* +-------------+ .
4539
* .
4540
* React Core . General Purpose Event Plugin System
4541
*/
4542
4543
var alreadyListeningTo = {};
4544
var isMonitoringScrollValue = false;
4545
var reactTopListenersCounter = 0;
4546
4547
// For events like 'submit' which don't consistently bubble (which we trap at a
4548
// lower node than `document`), binding at `document` would cause duplicate
4549
// events so we don't include them here
4550
var topEventMapping = {
4551
topBlur: 'blur',
4552
topChange: 'change',
4553
topClick: 'click',
4554
topCompositionEnd: 'compositionend',
4555
topCompositionStart: 'compositionstart',
4556
topCompositionUpdate: 'compositionupdate',
4557
topContextMenu: 'contextmenu',
4558
topCopy: 'copy',
4559
topCut: 'cut',
4560
topDoubleClick: 'dblclick',
4561
topDrag: 'drag',
4562
topDragEnd: 'dragend',
4563
topDragEnter: 'dragenter',
4564
topDragExit: 'dragexit',
4565
topDragLeave: 'dragleave',
4566
topDragOver: 'dragover',
4567
topDragStart: 'dragstart',
4568
topDrop: 'drop',
4569
topFocus: 'focus',
4570
topInput: 'input',
4571
topKeyDown: 'keydown',
4572
topKeyPress: 'keypress',
4573
topKeyUp: 'keyup',
4574
topMouseDown: 'mousedown',
4575
topMouseMove: 'mousemove',
4576
topMouseOut: 'mouseout',
4577
topMouseOver: 'mouseover',
4578
topMouseUp: 'mouseup',
4579
topPaste: 'paste',
4580
topScroll: 'scroll',
4581
topSelectionChange: 'selectionchange',
4582
topTextInput: 'textInput',
4583
topTouchCancel: 'touchcancel',
4584
topTouchEnd: 'touchend',
4585
topTouchMove: 'touchmove',
4586
topTouchStart: 'touchstart',
4587
topWheel: 'wheel'
4588
};
4589
4590
/**
4591
* To ensure no conflicts with other potential React instances on the page
4592
*/
4593
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
4594
4595
function getListeningForDocument(mountAt) {
4596
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
4597
// directly.
4598
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
4599
mountAt[topListenersIDKey] = reactTopListenersCounter++;
4600
alreadyListeningTo[mountAt[topListenersIDKey]] = {};
4601
}
4602
return alreadyListeningTo[mountAt[topListenersIDKey]];
4603
}
4604
4605
/**
4606
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
4607
* example:
4608
*
4609
* ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
4610
*
4611
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
4612
*
4613
* @internal
4614
*/
4615
var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
4616
4617
/**
4618
* Injectable event backend
4619
*/
4620
ReactEventListener: null,
4621
4622
injection: {
4623
/**
4624
* @param {object} ReactEventListener
4625
*/
4626
injectReactEventListener: function(ReactEventListener) {
4627
ReactEventListener.setHandleTopLevel(
4628
ReactBrowserEventEmitter.handleTopLevel
4629
);
4630
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
4631
}
4632
},
4633
4634
/**
4635
* Sets whether or not any created callbacks should be enabled.
4636
*
4637
* @param {boolean} enabled True if callbacks should be enabled.
4638
*/
4639
setEnabled: function(enabled) {
4640
if (ReactBrowserEventEmitter.ReactEventListener) {
4641
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
4642
}
4643
},
4644
4645
/**
4646
* @return {boolean} True if callbacks are enabled.
4647
*/
4648
isEnabled: function() {
4649
return !!(
4650
(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
4651
);
4652
},
4653
4654
/**
4655
* We listen for bubbled touch events on the document object.
4656
*
4657
* Firefox v8.01 (and possibly others) exhibited strange behavior when
4658
* mounting `onmousemove` events at some node that was not the document
4659
* element. The symptoms were that if your mouse is not moving over something
4660
* contained within that mount point (for example on the background) the
4661
* top-level listeners for `onmousemove` won't be called. However, if you
4662
* register the `mousemove` on the document object, then it will of course
4663
* catch all `mousemove`s. This along with iOS quirks, justifies restricting
4664
* top-level listeners to the document object only, at least for these
4665
* movement types of events and possibly all events.
4666
*
4667
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
4668
*
4669
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
4670
* they bubble to document.
4671
*
4672
* @param {string} registrationName Name of listener (e.g. `onClick`).
4673
* @param {object} contentDocumentHandle Document which owns the container
4674
*/
4675
listenTo: function(registrationName, contentDocumentHandle) {
4676
var mountAt = contentDocumentHandle;
4677
var isListening = getListeningForDocument(mountAt);
4678
var dependencies = EventPluginRegistry.
4679
registrationNameDependencies[registrationName];
4680
4681
var topLevelTypes = EventConstants.topLevelTypes;
4682
for (var i = 0, l = dependencies.length; i < l; i++) {
4683
var dependency = dependencies[i];
4684
if (!(
4685
(isListening.hasOwnProperty(dependency) && isListening[dependency])
4686
)) {
4687
if (dependency === topLevelTypes.topWheel) {
4688
if (isEventSupported('wheel')) {
4689
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4690
topLevelTypes.topWheel,
4691
'wheel',
4692
mountAt
4693
);
4694
} else if (isEventSupported('mousewheel')) {
4695
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4696
topLevelTypes.topWheel,
4697
'mousewheel',
4698
mountAt
4699
);
4700
} else {
4701
// Firefox needs to capture a different mouse scroll event.
4702
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
4703
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4704
topLevelTypes.topWheel,
4705
'DOMMouseScroll',
4706
mountAt
4707
);
4708
}
4709
} else if (dependency === topLevelTypes.topScroll) {
4710
4711
if (isEventSupported('scroll', true)) {
4712
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4713
topLevelTypes.topScroll,
4714
'scroll',
4715
mountAt
4716
);
4717
} else {
4718
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4719
topLevelTypes.topScroll,
4720
'scroll',
4721
ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
4722
);
4723
}
4724
} else if (dependency === topLevelTypes.topFocus ||
4725
dependency === topLevelTypes.topBlur) {
4726
4727
if (isEventSupported('focus', true)) {
4728
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4729
topLevelTypes.topFocus,
4730
'focus',
4731
mountAt
4732
);
4733
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4734
topLevelTypes.topBlur,
4735
'blur',
4736
mountAt
4737
);
4738
} else if (isEventSupported('focusin')) {
4739
// IE has `focusin` and `focusout` events which bubble.
4740
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
4741
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4742
topLevelTypes.topFocus,
4743
'focusin',
4744
mountAt
4745
);
4746
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4747
topLevelTypes.topBlur,
4748
'focusout',
4749
mountAt
4750
);
4751
}
4752
4753
// to make sure blur and focus event listeners are only attached once
4754
isListening[topLevelTypes.topBlur] = true;
4755
isListening[topLevelTypes.topFocus] = true;
4756
} else if (topEventMapping.hasOwnProperty(dependency)) {
4757
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4758
dependency,
4759
topEventMapping[dependency],
4760
mountAt
4761
);
4762
}
4763
4764
isListening[dependency] = true;
4765
}
4766
}
4767
},
4768
4769
trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
4770
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
4771
topLevelType,
4772
handlerBaseName,
4773
handle
4774
);
4775
},
4776
4777
trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
4778
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
4779
topLevelType,
4780
handlerBaseName,
4781
handle
4782
);
4783
},
4784
4785
/**
4786
* Listens to window scroll and resize events. We cache scroll values so that
4787
* application code can access them without triggering reflows.
4788
*
4789
* NOTE: Scroll events do not bubble.
4790
*
4791
* @see http://www.quirksmode.org/dom/events/scroll.html
4792
*/
4793
ensureScrollValueMonitoring: function() {
4794
if (!isMonitoringScrollValue) {
4795
var refresh = ViewportMetrics.refreshScrollValues;
4796
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
4797
isMonitoringScrollValue = true;
4798
}
4799
},
4800
4801
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
4802
4803
registrationNameModules: EventPluginHub.registrationNameModules,
4804
4805
putListener: EventPluginHub.putListener,
4806
4807
getListener: EventPluginHub.getListener,
4808
4809
deleteListener: EventPluginHub.deleteListener,
4810
4811
deleteAllListeners: EventPluginHub.deleteAllListeners
4812
4813
});
4814
4815
module.exports = ReactBrowserEventEmitter;
4816
4817
4818
},{"./EventConstants":15,"./EventPluginHub":17,"./EventPluginRegistry":18,"./Object.assign":27,"./ReactEventEmitterMixin":62,"./ViewportMetrics":105,"./isEventSupported":137}],32:[function(require,module,exports){
4819
/**
4820
* Copyright 2014-2015, Facebook, Inc.
4821
* All rights reserved.
4822
*
4823
* This source code is licensed under the BSD-style license found in the
4824
* LICENSE file in the root directory of this source tree. An additional grant
4825
* of patent rights can be found in the PATENTS file in the same directory.
4826
*
4827
* @providesModule ReactChildReconciler
4828
* @typechecks static-only
4829
*/
4830
4831
'use strict';
4832
4833
var ReactReconciler = require("./ReactReconciler");
4834
4835
var flattenChildren = require("./flattenChildren");
4836
var instantiateReactComponent = require("./instantiateReactComponent");
4837
var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
4838
4839
/**
4840
* ReactChildReconciler provides helpers for initializing or updating a set of
4841
* children. Its output is suitable for passing it onto ReactMultiChild which
4842
* does diffed reordering and insertion.
4843
*/
4844
var ReactChildReconciler = {
4845
4846
/**
4847
* Generates a "mount image" for each of the supplied children. In the case
4848
* of `ReactDOMComponent`, a mount image is a string of markup.
4849
*
4850
* @param {?object} nestedChildNodes Nested child maps.
4851
* @return {?object} A set of child instances.
4852
* @internal
4853
*/
4854
instantiateChildren: function(nestedChildNodes, transaction, context) {
4855
var children = flattenChildren(nestedChildNodes);
4856
for (var name in children) {
4857
if (children.hasOwnProperty(name)) {
4858
var child = children[name];
4859
// The rendered children must be turned into instances as they're
4860
// mounted.
4861
var childInstance = instantiateReactComponent(child, null);
4862
children[name] = childInstance;
4863
}
4864
}
4865
return children;
4866
},
4867
4868
/**
4869
* Updates the rendered children and returns a new set of children.
4870
*
4871
* @param {?object} prevChildren Previously initialized set of children.
4872
* @param {?object} nextNestedChildNodes Nested child maps.
4873
* @param {ReactReconcileTransaction} transaction
4874
* @param {object} context
4875
* @return {?object} A new set of child instances.
4876
* @internal
4877
*/
4878
updateChildren: function(
4879
prevChildren,
4880
nextNestedChildNodes,
4881
transaction,
4882
context) {
4883
// We currently don't have a way to track moves here but if we use iterators
4884
// instead of for..in we can zip the iterators and check if an item has
4885
// moved.
4886
// TODO: If nothing has changed, return the prevChildren object so that we
4887
// can quickly bailout if nothing has changed.
4888
var nextChildren = flattenChildren(nextNestedChildNodes);
4889
if (!nextChildren && !prevChildren) {
4890
return null;
4891
}
4892
var name;
4893
for (name in nextChildren) {
4894
if (!nextChildren.hasOwnProperty(name)) {
4895
continue;
4896
}
4897
var prevChild = prevChildren && prevChildren[name];
4898
var prevElement = prevChild && prevChild._currentElement;
4899
var nextElement = nextChildren[name];
4900
if (shouldUpdateReactComponent(prevElement, nextElement)) {
4901
ReactReconciler.receiveComponent(
4902
prevChild, nextElement, transaction, context
4903
);
4904
nextChildren[name] = prevChild;
4905
} else {
4906
if (prevChild) {
4907
ReactReconciler.unmountComponent(prevChild, name);
4908
}
4909
// The child must be instantiated before it's mounted.
4910
var nextChildInstance = instantiateReactComponent(
4911
nextElement,
4912
null
4913
);
4914
nextChildren[name] = nextChildInstance;
4915
}
4916
}
4917
// Unmount children that are no longer present.
4918
for (name in prevChildren) {
4919
if (prevChildren.hasOwnProperty(name) &&
4920
!(nextChildren && nextChildren.hasOwnProperty(name))) {
4921
ReactReconciler.unmountComponent(prevChildren[name]);
4922
}
4923
}
4924
return nextChildren;
4925
},
4926
4927
/**
4928
* Unmounts all rendered children. This should be used to clean up children
4929
* when this component is unmounted.
4930
*
4931
* @param {?object} renderedChildren Previously initialized set of children.
4932
* @internal
4933
*/
4934
unmountChildren: function(renderedChildren) {
4935
for (var name in renderedChildren) {
4936
var renderedChild = renderedChildren[name];
4937
ReactReconciler.unmountComponent(renderedChild);
4938
}
4939
}
4940
4941
};
4942
4943
module.exports = ReactChildReconciler;
4944
4945
4946
},{"./ReactReconciler":82,"./flattenChildren":119,"./instantiateReactComponent":135,"./shouldUpdateReactComponent":152}],33:[function(require,module,exports){
4947
(function (process){
4948
/**
4949
* Copyright 2013-2015, Facebook, Inc.
4950
* All rights reserved.
4951
*
4952
* This source code is licensed under the BSD-style license found in the
4953
* LICENSE file in the root directory of this source tree. An additional grant
4954
* of patent rights can be found in the PATENTS file in the same directory.
4955
*
4956
* @providesModule ReactChildren
4957
*/
4958
4959
'use strict';
4960
4961
var PooledClass = require("./PooledClass");
4962
var ReactFragment = require("./ReactFragment");
4963
4964
var traverseAllChildren = require("./traverseAllChildren");
4965
var warning = require("./warning");
4966
4967
var twoArgumentPooler = PooledClass.twoArgumentPooler;
4968
var threeArgumentPooler = PooledClass.threeArgumentPooler;
4969
4970
/**
4971
* PooledClass representing the bookkeeping associated with performing a child
4972
* traversal. Allows avoiding binding callbacks.
4973
*
4974
* @constructor ForEachBookKeeping
4975
* @param {!function} forEachFunction Function to perform traversal with.
4976
* @param {?*} forEachContext Context to perform context with.
4977
*/
4978
function ForEachBookKeeping(forEachFunction, forEachContext) {
4979
this.forEachFunction = forEachFunction;
4980
this.forEachContext = forEachContext;
4981
}
4982
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
4983
4984
function forEachSingleChild(traverseContext, child, name, i) {
4985
var forEachBookKeeping = traverseContext;
4986
forEachBookKeeping.forEachFunction.call(
4987
forEachBookKeeping.forEachContext, child, i);
4988
}
4989
4990
/**
4991
* Iterates through children that are typically specified as `props.children`.
4992
*
4993
* The provided forEachFunc(child, index) will be called for each
4994
* leaf child.
4995
*
4996
* @param {?*} children Children tree container.
4997
* @param {function(*, int)} forEachFunc.
4998
* @param {*} forEachContext Context for forEachContext.
4999
*/
5000
function forEachChildren(children, forEachFunc, forEachContext) {
5001
if (children == null) {
5002
return children;
5003
}
5004
5005
var traverseContext =
5006
ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
5007
traverseAllChildren(children, forEachSingleChild, traverseContext);
5008
ForEachBookKeeping.release(traverseContext);
5009
}
5010
5011
/**
5012
* PooledClass representing the bookkeeping associated with performing a child
5013
* mapping. Allows avoiding binding callbacks.
5014
*
5015
* @constructor MapBookKeeping
5016
* @param {!*} mapResult Object containing the ordered map of results.
5017
* @param {!function} mapFunction Function to perform mapping with.
5018
* @param {?*} mapContext Context to perform mapping with.
5019
*/
5020
function MapBookKeeping(mapResult, mapFunction, mapContext) {
5021
this.mapResult = mapResult;
5022
this.mapFunction = mapFunction;
5023
this.mapContext = mapContext;
5024
}
5025
PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
5026
5027
function mapSingleChildIntoContext(traverseContext, child, name, i) {
5028
var mapBookKeeping = traverseContext;
5029
var mapResult = mapBookKeeping.mapResult;
5030
5031
var keyUnique = !mapResult.hasOwnProperty(name);
5032
if ("production" !== process.env.NODE_ENV) {
5033
("production" !== process.env.NODE_ENV ? warning(
5034
keyUnique,
5035
'ReactChildren.map(...): Encountered two children with the same key, ' +
5036
'`%s`. Child keys must be unique; when two children share a key, only ' +
5037
'the first child will be used.',
5038
name
5039
) : null);
5040
}
5041
5042
if (keyUnique) {
5043
var mappedChild =
5044
mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
5045
mapResult[name] = mappedChild;
5046
}
5047
}
5048
5049
/**
5050
* Maps children that are typically specified as `props.children`.
5051
*
5052
* The provided mapFunction(child, key, index) will be called for each
5053
* leaf child.
5054
*
5055
* TODO: This may likely break any calls to `ReactChildren.map` that were
5056
* previously relying on the fact that we guarded against null children.
5057
*
5058
* @param {?*} children Children tree container.
5059
* @param {function(*, int)} mapFunction.
5060
* @param {*} mapContext Context for mapFunction.
5061
* @return {object} Object containing the ordered map of results.
5062
*/
5063
function mapChildren(children, func, context) {
5064
if (children == null) {
5065
return children;
5066
}
5067
5068
var mapResult = {};
5069
var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
5070
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
5071
MapBookKeeping.release(traverseContext);
5072
return ReactFragment.create(mapResult);
5073
}
5074
5075
function forEachSingleChildDummy(traverseContext, child, name, i) {
5076
return null;
5077
}
5078
5079
/**
5080
* Count the number of children that are typically specified as
5081
* `props.children`.
5082
*
5083
* @param {?*} children Children tree container.
5084
* @return {number} The number of children.
5085
*/
5086
function countChildren(children, context) {
5087
return traverseAllChildren(children, forEachSingleChildDummy, null);
5088
}
5089
5090
var ReactChildren = {
5091
forEach: forEachChildren,
5092
map: mapChildren,
5093
count: countChildren
5094
};
5095
5096
module.exports = ReactChildren;
5097
5098
5099
}).call(this,require("FWaASH"))
5100
},{"./PooledClass":28,"./ReactFragment":64,"./traverseAllChildren":154,"./warning":155,"FWaASH":1}],34:[function(require,module,exports){
5101
(function (process){
5102
/**
5103
* Copyright 2013-2015, Facebook, Inc.
5104
* All rights reserved.
5105
*
5106
* This source code is licensed under the BSD-style license found in the
5107
* LICENSE file in the root directory of this source tree. An additional grant
5108
* of patent rights can be found in the PATENTS file in the same directory.
5109
*
5110
* @providesModule ReactClass
5111
*/
5112
5113
'use strict';
5114
5115
var ReactComponent = require("./ReactComponent");
5116
var ReactCurrentOwner = require("./ReactCurrentOwner");
5117
var ReactElement = require("./ReactElement");
5118
var ReactErrorUtils = require("./ReactErrorUtils");
5119
var ReactInstanceMap = require("./ReactInstanceMap");
5120
var ReactLifeCycle = require("./ReactLifeCycle");
5121
var ReactPropTypeLocations = require("./ReactPropTypeLocations");
5122
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
5123
var ReactUpdateQueue = require("./ReactUpdateQueue");
5124
5125
var assign = require("./Object.assign");
5126
var invariant = require("./invariant");
5127
var keyMirror = require("./keyMirror");
5128
var keyOf = require("./keyOf");
5129
var warning = require("./warning");
5130
5131
var MIXINS_KEY = keyOf({mixins: null});
5132
5133
/**
5134
* Policies that describe methods in `ReactClassInterface`.
5135
*/
5136
var SpecPolicy = keyMirror({
5137
/**
5138
* These methods may be defined only once by the class specification or mixin.
5139
*/
5140
DEFINE_ONCE: null,
5141
/**
5142
* These methods may be defined by both the class specification and mixins.
5143
* Subsequent definitions will be chained. These methods must return void.
5144
*/
5145
DEFINE_MANY: null,
5146
/**
5147
* These methods are overriding the base class.
5148
*/
5149
OVERRIDE_BASE: null,
5150
/**
5151
* These methods are similar to DEFINE_MANY, except we assume they return
5152
* objects. We try to merge the keys of the return values of all the mixed in
5153
* functions. If there is a key conflict we throw.
5154
*/
5155
DEFINE_MANY_MERGED: null
5156
});
5157
5158
5159
var injectedMixins = [];
5160
5161
/**
5162
* Composite components are higher-level components that compose other composite
5163
* or native components.
5164
*
5165
* To create a new type of `ReactClass`, pass a specification of
5166
* your new class to `React.createClass`. The only requirement of your class
5167
* specification is that you implement a `render` method.
5168
*
5169
* var MyComponent = React.createClass({
5170
* render: function() {
5171
* return <div>Hello World</div>;
5172
* }
5173
* });
5174
*
5175
* The class specification supports a specific protocol of methods that have
5176
* special meaning (e.g. `render`). See `ReactClassInterface` for
5177
* more the comprehensive protocol. Any other properties and methods in the
5178
* class specification will available on the prototype.
5179
*
5180
* @interface ReactClassInterface
5181
* @internal
5182
*/
5183
var ReactClassInterface = {
5184
5185
/**
5186
* An array of Mixin objects to include when defining your component.
5187
*
5188
* @type {array}
5189
* @optional
5190
*/
5191
mixins: SpecPolicy.DEFINE_MANY,
5192
5193
/**
5194
* An object containing properties and methods that should be defined on
5195
* the component's constructor instead of its prototype (static methods).
5196
*
5197
* @type {object}
5198
* @optional
5199
*/
5200
statics: SpecPolicy.DEFINE_MANY,
5201
5202
/**
5203
* Definition of prop types for this component.
5204
*
5205
* @type {object}
5206
* @optional
5207
*/
5208
propTypes: SpecPolicy.DEFINE_MANY,
5209
5210
/**
5211
* Definition of context types for this component.
5212
*
5213
* @type {object}
5214
* @optional
5215
*/
5216
contextTypes: SpecPolicy.DEFINE_MANY,
5217
5218
/**
5219
* Definition of context types this component sets for its children.
5220
*
5221
* @type {object}
5222
* @optional
5223
*/
5224
childContextTypes: SpecPolicy.DEFINE_MANY,
5225
5226
// ==== Definition methods ====
5227
5228
/**
5229
* Invoked when the component is mounted. Values in the mapping will be set on
5230
* `this.props` if that prop is not specified (i.e. using an `in` check).
5231
*
5232
* This method is invoked before `getInitialState` and therefore cannot rely
5233
* on `this.state` or use `this.setState`.
5234
*
5235
* @return {object}
5236
* @optional
5237
*/
5238
getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
5239
5240
/**
5241
* Invoked once before the component is mounted. The return value will be used
5242
* as the initial value of `this.state`.
5243
*
5244
* getInitialState: function() {
5245
* return {
5246
* isOn: false,
5247
* fooBaz: new BazFoo()
5248
* }
5249
* }
5250
*
5251
* @return {object}
5252
* @optional
5253
*/
5254
getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
5255
5256
/**
5257
* @return {object}
5258
* @optional
5259
*/
5260
getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
5261
5262
/**
5263
* Uses props from `this.props` and state from `this.state` to render the
5264
* structure of the component.
5265
*
5266
* No guarantees are made about when or how often this method is invoked, so
5267
* it must not have side effects.
5268
*
5269
* render: function() {
5270
* var name = this.props.name;
5271
* return <div>Hello, {name}!</div>;
5272
* }
5273
*
5274
* @return {ReactComponent}
5275
* @nosideeffects
5276
* @required
5277
*/
5278
render: SpecPolicy.DEFINE_ONCE,
5279
5280
5281
5282
// ==== Delegate methods ====
5283
5284
/**
5285
* Invoked when the component is initially created and about to be mounted.
5286
* This may have side effects, but any external subscriptions or data created
5287
* by this method must be cleaned up in `componentWillUnmount`.
5288
*
5289
* @optional
5290
*/
5291
componentWillMount: SpecPolicy.DEFINE_MANY,
5292
5293
/**
5294
* Invoked when the component has been mounted and has a DOM representation.
5295
* However, there is no guarantee that the DOM node is in the document.
5296
*
5297
* Use this as an opportunity to operate on the DOM when the component has
5298
* been mounted (initialized and rendered) for the first time.
5299
*
5300
* @param {DOMElement} rootNode DOM element representing the component.
5301
* @optional
5302
*/
5303
componentDidMount: SpecPolicy.DEFINE_MANY,
5304
5305
/**
5306
* Invoked before the component receives new props.
5307
*
5308
* Use this as an opportunity to react to a prop transition by updating the
5309
* state using `this.setState`. Current props are accessed via `this.props`.
5310
*
5311
* componentWillReceiveProps: function(nextProps, nextContext) {
5312
* this.setState({
5313
* likesIncreasing: nextProps.likeCount > this.props.likeCount
5314
* });
5315
* }
5316
*
5317
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
5318
* transition may cause a state change, but the opposite is not true. If you
5319
* need it, you are probably looking for `componentWillUpdate`.
5320
*
5321
* @param {object} nextProps
5322
* @optional
5323
*/
5324
componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
5325
5326
/**
5327
* Invoked while deciding if the component should be updated as a result of
5328
* receiving new props, state and/or context.
5329
*
5330
* Use this as an opportunity to `return false` when you're certain that the
5331
* transition to the new props/state/context will not require a component
5332
* update.
5333
*
5334
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
5335
* return !equal(nextProps, this.props) ||
5336
* !equal(nextState, this.state) ||
5337
* !equal(nextContext, this.context);
5338
* }
5339
*
5340
* @param {object} nextProps
5341
* @param {?object} nextState
5342
* @param {?object} nextContext
5343
* @return {boolean} True if the component should update.
5344
* @optional
5345
*/
5346
shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
5347
5348
/**
5349
* Invoked when the component is about to update due to a transition from
5350
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
5351
* and `nextContext`.
5352
*
5353
* Use this as an opportunity to perform preparation before an update occurs.
5354
*
5355
* NOTE: You **cannot** use `this.setState()` in this method.
5356
*
5357
* @param {object} nextProps
5358
* @param {?object} nextState
5359
* @param {?object} nextContext
5360
* @param {ReactReconcileTransaction} transaction
5361
* @optional
5362
*/
5363
componentWillUpdate: SpecPolicy.DEFINE_MANY,
5364
5365
/**
5366
* Invoked when the component's DOM representation has been updated.
5367
*
5368
* Use this as an opportunity to operate on the DOM when the component has
5369
* been updated.
5370
*
5371
* @param {object} prevProps
5372
* @param {?object} prevState
5373
* @param {?object} prevContext
5374
* @param {DOMElement} rootNode DOM element representing the component.
5375
* @optional
5376
*/
5377
componentDidUpdate: SpecPolicy.DEFINE_MANY,
5378
5379
/**
5380
* Invoked when the component is about to be removed from its parent and have
5381
* its DOM representation destroyed.
5382
*
5383
* Use this as an opportunity to deallocate any external resources.
5384
*
5385
* NOTE: There is no `componentDidUnmount` since your component will have been
5386
* destroyed by that point.
5387
*
5388
* @optional
5389
*/
5390
componentWillUnmount: SpecPolicy.DEFINE_MANY,
5391
5392
5393
5394
// ==== Advanced methods ====
5395
5396
/**
5397
* Updates the component's currently mounted DOM representation.
5398
*
5399
* By default, this implements React's rendering and reconciliation algorithm.
5400
* Sophisticated clients may wish to override this.
5401
*
5402
* @param {ReactReconcileTransaction} transaction
5403
* @internal
5404
* @overridable
5405
*/
5406
updateComponent: SpecPolicy.OVERRIDE_BASE
5407
5408
};
5409
5410
/**
5411
* Mapping from class specification keys to special processing functions.
5412
*
5413
* Although these are declared like instance properties in the specification
5414
* when defining classes using `React.createClass`, they are actually static
5415
* and are accessible on the constructor instead of the prototype. Despite
5416
* being static, they must be defined outside of the "statics" key under
5417
* which all other static methods are defined.
5418
*/
5419
var RESERVED_SPEC_KEYS = {
5420
displayName: function(Constructor, displayName) {
5421
Constructor.displayName = displayName;
5422
},
5423
mixins: function(Constructor, mixins) {
5424
if (mixins) {
5425
for (var i = 0; i < mixins.length; i++) {
5426
mixSpecIntoComponent(Constructor, mixins[i]);
5427
}
5428
}
5429
},
5430
childContextTypes: function(Constructor, childContextTypes) {
5431
if ("production" !== process.env.NODE_ENV) {
5432
validateTypeDef(
5433
Constructor,
5434
childContextTypes,
5435
ReactPropTypeLocations.childContext
5436
);
5437
}
5438
Constructor.childContextTypes = assign(
5439
{},
5440
Constructor.childContextTypes,
5441
childContextTypes
5442
);
5443
},
5444
contextTypes: function(Constructor, contextTypes) {
5445
if ("production" !== process.env.NODE_ENV) {
5446
validateTypeDef(
5447
Constructor,
5448
contextTypes,
5449
ReactPropTypeLocations.context
5450
);
5451
}
5452
Constructor.contextTypes = assign(
5453
{},
5454
Constructor.contextTypes,
5455
contextTypes
5456
);
5457
},
5458
/**
5459
* Special case getDefaultProps which should move into statics but requires
5460
* automatic merging.
5461
*/
5462
getDefaultProps: function(Constructor, getDefaultProps) {
5463
if (Constructor.getDefaultProps) {
5464
Constructor.getDefaultProps = createMergedResultFunction(
5465
Constructor.getDefaultProps,
5466
getDefaultProps
5467
);
5468
} else {
5469
Constructor.getDefaultProps = getDefaultProps;
5470
}
5471
},
5472
propTypes: function(Constructor, propTypes) {
5473
if ("production" !== process.env.NODE_ENV) {
5474
validateTypeDef(
5475
Constructor,
5476
propTypes,
5477
ReactPropTypeLocations.prop
5478
);
5479
}
5480
Constructor.propTypes = assign(
5481
{},
5482
Constructor.propTypes,
5483
propTypes
5484
);
5485
},
5486
statics: function(Constructor, statics) {
5487
mixStaticSpecIntoComponent(Constructor, statics);
5488
}
5489
};
5490
5491
function validateTypeDef(Constructor, typeDef, location) {
5492
for (var propName in typeDef) {
5493
if (typeDef.hasOwnProperty(propName)) {
5494
// use a warning instead of an invariant so components
5495
// don't show up in prod but not in __DEV__
5496
("production" !== process.env.NODE_ENV ? warning(
5497
typeof typeDef[propName] === 'function',
5498
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
5499
'React.PropTypes.',
5500
Constructor.displayName || 'ReactClass',
5501
ReactPropTypeLocationNames[location],
5502
propName
5503
) : null);
5504
}
5505
}
5506
}
5507
5508
function validateMethodOverride(proto, name) {
5509
var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
5510
ReactClassInterface[name] :
5511
null;
5512
5513
// Disallow overriding of base class methods unless explicitly allowed.
5514
if (ReactClassMixin.hasOwnProperty(name)) {
5515
("production" !== process.env.NODE_ENV ? invariant(
5516
specPolicy === SpecPolicy.OVERRIDE_BASE,
5517
'ReactClassInterface: You are attempting to override ' +
5518
'`%s` from your class specification. Ensure that your method names ' +
5519
'do not overlap with React methods.',
5520
name
5521
) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
5522
}
5523
5524
// Disallow defining methods more than once unless explicitly allowed.
5525
if (proto.hasOwnProperty(name)) {
5526
("production" !== process.env.NODE_ENV ? invariant(
5527
specPolicy === SpecPolicy.DEFINE_MANY ||
5528
specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
5529
'ReactClassInterface: You are attempting to define ' +
5530
'`%s` on your component more than once. This conflict may be due ' +
5531
'to a mixin.',
5532
name
5533
) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
5534
specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
5535
}
5536
}
5537
5538
/**
5539
* Mixin helper which handles policy validation and reserved
5540
* specification keys when building React classses.
5541
*/
5542
function mixSpecIntoComponent(Constructor, spec) {
5543
if (!spec) {
5544
return;
5545
}
5546
5547
("production" !== process.env.NODE_ENV ? invariant(
5548
typeof spec !== 'function',
5549
'ReactClass: You\'re attempting to ' +
5550
'use a component class as a mixin. Instead, just use a regular object.'
5551
) : invariant(typeof spec !== 'function'));
5552
("production" !== process.env.NODE_ENV ? invariant(
5553
!ReactElement.isValidElement(spec),
5554
'ReactClass: You\'re attempting to ' +
5555
'use a component as a mixin. Instead, just use a regular object.'
5556
) : invariant(!ReactElement.isValidElement(spec)));
5557
5558
var proto = Constructor.prototype;
5559
5560
// By handling mixins before any other properties, we ensure the same
5561
// chaining order is applied to methods with DEFINE_MANY policy, whether
5562
// mixins are listed before or after these methods in the spec.
5563
if (spec.hasOwnProperty(MIXINS_KEY)) {
5564
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
5565
}
5566
5567
for (var name in spec) {
5568
if (!spec.hasOwnProperty(name)) {
5569
continue;
5570
}
5571
5572
if (name === MIXINS_KEY) {
5573
// We have already handled mixins in a special case above
5574
continue;
5575
}
5576
5577
var property = spec[name];
5578
validateMethodOverride(proto, name);
5579
5580
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
5581
RESERVED_SPEC_KEYS[name](Constructor, property);
5582
} else {
5583
// Setup methods on prototype:
5584
// The following member methods should not be automatically bound:
5585
// 1. Expected ReactClass methods (in the "interface").
5586
// 2. Overridden methods (that were mixed in).
5587
var isReactClassMethod =
5588
ReactClassInterface.hasOwnProperty(name);
5589
var isAlreadyDefined = proto.hasOwnProperty(name);
5590
var markedDontBind = property && property.__reactDontBind;
5591
var isFunction = typeof property === 'function';
5592
var shouldAutoBind =
5593
isFunction &&
5594
!isReactClassMethod &&
5595
!isAlreadyDefined &&
5596
!markedDontBind;
5597
5598
if (shouldAutoBind) {
5599
if (!proto.__reactAutoBindMap) {
5600
proto.__reactAutoBindMap = {};
5601
}
5602
proto.__reactAutoBindMap[name] = property;
5603
proto[name] = property;
5604
} else {
5605
if (isAlreadyDefined) {
5606
var specPolicy = ReactClassInterface[name];
5607
5608
// These cases should already be caught by validateMethodOverride
5609
("production" !== process.env.NODE_ENV ? invariant(
5610
isReactClassMethod && (
5611
(specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
5612
),
5613
'ReactClass: Unexpected spec policy %s for key %s ' +
5614
'when mixing in component specs.',
5615
specPolicy,
5616
name
5617
) : invariant(isReactClassMethod && (
5618
(specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
5619
)));
5620
5621
// For methods which are defined more than once, call the existing
5622
// methods before calling the new property, merging if appropriate.
5623
if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
5624
proto[name] = createMergedResultFunction(proto[name], property);
5625
} else if (specPolicy === SpecPolicy.DEFINE_MANY) {
5626
proto[name] = createChainedFunction(proto[name], property);
5627
}
5628
} else {
5629
proto[name] = property;
5630
if ("production" !== process.env.NODE_ENV) {
5631
// Add verbose displayName to the function, which helps when looking
5632
// at profiling tools.
5633
if (typeof property === 'function' && spec.displayName) {
5634
proto[name].displayName = spec.displayName + '_' + name;
5635
}
5636
}
5637
}
5638
}
5639
}
5640
}
5641
}
5642
5643
function mixStaticSpecIntoComponent(Constructor, statics) {
5644
if (!statics) {
5645
return;
5646
}
5647
for (var name in statics) {
5648
var property = statics[name];
5649
if (!statics.hasOwnProperty(name)) {
5650
continue;
5651
}
5652
5653
var isReserved = name in RESERVED_SPEC_KEYS;
5654
("production" !== process.env.NODE_ENV ? invariant(
5655
!isReserved,
5656
'ReactClass: You are attempting to define a reserved ' +
5657
'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
5658
'as an instance property instead; it will still be accessible on the ' +
5659
'constructor.',
5660
name
5661
) : invariant(!isReserved));
5662
5663
var isInherited = name in Constructor;
5664
("production" !== process.env.NODE_ENV ? invariant(
5665
!isInherited,
5666
'ReactClass: You are attempting to define ' +
5667
'`%s` on your component more than once. This conflict may be ' +
5668
'due to a mixin.',
5669
name
5670
) : invariant(!isInherited));
5671
Constructor[name] = property;
5672
}
5673
}
5674
5675
/**
5676
* Merge two objects, but throw if both contain the same key.
5677
*
5678
* @param {object} one The first object, which is mutated.
5679
* @param {object} two The second object
5680
* @return {object} one after it has been mutated to contain everything in two.
5681
*/
5682
function mergeIntoWithNoDuplicateKeys(one, two) {
5683
("production" !== process.env.NODE_ENV ? invariant(
5684
one && two && typeof one === 'object' && typeof two === 'object',
5685
'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
5686
) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
5687
5688
for (var key in two) {
5689
if (two.hasOwnProperty(key)) {
5690
("production" !== process.env.NODE_ENV ? invariant(
5691
one[key] === undefined,
5692
'mergeIntoWithNoDuplicateKeys(): ' +
5693
'Tried to merge two objects with the same key: `%s`. This conflict ' +
5694
'may be due to a mixin; in particular, this may be caused by two ' +
5695
'getInitialState() or getDefaultProps() methods returning objects ' +
5696
'with clashing keys.',
5697
key
5698
) : invariant(one[key] === undefined));
5699
one[key] = two[key];
5700
}
5701
}
5702
return one;
5703
}
5704
5705
/**
5706
* Creates a function that invokes two functions and merges their return values.
5707
*
5708
* @param {function} one Function to invoke first.
5709
* @param {function} two Function to invoke second.
5710
* @return {function} Function that invokes the two argument functions.
5711
* @private
5712
*/
5713
function createMergedResultFunction(one, two) {
5714
return function mergedResult() {
5715
var a = one.apply(this, arguments);
5716
var b = two.apply(this, arguments);
5717
if (a == null) {
5718
return b;
5719
} else if (b == null) {
5720
return a;
5721
}
5722
var c = {};
5723
mergeIntoWithNoDuplicateKeys(c, a);
5724
mergeIntoWithNoDuplicateKeys(c, b);
5725
return c;
5726
};
5727
}
5728
5729
/**
5730
* Creates a function that invokes two functions and ignores their return vales.
5731
*
5732
* @param {function} one Function to invoke first.
5733
* @param {function} two Function to invoke second.
5734
* @return {function} Function that invokes the two argument functions.
5735
* @private
5736
*/
5737
function createChainedFunction(one, two) {
5738
return function chainedFunction() {
5739
one.apply(this, arguments);
5740
two.apply(this, arguments);
5741
};
5742
}
5743
5744
/**
5745
* Binds a method to the component.
5746
*
5747
* @param {object} component Component whose method is going to be bound.
5748
* @param {function} method Method to be bound.
5749
* @return {function} The bound method.
5750
*/
5751
function bindAutoBindMethod(component, method) {
5752
var boundMethod = method.bind(component);
5753
if ("production" !== process.env.NODE_ENV) {
5754
boundMethod.__reactBoundContext = component;
5755
boundMethod.__reactBoundMethod = method;
5756
boundMethod.__reactBoundArguments = null;
5757
var componentName = component.constructor.displayName;
5758
var _bind = boundMethod.bind;
5759
/* eslint-disable block-scoped-var, no-undef */
5760
boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
5761
// User is trying to bind() an autobound method; we effectively will
5762
// ignore the value of "this" that the user is trying to use, so
5763
// let's warn.
5764
if (newThis !== component && newThis !== null) {
5765
("production" !== process.env.NODE_ENV ? warning(
5766
false,
5767
'bind(): React component methods may only be bound to the ' +
5768
'component instance. See %s',
5769
componentName
5770
) : null);
5771
} else if (!args.length) {
5772
("production" !== process.env.NODE_ENV ? warning(
5773
false,
5774
'bind(): You are binding a component method to the component. ' +
5775
'React does this for you automatically in a high-performance ' +
5776
'way, so you can safely remove this call. See %s',
5777
componentName
5778
) : null);
5779
return boundMethod;
5780
}
5781
var reboundMethod = _bind.apply(boundMethod, arguments);
5782
reboundMethod.__reactBoundContext = component;
5783
reboundMethod.__reactBoundMethod = method;
5784
reboundMethod.__reactBoundArguments = args;
5785
return reboundMethod;
5786
/* eslint-enable */
5787
};
5788
}
5789
return boundMethod;
5790
}
5791
5792
/**
5793
* Binds all auto-bound methods in a component.
5794
*
5795
* @param {object} component Component whose method is going to be bound.
5796
*/
5797
function bindAutoBindMethods(component) {
5798
for (var autoBindKey in component.__reactAutoBindMap) {
5799
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
5800
var method = component.__reactAutoBindMap[autoBindKey];
5801
component[autoBindKey] = bindAutoBindMethod(
5802
component,
5803
ReactErrorUtils.guard(
5804
method,
5805
component.constructor.displayName + '.' + autoBindKey
5806
)
5807
);
5808
}
5809
}
5810
}
5811
5812
var typeDeprecationDescriptor = {
5813
enumerable: false,
5814
get: function() {
5815
var displayName = this.displayName || this.name || 'Component';
5816
("production" !== process.env.NODE_ENV ? warning(
5817
false,
5818
'%s.type is deprecated. Use %s directly to access the class.',
5819
displayName,
5820
displayName
5821
) : null);
5822
Object.defineProperty(this, 'type', {
5823
value: this
5824
});
5825
return this;
5826
}
5827
};
5828
5829
/**
5830
* Add more to the ReactClass base class. These are all legacy features and
5831
* therefore not already part of the modern ReactComponent.
5832
*/
5833
var ReactClassMixin = {
5834
5835
/**
5836
* TODO: This will be deprecated because state should always keep a consistent
5837
* type signature and the only use case for this, is to avoid that.
5838
*/
5839
replaceState: function(newState, callback) {
5840
ReactUpdateQueue.enqueueReplaceState(this, newState);
5841
if (callback) {
5842
ReactUpdateQueue.enqueueCallback(this, callback);
5843
}
5844
},
5845
5846
/**
5847
* Checks whether or not this composite component is mounted.
5848
* @return {boolean} True if mounted, false otherwise.
5849
* @protected
5850
* @final
5851
*/
5852
isMounted: function() {
5853
if ("production" !== process.env.NODE_ENV) {
5854
var owner = ReactCurrentOwner.current;
5855
if (owner !== null) {
5856
("production" !== process.env.NODE_ENV ? warning(
5857
owner._warnedAboutRefsInRender,
5858
'%s is accessing isMounted inside its render() function. ' +
5859
'render() should be a pure function of props and state. It should ' +
5860
'never access something that requires stale data from the previous ' +
5861
'render, such as refs. Move this logic to componentDidMount and ' +
5862
'componentDidUpdate instead.',
5863
owner.getName() || 'A component'
5864
) : null);
5865
owner._warnedAboutRefsInRender = true;
5866
}
5867
}
5868
var internalInstance = ReactInstanceMap.get(this);
5869
return (
5870
internalInstance &&
5871
internalInstance !== ReactLifeCycle.currentlyMountingInstance
5872
);
5873
},
5874
5875
/**
5876
* Sets a subset of the props.
5877
*
5878
* @param {object} partialProps Subset of the next props.
5879
* @param {?function} callback Called after props are updated.
5880
* @final
5881
* @public
5882
* @deprecated
5883
*/
5884
setProps: function(partialProps, callback) {
5885
ReactUpdateQueue.enqueueSetProps(this, partialProps);
5886
if (callback) {
5887
ReactUpdateQueue.enqueueCallback(this, callback);
5888
}
5889
},
5890
5891
/**
5892
* Replace all the props.
5893
*
5894
* @param {object} newProps Subset of the next props.
5895
* @param {?function} callback Called after props are updated.
5896
* @final
5897
* @public
5898
* @deprecated
5899
*/
5900
replaceProps: function(newProps, callback) {
5901
ReactUpdateQueue.enqueueReplaceProps(this, newProps);
5902
if (callback) {
5903
ReactUpdateQueue.enqueueCallback(this, callback);
5904
}
5905
}
5906
};
5907
5908
var ReactClassComponent = function() {};
5909
assign(
5910
ReactClassComponent.prototype,
5911
ReactComponent.prototype,
5912
ReactClassMixin
5913
);
5914
5915
/**
5916
* Module for creating composite components.
5917
*
5918
* @class ReactClass
5919
*/
5920
var ReactClass = {
5921
5922
/**
5923
* Creates a composite component class given a class specification.
5924
*
5925
* @param {object} spec Class specification (which must define `render`).
5926
* @return {function} Component constructor function.
5927
* @public
5928
*/
5929
createClass: function(spec) {
5930
var Constructor = function(props, context) {
5931
// This constructor is overridden by mocks. The argument is used
5932
// by mocks to assert on what gets mounted.
5933
5934
if ("production" !== process.env.NODE_ENV) {
5935
("production" !== process.env.NODE_ENV ? warning(
5936
this instanceof Constructor,
5937
'Something is calling a React component directly. Use a factory or ' +
5938
'JSX instead. See: http://fb.me/react-legacyfactory'
5939
) : null);
5940
}
5941
5942
// Wire up auto-binding
5943
if (this.__reactAutoBindMap) {
5944
bindAutoBindMethods(this);
5945
}
5946
5947
this.props = props;
5948
this.context = context;
5949
this.state = null;
5950
5951
// ReactClasses doesn't have constructors. Instead, they use the
5952
// getInitialState and componentWillMount methods for initialization.
5953
5954
var initialState = this.getInitialState ? this.getInitialState() : null;
5955
if ("production" !== process.env.NODE_ENV) {
5956
// We allow auto-mocks to proceed as if they're returning null.
5957
if (typeof initialState === 'undefined' &&
5958
this.getInitialState._isMockFunction) {
5959
// This is probably bad practice. Consider warning here and
5960
// deprecating this convenience.
5961
initialState = null;
5962
}
5963
}
5964
("production" !== process.env.NODE_ENV ? invariant(
5965
typeof initialState === 'object' && !Array.isArray(initialState),
5966
'%s.getInitialState(): must return an object or null',
5967
Constructor.displayName || 'ReactCompositeComponent'
5968
) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
5969
5970
this.state = initialState;
5971
};
5972
Constructor.prototype = new ReactClassComponent();
5973
Constructor.prototype.constructor = Constructor;
5974
5975
injectedMixins.forEach(
5976
mixSpecIntoComponent.bind(null, Constructor)
5977
);
5978
5979
mixSpecIntoComponent(Constructor, spec);
5980
5981
// Initialize the defaultProps property after all mixins have been merged
5982
if (Constructor.getDefaultProps) {
5983
Constructor.defaultProps = Constructor.getDefaultProps();
5984
}
5985
5986
if ("production" !== process.env.NODE_ENV) {
5987
// This is a tag to indicate that the use of these method names is ok,
5988
// since it's used with createClass. If it's not, then it's likely a
5989
// mistake so we'll warn you to use the static property, property
5990
// initializer or constructor respectively.
5991
if (Constructor.getDefaultProps) {
5992
Constructor.getDefaultProps.isReactClassApproved = {};
5993
}
5994
if (Constructor.prototype.getInitialState) {
5995
Constructor.prototype.getInitialState.isReactClassApproved = {};
5996
}
5997
}
5998
5999
("production" !== process.env.NODE_ENV ? invariant(
6000
Constructor.prototype.render,
6001
'createClass(...): Class specification must implement a `render` method.'
6002
) : invariant(Constructor.prototype.render));
6003
6004
if ("production" !== process.env.NODE_ENV) {
6005
("production" !== process.env.NODE_ENV ? warning(
6006
!Constructor.prototype.componentShouldUpdate,
6007
'%s has a method called ' +
6008
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
6009
'The name is phrased as a question because the function is ' +
6010
'expected to return a value.',
6011
spec.displayName || 'A component'
6012
) : null);
6013
}
6014
6015
// Reduce time spent doing lookups by setting these on the prototype.
6016
for (var methodName in ReactClassInterface) {
6017
if (!Constructor.prototype[methodName]) {
6018
Constructor.prototype[methodName] = null;
6019
}
6020
}
6021
6022
// Legacy hook
6023
Constructor.type = Constructor;
6024
if ("production" !== process.env.NODE_ENV) {
6025
try {
6026
Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
6027
} catch (x) {
6028
// IE will fail on defineProperty (es5-shim/sham too)
6029
}
6030
}
6031
6032
return Constructor;
6033
},
6034
6035
injection: {
6036
injectMixin: function(mixin) {
6037
injectedMixins.push(mixin);
6038
}
6039
}
6040
6041
};
6042
6043
module.exports = ReactClass;
6044
6045
6046
}).call(this,require("FWaASH"))
6047
},{"./Object.assign":27,"./ReactComponent":35,"./ReactCurrentOwner":40,"./ReactElement":58,"./ReactErrorUtils":61,"./ReactInstanceMap":68,"./ReactLifeCycle":69,"./ReactPropTypeLocationNames":77,"./ReactPropTypeLocations":78,"./ReactUpdateQueue":87,"./invariant":136,"./keyMirror":141,"./keyOf":142,"./warning":155,"FWaASH":1}],35:[function(require,module,exports){
6048
(function (process){
6049
/**
6050
* Copyright 2013-2015, Facebook, Inc.
6051
* All rights reserved.
6052
*
6053
* This source code is licensed under the BSD-style license found in the
6054
* LICENSE file in the root directory of this source tree. An additional grant
6055
* of patent rights can be found in the PATENTS file in the same directory.
6056
*
6057
* @providesModule ReactComponent
6058
*/
6059
6060
'use strict';
6061
6062
var ReactUpdateQueue = require("./ReactUpdateQueue");
6063
6064
var invariant = require("./invariant");
6065
var warning = require("./warning");
6066
6067
/**
6068
* Base class helpers for the updating state of a component.
6069
*/
6070
function ReactComponent(props, context) {
6071
this.props = props;
6072
this.context = context;
6073
}
6074
6075
/**
6076
* Sets a subset of the state. Always use this to mutate
6077
* state. You should treat `this.state` as immutable.
6078
*
6079
* There is no guarantee that `this.state` will be immediately updated, so
6080
* accessing `this.state` after calling this method may return the old value.
6081
*
6082
* There is no guarantee that calls to `setState` will run synchronously,
6083
* as they may eventually be batched together. You can provide an optional
6084
* callback that will be executed when the call to setState is actually
6085
* completed.
6086
*
6087
* When a function is provided to setState, it will be called at some point in
6088
* the future (not synchronously). It will be called with the up to date
6089
* component arguments (state, props, context). These values can be different
6090
* from this.* because your function may be called after receiveProps but before
6091
* shouldComponentUpdate, and this new state, props, and context will not yet be
6092
* assigned to this.
6093
*
6094
* @param {object|function} partialState Next partial state or function to
6095
* produce next partial state to be merged with current state.
6096
* @param {?function} callback Called after state is updated.
6097
* @final
6098
* @protected
6099
*/
6100
ReactComponent.prototype.setState = function(partialState, callback) {
6101
("production" !== process.env.NODE_ENV ? invariant(
6102
typeof partialState === 'object' ||
6103
typeof partialState === 'function' ||
6104
partialState == null,
6105
'setState(...): takes an object of state variables to update or a ' +
6106
'function which returns an object of state variables.'
6107
) : invariant(typeof partialState === 'object' ||
6108
typeof partialState === 'function' ||
6109
partialState == null));
6110
if ("production" !== process.env.NODE_ENV) {
6111
("production" !== process.env.NODE_ENV ? warning(
6112
partialState != null,
6113
'setState(...): You passed an undefined or null state object; ' +
6114
'instead, use forceUpdate().'
6115
) : null);
6116
}
6117
ReactUpdateQueue.enqueueSetState(this, partialState);
6118
if (callback) {
6119
ReactUpdateQueue.enqueueCallback(this, callback);
6120
}
6121
};
6122
6123
/**
6124
* Forces an update. This should only be invoked when it is known with
6125
* certainty that we are **not** in a DOM transaction.
6126
*
6127
* You may want to call this when you know that some deeper aspect of the
6128
* component's state has changed but `setState` was not called.
6129
*
6130
* This will not invoke `shouldUpdateComponent`, but it will invoke
6131
* `componentWillUpdate` and `componentDidUpdate`.
6132
*
6133
* @param {?function} callback Called after update is complete.
6134
* @final
6135
* @protected
6136
*/
6137
ReactComponent.prototype.forceUpdate = function(callback) {
6138
ReactUpdateQueue.enqueueForceUpdate(this);
6139
if (callback) {
6140
ReactUpdateQueue.enqueueCallback(this, callback);
6141
}
6142
};
6143
6144
/**
6145
* Deprecated APIs. These APIs used to exist on classic React classes but since
6146
* we would like to deprecate them, we're not going to move them over to this
6147
* modern base class. Instead, we define a getter that warns if it's accessed.
6148
*/
6149
if ("production" !== process.env.NODE_ENV) {
6150
var deprecatedAPIs = {
6151
getDOMNode: 'getDOMNode',
6152
isMounted: 'isMounted',
6153
replaceState: 'replaceState',
6154
setProps: 'setProps'
6155
};
6156
var defineDeprecationWarning = function(methodName, displayName) {
6157
try {
6158
Object.defineProperty(ReactComponent.prototype, methodName, {
6159
get: function() {
6160
("production" !== process.env.NODE_ENV ? warning(
6161
false,
6162
'%s(...) is deprecated in plain JavaScript React classes.',
6163
displayName
6164
) : null);
6165
return undefined;
6166
}
6167
});
6168
} catch (x) {
6169
// IE will fail on defineProperty (es5-shim/sham too)
6170
}
6171
};
6172
for (var fnName in deprecatedAPIs) {
6173
if (deprecatedAPIs.hasOwnProperty(fnName)) {
6174
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
6175
}
6176
}
6177
}
6178
6179
module.exports = ReactComponent;
6180
6181
6182
}).call(this,require("FWaASH"))
6183
},{"./ReactUpdateQueue":87,"./invariant":136,"./warning":155,"FWaASH":1}],36:[function(require,module,exports){
6184
/**
6185
* Copyright 2013-2015, Facebook, Inc.
6186
* All rights reserved.
6187
*
6188
* This source code is licensed under the BSD-style license found in the
6189
* LICENSE file in the root directory of this source tree. An additional grant
6190
* of patent rights can be found in the PATENTS file in the same directory.
6191
*
6192
* @providesModule ReactComponentBrowserEnvironment
6193
*/
6194
6195
/*jslint evil: true */
6196
6197
'use strict';
6198
6199
var ReactDOMIDOperations = require("./ReactDOMIDOperations");
6200
var ReactMount = require("./ReactMount");
6201
6202
/**
6203
* Abstracts away all functionality of the reconciler that requires knowledge of
6204
* the browser context. TODO: These callers should be refactored to avoid the
6205
* need for this injection.
6206
*/
6207
var ReactComponentBrowserEnvironment = {
6208
6209
processChildrenUpdates:
6210
ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
6211
6212
replaceNodeWithMarkupByID:
6213
ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
6214
6215
/**
6216
* If a particular environment requires that some resources be cleaned up,
6217
* specify this in the injected Mixin. In the DOM, we would likely want to
6218
* purge any cached node ID lookups.
6219
*
6220
* @private
6221
*/
6222
unmountIDFromEnvironment: function(rootNodeID) {
6223
ReactMount.purgeID(rootNodeID);
6224
}
6225
6226
};
6227
6228
module.exports = ReactComponentBrowserEnvironment;
6229
6230
6231
},{"./ReactDOMIDOperations":45,"./ReactMount":71}],37:[function(require,module,exports){
6232
(function (process){
6233
/**
6234
* Copyright 2014-2015, Facebook, Inc.
6235
* All rights reserved.
6236
*
6237
* This source code is licensed under the BSD-style license found in the
6238
* LICENSE file in the root directory of this source tree. An additional grant
6239
* of patent rights can be found in the PATENTS file in the same directory.
6240
*
6241
* @providesModule ReactComponentEnvironment
6242
*/
6243
6244
'use strict';
6245
6246
var invariant = require("./invariant");
6247
6248
var injected = false;
6249
6250
var ReactComponentEnvironment = {
6251
6252
/**
6253
* Optionally injectable environment dependent cleanup hook. (server vs.
6254
* browser etc). Example: A browser system caches DOM nodes based on component
6255
* ID and must remove that cache entry when this instance is unmounted.
6256
*/
6257
unmountIDFromEnvironment: null,
6258
6259
/**
6260
* Optionally injectable hook for swapping out mount images in the middle of
6261
* the tree.
6262
*/
6263
replaceNodeWithMarkupByID: null,
6264
6265
/**
6266
* Optionally injectable hook for processing a queue of child updates. Will
6267
* later move into MultiChildComponents.
6268
*/
6269
processChildrenUpdates: null,
6270
6271
injection: {
6272
injectEnvironment: function(environment) {
6273
("production" !== process.env.NODE_ENV ? invariant(
6274
!injected,
6275
'ReactCompositeComponent: injectEnvironment() can only be called once.'
6276
) : invariant(!injected));
6277
ReactComponentEnvironment.unmountIDFromEnvironment =
6278
environment.unmountIDFromEnvironment;
6279
ReactComponentEnvironment.replaceNodeWithMarkupByID =
6280
environment.replaceNodeWithMarkupByID;
6281
ReactComponentEnvironment.processChildrenUpdates =
6282
environment.processChildrenUpdates;
6283
injected = true;
6284
}
6285
}
6286
6287
};
6288
6289
module.exports = ReactComponentEnvironment;
6290
6291
6292
}).call(this,require("FWaASH"))
6293
},{"./invariant":136,"FWaASH":1}],38:[function(require,module,exports){
6294
(function (process){
6295
/**
6296
* Copyright 2013-2015, Facebook, Inc.
6297
* All rights reserved.
6298
*
6299
* This source code is licensed under the BSD-style license found in the
6300
* LICENSE file in the root directory of this source tree. An additional grant
6301
* of patent rights can be found in the PATENTS file in the same directory.
6302
*
6303
* @providesModule ReactCompositeComponent
6304
*/
6305
6306
'use strict';
6307
6308
var ReactComponentEnvironment = require("./ReactComponentEnvironment");
6309
var ReactContext = require("./ReactContext");
6310
var ReactCurrentOwner = require("./ReactCurrentOwner");
6311
var ReactElement = require("./ReactElement");
6312
var ReactElementValidator = require("./ReactElementValidator");
6313
var ReactInstanceMap = require("./ReactInstanceMap");
6314
var ReactLifeCycle = require("./ReactLifeCycle");
6315
var ReactNativeComponent = require("./ReactNativeComponent");
6316
var ReactPerf = require("./ReactPerf");
6317
var ReactPropTypeLocations = require("./ReactPropTypeLocations");
6318
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
6319
var ReactReconciler = require("./ReactReconciler");
6320
var ReactUpdates = require("./ReactUpdates");
6321
6322
var assign = require("./Object.assign");
6323
var emptyObject = require("./emptyObject");
6324
var invariant = require("./invariant");
6325
var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
6326
var warning = require("./warning");
6327
6328
function getDeclarationErrorAddendum(component) {
6329
var owner = component._currentElement._owner || null;
6330
if (owner) {
6331
var name = owner.getName();
6332
if (name) {
6333
return ' Check the render method of `' + name + '`.';
6334
}
6335
}
6336
return '';
6337
}
6338
6339
/**
6340
* ------------------ The Life-Cycle of a Composite Component ------------------
6341
*
6342
* - constructor: Initialization of state. The instance is now retained.
6343
* - componentWillMount
6344
* - render
6345
* - [children's constructors]
6346
* - [children's componentWillMount and render]
6347
* - [children's componentDidMount]
6348
* - componentDidMount
6349
*
6350
* Update Phases:
6351
* - componentWillReceiveProps (only called if parent updated)
6352
* - shouldComponentUpdate
6353
* - componentWillUpdate
6354
* - render
6355
* - [children's constructors or receive props phases]
6356
* - componentDidUpdate
6357
*
6358
* - componentWillUnmount
6359
* - [children's componentWillUnmount]
6360
* - [children destroyed]
6361
* - (destroyed): The instance is now blank, released by React and ready for GC.
6362
*
6363
* -----------------------------------------------------------------------------
6364
*/
6365
6366
/**
6367
* An incrementing ID assigned to each component when it is mounted. This is
6368
* used to enforce the order in which `ReactUpdates` updates dirty components.
6369
*
6370
* @private
6371
*/
6372
var nextMountID = 1;
6373
6374
/**
6375
* @lends {ReactCompositeComponent.prototype}
6376
*/
6377
var ReactCompositeComponentMixin = {
6378
6379
/**
6380
* Base constructor for all composite component.
6381
*
6382
* @param {ReactElement} element
6383
* @final
6384
* @internal
6385
*/
6386
construct: function(element) {
6387
this._currentElement = element;
6388
this._rootNodeID = null;
6389
this._instance = null;
6390
6391
// See ReactUpdateQueue
6392
this._pendingElement = null;
6393
this._pendingStateQueue = null;
6394
this._pendingReplaceState = false;
6395
this._pendingForceUpdate = false;
6396
6397
this._renderedComponent = null;
6398
6399
this._context = null;
6400
this._mountOrder = 0;
6401
this._isTopLevel = false;
6402
6403
// See ReactUpdates and ReactUpdateQueue.
6404
this._pendingCallbacks = null;
6405
},
6406
6407
/**
6408
* Initializes the component, renders markup, and registers event listeners.
6409
*
6410
* @param {string} rootID DOM ID of the root node.
6411
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
6412
* @return {?string} Rendered markup to be inserted into the DOM.
6413
* @final
6414
* @internal
6415
*/
6416
mountComponent: function(rootID, transaction, context) {
6417
this._context = context;
6418
this._mountOrder = nextMountID++;
6419
this._rootNodeID = rootID;
6420
6421
var publicProps = this._processProps(this._currentElement.props);
6422
var publicContext = this._processContext(this._currentElement._context);
6423
6424
var Component = ReactNativeComponent.getComponentClassForElement(
6425
this._currentElement
6426
);
6427
6428
// Initialize the public class
6429
var inst = new Component(publicProps, publicContext);
6430
// These should be set up in the constructor, but as a convenience for
6431
// simpler class abstractions, we set them up after the fact.
6432
inst.props = publicProps;
6433
inst.context = publicContext;
6434
inst.refs = emptyObject;
6435
6436
this._instance = inst;
6437
6438
// Store a reference from the instance back to the internal representation
6439
ReactInstanceMap.set(inst, this);
6440
6441
if ("production" !== process.env.NODE_ENV) {
6442
this._warnIfContextsDiffer(this._currentElement._context, context);
6443
}
6444
6445
if ("production" !== process.env.NODE_ENV) {
6446
// Since plain JS classes are defined without any special initialization
6447
// logic, we can not catch common errors early. Therefore, we have to
6448
// catch them here, at initialization time, instead.
6449
("production" !== process.env.NODE_ENV ? warning(
6450
!inst.getInitialState ||
6451
inst.getInitialState.isReactClassApproved,
6452
'getInitialState was defined on %s, a plain JavaScript class. ' +
6453
'This is only supported for classes created using React.createClass. ' +
6454
'Did you mean to define a state property instead?',
6455
this.getName() || 'a component'
6456
) : null);
6457
("production" !== process.env.NODE_ENV ? warning(
6458
!inst.propTypes,
6459
'propTypes was defined as an instance property on %s. Use a static ' +
6460
'property to define propTypes instead.',
6461
this.getName() || 'a component'
6462
) : null);
6463
("production" !== process.env.NODE_ENV ? warning(
6464
!inst.contextTypes,
6465
'contextTypes was defined as an instance property on %s. Use a ' +
6466
'static property to define contextTypes instead.',
6467
this.getName() || 'a component'
6468
) : null);
6469
("production" !== process.env.NODE_ENV ? warning(
6470
typeof inst.componentShouldUpdate !== 'function',
6471
'%s has a method called ' +
6472
'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
6473
'The name is phrased as a question because the function is ' +
6474
'expected to return a value.',
6475
(this.getName() || 'A component')
6476
) : null);
6477
}
6478
6479
var initialState = inst.state;
6480
if (initialState === undefined) {
6481
inst.state = initialState = null;
6482
}
6483
("production" !== process.env.NODE_ENV ? invariant(
6484
typeof initialState === 'object' && !Array.isArray(initialState),
6485
'%s.state: must be set to an object or null',
6486
this.getName() || 'ReactCompositeComponent'
6487
) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
6488
6489
this._pendingStateQueue = null;
6490
this._pendingReplaceState = false;
6491
this._pendingForceUpdate = false;
6492
6493
var renderedElement;
6494
6495
var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
6496
ReactLifeCycle.currentlyMountingInstance = this;
6497
try {
6498
if (inst.componentWillMount) {
6499
inst.componentWillMount();
6500
// When mounting, calls to `setState` by `componentWillMount` will set
6501
// `this._pendingStateQueue` without triggering a re-render.
6502
if (this._pendingStateQueue) {
6503
inst.state = this._processPendingState(inst.props, inst.context);
6504
}
6505
}
6506
6507
renderedElement = this._renderValidatedComponent();
6508
} finally {
6509
ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
6510
}
6511
6512
this._renderedComponent = this._instantiateReactComponent(
6513
renderedElement,
6514
this._currentElement.type // The wrapping type
6515
);
6516
6517
var markup = ReactReconciler.mountComponent(
6518
this._renderedComponent,
6519
rootID,
6520
transaction,
6521
this._processChildContext(context)
6522
);
6523
if (inst.componentDidMount) {
6524
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
6525
}
6526
6527
return markup;
6528
},
6529
6530
/**
6531
* Releases any resources allocated by `mountComponent`.
6532
*
6533
* @final
6534
* @internal
6535
*/
6536
unmountComponent: function() {
6537
var inst = this._instance;
6538
6539
if (inst.componentWillUnmount) {
6540
var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
6541
ReactLifeCycle.currentlyUnmountingInstance = this;
6542
try {
6543
inst.componentWillUnmount();
6544
} finally {
6545
ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
6546
}
6547
}
6548
6549
ReactReconciler.unmountComponent(this._renderedComponent);
6550
this._renderedComponent = null;
6551
6552
// Reset pending fields
6553
this._pendingStateQueue = null;
6554
this._pendingReplaceState = false;
6555
this._pendingForceUpdate = false;
6556
this._pendingCallbacks = null;
6557
this._pendingElement = null;
6558
6559
// These fields do not really need to be reset since this object is no
6560
// longer accessible.
6561
this._context = null;
6562
this._rootNodeID = null;
6563
6564
// Delete the reference from the instance to this internal representation
6565
// which allow the internals to be properly cleaned up even if the user
6566
// leaks a reference to the public instance.
6567
ReactInstanceMap.remove(inst);
6568
6569
// Some existing components rely on inst.props even after they've been
6570
// destroyed (in event handlers).
6571
// TODO: inst.props = null;
6572
// TODO: inst.state = null;
6573
// TODO: inst.context = null;
6574
},
6575
6576
/**
6577
* Schedule a partial update to the props. Only used for internal testing.
6578
*
6579
* @param {object} partialProps Subset of the next props.
6580
* @param {?function} callback Called after props are updated.
6581
* @final
6582
* @internal
6583
*/
6584
_setPropsInternal: function(partialProps, callback) {
6585
// This is a deoptimized path. We optimize for always having an element.
6586
// This creates an extra internal element.
6587
var element = this._pendingElement || this._currentElement;
6588
this._pendingElement = ReactElement.cloneAndReplaceProps(
6589
element,
6590
assign({}, element.props, partialProps)
6591
);
6592
ReactUpdates.enqueueUpdate(this, callback);
6593
},
6594
6595
/**
6596
* Filters the context object to only contain keys specified in
6597
* `contextTypes`
6598
*
6599
* @param {object} context
6600
* @return {?object}
6601
* @private
6602
*/
6603
_maskContext: function(context) {
6604
var maskedContext = null;
6605
// This really should be getting the component class for the element,
6606
// but we know that we're not going to need it for built-ins.
6607
if (typeof this._currentElement.type === 'string') {
6608
return emptyObject;
6609
}
6610
var contextTypes = this._currentElement.type.contextTypes;
6611
if (!contextTypes) {
6612
return emptyObject;
6613
}
6614
maskedContext = {};
6615
for (var contextName in contextTypes) {
6616
maskedContext[contextName] = context[contextName];
6617
}
6618
return maskedContext;
6619
},
6620
6621
/**
6622
* Filters the context object to only contain keys specified in
6623
* `contextTypes`, and asserts that they are valid.
6624
*
6625
* @param {object} context
6626
* @return {?object}
6627
* @private
6628
*/
6629
_processContext: function(context) {
6630
var maskedContext = this._maskContext(context);
6631
if ("production" !== process.env.NODE_ENV) {
6632
var Component = ReactNativeComponent.getComponentClassForElement(
6633
this._currentElement
6634
);
6635
if (Component.contextTypes) {
6636
this._checkPropTypes(
6637
Component.contextTypes,
6638
maskedContext,
6639
ReactPropTypeLocations.context
6640
);
6641
}
6642
}
6643
return maskedContext;
6644
},
6645
6646
/**
6647
* @param {object} currentContext
6648
* @return {object}
6649
* @private
6650
*/
6651
_processChildContext: function(currentContext) {
6652
var inst = this._instance;
6653
var childContext = inst.getChildContext && inst.getChildContext();
6654
if (childContext) {
6655
("production" !== process.env.NODE_ENV ? invariant(
6656
typeof inst.constructor.childContextTypes === 'object',
6657
'%s.getChildContext(): childContextTypes must be defined in order to ' +
6658
'use getChildContext().',
6659
this.getName() || 'ReactCompositeComponent'
6660
) : invariant(typeof inst.constructor.childContextTypes === 'object'));
6661
if ("production" !== process.env.NODE_ENV) {
6662
this._checkPropTypes(
6663
inst.constructor.childContextTypes,
6664
childContext,
6665
ReactPropTypeLocations.childContext
6666
);
6667
}
6668
for (var name in childContext) {
6669
("production" !== process.env.NODE_ENV ? invariant(
6670
name in inst.constructor.childContextTypes,
6671
'%s.getChildContext(): key "%s" is not defined in childContextTypes.',
6672
this.getName() || 'ReactCompositeComponent',
6673
name
6674
) : invariant(name in inst.constructor.childContextTypes));
6675
}
6676
return assign({}, currentContext, childContext);
6677
}
6678
return currentContext;
6679
},
6680
6681
/**
6682
* Processes props by setting default values for unspecified props and
6683
* asserting that the props are valid. Does not mutate its argument; returns
6684
* a new props object with defaults merged in.
6685
*
6686
* @param {object} newProps
6687
* @return {object}
6688
* @private
6689
*/
6690
_processProps: function(newProps) {
6691
if ("production" !== process.env.NODE_ENV) {
6692
var Component = ReactNativeComponent.getComponentClassForElement(
6693
this._currentElement
6694
);
6695
if (Component.propTypes) {
6696
this._checkPropTypes(
6697
Component.propTypes,
6698
newProps,
6699
ReactPropTypeLocations.prop
6700
);
6701
}
6702
}
6703
return newProps;
6704
},
6705
6706
/**
6707
* Assert that the props are valid
6708
*
6709
* @param {object} propTypes Map of prop name to a ReactPropType
6710
* @param {object} props
6711
* @param {string} location e.g. "prop", "context", "child context"
6712
* @private
6713
*/
6714
_checkPropTypes: function(propTypes, props, location) {
6715
// TODO: Stop validating prop types here and only use the element
6716
// validation.
6717
var componentName = this.getName();
6718
for (var propName in propTypes) {
6719
if (propTypes.hasOwnProperty(propName)) {
6720
var error;
6721
try {
6722
// This is intentionally an invariant that gets caught. It's the same
6723
// behavior as without this statement except with a better message.
6724
("production" !== process.env.NODE_ENV ? invariant(
6725
typeof propTypes[propName] === 'function',
6726
'%s: %s type `%s` is invalid; it must be a function, usually ' +
6727
'from React.PropTypes.',
6728
componentName || 'React class',
6729
ReactPropTypeLocationNames[location],
6730
propName
6731
) : invariant(typeof propTypes[propName] === 'function'));
6732
error = propTypes[propName](props, propName, componentName, location);
6733
} catch (ex) {
6734
error = ex;
6735
}
6736
if (error instanceof Error) {
6737
// We may want to extend this logic for similar errors in
6738
// React.render calls, so I'm abstracting it away into
6739
// a function to minimize refactoring in the future
6740
var addendum = getDeclarationErrorAddendum(this);
6741
6742
if (location === ReactPropTypeLocations.prop) {
6743
// Preface gives us something to blacklist in warning module
6744
("production" !== process.env.NODE_ENV ? warning(
6745
false,
6746
'Failed Composite propType: %s%s',
6747
error.message,
6748
addendum
6749
) : null);
6750
} else {
6751
("production" !== process.env.NODE_ENV ? warning(
6752
false,
6753
'Failed Context Types: %s%s',
6754
error.message,
6755
addendum
6756
) : null);
6757
}
6758
}
6759
}
6760
}
6761
},
6762
6763
receiveComponent: function(nextElement, transaction, nextContext) {
6764
var prevElement = this._currentElement;
6765
var prevContext = this._context;
6766
6767
this._pendingElement = null;
6768
6769
this.updateComponent(
6770
transaction,
6771
prevElement,
6772
nextElement,
6773
prevContext,
6774
nextContext
6775
);
6776
},
6777
6778
/**
6779
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
6780
* is set, update the component.
6781
*
6782
* @param {ReactReconcileTransaction} transaction
6783
* @internal
6784
*/
6785
performUpdateIfNecessary: function(transaction) {
6786
if (this._pendingElement != null) {
6787
ReactReconciler.receiveComponent(
6788
this,
6789
this._pendingElement || this._currentElement,
6790
transaction,
6791
this._context
6792
);
6793
}
6794
6795
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
6796
if ("production" !== process.env.NODE_ENV) {
6797
ReactElementValidator.checkAndWarnForMutatedProps(
6798
this._currentElement
6799
);
6800
}
6801
6802
this.updateComponent(
6803
transaction,
6804
this._currentElement,
6805
this._currentElement,
6806
this._context,
6807
this._context
6808
);
6809
}
6810
},
6811
6812
/**
6813
* Compare two contexts, warning if they are different
6814
* TODO: Remove this check when owner-context is removed
6815
*/
6816
_warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
6817
ownerBasedContext = this._maskContext(ownerBasedContext);
6818
parentBasedContext = this._maskContext(parentBasedContext);
6819
var parentKeys = Object.keys(parentBasedContext).sort();
6820
var displayName = this.getName() || 'ReactCompositeComponent';
6821
for (var i = 0; i < parentKeys.length; i++) {
6822
var key = parentKeys[i];
6823
("production" !== process.env.NODE_ENV ? warning(
6824
ownerBasedContext[key] === parentBasedContext[key],
6825
'owner-based and parent-based contexts differ ' +
6826
'(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
6827
'(see: http://fb.me/react-context-by-parent)',
6828
ownerBasedContext[key],
6829
parentBasedContext[key],
6830
key,
6831
displayName
6832
) : null);
6833
}
6834
},
6835
6836
/**
6837
* Perform an update to a mounted component. The componentWillReceiveProps and
6838
* shouldComponentUpdate methods are called, then (assuming the update isn't
6839
* skipped) the remaining update lifecycle methods are called and the DOM
6840
* representation is updated.
6841
*
6842
* By default, this implements React's rendering and reconciliation algorithm.
6843
* Sophisticated clients may wish to override this.
6844
*
6845
* @param {ReactReconcileTransaction} transaction
6846
* @param {ReactElement} prevParentElement
6847
* @param {ReactElement} nextParentElement
6848
* @internal
6849
* @overridable
6850
*/
6851
updateComponent: function(
6852
transaction,
6853
prevParentElement,
6854
nextParentElement,
6855
prevUnmaskedContext,
6856
nextUnmaskedContext
6857
) {
6858
var inst = this._instance;
6859
6860
var nextContext = inst.context;
6861
var nextProps = inst.props;
6862
6863
// Distinguish between a props update versus a simple state update
6864
if (prevParentElement !== nextParentElement) {
6865
nextContext = this._processContext(nextParentElement._context);
6866
nextProps = this._processProps(nextParentElement.props);
6867
6868
if ("production" !== process.env.NODE_ENV) {
6869
if (nextUnmaskedContext != null) {
6870
this._warnIfContextsDiffer(
6871
nextParentElement._context,
6872
nextUnmaskedContext
6873
);
6874
}
6875
}
6876
6877
// An update here will schedule an update but immediately set
6878
// _pendingStateQueue which will ensure that any state updates gets
6879
// immediately reconciled instead of waiting for the next batch.
6880
6881
if (inst.componentWillReceiveProps) {
6882
inst.componentWillReceiveProps(nextProps, nextContext);
6883
}
6884
}
6885
6886
var nextState = this._processPendingState(nextProps, nextContext);
6887
6888
var shouldUpdate =
6889
this._pendingForceUpdate ||
6890
!inst.shouldComponentUpdate ||
6891
inst.shouldComponentUpdate(nextProps, nextState, nextContext);
6892
6893
if ("production" !== process.env.NODE_ENV) {
6894
("production" !== process.env.NODE_ENV ? warning(
6895
typeof shouldUpdate !== 'undefined',
6896
'%s.shouldComponentUpdate(): Returned undefined instead of a ' +
6897
'boolean value. Make sure to return true or false.',
6898
this.getName() || 'ReactCompositeComponent'
6899
) : null);
6900
}
6901
6902
if (shouldUpdate) {
6903
this._pendingForceUpdate = false;
6904
// Will set `this.props`, `this.state` and `this.context`.
6905
this._performComponentUpdate(
6906
nextParentElement,
6907
nextProps,
6908
nextState,
6909
nextContext,
6910
transaction,
6911
nextUnmaskedContext
6912
);
6913
} else {
6914
// If it's determined that a component should not update, we still want
6915
// to set props and state but we shortcut the rest of the update.
6916
this._currentElement = nextParentElement;
6917
this._context = nextUnmaskedContext;
6918
inst.props = nextProps;
6919
inst.state = nextState;
6920
inst.context = nextContext;
6921
}
6922
},
6923
6924
_processPendingState: function(props, context) {
6925
var inst = this._instance;
6926
var queue = this._pendingStateQueue;
6927
var replace = this._pendingReplaceState;
6928
this._pendingReplaceState = false;
6929
this._pendingStateQueue = null;
6930
6931
if (!queue) {
6932
return inst.state;
6933
}
6934
6935
var nextState = assign({}, replace ? queue[0] : inst.state);
6936
for (var i = replace ? 1 : 0; i < queue.length; i++) {
6937
var partial = queue[i];
6938
assign(
6939
nextState,
6940
typeof partial === 'function' ?
6941
partial.call(inst, nextState, props, context) :
6942
partial
6943
);
6944
}
6945
6946
return nextState;
6947
},
6948
6949
/**
6950
* Merges new props and state, notifies delegate methods of update and
6951
* performs update.
6952
*
6953
* @param {ReactElement} nextElement Next element
6954
* @param {object} nextProps Next public object to set as properties.
6955
* @param {?object} nextState Next object to set as state.
6956
* @param {?object} nextContext Next public object to set as context.
6957
* @param {ReactReconcileTransaction} transaction
6958
* @param {?object} unmaskedContext
6959
* @private
6960
*/
6961
_performComponentUpdate: function(
6962
nextElement,
6963
nextProps,
6964
nextState,
6965
nextContext,
6966
transaction,
6967
unmaskedContext
6968
) {
6969
var inst = this._instance;
6970
6971
var prevProps = inst.props;
6972
var prevState = inst.state;
6973
var prevContext = inst.context;
6974
6975
if (inst.componentWillUpdate) {
6976
inst.componentWillUpdate(nextProps, nextState, nextContext);
6977
}
6978
6979
this._currentElement = nextElement;
6980
this._context = unmaskedContext;
6981
inst.props = nextProps;
6982
inst.state = nextState;
6983
inst.context = nextContext;
6984
6985
this._updateRenderedComponent(transaction, unmaskedContext);
6986
6987
if (inst.componentDidUpdate) {
6988
transaction.getReactMountReady().enqueue(
6989
inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
6990
inst
6991
);
6992
}
6993
},
6994
6995
/**
6996
* Call the component's `render` method and update the DOM accordingly.
6997
*
6998
* @param {ReactReconcileTransaction} transaction
6999
* @internal
7000
*/
7001
_updateRenderedComponent: function(transaction, context) {
7002
var prevComponentInstance = this._renderedComponent;
7003
var prevRenderedElement = prevComponentInstance._currentElement;
7004
var nextRenderedElement = this._renderValidatedComponent();
7005
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
7006
ReactReconciler.receiveComponent(
7007
prevComponentInstance,
7008
nextRenderedElement,
7009
transaction,
7010
this._processChildContext(context)
7011
);
7012
} else {
7013
// These two IDs are actually the same! But nothing should rely on that.
7014
var thisID = this._rootNodeID;
7015
var prevComponentID = prevComponentInstance._rootNodeID;
7016
ReactReconciler.unmountComponent(prevComponentInstance);
7017
7018
this._renderedComponent = this._instantiateReactComponent(
7019
nextRenderedElement,
7020
this._currentElement.type
7021
);
7022
var nextMarkup = ReactReconciler.mountComponent(
7023
this._renderedComponent,
7024
thisID,
7025
transaction,
7026
context
7027
);
7028
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
7029
}
7030
},
7031
7032
/**
7033
* @protected
7034
*/
7035
_replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
7036
ReactComponentEnvironment.replaceNodeWithMarkupByID(
7037
prevComponentID,
7038
nextMarkup
7039
);
7040
},
7041
7042
/**
7043
* @protected
7044
*/
7045
_renderValidatedComponentWithoutOwnerOrContext: function() {
7046
var inst = this._instance;
7047
var renderedComponent = inst.render();
7048
if ("production" !== process.env.NODE_ENV) {
7049
// We allow auto-mocks to proceed as if they're returning null.
7050
if (typeof renderedComponent === 'undefined' &&
7051
inst.render._isMockFunction) {
7052
// This is probably bad practice. Consider warning here and
7053
// deprecating this convenience.
7054
renderedComponent = null;
7055
}
7056
}
7057
7058
return renderedComponent;
7059
},
7060
7061
/**
7062
* @private
7063
*/
7064
_renderValidatedComponent: function() {
7065
var renderedComponent;
7066
var previousContext = ReactContext.current;
7067
ReactContext.current = this._processChildContext(
7068
this._currentElement._context
7069
);
7070
ReactCurrentOwner.current = this;
7071
try {
7072
renderedComponent =
7073
this._renderValidatedComponentWithoutOwnerOrContext();
7074
} finally {
7075
ReactContext.current = previousContext;
7076
ReactCurrentOwner.current = null;
7077
}
7078
("production" !== process.env.NODE_ENV ? invariant(
7079
// TODO: An `isValidNode` function would probably be more appropriate
7080
renderedComponent === null || renderedComponent === false ||
7081
ReactElement.isValidElement(renderedComponent),
7082
'%s.render(): A valid ReactComponent must be returned. You may have ' +
7083
'returned undefined, an array or some other invalid object.',
7084
this.getName() || 'ReactCompositeComponent'
7085
) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
7086
renderedComponent === null || renderedComponent === false ||
7087
ReactElement.isValidElement(renderedComponent)));
7088
return renderedComponent;
7089
},
7090
7091
/**
7092
* Lazily allocates the refs object and stores `component` as `ref`.
7093
*
7094
* @param {string} ref Reference name.
7095
* @param {component} component Component to store as `ref`.
7096
* @final
7097
* @private
7098
*/
7099
attachRef: function(ref, component) {
7100
var inst = this.getPublicInstance();
7101
var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
7102
refs[ref] = component.getPublicInstance();
7103
},
7104
7105
/**
7106
* Detaches a reference name.
7107
*
7108
* @param {string} ref Name to dereference.
7109
* @final
7110
* @private
7111
*/
7112
detachRef: function(ref) {
7113
var refs = this.getPublicInstance().refs;
7114
delete refs[ref];
7115
},
7116
7117
/**
7118
* Get a text description of the component that can be used to identify it
7119
* in error messages.
7120
* @return {string} The name or null.
7121
* @internal
7122
*/
7123
getName: function() {
7124
var type = this._currentElement.type;
7125
var constructor = this._instance && this._instance.constructor;
7126
return (
7127
type.displayName || (constructor && constructor.displayName) ||
7128
type.name || (constructor && constructor.name) ||
7129
null
7130
);
7131
},
7132
7133
/**
7134
* Get the publicly accessible representation of this component - i.e. what
7135
* is exposed by refs and returned by React.render. Can be null for stateless
7136
* components.
7137
*
7138
* @return {ReactComponent} the public component instance.
7139
* @internal
7140
*/
7141
getPublicInstance: function() {
7142
return this._instance;
7143
},
7144
7145
// Stub
7146
_instantiateReactComponent: null
7147
7148
};
7149
7150
ReactPerf.measureMethods(
7151
ReactCompositeComponentMixin,
7152
'ReactCompositeComponent',
7153
{
7154
mountComponent: 'mountComponent',
7155
updateComponent: 'updateComponent',
7156
_renderValidatedComponent: '_renderValidatedComponent'
7157
}
7158
);
7159
7160
var ReactCompositeComponent = {
7161
7162
Mixin: ReactCompositeComponentMixin
7163
7164
};
7165
7166
module.exports = ReactCompositeComponent;
7167
7168
7169
}).call(this,require("FWaASH"))
7170
},{"./Object.assign":27,"./ReactComponentEnvironment":37,"./ReactContext":39,"./ReactCurrentOwner":40,"./ReactElement":58,"./ReactElementValidator":59,"./ReactInstanceMap":68,"./ReactLifeCycle":69,"./ReactNativeComponent":74,"./ReactPerf":76,"./ReactPropTypeLocationNames":77,"./ReactPropTypeLocations":78,"./ReactReconciler":82,"./ReactUpdates":88,"./emptyObject":116,"./invariant":136,"./shouldUpdateReactComponent":152,"./warning":155,"FWaASH":1}],39:[function(require,module,exports){
7171
(function (process){
7172
/**
7173
* Copyright 2013-2015, Facebook, Inc.
7174
* All rights reserved.
7175
*
7176
* This source code is licensed under the BSD-style license found in the
7177
* LICENSE file in the root directory of this source tree. An additional grant
7178
* of patent rights can be found in the PATENTS file in the same directory.
7179
*
7180
* @providesModule ReactContext
7181
*/
7182
7183
'use strict';
7184
7185
var assign = require("./Object.assign");
7186
var emptyObject = require("./emptyObject");
7187
var warning = require("./warning");
7188
7189
var didWarn = false;
7190
7191
/**
7192
* Keeps track of the current context.
7193
*
7194
* The context is automatically passed down the component ownership hierarchy
7195
* and is accessible via `this.context` on ReactCompositeComponents.
7196
*/
7197
var ReactContext = {
7198
7199
/**
7200
* @internal
7201
* @type {object}
7202
*/
7203
current: emptyObject,
7204
7205
/**
7206
* Temporarily extends the current context while executing scopedCallback.
7207
*
7208
* A typical use case might look like
7209
*
7210
* render: function() {
7211
* var children = ReactContext.withContext({foo: 'foo'}, () => (
7212
*
7213
* ));
7214
* return <div>{children}</div>;
7215
* }
7216
*
7217
* @param {object} newContext New context to merge into the existing context
7218
* @param {function} scopedCallback Callback to run with the new context
7219
* @return {ReactComponent|array<ReactComponent>}
7220
*/
7221
withContext: function(newContext, scopedCallback) {
7222
if ("production" !== process.env.NODE_ENV) {
7223
("production" !== process.env.NODE_ENV ? warning(
7224
didWarn,
7225
'withContext is deprecated and will be removed in a future version. ' +
7226
'Use a wrapper component with getChildContext instead.'
7227
) : null);
7228
7229
didWarn = true;
7230
}
7231
7232
var result;
7233
var previousContext = ReactContext.current;
7234
ReactContext.current = assign({}, previousContext, newContext);
7235
try {
7236
result = scopedCallback();
7237
} finally {
7238
ReactContext.current = previousContext;
7239
}
7240
return result;
7241
}
7242
7243
};
7244
7245
module.exports = ReactContext;
7246
7247
7248
}).call(this,require("FWaASH"))
7249
},{"./Object.assign":27,"./emptyObject":116,"./warning":155,"FWaASH":1}],40:[function(require,module,exports){
7250
/**
7251
* Copyright 2013-2015, Facebook, Inc.
7252
* All rights reserved.
7253
*
7254
* This source code is licensed under the BSD-style license found in the
7255
* LICENSE file in the root directory of this source tree. An additional grant
7256
* of patent rights can be found in the PATENTS file in the same directory.
7257
*
7258
* @providesModule ReactCurrentOwner
7259
*/
7260
7261
'use strict';
7262
7263
/**
7264
* Keeps track of the current owner.
7265
*
7266
* The current owner is the component who should own any components that are
7267
* currently being constructed.
7268
*
7269
* The depth indicate how many composite components are above this render level.
7270
*/
7271
var ReactCurrentOwner = {
7272
7273
/**
7274
* @internal
7275
* @type {ReactComponent}
7276
*/
7277
current: null
7278
7279
};
7280
7281
module.exports = ReactCurrentOwner;
7282
7283
7284
},{}],41:[function(require,module,exports){
7285
(function (process){
7286
/**
7287
* Copyright 2013-2015, Facebook, Inc.
7288
* All rights reserved.
7289
*
7290
* This source code is licensed under the BSD-style license found in the
7291
* LICENSE file in the root directory of this source tree. An additional grant
7292
* of patent rights can be found in the PATENTS file in the same directory.
7293
*
7294
* @providesModule ReactDOM
7295
* @typechecks static-only
7296
*/
7297
7298
'use strict';
7299
7300
var ReactElement = require("./ReactElement");
7301
var ReactElementValidator = require("./ReactElementValidator");
7302
7303
var mapObject = require("./mapObject");
7304
7305
/**
7306
* Create a factory that creates HTML tag elements.
7307
*
7308
* @param {string} tag Tag name (e.g. `div`).
7309
* @private
7310
*/
7311
function createDOMFactory(tag) {
7312
if ("production" !== process.env.NODE_ENV) {
7313
return ReactElementValidator.createFactory(tag);
7314
}
7315
return ReactElement.createFactory(tag);
7316
}
7317
7318
/**
7319
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
7320
* This is also accessible via `React.DOM`.
7321
*
7322
* @public
7323
*/
7324
var ReactDOM = mapObject({
7325
a: 'a',
7326
abbr: 'abbr',
7327
address: 'address',
7328
area: 'area',
7329
article: 'article',
7330
aside: 'aside',
7331
audio: 'audio',
7332
b: 'b',
7333
base: 'base',
7334
bdi: 'bdi',
7335
bdo: 'bdo',
7336
big: 'big',
7337
blockquote: 'blockquote',
7338
body: 'body',
7339
br: 'br',
7340
button: 'button',
7341
canvas: 'canvas',
7342
caption: 'caption',
7343
cite: 'cite',
7344
code: 'code',
7345
col: 'col',
7346
colgroup: 'colgroup',
7347
data: 'data',
7348
datalist: 'datalist',
7349
dd: 'dd',
7350
del: 'del',
7351
details: 'details',
7352
dfn: 'dfn',
7353
dialog: 'dialog',
7354
div: 'div',
7355
dl: 'dl',
7356
dt: 'dt',
7357
em: 'em',
7358
embed: 'embed',
7359
fieldset: 'fieldset',
7360
figcaption: 'figcaption',
7361
figure: 'figure',
7362
footer: 'footer',
7363
form: 'form',
7364
h1: 'h1',
7365
h2: 'h2',
7366
h3: 'h3',
7367
h4: 'h4',
7368
h5: 'h5',
7369
h6: 'h6',
7370
head: 'head',
7371
header: 'header',
7372
hr: 'hr',
7373
html: 'html',
7374
i: 'i',
7375
iframe: 'iframe',
7376
img: 'img',
7377
input: 'input',
7378
ins: 'ins',
7379
kbd: 'kbd',
7380
keygen: 'keygen',
7381
label: 'label',
7382
legend: 'legend',
7383
li: 'li',
7384
link: 'link',
7385
main: 'main',
7386
map: 'map',
7387
mark: 'mark',
7388
menu: 'menu',
7389
menuitem: 'menuitem',
7390
meta: 'meta',
7391
meter: 'meter',
7392
nav: 'nav',
7393
noscript: 'noscript',
7394
object: 'object',
7395
ol: 'ol',
7396
optgroup: 'optgroup',
7397
option: 'option',
7398
output: 'output',
7399
p: 'p',
7400
param: 'param',
7401
picture: 'picture',
7402
pre: 'pre',
7403
progress: 'progress',
7404
q: 'q',
7405
rp: 'rp',
7406
rt: 'rt',
7407
ruby: 'ruby',
7408
s: 's',
7409
samp: 'samp',
7410
script: 'script',
7411
section: 'section',
7412
select: 'select',
7413
small: 'small',
7414
source: 'source',
7415
span: 'span',
7416
strong: 'strong',
7417
style: 'style',
7418
sub: 'sub',
7419
summary: 'summary',
7420
sup: 'sup',
7421
table: 'table',
7422
tbody: 'tbody',
7423
td: 'td',
7424
textarea: 'textarea',
7425
tfoot: 'tfoot',
7426
th: 'th',
7427
thead: 'thead',
7428
time: 'time',
7429
title: 'title',
7430
tr: 'tr',
7431
track: 'track',
7432
u: 'u',
7433
ul: 'ul',
7434
'var': 'var',
7435
video: 'video',
7436
wbr: 'wbr',
7437
7438
// SVG
7439
circle: 'circle',
7440
defs: 'defs',
7441
ellipse: 'ellipse',
7442
g: 'g',
7443
line: 'line',
7444
linearGradient: 'linearGradient',
7445
mask: 'mask',
7446
path: 'path',
7447
pattern: 'pattern',
7448
polygon: 'polygon',
7449
polyline: 'polyline',
7450
radialGradient: 'radialGradient',
7451
rect: 'rect',
7452
stop: 'stop',
7453
svg: 'svg',
7454
text: 'text',
7455
tspan: 'tspan'
7456
7457
}, createDOMFactory);
7458
7459
module.exports = ReactDOM;
7460
7461
7462
}).call(this,require("FWaASH"))
7463
},{"./ReactElement":58,"./ReactElementValidator":59,"./mapObject":143,"FWaASH":1}],42:[function(require,module,exports){
7464
/**
7465
* Copyright 2013-2015, Facebook, Inc.
7466
* All rights reserved.
7467
*
7468
* This source code is licensed under the BSD-style license found in the
7469
* LICENSE file in the root directory of this source tree. An additional grant
7470
* of patent rights can be found in the PATENTS file in the same directory.
7471
*
7472
* @providesModule ReactDOMButton
7473
*/
7474
7475
'use strict';
7476
7477
var AutoFocusMixin = require("./AutoFocusMixin");
7478
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
7479
var ReactClass = require("./ReactClass");
7480
var ReactElement = require("./ReactElement");
7481
7482
var keyMirror = require("./keyMirror");
7483
7484
var button = ReactElement.createFactory('button');
7485
7486
var mouseListenerNames = keyMirror({
7487
onClick: true,
7488
onDoubleClick: true,
7489
onMouseDown: true,
7490
onMouseMove: true,
7491
onMouseUp: true,
7492
onClickCapture: true,
7493
onDoubleClickCapture: true,
7494
onMouseDownCapture: true,
7495
onMouseMoveCapture: true,
7496
onMouseUpCapture: true
7497
});
7498
7499
/**
7500
* Implements a <button> native component that does not receive mouse events
7501
* when `disabled` is set.
7502
*/
7503
var ReactDOMButton = ReactClass.createClass({
7504
displayName: 'ReactDOMButton',
7505
tagName: 'BUTTON',
7506
7507
mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
7508
7509
render: function() {
7510
var props = {};
7511
7512
// Copy the props; except the mouse listeners if we're disabled
7513
for (var key in this.props) {
7514
if (this.props.hasOwnProperty(key) &&
7515
(!this.props.disabled || !mouseListenerNames[key])) {
7516
props[key] = this.props[key];
7517
}
7518
}
7519
7520
return button(props, this.props.children);
7521
}
7522
7523
});
7524
7525
module.exports = ReactDOMButton;
7526
7527
7528
},{"./AutoFocusMixin":2,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58,"./keyMirror":141}],43:[function(require,module,exports){
7529
(function (process){
7530
/**
7531
* Copyright 2013-2015, Facebook, Inc.
7532
* All rights reserved.
7533
*
7534
* This source code is licensed under the BSD-style license found in the
7535
* LICENSE file in the root directory of this source tree. An additional grant
7536
* of patent rights can be found in the PATENTS file in the same directory.
7537
*
7538
* @providesModule ReactDOMComponent
7539
* @typechecks static-only
7540
*/
7541
7542
/* global hasOwnProperty:true */
7543
7544
'use strict';
7545
7546
var CSSPropertyOperations = require("./CSSPropertyOperations");
7547
var DOMProperty = require("./DOMProperty");
7548
var DOMPropertyOperations = require("./DOMPropertyOperations");
7549
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
7550
var ReactComponentBrowserEnvironment =
7551
require("./ReactComponentBrowserEnvironment");
7552
var ReactMount = require("./ReactMount");
7553
var ReactMultiChild = require("./ReactMultiChild");
7554
var ReactPerf = require("./ReactPerf");
7555
7556
var assign = require("./Object.assign");
7557
var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
7558
var invariant = require("./invariant");
7559
var isEventSupported = require("./isEventSupported");
7560
var keyOf = require("./keyOf");
7561
var warning = require("./warning");
7562
7563
var deleteListener = ReactBrowserEventEmitter.deleteListener;
7564
var listenTo = ReactBrowserEventEmitter.listenTo;
7565
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
7566
7567
// For quickly matching children type, to test if can be treated as content.
7568
var CONTENT_TYPES = {'string': true, 'number': true};
7569
7570
var STYLE = keyOf({style: null});
7571
7572
var ELEMENT_NODE_TYPE = 1;
7573
7574
/**
7575
* Optionally injectable operations for mutating the DOM
7576
*/
7577
var BackendIDOperations = null;
7578
7579
/**
7580
* @param {?object} props
7581
*/
7582
function assertValidProps(props) {
7583
if (!props) {
7584
return;
7585
}
7586
// Note the use of `==` which checks for null or undefined.
7587
if (props.dangerouslySetInnerHTML != null) {
7588
("production" !== process.env.NODE_ENV ? invariant(
7589
props.children == null,
7590
'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
7591
) : invariant(props.children == null));
7592
("production" !== process.env.NODE_ENV ? invariant(
7593
props.dangerouslySetInnerHTML.__html != null,
7594
'`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
7595
'Please visit http://fb.me/react-invariant-dangerously-set-inner-html ' +
7596
'for more information.'
7597
) : invariant(props.dangerouslySetInnerHTML.__html != null));
7598
}
7599
if ("production" !== process.env.NODE_ENV) {
7600
("production" !== process.env.NODE_ENV ? warning(
7601
props.innerHTML == null,
7602
'Directly setting property `innerHTML` is not permitted. ' +
7603
'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
7604
) : null);
7605
("production" !== process.env.NODE_ENV ? warning(
7606
!props.contentEditable || props.children == null,
7607
'A component is `contentEditable` and contains `children` managed by ' +
7608
'React. It is now your responsibility to guarantee that none of ' +
7609
'those nodes are unexpectedly modified or duplicated. This is ' +
7610
'probably not intentional.'
7611
) : null);
7612
}
7613
("production" !== process.env.NODE_ENV ? invariant(
7614
props.style == null || typeof props.style === 'object',
7615
'The `style` prop expects a mapping from style properties to values, ' +
7616
'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
7617
'using JSX.'
7618
) : invariant(props.style == null || typeof props.style === 'object'));
7619
}
7620
7621
function putListener(id, registrationName, listener, transaction) {
7622
if ("production" !== process.env.NODE_ENV) {
7623
// IE8 has no API for event capturing and the `onScroll` event doesn't
7624
// bubble.
7625
("production" !== process.env.NODE_ENV ? warning(
7626
registrationName !== 'onScroll' || isEventSupported('scroll', true),
7627
'This browser doesn\'t support the `onScroll` event'
7628
) : null);
7629
}
7630
var container = ReactMount.findReactContainerForID(id);
7631
if (container) {
7632
var doc = container.nodeType === ELEMENT_NODE_TYPE ?
7633
container.ownerDocument :
7634
container;
7635
listenTo(registrationName, doc);
7636
}
7637
transaction.getPutListenerQueue().enqueuePutListener(
7638
id,
7639
registrationName,
7640
listener
7641
);
7642
}
7643
7644
// For HTML, certain tags should omit their close tag. We keep a whitelist for
7645
// those special cased tags.
7646
7647
var omittedCloseTags = {
7648
'area': true,
7649
'base': true,
7650
'br': true,
7651
'col': true,
7652
'embed': true,
7653
'hr': true,
7654
'img': true,
7655
'input': true,
7656
'keygen': true,
7657
'link': true,
7658
'meta': true,
7659
'param': true,
7660
'source': true,
7661
'track': true,
7662
'wbr': true
7663
// NOTE: menuitem's close tag should be omitted, but that causes problems.
7664
};
7665
7666
// We accept any tag to be rendered but since this gets injected into abitrary
7667
// HTML, we want to make sure that it's a safe tag.
7668
// http://www.w3.org/TR/REC-xml/#NT-Name
7669
7670
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
7671
var validatedTagCache = {};
7672
var hasOwnProperty = {}.hasOwnProperty;
7673
7674
function validateDangerousTag(tag) {
7675
if (!hasOwnProperty.call(validatedTagCache, tag)) {
7676
("production" !== process.env.NODE_ENV ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
7677
validatedTagCache[tag] = true;
7678
}
7679
}
7680
7681
/**
7682
* Creates a new React class that is idempotent and capable of containing other
7683
* React components. It accepts event listeners and DOM properties that are
7684
* valid according to `DOMProperty`.
7685
*
7686
* - Event listeners: `onClick`, `onMouseDown`, etc.
7687
* - DOM properties: `className`, `name`, `title`, etc.
7688
*
7689
* The `style` property functions differently from the DOM API. It accepts an
7690
* object mapping of style properties to values.
7691
*
7692
* @constructor ReactDOMComponent
7693
* @extends ReactMultiChild
7694
*/
7695
function ReactDOMComponent(tag) {
7696
validateDangerousTag(tag);
7697
this._tag = tag;
7698
this._renderedChildren = null;
7699
this._previousStyleCopy = null;
7700
this._rootNodeID = null;
7701
}
7702
7703
ReactDOMComponent.displayName = 'ReactDOMComponent';
7704
7705
ReactDOMComponent.Mixin = {
7706
7707
construct: function(element) {
7708
this._currentElement = element;
7709
},
7710
7711
/**
7712
* Generates root tag markup then recurses. This method has side effects and
7713
* is not idempotent.
7714
*
7715
* @internal
7716
* @param {string} rootID The root DOM ID for this node.
7717
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
7718
* @return {string} The computed markup.
7719
*/
7720
mountComponent: function(rootID, transaction, context) {
7721
this._rootNodeID = rootID;
7722
assertValidProps(this._currentElement.props);
7723
var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
7724
return (
7725
this._createOpenTagMarkupAndPutListeners(transaction) +
7726
this._createContentMarkup(transaction, context) +
7727
closeTag
7728
);
7729
},
7730
7731
/**
7732
* Creates markup for the open tag and all attributes.
7733
*
7734
* This method has side effects because events get registered.
7735
*
7736
* Iterating over object properties is faster than iterating over arrays.
7737
* @see http://jsperf.com/obj-vs-arr-iteration
7738
*
7739
* @private
7740
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
7741
* @return {string} Markup of opening tag.
7742
*/
7743
_createOpenTagMarkupAndPutListeners: function(transaction) {
7744
var props = this._currentElement.props;
7745
var ret = '<' + this._tag;
7746
7747
for (var propKey in props) {
7748
if (!props.hasOwnProperty(propKey)) {
7749
continue;
7750
}
7751
var propValue = props[propKey];
7752
if (propValue == null) {
7753
continue;
7754
}
7755
if (registrationNameModules.hasOwnProperty(propKey)) {
7756
putListener(this._rootNodeID, propKey, propValue, transaction);
7757
} else {
7758
if (propKey === STYLE) {
7759
if (propValue) {
7760
propValue = this._previousStyleCopy = assign({}, props.style);
7761
}
7762
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
7763
}
7764
var markup =
7765
DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
7766
if (markup) {
7767
ret += ' ' + markup;
7768
}
7769
}
7770
}
7771
7772
// For static pages, no need to put React ID and checksum. Saves lots of
7773
// bytes.
7774
if (transaction.renderToStaticMarkup) {
7775
return ret + '>';
7776
}
7777
7778
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
7779
return ret + ' ' + markupForID + '>';
7780
},
7781
7782
/**
7783
* Creates markup for the content between the tags.
7784
*
7785
* @private
7786
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
7787
* @param {object} context
7788
* @return {string} Content markup.
7789
*/
7790
_createContentMarkup: function(transaction, context) {
7791
var prefix = '';
7792
if (this._tag === 'listing' ||
7793
this._tag === 'pre' ||
7794
this._tag === 'textarea') {
7795
// Add an initial newline because browsers ignore the first newline in
7796
// a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
7797
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
7798
prefix = '\n';
7799
}
7800
7801
var props = this._currentElement.props;
7802
7803
// Intentional use of != to avoid catching zero/false.
7804
var innerHTML = props.dangerouslySetInnerHTML;
7805
if (innerHTML != null) {
7806
if (innerHTML.__html != null) {
7807
return prefix + innerHTML.__html;
7808
}
7809
} else {
7810
var contentToUse =
7811
CONTENT_TYPES[typeof props.children] ? props.children : null;
7812
var childrenToUse = contentToUse != null ? null : props.children;
7813
if (contentToUse != null) {
7814
return prefix + escapeTextContentForBrowser(contentToUse);
7815
} else if (childrenToUse != null) {
7816
var mountImages = this.mountChildren(
7817
childrenToUse,
7818
transaction,
7819
context
7820
);
7821
return prefix + mountImages.join('');
7822
}
7823
}
7824
return prefix;
7825
},
7826
7827
receiveComponent: function(nextElement, transaction, context) {
7828
var prevElement = this._currentElement;
7829
this._currentElement = nextElement;
7830
this.updateComponent(transaction, prevElement, nextElement, context);
7831
},
7832
7833
/**
7834
* Updates a native DOM component after it has already been allocated and
7835
* attached to the DOM. Reconciles the root DOM node, then recurses.
7836
*
7837
* @param {ReactReconcileTransaction} transaction
7838
* @param {ReactElement} prevElement
7839
* @param {ReactElement} nextElement
7840
* @internal
7841
* @overridable
7842
*/
7843
updateComponent: function(transaction, prevElement, nextElement, context) {
7844
assertValidProps(this._currentElement.props);
7845
this._updateDOMProperties(prevElement.props, transaction);
7846
this._updateDOMChildren(prevElement.props, transaction, context);
7847
},
7848
7849
/**
7850
* Reconciles the properties by detecting differences in property values and
7851
* updating the DOM as necessary. This function is probably the single most
7852
* critical path for performance optimization.
7853
*
7854
* TODO: Benchmark whether checking for changed values in memory actually
7855
* improves performance (especially statically positioned elements).
7856
* TODO: Benchmark the effects of putting this at the top since 99% of props
7857
* do not change for a given reconciliation.
7858
* TODO: Benchmark areas that can be improved with caching.
7859
*
7860
* @private
7861
* @param {object} lastProps
7862
* @param {ReactReconcileTransaction} transaction
7863
*/
7864
_updateDOMProperties: function(lastProps, transaction) {
7865
var nextProps = this._currentElement.props;
7866
var propKey;
7867
var styleName;
7868
var styleUpdates;
7869
for (propKey in lastProps) {
7870
if (nextProps.hasOwnProperty(propKey) ||
7871
!lastProps.hasOwnProperty(propKey)) {
7872
continue;
7873
}
7874
if (propKey === STYLE) {
7875
var lastStyle = this._previousStyleCopy;
7876
for (styleName in lastStyle) {
7877
if (lastStyle.hasOwnProperty(styleName)) {
7878
styleUpdates = styleUpdates || {};
7879
styleUpdates[styleName] = '';
7880
}
7881
}
7882
} else if (registrationNameModules.hasOwnProperty(propKey)) {
7883
deleteListener(this._rootNodeID, propKey);
7884
} else if (
7885
DOMProperty.isStandardName[propKey] ||
7886
DOMProperty.isCustomAttribute(propKey)) {
7887
BackendIDOperations.deletePropertyByID(
7888
this._rootNodeID,
7889
propKey
7890
);
7891
}
7892
}
7893
for (propKey in nextProps) {
7894
var nextProp = nextProps[propKey];
7895
var lastProp = propKey === STYLE ?
7896
this._previousStyleCopy :
7897
lastProps[propKey];
7898
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
7899
continue;
7900
}
7901
if (propKey === STYLE) {
7902
if (nextProp) {
7903
nextProp = this._previousStyleCopy = assign({}, nextProp);
7904
}
7905
if (lastProp) {
7906
// Unset styles on `lastProp` but not on `nextProp`.
7907
for (styleName in lastProp) {
7908
if (lastProp.hasOwnProperty(styleName) &&
7909
(!nextProp || !nextProp.hasOwnProperty(styleName))) {
7910
styleUpdates = styleUpdates || {};
7911
styleUpdates[styleName] = '';
7912
}
7913
}
7914
// Update styles that changed since `lastProp`.
7915
for (styleName in nextProp) {
7916
if (nextProp.hasOwnProperty(styleName) &&
7917
lastProp[styleName] !== nextProp[styleName]) {
7918
styleUpdates = styleUpdates || {};
7919
styleUpdates[styleName] = nextProp[styleName];
7920
}
7921
}
7922
} else {
7923
// Relies on `updateStylesByID` not mutating `styleUpdates`.
7924
styleUpdates = nextProp;
7925
}
7926
} else if (registrationNameModules.hasOwnProperty(propKey)) {
7927
putListener(this._rootNodeID, propKey, nextProp, transaction);
7928
} else if (
7929
DOMProperty.isStandardName[propKey] ||
7930
DOMProperty.isCustomAttribute(propKey)) {
7931
BackendIDOperations.updatePropertyByID(
7932
this._rootNodeID,
7933
propKey,
7934
nextProp
7935
);
7936
}
7937
}
7938
if (styleUpdates) {
7939
BackendIDOperations.updateStylesByID(
7940
this._rootNodeID,
7941
styleUpdates
7942
);
7943
}
7944
},
7945
7946
/**
7947
* Reconciles the children with the various properties that affect the
7948
* children content.
7949
*
7950
* @param {object} lastProps
7951
* @param {ReactReconcileTransaction} transaction
7952
*/
7953
_updateDOMChildren: function(lastProps, transaction, context) {
7954
var nextProps = this._currentElement.props;
7955
7956
var lastContent =
7957
CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
7958
var nextContent =
7959
CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
7960
7961
var lastHtml =
7962
lastProps.dangerouslySetInnerHTML &&
7963
lastProps.dangerouslySetInnerHTML.__html;
7964
var nextHtml =
7965
nextProps.dangerouslySetInnerHTML &&
7966
nextProps.dangerouslySetInnerHTML.__html;
7967
7968
// Note the use of `!=` which checks for null or undefined.
7969
var lastChildren = lastContent != null ? null : lastProps.children;
7970
var nextChildren = nextContent != null ? null : nextProps.children;
7971
7972
// If we're switching from children to content/html or vice versa, remove
7973
// the old content
7974
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
7975
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
7976
if (lastChildren != null && nextChildren == null) {
7977
this.updateChildren(null, transaction, context);
7978
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
7979
this.updateTextContent('');
7980
}
7981
7982
if (nextContent != null) {
7983
if (lastContent !== nextContent) {
7984
this.updateTextContent('' + nextContent);
7985
}
7986
} else if (nextHtml != null) {
7987
if (lastHtml !== nextHtml) {
7988
BackendIDOperations.updateInnerHTMLByID(
7989
this._rootNodeID,
7990
nextHtml
7991
);
7992
}
7993
} else if (nextChildren != null) {
7994
this.updateChildren(nextChildren, transaction, context);
7995
}
7996
},
7997
7998
/**
7999
* Destroys all event registrations for this instance. Does not remove from
8000
* the DOM. That must be done by the parent.
8001
*
8002
* @internal
8003
*/
8004
unmountComponent: function() {
8005
this.unmountChildren();
8006
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
8007
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
8008
this._rootNodeID = null;
8009
}
8010
8011
};
8012
8013
ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
8014
mountComponent: 'mountComponent',
8015
updateComponent: 'updateComponent'
8016
});
8017
8018
assign(
8019
ReactDOMComponent.prototype,
8020
ReactDOMComponent.Mixin,
8021
ReactMultiChild.Mixin
8022
);
8023
8024
ReactDOMComponent.injection = {
8025
injectIDOperations: function(IDOperations) {
8026
ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
8027
}
8028
};
8029
8030
module.exports = ReactDOMComponent;
8031
8032
8033
}).call(this,require("FWaASH"))
8034
},{"./CSSPropertyOperations":5,"./DOMProperty":10,"./DOMPropertyOperations":11,"./Object.assign":27,"./ReactBrowserEventEmitter":31,"./ReactComponentBrowserEnvironment":36,"./ReactMount":71,"./ReactMultiChild":72,"./ReactPerf":76,"./escapeTextContentForBrowser":117,"./invariant":136,"./isEventSupported":137,"./keyOf":142,"./warning":155,"FWaASH":1}],44:[function(require,module,exports){
8035
/**
8036
* Copyright 2013-2015, Facebook, Inc.
8037
* All rights reserved.
8038
*
8039
* This source code is licensed under the BSD-style license found in the
8040
* LICENSE file in the root directory of this source tree. An additional grant
8041
* of patent rights can be found in the PATENTS file in the same directory.
8042
*
8043
* @providesModule ReactDOMForm
8044
*/
8045
8046
'use strict';
8047
8048
var EventConstants = require("./EventConstants");
8049
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
8050
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
8051
var ReactClass = require("./ReactClass");
8052
var ReactElement = require("./ReactElement");
8053
8054
var form = ReactElement.createFactory('form');
8055
8056
/**
8057
* Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
8058
* to capture it on the <form> element itself. There are lots of hacks we could
8059
* do to accomplish this, but the most reliable is to make <form> a
8060
* composite component and use `componentDidMount` to attach the event handlers.
8061
*/
8062
var ReactDOMForm = ReactClass.createClass({
8063
displayName: 'ReactDOMForm',
8064
tagName: 'FORM',
8065
8066
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
8067
8068
render: function() {
8069
// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
8070
// `jshint` fails to parse JSX so in order for linting to work in the open
8071
// source repo, we need to just use `ReactDOM.form`.
8072
return form(this.props);
8073
},
8074
8075
componentDidMount: function() {
8076
this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
8077
this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
8078
}
8079
});
8080
8081
module.exports = ReactDOMForm;
8082
8083
8084
},{"./EventConstants":15,"./LocalEventTrapMixin":25,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58}],45:[function(require,module,exports){
8085
(function (process){
8086
/**
8087
* Copyright 2013-2015, Facebook, Inc.
8088
* All rights reserved.
8089
*
8090
* This source code is licensed under the BSD-style license found in the
8091
* LICENSE file in the root directory of this source tree. An additional grant
8092
* of patent rights can be found in the PATENTS file in the same directory.
8093
*
8094
* @providesModule ReactDOMIDOperations
8095
* @typechecks static-only
8096
*/
8097
8098
/*jslint evil: true */
8099
8100
'use strict';
8101
8102
var CSSPropertyOperations = require("./CSSPropertyOperations");
8103
var DOMChildrenOperations = require("./DOMChildrenOperations");
8104
var DOMPropertyOperations = require("./DOMPropertyOperations");
8105
var ReactMount = require("./ReactMount");
8106
var ReactPerf = require("./ReactPerf");
8107
8108
var invariant = require("./invariant");
8109
var setInnerHTML = require("./setInnerHTML");
8110
8111
/**
8112
* Errors for properties that should not be updated with `updatePropertyById()`.
8113
*
8114
* @type {object}
8115
* @private
8116
*/
8117
var INVALID_PROPERTY_ERRORS = {
8118
dangerouslySetInnerHTML:
8119
'`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
8120
style: '`style` must be set using `updateStylesByID()`.'
8121
};
8122
8123
/**
8124
* Operations used to process updates to DOM nodes. This is made injectable via
8125
* `ReactDOMComponent.BackendIDOperations`.
8126
*/
8127
var ReactDOMIDOperations = {
8128
8129
/**
8130
* Updates a DOM node with new property values. This should only be used to
8131
* update DOM properties in `DOMProperty`.
8132
*
8133
* @param {string} id ID of the node to update.
8134
* @param {string} name A valid property name, see `DOMProperty`.
8135
* @param {*} value New value of the property.
8136
* @internal
8137
*/
8138
updatePropertyByID: function(id, name, value) {
8139
var node = ReactMount.getNode(id);
8140
("production" !== process.env.NODE_ENV ? invariant(
8141
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
8142
'updatePropertyByID(...): %s',
8143
INVALID_PROPERTY_ERRORS[name]
8144
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
8145
8146
// If we're updating to null or undefined, we should remove the property
8147
// from the DOM node instead of inadvertantly setting to a string. This
8148
// brings us in line with the same behavior we have on initial render.
8149
if (value != null) {
8150
DOMPropertyOperations.setValueForProperty(node, name, value);
8151
} else {
8152
DOMPropertyOperations.deleteValueForProperty(node, name);
8153
}
8154
},
8155
8156
/**
8157
* Updates a DOM node to remove a property. This should only be used to remove
8158
* DOM properties in `DOMProperty`.
8159
*
8160
* @param {string} id ID of the node to update.
8161
* @param {string} name A property name to remove, see `DOMProperty`.
8162
* @internal
8163
*/
8164
deletePropertyByID: function(id, name, value) {
8165
var node = ReactMount.getNode(id);
8166
("production" !== process.env.NODE_ENV ? invariant(
8167
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
8168
'updatePropertyByID(...): %s',
8169
INVALID_PROPERTY_ERRORS[name]
8170
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
8171
DOMPropertyOperations.deleteValueForProperty(node, name, value);
8172
},
8173
8174
/**
8175
* Updates a DOM node with new style values. If a value is specified as '',
8176
* the corresponding style property will be unset.
8177
*
8178
* @param {string} id ID of the node to update.
8179
* @param {object} styles Mapping from styles to values.
8180
* @internal
8181
*/
8182
updateStylesByID: function(id, styles) {
8183
var node = ReactMount.getNode(id);
8184
CSSPropertyOperations.setValueForStyles(node, styles);
8185
},
8186
8187
/**
8188
* Updates a DOM node's innerHTML.
8189
*
8190
* @param {string} id ID of the node to update.
8191
* @param {string} html An HTML string.
8192
* @internal
8193
*/
8194
updateInnerHTMLByID: function(id, html) {
8195
var node = ReactMount.getNode(id);
8196
setInnerHTML(node, html);
8197
},
8198
8199
/**
8200
* Updates a DOM node's text content set by `props.content`.
8201
*
8202
* @param {string} id ID of the node to update.
8203
* @param {string} content Text content.
8204
* @internal
8205
*/
8206
updateTextContentByID: function(id, content) {
8207
var node = ReactMount.getNode(id);
8208
DOMChildrenOperations.updateTextContent(node, content);
8209
},
8210
8211
/**
8212
* Replaces a DOM node that exists in the document with markup.
8213
*
8214
* @param {string} id ID of child to be replaced.
8215
* @param {string} markup Dangerous markup to inject in place of child.
8216
* @internal
8217
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
8218
*/
8219
dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
8220
var node = ReactMount.getNode(id);
8221
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
8222
},
8223
8224
/**
8225
* Updates a component's children by processing a series of updates.
8226
*
8227
* @param {array<object>} updates List of update configurations.
8228
* @param {array<string>} markup List of markup strings.
8229
* @internal
8230
*/
8231
dangerouslyProcessChildrenUpdates: function(updates, markup) {
8232
for (var i = 0; i < updates.length; i++) {
8233
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
8234
}
8235
DOMChildrenOperations.processUpdates(updates, markup);
8236
}
8237
};
8238
8239
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
8240
updatePropertyByID: 'updatePropertyByID',
8241
deletePropertyByID: 'deletePropertyByID',
8242
updateStylesByID: 'updateStylesByID',
8243
updateInnerHTMLByID: 'updateInnerHTMLByID',
8244
updateTextContentByID: 'updateTextContentByID',
8245
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
8246
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
8247
});
8248
8249
module.exports = ReactDOMIDOperations;
8250
8251
8252
}).call(this,require("FWaASH"))
8253
},{"./CSSPropertyOperations":5,"./DOMChildrenOperations":9,"./DOMPropertyOperations":11,"./ReactMount":71,"./ReactPerf":76,"./invariant":136,"./setInnerHTML":149,"FWaASH":1}],46:[function(require,module,exports){
8254
/**
8255
* Copyright 2013-2015, Facebook, Inc.
8256
* All rights reserved.
8257
*
8258
* This source code is licensed under the BSD-style license found in the
8259
* LICENSE file in the root directory of this source tree. An additional grant
8260
* of patent rights can be found in the PATENTS file in the same directory.
8261
*
8262
* @providesModule ReactDOMIframe
8263
*/
8264
8265
'use strict';
8266
8267
var EventConstants = require("./EventConstants");
8268
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
8269
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
8270
var ReactClass = require("./ReactClass");
8271
var ReactElement = require("./ReactElement");
8272
8273
var iframe = ReactElement.createFactory('iframe');
8274
8275
/**
8276
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
8277
* capture it on the <iframe> element itself. There are lots of hacks we could
8278
* do to accomplish this, but the most reliable is to make <iframe> a composite
8279
* component and use `componentDidMount` to attach the event handlers.
8280
*/
8281
var ReactDOMIframe = ReactClass.createClass({
8282
displayName: 'ReactDOMIframe',
8283
tagName: 'IFRAME',
8284
8285
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
8286
8287
render: function() {
8288
return iframe(this.props);
8289
},
8290
8291
componentDidMount: function() {
8292
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
8293
}
8294
});
8295
8296
module.exports = ReactDOMIframe;
8297
8298
8299
},{"./EventConstants":15,"./LocalEventTrapMixin":25,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58}],47:[function(require,module,exports){
8300
/**
8301
* Copyright 2013-2015, Facebook, Inc.
8302
* All rights reserved.
8303
*
8304
* This source code is licensed under the BSD-style license found in the
8305
* LICENSE file in the root directory of this source tree. An additional grant
8306
* of patent rights can be found in the PATENTS file in the same directory.
8307
*
8308
* @providesModule ReactDOMImg
8309
*/
8310
8311
'use strict';
8312
8313
var EventConstants = require("./EventConstants");
8314
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
8315
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
8316
var ReactClass = require("./ReactClass");
8317
var ReactElement = require("./ReactElement");
8318
8319
var img = ReactElement.createFactory('img');
8320
8321
/**
8322
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
8323
* capture it on the <img> element itself. There are lots of hacks we could do
8324
* to accomplish this, but the most reliable is to make <img> a composite
8325
* component and use `componentDidMount` to attach the event handlers.
8326
*/
8327
var ReactDOMImg = ReactClass.createClass({
8328
displayName: 'ReactDOMImg',
8329
tagName: 'IMG',
8330
8331
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
8332
8333
render: function() {
8334
return img(this.props);
8335
},
8336
8337
componentDidMount: function() {
8338
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
8339
this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
8340
}
8341
});
8342
8343
module.exports = ReactDOMImg;
8344
8345
8346
},{"./EventConstants":15,"./LocalEventTrapMixin":25,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58}],48:[function(require,module,exports){
8347
(function (process){
8348
/**
8349
* Copyright 2013-2015, Facebook, Inc.
8350
* All rights reserved.
8351
*
8352
* This source code is licensed under the BSD-style license found in the
8353
* LICENSE file in the root directory of this source tree. An additional grant
8354
* of patent rights can be found in the PATENTS file in the same directory.
8355
*
8356
* @providesModule ReactDOMInput
8357
*/
8358
8359
'use strict';
8360
8361
var AutoFocusMixin = require("./AutoFocusMixin");
8362
var DOMPropertyOperations = require("./DOMPropertyOperations");
8363
var LinkedValueUtils = require("./LinkedValueUtils");
8364
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
8365
var ReactClass = require("./ReactClass");
8366
var ReactElement = require("./ReactElement");
8367
var ReactMount = require("./ReactMount");
8368
var ReactUpdates = require("./ReactUpdates");
8369
8370
var assign = require("./Object.assign");
8371
var invariant = require("./invariant");
8372
8373
var input = ReactElement.createFactory('input');
8374
8375
var instancesByReactID = {};
8376
8377
function forceUpdateIfMounted() {
8378
/*jshint validthis:true */
8379
if (this.isMounted()) {
8380
this.forceUpdate();
8381
}
8382
}
8383
8384
/**
8385
* Implements an <input> native component that allows setting these optional
8386
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
8387
*
8388
* If `checked` or `value` are not supplied (or null/undefined), user actions
8389
* that affect the checked state or value will trigger updates to the element.
8390
*
8391
* If they are supplied (and not null/undefined), the rendered element will not
8392
* trigger updates to the element. Instead, the props must change in order for
8393
* the rendered element to be updated.
8394
*
8395
* The rendered element will be initialized as unchecked (or `defaultChecked`)
8396
* with an empty value (or `defaultValue`).
8397
*
8398
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
8399
*/
8400
var ReactDOMInput = ReactClass.createClass({
8401
displayName: 'ReactDOMInput',
8402
tagName: 'INPUT',
8403
8404
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
8405
8406
getInitialState: function() {
8407
var defaultValue = this.props.defaultValue;
8408
return {
8409
initialChecked: this.props.defaultChecked || false,
8410
initialValue: defaultValue != null ? defaultValue : null
8411
};
8412
},
8413
8414
render: function() {
8415
// Clone `this.props` so we don't mutate the input.
8416
var props = assign({}, this.props);
8417
8418
props.defaultChecked = null;
8419
props.defaultValue = null;
8420
8421
var value = LinkedValueUtils.getValue(this);
8422
props.value = value != null ? value : this.state.initialValue;
8423
8424
var checked = LinkedValueUtils.getChecked(this);
8425
props.checked = checked != null ? checked : this.state.initialChecked;
8426
8427
props.onChange = this._handleChange;
8428
8429
return input(props, this.props.children);
8430
},
8431
8432
componentDidMount: function() {
8433
var id = ReactMount.getID(this.getDOMNode());
8434
instancesByReactID[id] = this;
8435
},
8436
8437
componentWillUnmount: function() {
8438
var rootNode = this.getDOMNode();
8439
var id = ReactMount.getID(rootNode);
8440
delete instancesByReactID[id];
8441
},
8442
8443
componentDidUpdate: function(prevProps, prevState, prevContext) {
8444
var rootNode = this.getDOMNode();
8445
if (this.props.checked != null) {
8446
DOMPropertyOperations.setValueForProperty(
8447
rootNode,
8448
'checked',
8449
this.props.checked || false
8450
);
8451
}
8452
8453
var value = LinkedValueUtils.getValue(this);
8454
if (value != null) {
8455
// Cast `value` to a string to ensure the value is set correctly. While
8456
// browsers typically do this as necessary, jsdom doesn't.
8457
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
8458
}
8459
},
8460
8461
_handleChange: function(event) {
8462
var returnValue;
8463
var onChange = LinkedValueUtils.getOnChange(this);
8464
if (onChange) {
8465
returnValue = onChange.call(this, event);
8466
}
8467
// Here we use asap to wait until all updates have propagated, which
8468
// is important when using controlled components within layers:
8469
// https://github.com/facebook/react/issues/1698
8470
ReactUpdates.asap(forceUpdateIfMounted, this);
8471
8472
var name = this.props.name;
8473
if (this.props.type === 'radio' && name != null) {
8474
var rootNode = this.getDOMNode();
8475
var queryRoot = rootNode;
8476
8477
while (queryRoot.parentNode) {
8478
queryRoot = queryRoot.parentNode;
8479
}
8480
8481
// If `rootNode.form` was non-null, then we could try `form.elements`,
8482
// but that sometimes behaves strangely in IE8. We could also try using
8483
// `form.getElementsByName`, but that will only return direct children
8484
// and won't include inputs that use the HTML5 `form=` attribute. Since
8485
// the input might not even be in a form, let's just use the global
8486
// `querySelectorAll` to ensure we don't miss anything.
8487
var group = queryRoot.querySelectorAll(
8488
'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
8489
8490
for (var i = 0, groupLen = group.length; i < groupLen; i++) {
8491
var otherNode = group[i];
8492
if (otherNode === rootNode ||
8493
otherNode.form !== rootNode.form) {
8494
continue;
8495
}
8496
var otherID = ReactMount.getID(otherNode);
8497
("production" !== process.env.NODE_ENV ? invariant(
8498
otherID,
8499
'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
8500
'same `name` is not supported.'
8501
) : invariant(otherID));
8502
var otherInstance = instancesByReactID[otherID];
8503
("production" !== process.env.NODE_ENV ? invariant(
8504
otherInstance,
8505
'ReactDOMInput: Unknown radio button ID %s.',
8506
otherID
8507
) : invariant(otherInstance));
8508
// If this is a controlled radio button group, forcing the input that
8509
// was previously checked to update will cause it to be come re-checked
8510
// as appropriate.
8511
ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
8512
}
8513
}
8514
8515
return returnValue;
8516
}
8517
8518
});
8519
8520
module.exports = ReactDOMInput;
8521
8522
8523
}).call(this,require("FWaASH"))
8524
},{"./AutoFocusMixin":2,"./DOMPropertyOperations":11,"./LinkedValueUtils":24,"./Object.assign":27,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58,"./ReactMount":71,"./ReactUpdates":88,"./invariant":136,"FWaASH":1}],49:[function(require,module,exports){
8525
(function (process){
8526
/**
8527
* Copyright 2013-2015, Facebook, Inc.
8528
* All rights reserved.
8529
*
8530
* This source code is licensed under the BSD-style license found in the
8531
* LICENSE file in the root directory of this source tree. An additional grant
8532
* of patent rights can be found in the PATENTS file in the same directory.
8533
*
8534
* @providesModule ReactDOMOption
8535
*/
8536
8537
'use strict';
8538
8539
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
8540
var ReactClass = require("./ReactClass");
8541
var ReactElement = require("./ReactElement");
8542
8543
var warning = require("./warning");
8544
8545
var option = ReactElement.createFactory('option');
8546
8547
/**
8548
* Implements an <option> native component that warns when `selected` is set.
8549
*/
8550
var ReactDOMOption = ReactClass.createClass({
8551
displayName: 'ReactDOMOption',
8552
tagName: 'OPTION',
8553
8554
mixins: [ReactBrowserComponentMixin],
8555
8556
componentWillMount: function() {
8557
// TODO (yungsters): Remove support for `selected` in <option>.
8558
if ("production" !== process.env.NODE_ENV) {
8559
("production" !== process.env.NODE_ENV ? warning(
8560
this.props.selected == null,
8561
'Use the `defaultValue` or `value` props on <select> instead of ' +
8562
'setting `selected` on <option>.'
8563
) : null);
8564
}
8565
},
8566
8567
render: function() {
8568
return option(this.props, this.props.children);
8569
}
8570
8571
});
8572
8573
module.exports = ReactDOMOption;
8574
8575
8576
}).call(this,require("FWaASH"))
8577
},{"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58,"./warning":155,"FWaASH":1}],50:[function(require,module,exports){
8578
/**
8579
* Copyright 2013-2015, Facebook, Inc.
8580
* All rights reserved.
8581
*
8582
* This source code is licensed under the BSD-style license found in the
8583
* LICENSE file in the root directory of this source tree. An additional grant
8584
* of patent rights can be found in the PATENTS file in the same directory.
8585
*
8586
* @providesModule ReactDOMSelect
8587
*/
8588
8589
'use strict';
8590
8591
var AutoFocusMixin = require("./AutoFocusMixin");
8592
var LinkedValueUtils = require("./LinkedValueUtils");
8593
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
8594
var ReactClass = require("./ReactClass");
8595
var ReactElement = require("./ReactElement");
8596
var ReactUpdates = require("./ReactUpdates");
8597
8598
var assign = require("./Object.assign");
8599
8600
var select = ReactElement.createFactory('select');
8601
8602
function updateOptionsIfPendingUpdateAndMounted() {
8603
/*jshint validthis:true */
8604
if (this._pendingUpdate) {
8605
this._pendingUpdate = false;
8606
var value = LinkedValueUtils.getValue(this);
8607
if (value != null && this.isMounted()) {
8608
updateOptions(this, value);
8609
}
8610
}
8611
}
8612
8613
/**
8614
* Validation function for `value` and `defaultValue`.
8615
* @private
8616
*/
8617
function selectValueType(props, propName, componentName) {
8618
if (props[propName] == null) {
8619
return null;
8620
}
8621
if (props.multiple) {
8622
if (!Array.isArray(props[propName])) {
8623
return new Error(
8624
("The `" + propName + "` prop supplied to <select> must be an array if ") +
8625
("`multiple` is true.")
8626
);
8627
}
8628
} else {
8629
if (Array.isArray(props[propName])) {
8630
return new Error(
8631
("The `" + propName + "` prop supplied to <select> must be a scalar ") +
8632
("value if `multiple` is false.")
8633
);
8634
}
8635
}
8636
}
8637
8638
/**
8639
* @param {ReactComponent} component Instance of ReactDOMSelect
8640
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
8641
* @private
8642
*/
8643
function updateOptions(component, propValue) {
8644
var selectedValue, i, l;
8645
var options = component.getDOMNode().options;
8646
8647
if (component.props.multiple) {
8648
selectedValue = {};
8649
for (i = 0, l = propValue.length; i < l; i++) {
8650
selectedValue['' + propValue[i]] = true;
8651
}
8652
for (i = 0, l = options.length; i < l; i++) {
8653
var selected = selectedValue.hasOwnProperty(options[i].value);
8654
if (options[i].selected !== selected) {
8655
options[i].selected = selected;
8656
}
8657
}
8658
} else {
8659
// Do not set `select.value` as exact behavior isn't consistent across all
8660
// browsers for all cases.
8661
selectedValue = '' + propValue;
8662
for (i = 0, l = options.length; i < l; i++) {
8663
if (options[i].value === selectedValue) {
8664
options[i].selected = true;
8665
return;
8666
}
8667
}
8668
options[0].selected = true;
8669
}
8670
}
8671
8672
/**
8673
* Implements a <select> native component that allows optionally setting the
8674
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
8675
* stringable. If `multiple` is true, the prop must be an array of stringables.
8676
*
8677
* If `value` is not supplied (or null/undefined), user actions that change the
8678
* selected option will trigger updates to the rendered options.
8679
*
8680
* If it is supplied (and not null/undefined), the rendered options will not
8681
* update in response to user actions. Instead, the `value` prop must change in
8682
* order for the rendered options to update.
8683
*
8684
* If `defaultValue` is provided, any options with the supplied values will be
8685
* selected.
8686
*/
8687
var ReactDOMSelect = ReactClass.createClass({
8688
displayName: 'ReactDOMSelect',
8689
tagName: 'SELECT',
8690
8691
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
8692
8693
propTypes: {
8694
defaultValue: selectValueType,
8695
value: selectValueType
8696
},
8697
8698
render: function() {
8699
// Clone `this.props` so we don't mutate the input.
8700
var props = assign({}, this.props);
8701
8702
props.onChange = this._handleChange;
8703
props.value = null;
8704
8705
return select(props, this.props.children);
8706
},
8707
8708
componentWillMount: function() {
8709
this._pendingUpdate = false;
8710
},
8711
8712
componentDidMount: function() {
8713
var value = LinkedValueUtils.getValue(this);
8714
if (value != null) {
8715
updateOptions(this, value);
8716
} else if (this.props.defaultValue != null) {
8717
updateOptions(this, this.props.defaultValue);
8718
}
8719
},
8720
8721
componentDidUpdate: function(prevProps) {
8722
var value = LinkedValueUtils.getValue(this);
8723
if (value != null) {
8724
this._pendingUpdate = false;
8725
updateOptions(this, value);
8726
} else if (!prevProps.multiple !== !this.props.multiple) {
8727
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
8728
if (this.props.defaultValue != null) {
8729
updateOptions(this, this.props.defaultValue);
8730
} else {
8731
// Revert the select back to its default unselected state.
8732
updateOptions(this, this.props.multiple ? [] : '');
8733
}
8734
}
8735
},
8736
8737
_handleChange: function(event) {
8738
var returnValue;
8739
var onChange = LinkedValueUtils.getOnChange(this);
8740
if (onChange) {
8741
returnValue = onChange.call(this, event);
8742
}
8743
8744
this._pendingUpdate = true;
8745
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
8746
return returnValue;
8747
}
8748
8749
});
8750
8751
module.exports = ReactDOMSelect;
8752
8753
8754
},{"./AutoFocusMixin":2,"./LinkedValueUtils":24,"./Object.assign":27,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58,"./ReactUpdates":88}],51:[function(require,module,exports){
8755
/**
8756
* Copyright 2013-2015, Facebook, Inc.
8757
* All rights reserved.
8758
*
8759
* This source code is licensed under the BSD-style license found in the
8760
* LICENSE file in the root directory of this source tree. An additional grant
8761
* of patent rights can be found in the PATENTS file in the same directory.
8762
*
8763
* @providesModule ReactDOMSelection
8764
*/
8765
8766
'use strict';
8767
8768
var ExecutionEnvironment = require("./ExecutionEnvironment");
8769
8770
var getNodeForCharacterOffset = require("./getNodeForCharacterOffset");
8771
var getTextContentAccessor = require("./getTextContentAccessor");
8772
8773
/**
8774
* While `isCollapsed` is available on the Selection object and `collapsed`
8775
* is available on the Range object, IE11 sometimes gets them wrong.
8776
* If the anchor/focus nodes and offsets are the same, the range is collapsed.
8777
*/
8778
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
8779
return anchorNode === focusNode && anchorOffset === focusOffset;
8780
}
8781
8782
/**
8783
* Get the appropriate anchor and focus node/offset pairs for IE.
8784
*
8785
* The catch here is that IE's selection API doesn't provide information
8786
* about whether the selection is forward or backward, so we have to
8787
* behave as though it's always forward.
8788
*
8789
* IE text differs from modern selection in that it behaves as though
8790
* block elements end with a new line. This means character offsets will
8791
* differ between the two APIs.
8792
*
8793
* @param {DOMElement} node
8794
* @return {object}
8795
*/
8796
function getIEOffsets(node) {
8797
var selection = document.selection;
8798
var selectedRange = selection.createRange();
8799
var selectedLength = selectedRange.text.length;
8800
8801
// Duplicate selection so we can move range without breaking user selection.
8802
var fromStart = selectedRange.duplicate();
8803
fromStart.moveToElementText(node);
8804
fromStart.setEndPoint('EndToStart', selectedRange);
8805
8806
var startOffset = fromStart.text.length;
8807
var endOffset = startOffset + selectedLength;
8808
8809
return {
8810
start: startOffset,
8811
end: endOffset
8812
};
8813
}
8814
8815
/**
8816
* @param {DOMElement} node
8817
* @return {?object}
8818
*/
8819
function getModernOffsets(node) {
8820
var selection = window.getSelection && window.getSelection();
8821
8822
if (!selection || selection.rangeCount === 0) {
8823
return null;
8824
}
8825
8826
var anchorNode = selection.anchorNode;
8827
var anchorOffset = selection.anchorOffset;
8828
var focusNode = selection.focusNode;
8829
var focusOffset = selection.focusOffset;
8830
8831
var currentRange = selection.getRangeAt(0);
8832
8833
// If the node and offset values are the same, the selection is collapsed.
8834
// `Selection.isCollapsed` is available natively, but IE sometimes gets
8835
// this value wrong.
8836
var isSelectionCollapsed = isCollapsed(
8837
selection.anchorNode,
8838
selection.anchorOffset,
8839
selection.focusNode,
8840
selection.focusOffset
8841
);
8842
8843
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
8844
8845
var tempRange = currentRange.cloneRange();
8846
tempRange.selectNodeContents(node);
8847
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
8848
8849
var isTempRangeCollapsed = isCollapsed(
8850
tempRange.startContainer,
8851
tempRange.startOffset,
8852
tempRange.endContainer,
8853
tempRange.endOffset
8854
);
8855
8856
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
8857
var end = start + rangeLength;
8858
8859
// Detect whether the selection is backward.
8860
var detectionRange = document.createRange();
8861
detectionRange.setStart(anchorNode, anchorOffset);
8862
detectionRange.setEnd(focusNode, focusOffset);
8863
var isBackward = detectionRange.collapsed;
8864
8865
return {
8866
start: isBackward ? end : start,
8867
end: isBackward ? start : end
8868
};
8869
}
8870
8871
/**
8872
* @param {DOMElement|DOMTextNode} node
8873
* @param {object} offsets
8874
*/
8875
function setIEOffsets(node, offsets) {
8876
var range = document.selection.createRange().duplicate();
8877
var start, end;
8878
8879
if (typeof offsets.end === 'undefined') {
8880
start = offsets.start;
8881
end = start;
8882
} else if (offsets.start > offsets.end) {
8883
start = offsets.end;
8884
end = offsets.start;
8885
} else {
8886
start = offsets.start;
8887
end = offsets.end;
8888
}
8889
8890
range.moveToElementText(node);
8891
range.moveStart('character', start);
8892
range.setEndPoint('EndToStart', range);
8893
range.moveEnd('character', end - start);
8894
range.select();
8895
}
8896
8897
/**
8898
* In modern non-IE browsers, we can support both forward and backward
8899
* selections.
8900
*
8901
* Note: IE10+ supports the Selection object, but it does not support
8902
* the `extend` method, which means that even in modern IE, it's not possible
8903
* to programatically create a backward selection. Thus, for all IE
8904
* versions, we use the old IE API to create our selections.
8905
*
8906
* @param {DOMElement|DOMTextNode} node
8907
* @param {object} offsets
8908
*/
8909
function setModernOffsets(node, offsets) {
8910
if (!window.getSelection) {
8911
return;
8912
}
8913
8914
var selection = window.getSelection();
8915
var length = node[getTextContentAccessor()].length;
8916
var start = Math.min(offsets.start, length);
8917
var end = typeof offsets.end === 'undefined' ?
8918
start : Math.min(offsets.end, length);
8919
8920
// IE 11 uses modern selection, but doesn't support the extend method.
8921
// Flip backward selections, so we can set with a single range.
8922
if (!selection.extend && start > end) {
8923
var temp = end;
8924
end = start;
8925
start = temp;
8926
}
8927
8928
var startMarker = getNodeForCharacterOffset(node, start);
8929
var endMarker = getNodeForCharacterOffset(node, end);
8930
8931
if (startMarker && endMarker) {
8932
var range = document.createRange();
8933
range.setStart(startMarker.node, startMarker.offset);
8934
selection.removeAllRanges();
8935
8936
if (start > end) {
8937
selection.addRange(range);
8938
selection.extend(endMarker.node, endMarker.offset);
8939
} else {
8940
range.setEnd(endMarker.node, endMarker.offset);
8941
selection.addRange(range);
8942
}
8943
}
8944
}
8945
8946
var useIEOffsets = (
8947
ExecutionEnvironment.canUseDOM &&
8948
'selection' in document &&
8949
!('getSelection' in window)
8950
);
8951
8952
var ReactDOMSelection = {
8953
/**
8954
* @param {DOMElement} node
8955
*/
8956
getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
8957
8958
/**
8959
* @param {DOMElement|DOMTextNode} node
8960
* @param {object} offsets
8961
*/
8962
setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
8963
};
8964
8965
module.exports = ReactDOMSelection;
8966
8967
8968
},{"./ExecutionEnvironment":21,"./getNodeForCharacterOffset":129,"./getTextContentAccessor":131}],52:[function(require,module,exports){
8969
/**
8970
* Copyright 2013-2015, Facebook, Inc.
8971
* All rights reserved.
8972
*
8973
* This source code is licensed under the BSD-style license found in the
8974
* LICENSE file in the root directory of this source tree. An additional grant
8975
* of patent rights can be found in the PATENTS file in the same directory.
8976
*
8977
* @providesModule ReactDOMTextComponent
8978
* @typechecks static-only
8979
*/
8980
8981
'use strict';
8982
8983
var DOMPropertyOperations = require("./DOMPropertyOperations");
8984
var ReactComponentBrowserEnvironment =
8985
require("./ReactComponentBrowserEnvironment");
8986
var ReactDOMComponent = require("./ReactDOMComponent");
8987
8988
var assign = require("./Object.assign");
8989
var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
8990
8991
/**
8992
* Text nodes violate a couple assumptions that React makes about components:
8993
*
8994
* - When mounting text into the DOM, adjacent text nodes are merged.
8995
* - Text nodes cannot be assigned a React root ID.
8996
*
8997
* This component is used to wrap strings in elements so that they can undergo
8998
* the same reconciliation that is applied to elements.
8999
*
9000
* TODO: Investigate representing React components in the DOM with text nodes.
9001
*
9002
* @class ReactDOMTextComponent
9003
* @extends ReactComponent
9004
* @internal
9005
*/
9006
var ReactDOMTextComponent = function(props) {
9007
// This constructor and its argument is currently used by mocks.
9008
};
9009
9010
assign(ReactDOMTextComponent.prototype, {
9011
9012
/**
9013
* @param {ReactText} text
9014
* @internal
9015
*/
9016
construct: function(text) {
9017
// TODO: This is really a ReactText (ReactNode), not a ReactElement
9018
this._currentElement = text;
9019
this._stringText = '' + text;
9020
9021
// Properties
9022
this._rootNodeID = null;
9023
this._mountIndex = 0;
9024
},
9025
9026
/**
9027
* Creates the markup for this text node. This node is not intended to have
9028
* any features besides containing text content.
9029
*
9030
* @param {string} rootID DOM ID of the root node.
9031
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
9032
* @return {string} Markup for this text node.
9033
* @internal
9034
*/
9035
mountComponent: function(rootID, transaction, context) {
9036
this._rootNodeID = rootID;
9037
var escapedText = escapeTextContentForBrowser(this._stringText);
9038
9039
if (transaction.renderToStaticMarkup) {
9040
// Normally we'd wrap this in a `span` for the reasons stated above, but
9041
// since this is a situation where React won't take over (static pages),
9042
// we can simply return the text as it is.
9043
return escapedText;
9044
}
9045
9046
return (
9047
'<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
9048
escapedText +
9049
'</span>'
9050
);
9051
},
9052
9053
/**
9054
* Updates this component by updating the text content.
9055
*
9056
* @param {ReactText} nextText The next text content
9057
* @param {ReactReconcileTransaction} transaction
9058
* @internal
9059
*/
9060
receiveComponent: function(nextText, transaction) {
9061
if (nextText !== this._currentElement) {
9062
this._currentElement = nextText;
9063
var nextStringText = '' + nextText;
9064
if (nextStringText !== this._stringText) {
9065
// TODO: Save this as pending props and use performUpdateIfNecessary
9066
// and/or updateComponent to do the actual update for consistency with
9067
// other component types?
9068
this._stringText = nextStringText;
9069
ReactDOMComponent.BackendIDOperations.updateTextContentByID(
9070
this._rootNodeID,
9071
nextStringText
9072
);
9073
}
9074
}
9075
},
9076
9077
unmountComponent: function() {
9078
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
9079
}
9080
9081
});
9082
9083
module.exports = ReactDOMTextComponent;
9084
9085
9086
},{"./DOMPropertyOperations":11,"./Object.assign":27,"./ReactComponentBrowserEnvironment":36,"./ReactDOMComponent":43,"./escapeTextContentForBrowser":117}],53:[function(require,module,exports){
9087
(function (process){
9088
/**
9089
* Copyright 2013-2015, Facebook, Inc.
9090
* All rights reserved.
9091
*
9092
* This source code is licensed under the BSD-style license found in the
9093
* LICENSE file in the root directory of this source tree. An additional grant
9094
* of patent rights can be found in the PATENTS file in the same directory.
9095
*
9096
* @providesModule ReactDOMTextarea
9097
*/
9098
9099
'use strict';
9100
9101
var AutoFocusMixin = require("./AutoFocusMixin");
9102
var DOMPropertyOperations = require("./DOMPropertyOperations");
9103
var LinkedValueUtils = require("./LinkedValueUtils");
9104
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
9105
var ReactClass = require("./ReactClass");
9106
var ReactElement = require("./ReactElement");
9107
var ReactUpdates = require("./ReactUpdates");
9108
9109
var assign = require("./Object.assign");
9110
var invariant = require("./invariant");
9111
9112
var warning = require("./warning");
9113
9114
var textarea = ReactElement.createFactory('textarea');
9115
9116
function forceUpdateIfMounted() {
9117
/*jshint validthis:true */
9118
if (this.isMounted()) {
9119
this.forceUpdate();
9120
}
9121
}
9122
9123
/**
9124
* Implements a <textarea> native component that allows setting `value`, and
9125
* `defaultValue`. This differs from the traditional DOM API because value is
9126
* usually set as PCDATA children.
9127
*
9128
* If `value` is not supplied (or null/undefined), user actions that affect the
9129
* value will trigger updates to the element.
9130
*
9131
* If `value` is supplied (and not null/undefined), the rendered element will
9132
* not trigger updates to the element. Instead, the `value` prop must change in
9133
* order for the rendered element to be updated.
9134
*
9135
* The rendered element will be initialized with an empty value, the prop
9136
* `defaultValue` if specified, or the children content (deprecated).
9137
*/
9138
var ReactDOMTextarea = ReactClass.createClass({
9139
displayName: 'ReactDOMTextarea',
9140
tagName: 'TEXTAREA',
9141
9142
mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
9143
9144
getInitialState: function() {
9145
var defaultValue = this.props.defaultValue;
9146
// TODO (yungsters): Remove support for children content in <textarea>.
9147
var children = this.props.children;
9148
if (children != null) {
9149
if ("production" !== process.env.NODE_ENV) {
9150
("production" !== process.env.NODE_ENV ? warning(
9151
false,
9152
'Use the `defaultValue` or `value` props instead of setting ' +
9153
'children on <textarea>.'
9154
) : null);
9155
}
9156
("production" !== process.env.NODE_ENV ? invariant(
9157
defaultValue == null,
9158
'If you supply `defaultValue` on a <textarea>, do not pass children.'
9159
) : invariant(defaultValue == null));
9160
if (Array.isArray(children)) {
9161
("production" !== process.env.NODE_ENV ? invariant(
9162
children.length <= 1,
9163
'<textarea> can only have at most one child.'
9164
) : invariant(children.length <= 1));
9165
children = children[0];
9166
}
9167
9168
defaultValue = '' + children;
9169
}
9170
if (defaultValue == null) {
9171
defaultValue = '';
9172
}
9173
var value = LinkedValueUtils.getValue(this);
9174
return {
9175
// We save the initial value so that `ReactDOMComponent` doesn't update
9176
// `textContent` (unnecessary since we update value).
9177
// The initial value can be a boolean or object so that's why it's
9178
// forced to be a string.
9179
initialValue: '' + (value != null ? value : defaultValue)
9180
};
9181
},
9182
9183
render: function() {
9184
// Clone `this.props` so we don't mutate the input.
9185
var props = assign({}, this.props);
9186
9187
("production" !== process.env.NODE_ENV ? invariant(
9188
props.dangerouslySetInnerHTML == null,
9189
'`dangerouslySetInnerHTML` does not make sense on <textarea>.'
9190
) : invariant(props.dangerouslySetInnerHTML == null));
9191
9192
props.defaultValue = null;
9193
props.value = null;
9194
props.onChange = this._handleChange;
9195
9196
// Always set children to the same thing. In IE9, the selection range will
9197
// get reset if `textContent` is mutated.
9198
return textarea(props, this.state.initialValue);
9199
},
9200
9201
componentDidUpdate: function(prevProps, prevState, prevContext) {
9202
var value = LinkedValueUtils.getValue(this);
9203
if (value != null) {
9204
var rootNode = this.getDOMNode();
9205
// Cast `value` to a string to ensure the value is set correctly. While
9206
// browsers typically do this as necessary, jsdom doesn't.
9207
DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
9208
}
9209
},
9210
9211
_handleChange: function(event) {
9212
var returnValue;
9213
var onChange = LinkedValueUtils.getOnChange(this);
9214
if (onChange) {
9215
returnValue = onChange.call(this, event);
9216
}
9217
ReactUpdates.asap(forceUpdateIfMounted, this);
9218
return returnValue;
9219
}
9220
9221
});
9222
9223
module.exports = ReactDOMTextarea;
9224
9225
9226
}).call(this,require("FWaASH"))
9227
},{"./AutoFocusMixin":2,"./DOMPropertyOperations":11,"./LinkedValueUtils":24,"./Object.assign":27,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactElement":58,"./ReactUpdates":88,"./invariant":136,"./warning":155,"FWaASH":1}],54:[function(require,module,exports){
9228
/**
9229
* Copyright 2013-2015, Facebook, Inc.
9230
* All rights reserved.
9231
*
9232
* This source code is licensed under the BSD-style license found in the
9233
* LICENSE file in the root directory of this source tree. An additional grant
9234
* of patent rights can be found in the PATENTS file in the same directory.
9235
*
9236
* @providesModule ReactDefaultBatchingStrategy
9237
*/
9238
9239
'use strict';
9240
9241
var ReactUpdates = require("./ReactUpdates");
9242
var Transaction = require("./Transaction");
9243
9244
var assign = require("./Object.assign");
9245
var emptyFunction = require("./emptyFunction");
9246
9247
var RESET_BATCHED_UPDATES = {
9248
initialize: emptyFunction,
9249
close: function() {
9250
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
9251
}
9252
};
9253
9254
var FLUSH_BATCHED_UPDATES = {
9255
initialize: emptyFunction,
9256
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
9257
};
9258
9259
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
9260
9261
function ReactDefaultBatchingStrategyTransaction() {
9262
this.reinitializeTransaction();
9263
}
9264
9265
assign(
9266
ReactDefaultBatchingStrategyTransaction.prototype,
9267
Transaction.Mixin,
9268
{
9269
getTransactionWrappers: function() {
9270
return TRANSACTION_WRAPPERS;
9271
}
9272
}
9273
);
9274
9275
var transaction = new ReactDefaultBatchingStrategyTransaction();
9276
9277
var ReactDefaultBatchingStrategy = {
9278
isBatchingUpdates: false,
9279
9280
/**
9281
* Call the provided function in a context within which calls to `setState`
9282
* and friends are batched such that components aren't updated unnecessarily.
9283
*/
9284
batchedUpdates: function(callback, a, b, c, d) {
9285
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
9286
9287
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
9288
9289
// The code is written this way to avoid extra allocations
9290
if (alreadyBatchingUpdates) {
9291
callback(a, b, c, d);
9292
} else {
9293
transaction.perform(callback, null, a, b, c, d);
9294
}
9295
}
9296
};
9297
9298
module.exports = ReactDefaultBatchingStrategy;
9299
9300
9301
},{"./Object.assign":27,"./ReactUpdates":88,"./Transaction":104,"./emptyFunction":115}],55:[function(require,module,exports){
9302
(function (process){
9303
/**
9304
* Copyright 2013-2015, Facebook, Inc.
9305
* All rights reserved.
9306
*
9307
* This source code is licensed under the BSD-style license found in the
9308
* LICENSE file in the root directory of this source tree. An additional grant
9309
* of patent rights can be found in the PATENTS file in the same directory.
9310
*
9311
* @providesModule ReactDefaultInjection
9312
*/
9313
9314
'use strict';
9315
9316
var BeforeInputEventPlugin = require("./BeforeInputEventPlugin");
9317
var ChangeEventPlugin = require("./ChangeEventPlugin");
9318
var ClientReactRootIndex = require("./ClientReactRootIndex");
9319
var DefaultEventPluginOrder = require("./DefaultEventPluginOrder");
9320
var EnterLeaveEventPlugin = require("./EnterLeaveEventPlugin");
9321
var ExecutionEnvironment = require("./ExecutionEnvironment");
9322
var HTMLDOMPropertyConfig = require("./HTMLDOMPropertyConfig");
9323
var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin");
9324
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
9325
var ReactClass = require("./ReactClass");
9326
var ReactComponentBrowserEnvironment =
9327
require("./ReactComponentBrowserEnvironment");
9328
var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
9329
var ReactDOMComponent = require("./ReactDOMComponent");
9330
var ReactDOMButton = require("./ReactDOMButton");
9331
var ReactDOMForm = require("./ReactDOMForm");
9332
var ReactDOMImg = require("./ReactDOMImg");
9333
var ReactDOMIDOperations = require("./ReactDOMIDOperations");
9334
var ReactDOMIframe = require("./ReactDOMIframe");
9335
var ReactDOMInput = require("./ReactDOMInput");
9336
var ReactDOMOption = require("./ReactDOMOption");
9337
var ReactDOMSelect = require("./ReactDOMSelect");
9338
var ReactDOMTextarea = require("./ReactDOMTextarea");
9339
var ReactDOMTextComponent = require("./ReactDOMTextComponent");
9340
var ReactElement = require("./ReactElement");
9341
var ReactEventListener = require("./ReactEventListener");
9342
var ReactInjection = require("./ReactInjection");
9343
var ReactInstanceHandles = require("./ReactInstanceHandles");
9344
var ReactMount = require("./ReactMount");
9345
var ReactReconcileTransaction = require("./ReactReconcileTransaction");
9346
var SelectEventPlugin = require("./SelectEventPlugin");
9347
var ServerReactRootIndex = require("./ServerReactRootIndex");
9348
var SimpleEventPlugin = require("./SimpleEventPlugin");
9349
var SVGDOMPropertyConfig = require("./SVGDOMPropertyConfig");
9350
9351
var createFullPageComponent = require("./createFullPageComponent");
9352
9353
function autoGenerateWrapperClass(type) {
9354
return ReactClass.createClass({
9355
tagName: type.toUpperCase(),
9356
render: function() {
9357
return new ReactElement(
9358
type,
9359
null,
9360
null,
9361
null,
9362
null,
9363
this.props
9364
);
9365
}
9366
});
9367
}
9368
9369
function inject() {
9370
ReactInjection.EventEmitter.injectReactEventListener(
9371
ReactEventListener
9372
);
9373
9374
/**
9375
* Inject modules for resolving DOM hierarchy and plugin ordering.
9376
*/
9377
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
9378
ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
9379
ReactInjection.EventPluginHub.injectMount(ReactMount);
9380
9381
/**
9382
* Some important event plugins included by default (without having to require
9383
* them).
9384
*/
9385
ReactInjection.EventPluginHub.injectEventPluginsByName({
9386
SimpleEventPlugin: SimpleEventPlugin,
9387
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
9388
ChangeEventPlugin: ChangeEventPlugin,
9389
MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
9390
SelectEventPlugin: SelectEventPlugin,
9391
BeforeInputEventPlugin: BeforeInputEventPlugin
9392
});
9393
9394
ReactInjection.NativeComponent.injectGenericComponentClass(
9395
ReactDOMComponent
9396
);
9397
9398
ReactInjection.NativeComponent.injectTextComponentClass(
9399
ReactDOMTextComponent
9400
);
9401
9402
ReactInjection.NativeComponent.injectAutoWrapper(
9403
autoGenerateWrapperClass
9404
);
9405
9406
// This needs to happen before createFullPageComponent() otherwise the mixin
9407
// won't be included.
9408
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
9409
9410
ReactInjection.NativeComponent.injectComponentClasses({
9411
'button': ReactDOMButton,
9412
'form': ReactDOMForm,
9413
'iframe': ReactDOMIframe,
9414
'img': ReactDOMImg,
9415
'input': ReactDOMInput,
9416
'option': ReactDOMOption,
9417
'select': ReactDOMSelect,
9418
'textarea': ReactDOMTextarea,
9419
9420
'html': createFullPageComponent('html'),
9421
'head': createFullPageComponent('head'),
9422
'body': createFullPageComponent('body')
9423
});
9424
9425
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
9426
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
9427
9428
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
9429
9430
ReactInjection.Updates.injectReconcileTransaction(
9431
ReactReconcileTransaction
9432
);
9433
ReactInjection.Updates.injectBatchingStrategy(
9434
ReactDefaultBatchingStrategy
9435
);
9436
9437
ReactInjection.RootIndex.injectCreateReactRootIndex(
9438
ExecutionEnvironment.canUseDOM ?
9439
ClientReactRootIndex.createReactRootIndex :
9440
ServerReactRootIndex.createReactRootIndex
9441
);
9442
9443
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
9444
ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
9445
9446
if ("production" !== process.env.NODE_ENV) {
9447
var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
9448
if ((/[?&]react_perf\b/).test(url)) {
9449
var ReactDefaultPerf = require("./ReactDefaultPerf");
9450
ReactDefaultPerf.start();
9451
}
9452
}
9453
}
9454
9455
module.exports = {
9456
inject: inject
9457
};
9458
9459
9460
}).call(this,require("FWaASH"))
9461
},{"./BeforeInputEventPlugin":3,"./ChangeEventPlugin":7,"./ClientReactRootIndex":8,"./DefaultEventPluginOrder":13,"./EnterLeaveEventPlugin":14,"./ExecutionEnvironment":21,"./HTMLDOMPropertyConfig":23,"./MobileSafariClickEventPlugin":26,"./ReactBrowserComponentMixin":30,"./ReactClass":34,"./ReactComponentBrowserEnvironment":36,"./ReactDOMButton":42,"./ReactDOMComponent":43,"./ReactDOMForm":44,"./ReactDOMIDOperations":45,"./ReactDOMIframe":46,"./ReactDOMImg":47,"./ReactDOMInput":48,"./ReactDOMOption":49,"./ReactDOMSelect":50,"./ReactDOMTextComponent":52,"./ReactDOMTextarea":53,"./ReactDefaultBatchingStrategy":54,"./ReactDefaultPerf":56,"./ReactElement":58,"./ReactEventListener":63,"./ReactInjection":65,"./ReactInstanceHandles":67,"./ReactMount":71,"./ReactReconcileTransaction":81,"./SVGDOMPropertyConfig":89,"./SelectEventPlugin":90,"./ServerReactRootIndex":91,"./SimpleEventPlugin":92,"./createFullPageComponent":112,"FWaASH":1}],56:[function(require,module,exports){
9462
/**
9463
* Copyright 2013-2015, Facebook, Inc.
9464
* All rights reserved.
9465
*
9466
* This source code is licensed under the BSD-style license found in the
9467
* LICENSE file in the root directory of this source tree. An additional grant
9468
* of patent rights can be found in the PATENTS file in the same directory.
9469
*
9470
* @providesModule ReactDefaultPerf
9471
* @typechecks static-only
9472
*/
9473
9474
'use strict';
9475
9476
var DOMProperty = require("./DOMProperty");
9477
var ReactDefaultPerfAnalysis = require("./ReactDefaultPerfAnalysis");
9478
var ReactMount = require("./ReactMount");
9479
var ReactPerf = require("./ReactPerf");
9480
9481
var performanceNow = require("./performanceNow");
9482
9483
function roundFloat(val) {
9484
return Math.floor(val * 100) / 100;
9485
}
9486
9487
function addValue(obj, key, val) {
9488
obj[key] = (obj[key] || 0) + val;
9489
}
9490
9491
var ReactDefaultPerf = {
9492
_allMeasurements: [], // last item in the list is the current one
9493
_mountStack: [0],
9494
_injected: false,
9495
9496
start: function() {
9497
if (!ReactDefaultPerf._injected) {
9498
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
9499
}
9500
9501
ReactDefaultPerf._allMeasurements.length = 0;
9502
ReactPerf.enableMeasure = true;
9503
},
9504
9505
stop: function() {
9506
ReactPerf.enableMeasure = false;
9507
},
9508
9509
getLastMeasurements: function() {
9510
return ReactDefaultPerf._allMeasurements;
9511
},
9512
9513
printExclusive: function(measurements) {
9514
measurements = measurements || ReactDefaultPerf._allMeasurements;
9515
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
9516
console.table(summary.map(function(item) {
9517
return {
9518
'Component class name': item.componentName,
9519
'Total inclusive time (ms)': roundFloat(item.inclusive),
9520
'Exclusive mount time (ms)': roundFloat(item.exclusive),
9521
'Exclusive render time (ms)': roundFloat(item.render),
9522
'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
9523
'Render time per instance (ms)': roundFloat(item.render / item.count),
9524
'Instances': item.count
9525
};
9526
}));
9527
// TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
9528
// number.
9529
},
9530
9531
printInclusive: function(measurements) {
9532
measurements = measurements || ReactDefaultPerf._allMeasurements;
9533
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
9534
console.table(summary.map(function(item) {
9535
return {
9536
'Owner > component': item.componentName,
9537
'Inclusive time (ms)': roundFloat(item.time),
9538
'Instances': item.count
9539
};
9540
}));
9541
console.log(
9542
'Total time:',
9543
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
9544
);
9545
},
9546
9547
getMeasurementsSummaryMap: function(measurements) {
9548
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
9549
measurements,
9550
true
9551
);
9552
return summary.map(function(item) {
9553
return {
9554
'Owner > component': item.componentName,
9555
'Wasted time (ms)': item.time,
9556
'Instances': item.count
9557
};
9558
});
9559
},
9560
9561
printWasted: function(measurements) {
9562
measurements = measurements || ReactDefaultPerf._allMeasurements;
9563
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
9564
console.log(
9565
'Total time:',
9566
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
9567
);
9568
},
9569
9570
printDOM: function(measurements) {
9571
measurements = measurements || ReactDefaultPerf._allMeasurements;
9572
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
9573
console.table(summary.map(function(item) {
9574
var result = {};
9575
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
9576
result['type'] = item.type;
9577
result['args'] = JSON.stringify(item.args);
9578
return result;
9579
}));
9580
console.log(
9581
'Total time:',
9582
ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
9583
);
9584
},
9585
9586
_recordWrite: function(id, fnName, totalTime, args) {
9587
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
9588
var writes =
9589
ReactDefaultPerf
9590
._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
9591
.writes;
9592
writes[id] = writes[id] || [];
9593
writes[id].push({
9594
type: fnName,
9595
time: totalTime,
9596
args: args
9597
});
9598
},
9599
9600
measure: function(moduleName, fnName, func) {
9601
return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
9602
var totalTime;
9603
var rv;
9604
var start;
9605
9606
if (fnName === '_renderNewRootComponent' ||
9607
fnName === 'flushBatchedUpdates') {
9608
// A "measurement" is a set of metrics recorded for each flush. We want
9609
// to group the metrics for a given flush together so we can look at the
9610
// components that rendered and the DOM operations that actually
9611
// happened to determine the amount of "wasted work" performed.
9612
ReactDefaultPerf._allMeasurements.push({
9613
exclusive: {},
9614
inclusive: {},
9615
render: {},
9616
counts: {},
9617
writes: {},
9618
displayNames: {},
9619
totalTime: 0
9620
});
9621
start = performanceNow();
9622
rv = func.apply(this, args);
9623
ReactDefaultPerf._allMeasurements[
9624
ReactDefaultPerf._allMeasurements.length - 1
9625
].totalTime = performanceNow() - start;
9626
return rv;
9627
} else if (moduleName === 'ReactDOMIDOperations' ||
9628
moduleName === 'ReactComponentBrowserEnvironment') {
9629
start = performanceNow();
9630
rv = func.apply(this, args);
9631
totalTime = performanceNow() - start;
9632
9633
if (fnName === '_mountImageIntoNode') {
9634
var mountID = ReactMount.getID(args[1]);
9635
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
9636
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
9637
// special format
9638
args[0].forEach(function(update) {
9639
var writeArgs = {};
9640
if (update.fromIndex !== null) {
9641
writeArgs.fromIndex = update.fromIndex;
9642
}
9643
if (update.toIndex !== null) {
9644
writeArgs.toIndex = update.toIndex;
9645
}
9646
if (update.textContent !== null) {
9647
writeArgs.textContent = update.textContent;
9648
}
9649
if (update.markupIndex !== null) {
9650
writeArgs.markup = args[1][update.markupIndex];
9651
}
9652
ReactDefaultPerf._recordWrite(
9653
update.parentID,
9654
update.type,
9655
totalTime,
9656
writeArgs
9657
);
9658
});
9659
} else {
9660
// basic format
9661
ReactDefaultPerf._recordWrite(
9662
args[0],
9663
fnName,
9664
totalTime,
9665
Array.prototype.slice.call(args, 1)
9666
);
9667
}
9668
return rv;
9669
} else if (moduleName === 'ReactCompositeComponent' && (
9670
(// TODO: receiveComponent()?
9671
(fnName === 'mountComponent' ||
9672
fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
9673
9674
var rootNodeID = fnName === 'mountComponent' ?
9675
args[0] :
9676
this._rootNodeID;
9677
var isRender = fnName === '_renderValidatedComponent';
9678
var isMount = fnName === 'mountComponent';
9679
9680
var mountStack = ReactDefaultPerf._mountStack;
9681
var entry = ReactDefaultPerf._allMeasurements[
9682
ReactDefaultPerf._allMeasurements.length - 1
9683
];
9684
9685
if (isRender) {
9686
addValue(entry.counts, rootNodeID, 1);
9687
} else if (isMount) {
9688
mountStack.push(0);
9689
}
9690
9691
start = performanceNow();
9692
rv = func.apply(this, args);
9693
totalTime = performanceNow() - start;
9694
9695
if (isRender) {
9696
addValue(entry.render, rootNodeID, totalTime);
9697
} else if (isMount) {
9698
var subMountTime = mountStack.pop();
9699
mountStack[mountStack.length - 1] += totalTime;
9700
addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
9701
addValue(entry.inclusive, rootNodeID, totalTime);
9702
} else {
9703
addValue(entry.inclusive, rootNodeID, totalTime);
9704
}
9705
9706
var displayName = null;
9707
if (this._instance.constructor.displayName) {
9708
displayName = this._instance.constructor.displayName;
9709
} else if (this._currentElement.type) {
9710
displayName = this._currentElement.type;
9711
}
9712
9713
entry.displayNames[rootNodeID] = {
9714
current: displayName,
9715
owner: this._currentElement._owner ?
9716
this._currentElement._owner._instance.constructor.displayName :
9717
'<root>'
9718
};
9719
9720
return rv;
9721
} else {
9722
return func.apply(this, args);
9723
}
9724
};
9725
}
9726
};
9727
9728
module.exports = ReactDefaultPerf;
9729
9730
9731
},{"./DOMProperty":10,"./ReactDefaultPerfAnalysis":57,"./ReactMount":71,"./ReactPerf":76,"./performanceNow":147}],57:[function(require,module,exports){
9732
/**
9733
* Copyright 2013-2015, Facebook, Inc.
9734
* All rights reserved.
9735
*
9736
* This source code is licensed under the BSD-style license found in the
9737
* LICENSE file in the root directory of this source tree. An additional grant
9738
* of patent rights can be found in the PATENTS file in the same directory.
9739
*
9740
* @providesModule ReactDefaultPerfAnalysis
9741
*/
9742
9743
var assign = require("./Object.assign");
9744
9745
// Don't try to save users less than 1.2ms (a number I made up)
9746
var DONT_CARE_THRESHOLD = 1.2;
9747
var DOM_OPERATION_TYPES = {
9748
'_mountImageIntoNode': 'set innerHTML',
9749
INSERT_MARKUP: 'set innerHTML',
9750
MOVE_EXISTING: 'move',
9751
REMOVE_NODE: 'remove',
9752
TEXT_CONTENT: 'set textContent',
9753
'updatePropertyByID': 'update attribute',
9754
'deletePropertyByID': 'delete attribute',
9755
'updateStylesByID': 'update styles',
9756
'updateInnerHTMLByID': 'set innerHTML',
9757
'dangerouslyReplaceNodeWithMarkupByID': 'replace'
9758
};
9759
9760
function getTotalTime(measurements) {
9761
// TODO: return number of DOM ops? could be misleading.
9762
// TODO: measure dropped frames after reconcile?
9763
// TODO: log total time of each reconcile and the top-level component
9764
// class that triggered it.
9765
var totalTime = 0;
9766
for (var i = 0; i < measurements.length; i++) {
9767
var measurement = measurements[i];
9768
totalTime += measurement.totalTime;
9769
}
9770
return totalTime;
9771
}
9772
9773
function getDOMSummary(measurements) {
9774
var items = [];
9775
for (var i = 0; i < measurements.length; i++) {
9776
var measurement = measurements[i];
9777
var id;
9778
9779
for (id in measurement.writes) {
9780
measurement.writes[id].forEach(function(write) {
9781
items.push({
9782
id: id,
9783
type: DOM_OPERATION_TYPES[write.type] || write.type,
9784
args: write.args
9785
});
9786
});
9787
}
9788
}
9789
return items;
9790
}
9791
9792
function getExclusiveSummary(measurements) {
9793
var candidates = {};
9794
var displayName;
9795
9796
for (var i = 0; i < measurements.length; i++) {
9797
var measurement = measurements[i];
9798
var allIDs = assign(
9799
{},
9800
measurement.exclusive,
9801
measurement.inclusive
9802
);
9803
9804
for (var id in allIDs) {
9805
displayName = measurement.displayNames[id].current;
9806
9807
candidates[displayName] = candidates[displayName] || {
9808
componentName: displayName,
9809
inclusive: 0,
9810
exclusive: 0,
9811
render: 0,
9812
count: 0
9813
};
9814
if (measurement.render[id]) {
9815
candidates[displayName].render += measurement.render[id];
9816
}
9817
if (measurement.exclusive[id]) {
9818
candidates[displayName].exclusive += measurement.exclusive[id];
9819
}
9820
if (measurement.inclusive[id]) {
9821
candidates[displayName].inclusive += measurement.inclusive[id];
9822
}
9823
if (measurement.counts[id]) {
9824
candidates[displayName].count += measurement.counts[id];
9825
}
9826
}
9827
}
9828
9829
// Now make a sorted array with the results.
9830
var arr = [];
9831
for (displayName in candidates) {
9832
if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
9833
arr.push(candidates[displayName]);
9834
}
9835
}
9836
9837
arr.sort(function(a, b) {
9838
return b.exclusive - a.exclusive;
9839
});
9840
9841
return arr;
9842
}
9843
9844
function getInclusiveSummary(measurements, onlyClean) {
9845
var candidates = {};
9846
var inclusiveKey;
9847
9848
for (var i = 0; i < measurements.length; i++) {
9849
var measurement = measurements[i];
9850
var allIDs = assign(
9851
{},
9852
measurement.exclusive,
9853
measurement.inclusive
9854
);
9855
var cleanComponents;
9856
9857
if (onlyClean) {
9858
cleanComponents = getUnchangedComponents(measurement);
9859
}
9860
9861
for (var id in allIDs) {
9862
if (onlyClean && !cleanComponents[id]) {
9863
continue;
9864
}
9865
9866
var displayName = measurement.displayNames[id];
9867
9868
// Inclusive time is not useful for many components without knowing where
9869
// they are instantiated. So we aggregate inclusive time with both the
9870
// owner and current displayName as the key.
9871
inclusiveKey = displayName.owner + ' > ' + displayName.current;
9872
9873
candidates[inclusiveKey] = candidates[inclusiveKey] || {
9874
componentName: inclusiveKey,
9875
time: 0,
9876
count: 0
9877
};
9878
9879
if (measurement.inclusive[id]) {
9880
candidates[inclusiveKey].time += measurement.inclusive[id];
9881
}
9882
if (measurement.counts[id]) {
9883
candidates[inclusiveKey].count += measurement.counts[id];
9884
}
9885
}
9886
}
9887
9888
// Now make a sorted array with the results.
9889
var arr = [];
9890
for (inclusiveKey in candidates) {
9891
if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
9892
arr.push(candidates[inclusiveKey]);
9893
}
9894
}
9895
9896
arr.sort(function(a, b) {
9897
return b.time - a.time;
9898
});
9899
9900
return arr;
9901
}
9902
9903
function getUnchangedComponents(measurement) {
9904
// For a given reconcile, look at which components did not actually
9905
// render anything to the DOM and return a mapping of their ID to
9906
// the amount of time it took to render the entire subtree.
9907
var cleanComponents = {};
9908
var dirtyLeafIDs = Object.keys(measurement.writes);
9909
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
9910
9911
for (var id in allIDs) {
9912
var isDirty = false;
9913
// For each component that rendered, see if a component that triggered
9914
// a DOM op is in its subtree.
9915
for (var i = 0; i < dirtyLeafIDs.length; i++) {
9916
if (dirtyLeafIDs[i].indexOf(id) === 0) {
9917
isDirty = true;
9918
break;
9919
}
9920
}
9921
if (!isDirty && measurement.counts[id] > 0) {
9922
cleanComponents[id] = true;
9923
}
9924
}
9925
return cleanComponents;
9926
}
9927
9928
var ReactDefaultPerfAnalysis = {
9929
getExclusiveSummary: getExclusiveSummary,
9930
getInclusiveSummary: getInclusiveSummary,
9931
getDOMSummary: getDOMSummary,
9932
getTotalTime: getTotalTime
9933
};
9934
9935
module.exports = ReactDefaultPerfAnalysis;
9936
9937
9938
},{"./Object.assign":27}],58:[function(require,module,exports){
9939
(function (process){
9940
/**
9941
* Copyright 2014-2015, Facebook, Inc.
9942
* All rights reserved.
9943
*
9944
* This source code is licensed under the BSD-style license found in the
9945
* LICENSE file in the root directory of this source tree. An additional grant
9946
* of patent rights can be found in the PATENTS file in the same directory.
9947
*
9948
* @providesModule ReactElement
9949
*/
9950
9951
'use strict';
9952
9953
var ReactContext = require("./ReactContext");
9954
var ReactCurrentOwner = require("./ReactCurrentOwner");
9955
9956
var assign = require("./Object.assign");
9957
var warning = require("./warning");
9958
9959
var RESERVED_PROPS = {
9960
key: true,
9961
ref: true
9962
};
9963
9964
/**
9965
* Warn for mutations.
9966
*
9967
* @internal
9968
* @param {object} object
9969
* @param {string} key
9970
*/
9971
function defineWarningProperty(object, key) {
9972
Object.defineProperty(object, key, {
9973
9974
configurable: false,
9975
enumerable: true,
9976
9977
get: function() {
9978
if (!this._store) {
9979
return null;
9980
}
9981
return this._store[key];
9982
},
9983
9984
set: function(value) {
9985
("production" !== process.env.NODE_ENV ? warning(
9986
false,
9987
'Don\'t set the %s property of the React element. Instead, ' +
9988
'specify the correct value when initially creating the element.',
9989
key
9990
) : null);
9991
this._store[key] = value;
9992
}
9993
9994
});
9995
}
9996
9997
/**
9998
* This is updated to true if the membrane is successfully created.
9999
*/
10000
var useMutationMembrane = false;
10001
10002
/**
10003
* Warn for mutations.
10004
*
10005
* @internal
10006
* @param {object} element
10007
*/
10008
function defineMutationMembrane(prototype) {
10009
try {
10010
var pseudoFrozenProperties = {
10011
props: true
10012
};
10013
for (var key in pseudoFrozenProperties) {
10014
defineWarningProperty(prototype, key);
10015
}
10016
useMutationMembrane = true;
10017
} catch (x) {
10018
// IE will fail on defineProperty
10019
}
10020
}
10021
10022
/**
10023
* Base constructor for all React elements. This is only used to make this
10024
* work with a dynamic instanceof check. Nothing should live on this prototype.
10025
*
10026
* @param {*} type
10027
* @param {string|object} ref
10028
* @param {*} key
10029
* @param {*} props
10030
* @internal
10031
*/
10032
var ReactElement = function(type, key, ref, owner, context, props) {
10033
// Built-in properties that belong on the element
10034
this.type = type;
10035
this.key = key;
10036
this.ref = ref;
10037
10038
// Record the component responsible for creating this element.
10039
this._owner = owner;
10040
10041
// TODO: Deprecate withContext, and then the context becomes accessible
10042
// through the owner.
10043
this._context = context;
10044
10045
if ("production" !== process.env.NODE_ENV) {
10046
// The validation flag and props are currently mutative. We put them on
10047
// an external backing store so that we can freeze the whole object.
10048
// This can be replaced with a WeakMap once they are implemented in
10049
// commonly used development environments.
10050
this._store = {props: props, originalProps: assign({}, props)};
10051
10052
// To make comparing ReactElements easier for testing purposes, we make
10053
// the validation flag non-enumerable (where possible, which should
10054
// include every environment we run tests in), so the test framework
10055
// ignores it.
10056
try {
10057
Object.defineProperty(this._store, 'validated', {
10058
configurable: false,
10059
enumerable: false,
10060
writable: true
10061
});
10062
} catch (x) {
10063
}
10064
this._store.validated = false;
10065
10066
// We're not allowed to set props directly on the object so we early
10067
// return and rely on the prototype membrane to forward to the backing
10068
// store.
10069
if (useMutationMembrane) {
10070
Object.freeze(this);
10071
return;
10072
}
10073
}
10074
10075
this.props = props;
10076
};
10077
10078
// We intentionally don't expose the function on the constructor property.
10079
// ReactElement should be indistinguishable from a plain object.
10080
ReactElement.prototype = {
10081
_isReactElement: true
10082
};
10083
10084
if ("production" !== process.env.NODE_ENV) {
10085
defineMutationMembrane(ReactElement.prototype);
10086
}
10087
10088
ReactElement.createElement = function(type, config, children) {
10089
var propName;
10090
10091
// Reserved names are extracted
10092
var props = {};
10093
10094
var key = null;
10095
var ref = null;
10096
10097
if (config != null) {
10098
ref = config.ref === undefined ? null : config.ref;
10099
key = config.key === undefined ? null : '' + config.key;
10100
// Remaining properties are added to a new props object
10101
for (propName in config) {
10102
if (config.hasOwnProperty(propName) &&
10103
!RESERVED_PROPS.hasOwnProperty(propName)) {
10104
props[propName] = config[propName];
10105
}
10106
}
10107
}
10108
10109
// Children can be more than one argument, and those are transferred onto
10110
// the newly allocated props object.
10111
var childrenLength = arguments.length - 2;
10112
if (childrenLength === 1) {
10113
props.children = children;
10114
} else if (childrenLength > 1) {
10115
var childArray = Array(childrenLength);
10116
for (var i = 0; i < childrenLength; i++) {
10117
childArray[i] = arguments[i + 2];
10118
}
10119
props.children = childArray;
10120
}
10121
10122
// Resolve default props
10123
if (type && type.defaultProps) {
10124
var defaultProps = type.defaultProps;
10125
for (propName in defaultProps) {
10126
if (typeof props[propName] === 'undefined') {
10127
props[propName] = defaultProps[propName];
10128
}
10129
}
10130
}
10131
10132
return new ReactElement(
10133
type,
10134
key,
10135
ref,
10136
ReactCurrentOwner.current,
10137
ReactContext.current,
10138
props
10139
);
10140
};
10141
10142
ReactElement.createFactory = function(type) {
10143
var factory = ReactElement.createElement.bind(null, type);
10144
// Expose the type on the factory and the prototype so that it can be
10145
// easily accessed on elements. E.g. <Foo />.type === Foo.type.
10146
// This should not be named `constructor` since this may not be the function
10147
// that created the element, and it may not even be a constructor.
10148
// Legacy hook TODO: Warn if this is accessed
10149
factory.type = type;
10150
return factory;
10151
};
10152
10153
ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
10154
var newElement = new ReactElement(
10155
oldElement.type,
10156
oldElement.key,
10157
oldElement.ref,
10158
oldElement._owner,
10159
oldElement._context,
10160
newProps
10161
);
10162
10163
if ("production" !== process.env.NODE_ENV) {
10164
// If the key on the original is valid, then the clone is valid
10165
newElement._store.validated = oldElement._store.validated;
10166
}
10167
return newElement;
10168
};
10169
10170
ReactElement.cloneElement = function(element, config, children) {
10171
var propName;
10172
10173
// Original props are copied
10174
var props = assign({}, element.props);
10175
10176
// Reserved names are extracted
10177
var key = element.key;
10178
var ref = element.ref;
10179
10180
// Owner will be preserved, unless ref is overridden
10181
var owner = element._owner;
10182
10183
if (config != null) {
10184
if (config.ref !== undefined) {
10185
// Silently steal the ref from the parent.
10186
ref = config.ref;
10187
owner = ReactCurrentOwner.current;
10188
}
10189
if (config.key !== undefined) {
10190
key = '' + config.key;
10191
}
10192
// Remaining properties override existing props
10193
for (propName in config) {
10194
if (config.hasOwnProperty(propName) &&
10195
!RESERVED_PROPS.hasOwnProperty(propName)) {
10196
props[propName] = config[propName];
10197
}
10198
}
10199
}
10200
10201
// Children can be more than one argument, and those are transferred onto
10202
// the newly allocated props object.
10203
var childrenLength = arguments.length - 2;
10204
if (childrenLength === 1) {
10205
props.children = children;
10206
} else if (childrenLength > 1) {
10207
var childArray = Array(childrenLength);
10208
for (var i = 0; i < childrenLength; i++) {
10209
childArray[i] = arguments[i + 2];
10210
}
10211
props.children = childArray;
10212
}
10213
10214
return new ReactElement(
10215
element.type,
10216
key,
10217
ref,
10218
owner,
10219
element._context,
10220
props
10221
);
10222
};
10223
10224
/**
10225
* @param {?object} object
10226
* @return {boolean} True if `object` is a valid component.
10227
* @final
10228
*/
10229
ReactElement.isValidElement = function(object) {
10230
// ReactTestUtils is often used outside of beforeEach where as React is
10231
// within it. This leads to two different instances of React on the same
10232
// page. To identify a element from a different React instance we use
10233
// a flag instead of an instanceof check.
10234
var isElement = !!(object && object._isReactElement);
10235
// if (isElement && !(object instanceof ReactElement)) {
10236
// This is an indicator that you're using multiple versions of React at the
10237
// same time. This will screw with ownership and stuff. Fix it, please.
10238
// TODO: We could possibly warn here.
10239
// }
10240
return isElement;
10241
};
10242
10243
module.exports = ReactElement;
10244
10245
10246
}).call(this,require("FWaASH"))
10247
},{"./Object.assign":27,"./ReactContext":39,"./ReactCurrentOwner":40,"./warning":155,"FWaASH":1}],59:[function(require,module,exports){
10248
(function (process){
10249
/**
10250
* Copyright 2014-2015, Facebook, Inc.
10251
* All rights reserved.
10252
*
10253
* This source code is licensed under the BSD-style license found in the
10254
* LICENSE file in the root directory of this source tree. An additional grant
10255
* of patent rights can be found in the PATENTS file in the same directory.
10256
*
10257
* @providesModule ReactElementValidator
10258
*/
10259
10260
/**
10261
* ReactElementValidator provides a wrapper around a element factory
10262
* which validates the props passed to the element. This is intended to be
10263
* used only in DEV and could be replaced by a static type checker for languages
10264
* that support it.
10265
*/
10266
10267
'use strict';
10268
10269
var ReactElement = require("./ReactElement");
10270
var ReactFragment = require("./ReactFragment");
10271
var ReactPropTypeLocations = require("./ReactPropTypeLocations");
10272
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
10273
var ReactCurrentOwner = require("./ReactCurrentOwner");
10274
var ReactNativeComponent = require("./ReactNativeComponent");
10275
10276
var getIteratorFn = require("./getIteratorFn");
10277
var invariant = require("./invariant");
10278
var warning = require("./warning");
10279
10280
function getDeclarationErrorAddendum() {
10281
if (ReactCurrentOwner.current) {
10282
var name = ReactCurrentOwner.current.getName();
10283
if (name) {
10284
return ' Check the render method of `' + name + '`.';
10285
}
10286
}
10287
return '';
10288
}
10289
10290
/**
10291
* Warn if there's no key explicitly set on dynamic arrays of children or
10292
* object keys are not valid. This allows us to keep track of children between
10293
* updates.
10294
*/
10295
var ownerHasKeyUseWarning = {};
10296
10297
var loggedTypeFailures = {};
10298
10299
var NUMERIC_PROPERTY_REGEX = /^\d+$/;
10300
10301
/**
10302
* Gets the instance's name for use in warnings.
10303
*
10304
* @internal
10305
* @return {?string} Display name or undefined
10306
*/
10307
function getName(instance) {
10308
var publicInstance = instance && instance.getPublicInstance();
10309
if (!publicInstance) {
10310
return undefined;
10311
}
10312
var constructor = publicInstance.constructor;
10313
if (!constructor) {
10314
return undefined;
10315
}
10316
return constructor.displayName || constructor.name || undefined;
10317
}
10318
10319
/**
10320
* Gets the current owner's displayName for use in warnings.
10321
*
10322
* @internal
10323
* @return {?string} Display name or undefined
10324
*/
10325
function getCurrentOwnerDisplayName() {
10326
var current = ReactCurrentOwner.current;
10327
return (
10328
current && getName(current) || undefined
10329
);
10330
}
10331
10332
/**
10333
* Warn if the element doesn't have an explicit key assigned to it.
10334
* This element is in an array. The array could grow and shrink or be
10335
* reordered. All children that haven't already been validated are required to
10336
* have a "key" property assigned to it.
10337
*
10338
* @internal
10339
* @param {ReactElement} element Element that requires a key.
10340
* @param {*} parentType element's parent's type.
10341
*/
10342
function validateExplicitKey(element, parentType) {
10343
if (element._store.validated || element.key != null) {
10344
return;
10345
}
10346
element._store.validated = true;
10347
10348
warnAndMonitorForKeyUse(
10349
'Each child in an array or iterator should have a unique "key" prop.',
10350
element,
10351
parentType
10352
);
10353
}
10354
10355
/**
10356
* Warn if the key is being defined as an object property but has an incorrect
10357
* value.
10358
*
10359
* @internal
10360
* @param {string} name Property name of the key.
10361
* @param {ReactElement} element Component that requires a key.
10362
* @param {*} parentType element's parent's type.
10363
*/
10364
function validatePropertyKey(name, element, parentType) {
10365
if (!NUMERIC_PROPERTY_REGEX.test(name)) {
10366
return;
10367
}
10368
warnAndMonitorForKeyUse(
10369
'Child objects should have non-numeric keys so ordering is preserved.',
10370
element,
10371
parentType
10372
);
10373
}
10374
10375
/**
10376
* Shared warning and monitoring code for the key warnings.
10377
*
10378
* @internal
10379
* @param {string} message The base warning that gets output.
10380
* @param {ReactElement} element Component that requires a key.
10381
* @param {*} parentType element's parent's type.
10382
*/
10383
function warnAndMonitorForKeyUse(message, element, parentType) {
10384
var ownerName = getCurrentOwnerDisplayName();
10385
var parentName = typeof parentType === 'string' ?
10386
parentType : parentType.displayName || parentType.name;
10387
10388
var useName = ownerName || parentName;
10389
var memoizer = ownerHasKeyUseWarning[message] || (
10390
(ownerHasKeyUseWarning[message] = {})
10391
);
10392
if (memoizer.hasOwnProperty(useName)) {
10393
return;
10394
}
10395
memoizer[useName] = true;
10396
10397
var parentOrOwnerAddendum =
10398
ownerName ? (" Check the render method of " + ownerName + ".") :
10399
parentName ? (" Check the React.render call using <" + parentName + ">.") :
10400
'';
10401
10402
// Usually the current owner is the offender, but if it accepts children as a
10403
// property, it may be the creator of the child that's responsible for
10404
// assigning it a key.
10405
var childOwnerAddendum = '';
10406
if (element &&
10407
element._owner &&
10408
element._owner !== ReactCurrentOwner.current) {
10409
// Name of the component that originally created this child.
10410
var childOwnerName = getName(element._owner);
10411
10412
childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
10413
}
10414
10415
("production" !== process.env.NODE_ENV ? warning(
10416
false,
10417
message + '%s%s See http://fb.me/react-warning-keys for more information.',
10418
parentOrOwnerAddendum,
10419
childOwnerAddendum
10420
) : null);
10421
}
10422
10423
/**
10424
* Ensure that every element either is passed in a static location, in an
10425
* array with an explicit keys property defined, or in an object literal
10426
* with valid key property.
10427
*
10428
* @internal
10429
* @param {ReactNode} node Statically passed child of any type.
10430
* @param {*} parentType node's parent's type.
10431
*/
10432
function validateChildKeys(node, parentType) {
10433
if (Array.isArray(node)) {
10434
for (var i = 0; i < node.length; i++) {
10435
var child = node[i];
10436
if (ReactElement.isValidElement(child)) {
10437
validateExplicitKey(child, parentType);
10438
}
10439
}
10440
} else if (ReactElement.isValidElement(node)) {
10441
// This element was passed in a valid location.
10442
node._store.validated = true;
10443
} else if (node) {
10444
var iteratorFn = getIteratorFn(node);
10445
// Entry iterators provide implicit keys.
10446
if (iteratorFn) {
10447
if (iteratorFn !== node.entries) {
10448
var iterator = iteratorFn.call(node);
10449
var step;
10450
while (!(step = iterator.next()).done) {
10451
if (ReactElement.isValidElement(step.value)) {
10452
validateExplicitKey(step.value, parentType);
10453
}
10454
}
10455
}
10456
} else if (typeof node === 'object') {
10457
var fragment = ReactFragment.extractIfFragment(node);
10458
for (var key in fragment) {
10459
if (fragment.hasOwnProperty(key)) {
10460
validatePropertyKey(key, fragment[key], parentType);
10461
}
10462
}
10463
}
10464
}
10465
}
10466
10467
/**
10468
* Assert that the props are valid
10469
*
10470
* @param {string} componentName Name of the component for error messages.
10471
* @param {object} propTypes Map of prop name to a ReactPropType
10472
* @param {object} props
10473
* @param {string} location e.g. "prop", "context", "child context"
10474
* @private
10475
*/
10476
function checkPropTypes(componentName, propTypes, props, location) {
10477
for (var propName in propTypes) {
10478
if (propTypes.hasOwnProperty(propName)) {
10479
var error;
10480
// Prop type validation may throw. In case they do, we don't want to
10481
// fail the render phase where it didn't fail before. So we log it.
10482
// After these have been cleaned up, we'll let them throw.
10483
try {
10484
// This is intentionally an invariant that gets caught. It's the same
10485
// behavior as without this statement except with a better message.
10486
("production" !== process.env.NODE_ENV ? invariant(
10487
typeof propTypes[propName] === 'function',
10488
'%s: %s type `%s` is invalid; it must be a function, usually from ' +
10489
'React.PropTypes.',
10490
componentName || 'React class',
10491
ReactPropTypeLocationNames[location],
10492
propName
10493
) : invariant(typeof propTypes[propName] === 'function'));
10494
error = propTypes[propName](props, propName, componentName, location);
10495
} catch (ex) {
10496
error = ex;
10497
}
10498
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
10499
// Only monitor this failure once because there tends to be a lot of the
10500
// same error.
10501
loggedTypeFailures[error.message] = true;
10502
10503
var addendum = getDeclarationErrorAddendum(this);
10504
("production" !== process.env.NODE_ENV ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
10505
}
10506
}
10507
}
10508
}
10509
10510
var warnedPropsMutations = {};
10511
10512
/**
10513
* Warn about mutating props when setting `propName` on `element`.
10514
*
10515
* @param {string} propName The string key within props that was set
10516
* @param {ReactElement} element
10517
*/
10518
function warnForPropsMutation(propName, element) {
10519
var type = element.type;
10520
var elementName = typeof type === 'string' ? type : type.displayName;
10521
var ownerName = element._owner ?
10522
element._owner.getPublicInstance().constructor.displayName : null;
10523
10524
var warningKey = propName + '|' + elementName + '|' + ownerName;
10525
if (warnedPropsMutations.hasOwnProperty(warningKey)) {
10526
return;
10527
}
10528
warnedPropsMutations[warningKey] = true;
10529
10530
var elementInfo = '';
10531
if (elementName) {
10532
elementInfo = ' <' + elementName + ' />';
10533
}
10534
var ownerInfo = '';
10535
if (ownerName) {
10536
ownerInfo = ' The element was created by ' + ownerName + '.';
10537
}
10538
10539
("production" !== process.env.NODE_ENV ? warning(
10540
false,
10541
'Don\'t set .props.%s of the React component%s. ' +
10542
'Instead, specify the correct value when ' +
10543
'initially creating the element.%s',
10544
propName,
10545
elementInfo,
10546
ownerInfo
10547
) : null);
10548
}
10549
10550
// Inline Object.is polyfill
10551
function is(a, b) {
10552
if (a !== a) {
10553
// NaN
10554
return b !== b;
10555
}
10556
if (a === 0 && b === 0) {
10557
// +-0
10558
return 1 / a === 1 / b;
10559
}
10560
return a === b;
10561
}
10562
10563
/**
10564
* Given an element, check if its props have been mutated since element
10565
* creation (or the last call to this function). In particular, check if any
10566
* new props have been added, which we can't directly catch by defining warning
10567
* properties on the props object.
10568
*
10569
* @param {ReactElement} element
10570
*/
10571
function checkAndWarnForMutatedProps(element) {
10572
if (!element._store) {
10573
// Element was created using `new ReactElement` directly or with
10574
// `ReactElement.createElement`; skip mutation checking
10575
return;
10576
}
10577
10578
var originalProps = element._store.originalProps;
10579
var props = element.props;
10580
10581
for (var propName in props) {
10582
if (props.hasOwnProperty(propName)) {
10583
if (!originalProps.hasOwnProperty(propName) ||
10584
!is(originalProps[propName], props[propName])) {
10585
warnForPropsMutation(propName, element);
10586
10587
// Copy over the new value so that the two props objects match again
10588
originalProps[propName] = props[propName];
10589
}
10590
}
10591
}
10592
}
10593
10594
/**
10595
* Given an element, validate that its props follow the propTypes definition,
10596
* provided by the type.
10597
*
10598
* @param {ReactElement} element
10599
*/
10600
function validatePropTypes(element) {
10601
if (element.type == null) {
10602
// This has already warned. Don't throw.
10603
return;
10604
}
10605
// Extract the component class from the element. Converts string types
10606
// to a composite class which may have propTypes.
10607
// TODO: Validating a string's propTypes is not decoupled from the
10608
// rendering target which is problematic.
10609
var componentClass = ReactNativeComponent.getComponentClassForElement(
10610
element
10611
);
10612
var name = componentClass.displayName || componentClass.name;
10613
if (componentClass.propTypes) {
10614
checkPropTypes(
10615
name,
10616
componentClass.propTypes,
10617
element.props,
10618
ReactPropTypeLocations.prop
10619
);
10620
}
10621
if (typeof componentClass.getDefaultProps === 'function') {
10622
("production" !== process.env.NODE_ENV ? warning(
10623
componentClass.getDefaultProps.isReactClassApproved,
10624
'getDefaultProps is only used on classic React.createClass ' +
10625
'definitions. Use a static property named `defaultProps` instead.'
10626
) : null);
10627
}
10628
}
10629
10630
var ReactElementValidator = {
10631
10632
checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
10633
10634
createElement: function(type, props, children) {
10635
// We warn in this case but don't throw. We expect the element creation to
10636
// succeed and there will likely be errors in render.
10637
("production" !== process.env.NODE_ENV ? warning(
10638
type != null,
10639
'React.createElement: type should not be null or undefined. It should ' +
10640
'be a string (for DOM elements) or a ReactClass (for composite ' +
10641
'components).'
10642
) : null);
10643
10644
var element = ReactElement.createElement.apply(this, arguments);
10645
10646
// The result can be nullish if a mock or a custom function is used.
10647
// TODO: Drop this when these are no longer allowed as the type argument.
10648
if (element == null) {
10649
return element;
10650
}
10651
10652
for (var i = 2; i < arguments.length; i++) {
10653
validateChildKeys(arguments[i], type);
10654
}
10655
10656
validatePropTypes(element);
10657
10658
return element;
10659
},
10660
10661
createFactory: function(type) {
10662
var validatedFactory = ReactElementValidator.createElement.bind(
10663
null,
10664
type
10665
);
10666
// Legacy hook TODO: Warn if this is accessed
10667
validatedFactory.type = type;
10668
10669
if ("production" !== process.env.NODE_ENV) {
10670
try {
10671
Object.defineProperty(
10672
validatedFactory,
10673
'type',
10674
{
10675
enumerable: false,
10676
get: function() {
10677
("production" !== process.env.NODE_ENV ? warning(
10678
false,
10679
'Factory.type is deprecated. Access the class directly ' +
10680
'before passing it to createFactory.'
10681
) : null);
10682
Object.defineProperty(this, 'type', {
10683
value: type
10684
});
10685
return type;
10686
}
10687
}
10688
);
10689
} catch (x) {
10690
// IE will fail on defineProperty (es5-shim/sham too)
10691
}
10692
}
10693
10694
10695
return validatedFactory;
10696
},
10697
10698
cloneElement: function(element, props, children) {
10699
var newElement = ReactElement.cloneElement.apply(this, arguments);
10700
for (var i = 2; i < arguments.length; i++) {
10701
validateChildKeys(arguments[i], newElement.type);
10702
}
10703
validatePropTypes(newElement);
10704
return newElement;
10705
}
10706
10707
};
10708
10709
module.exports = ReactElementValidator;
10710
10711
10712
}).call(this,require("FWaASH"))
10713
},{"./ReactCurrentOwner":40,"./ReactElement":58,"./ReactFragment":64,"./ReactNativeComponent":74,"./ReactPropTypeLocationNames":77,"./ReactPropTypeLocations":78,"./getIteratorFn":127,"./invariant":136,"./warning":155,"FWaASH":1}],60:[function(require,module,exports){
10714
(function (process){
10715
/**
10716
* Copyright 2014-2015, Facebook, Inc.
10717
* All rights reserved.
10718
*
10719
* This source code is licensed under the BSD-style license found in the
10720
* LICENSE file in the root directory of this source tree. An additional grant
10721
* of patent rights can be found in the PATENTS file in the same directory.
10722
*
10723
* @providesModule ReactEmptyComponent
10724
*/
10725
10726
'use strict';
10727
10728
var ReactElement = require("./ReactElement");
10729
var ReactInstanceMap = require("./ReactInstanceMap");
10730
10731
var invariant = require("./invariant");
10732
10733
var component;
10734
// This registry keeps track of the React IDs of the components that rendered to
10735
// `null` (in reality a placeholder such as `noscript`)
10736
var nullComponentIDsRegistry = {};
10737
10738
var ReactEmptyComponentInjection = {
10739
injectEmptyComponent: function(emptyComponent) {
10740
component = ReactElement.createFactory(emptyComponent);
10741
}
10742
};
10743
10744
var ReactEmptyComponentType = function() {};
10745
ReactEmptyComponentType.prototype.componentDidMount = function() {
10746
var internalInstance = ReactInstanceMap.get(this);
10747
// TODO: Make sure we run these methods in the correct order, we shouldn't
10748
// need this check. We're going to assume if we're here it means we ran
10749
// componentWillUnmount already so there is no internal instance (it gets
10750
// removed as part of the unmounting process).
10751
if (!internalInstance) {
10752
return;
10753
}
10754
registerNullComponentID(internalInstance._rootNodeID);
10755
};
10756
ReactEmptyComponentType.prototype.componentWillUnmount = function() {
10757
var internalInstance = ReactInstanceMap.get(this);
10758
// TODO: Get rid of this check. See TODO in componentDidMount.
10759
if (!internalInstance) {
10760
return;
10761
}
10762
deregisterNullComponentID(internalInstance._rootNodeID);
10763
};
10764
ReactEmptyComponentType.prototype.render = function() {
10765
("production" !== process.env.NODE_ENV ? invariant(
10766
component,
10767
'Trying to return null from a render, but no null placeholder component ' +
10768
'was injected.'
10769
) : invariant(component));
10770
return component();
10771
};
10772
10773
var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
10774
10775
/**
10776
* Mark the component as having rendered to null.
10777
* @param {string} id Component's `_rootNodeID`.
10778
*/
10779
function registerNullComponentID(id) {
10780
nullComponentIDsRegistry[id] = true;
10781
}
10782
10783
/**
10784
* Unmark the component as having rendered to null: it renders to something now.
10785
* @param {string} id Component's `_rootNodeID`.
10786
*/
10787
function deregisterNullComponentID(id) {
10788
delete nullComponentIDsRegistry[id];
10789
}
10790
10791
/**
10792
* @param {string} id Component's `_rootNodeID`.
10793
* @return {boolean} True if the component is rendered to null.
10794
*/
10795
function isNullComponentID(id) {
10796
return !!nullComponentIDsRegistry[id];
10797
}
10798
10799
var ReactEmptyComponent = {
10800
emptyElement: emptyElement,
10801
injection: ReactEmptyComponentInjection,
10802
isNullComponentID: isNullComponentID
10803
};
10804
10805
module.exports = ReactEmptyComponent;
10806
10807
10808
}).call(this,require("FWaASH"))
10809
},{"./ReactElement":58,"./ReactInstanceMap":68,"./invariant":136,"FWaASH":1}],61:[function(require,module,exports){
10810
/**
10811
* Copyright 2013-2015, Facebook, Inc.
10812
* All rights reserved.
10813
*
10814
* This source code is licensed under the BSD-style license found in the
10815
* LICENSE file in the root directory of this source tree. An additional grant
10816
* of patent rights can be found in the PATENTS file in the same directory.
10817
*
10818
* @providesModule ReactErrorUtils
10819
* @typechecks
10820
*/
10821
10822
"use strict";
10823
10824
var ReactErrorUtils = {
10825
/**
10826
* Creates a guarded version of a function. This is supposed to make debugging
10827
* of event handlers easier. To aid debugging with the browser's debugger,
10828
* this currently simply returns the original function.
10829
*
10830
* @param {function} func Function to be executed
10831
* @param {string} name The name of the guard
10832
* @return {function}
10833
*/
10834
guard: function(func, name) {
10835
return func;
10836
}
10837
};
10838
10839
module.exports = ReactErrorUtils;
10840
10841
10842
},{}],62:[function(require,module,exports){
10843
/**
10844
* Copyright 2013-2015, Facebook, Inc.
10845
* All rights reserved.
10846
*
10847
* This source code is licensed under the BSD-style license found in the
10848
* LICENSE file in the root directory of this source tree. An additional grant
10849
* of patent rights can be found in the PATENTS file in the same directory.
10850
*
10851
* @providesModule ReactEventEmitterMixin
10852
*/
10853
10854
'use strict';
10855
10856
var EventPluginHub = require("./EventPluginHub");
10857
10858
function runEventQueueInBatch(events) {
10859
EventPluginHub.enqueueEvents(events);
10860
EventPluginHub.processEventQueue();
10861
}
10862
10863
var ReactEventEmitterMixin = {
10864
10865
/**
10866
* Streams a fired top-level event to `EventPluginHub` where plugins have the
10867
* opportunity to create `ReactEvent`s to be dispatched.
10868
*
10869
* @param {string} topLevelType Record from `EventConstants`.
10870
* @param {object} topLevelTarget The listening component root node.
10871
* @param {string} topLevelTargetID ID of `topLevelTarget`.
10872
* @param {object} nativeEvent Native environment event.
10873
*/
10874
handleTopLevel: function(
10875
topLevelType,
10876
topLevelTarget,
10877
topLevelTargetID,
10878
nativeEvent) {
10879
var events = EventPluginHub.extractEvents(
10880
topLevelType,
10881
topLevelTarget,
10882
topLevelTargetID,
10883
nativeEvent
10884
);
10885
10886
runEventQueueInBatch(events);
10887
}
10888
};
10889
10890
module.exports = ReactEventEmitterMixin;
10891
10892
10893
},{"./EventPluginHub":17}],63:[function(require,module,exports){
10894
/**
10895
* Copyright 2013-2015, Facebook, Inc.
10896
* All rights reserved.
10897
*
10898
* This source code is licensed under the BSD-style license found in the
10899
* LICENSE file in the root directory of this source tree. An additional grant
10900
* of patent rights can be found in the PATENTS file in the same directory.
10901
*
10902
* @providesModule ReactEventListener
10903
* @typechecks static-only
10904
*/
10905
10906
'use strict';
10907
10908
var EventListener = require("./EventListener");
10909
var ExecutionEnvironment = require("./ExecutionEnvironment");
10910
var PooledClass = require("./PooledClass");
10911
var ReactInstanceHandles = require("./ReactInstanceHandles");
10912
var ReactMount = require("./ReactMount");
10913
var ReactUpdates = require("./ReactUpdates");
10914
10915
var assign = require("./Object.assign");
10916
var getEventTarget = require("./getEventTarget");
10917
var getUnboundedScrollPosition = require("./getUnboundedScrollPosition");
10918
10919
/**
10920
* Finds the parent React component of `node`.
10921
*
10922
* @param {*} node
10923
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
10924
* is not nested.
10925
*/
10926
function findParent(node) {
10927
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
10928
// traversal, but caching is difficult to do correctly without using a
10929
// mutation observer to listen for all DOM changes.
10930
var nodeID = ReactMount.getID(node);
10931
var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
10932
var container = ReactMount.findReactContainerForID(rootID);
10933
var parent = ReactMount.getFirstReactDOM(container);
10934
return parent;
10935
}
10936
10937
// Used to store ancestor hierarchy in top level callback
10938
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
10939
this.topLevelType = topLevelType;
10940
this.nativeEvent = nativeEvent;
10941
this.ancestors = [];
10942
}
10943
assign(TopLevelCallbackBookKeeping.prototype, {
10944
destructor: function() {
10945
this.topLevelType = null;
10946
this.nativeEvent = null;
10947
this.ancestors.length = 0;
10948
}
10949
});
10950
PooledClass.addPoolingTo(
10951
TopLevelCallbackBookKeeping,
10952
PooledClass.twoArgumentPooler
10953
);
10954
10955
function handleTopLevelImpl(bookKeeping) {
10956
var topLevelTarget = ReactMount.getFirstReactDOM(
10957
getEventTarget(bookKeeping.nativeEvent)
10958
) || window;
10959
10960
// Loop through the hierarchy, in case there's any nested components.
10961
// It's important that we build the array of ancestors before calling any
10962
// event handlers, because event handlers can modify the DOM, leading to
10963
// inconsistencies with ReactMount's node cache. See #1105.
10964
var ancestor = topLevelTarget;
10965
while (ancestor) {
10966
bookKeeping.ancestors.push(ancestor);
10967
ancestor = findParent(ancestor);
10968
}
10969
10970
for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
10971
topLevelTarget = bookKeeping.ancestors[i];
10972
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
10973
ReactEventListener._handleTopLevel(
10974
bookKeeping.topLevelType,
10975
topLevelTarget,
10976
topLevelTargetID,
10977
bookKeeping.nativeEvent
10978
);
10979
}
10980
}
10981
10982
function scrollValueMonitor(cb) {
10983
var scrollPosition = getUnboundedScrollPosition(window);
10984
cb(scrollPosition);
10985
}
10986
10987
var ReactEventListener = {
10988
_enabled: true,
10989
_handleTopLevel: null,
10990
10991
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
10992
10993
setHandleTopLevel: function(handleTopLevel) {
10994
ReactEventListener._handleTopLevel = handleTopLevel;
10995
},
10996
10997
setEnabled: function(enabled) {
10998
ReactEventListener._enabled = !!enabled;
10999
},
11000
11001
isEnabled: function() {
11002
return ReactEventListener._enabled;
11003
},
11004
11005
11006
/**
11007
* Traps top-level events by using event bubbling.
11008
*
11009
* @param {string} topLevelType Record from `EventConstants`.
11010
* @param {string} handlerBaseName Event name (e.g. "click").
11011
* @param {object} handle Element on which to attach listener.
11012
* @return {object} An object with a remove function which will forcefully
11013
* remove the listener.
11014
* @internal
11015
*/
11016
trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
11017
var element = handle;
11018
if (!element) {
11019
return null;
11020
}
11021
return EventListener.listen(
11022
element,
11023
handlerBaseName,
11024
ReactEventListener.dispatchEvent.bind(null, topLevelType)
11025
);
11026
},
11027
11028
/**
11029
* Traps a top-level event by using event capturing.
11030
*
11031
* @param {string} topLevelType Record from `EventConstants`.
11032
* @param {string} handlerBaseName Event name (e.g. "click").
11033
* @param {object} handle Element on which to attach listener.
11034
* @return {object} An object with a remove function which will forcefully
11035
* remove the listener.
11036
* @internal
11037
*/
11038
trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
11039
var element = handle;
11040
if (!element) {
11041
return null;
11042
}
11043
return EventListener.capture(
11044
element,
11045
handlerBaseName,
11046
ReactEventListener.dispatchEvent.bind(null, topLevelType)
11047
);
11048
},
11049
11050
monitorScrollValue: function(refresh) {
11051
var callback = scrollValueMonitor.bind(null, refresh);
11052
EventListener.listen(window, 'scroll', callback);
11053
},
11054
11055
dispatchEvent: function(topLevelType, nativeEvent) {
11056
if (!ReactEventListener._enabled) {
11057
return;
11058
}
11059
11060
var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
11061
topLevelType,
11062
nativeEvent
11063
);
11064
try {
11065
// Event queue being processed in the same cycle allows
11066
// `preventDefault`.
11067
ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
11068
} finally {
11069
TopLevelCallbackBookKeeping.release(bookKeeping);
11070
}
11071
}
11072
};
11073
11074
module.exports = ReactEventListener;
11075
11076
11077
},{"./EventListener":16,"./ExecutionEnvironment":21,"./Object.assign":27,"./PooledClass":28,"./ReactInstanceHandles":67,"./ReactMount":71,"./ReactUpdates":88,"./getEventTarget":126,"./getUnboundedScrollPosition":132}],64:[function(require,module,exports){
11078
(function (process){
11079
/**
11080
* Copyright 2015, Facebook, Inc.
11081
* All rights reserved.
11082
*
11083
* This source code is licensed under the BSD-style license found in the
11084
* LICENSE file in the root directory of this source tree. An additional grant
11085
* of patent rights can be found in the PATENTS file in the same directory.
11086
*
11087
* @providesModule ReactFragment
11088
*/
11089
11090
'use strict';
11091
11092
var ReactElement = require("./ReactElement");
11093
11094
var warning = require("./warning");
11095
11096
/**
11097
* We used to allow keyed objects to serve as a collection of ReactElements,
11098
* or nested sets. This allowed us a way to explicitly key a set a fragment of
11099
* components. This is now being replaced with an opaque data structure.
11100
* The upgrade path is to call React.addons.createFragment({ key: value }) to
11101
* create a keyed fragment. The resulting data structure is opaque, for now.
11102
*/
11103
11104
if ("production" !== process.env.NODE_ENV) {
11105
var fragmentKey = '_reactFragment';
11106
var didWarnKey = '_reactDidWarn';
11107
var canWarnForReactFragment = false;
11108
11109
try {
11110
// Feature test. Don't even try to issue this warning if we can't use
11111
// enumerable: false.
11112
11113
var dummy = function() {
11114
return 1;
11115
};
11116
11117
Object.defineProperty(
11118
{},
11119
fragmentKey,
11120
{enumerable: false, value: true}
11121
);
11122
11123
Object.defineProperty(
11124
{},
11125
'key',
11126
{enumerable: true, get: dummy}
11127
);
11128
11129
canWarnForReactFragment = true;
11130
} catch (x) { }
11131
11132
var proxyPropertyAccessWithWarning = function(obj, key) {
11133
Object.defineProperty(obj, key, {
11134
enumerable: true,
11135
get: function() {
11136
("production" !== process.env.NODE_ENV ? warning(
11137
this[didWarnKey],
11138
'A ReactFragment is an opaque type. Accessing any of its ' +
11139
'properties is deprecated. Pass it to one of the React.Children ' +
11140
'helpers.'
11141
) : null);
11142
this[didWarnKey] = true;
11143
return this[fragmentKey][key];
11144
},
11145
set: function(value) {
11146
("production" !== process.env.NODE_ENV ? warning(
11147
this[didWarnKey],
11148
'A ReactFragment is an immutable opaque type. Mutating its ' +
11149
'properties is deprecated.'
11150
) : null);
11151
this[didWarnKey] = true;
11152
this[fragmentKey][key] = value;
11153
}
11154
});
11155
};
11156
11157
var issuedWarnings = {};
11158
11159
var didWarnForFragment = function(fragment) {
11160
// We use the keys and the type of the value as a heuristic to dedupe the
11161
// warning to avoid spamming too much.
11162
var fragmentCacheKey = '';
11163
for (var key in fragment) {
11164
fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
11165
}
11166
var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
11167
issuedWarnings[fragmentCacheKey] = true;
11168
return alreadyWarnedOnce;
11169
};
11170
}
11171
11172
var ReactFragment = {
11173
// Wrap a keyed object in an opaque proxy that warns you if you access any
11174
// of its properties.
11175
create: function(object) {
11176
if ("production" !== process.env.NODE_ENV) {
11177
if (typeof object !== 'object' || !object || Array.isArray(object)) {
11178
("production" !== process.env.NODE_ENV ? warning(
11179
false,
11180
'React.addons.createFragment only accepts a single object.',
11181
object
11182
) : null);
11183
return object;
11184
}
11185
if (ReactElement.isValidElement(object)) {
11186
("production" !== process.env.NODE_ENV ? warning(
11187
false,
11188
'React.addons.createFragment does not accept a ReactElement ' +
11189
'without a wrapper object.'
11190
) : null);
11191
return object;
11192
}
11193
if (canWarnForReactFragment) {
11194
var proxy = {};
11195
Object.defineProperty(proxy, fragmentKey, {
11196
enumerable: false,
11197
value: object
11198
});
11199
Object.defineProperty(proxy, didWarnKey, {
11200
writable: true,
11201
enumerable: false,
11202
value: false
11203
});
11204
for (var key in object) {
11205
proxyPropertyAccessWithWarning(proxy, key);
11206
}
11207
Object.preventExtensions(proxy);
11208
return proxy;
11209
}
11210
}
11211
return object;
11212
},
11213
// Extract the original keyed object from the fragment opaque type. Warn if
11214
// a plain object is passed here.
11215
extract: function(fragment) {
11216
if ("production" !== process.env.NODE_ENV) {
11217
if (canWarnForReactFragment) {
11218
if (!fragment[fragmentKey]) {
11219
("production" !== process.env.NODE_ENV ? warning(
11220
didWarnForFragment(fragment),
11221
'Any use of a keyed object should be wrapped in ' +
11222
'React.addons.createFragment(object) before being passed as a ' +
11223
'child.'
11224
) : null);
11225
return fragment;
11226
}
11227
return fragment[fragmentKey];
11228
}
11229
}
11230
return fragment;
11231
},
11232
// Check if this is a fragment and if so, extract the keyed object. If it
11233
// is a fragment-like object, warn that it should be wrapped. Ignore if we
11234
// can't determine what kind of object this is.
11235
extractIfFragment: function(fragment) {
11236
if ("production" !== process.env.NODE_ENV) {
11237
if (canWarnForReactFragment) {
11238
// If it is the opaque type, return the keyed object.
11239
if (fragment[fragmentKey]) {
11240
return fragment[fragmentKey];
11241
}
11242
// Otherwise, check each property if it has an element, if it does
11243
// it is probably meant as a fragment, so we can warn early. Defer,
11244
// the warning to extract.
11245
for (var key in fragment) {
11246
if (fragment.hasOwnProperty(key) &&
11247
ReactElement.isValidElement(fragment[key])) {
11248
// This looks like a fragment object, we should provide an
11249
// early warning.
11250
return ReactFragment.extract(fragment);
11251
}
11252
}
11253
}
11254
}
11255
return fragment;
11256
}
11257
};
11258
11259
module.exports = ReactFragment;
11260
11261
11262
}).call(this,require("FWaASH"))
11263
},{"./ReactElement":58,"./warning":155,"FWaASH":1}],65:[function(require,module,exports){
11264
/**
11265
* Copyright 2013-2015, Facebook, Inc.
11266
* All rights reserved.
11267
*
11268
* This source code is licensed under the BSD-style license found in the
11269
* LICENSE file in the root directory of this source tree. An additional grant
11270
* of patent rights can be found in the PATENTS file in the same directory.
11271
*
11272
* @providesModule ReactInjection
11273
*/
11274
11275
'use strict';
11276
11277
var DOMProperty = require("./DOMProperty");
11278
var EventPluginHub = require("./EventPluginHub");
11279
var ReactComponentEnvironment = require("./ReactComponentEnvironment");
11280
var ReactClass = require("./ReactClass");
11281
var ReactEmptyComponent = require("./ReactEmptyComponent");
11282
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
11283
var ReactNativeComponent = require("./ReactNativeComponent");
11284
var ReactDOMComponent = require("./ReactDOMComponent");
11285
var ReactPerf = require("./ReactPerf");
11286
var ReactRootIndex = require("./ReactRootIndex");
11287
var ReactUpdates = require("./ReactUpdates");
11288
11289
var ReactInjection = {
11290
Component: ReactComponentEnvironment.injection,
11291
Class: ReactClass.injection,
11292
DOMComponent: ReactDOMComponent.injection,
11293
DOMProperty: DOMProperty.injection,
11294
EmptyComponent: ReactEmptyComponent.injection,
11295
EventPluginHub: EventPluginHub.injection,
11296
EventEmitter: ReactBrowserEventEmitter.injection,
11297
NativeComponent: ReactNativeComponent.injection,
11298
Perf: ReactPerf.injection,
11299
RootIndex: ReactRootIndex.injection,
11300
Updates: ReactUpdates.injection
11301
};
11302
11303
module.exports = ReactInjection;
11304
11305
11306
},{"./DOMProperty":10,"./EventPluginHub":17,"./ReactBrowserEventEmitter":31,"./ReactClass":34,"./ReactComponentEnvironment":37,"./ReactDOMComponent":43,"./ReactEmptyComponent":60,"./ReactNativeComponent":74,"./ReactPerf":76,"./ReactRootIndex":84,"./ReactUpdates":88}],66:[function(require,module,exports){
11307
/**
11308
* Copyright 2013-2015, Facebook, Inc.
11309
* All rights reserved.
11310
*
11311
* This source code is licensed under the BSD-style license found in the
11312
* LICENSE file in the root directory of this source tree. An additional grant
11313
* of patent rights can be found in the PATENTS file in the same directory.
11314
*
11315
* @providesModule ReactInputSelection
11316
*/
11317
11318
'use strict';
11319
11320
var ReactDOMSelection = require("./ReactDOMSelection");
11321
11322
var containsNode = require("./containsNode");
11323
var focusNode = require("./focusNode");
11324
var getActiveElement = require("./getActiveElement");
11325
11326
function isInDocument(node) {
11327
return containsNode(document.documentElement, node);
11328
}
11329
11330
/**
11331
* @ReactInputSelection: React input selection module. Based on Selection.js,
11332
* but modified to be suitable for react and has a couple of bug fixes (doesn't
11333
* assume buttons have range selections allowed).
11334
* Input selection module for React.
11335
*/
11336
var ReactInputSelection = {
11337
11338
hasSelectionCapabilities: function(elem) {
11339
return elem && (
11340
((elem.nodeName === 'INPUT' && elem.type === 'text') ||
11341
elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
11342
);
11343
},
11344
11345
getSelectionInformation: function() {
11346
var focusedElem = getActiveElement();
11347
return {
11348
focusedElem: focusedElem,
11349
selectionRange:
11350
ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
11351
ReactInputSelection.getSelection(focusedElem) :
11352
null
11353
};
11354
},
11355
11356
/**
11357
* @restoreSelection: If any selection information was potentially lost,
11358
* restore it. This is useful when performing operations that could remove dom
11359
* nodes and place them back in, resulting in focus being lost.
11360
*/
11361
restoreSelection: function(priorSelectionInformation) {
11362
var curFocusedElem = getActiveElement();
11363
var priorFocusedElem = priorSelectionInformation.focusedElem;
11364
var priorSelectionRange = priorSelectionInformation.selectionRange;
11365
if (curFocusedElem !== priorFocusedElem &&
11366
isInDocument(priorFocusedElem)) {
11367
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
11368
ReactInputSelection.setSelection(
11369
priorFocusedElem,
11370
priorSelectionRange
11371
);
11372
}
11373
focusNode(priorFocusedElem);
11374
}
11375
},
11376
11377
/**
11378
* @getSelection: Gets the selection bounds of a focused textarea, input or
11379
* contentEditable node.
11380
* -@input: Look up selection bounds of this input
11381
* -@return {start: selectionStart, end: selectionEnd}
11382
*/
11383
getSelection: function(input) {
11384
var selection;
11385
11386
if ('selectionStart' in input) {
11387
// Modern browser with input or textarea.
11388
selection = {
11389
start: input.selectionStart,
11390
end: input.selectionEnd
11391
};
11392
} else if (document.selection && input.nodeName === 'INPUT') {
11393
// IE8 input.
11394
var range = document.selection.createRange();
11395
// There can only be one selection per document in IE, so it must
11396
// be in our element.
11397
if (range.parentElement() === input) {
11398
selection = {
11399
start: -range.moveStart('character', -input.value.length),
11400
end: -range.moveEnd('character', -input.value.length)
11401
};
11402
}
11403
} else {
11404
// Content editable or old IE textarea.
11405
selection = ReactDOMSelection.getOffsets(input);
11406
}
11407
11408
return selection || {start: 0, end: 0};
11409
},
11410
11411
/**
11412
* @setSelection: Sets the selection bounds of a textarea or input and focuses
11413
* the input.
11414
* -@input Set selection bounds of this input or textarea
11415
* -@offsets Object of same form that is returned from get*
11416
*/
11417
setSelection: function(input, offsets) {
11418
var start = offsets.start;
11419
var end = offsets.end;
11420
if (typeof end === 'undefined') {
11421
end = start;
11422
}
11423
11424
if ('selectionStart' in input) {
11425
input.selectionStart = start;
11426
input.selectionEnd = Math.min(end, input.value.length);
11427
} else if (document.selection && input.nodeName === 'INPUT') {
11428
var range = input.createTextRange();
11429
range.collapse(true);
11430
range.moveStart('character', start);
11431
range.moveEnd('character', end - start);
11432
range.select();
11433
} else {
11434
ReactDOMSelection.setOffsets(input, offsets);
11435
}
11436
}
11437
};
11438
11439
module.exports = ReactInputSelection;
11440
11441
11442
},{"./ReactDOMSelection":51,"./containsNode":110,"./focusNode":120,"./getActiveElement":122}],67:[function(require,module,exports){
11443
(function (process){
11444
/**
11445
* Copyright 2013-2015, Facebook, Inc.
11446
* All rights reserved.
11447
*
11448
* This source code is licensed under the BSD-style license found in the
11449
* LICENSE file in the root directory of this source tree. An additional grant
11450
* of patent rights can be found in the PATENTS file in the same directory.
11451
*
11452
* @providesModule ReactInstanceHandles
11453
* @typechecks static-only
11454
*/
11455
11456
'use strict';
11457
11458
var ReactRootIndex = require("./ReactRootIndex");
11459
11460
var invariant = require("./invariant");
11461
11462
var SEPARATOR = '.';
11463
var SEPARATOR_LENGTH = SEPARATOR.length;
11464
11465
/**
11466
* Maximum depth of traversals before we consider the possibility of a bad ID.
11467
*/
11468
var MAX_TREE_DEPTH = 100;
11469
11470
/**
11471
* Creates a DOM ID prefix to use when mounting React components.
11472
*
11473
* @param {number} index A unique integer
11474
* @return {string} React root ID.
11475
* @internal
11476
*/
11477
function getReactRootIDString(index) {
11478
return SEPARATOR + index.toString(36);
11479
}
11480
11481
/**
11482
* Checks if a character in the supplied ID is a separator or the end.
11483
*
11484
* @param {string} id A React DOM ID.
11485
* @param {number} index Index of the character to check.
11486
* @return {boolean} True if the character is a separator or end of the ID.
11487
* @private
11488
*/
11489
function isBoundary(id, index) {
11490
return id.charAt(index) === SEPARATOR || index === id.length;
11491
}
11492
11493
/**
11494
* Checks if the supplied string is a valid React DOM ID.
11495
*
11496
* @param {string} id A React DOM ID, maybe.
11497
* @return {boolean} True if the string is a valid React DOM ID.
11498
* @private
11499
*/
11500
function isValidID(id) {
11501
return id === '' || (
11502
id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
11503
);
11504
}
11505
11506
/**
11507
* Checks if the first ID is an ancestor of or equal to the second ID.
11508
*
11509
* @param {string} ancestorID
11510
* @param {string} descendantID
11511
* @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
11512
* @internal
11513
*/
11514
function isAncestorIDOf(ancestorID, descendantID) {
11515
return (
11516
descendantID.indexOf(ancestorID) === 0 &&
11517
isBoundary(descendantID, ancestorID.length)
11518
);
11519
}
11520
11521
/**
11522
* Gets the parent ID of the supplied React DOM ID, `id`.
11523
*
11524
* @param {string} id ID of a component.
11525
* @return {string} ID of the parent, or an empty string.
11526
* @private
11527
*/
11528
function getParentID(id) {
11529
return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
11530
}
11531
11532
/**
11533
* Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
11534
* supplied `destinationID`. If they are equal, the ID is returned.
11535
*
11536
* @param {string} ancestorID ID of an ancestor node of `destinationID`.
11537
* @param {string} destinationID ID of the destination node.
11538
* @return {string} Next ID on the path from `ancestorID` to `destinationID`.
11539
* @private
11540
*/
11541
function getNextDescendantID(ancestorID, destinationID) {
11542
("production" !== process.env.NODE_ENV ? invariant(
11543
isValidID(ancestorID) && isValidID(destinationID),
11544
'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
11545
ancestorID,
11546
destinationID
11547
) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
11548
("production" !== process.env.NODE_ENV ? invariant(
11549
isAncestorIDOf(ancestorID, destinationID),
11550
'getNextDescendantID(...): React has made an invalid assumption about ' +
11551
'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
11552
ancestorID,
11553
destinationID
11554
) : invariant(isAncestorIDOf(ancestorID, destinationID)));
11555
if (ancestorID === destinationID) {
11556
return ancestorID;
11557
}
11558
// Skip over the ancestor and the immediate separator. Traverse until we hit
11559
// another separator or we reach the end of `destinationID`.
11560
var start = ancestorID.length + SEPARATOR_LENGTH;
11561
var i;
11562
for (i = start; i < destinationID.length; i++) {
11563
if (isBoundary(destinationID, i)) {
11564
break;
11565
}
11566
}
11567
return destinationID.substr(0, i);
11568
}
11569
11570
/**
11571
* Gets the nearest common ancestor ID of two IDs.
11572
*
11573
* Using this ID scheme, the nearest common ancestor ID is the longest common
11574
* prefix of the two IDs that immediately preceded a "marker" in both strings.
11575
*
11576
* @param {string} oneID
11577
* @param {string} twoID
11578
* @return {string} Nearest common ancestor ID, or the empty string if none.
11579
* @private
11580
*/
11581
function getFirstCommonAncestorID(oneID, twoID) {
11582
var minLength = Math.min(oneID.length, twoID.length);
11583
if (minLength === 0) {
11584
return '';
11585
}
11586
var lastCommonMarkerIndex = 0;
11587
// Use `<=` to traverse until the "EOL" of the shorter string.
11588
for (var i = 0; i <= minLength; i++) {
11589
if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
11590
lastCommonMarkerIndex = i;
11591
} else if (oneID.charAt(i) !== twoID.charAt(i)) {
11592
break;
11593
}
11594
}
11595
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
11596
("production" !== process.env.NODE_ENV ? invariant(
11597
isValidID(longestCommonID),
11598
'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
11599
oneID,
11600
twoID,
11601
longestCommonID
11602
) : invariant(isValidID(longestCommonID)));
11603
return longestCommonID;
11604
}
11605
11606
/**
11607
* Traverses the parent path between two IDs (either up or down). The IDs must
11608
* not be the same, and there must exist a parent path between them. If the
11609
* callback returns `false`, traversal is stopped.
11610
*
11611
* @param {?string} start ID at which to start traversal.
11612
* @param {?string} stop ID at which to end traversal.
11613
* @param {function} cb Callback to invoke each ID with.
11614
* @param {?boolean} skipFirst Whether or not to skip the first node.
11615
* @param {?boolean} skipLast Whether or not to skip the last node.
11616
* @private
11617
*/
11618
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
11619
start = start || '';
11620
stop = stop || '';
11621
("production" !== process.env.NODE_ENV ? invariant(
11622
start !== stop,
11623
'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
11624
start
11625
) : invariant(start !== stop));
11626
var traverseUp = isAncestorIDOf(stop, start);
11627
("production" !== process.env.NODE_ENV ? invariant(
11628
traverseUp || isAncestorIDOf(start, stop),
11629
'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
11630
'not have a parent path.',
11631
start,
11632
stop
11633
) : invariant(traverseUp || isAncestorIDOf(start, stop)));
11634
// Traverse from `start` to `stop` one depth at a time.
11635
var depth = 0;
11636
var traverse = traverseUp ? getParentID : getNextDescendantID;
11637
for (var id = start; /* until break */; id = traverse(id, stop)) {
11638
var ret;
11639
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
11640
ret = cb(id, traverseUp, arg);
11641
}
11642
if (ret === false || id === stop) {
11643
// Only break //after// visiting `stop`.
11644
break;
11645
}
11646
("production" !== process.env.NODE_ENV ? invariant(
11647
depth++ < MAX_TREE_DEPTH,
11648
'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
11649
'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
11650
start, stop
11651
) : invariant(depth++ < MAX_TREE_DEPTH));
11652
}
11653
}
11654
11655
/**
11656
* Manages the IDs assigned to DOM representations of React components. This
11657
* uses a specific scheme in order to traverse the DOM efficiently (e.g. in
11658
* order to simulate events).
11659
*
11660
* @internal
11661
*/
11662
var ReactInstanceHandles = {
11663
11664
/**
11665
* Constructs a React root ID
11666
* @return {string} A React root ID.
11667
*/
11668
createReactRootID: function() {
11669
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
11670
},
11671
11672
/**
11673
* Constructs a React ID by joining a root ID with a name.
11674
*
11675
* @param {string} rootID Root ID of a parent component.
11676
* @param {string} name A component's name (as flattened children).
11677
* @return {string} A React ID.
11678
* @internal
11679
*/
11680
createReactID: function(rootID, name) {
11681
return rootID + name;
11682
},
11683
11684
/**
11685
* Gets the DOM ID of the React component that is the root of the tree that
11686
* contains the React component with the supplied DOM ID.
11687
*
11688
* @param {string} id DOM ID of a React component.
11689
* @return {?string} DOM ID of the React component that is the root.
11690
* @internal
11691
*/
11692
getReactRootIDFromNodeID: function(id) {
11693
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
11694
var index = id.indexOf(SEPARATOR, 1);
11695
return index > -1 ? id.substr(0, index) : id;
11696
}
11697
return null;
11698
},
11699
11700
/**
11701
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
11702
* should would receive a `mouseEnter` or `mouseLeave` event.
11703
*
11704
* NOTE: Does not invoke the callback on the nearest common ancestor because
11705
* nothing "entered" or "left" that element.
11706
*
11707
* @param {string} leaveID ID being left.
11708
* @param {string} enterID ID being entered.
11709
* @param {function} cb Callback to invoke on each entered/left ID.
11710
* @param {*} upArg Argument to invoke the callback with on left IDs.
11711
* @param {*} downArg Argument to invoke the callback with on entered IDs.
11712
* @internal
11713
*/
11714
traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
11715
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
11716
if (ancestorID !== leaveID) {
11717
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
11718
}
11719
if (ancestorID !== enterID) {
11720
traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
11721
}
11722
},
11723
11724
/**
11725
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
11726
*
11727
* NOTE: This traversal happens on IDs without touching the DOM.
11728
*
11729
* @param {string} targetID ID of the target node.
11730
* @param {function} cb Callback to invoke.
11731
* @param {*} arg Argument to invoke the callback with.
11732
* @internal
11733
*/
11734
traverseTwoPhase: function(targetID, cb, arg) {
11735
if (targetID) {
11736
traverseParentPath('', targetID, cb, arg, true, false);
11737
traverseParentPath(targetID, '', cb, arg, false, true);
11738
}
11739
},
11740
11741
/**
11742
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
11743
* example, passing `.0.$row-0.1` would result in `cb` getting called
11744
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
11745
*
11746
* NOTE: This traversal happens on IDs without touching the DOM.
11747
*
11748
* @param {string} targetID ID of the target node.
11749
* @param {function} cb Callback to invoke.
11750
* @param {*} arg Argument to invoke the callback with.
11751
* @internal
11752
*/
11753
traverseAncestors: function(targetID, cb, arg) {
11754
traverseParentPath('', targetID, cb, arg, true, false);
11755
},
11756
11757
/**
11758
* Exposed for unit testing.
11759
* @private
11760
*/
11761
_getFirstCommonAncestorID: getFirstCommonAncestorID,
11762
11763
/**
11764
* Exposed for unit testing.
11765
* @private
11766
*/
11767
_getNextDescendantID: getNextDescendantID,
11768
11769
isAncestorIDOf: isAncestorIDOf,
11770
11771
SEPARATOR: SEPARATOR
11772
11773
};
11774
11775
module.exports = ReactInstanceHandles;
11776
11777
11778
}).call(this,require("FWaASH"))
11779
},{"./ReactRootIndex":84,"./invariant":136,"FWaASH":1}],68:[function(require,module,exports){
11780
/**
11781
* Copyright 2013-2015, Facebook, Inc.
11782
* All rights reserved.
11783
*
11784
* This source code is licensed under the BSD-style license found in the
11785
* LICENSE file in the root directory of this source tree. An additional grant
11786
* of patent rights can be found in the PATENTS file in the same directory.
11787
*
11788
* @providesModule ReactInstanceMap
11789
*/
11790
11791
'use strict';
11792
11793
/**
11794
* `ReactInstanceMap` maintains a mapping from a public facing stateful
11795
* instance (key) and the internal representation (value). This allows public
11796
* methods to accept the user facing instance as an argument and map them back
11797
* to internal methods.
11798
*/
11799
11800
// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
11801
var ReactInstanceMap = {
11802
11803
/**
11804
* This API should be called `delete` but we'd have to make sure to always
11805
* transform these to strings for IE support. When this transform is fully
11806
* supported we can rename it.
11807
*/
11808
remove: function(key) {
11809
key._reactInternalInstance = undefined;
11810
},
11811
11812
get: function(key) {
11813
return key._reactInternalInstance;
11814
},
11815
11816
has: function(key) {
11817
return key._reactInternalInstance !== undefined;
11818
},
11819
11820
set: function(key, value) {
11821
key._reactInternalInstance = value;
11822
}
11823
11824
};
11825
11826
module.exports = ReactInstanceMap;
11827
11828
11829
},{}],69:[function(require,module,exports){
11830
/**
11831
* Copyright 2015, Facebook, Inc.
11832
* All rights reserved.
11833
*
11834
* This source code is licensed under the BSD-style license found in the
11835
* LICENSE file in the root directory of this source tree. An additional grant
11836
* of patent rights can be found in the PATENTS file in the same directory.
11837
*
11838
* @providesModule ReactLifeCycle
11839
*/
11840
11841
'use strict';
11842
11843
/**
11844
* This module manages the bookkeeping when a component is in the process
11845
* of being mounted or being unmounted. This is used as a way to enforce
11846
* invariants (or warnings) when it is not recommended to call
11847
* setState/forceUpdate.
11848
*
11849
* currentlyMountingInstance: During the construction phase, it is not possible
11850
* to trigger an update since the instance is not fully mounted yet. However, we
11851
* currently allow this as a convenience for mutating the initial state.
11852
*
11853
* currentlyUnmountingInstance: During the unmounting phase, the instance is
11854
* still mounted and can therefore schedule an update. However, this is not
11855
* recommended and probably an error since it's about to be unmounted.
11856
* Therefore we still want to trigger in an error for that case.
11857
*/
11858
11859
var ReactLifeCycle = {
11860
currentlyMountingInstance: null,
11861
currentlyUnmountingInstance: null
11862
};
11863
11864
module.exports = ReactLifeCycle;
11865
11866
11867
},{}],70:[function(require,module,exports){
11868
/**
11869
* Copyright 2013-2015, Facebook, Inc.
11870
* All rights reserved.
11871
*
11872
* This source code is licensed under the BSD-style license found in the
11873
* LICENSE file in the root directory of this source tree. An additional grant
11874
* of patent rights can be found in the PATENTS file in the same directory.
11875
*
11876
* @providesModule ReactMarkupChecksum
11877
*/
11878
11879
'use strict';
11880
11881
var adler32 = require("./adler32");
11882
11883
var ReactMarkupChecksum = {
11884
CHECKSUM_ATTR_NAME: 'data-react-checksum',
11885
11886
/**
11887
* @param {string} markup Markup string
11888
* @return {string} Markup string with checksum attribute attached
11889
*/
11890
addChecksumToMarkup: function(markup) {
11891
var checksum = adler32(markup);
11892
return markup.replace(
11893
'>',
11894
' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
11895
);
11896
},
11897
11898
/**
11899
* @param {string} markup to use
11900
* @param {DOMElement} element root React element
11901
* @returns {boolean} whether or not the markup is the same
11902
*/
11903
canReuseMarkup: function(markup, element) {
11904
var existingChecksum = element.getAttribute(
11905
ReactMarkupChecksum.CHECKSUM_ATTR_NAME
11906
);
11907
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
11908
var markupChecksum = adler32(markup);
11909
return markupChecksum === existingChecksum;
11910
}
11911
};
11912
11913
module.exports = ReactMarkupChecksum;
11914
11915
11916
},{"./adler32":107}],71:[function(require,module,exports){
11917
(function (process){
11918
/**
11919
* Copyright 2013-2015, Facebook, Inc.
11920
* All rights reserved.
11921
*
11922
* This source code is licensed under the BSD-style license found in the
11923
* LICENSE file in the root directory of this source tree. An additional grant
11924
* of patent rights can be found in the PATENTS file in the same directory.
11925
*
11926
* @providesModule ReactMount
11927
*/
11928
11929
'use strict';
11930
11931
var DOMProperty = require("./DOMProperty");
11932
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
11933
var ReactCurrentOwner = require("./ReactCurrentOwner");
11934
var ReactElement = require("./ReactElement");
11935
var ReactElementValidator = require("./ReactElementValidator");
11936
var ReactEmptyComponent = require("./ReactEmptyComponent");
11937
var ReactInstanceHandles = require("./ReactInstanceHandles");
11938
var ReactInstanceMap = require("./ReactInstanceMap");
11939
var ReactMarkupChecksum = require("./ReactMarkupChecksum");
11940
var ReactPerf = require("./ReactPerf");
11941
var ReactReconciler = require("./ReactReconciler");
11942
var ReactUpdateQueue = require("./ReactUpdateQueue");
11943
var ReactUpdates = require("./ReactUpdates");
11944
11945
var emptyObject = require("./emptyObject");
11946
var containsNode = require("./containsNode");
11947
var getReactRootElementInContainer = require("./getReactRootElementInContainer");
11948
var instantiateReactComponent = require("./instantiateReactComponent");
11949
var invariant = require("./invariant");
11950
var setInnerHTML = require("./setInnerHTML");
11951
var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
11952
var warning = require("./warning");
11953
11954
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
11955
11956
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
11957
var nodeCache = {};
11958
11959
var ELEMENT_NODE_TYPE = 1;
11960
var DOC_NODE_TYPE = 9;
11961
11962
/** Mapping from reactRootID to React component instance. */
11963
var instancesByReactRootID = {};
11964
11965
/** Mapping from reactRootID to `container` nodes. */
11966
var containersByReactRootID = {};
11967
11968
if ("production" !== process.env.NODE_ENV) {
11969
/** __DEV__-only mapping from reactRootID to root elements. */
11970
var rootElementsByReactRootID = {};
11971
}
11972
11973
// Used to store breadth-first search state in findComponentRoot.
11974
var findComponentRootReusableArray = [];
11975
11976
/**
11977
* Finds the index of the first character
11978
* that's not common between the two given strings.
11979
*
11980
* @return {number} the index of the character where the strings diverge
11981
*/
11982
function firstDifferenceIndex(string1, string2) {
11983
var minLen = Math.min(string1.length, string2.length);
11984
for (var i = 0; i < minLen; i++) {
11985
if (string1.charAt(i) !== string2.charAt(i)) {
11986
return i;
11987
}
11988
}
11989
return string1.length === string2.length ? -1 : minLen;
11990
}
11991
11992
/**
11993
* @param {DOMElement} container DOM element that may contain a React component.
11994
* @return {?string} A "reactRoot" ID, if a React component is rendered.
11995
*/
11996
function getReactRootID(container) {
11997
var rootElement = getReactRootElementInContainer(container);
11998
return rootElement && ReactMount.getID(rootElement);
11999
}
12000
12001
/**
12002
* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
12003
* element can return its control whose name or ID equals ATTR_NAME. All
12004
* DOM nodes support `getAttributeNode` but this can also get called on
12005
* other objects so just return '' if we're given something other than a
12006
* DOM node (such as window).
12007
*
12008
* @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
12009
* @return {string} ID of the supplied `domNode`.
12010
*/
12011
function getID(node) {
12012
var id = internalGetID(node);
12013
if (id) {
12014
if (nodeCache.hasOwnProperty(id)) {
12015
var cached = nodeCache[id];
12016
if (cached !== node) {
12017
("production" !== process.env.NODE_ENV ? invariant(
12018
!isValid(cached, id),
12019
'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
12020
ATTR_NAME, id
12021
) : invariant(!isValid(cached, id)));
12022
12023
nodeCache[id] = node;
12024
}
12025
} else {
12026
nodeCache[id] = node;
12027
}
12028
}
12029
12030
return id;
12031
}
12032
12033
function internalGetID(node) {
12034
// If node is something like a window, document, or text node, none of
12035
// which support attributes or a .getAttribute method, gracefully return
12036
// the empty string, as if the attribute were missing.
12037
return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
12038
}
12039
12040
/**
12041
* Sets the React-specific ID of the given node.
12042
*
12043
* @param {DOMElement} node The DOM node whose ID will be set.
12044
* @param {string} id The value of the ID attribute.
12045
*/
12046
function setID(node, id) {
12047
var oldID = internalGetID(node);
12048
if (oldID !== id) {
12049
delete nodeCache[oldID];
12050
}
12051
node.setAttribute(ATTR_NAME, id);
12052
nodeCache[id] = node;
12053
}
12054
12055
/**
12056
* Finds the node with the supplied React-generated DOM ID.
12057
*
12058
* @param {string} id A React-generated DOM ID.
12059
* @return {DOMElement} DOM node with the suppled `id`.
12060
* @internal
12061
*/
12062
function getNode(id) {
12063
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
12064
nodeCache[id] = ReactMount.findReactNodeByID(id);
12065
}
12066
return nodeCache[id];
12067
}
12068
12069
/**
12070
* Finds the node with the supplied public React instance.
12071
*
12072
* @param {*} instance A public React instance.
12073
* @return {?DOMElement} DOM node with the suppled `id`.
12074
* @internal
12075
*/
12076
function getNodeFromInstance(instance) {
12077
var id = ReactInstanceMap.get(instance)._rootNodeID;
12078
if (ReactEmptyComponent.isNullComponentID(id)) {
12079
return null;
12080
}
12081
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
12082
nodeCache[id] = ReactMount.findReactNodeByID(id);
12083
}
12084
return nodeCache[id];
12085
}
12086
12087
/**
12088
* A node is "valid" if it is contained by a currently mounted container.
12089
*
12090
* This means that the node does not have to be contained by a document in
12091
* order to be considered valid.
12092
*
12093
* @param {?DOMElement} node The candidate DOM node.
12094
* @param {string} id The expected ID of the node.
12095
* @return {boolean} Whether the node is contained by a mounted container.
12096
*/
12097
function isValid(node, id) {
12098
if (node) {
12099
("production" !== process.env.NODE_ENV ? invariant(
12100
internalGetID(node) === id,
12101
'ReactMount: Unexpected modification of `%s`',
12102
ATTR_NAME
12103
) : invariant(internalGetID(node) === id));
12104
12105
var container = ReactMount.findReactContainerForID(id);
12106
if (container && containsNode(container, node)) {
12107
return true;
12108
}
12109
}
12110
12111
return false;
12112
}
12113
12114
/**
12115
* Causes the cache to forget about one React-specific ID.
12116
*
12117
* @param {string} id The ID to forget.
12118
*/
12119
function purgeID(id) {
12120
delete nodeCache[id];
12121
}
12122
12123
var deepestNodeSoFar = null;
12124
function findDeepestCachedAncestorImpl(ancestorID) {
12125
var ancestor = nodeCache[ancestorID];
12126
if (ancestor && isValid(ancestor, ancestorID)) {
12127
deepestNodeSoFar = ancestor;
12128
} else {
12129
// This node isn't populated in the cache, so presumably none of its
12130
// descendants are. Break out of the loop.
12131
return false;
12132
}
12133
}
12134
12135
/**
12136
* Return the deepest cached node whose ID is a prefix of `targetID`.
12137
*/
12138
function findDeepestCachedAncestor(targetID) {
12139
deepestNodeSoFar = null;
12140
ReactInstanceHandles.traverseAncestors(
12141
targetID,
12142
findDeepestCachedAncestorImpl
12143
);
12144
12145
var foundNode = deepestNodeSoFar;
12146
deepestNodeSoFar = null;
12147
return foundNode;
12148
}
12149
12150
/**
12151
* Mounts this component and inserts it into the DOM.
12152
*
12153
* @param {ReactComponent} componentInstance The instance to mount.
12154
* @param {string} rootID DOM ID of the root node.
12155
* @param {DOMElement} container DOM element to mount into.
12156
* @param {ReactReconcileTransaction} transaction
12157
* @param {boolean} shouldReuseMarkup If true, do not insert markup
12158
*/
12159
function mountComponentIntoNode(
12160
componentInstance,
12161
rootID,
12162
container,
12163
transaction,
12164
shouldReuseMarkup) {
12165
var markup = ReactReconciler.mountComponent(
12166
componentInstance, rootID, transaction, emptyObject
12167
);
12168
componentInstance._isTopLevel = true;
12169
ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
12170
}
12171
12172
/**
12173
* Batched mount.
12174
*
12175
* @param {ReactComponent} componentInstance The instance to mount.
12176
* @param {string} rootID DOM ID of the root node.
12177
* @param {DOMElement} container DOM element to mount into.
12178
* @param {boolean} shouldReuseMarkup If true, do not insert markup
12179
*/
12180
function batchedMountComponentIntoNode(
12181
componentInstance,
12182
rootID,
12183
container,
12184
shouldReuseMarkup) {
12185
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
12186
transaction.perform(
12187
mountComponentIntoNode,
12188
null,
12189
componentInstance,
12190
rootID,
12191
container,
12192
transaction,
12193
shouldReuseMarkup
12194
);
12195
ReactUpdates.ReactReconcileTransaction.release(transaction);
12196
}
12197
12198
/**
12199
* Mounting is the process of initializing a React component by creating its
12200
* representative DOM elements and inserting them into a supplied `container`.
12201
* Any prior content inside `container` is destroyed in the process.
12202
*
12203
* ReactMount.render(
12204
* component,
12205
* document.getElementById('container')
12206
* );
12207
*
12208
* <div id="container"> <-- Supplied `container`.
12209
* <div data-reactid=".3"> <-- Rendered reactRoot of React
12210
* // ... component.
12211
* </div>
12212
* </div>
12213
*
12214
* Inside of `container`, the first element rendered is the "reactRoot".
12215
*/
12216
var ReactMount = {
12217
/** Exposed for debugging purposes **/
12218
_instancesByReactRootID: instancesByReactRootID,
12219
12220
/**
12221
* This is a hook provided to support rendering React components while
12222
* ensuring that the apparent scroll position of its `container` does not
12223
* change.
12224
*
12225
* @param {DOMElement} container The `container` being rendered into.
12226
* @param {function} renderCallback This must be called once to do the render.
12227
*/
12228
scrollMonitor: function(container, renderCallback) {
12229
renderCallback();
12230
},
12231
12232
/**
12233
* Take a component that's already mounted into the DOM and replace its props
12234
* @param {ReactComponent} prevComponent component instance already in the DOM
12235
* @param {ReactElement} nextElement component instance to render
12236
* @param {DOMElement} container container to render into
12237
* @param {?function} callback function triggered on completion
12238
*/
12239
_updateRootComponent: function(
12240
prevComponent,
12241
nextElement,
12242
container,
12243
callback) {
12244
if ("production" !== process.env.NODE_ENV) {
12245
ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
12246
}
12247
12248
ReactMount.scrollMonitor(container, function() {
12249
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
12250
if (callback) {
12251
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
12252
}
12253
});
12254
12255
if ("production" !== process.env.NODE_ENV) {
12256
// Record the root element in case it later gets transplanted.
12257
rootElementsByReactRootID[getReactRootID(container)] =
12258
getReactRootElementInContainer(container);
12259
}
12260
12261
return prevComponent;
12262
},
12263
12264
/**
12265
* Register a component into the instance map and starts scroll value
12266
* monitoring
12267
* @param {ReactComponent} nextComponent component instance to render
12268
* @param {DOMElement} container container to render into
12269
* @return {string} reactRoot ID prefix
12270
*/
12271
_registerComponent: function(nextComponent, container) {
12272
("production" !== process.env.NODE_ENV ? invariant(
12273
container && (
12274
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
12275
),
12276
'_registerComponent(...): Target container is not a DOM element.'
12277
) : invariant(container && (
12278
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
12279
)));
12280
12281
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
12282
12283
var reactRootID = ReactMount.registerContainer(container);
12284
instancesByReactRootID[reactRootID] = nextComponent;
12285
return reactRootID;
12286
},
12287
12288
/**
12289
* Render a new component into the DOM.
12290
* @param {ReactElement} nextElement element to render
12291
* @param {DOMElement} container container to render into
12292
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
12293
* @return {ReactComponent} nextComponent
12294
*/
12295
_renderNewRootComponent: function(
12296
nextElement,
12297
container,
12298
shouldReuseMarkup
12299
) {
12300
// Various parts of our code (such as ReactCompositeComponent's
12301
// _renderValidatedComponent) assume that calls to render aren't nested;
12302
// verify that that's the case.
12303
("production" !== process.env.NODE_ENV ? warning(
12304
ReactCurrentOwner.current == null,
12305
'_renderNewRootComponent(): Render methods should be a pure function ' +
12306
'of props and state; triggering nested component updates from ' +
12307
'render is not allowed. If necessary, trigger nested updates in ' +
12308
'componentDidUpdate.'
12309
) : null);
12310
12311
var componentInstance = instantiateReactComponent(nextElement, null);
12312
var reactRootID = ReactMount._registerComponent(
12313
componentInstance,
12314
container
12315
);
12316
12317
// The initial render is synchronous but any updates that happen during
12318
// rendering, in componentWillMount or componentDidMount, will be batched
12319
// according to the current batching strategy.
12320
12321
ReactUpdates.batchedUpdates(
12322
batchedMountComponentIntoNode,
12323
componentInstance,
12324
reactRootID,
12325
container,
12326
shouldReuseMarkup
12327
);
12328
12329
if ("production" !== process.env.NODE_ENV) {
12330
// Record the root element in case it later gets transplanted.
12331
rootElementsByReactRootID[reactRootID] =
12332
getReactRootElementInContainer(container);
12333
}
12334
12335
return componentInstance;
12336
},
12337
12338
/**
12339
* Renders a React component into the DOM in the supplied `container`.
12340
*
12341
* If the React component was previously rendered into `container`, this will
12342
* perform an update on it and only mutate the DOM as necessary to reflect the
12343
* latest React component.
12344
*
12345
* @param {ReactElement} nextElement Component element to render.
12346
* @param {DOMElement} container DOM element to render into.
12347
* @param {?function} callback function triggered on completion
12348
* @return {ReactComponent} Component instance rendered in `container`.
12349
*/
12350
render: function(nextElement, container, callback) {
12351
("production" !== process.env.NODE_ENV ? invariant(
12352
ReactElement.isValidElement(nextElement),
12353
'React.render(): Invalid component element.%s',
12354
(
12355
typeof nextElement === 'string' ?
12356
' Instead of passing an element string, make sure to instantiate ' +
12357
'it by passing it to React.createElement.' :
12358
typeof nextElement === 'function' ?
12359
' Instead of passing a component class, make sure to instantiate ' +
12360
'it by passing it to React.createElement.' :
12361
// Check if it quacks like an element
12362
nextElement != null && nextElement.props !== undefined ?
12363
' This may be caused by unintentionally loading two independent ' +
12364
'copies of React.' :
12365
''
12366
)
12367
) : invariant(ReactElement.isValidElement(nextElement)));
12368
12369
var prevComponent = instancesByReactRootID[getReactRootID(container)];
12370
12371
if (prevComponent) {
12372
var prevElement = prevComponent._currentElement;
12373
if (shouldUpdateReactComponent(prevElement, nextElement)) {
12374
return ReactMount._updateRootComponent(
12375
prevComponent,
12376
nextElement,
12377
container,
12378
callback
12379
).getPublicInstance();
12380
} else {
12381
ReactMount.unmountComponentAtNode(container);
12382
}
12383
}
12384
12385
var reactRootElement = getReactRootElementInContainer(container);
12386
var containerHasReactMarkup =
12387
reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
12388
12389
if ("production" !== process.env.NODE_ENV) {
12390
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
12391
var rootElementSibling = reactRootElement;
12392
while (rootElementSibling) {
12393
if (ReactMount.isRenderedByReact(rootElementSibling)) {
12394
("production" !== process.env.NODE_ENV ? warning(
12395
false,
12396
'render(): Target node has markup rendered by React, but there ' +
12397
'are unrelated nodes as well. This is most commonly caused by ' +
12398
'white-space inserted around server-rendered markup.'
12399
) : null);
12400
break;
12401
}
12402
12403
rootElementSibling = rootElementSibling.nextSibling;
12404
}
12405
}
12406
}
12407
12408
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
12409
12410
var component = ReactMount._renderNewRootComponent(
12411
nextElement,
12412
container,
12413
shouldReuseMarkup
12414
).getPublicInstance();
12415
if (callback) {
12416
callback.call(component);
12417
}
12418
return component;
12419
},
12420
12421
/**
12422
* Constructs a component instance of `constructor` with `initialProps` and
12423
* renders it into the supplied `container`.
12424
*
12425
* @param {function} constructor React component constructor.
12426
* @param {?object} props Initial props of the component instance.
12427
* @param {DOMElement} container DOM element to render into.
12428
* @return {ReactComponent} Component instance rendered in `container`.
12429
*/
12430
constructAndRenderComponent: function(constructor, props, container) {
12431
var element = ReactElement.createElement(constructor, props);
12432
return ReactMount.render(element, container);
12433
},
12434
12435
/**
12436
* Constructs a component instance of `constructor` with `initialProps` and
12437
* renders it into a container node identified by supplied `id`.
12438
*
12439
* @param {function} componentConstructor React component constructor
12440
* @param {?object} props Initial props of the component instance.
12441
* @param {string} id ID of the DOM element to render into.
12442
* @return {ReactComponent} Component instance rendered in the container node.
12443
*/
12444
constructAndRenderComponentByID: function(constructor, props, id) {
12445
var domNode = document.getElementById(id);
12446
("production" !== process.env.NODE_ENV ? invariant(
12447
domNode,
12448
'Tried to get element with id of "%s" but it is not present on the page.',
12449
id
12450
) : invariant(domNode));
12451
return ReactMount.constructAndRenderComponent(constructor, props, domNode);
12452
},
12453
12454
/**
12455
* Registers a container node into which React components will be rendered.
12456
* This also creates the "reactRoot" ID that will be assigned to the element
12457
* rendered within.
12458
*
12459
* @param {DOMElement} container DOM element to register as a container.
12460
* @return {string} The "reactRoot" ID of elements rendered within.
12461
*/
12462
registerContainer: function(container) {
12463
var reactRootID = getReactRootID(container);
12464
if (reactRootID) {
12465
// If one exists, make sure it is a valid "reactRoot" ID.
12466
reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
12467
}
12468
if (!reactRootID) {
12469
// No valid "reactRoot" ID found, create one.
12470
reactRootID = ReactInstanceHandles.createReactRootID();
12471
}
12472
containersByReactRootID[reactRootID] = container;
12473
return reactRootID;
12474
},
12475
12476
/**
12477
* Unmounts and destroys the React component rendered in the `container`.
12478
*
12479
* @param {DOMElement} container DOM element containing a React component.
12480
* @return {boolean} True if a component was found in and unmounted from
12481
* `container`
12482
*/
12483
unmountComponentAtNode: function(container) {
12484
// Various parts of our code (such as ReactCompositeComponent's
12485
// _renderValidatedComponent) assume that calls to render aren't nested;
12486
// verify that that's the case. (Strictly speaking, unmounting won't cause a
12487
// render but we still don't expect to be in a render call here.)
12488
("production" !== process.env.NODE_ENV ? warning(
12489
ReactCurrentOwner.current == null,
12490
'unmountComponentAtNode(): Render methods should be a pure function of ' +
12491
'props and state; triggering nested component updates from render is ' +
12492
'not allowed. If necessary, trigger nested updates in ' +
12493
'componentDidUpdate.'
12494
) : null);
12495
12496
("production" !== process.env.NODE_ENV ? invariant(
12497
container && (
12498
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
12499
),
12500
'unmountComponentAtNode(...): Target container is not a DOM element.'
12501
) : invariant(container && (
12502
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
12503
)));
12504
12505
var reactRootID = getReactRootID(container);
12506
var component = instancesByReactRootID[reactRootID];
12507
if (!component) {
12508
return false;
12509
}
12510
ReactMount.unmountComponentFromNode(component, container);
12511
delete instancesByReactRootID[reactRootID];
12512
delete containersByReactRootID[reactRootID];
12513
if ("production" !== process.env.NODE_ENV) {
12514
delete rootElementsByReactRootID[reactRootID];
12515
}
12516
return true;
12517
},
12518
12519
/**
12520
* Unmounts a component and removes it from the DOM.
12521
*
12522
* @param {ReactComponent} instance React component instance.
12523
* @param {DOMElement} container DOM element to unmount from.
12524
* @final
12525
* @internal
12526
* @see {ReactMount.unmountComponentAtNode}
12527
*/
12528
unmountComponentFromNode: function(instance, container) {
12529
ReactReconciler.unmountComponent(instance);
12530
12531
if (container.nodeType === DOC_NODE_TYPE) {
12532
container = container.documentElement;
12533
}
12534
12535
// http://jsperf.com/emptying-a-node
12536
while (container.lastChild) {
12537
container.removeChild(container.lastChild);
12538
}
12539
},
12540
12541
/**
12542
* Finds the container DOM element that contains React component to which the
12543
* supplied DOM `id` belongs.
12544
*
12545
* @param {string} id The ID of an element rendered by a React component.
12546
* @return {?DOMElement} DOM element that contains the `id`.
12547
*/
12548
findReactContainerForID: function(id) {
12549
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
12550
var container = containersByReactRootID[reactRootID];
12551
12552
if ("production" !== process.env.NODE_ENV) {
12553
var rootElement = rootElementsByReactRootID[reactRootID];
12554
if (rootElement && rootElement.parentNode !== container) {
12555
("production" !== process.env.NODE_ENV ? invariant(
12556
// Call internalGetID here because getID calls isValid which calls
12557
// findReactContainerForID (this function).
12558
internalGetID(rootElement) === reactRootID,
12559
'ReactMount: Root element ID differed from reactRootID.'
12560
) : invariant(// Call internalGetID here because getID calls isValid which calls
12561
// findReactContainerForID (this function).
12562
internalGetID(rootElement) === reactRootID));
12563
12564
var containerChild = container.firstChild;
12565
if (containerChild &&
12566
reactRootID === internalGetID(containerChild)) {
12567
// If the container has a new child with the same ID as the old
12568
// root element, then rootElementsByReactRootID[reactRootID] is
12569
// just stale and needs to be updated. The case that deserves a
12570
// warning is when the container is empty.
12571
rootElementsByReactRootID[reactRootID] = containerChild;
12572
} else {
12573
("production" !== process.env.NODE_ENV ? warning(
12574
false,
12575
'ReactMount: Root element has been removed from its original ' +
12576
'container. New container:', rootElement.parentNode
12577
) : null);
12578
}
12579
}
12580
}
12581
12582
return container;
12583
},
12584
12585
/**
12586
* Finds an element rendered by React with the supplied ID.
12587
*
12588
* @param {string} id ID of a DOM node in the React component.
12589
* @return {DOMElement} Root DOM node of the React component.
12590
*/
12591
findReactNodeByID: function(id) {
12592
var reactRoot = ReactMount.findReactContainerForID(id);
12593
return ReactMount.findComponentRoot(reactRoot, id);
12594
},
12595
12596
/**
12597
* True if the supplied `node` is rendered by React.
12598
*
12599
* @param {*} node DOM Element to check.
12600
* @return {boolean} True if the DOM Element appears to be rendered by React.
12601
* @internal
12602
*/
12603
isRenderedByReact: function(node) {
12604
if (node.nodeType !== 1) {
12605
// Not a DOMElement, therefore not a React component
12606
return false;
12607
}
12608
var id = ReactMount.getID(node);
12609
return id ? id.charAt(0) === SEPARATOR : false;
12610
},
12611
12612
/**
12613
* Traverses up the ancestors of the supplied node to find a node that is a
12614
* DOM representation of a React component.
12615
*
12616
* @param {*} node
12617
* @return {?DOMEventTarget}
12618
* @internal
12619
*/
12620
getFirstReactDOM: function(node) {
12621
var current = node;
12622
while (current && current.parentNode !== current) {
12623
if (ReactMount.isRenderedByReact(current)) {
12624
return current;
12625
}
12626
current = current.parentNode;
12627
}
12628
return null;
12629
},
12630
12631
/**
12632
* Finds a node with the supplied `targetID` inside of the supplied
12633
* `ancestorNode`. Exploits the ID naming scheme to perform the search
12634
* quickly.
12635
*
12636
* @param {DOMEventTarget} ancestorNode Search from this root.
12637
* @pararm {string} targetID ID of the DOM representation of the component.
12638
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
12639
* @internal
12640
*/
12641
findComponentRoot: function(ancestorNode, targetID) {
12642
var firstChildren = findComponentRootReusableArray;
12643
var childIndex = 0;
12644
12645
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
12646
12647
firstChildren[0] = deepestAncestor.firstChild;
12648
firstChildren.length = 1;
12649
12650
while (childIndex < firstChildren.length) {
12651
var child = firstChildren[childIndex++];
12652
var targetChild;
12653
12654
while (child) {
12655
var childID = ReactMount.getID(child);
12656
if (childID) {
12657
// Even if we find the node we're looking for, we finish looping
12658
// through its siblings to ensure they're cached so that we don't have
12659
// to revisit this node again. Otherwise, we make n^2 calls to getID
12660
// when visiting the many children of a single node in order.
12661
12662
if (targetID === childID) {
12663
targetChild = child;
12664
} else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
12665
// If we find a child whose ID is an ancestor of the given ID,
12666
// then we can be sure that we only want to search the subtree
12667
// rooted at this child, so we can throw out the rest of the
12668
// search state.
12669
firstChildren.length = childIndex = 0;
12670
firstChildren.push(child.firstChild);
12671
}
12672
12673
} else {
12674
// If this child had no ID, then there's a chance that it was
12675
// injected automatically by the browser, as when a `<table>`
12676
// element sprouts an extra `<tbody>` child as a side effect of
12677
// `.innerHTML` parsing. Optimistically continue down this
12678
// branch, but not before examining the other siblings.
12679
firstChildren.push(child.firstChild);
12680
}
12681
12682
child = child.nextSibling;
12683
}
12684
12685
if (targetChild) {
12686
// Emptying firstChildren/findComponentRootReusableArray is
12687
// not necessary for correctness, but it helps the GC reclaim
12688
// any nodes that were left at the end of the search.
12689
firstChildren.length = 0;
12690
12691
return targetChild;
12692
}
12693
}
12694
12695
firstChildren.length = 0;
12696
12697
("production" !== process.env.NODE_ENV ? invariant(
12698
false,
12699
'findComponentRoot(..., %s): Unable to find element. This probably ' +
12700
'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
12701
'usually due to forgetting a <tbody> when using tables, nesting tags ' +
12702
'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
12703
'parent. ' +
12704
'Try inspecting the child nodes of the element with React ID `%s`.',
12705
targetID,
12706
ReactMount.getID(ancestorNode)
12707
) : invariant(false));
12708
},
12709
12710
_mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
12711
("production" !== process.env.NODE_ENV ? invariant(
12712
container && (
12713
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
12714
),
12715
'mountComponentIntoNode(...): Target container is not valid.'
12716
) : invariant(container && (
12717
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
12718
)));
12719
12720
if (shouldReuseMarkup) {
12721
var rootElement = getReactRootElementInContainer(container);
12722
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
12723
return;
12724
} else {
12725
var checksum = rootElement.getAttribute(
12726
ReactMarkupChecksum.CHECKSUM_ATTR_NAME
12727
);
12728
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
12729
12730
var rootMarkup = rootElement.outerHTML;
12731
rootElement.setAttribute(
12732
ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
12733
checksum
12734
);
12735
12736
var diffIndex = firstDifferenceIndex(markup, rootMarkup);
12737
var difference = ' (client) ' +
12738
markup.substring(diffIndex - 20, diffIndex + 20) +
12739
'\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
12740
12741
("production" !== process.env.NODE_ENV ? invariant(
12742
container.nodeType !== DOC_NODE_TYPE,
12743
'You\'re trying to render a component to the document using ' +
12744
'server rendering but the checksum was invalid. This usually ' +
12745
'means you rendered a different component type or props on ' +
12746
'the client from the one on the server, or your render() ' +
12747
'methods are impure. React cannot handle this case due to ' +
12748
'cross-browser quirks by rendering at the document root. You ' +
12749
'should look for environment dependent code in your components ' +
12750
'and ensure the props are the same client and server side:\n%s',
12751
difference
12752
) : invariant(container.nodeType !== DOC_NODE_TYPE));
12753
12754
if ("production" !== process.env.NODE_ENV) {
12755
("production" !== process.env.NODE_ENV ? warning(
12756
false,
12757
'React attempted to reuse markup in a container but the ' +
12758
'checksum was invalid. This generally means that you are ' +
12759
'using server rendering and the markup generated on the ' +
12760
'server was not what the client was expecting. React injected ' +
12761
'new markup to compensate which works but you have lost many ' +
12762
'of the benefits of server rendering. Instead, figure out ' +
12763
'why the markup being generated is different on the client ' +
12764
'or server:\n%s',
12765
difference
12766
) : null);
12767
}
12768
}
12769
}
12770
12771
("production" !== process.env.NODE_ENV ? invariant(
12772
container.nodeType !== DOC_NODE_TYPE,
12773
'You\'re trying to render a component to the document but ' +
12774
'you didn\'t use server rendering. We can\'t do this ' +
12775
'without using server rendering due to cross-browser quirks. ' +
12776
'See React.renderToString() for server rendering.'
12777
) : invariant(container.nodeType !== DOC_NODE_TYPE));
12778
12779
setInnerHTML(container, markup);
12780
},
12781
12782
/**
12783
* React ID utilities.
12784
*/
12785
12786
getReactRootID: getReactRootID,
12787
12788
getID: getID,
12789
12790
setID: setID,
12791
12792
getNode: getNode,
12793
12794
getNodeFromInstance: getNodeFromInstance,
12795
12796
purgeID: purgeID
12797
};
12798
12799
ReactPerf.measureMethods(ReactMount, 'ReactMount', {
12800
_renderNewRootComponent: '_renderNewRootComponent',
12801
_mountImageIntoNode: '_mountImageIntoNode'
12802
});
12803
12804
module.exports = ReactMount;
12805
12806
12807
}).call(this,require("FWaASH"))
12808
},{"./DOMProperty":10,"./ReactBrowserEventEmitter":31,"./ReactCurrentOwner":40,"./ReactElement":58,"./ReactElementValidator":59,"./ReactEmptyComponent":60,"./ReactInstanceHandles":67,"./ReactInstanceMap":68,"./ReactMarkupChecksum":70,"./ReactPerf":76,"./ReactReconciler":82,"./ReactUpdateQueue":87,"./ReactUpdates":88,"./containsNode":110,"./emptyObject":116,"./getReactRootElementInContainer":130,"./instantiateReactComponent":135,"./invariant":136,"./setInnerHTML":149,"./shouldUpdateReactComponent":152,"./warning":155,"FWaASH":1}],72:[function(require,module,exports){
12809
/**
12810
* Copyright 2013-2015, Facebook, Inc.
12811
* All rights reserved.
12812
*
12813
* This source code is licensed under the BSD-style license found in the
12814
* LICENSE file in the root directory of this source tree. An additional grant
12815
* of patent rights can be found in the PATENTS file in the same directory.
12816
*
12817
* @providesModule ReactMultiChild
12818
* @typechecks static-only
12819
*/
12820
12821
'use strict';
12822
12823
var ReactComponentEnvironment = require("./ReactComponentEnvironment");
12824
var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
12825
12826
var ReactReconciler = require("./ReactReconciler");
12827
var ReactChildReconciler = require("./ReactChildReconciler");
12828
12829
/**
12830
* Updating children of a component may trigger recursive updates. The depth is
12831
* used to batch recursive updates to render markup more efficiently.
12832
*
12833
* @type {number}
12834
* @private
12835
*/
12836
var updateDepth = 0;
12837
12838
/**
12839
* Queue of update configuration objects.
12840
*
12841
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
12842
*
12843
* @type {array<object>}
12844
* @private
12845
*/
12846
var updateQueue = [];
12847
12848
/**
12849
* Queue of markup to be rendered.
12850
*
12851
* @type {array<string>}
12852
* @private
12853
*/
12854
var markupQueue = [];
12855
12856
/**
12857
* Enqueues markup to be rendered and inserted at a supplied index.
12858
*
12859
* @param {string} parentID ID of the parent component.
12860
* @param {string} markup Markup that renders into an element.
12861
* @param {number} toIndex Destination index.
12862
* @private
12863
*/
12864
function enqueueMarkup(parentID, markup, toIndex) {
12865
// NOTE: Null values reduce hidden classes.
12866
updateQueue.push({
12867
parentID: parentID,
12868
parentNode: null,
12869
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
12870
markupIndex: markupQueue.push(markup) - 1,
12871
textContent: null,
12872
fromIndex: null,
12873
toIndex: toIndex
12874
});
12875
}
12876
12877
/**
12878
* Enqueues moving an existing element to another index.
12879
*
12880
* @param {string} parentID ID of the parent component.
12881
* @param {number} fromIndex Source index of the existing element.
12882
* @param {number} toIndex Destination index of the element.
12883
* @private
12884
*/
12885
function enqueueMove(parentID, fromIndex, toIndex) {
12886
// NOTE: Null values reduce hidden classes.
12887
updateQueue.push({
12888
parentID: parentID,
12889
parentNode: null,
12890
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
12891
markupIndex: null,
12892
textContent: null,
12893
fromIndex: fromIndex,
12894
toIndex: toIndex
12895
});
12896
}
12897
12898
/**
12899
* Enqueues removing an element at an index.
12900
*
12901
* @param {string} parentID ID of the parent component.
12902
* @param {number} fromIndex Index of the element to remove.
12903
* @private
12904
*/
12905
function enqueueRemove(parentID, fromIndex) {
12906
// NOTE: Null values reduce hidden classes.
12907
updateQueue.push({
12908
parentID: parentID,
12909
parentNode: null,
12910
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
12911
markupIndex: null,
12912
textContent: null,
12913
fromIndex: fromIndex,
12914
toIndex: null
12915
});
12916
}
12917
12918
/**
12919
* Enqueues setting the text content.
12920
*
12921
* @param {string} parentID ID of the parent component.
12922
* @param {string} textContent Text content to set.
12923
* @private
12924
*/
12925
function enqueueTextContent(parentID, textContent) {
12926
// NOTE: Null values reduce hidden classes.
12927
updateQueue.push({
12928
parentID: parentID,
12929
parentNode: null,
12930
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
12931
markupIndex: null,
12932
textContent: textContent,
12933
fromIndex: null,
12934
toIndex: null
12935
});
12936
}
12937
12938
/**
12939
* Processes any enqueued updates.
12940
*
12941
* @private
12942
*/
12943
function processQueue() {
12944
if (updateQueue.length) {
12945
ReactComponentEnvironment.processChildrenUpdates(
12946
updateQueue,
12947
markupQueue
12948
);
12949
clearQueue();
12950
}
12951
}
12952
12953
/**
12954
* Clears any enqueued updates.
12955
*
12956
* @private
12957
*/
12958
function clearQueue() {
12959
updateQueue.length = 0;
12960
markupQueue.length = 0;
12961
}
12962
12963
/**
12964
* ReactMultiChild are capable of reconciling multiple children.
12965
*
12966
* @class ReactMultiChild
12967
* @internal
12968
*/
12969
var ReactMultiChild = {
12970
12971
/**
12972
* Provides common functionality for components that must reconcile multiple
12973
* children. This is used by `ReactDOMComponent` to mount, update, and
12974
* unmount child components.
12975
*
12976
* @lends {ReactMultiChild.prototype}
12977
*/
12978
Mixin: {
12979
12980
/**
12981
* Generates a "mount image" for each of the supplied children. In the case
12982
* of `ReactDOMComponent`, a mount image is a string of markup.
12983
*
12984
* @param {?object} nestedChildren Nested child maps.
12985
* @return {array} An array of mounted representations.
12986
* @internal
12987
*/
12988
mountChildren: function(nestedChildren, transaction, context) {
12989
var children = ReactChildReconciler.instantiateChildren(
12990
nestedChildren, transaction, context
12991
);
12992
this._renderedChildren = children;
12993
var mountImages = [];
12994
var index = 0;
12995
for (var name in children) {
12996
if (children.hasOwnProperty(name)) {
12997
var child = children[name];
12998
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
12999
var rootID = this._rootNodeID + name;
13000
var mountImage = ReactReconciler.mountComponent(
13001
child,
13002
rootID,
13003
transaction,
13004
context
13005
);
13006
child._mountIndex = index;
13007
mountImages.push(mountImage);
13008
index++;
13009
}
13010
}
13011
return mountImages;
13012
},
13013
13014
/**
13015
* Replaces any rendered children with a text content string.
13016
*
13017
* @param {string} nextContent String of content.
13018
* @internal
13019
*/
13020
updateTextContent: function(nextContent) {
13021
updateDepth++;
13022
var errorThrown = true;
13023
try {
13024
var prevChildren = this._renderedChildren;
13025
// Remove any rendered children.
13026
ReactChildReconciler.unmountChildren(prevChildren);
13027
// TODO: The setTextContent operation should be enough
13028
for (var name in prevChildren) {
13029
if (prevChildren.hasOwnProperty(name)) {
13030
this._unmountChildByName(prevChildren[name], name);
13031
}
13032
}
13033
// Set new text content.
13034
this.setTextContent(nextContent);
13035
errorThrown = false;
13036
} finally {
13037
updateDepth--;
13038
if (!updateDepth) {
13039
if (errorThrown) {
13040
clearQueue();
13041
} else {
13042
processQueue();
13043
}
13044
}
13045
}
13046
},
13047
13048
/**
13049
* Updates the rendered children with new children.
13050
*
13051
* @param {?object} nextNestedChildren Nested child maps.
13052
* @param {ReactReconcileTransaction} transaction
13053
* @internal
13054
*/
13055
updateChildren: function(nextNestedChildren, transaction, context) {
13056
updateDepth++;
13057
var errorThrown = true;
13058
try {
13059
this._updateChildren(nextNestedChildren, transaction, context);
13060
errorThrown = false;
13061
} finally {
13062
updateDepth--;
13063
if (!updateDepth) {
13064
if (errorThrown) {
13065
clearQueue();
13066
} else {
13067
processQueue();
13068
}
13069
}
13070
13071
}
13072
},
13073
13074
/**
13075
* Improve performance by isolating this hot code path from the try/catch
13076
* block in `updateChildren`.
13077
*
13078
* @param {?object} nextNestedChildren Nested child maps.
13079
* @param {ReactReconcileTransaction} transaction
13080
* @final
13081
* @protected
13082
*/
13083
_updateChildren: function(nextNestedChildren, transaction, context) {
13084
var prevChildren = this._renderedChildren;
13085
var nextChildren = ReactChildReconciler.updateChildren(
13086
prevChildren, nextNestedChildren, transaction, context
13087
);
13088
this._renderedChildren = nextChildren;
13089
if (!nextChildren && !prevChildren) {
13090
return;
13091
}
13092
var name;
13093
// `nextIndex` will increment for each child in `nextChildren`, but
13094
// `lastIndex` will be the last index visited in `prevChildren`.
13095
var lastIndex = 0;
13096
var nextIndex = 0;
13097
for (name in nextChildren) {
13098
if (!nextChildren.hasOwnProperty(name)) {
13099
continue;
13100
}
13101
var prevChild = prevChildren && prevChildren[name];
13102
var nextChild = nextChildren[name];
13103
if (prevChild === nextChild) {
13104
this.moveChild(prevChild, nextIndex, lastIndex);
13105
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
13106
prevChild._mountIndex = nextIndex;
13107
} else {
13108
if (prevChild) {
13109
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
13110
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
13111
this._unmountChildByName(prevChild, name);
13112
}
13113
// The child must be instantiated before it's mounted.
13114
this._mountChildByNameAtIndex(
13115
nextChild, name, nextIndex, transaction, context
13116
);
13117
}
13118
nextIndex++;
13119
}
13120
// Remove children that are no longer present.
13121
for (name in prevChildren) {
13122
if (prevChildren.hasOwnProperty(name) &&
13123
!(nextChildren && nextChildren.hasOwnProperty(name))) {
13124
this._unmountChildByName(prevChildren[name], name);
13125
}
13126
}
13127
},
13128
13129
/**
13130
* Unmounts all rendered children. This should be used to clean up children
13131
* when this component is unmounted.
13132
*
13133
* @internal
13134
*/
13135
unmountChildren: function() {
13136
var renderedChildren = this._renderedChildren;
13137
ReactChildReconciler.unmountChildren(renderedChildren);
13138
this._renderedChildren = null;
13139
},
13140
13141
/**
13142
* Moves a child component to the supplied index.
13143
*
13144
* @param {ReactComponent} child Component to move.
13145
* @param {number} toIndex Destination index of the element.
13146
* @param {number} lastIndex Last index visited of the siblings of `child`.
13147
* @protected
13148
*/
13149
moveChild: function(child, toIndex, lastIndex) {
13150
// If the index of `child` is less than `lastIndex`, then it needs to
13151
// be moved. Otherwise, we do not need to move it because a child will be
13152
// inserted or moved before `child`.
13153
if (child._mountIndex < lastIndex) {
13154
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
13155
}
13156
},
13157
13158
/**
13159
* Creates a child component.
13160
*
13161
* @param {ReactComponent} child Component to create.
13162
* @param {string} mountImage Markup to insert.
13163
* @protected
13164
*/
13165
createChild: function(child, mountImage) {
13166
enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
13167
},
13168
13169
/**
13170
* Removes a child component.
13171
*
13172
* @param {ReactComponent} child Child to remove.
13173
* @protected
13174
*/
13175
removeChild: function(child) {
13176
enqueueRemove(this._rootNodeID, child._mountIndex);
13177
},
13178
13179
/**
13180
* Sets this text content string.
13181
*
13182
* @param {string} textContent Text content to set.
13183
* @protected
13184
*/
13185
setTextContent: function(textContent) {
13186
enqueueTextContent(this._rootNodeID, textContent);
13187
},
13188
13189
/**
13190
* Mounts a child with the supplied name.
13191
*
13192
* NOTE: This is part of `updateChildren` and is here for readability.
13193
*
13194
* @param {ReactComponent} child Component to mount.
13195
* @param {string} name Name of the child.
13196
* @param {number} index Index at which to insert the child.
13197
* @param {ReactReconcileTransaction} transaction
13198
* @private
13199
*/
13200
_mountChildByNameAtIndex: function(
13201
child,
13202
name,
13203
index,
13204
transaction,
13205
context) {
13206
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
13207
var rootID = this._rootNodeID + name;
13208
var mountImage = ReactReconciler.mountComponent(
13209
child,
13210
rootID,
13211
transaction,
13212
context
13213
);
13214
child._mountIndex = index;
13215
this.createChild(child, mountImage);
13216
},
13217
13218
/**
13219
* Unmounts a rendered child by name.
13220
*
13221
* NOTE: This is part of `updateChildren` and is here for readability.
13222
*
13223
* @param {ReactComponent} child Component to unmount.
13224
* @param {string} name Name of the child in `this._renderedChildren`.
13225
* @private
13226
*/
13227
_unmountChildByName: function(child, name) {
13228
this.removeChild(child);
13229
child._mountIndex = null;
13230
}
13231
13232
}
13233
13234
};
13235
13236
module.exports = ReactMultiChild;
13237
13238
13239
},{"./ReactChildReconciler":32,"./ReactComponentEnvironment":37,"./ReactMultiChildUpdateTypes":73,"./ReactReconciler":82}],73:[function(require,module,exports){
13240
/**
13241
* Copyright 2013-2015, Facebook, Inc.
13242
* All rights reserved.
13243
*
13244
* This source code is licensed under the BSD-style license found in the
13245
* LICENSE file in the root directory of this source tree. An additional grant
13246
* of patent rights can be found in the PATENTS file in the same directory.
13247
*
13248
* @providesModule ReactMultiChildUpdateTypes
13249
*/
13250
13251
'use strict';
13252
13253
var keyMirror = require("./keyMirror");
13254
13255
/**
13256
* When a component's children are updated, a series of update configuration
13257
* objects are created in order to batch and serialize the required changes.
13258
*
13259
* Enumerates all the possible types of update configurations.
13260
*
13261
* @internal
13262
*/
13263
var ReactMultiChildUpdateTypes = keyMirror({
13264
INSERT_MARKUP: null,
13265
MOVE_EXISTING: null,
13266
REMOVE_NODE: null,
13267
TEXT_CONTENT: null
13268
});
13269
13270
module.exports = ReactMultiChildUpdateTypes;
13271
13272
13273
},{"./keyMirror":141}],74:[function(require,module,exports){
13274
(function (process){
13275
/**
13276
* Copyright 2014-2015, Facebook, Inc.
13277
* All rights reserved.
13278
*
13279
* This source code is licensed under the BSD-style license found in the
13280
* LICENSE file in the root directory of this source tree. An additional grant
13281
* of patent rights can be found in the PATENTS file in the same directory.
13282
*
13283
* @providesModule ReactNativeComponent
13284
*/
13285
13286
'use strict';
13287
13288
var assign = require("./Object.assign");
13289
var invariant = require("./invariant");
13290
13291
var autoGenerateWrapperClass = null;
13292
var genericComponentClass = null;
13293
// This registry keeps track of wrapper classes around native tags
13294
var tagToComponentClass = {};
13295
var textComponentClass = null;
13296
13297
var ReactNativeComponentInjection = {
13298
// This accepts a class that receives the tag string. This is a catch all
13299
// that can render any kind of tag.
13300
injectGenericComponentClass: function(componentClass) {
13301
genericComponentClass = componentClass;
13302
},
13303
// This accepts a text component class that takes the text string to be
13304
// rendered as props.
13305
injectTextComponentClass: function(componentClass) {
13306
textComponentClass = componentClass;
13307
},
13308
// This accepts a keyed object with classes as values. Each key represents a
13309
// tag. That particular tag will use this class instead of the generic one.
13310
injectComponentClasses: function(componentClasses) {
13311
assign(tagToComponentClass, componentClasses);
13312
},
13313
// Temporary hack since we expect DOM refs to behave like composites,
13314
// for this release.
13315
injectAutoWrapper: function(wrapperFactory) {
13316
autoGenerateWrapperClass = wrapperFactory;
13317
}
13318
};
13319
13320
/**
13321
* Get a composite component wrapper class for a specific tag.
13322
*
13323
* @param {ReactElement} element The tag for which to get the class.
13324
* @return {function} The React class constructor function.
13325
*/
13326
function getComponentClassForElement(element) {
13327
if (typeof element.type === 'function') {
13328
return element.type;
13329
}
13330
var tag = element.type;
13331
var componentClass = tagToComponentClass[tag];
13332
if (componentClass == null) {
13333
tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
13334
}
13335
return componentClass;
13336
}
13337
13338
/**
13339
* Get a native internal component class for a specific tag.
13340
*
13341
* @param {ReactElement} element The element to create.
13342
* @return {function} The internal class constructor function.
13343
*/
13344
function createInternalComponent(element) {
13345
("production" !== process.env.NODE_ENV ? invariant(
13346
genericComponentClass,
13347
'There is no registered component for the tag %s',
13348
element.type
13349
) : invariant(genericComponentClass));
13350
return new genericComponentClass(element.type, element.props);
13351
}
13352
13353
/**
13354
* @param {ReactText} text
13355
* @return {ReactComponent}
13356
*/
13357
function createInstanceForText(text) {
13358
return new textComponentClass(text);
13359
}
13360
13361
/**
13362
* @param {ReactComponent} component
13363
* @return {boolean}
13364
*/
13365
function isTextComponent(component) {
13366
return component instanceof textComponentClass;
13367
}
13368
13369
var ReactNativeComponent = {
13370
getComponentClassForElement: getComponentClassForElement,
13371
createInternalComponent: createInternalComponent,
13372
createInstanceForText: createInstanceForText,
13373
isTextComponent: isTextComponent,
13374
injection: ReactNativeComponentInjection
13375
};
13376
13377
module.exports = ReactNativeComponent;
13378
13379
13380
}).call(this,require("FWaASH"))
13381
},{"./Object.assign":27,"./invariant":136,"FWaASH":1}],75:[function(require,module,exports){
13382
(function (process){
13383
/**
13384
* Copyright 2013-2015, Facebook, Inc.
13385
* All rights reserved.
13386
*
13387
* This source code is licensed under the BSD-style license found in the
13388
* LICENSE file in the root directory of this source tree. An additional grant
13389
* of patent rights can be found in the PATENTS file in the same directory.
13390
*
13391
* @providesModule ReactOwner
13392
*/
13393
13394
'use strict';
13395
13396
var invariant = require("./invariant");
13397
13398
/**
13399
* ReactOwners are capable of storing references to owned components.
13400
*
13401
* All components are capable of //being// referenced by owner components, but
13402
* only ReactOwner components are capable of //referencing// owned components.
13403
* The named reference is known as a "ref".
13404
*
13405
* Refs are available when mounted and updated during reconciliation.
13406
*
13407
* var MyComponent = React.createClass({
13408
* render: function() {
13409
* return (
13410
* <div onClick={this.handleClick}>
13411
* <CustomComponent ref="custom" />
13412
* </div>
13413
* );
13414
* },
13415
* handleClick: function() {
13416
* this.refs.custom.handleClick();
13417
* },
13418
* componentDidMount: function() {
13419
* this.refs.custom.initialize();
13420
* }
13421
* });
13422
*
13423
* Refs should rarely be used. When refs are used, they should only be done to
13424
* control data that is not handled by React's data flow.
13425
*
13426
* @class ReactOwner
13427
*/
13428
var ReactOwner = {
13429
13430
/**
13431
* @param {?object} object
13432
* @return {boolean} True if `object` is a valid owner.
13433
* @final
13434
*/
13435
isValidOwner: function(object) {
13436
return !!(
13437
(object &&
13438
typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
13439
);
13440
},
13441
13442
/**
13443
* Adds a component by ref to an owner component.
13444
*
13445
* @param {ReactComponent} component Component to reference.
13446
* @param {string} ref Name by which to refer to the component.
13447
* @param {ReactOwner} owner Component on which to record the ref.
13448
* @final
13449
* @internal
13450
*/
13451
addComponentAsRefTo: function(component, ref, owner) {
13452
("production" !== process.env.NODE_ENV ? invariant(
13453
ReactOwner.isValidOwner(owner),
13454
'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
13455
'usually means that you\'re trying to add a ref to a component that ' +
13456
'doesn\'t have an owner (that is, was not created inside of another ' +
13457
'component\'s `render` method). Try rendering this component inside of ' +
13458
'a new top-level component which will hold the ref.'
13459
) : invariant(ReactOwner.isValidOwner(owner)));
13460
owner.attachRef(ref, component);
13461
},
13462
13463
/**
13464
* Removes a component by ref from an owner component.
13465
*
13466
* @param {ReactComponent} component Component to dereference.
13467
* @param {string} ref Name of the ref to remove.
13468
* @param {ReactOwner} owner Component on which the ref is recorded.
13469
* @final
13470
* @internal
13471
*/
13472
removeComponentAsRefFrom: function(component, ref, owner) {
13473
("production" !== process.env.NODE_ENV ? invariant(
13474
ReactOwner.isValidOwner(owner),
13475
'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
13476
'usually means that you\'re trying to remove a ref to a component that ' +
13477
'doesn\'t have an owner (that is, was not created inside of another ' +
13478
'component\'s `render` method). Try rendering this component inside of ' +
13479
'a new top-level component which will hold the ref.'
13480
) : invariant(ReactOwner.isValidOwner(owner)));
13481
// Check that `component` is still the current ref because we do not want to
13482
// detach the ref if another component stole it.
13483
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
13484
owner.detachRef(ref);
13485
}
13486
}
13487
13488
};
13489
13490
module.exports = ReactOwner;
13491
13492
13493
}).call(this,require("FWaASH"))
13494
},{"./invariant":136,"FWaASH":1}],76:[function(require,module,exports){
13495
(function (process){
13496
/**
13497
* Copyright 2013-2015, Facebook, Inc.
13498
* All rights reserved.
13499
*
13500
* This source code is licensed under the BSD-style license found in the
13501
* LICENSE file in the root directory of this source tree. An additional grant
13502
* of patent rights can be found in the PATENTS file in the same directory.
13503
*
13504
* @providesModule ReactPerf
13505
* @typechecks static-only
13506
*/
13507
13508
'use strict';
13509
13510
/**
13511
* ReactPerf is a general AOP system designed to measure performance. This
13512
* module only has the hooks: see ReactDefaultPerf for the analysis tool.
13513
*/
13514
var ReactPerf = {
13515
/**
13516
* Boolean to enable/disable measurement. Set to false by default to prevent
13517
* accidental logging and perf loss.
13518
*/
13519
enableMeasure: false,
13520
13521
/**
13522
* Holds onto the measure function in use. By default, don't measure
13523
* anything, but we'll override this if we inject a measure function.
13524
*/
13525
storedMeasure: _noMeasure,
13526
13527
/**
13528
* @param {object} object
13529
* @param {string} objectName
13530
* @param {object<string>} methodNames
13531
*/
13532
measureMethods: function(object, objectName, methodNames) {
13533
if ("production" !== process.env.NODE_ENV) {
13534
for (var key in methodNames) {
13535
if (!methodNames.hasOwnProperty(key)) {
13536
continue;
13537
}
13538
object[key] = ReactPerf.measure(
13539
objectName,
13540
methodNames[key],
13541
object[key]
13542
);
13543
}
13544
}
13545
},
13546
13547
/**
13548
* Use this to wrap methods you want to measure. Zero overhead in production.
13549
*
13550
* @param {string} objName
13551
* @param {string} fnName
13552
* @param {function} func
13553
* @return {function}
13554
*/
13555
measure: function(objName, fnName, func) {
13556
if ("production" !== process.env.NODE_ENV) {
13557
var measuredFunc = null;
13558
var wrapper = function() {
13559
if (ReactPerf.enableMeasure) {
13560
if (!measuredFunc) {
13561
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
13562
}
13563
return measuredFunc.apply(this, arguments);
13564
}
13565
return func.apply(this, arguments);
13566
};
13567
wrapper.displayName = objName + '_' + fnName;
13568
return wrapper;
13569
}
13570
return func;
13571
},
13572
13573
injection: {
13574
/**
13575
* @param {function} measure
13576
*/
13577
injectMeasure: function(measure) {
13578
ReactPerf.storedMeasure = measure;
13579
}
13580
}
13581
};
13582
13583
/**
13584
* Simply passes through the measured function, without measuring it.
13585
*
13586
* @param {string} objName
13587
* @param {string} fnName
13588
* @param {function} func
13589
* @return {function}
13590
*/
13591
function _noMeasure(objName, fnName, func) {
13592
return func;
13593
}
13594
13595
module.exports = ReactPerf;
13596
13597
13598
}).call(this,require("FWaASH"))
13599
},{"FWaASH":1}],77:[function(require,module,exports){
13600
(function (process){
13601
/**
13602
* Copyright 2013-2015, Facebook, Inc.
13603
* All rights reserved.
13604
*
13605
* This source code is licensed under the BSD-style license found in the
13606
* LICENSE file in the root directory of this source tree. An additional grant
13607
* of patent rights can be found in the PATENTS file in the same directory.
13608
*
13609
* @providesModule ReactPropTypeLocationNames
13610
*/
13611
13612
'use strict';
13613
13614
var ReactPropTypeLocationNames = {};
13615
13616
if ("production" !== process.env.NODE_ENV) {
13617
ReactPropTypeLocationNames = {
13618
prop: 'prop',
13619
context: 'context',
13620
childContext: 'child context'
13621
};
13622
}
13623
13624
module.exports = ReactPropTypeLocationNames;
13625
13626
13627
}).call(this,require("FWaASH"))
13628
},{"FWaASH":1}],78:[function(require,module,exports){
13629
/**
13630
* Copyright 2013-2015, Facebook, Inc.
13631
* All rights reserved.
13632
*
13633
* This source code is licensed under the BSD-style license found in the
13634
* LICENSE file in the root directory of this source tree. An additional grant
13635
* of patent rights can be found in the PATENTS file in the same directory.
13636
*
13637
* @providesModule ReactPropTypeLocations
13638
*/
13639
13640
'use strict';
13641
13642
var keyMirror = require("./keyMirror");
13643
13644
var ReactPropTypeLocations = keyMirror({
13645
prop: null,
13646
context: null,
13647
childContext: null
13648
});
13649
13650
module.exports = ReactPropTypeLocations;
13651
13652
13653
},{"./keyMirror":141}],79:[function(require,module,exports){
13654
/**
13655
* Copyright 2013-2015, Facebook, Inc.
13656
* All rights reserved.
13657
*
13658
* This source code is licensed under the BSD-style license found in the
13659
* LICENSE file in the root directory of this source tree. An additional grant
13660
* of patent rights can be found in the PATENTS file in the same directory.
13661
*
13662
* @providesModule ReactPropTypes
13663
*/
13664
13665
'use strict';
13666
13667
var ReactElement = require("./ReactElement");
13668
var ReactFragment = require("./ReactFragment");
13669
var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
13670
13671
var emptyFunction = require("./emptyFunction");
13672
13673
/**
13674
* Collection of methods that allow declaration and validation of props that are
13675
* supplied to React components. Example usage:
13676
*
13677
* var Props = require('ReactPropTypes');
13678
* var MyArticle = React.createClass({
13679
* propTypes: {
13680
* // An optional string prop named "description".
13681
* description: Props.string,
13682
*
13683
* // A required enum prop named "category".
13684
* category: Props.oneOf(['News','Photos']).isRequired,
13685
*
13686
* // A prop named "dialog" that requires an instance of Dialog.
13687
* dialog: Props.instanceOf(Dialog).isRequired
13688
* },
13689
* render: function() { ... }
13690
* });
13691
*
13692
* A more formal specification of how these methods are used:
13693
*
13694
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
13695
* decl := ReactPropTypes.{type}(.isRequired)?
13696
*
13697
* Each and every declaration produces a function with the same signature. This
13698
* allows the creation of custom validation functions. For example:
13699
*
13700
* var MyLink = React.createClass({
13701
* propTypes: {
13702
* // An optional string or URI prop named "href".
13703
* href: function(props, propName, componentName) {
13704
* var propValue = props[propName];
13705
* if (propValue != null && typeof propValue !== 'string' &&
13706
* !(propValue instanceof URI)) {
13707
* return new Error(
13708
* 'Expected a string or an URI for ' + propName + ' in ' +
13709
* componentName
13710
* );
13711
* }
13712
* }
13713
* },
13714
* render: function() {...}
13715
* });
13716
*
13717
* @internal
13718
*/
13719
13720
var ANONYMOUS = '<<anonymous>>';
13721
13722
var elementTypeChecker = createElementTypeChecker();
13723
var nodeTypeChecker = createNodeChecker();
13724
13725
var ReactPropTypes = {
13726
array: createPrimitiveTypeChecker('array'),
13727
bool: createPrimitiveTypeChecker('boolean'),
13728
func: createPrimitiveTypeChecker('function'),
13729
number: createPrimitiveTypeChecker('number'),
13730
object: createPrimitiveTypeChecker('object'),
13731
string: createPrimitiveTypeChecker('string'),
13732
13733
any: createAnyTypeChecker(),
13734
arrayOf: createArrayOfTypeChecker,
13735
element: elementTypeChecker,
13736
instanceOf: createInstanceTypeChecker,
13737
node: nodeTypeChecker,
13738
objectOf: createObjectOfTypeChecker,
13739
oneOf: createEnumTypeChecker,
13740
oneOfType: createUnionTypeChecker,
13741
shape: createShapeTypeChecker
13742
};
13743
13744
function createChainableTypeChecker(validate) {
13745
function checkType(isRequired, props, propName, componentName, location) {
13746
componentName = componentName || ANONYMOUS;
13747
if (props[propName] == null) {
13748
var locationName = ReactPropTypeLocationNames[location];
13749
if (isRequired) {
13750
return new Error(
13751
("Required " + locationName + " `" + propName + "` was not specified in ") +
13752
("`" + componentName + "`.")
13753
);
13754
}
13755
return null;
13756
} else {
13757
return validate(props, propName, componentName, location);
13758
}
13759
}
13760
13761
var chainedCheckType = checkType.bind(null, false);
13762
chainedCheckType.isRequired = checkType.bind(null, true);
13763
13764
return chainedCheckType;
13765
}
13766
13767
function createPrimitiveTypeChecker(expectedType) {
13768
function validate(props, propName, componentName, location) {
13769
var propValue = props[propName];
13770
var propType = getPropType(propValue);
13771
if (propType !== expectedType) {
13772
var locationName = ReactPropTypeLocationNames[location];
13773
// `propValue` being instance of, say, date/regexp, pass the 'object'
13774
// check, but we can offer a more precise error message here rather than
13775
// 'of type `object`'.
13776
var preciseType = getPreciseType(propValue);
13777
13778
return new Error(
13779
("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
13780
("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
13781
);
13782
}
13783
return null;
13784
}
13785
return createChainableTypeChecker(validate);
13786
}
13787
13788
function createAnyTypeChecker() {
13789
return createChainableTypeChecker(emptyFunction.thatReturns(null));
13790
}
13791
13792
function createArrayOfTypeChecker(typeChecker) {
13793
function validate(props, propName, componentName, location) {
13794
var propValue = props[propName];
13795
if (!Array.isArray(propValue)) {
13796
var locationName = ReactPropTypeLocationNames[location];
13797
var propType = getPropType(propValue);
13798
return new Error(
13799
("Invalid " + locationName + " `" + propName + "` of type ") +
13800
("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
13801
);
13802
}
13803
for (var i = 0; i < propValue.length; i++) {
13804
var error = typeChecker(propValue, i, componentName, location);
13805
if (error instanceof Error) {
13806
return error;
13807
}
13808
}
13809
return null;
13810
}
13811
return createChainableTypeChecker(validate);
13812
}
13813
13814
function createElementTypeChecker() {
13815
function validate(props, propName, componentName, location) {
13816
if (!ReactElement.isValidElement(props[propName])) {
13817
var locationName = ReactPropTypeLocationNames[location];
13818
return new Error(
13819
("Invalid " + locationName + " `" + propName + "` supplied to ") +
13820
("`" + componentName + "`, expected a ReactElement.")
13821
);
13822
}
13823
return null;
13824
}
13825
return createChainableTypeChecker(validate);
13826
}
13827
13828
function createInstanceTypeChecker(expectedClass) {
13829
function validate(props, propName, componentName, location) {
13830
if (!(props[propName] instanceof expectedClass)) {
13831
var locationName = ReactPropTypeLocationNames[location];
13832
var expectedClassName = expectedClass.name || ANONYMOUS;
13833
return new Error(
13834
("Invalid " + locationName + " `" + propName + "` supplied to ") +
13835
("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
13836
);
13837
}
13838
return null;
13839
}
13840
return createChainableTypeChecker(validate);
13841
}
13842
13843
function createEnumTypeChecker(expectedValues) {
13844
function validate(props, propName, componentName, location) {
13845
var propValue = props[propName];
13846
for (var i = 0; i < expectedValues.length; i++) {
13847
if (propValue === expectedValues[i]) {
13848
return null;
13849
}
13850
}
13851
13852
var locationName = ReactPropTypeLocationNames[location];
13853
var valuesString = JSON.stringify(expectedValues);
13854
return new Error(
13855
("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
13856
("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
13857
);
13858
}
13859
return createChainableTypeChecker(validate);
13860
}
13861
13862
function createObjectOfTypeChecker(typeChecker) {
13863
function validate(props, propName, componentName, location) {
13864
var propValue = props[propName];
13865
var propType = getPropType(propValue);
13866
if (propType !== 'object') {
13867
var locationName = ReactPropTypeLocationNames[location];
13868
return new Error(
13869
("Invalid " + locationName + " `" + propName + "` of type ") +
13870
("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
13871
);
13872
}
13873
for (var key in propValue) {
13874
if (propValue.hasOwnProperty(key)) {
13875
var error = typeChecker(propValue, key, componentName, location);
13876
if (error instanceof Error) {
13877
return error;
13878
}
13879
}
13880
}
13881
return null;
13882
}
13883
return createChainableTypeChecker(validate);
13884
}
13885
13886
function createUnionTypeChecker(arrayOfTypeCheckers) {
13887
function validate(props, propName, componentName, location) {
13888
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
13889
var checker = arrayOfTypeCheckers[i];
13890
if (checker(props, propName, componentName, location) == null) {
13891
return null;
13892
}
13893
}
13894
13895
var locationName = ReactPropTypeLocationNames[location];
13896
return new Error(
13897
("Invalid " + locationName + " `" + propName + "` supplied to ") +
13898
("`" + componentName + "`.")
13899
);
13900
}
13901
return createChainableTypeChecker(validate);
13902
}
13903
13904
function createNodeChecker() {
13905
function validate(props, propName, componentName, location) {
13906
if (!isNode(props[propName])) {
13907
var locationName = ReactPropTypeLocationNames[location];
13908
return new Error(
13909
("Invalid " + locationName + " `" + propName + "` supplied to ") +
13910
("`" + componentName + "`, expected a ReactNode.")
13911
);
13912
}
13913
return null;
13914
}
13915
return createChainableTypeChecker(validate);
13916
}
13917
13918
function createShapeTypeChecker(shapeTypes) {
13919
function validate(props, propName, componentName, location) {
13920
var propValue = props[propName];
13921
var propType = getPropType(propValue);
13922
if (propType !== 'object') {
13923
var locationName = ReactPropTypeLocationNames[location];
13924
return new Error(
13925
("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
13926
("supplied to `" + componentName + "`, expected `object`.")
13927
);
13928
}
13929
for (var key in shapeTypes) {
13930
var checker = shapeTypes[key];
13931
if (!checker) {
13932
continue;
13933
}
13934
var error = checker(propValue, key, componentName, location);
13935
if (error) {
13936
return error;
13937
}
13938
}
13939
return null;
13940
}
13941
return createChainableTypeChecker(validate);
13942
}
13943
13944
function isNode(propValue) {
13945
switch (typeof propValue) {
13946
case 'number':
13947
case 'string':
13948
return true;
13949
case 'boolean':
13950
return !propValue;
13951
case 'object':
13952
if (Array.isArray(propValue)) {
13953
return propValue.every(isNode);
13954
}
13955
if (ReactElement.isValidElement(propValue)) {
13956
return true;
13957
}
13958
propValue = ReactFragment.extractIfFragment(propValue);
13959
for (var k in propValue) {
13960
if (!isNode(propValue[k])) {
13961
return false;
13962
}
13963
}
13964
return true;
13965
default:
13966
return false;
13967
}
13968
}
13969
13970
// Equivalent of `typeof` but with special handling for array and regexp.
13971
function getPropType(propValue) {
13972
var propType = typeof propValue;
13973
if (Array.isArray(propValue)) {
13974
return 'array';
13975
}
13976
if (propValue instanceof RegExp) {
13977
// Old webkits (at least until Android 4.0) return 'function' rather than
13978
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
13979
// passes PropTypes.object.
13980
return 'object';
13981
}
13982
return propType;
13983
}
13984
13985
// This handles more types than `getPropType`. Only used for error messages.
13986
// See `createPrimitiveTypeChecker`.
13987
function getPreciseType(propValue) {
13988
var propType = getPropType(propValue);
13989
if (propType === 'object') {
13990
if (propValue instanceof Date) {
13991
return 'date';
13992
} else if (propValue instanceof RegExp) {
13993
return 'regexp';
13994
}
13995
}
13996
return propType;
13997
}
13998
13999
module.exports = ReactPropTypes;
14000
14001
14002
},{"./ReactElement":58,"./ReactFragment":64,"./ReactPropTypeLocationNames":77,"./emptyFunction":115}],80:[function(require,module,exports){
14003
/**
14004
* Copyright 2013-2015, Facebook, Inc.
14005
* All rights reserved.
14006
*
14007
* This source code is licensed under the BSD-style license found in the
14008
* LICENSE file in the root directory of this source tree. An additional grant
14009
* of patent rights can be found in the PATENTS file in the same directory.
14010
*
14011
* @providesModule ReactPutListenerQueue
14012
*/
14013
14014
'use strict';
14015
14016
var PooledClass = require("./PooledClass");
14017
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
14018
14019
var assign = require("./Object.assign");
14020
14021
function ReactPutListenerQueue() {
14022
this.listenersToPut = [];
14023
}
14024
14025
assign(ReactPutListenerQueue.prototype, {
14026
enqueuePutListener: function(rootNodeID, propKey, propValue) {
14027
this.listenersToPut.push({
14028
rootNodeID: rootNodeID,
14029
propKey: propKey,
14030
propValue: propValue
14031
});
14032
},
14033
14034
putListeners: function() {
14035
for (var i = 0; i < this.listenersToPut.length; i++) {
14036
var listenerToPut = this.listenersToPut[i];
14037
ReactBrowserEventEmitter.putListener(
14038
listenerToPut.rootNodeID,
14039
listenerToPut.propKey,
14040
listenerToPut.propValue
14041
);
14042
}
14043
},
14044
14045
reset: function() {
14046
this.listenersToPut.length = 0;
14047
},
14048
14049
destructor: function() {
14050
this.reset();
14051
}
14052
});
14053
14054
PooledClass.addPoolingTo(ReactPutListenerQueue);
14055
14056
module.exports = ReactPutListenerQueue;
14057
14058
14059
},{"./Object.assign":27,"./PooledClass":28,"./ReactBrowserEventEmitter":31}],81:[function(require,module,exports){
14060
/**
14061
* Copyright 2013-2015, Facebook, Inc.
14062
* All rights reserved.
14063
*
14064
* This source code is licensed under the BSD-style license found in the
14065
* LICENSE file in the root directory of this source tree. An additional grant
14066
* of patent rights can be found in the PATENTS file in the same directory.
14067
*
14068
* @providesModule ReactReconcileTransaction
14069
* @typechecks static-only
14070
*/
14071
14072
'use strict';
14073
14074
var CallbackQueue = require("./CallbackQueue");
14075
var PooledClass = require("./PooledClass");
14076
var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
14077
var ReactInputSelection = require("./ReactInputSelection");
14078
var ReactPutListenerQueue = require("./ReactPutListenerQueue");
14079
var Transaction = require("./Transaction");
14080
14081
var assign = require("./Object.assign");
14082
14083
/**
14084
* Ensures that, when possible, the selection range (currently selected text
14085
* input) is not disturbed by performing the transaction.
14086
*/
14087
var SELECTION_RESTORATION = {
14088
/**
14089
* @return {Selection} Selection information.
14090
*/
14091
initialize: ReactInputSelection.getSelectionInformation,
14092
/**
14093
* @param {Selection} sel Selection information returned from `initialize`.
14094
*/
14095
close: ReactInputSelection.restoreSelection
14096
};
14097
14098
/**
14099
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
14100
* high level DOM manipulations (like temporarily removing a text input from the
14101
* DOM).
14102
*/
14103
var EVENT_SUPPRESSION = {
14104
/**
14105
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
14106
* the reconciliation.
14107
*/
14108
initialize: function() {
14109
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
14110
ReactBrowserEventEmitter.setEnabled(false);
14111
return currentlyEnabled;
14112
},
14113
14114
/**
14115
* @param {boolean} previouslyEnabled Enabled status of
14116
* `ReactBrowserEventEmitter` before the reconciliation occured. `close`
14117
* restores the previous value.
14118
*/
14119
close: function(previouslyEnabled) {
14120
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
14121
}
14122
};
14123
14124
/**
14125
* Provides a queue for collecting `componentDidMount` and
14126
* `componentDidUpdate` callbacks during the the transaction.
14127
*/
14128
var ON_DOM_READY_QUEUEING = {
14129
/**
14130
* Initializes the internal `onDOMReady` queue.
14131
*/
14132
initialize: function() {
14133
this.reactMountReady.reset();
14134
},
14135
14136
/**
14137
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
14138
*/
14139
close: function() {
14140
this.reactMountReady.notifyAll();
14141
}
14142
};
14143
14144
var PUT_LISTENER_QUEUEING = {
14145
initialize: function() {
14146
this.putListenerQueue.reset();
14147
},
14148
14149
close: function() {
14150
this.putListenerQueue.putListeners();
14151
}
14152
};
14153
14154
/**
14155
* Executed within the scope of the `Transaction` instance. Consider these as
14156
* being member methods, but with an implied ordering while being isolated from
14157
* each other.
14158
*/
14159
var TRANSACTION_WRAPPERS = [
14160
PUT_LISTENER_QUEUEING,
14161
SELECTION_RESTORATION,
14162
EVENT_SUPPRESSION,
14163
ON_DOM_READY_QUEUEING
14164
];
14165
14166
/**
14167
* Currently:
14168
* - The order that these are listed in the transaction is critical:
14169
* - Suppresses events.
14170
* - Restores selection range.
14171
*
14172
* Future:
14173
* - Restore document/overflow scroll positions that were unintentionally
14174
* modified via DOM insertions above the top viewport boundary.
14175
* - Implement/integrate with customized constraint based layout system and keep
14176
* track of which dimensions must be remeasured.
14177
*
14178
* @class ReactReconcileTransaction
14179
*/
14180
function ReactReconcileTransaction() {
14181
this.reinitializeTransaction();
14182
// Only server-side rendering really needs this option (see
14183
// `ReactServerRendering`), but server-side uses
14184
// `ReactServerRenderingTransaction` instead. This option is here so that it's
14185
// accessible and defaults to false when `ReactDOMComponent` and
14186
// `ReactTextComponent` checks it in `mountComponent`.`
14187
this.renderToStaticMarkup = false;
14188
this.reactMountReady = CallbackQueue.getPooled(null);
14189
this.putListenerQueue = ReactPutListenerQueue.getPooled();
14190
}
14191
14192
var Mixin = {
14193
/**
14194
* @see Transaction
14195
* @abstract
14196
* @final
14197
* @return {array<object>} List of operation wrap proceedures.
14198
* TODO: convert to array<TransactionWrapper>
14199
*/
14200
getTransactionWrappers: function() {
14201
return TRANSACTION_WRAPPERS;
14202
},
14203
14204
/**
14205
* @return {object} The queue to collect `onDOMReady` callbacks with.
14206
*/
14207
getReactMountReady: function() {
14208
return this.reactMountReady;
14209
},
14210
14211
getPutListenerQueue: function() {
14212
return this.putListenerQueue;
14213
},
14214
14215
/**
14216
* `PooledClass` looks for this, and will invoke this before allowing this
14217
* instance to be resused.
14218
*/
14219
destructor: function() {
14220
CallbackQueue.release(this.reactMountReady);
14221
this.reactMountReady = null;
14222
14223
ReactPutListenerQueue.release(this.putListenerQueue);
14224
this.putListenerQueue = null;
14225
}
14226
};
14227
14228
14229
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
14230
14231
PooledClass.addPoolingTo(ReactReconcileTransaction);
14232
14233
module.exports = ReactReconcileTransaction;
14234
14235
14236
},{"./CallbackQueue":6,"./Object.assign":27,"./PooledClass":28,"./ReactBrowserEventEmitter":31,"./ReactInputSelection":66,"./ReactPutListenerQueue":80,"./Transaction":104}],82:[function(require,module,exports){
14237
(function (process){
14238
/**
14239
* Copyright 2013-2015, Facebook, Inc.
14240
* All rights reserved.
14241
*
14242
* This source code is licensed under the BSD-style license found in the
14243
* LICENSE file in the root directory of this source tree. An additional grant
14244
* of patent rights can be found in the PATENTS file in the same directory.
14245
*
14246
* @providesModule ReactReconciler
14247
*/
14248
14249
'use strict';
14250
14251
var ReactRef = require("./ReactRef");
14252
var ReactElementValidator = require("./ReactElementValidator");
14253
14254
/**
14255
* Helper to call ReactRef.attachRefs with this composite component, split out
14256
* to avoid allocations in the transaction mount-ready queue.
14257
*/
14258
function attachRefs() {
14259
ReactRef.attachRefs(this, this._currentElement);
14260
}
14261
14262
var ReactReconciler = {
14263
14264
/**
14265
* Initializes the component, renders markup, and registers event listeners.
14266
*
14267
* @param {ReactComponent} internalInstance
14268
* @param {string} rootID DOM ID of the root node.
14269
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
14270
* @return {?string} Rendered markup to be inserted into the DOM.
14271
* @final
14272
* @internal
14273
*/
14274
mountComponent: function(internalInstance, rootID, transaction, context) {
14275
var markup = internalInstance.mountComponent(rootID, transaction, context);
14276
if ("production" !== process.env.NODE_ENV) {
14277
ReactElementValidator.checkAndWarnForMutatedProps(
14278
internalInstance._currentElement
14279
);
14280
}
14281
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
14282
return markup;
14283
},
14284
14285
/**
14286
* Releases any resources allocated by `mountComponent`.
14287
*
14288
* @final
14289
* @internal
14290
*/
14291
unmountComponent: function(internalInstance) {
14292
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
14293
internalInstance.unmountComponent();
14294
},
14295
14296
/**
14297
* Update a component using a new element.
14298
*
14299
* @param {ReactComponent} internalInstance
14300
* @param {ReactElement} nextElement
14301
* @param {ReactReconcileTransaction} transaction
14302
* @param {object} context
14303
* @internal
14304
*/
14305
receiveComponent: function(
14306
internalInstance, nextElement, transaction, context
14307
) {
14308
var prevElement = internalInstance._currentElement;
14309
14310
if (nextElement === prevElement && nextElement._owner != null) {
14311
// Since elements are immutable after the owner is rendered,
14312
// we can do a cheap identity compare here to determine if this is a
14313
// superfluous reconcile. It's possible for state to be mutable but such
14314
// change should trigger an update of the owner which would recreate
14315
// the element. We explicitly check for the existence of an owner since
14316
// it's possible for an element created outside a composite to be
14317
// deeply mutated and reused.
14318
return;
14319
}
14320
14321
if ("production" !== process.env.NODE_ENV) {
14322
ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
14323
}
14324
14325
var refsChanged = ReactRef.shouldUpdateRefs(
14326
prevElement,
14327
nextElement
14328
);
14329
14330
if (refsChanged) {
14331
ReactRef.detachRefs(internalInstance, prevElement);
14332
}
14333
14334
internalInstance.receiveComponent(nextElement, transaction, context);
14335
14336
if (refsChanged) {
14337
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
14338
}
14339
},
14340
14341
/**
14342
* Flush any dirty changes in a component.
14343
*
14344
* @param {ReactComponent} internalInstance
14345
* @param {ReactReconcileTransaction} transaction
14346
* @internal
14347
*/
14348
performUpdateIfNecessary: function(
14349
internalInstance,
14350
transaction
14351
) {
14352
internalInstance.performUpdateIfNecessary(transaction);
14353
}
14354
14355
};
14356
14357
module.exports = ReactReconciler;
14358
14359
14360
}).call(this,require("FWaASH"))
14361
},{"./ReactElementValidator":59,"./ReactRef":83,"FWaASH":1}],83:[function(require,module,exports){
14362
/**
14363
* Copyright 2013-2015, Facebook, Inc.
14364
* All rights reserved.
14365
*
14366
* This source code is licensed under the BSD-style license found in the
14367
* LICENSE file in the root directory of this source tree. An additional grant
14368
* of patent rights can be found in the PATENTS file in the same directory.
14369
*
14370
* @providesModule ReactRef
14371
*/
14372
14373
'use strict';
14374
14375
var ReactOwner = require("./ReactOwner");
14376
14377
var ReactRef = {};
14378
14379
function attachRef(ref, component, owner) {
14380
if (typeof ref === 'function') {
14381
ref(component.getPublicInstance());
14382
} else {
14383
// Legacy ref
14384
ReactOwner.addComponentAsRefTo(component, ref, owner);
14385
}
14386
}
14387
14388
function detachRef(ref, component, owner) {
14389
if (typeof ref === 'function') {
14390
ref(null);
14391
} else {
14392
// Legacy ref
14393
ReactOwner.removeComponentAsRefFrom(component, ref, owner);
14394
}
14395
}
14396
14397
ReactRef.attachRefs = function(instance, element) {
14398
var ref = element.ref;
14399
if (ref != null) {
14400
attachRef(ref, instance, element._owner);
14401
}
14402
};
14403
14404
ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
14405
// If either the owner or a `ref` has changed, make sure the newest owner
14406
// has stored a reference to `this`, and the previous owner (if different)
14407
// has forgotten the reference to `this`. We use the element instead
14408
// of the public this.props because the post processing cannot determine
14409
// a ref. The ref conceptually lives on the element.
14410
14411
// TODO: Should this even be possible? The owner cannot change because
14412
// it's forbidden by shouldUpdateReactComponent. The ref can change
14413
// if you swap the keys of but not the refs. Reconsider where this check
14414
// is made. It probably belongs where the key checking and
14415
// instantiateReactComponent is done.
14416
14417
return (
14418
nextElement._owner !== prevElement._owner ||
14419
nextElement.ref !== prevElement.ref
14420
);
14421
};
14422
14423
ReactRef.detachRefs = function(instance, element) {
14424
var ref = element.ref;
14425
if (ref != null) {
14426
detachRef(ref, instance, element._owner);
14427
}
14428
};
14429
14430
module.exports = ReactRef;
14431
14432
14433
},{"./ReactOwner":75}],84:[function(require,module,exports){
14434
/**
14435
* Copyright 2013-2015, Facebook, Inc.
14436
* All rights reserved.
14437
*
14438
* This source code is licensed under the BSD-style license found in the
14439
* LICENSE file in the root directory of this source tree. An additional grant
14440
* of patent rights can be found in the PATENTS file in the same directory.
14441
*
14442
* @providesModule ReactRootIndex
14443
* @typechecks
14444
*/
14445
14446
'use strict';
14447
14448
var ReactRootIndexInjection = {
14449
/**
14450
* @param {function} _createReactRootIndex
14451
*/
14452
injectCreateReactRootIndex: function(_createReactRootIndex) {
14453
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
14454
}
14455
};
14456
14457
var ReactRootIndex = {
14458
createReactRootIndex: null,
14459
injection: ReactRootIndexInjection
14460
};
14461
14462
module.exports = ReactRootIndex;
14463
14464
14465
},{}],85:[function(require,module,exports){
14466
(function (process){
14467
/**
14468
* Copyright 2013-2015, Facebook, Inc.
14469
* All rights reserved.
14470
*
14471
* This source code is licensed under the BSD-style license found in the
14472
* LICENSE file in the root directory of this source tree. An additional grant
14473
* of patent rights can be found in the PATENTS file in the same directory.
14474
*
14475
* @typechecks static-only
14476
* @providesModule ReactServerRendering
14477
*/
14478
'use strict';
14479
14480
var ReactElement = require("./ReactElement");
14481
var ReactInstanceHandles = require("./ReactInstanceHandles");
14482
var ReactMarkupChecksum = require("./ReactMarkupChecksum");
14483
var ReactServerRenderingTransaction =
14484
require("./ReactServerRenderingTransaction");
14485
14486
var emptyObject = require("./emptyObject");
14487
var instantiateReactComponent = require("./instantiateReactComponent");
14488
var invariant = require("./invariant");
14489
14490
/**
14491
* @param {ReactElement} element
14492
* @return {string} the HTML markup
14493
*/
14494
function renderToString(element) {
14495
("production" !== process.env.NODE_ENV ? invariant(
14496
ReactElement.isValidElement(element),
14497
'renderToString(): You must pass a valid ReactElement.'
14498
) : invariant(ReactElement.isValidElement(element)));
14499
14500
var transaction;
14501
try {
14502
var id = ReactInstanceHandles.createReactRootID();
14503
transaction = ReactServerRenderingTransaction.getPooled(false);
14504
14505
return transaction.perform(function() {
14506
var componentInstance = instantiateReactComponent(element, null);
14507
var markup =
14508
componentInstance.mountComponent(id, transaction, emptyObject);
14509
return ReactMarkupChecksum.addChecksumToMarkup(markup);
14510
}, null);
14511
} finally {
14512
ReactServerRenderingTransaction.release(transaction);
14513
}
14514
}
14515
14516
/**
14517
* @param {ReactElement} element
14518
* @return {string} the HTML markup, without the extra React ID and checksum
14519
* (for generating static pages)
14520
*/
14521
function renderToStaticMarkup(element) {
14522
("production" !== process.env.NODE_ENV ? invariant(
14523
ReactElement.isValidElement(element),
14524
'renderToStaticMarkup(): You must pass a valid ReactElement.'
14525
) : invariant(ReactElement.isValidElement(element)));
14526
14527
var transaction;
14528
try {
14529
var id = ReactInstanceHandles.createReactRootID();
14530
transaction = ReactServerRenderingTransaction.getPooled(true);
14531
14532
return transaction.perform(function() {
14533
var componentInstance = instantiateReactComponent(element, null);
14534
return componentInstance.mountComponent(id, transaction, emptyObject);
14535
}, null);
14536
} finally {
14537
ReactServerRenderingTransaction.release(transaction);
14538
}
14539
}
14540
14541
module.exports = {
14542
renderToString: renderToString,
14543
renderToStaticMarkup: renderToStaticMarkup
14544
};
14545
14546
14547
}).call(this,require("FWaASH"))
14548
},{"./ReactElement":58,"./ReactInstanceHandles":67,"./ReactMarkupChecksum":70,"./ReactServerRenderingTransaction":86,"./emptyObject":116,"./instantiateReactComponent":135,"./invariant":136,"FWaASH":1}],86:[function(require,module,exports){
14549
/**
14550
* Copyright 2014-2015, Facebook, Inc.
14551
* All rights reserved.
14552
*
14553
* This source code is licensed under the BSD-style license found in the
14554
* LICENSE file in the root directory of this source tree. An additional grant
14555
* of patent rights can be found in the PATENTS file in the same directory.
14556
*
14557
* @providesModule ReactServerRenderingTransaction
14558
* @typechecks
14559
*/
14560
14561
'use strict';
14562
14563
var PooledClass = require("./PooledClass");
14564
var CallbackQueue = require("./CallbackQueue");
14565
var ReactPutListenerQueue = require("./ReactPutListenerQueue");
14566
var Transaction = require("./Transaction");
14567
14568
var assign = require("./Object.assign");
14569
var emptyFunction = require("./emptyFunction");
14570
14571
/**
14572
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
14573
* during the performing of the transaction.
14574
*/
14575
var ON_DOM_READY_QUEUEING = {
14576
/**
14577
* Initializes the internal `onDOMReady` queue.
14578
*/
14579
initialize: function() {
14580
this.reactMountReady.reset();
14581
},
14582
14583
close: emptyFunction
14584
};
14585
14586
var PUT_LISTENER_QUEUEING = {
14587
initialize: function() {
14588
this.putListenerQueue.reset();
14589
},
14590
14591
close: emptyFunction
14592
};
14593
14594
/**
14595
* Executed within the scope of the `Transaction` instance. Consider these as
14596
* being member methods, but with an implied ordering while being isolated from
14597
* each other.
14598
*/
14599
var TRANSACTION_WRAPPERS = [
14600
PUT_LISTENER_QUEUEING,
14601
ON_DOM_READY_QUEUEING
14602
];
14603
14604
/**
14605
* @class ReactServerRenderingTransaction
14606
* @param {boolean} renderToStaticMarkup
14607
*/
14608
function ReactServerRenderingTransaction(renderToStaticMarkup) {
14609
this.reinitializeTransaction();
14610
this.renderToStaticMarkup = renderToStaticMarkup;
14611
this.reactMountReady = CallbackQueue.getPooled(null);
14612
this.putListenerQueue = ReactPutListenerQueue.getPooled();
14613
}
14614
14615
var Mixin = {
14616
/**
14617
* @see Transaction
14618
* @abstract
14619
* @final
14620
* @return {array} Empty list of operation wrap proceedures.
14621
*/
14622
getTransactionWrappers: function() {
14623
return TRANSACTION_WRAPPERS;
14624
},
14625
14626
/**
14627
* @return {object} The queue to collect `onDOMReady` callbacks with.
14628
*/
14629
getReactMountReady: function() {
14630
return this.reactMountReady;
14631
},
14632
14633
getPutListenerQueue: function() {
14634
return this.putListenerQueue;
14635
},
14636
14637
/**
14638
* `PooledClass` looks for this, and will invoke this before allowing this
14639
* instance to be resused.
14640
*/
14641
destructor: function() {
14642
CallbackQueue.release(this.reactMountReady);
14643
this.reactMountReady = null;
14644
14645
ReactPutListenerQueue.release(this.putListenerQueue);
14646
this.putListenerQueue = null;
14647
}
14648
};
14649
14650
14651
assign(
14652
ReactServerRenderingTransaction.prototype,
14653
Transaction.Mixin,
14654
Mixin
14655
);
14656
14657
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
14658
14659
module.exports = ReactServerRenderingTransaction;
14660
14661
14662
},{"./CallbackQueue":6,"./Object.assign":27,"./PooledClass":28,"./ReactPutListenerQueue":80,"./Transaction":104,"./emptyFunction":115}],87:[function(require,module,exports){
14663
(function (process){
14664
/**
14665
* Copyright 2015, Facebook, Inc.
14666
* All rights reserved.
14667
*
14668
* This source code is licensed under the BSD-style license found in the
14669
* LICENSE file in the root directory of this source tree. An additional grant
14670
* of patent rights can be found in the PATENTS file in the same directory.
14671
*
14672
* @providesModule ReactUpdateQueue
14673
*/
14674
14675
'use strict';
14676
14677
var ReactLifeCycle = require("./ReactLifeCycle");
14678
var ReactCurrentOwner = require("./ReactCurrentOwner");
14679
var ReactElement = require("./ReactElement");
14680
var ReactInstanceMap = require("./ReactInstanceMap");
14681
var ReactUpdates = require("./ReactUpdates");
14682
14683
var assign = require("./Object.assign");
14684
var invariant = require("./invariant");
14685
var warning = require("./warning");
14686
14687
function enqueueUpdate(internalInstance) {
14688
if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
14689
// If we're in a componentWillMount handler, don't enqueue a rerender
14690
// because ReactUpdates assumes we're in a browser context (which is
14691
// wrong for server rendering) and we're about to do a render anyway.
14692
// See bug in #1740.
14693
ReactUpdates.enqueueUpdate(internalInstance);
14694
}
14695
}
14696
14697
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
14698
("production" !== process.env.NODE_ENV ? invariant(
14699
ReactCurrentOwner.current == null,
14700
'%s(...): Cannot update during an existing state transition ' +
14701
'(such as within `render`). Render methods should be a pure function ' +
14702
'of props and state.',
14703
callerName
14704
) : invariant(ReactCurrentOwner.current == null));
14705
14706
var internalInstance = ReactInstanceMap.get(publicInstance);
14707
if (!internalInstance) {
14708
if ("production" !== process.env.NODE_ENV) {
14709
// Only warn when we have a callerName. Otherwise we should be silent.
14710
// We're probably calling from enqueueCallback. We don't want to warn
14711
// there because we already warned for the corresponding lifecycle method.
14712
("production" !== process.env.NODE_ENV ? warning(
14713
!callerName,
14714
'%s(...): Can only update a mounted or mounting component. ' +
14715
'This usually means you called %s() on an unmounted ' +
14716
'component. This is a no-op.',
14717
callerName,
14718
callerName
14719
) : null);
14720
}
14721
return null;
14722
}
14723
14724
if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
14725
return null;
14726
}
14727
14728
return internalInstance;
14729
}
14730
14731
/**
14732
* ReactUpdateQueue allows for state updates to be scheduled into a later
14733
* reconciliation step.
14734
*/
14735
var ReactUpdateQueue = {
14736
14737
/**
14738
* Enqueue a callback that will be executed after all the pending updates
14739
* have processed.
14740
*
14741
* @param {ReactClass} publicInstance The instance to use as `this` context.
14742
* @param {?function} callback Called after state is updated.
14743
* @internal
14744
*/
14745
enqueueCallback: function(publicInstance, callback) {
14746
("production" !== process.env.NODE_ENV ? invariant(
14747
typeof callback === 'function',
14748
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
14749
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
14750
'isn\'t callable.'
14751
) : invariant(typeof callback === 'function'));
14752
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
14753
14754
// Previously we would throw an error if we didn't have an internal
14755
// instance. Since we want to make it a no-op instead, we mirror the same
14756
// behavior we have in other enqueue* methods.
14757
// We also need to ignore callbacks in componentWillMount. See
14758
// enqueueUpdates.
14759
if (!internalInstance ||
14760
internalInstance === ReactLifeCycle.currentlyMountingInstance) {
14761
return null;
14762
}
14763
14764
if (internalInstance._pendingCallbacks) {
14765
internalInstance._pendingCallbacks.push(callback);
14766
} else {
14767
internalInstance._pendingCallbacks = [callback];
14768
}
14769
// TODO: The callback here is ignored when setState is called from
14770
// componentWillMount. Either fix it or disallow doing so completely in
14771
// favor of getInitialState. Alternatively, we can disallow
14772
// componentWillMount during server-side rendering.
14773
enqueueUpdate(internalInstance);
14774
},
14775
14776
enqueueCallbackInternal: function(internalInstance, callback) {
14777
("production" !== process.env.NODE_ENV ? invariant(
14778
typeof callback === 'function',
14779
'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
14780
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
14781
'isn\'t callable.'
14782
) : invariant(typeof callback === 'function'));
14783
if (internalInstance._pendingCallbacks) {
14784
internalInstance._pendingCallbacks.push(callback);
14785
} else {
14786
internalInstance._pendingCallbacks = [callback];
14787
}
14788
enqueueUpdate(internalInstance);
14789
},
14790
14791
/**
14792
* Forces an update. This should only be invoked when it is known with
14793
* certainty that we are **not** in a DOM transaction.
14794
*
14795
* You may want to call this when you know that some deeper aspect of the
14796
* component's state has changed but `setState` was not called.
14797
*
14798
* This will not invoke `shouldUpdateComponent`, but it will invoke
14799
* `componentWillUpdate` and `componentDidUpdate`.
14800
*
14801
* @param {ReactClass} publicInstance The instance that should rerender.
14802
* @internal
14803
*/
14804
enqueueForceUpdate: function(publicInstance) {
14805
var internalInstance = getInternalInstanceReadyForUpdate(
14806
publicInstance,
14807
'forceUpdate'
14808
);
14809
14810
if (!internalInstance) {
14811
return;
14812
}
14813
14814
internalInstance._pendingForceUpdate = true;
14815
14816
enqueueUpdate(internalInstance);
14817
},
14818
14819
/**
14820
* Replaces all of the state. Always use this or `setState` to mutate state.
14821
* You should treat `this.state` as immutable.
14822
*
14823
* There is no guarantee that `this.state` will be immediately updated, so
14824
* accessing `this.state` after calling this method may return the old value.
14825
*
14826
* @param {ReactClass} publicInstance The instance that should rerender.
14827
* @param {object} completeState Next state.
14828
* @internal
14829
*/
14830
enqueueReplaceState: function(publicInstance, completeState) {
14831
var internalInstance = getInternalInstanceReadyForUpdate(
14832
publicInstance,
14833
'replaceState'
14834
);
14835
14836
if (!internalInstance) {
14837
return;
14838
}
14839
14840
internalInstance._pendingStateQueue = [completeState];
14841
internalInstance._pendingReplaceState = true;
14842
14843
enqueueUpdate(internalInstance);
14844
},
14845
14846
/**
14847
* Sets a subset of the state. This only exists because _pendingState is
14848
* internal. This provides a merging strategy that is not available to deep
14849
* properties which is confusing. TODO: Expose pendingState or don't use it
14850
* during the merge.
14851
*
14852
* @param {ReactClass} publicInstance The instance that should rerender.
14853
* @param {object} partialState Next partial state to be merged with state.
14854
* @internal
14855
*/
14856
enqueueSetState: function(publicInstance, partialState) {
14857
var internalInstance = getInternalInstanceReadyForUpdate(
14858
publicInstance,
14859
'setState'
14860
);
14861
14862
if (!internalInstance) {
14863
return;
14864
}
14865
14866
var queue =
14867
internalInstance._pendingStateQueue ||
14868
(internalInstance._pendingStateQueue = []);
14869
queue.push(partialState);
14870
14871
enqueueUpdate(internalInstance);
14872
},
14873
14874
/**
14875
* Sets a subset of the props.
14876
*
14877
* @param {ReactClass} publicInstance The instance that should rerender.
14878
* @param {object} partialProps Subset of the next props.
14879
* @internal
14880
*/
14881
enqueueSetProps: function(publicInstance, partialProps) {
14882
var internalInstance = getInternalInstanceReadyForUpdate(
14883
publicInstance,
14884
'setProps'
14885
);
14886
14887
if (!internalInstance) {
14888
return;
14889
}
14890
14891
("production" !== process.env.NODE_ENV ? invariant(
14892
internalInstance._isTopLevel,
14893
'setProps(...): You called `setProps` on a ' +
14894
'component with a parent. This is an anti-pattern since props will ' +
14895
'get reactively updated when rendered. Instead, change the owner\'s ' +
14896
'`render` method to pass the correct value as props to the component ' +
14897
'where it is created.'
14898
) : invariant(internalInstance._isTopLevel));
14899
14900
// Merge with the pending element if it exists, otherwise with existing
14901
// element props.
14902
var element = internalInstance._pendingElement ||
14903
internalInstance._currentElement;
14904
var props = assign({}, element.props, partialProps);
14905
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
14906
element,
14907
props
14908
);
14909
14910
enqueueUpdate(internalInstance);
14911
},
14912
14913
/**
14914
* Replaces all of the props.
14915
*
14916
* @param {ReactClass} publicInstance The instance that should rerender.
14917
* @param {object} props New props.
14918
* @internal
14919
*/
14920
enqueueReplaceProps: function(publicInstance, props) {
14921
var internalInstance = getInternalInstanceReadyForUpdate(
14922
publicInstance,
14923
'replaceProps'
14924
);
14925
14926
if (!internalInstance) {
14927
return;
14928
}
14929
14930
("production" !== process.env.NODE_ENV ? invariant(
14931
internalInstance._isTopLevel,
14932
'replaceProps(...): You called `replaceProps` on a ' +
14933
'component with a parent. This is an anti-pattern since props will ' +
14934
'get reactively updated when rendered. Instead, change the owner\'s ' +
14935
'`render` method to pass the correct value as props to the component ' +
14936
'where it is created.'
14937
) : invariant(internalInstance._isTopLevel));
14938
14939
// Merge with the pending element if it exists, otherwise with existing
14940
// element props.
14941
var element = internalInstance._pendingElement ||
14942
internalInstance._currentElement;
14943
internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
14944
element,
14945
props
14946
);
14947
14948
enqueueUpdate(internalInstance);
14949
},
14950
14951
enqueueElementInternal: function(internalInstance, newElement) {
14952
internalInstance._pendingElement = newElement;
14953
enqueueUpdate(internalInstance);
14954
}
14955
14956
};
14957
14958
module.exports = ReactUpdateQueue;
14959
14960
14961
}).call(this,require("FWaASH"))
14962
},{"./Object.assign":27,"./ReactCurrentOwner":40,"./ReactElement":58,"./ReactInstanceMap":68,"./ReactLifeCycle":69,"./ReactUpdates":88,"./invariant":136,"./warning":155,"FWaASH":1}],88:[function(require,module,exports){
14963
(function (process){
14964
/**
14965
* Copyright 2013-2015, Facebook, Inc.
14966
* All rights reserved.
14967
*
14968
* This source code is licensed under the BSD-style license found in the
14969
* LICENSE file in the root directory of this source tree. An additional grant
14970
* of patent rights can be found in the PATENTS file in the same directory.
14971
*
14972
* @providesModule ReactUpdates
14973
*/
14974
14975
'use strict';
14976
14977
var CallbackQueue = require("./CallbackQueue");
14978
var PooledClass = require("./PooledClass");
14979
var ReactCurrentOwner = require("./ReactCurrentOwner");
14980
var ReactPerf = require("./ReactPerf");
14981
var ReactReconciler = require("./ReactReconciler");
14982
var Transaction = require("./Transaction");
14983
14984
var assign = require("./Object.assign");
14985
var invariant = require("./invariant");
14986
var warning = require("./warning");
14987
14988
var dirtyComponents = [];
14989
var asapCallbackQueue = CallbackQueue.getPooled();
14990
var asapEnqueued = false;
14991
14992
var batchingStrategy = null;
14993
14994
function ensureInjected() {
14995
("production" !== process.env.NODE_ENV ? invariant(
14996
ReactUpdates.ReactReconcileTransaction && batchingStrategy,
14997
'ReactUpdates: must inject a reconcile transaction class and batching ' +
14998
'strategy'
14999
) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
15000
}
15001
15002
var NESTED_UPDATES = {
15003
initialize: function() {
15004
this.dirtyComponentsLength = dirtyComponents.length;
15005
},
15006
close: function() {
15007
if (this.dirtyComponentsLength !== dirtyComponents.length) {
15008
// Additional updates were enqueued by componentDidUpdate handlers or
15009
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
15010
// these new updates so that if A's componentDidUpdate calls setState on
15011
// B, B will update before the callback A's updater provided when calling
15012
// setState.
15013
dirtyComponents.splice(0, this.dirtyComponentsLength);
15014
flushBatchedUpdates();
15015
} else {
15016
dirtyComponents.length = 0;
15017
}
15018
}
15019
};
15020
15021
var UPDATE_QUEUEING = {
15022
initialize: function() {
15023
this.callbackQueue.reset();
15024
},
15025
close: function() {
15026
this.callbackQueue.notifyAll();
15027
}
15028
};
15029
15030
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
15031
15032
function ReactUpdatesFlushTransaction() {
15033
this.reinitializeTransaction();
15034
this.dirtyComponentsLength = null;
15035
this.callbackQueue = CallbackQueue.getPooled();
15036
this.reconcileTransaction =
15037
ReactUpdates.ReactReconcileTransaction.getPooled();
15038
}
15039
15040
assign(
15041
ReactUpdatesFlushTransaction.prototype,
15042
Transaction.Mixin, {
15043
getTransactionWrappers: function() {
15044
return TRANSACTION_WRAPPERS;
15045
},
15046
15047
destructor: function() {
15048
this.dirtyComponentsLength = null;
15049
CallbackQueue.release(this.callbackQueue);
15050
this.callbackQueue = null;
15051
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
15052
this.reconcileTransaction = null;
15053
},
15054
15055
perform: function(method, scope, a) {
15056
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
15057
// with this transaction's wrappers around it.
15058
return Transaction.Mixin.perform.call(
15059
this,
15060
this.reconcileTransaction.perform,
15061
this.reconcileTransaction,
15062
method,
15063
scope,
15064
a
15065
);
15066
}
15067
});
15068
15069
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
15070
15071
function batchedUpdates(callback, a, b, c, d) {
15072
ensureInjected();
15073
batchingStrategy.batchedUpdates(callback, a, b, c, d);
15074
}
15075
15076
/**
15077
* Array comparator for ReactComponents by mount ordering.
15078
*
15079
* @param {ReactComponent} c1 first component you're comparing
15080
* @param {ReactComponent} c2 second component you're comparing
15081
* @return {number} Return value usable by Array.prototype.sort().
15082
*/
15083
function mountOrderComparator(c1, c2) {
15084
return c1._mountOrder - c2._mountOrder;
15085
}
15086
15087
function runBatchedUpdates(transaction) {
15088
var len = transaction.dirtyComponentsLength;
15089
("production" !== process.env.NODE_ENV ? invariant(
15090
len === dirtyComponents.length,
15091
'Expected flush transaction\'s stored dirty-components length (%s) to ' +
15092
'match dirty-components array length (%s).',
15093
len,
15094
dirtyComponents.length
15095
) : invariant(len === dirtyComponents.length));
15096
15097
// Since reconciling a component higher in the owner hierarchy usually (not
15098
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
15099
// them before their children by sorting the array.
15100
dirtyComponents.sort(mountOrderComparator);
15101
15102
for (var i = 0; i < len; i++) {
15103
// If a component is unmounted before pending changes apply, it will still
15104
// be here, but we assume that it has cleared its _pendingCallbacks and
15105
// that performUpdateIfNecessary is a noop.
15106
var component = dirtyComponents[i];
15107
15108
// If performUpdateIfNecessary happens to enqueue any new updates, we
15109
// shouldn't execute the callbacks until the next render happens, so
15110
// stash the callbacks first
15111
var callbacks = component._pendingCallbacks;
15112
component._pendingCallbacks = null;
15113
15114
ReactReconciler.performUpdateIfNecessary(
15115
component,
15116
transaction.reconcileTransaction
15117
);
15118
15119
if (callbacks) {
15120
for (var j = 0; j < callbacks.length; j++) {
15121
transaction.callbackQueue.enqueue(
15122
callbacks[j],
15123
component.getPublicInstance()
15124
);
15125
}
15126
}
15127
}
15128
}
15129
15130
var flushBatchedUpdates = function() {
15131
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
15132
// array and perform any updates enqueued by mount-ready handlers (i.e.,
15133
// componentDidUpdate) but we need to check here too in order to catch
15134
// updates enqueued by setState callbacks and asap calls.
15135
while (dirtyComponents.length || asapEnqueued) {
15136
if (dirtyComponents.length) {
15137
var transaction = ReactUpdatesFlushTransaction.getPooled();
15138
transaction.perform(runBatchedUpdates, null, transaction);
15139
ReactUpdatesFlushTransaction.release(transaction);
15140
}
15141
15142
if (asapEnqueued) {
15143
asapEnqueued = false;
15144
var queue = asapCallbackQueue;
15145
asapCallbackQueue = CallbackQueue.getPooled();
15146
queue.notifyAll();
15147
CallbackQueue.release(queue);
15148
}
15149
}
15150
};
15151
flushBatchedUpdates = ReactPerf.measure(
15152
'ReactUpdates',
15153
'flushBatchedUpdates',
15154
flushBatchedUpdates
15155
);
15156
15157
/**
15158
* Mark a component as needing a rerender, adding an optional callback to a
15159
* list of functions which will be executed once the rerender occurs.
15160
*/
15161
function enqueueUpdate(component) {
15162
ensureInjected();
15163
15164
// Various parts of our code (such as ReactCompositeComponent's
15165
// _renderValidatedComponent) assume that calls to render aren't nested;
15166
// verify that that's the case. (This is called by each top-level update
15167
// function, like setProps, setState, forceUpdate, etc.; creation and
15168
// destruction of top-level components is guarded in ReactMount.)
15169
("production" !== process.env.NODE_ENV ? warning(
15170
ReactCurrentOwner.current == null,
15171
'enqueueUpdate(): Render methods should be a pure function of props ' +
15172
'and state; triggering nested component updates from render is not ' +
15173
'allowed. If necessary, trigger nested updates in ' +
15174
'componentDidUpdate.'
15175
) : null);
15176
15177
if (!batchingStrategy.isBatchingUpdates) {
15178
batchingStrategy.batchedUpdates(enqueueUpdate, component);
15179
return;
15180
}
15181
15182
dirtyComponents.push(component);
15183
}
15184
15185
/**
15186
* Enqueue a callback to be run at the end of the current batching cycle. Throws
15187
* if no updates are currently being performed.
15188
*/
15189
function asap(callback, context) {
15190
("production" !== process.env.NODE_ENV ? invariant(
15191
batchingStrategy.isBatchingUpdates,
15192
'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
15193
'updates are not being batched.'
15194
) : invariant(batchingStrategy.isBatchingUpdates));
15195
asapCallbackQueue.enqueue(callback, context);
15196
asapEnqueued = true;
15197
}
15198
15199
var ReactUpdatesInjection = {
15200
injectReconcileTransaction: function(ReconcileTransaction) {
15201
("production" !== process.env.NODE_ENV ? invariant(
15202
ReconcileTransaction,
15203
'ReactUpdates: must provide a reconcile transaction class'
15204
) : invariant(ReconcileTransaction));
15205
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
15206
},
15207
15208
injectBatchingStrategy: function(_batchingStrategy) {
15209
("production" !== process.env.NODE_ENV ? invariant(
15210
_batchingStrategy,
15211
'ReactUpdates: must provide a batching strategy'
15212
) : invariant(_batchingStrategy));
15213
("production" !== process.env.NODE_ENV ? invariant(
15214
typeof _batchingStrategy.batchedUpdates === 'function',
15215
'ReactUpdates: must provide a batchedUpdates() function'
15216
) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
15217
("production" !== process.env.NODE_ENV ? invariant(
15218
typeof _batchingStrategy.isBatchingUpdates === 'boolean',
15219
'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
15220
) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
15221
batchingStrategy = _batchingStrategy;
15222
}
15223
};
15224
15225
var ReactUpdates = {
15226
/**
15227
* React references `ReactReconcileTransaction` using this property in order
15228
* to allow dependency injection.
15229
*
15230
* @internal
15231
*/
15232
ReactReconcileTransaction: null,
15233
15234
batchedUpdates: batchedUpdates,
15235
enqueueUpdate: enqueueUpdate,
15236
flushBatchedUpdates: flushBatchedUpdates,
15237
injection: ReactUpdatesInjection,
15238
asap: asap
15239
};
15240
15241
module.exports = ReactUpdates;
15242
15243
15244
}).call(this,require("FWaASH"))
15245
},{"./CallbackQueue":6,"./Object.assign":27,"./PooledClass":28,"./ReactCurrentOwner":40,"./ReactPerf":76,"./ReactReconciler":82,"./Transaction":104,"./invariant":136,"./warning":155,"FWaASH":1}],89:[function(require,module,exports){
15246
/**
15247
* Copyright 2013-2015, Facebook, Inc.
15248
* All rights reserved.
15249
*
15250
* This source code is licensed under the BSD-style license found in the
15251
* LICENSE file in the root directory of this source tree. An additional grant
15252
* of patent rights can be found in the PATENTS file in the same directory.
15253
*
15254
* @providesModule SVGDOMPropertyConfig
15255
*/
15256
15257
/*jslint bitwise: true*/
15258
15259
'use strict';
15260
15261
var DOMProperty = require("./DOMProperty");
15262
15263
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
15264
15265
var SVGDOMPropertyConfig = {
15266
Properties: {
15267
cx: MUST_USE_ATTRIBUTE,
15268
cy: MUST_USE_ATTRIBUTE,
15269
d: MUST_USE_ATTRIBUTE,
15270
dx: MUST_USE_ATTRIBUTE,
15271
dy: MUST_USE_ATTRIBUTE,
15272
fill: MUST_USE_ATTRIBUTE,
15273
fillOpacity: MUST_USE_ATTRIBUTE,
15274
fontFamily: MUST_USE_ATTRIBUTE,
15275
fontSize: MUST_USE_ATTRIBUTE,
15276
fx: MUST_USE_ATTRIBUTE,
15277
fy: MUST_USE_ATTRIBUTE,
15278
gradientTransform: MUST_USE_ATTRIBUTE,
15279
gradientUnits: MUST_USE_ATTRIBUTE,
15280
markerEnd: MUST_USE_ATTRIBUTE,
15281
markerMid: MUST_USE_ATTRIBUTE,
15282
markerStart: MUST_USE_ATTRIBUTE,
15283
offset: MUST_USE_ATTRIBUTE,
15284
opacity: MUST_USE_ATTRIBUTE,
15285
patternContentUnits: MUST_USE_ATTRIBUTE,
15286
patternUnits: MUST_USE_ATTRIBUTE,
15287
points: MUST_USE_ATTRIBUTE,
15288
preserveAspectRatio: MUST_USE_ATTRIBUTE,
15289
r: MUST_USE_ATTRIBUTE,
15290
rx: MUST_USE_ATTRIBUTE,
15291
ry: MUST_USE_ATTRIBUTE,
15292
spreadMethod: MUST_USE_ATTRIBUTE,
15293
stopColor: MUST_USE_ATTRIBUTE,
15294
stopOpacity: MUST_USE_ATTRIBUTE,
15295
stroke: MUST_USE_ATTRIBUTE,
15296
strokeDasharray: MUST_USE_ATTRIBUTE,
15297
strokeLinecap: MUST_USE_ATTRIBUTE,
15298
strokeOpacity: MUST_USE_ATTRIBUTE,
15299
strokeWidth: MUST_USE_ATTRIBUTE,
15300
textAnchor: MUST_USE_ATTRIBUTE,
15301
transform: MUST_USE_ATTRIBUTE,
15302
version: MUST_USE_ATTRIBUTE,
15303
viewBox: MUST_USE_ATTRIBUTE,
15304
x1: MUST_USE_ATTRIBUTE,
15305
x2: MUST_USE_ATTRIBUTE,
15306
x: MUST_USE_ATTRIBUTE,
15307
y1: MUST_USE_ATTRIBUTE,
15308
y2: MUST_USE_ATTRIBUTE,
15309
y: MUST_USE_ATTRIBUTE
15310
},
15311
DOMAttributeNames: {
15312
fillOpacity: 'fill-opacity',
15313
fontFamily: 'font-family',
15314
fontSize: 'font-size',
15315
gradientTransform: 'gradientTransform',
15316
gradientUnits: 'gradientUnits',
15317
markerEnd: 'marker-end',
15318
markerMid: 'marker-mid',
15319
markerStart: 'marker-start',
15320
patternContentUnits: 'patternContentUnits',
15321
patternUnits: 'patternUnits',
15322
preserveAspectRatio: 'preserveAspectRatio',
15323
spreadMethod: 'spreadMethod',
15324
stopColor: 'stop-color',
15325
stopOpacity: 'stop-opacity',
15326
strokeDasharray: 'stroke-dasharray',
15327
strokeLinecap: 'stroke-linecap',
15328
strokeOpacity: 'stroke-opacity',
15329
strokeWidth: 'stroke-width',
15330
textAnchor: 'text-anchor',
15331
viewBox: 'viewBox'
15332
}
15333
};
15334
15335
module.exports = SVGDOMPropertyConfig;
15336
15337
15338
},{"./DOMProperty":10}],90:[function(require,module,exports){
15339
/**
15340
* Copyright 2013-2015, Facebook, Inc.
15341
* All rights reserved.
15342
*
15343
* This source code is licensed under the BSD-style license found in the
15344
* LICENSE file in the root directory of this source tree. An additional grant
15345
* of patent rights can be found in the PATENTS file in the same directory.
15346
*
15347
* @providesModule SelectEventPlugin
15348
*/
15349
15350
'use strict';
15351
15352
var EventConstants = require("./EventConstants");
15353
var EventPropagators = require("./EventPropagators");
15354
var ReactInputSelection = require("./ReactInputSelection");
15355
var SyntheticEvent = require("./SyntheticEvent");
15356
15357
var getActiveElement = require("./getActiveElement");
15358
var isTextInputElement = require("./isTextInputElement");
15359
var keyOf = require("./keyOf");
15360
var shallowEqual = require("./shallowEqual");
15361
15362
var topLevelTypes = EventConstants.topLevelTypes;
15363
15364
var eventTypes = {
15365
select: {
15366
phasedRegistrationNames: {
15367
bubbled: keyOf({onSelect: null}),
15368
captured: keyOf({onSelectCapture: null})
15369
},
15370
dependencies: [
15371
topLevelTypes.topBlur,
15372
topLevelTypes.topContextMenu,
15373
topLevelTypes.topFocus,
15374
topLevelTypes.topKeyDown,
15375
topLevelTypes.topMouseDown,
15376
topLevelTypes.topMouseUp,
15377
topLevelTypes.topSelectionChange
15378
]
15379
}
15380
};
15381
15382
var activeElement = null;
15383
var activeElementID = null;
15384
var lastSelection = null;
15385
var mouseDown = false;
15386
15387
/**
15388
* Get an object which is a unique representation of the current selection.
15389
*
15390
* The return value will not be consistent across nodes or browsers, but
15391
* two identical selections on the same node will return identical objects.
15392
*
15393
* @param {DOMElement} node
15394
* @param {object}
15395
*/
15396
function getSelection(node) {
15397
if ('selectionStart' in node &&
15398
ReactInputSelection.hasSelectionCapabilities(node)) {
15399
return {
15400
start: node.selectionStart,
15401
end: node.selectionEnd
15402
};
15403
} else if (window.getSelection) {
15404
var selection = window.getSelection();
15405
return {
15406
anchorNode: selection.anchorNode,
15407
anchorOffset: selection.anchorOffset,
15408
focusNode: selection.focusNode,
15409
focusOffset: selection.focusOffset
15410
};
15411
} else if (document.selection) {
15412
var range = document.selection.createRange();
15413
return {
15414
parentElement: range.parentElement(),
15415
text: range.text,
15416
top: range.boundingTop,
15417
left: range.boundingLeft
15418
};
15419
}
15420
}
15421
15422
/**
15423
* Poll selection to see whether it's changed.
15424
*
15425
* @param {object} nativeEvent
15426
* @return {?SyntheticEvent}
15427
*/
15428
function constructSelectEvent(nativeEvent) {
15429
// Ensure we have the right element, and that the user is not dragging a
15430
// selection (this matches native `select` event behavior). In HTML5, select
15431
// fires only on input and textarea thus if there's no focused element we
15432
// won't dispatch.
15433
if (mouseDown ||
15434
activeElement == null ||
15435
activeElement !== getActiveElement()) {
15436
return null;
15437
}
15438
15439
// Only fire when selection has actually changed.
15440
var currentSelection = getSelection(activeElement);
15441
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
15442
lastSelection = currentSelection;
15443
15444
var syntheticEvent = SyntheticEvent.getPooled(
15445
eventTypes.select,
15446
activeElementID,
15447
nativeEvent
15448
);
15449
15450
syntheticEvent.type = 'select';
15451
syntheticEvent.target = activeElement;
15452
15453
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
15454
15455
return syntheticEvent;
15456
}
15457
}
15458
15459
/**
15460
* This plugin creates an `onSelect` event that normalizes select events
15461
* across form elements.
15462
*
15463
* Supported elements are:
15464
* - input (see `isTextInputElement`)
15465
* - textarea
15466
* - contentEditable
15467
*
15468
* This differs from native browser implementations in the following ways:
15469
* - Fires on contentEditable fields as well as inputs.
15470
* - Fires for collapsed selection.
15471
* - Fires after user input.
15472
*/
15473
var SelectEventPlugin = {
15474
15475
eventTypes: eventTypes,
15476
15477
/**
15478
* @param {string} topLevelType Record from `EventConstants`.
15479
* @param {DOMEventTarget} topLevelTarget The listening component root node.
15480
* @param {string} topLevelTargetID ID of `topLevelTarget`.
15481
* @param {object} nativeEvent Native browser event.
15482
* @return {*} An accumulation of synthetic events.
15483
* @see {EventPluginHub.extractEvents}
15484
*/
15485
extractEvents: function(
15486
topLevelType,
15487
topLevelTarget,
15488
topLevelTargetID,
15489
nativeEvent) {
15490
15491
switch (topLevelType) {
15492
// Track the input node that has focus.
15493
case topLevelTypes.topFocus:
15494
if (isTextInputElement(topLevelTarget) ||
15495
topLevelTarget.contentEditable === 'true') {
15496
activeElement = topLevelTarget;
15497
activeElementID = topLevelTargetID;
15498
lastSelection = null;
15499
}
15500
break;
15501
case topLevelTypes.topBlur:
15502
activeElement = null;
15503
activeElementID = null;
15504
lastSelection = null;
15505
break;
15506
15507
// Don't fire the event while the user is dragging. This matches the
15508
// semantics of the native select event.
15509
case topLevelTypes.topMouseDown:
15510
mouseDown = true;
15511
break;
15512
case topLevelTypes.topContextMenu:
15513
case topLevelTypes.topMouseUp:
15514
mouseDown = false;
15515
return constructSelectEvent(nativeEvent);
15516
15517
// Chrome and IE fire non-standard event when selection is changed (and
15518
// sometimes when it hasn't).
15519
// Firefox doesn't support selectionchange, so check selection status
15520
// after each key entry. The selection changes after keydown and before
15521
// keyup, but we check on keydown as well in the case of holding down a
15522
// key, when multiple keydown events are fired but only one keyup is.
15523
case topLevelTypes.topSelectionChange:
15524
case topLevelTypes.topKeyDown:
15525
case topLevelTypes.topKeyUp:
15526
return constructSelectEvent(nativeEvent);
15527
}
15528
}
15529
};
15530
15531
module.exports = SelectEventPlugin;
15532
15533
15534
},{"./EventConstants":15,"./EventPropagators":20,"./ReactInputSelection":66,"./SyntheticEvent":96,"./getActiveElement":122,"./isTextInputElement":139,"./keyOf":142,"./shallowEqual":151}],91:[function(require,module,exports){
15535
/**
15536
* Copyright 2013-2015, Facebook, Inc.
15537
* All rights reserved.
15538
*
15539
* This source code is licensed under the BSD-style license found in the
15540
* LICENSE file in the root directory of this source tree. An additional grant
15541
* of patent rights can be found in the PATENTS file in the same directory.
15542
*
15543
* @providesModule ServerReactRootIndex
15544
* @typechecks
15545
*/
15546
15547
'use strict';
15548
15549
/**
15550
* Size of the reactRoot ID space. We generate random numbers for React root
15551
* IDs and if there's a collision the events and DOM update system will
15552
* get confused. In the future we need a way to generate GUIDs but for
15553
* now this will work on a smaller scale.
15554
*/
15555
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
15556
15557
var ServerReactRootIndex = {
15558
createReactRootIndex: function() {
15559
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
15560
}
15561
};
15562
15563
module.exports = ServerReactRootIndex;
15564
15565
15566
},{}],92:[function(require,module,exports){
15567
(function (process){
15568
/**
15569
* Copyright 2013-2015, Facebook, Inc.
15570
* All rights reserved.
15571
*
15572
* This source code is licensed under the BSD-style license found in the
15573
* LICENSE file in the root directory of this source tree. An additional grant
15574
* of patent rights can be found in the PATENTS file in the same directory.
15575
*
15576
* @providesModule SimpleEventPlugin
15577
*/
15578
15579
'use strict';
15580
15581
var EventConstants = require("./EventConstants");
15582
var EventPluginUtils = require("./EventPluginUtils");
15583
var EventPropagators = require("./EventPropagators");
15584
var SyntheticClipboardEvent = require("./SyntheticClipboardEvent");
15585
var SyntheticEvent = require("./SyntheticEvent");
15586
var SyntheticFocusEvent = require("./SyntheticFocusEvent");
15587
var SyntheticKeyboardEvent = require("./SyntheticKeyboardEvent");
15588
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
15589
var SyntheticDragEvent = require("./SyntheticDragEvent");
15590
var SyntheticTouchEvent = require("./SyntheticTouchEvent");
15591
var SyntheticUIEvent = require("./SyntheticUIEvent");
15592
var SyntheticWheelEvent = require("./SyntheticWheelEvent");
15593
15594
var getEventCharCode = require("./getEventCharCode");
15595
15596
var invariant = require("./invariant");
15597
var keyOf = require("./keyOf");
15598
var warning = require("./warning");
15599
15600
var topLevelTypes = EventConstants.topLevelTypes;
15601
15602
var eventTypes = {
15603
blur: {
15604
phasedRegistrationNames: {
15605
bubbled: keyOf({onBlur: true}),
15606
captured: keyOf({onBlurCapture: true})
15607
}
15608
},
15609
click: {
15610
phasedRegistrationNames: {
15611
bubbled: keyOf({onClick: true}),
15612
captured: keyOf({onClickCapture: true})
15613
}
15614
},
15615
contextMenu: {
15616
phasedRegistrationNames: {
15617
bubbled: keyOf({onContextMenu: true}),
15618
captured: keyOf({onContextMenuCapture: true})
15619
}
15620
},
15621
copy: {
15622
phasedRegistrationNames: {
15623
bubbled: keyOf({onCopy: true}),
15624
captured: keyOf({onCopyCapture: true})
15625
}
15626
},
15627
cut: {
15628
phasedRegistrationNames: {
15629
bubbled: keyOf({onCut: true}),
15630
captured: keyOf({onCutCapture: true})
15631
}
15632
},
15633
doubleClick: {
15634
phasedRegistrationNames: {
15635
bubbled: keyOf({onDoubleClick: true}),
15636
captured: keyOf({onDoubleClickCapture: true})
15637
}
15638
},
15639
drag: {
15640
phasedRegistrationNames: {
15641
bubbled: keyOf({onDrag: true}),
15642
captured: keyOf({onDragCapture: true})
15643
}
15644
},
15645
dragEnd: {
15646
phasedRegistrationNames: {
15647
bubbled: keyOf({onDragEnd: true}),
15648
captured: keyOf({onDragEndCapture: true})
15649
}
15650
},
15651
dragEnter: {
15652
phasedRegistrationNames: {
15653
bubbled: keyOf({onDragEnter: true}),
15654
captured: keyOf({onDragEnterCapture: true})
15655
}
15656
},
15657
dragExit: {
15658
phasedRegistrationNames: {
15659
bubbled: keyOf({onDragExit: true}),
15660
captured: keyOf({onDragExitCapture: true})
15661
}
15662
},
15663
dragLeave: {
15664
phasedRegistrationNames: {
15665
bubbled: keyOf({onDragLeave: true}),
15666
captured: keyOf({onDragLeaveCapture: true})
15667
}
15668
},
15669
dragOver: {
15670
phasedRegistrationNames: {
15671
bubbled: keyOf({onDragOver: true}),
15672
captured: keyOf({onDragOverCapture: true})
15673
}
15674
},
15675
dragStart: {
15676
phasedRegistrationNames: {
15677
bubbled: keyOf({onDragStart: true}),
15678
captured: keyOf({onDragStartCapture: true})
15679
}
15680
},
15681
drop: {
15682
phasedRegistrationNames: {
15683
bubbled: keyOf({onDrop: true}),
15684
captured: keyOf({onDropCapture: true})
15685
}
15686
},
15687
focus: {
15688
phasedRegistrationNames: {
15689
bubbled: keyOf({onFocus: true}),
15690
captured: keyOf({onFocusCapture: true})
15691
}
15692
},
15693
input: {
15694
phasedRegistrationNames: {
15695
bubbled: keyOf({onInput: true}),
15696
captured: keyOf({onInputCapture: true})
15697
}
15698
},
15699
keyDown: {
15700
phasedRegistrationNames: {
15701
bubbled: keyOf({onKeyDown: true}),
15702
captured: keyOf({onKeyDownCapture: true})
15703
}
15704
},
15705
keyPress: {
15706
phasedRegistrationNames: {
15707
bubbled: keyOf({onKeyPress: true}),
15708
captured: keyOf({onKeyPressCapture: true})
15709
}
15710
},
15711
keyUp: {
15712
phasedRegistrationNames: {
15713
bubbled: keyOf({onKeyUp: true}),
15714
captured: keyOf({onKeyUpCapture: true})
15715
}
15716
},
15717
load: {
15718
phasedRegistrationNames: {
15719
bubbled: keyOf({onLoad: true}),
15720
captured: keyOf({onLoadCapture: true})
15721
}
15722
},
15723
error: {
15724
phasedRegistrationNames: {
15725
bubbled: keyOf({onError: true}),
15726
captured: keyOf({onErrorCapture: true})
15727
}
15728
},
15729
// Note: We do not allow listening to mouseOver events. Instead, use the
15730
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
15731
mouseDown: {
15732
phasedRegistrationNames: {
15733
bubbled: keyOf({onMouseDown: true}),
15734
captured: keyOf({onMouseDownCapture: true})
15735
}
15736
},
15737
mouseMove: {
15738
phasedRegistrationNames: {
15739
bubbled: keyOf({onMouseMove: true}),
15740
captured: keyOf({onMouseMoveCapture: true})
15741
}
15742
},
15743
mouseOut: {
15744
phasedRegistrationNames: {
15745
bubbled: keyOf({onMouseOut: true}),
15746
captured: keyOf({onMouseOutCapture: true})
15747
}
15748
},
15749
mouseOver: {
15750
phasedRegistrationNames: {
15751
bubbled: keyOf({onMouseOver: true}),
15752
captured: keyOf({onMouseOverCapture: true})
15753
}
15754
},
15755
mouseUp: {
15756
phasedRegistrationNames: {
15757
bubbled: keyOf({onMouseUp: true}),
15758
captured: keyOf({onMouseUpCapture: true})
15759
}
15760
},
15761
paste: {
15762
phasedRegistrationNames: {
15763
bubbled: keyOf({onPaste: true}),
15764
captured: keyOf({onPasteCapture: true})
15765
}
15766
},
15767
reset: {
15768
phasedRegistrationNames: {
15769
bubbled: keyOf({onReset: true}),
15770
captured: keyOf({onResetCapture: true})
15771
}
15772
},
15773
scroll: {
15774
phasedRegistrationNames: {
15775
bubbled: keyOf({onScroll: true}),
15776
captured: keyOf({onScrollCapture: true})
15777
}
15778
},
15779
submit: {
15780
phasedRegistrationNames: {
15781
bubbled: keyOf({onSubmit: true}),
15782
captured: keyOf({onSubmitCapture: true})
15783
}
15784
},
15785
touchCancel: {
15786
phasedRegistrationNames: {
15787
bubbled: keyOf({onTouchCancel: true}),
15788
captured: keyOf({onTouchCancelCapture: true})
15789
}
15790
},
15791
touchEnd: {
15792
phasedRegistrationNames: {
15793
bubbled: keyOf({onTouchEnd: true}),
15794
captured: keyOf({onTouchEndCapture: true})
15795
}
15796
},
15797
touchMove: {
15798
phasedRegistrationNames: {
15799
bubbled: keyOf({onTouchMove: true}),
15800
captured: keyOf({onTouchMoveCapture: true})
15801
}
15802
},
15803
touchStart: {
15804
phasedRegistrationNames: {
15805
bubbled: keyOf({onTouchStart: true}),
15806
captured: keyOf({onTouchStartCapture: true})
15807
}
15808
},
15809
wheel: {
15810
phasedRegistrationNames: {
15811
bubbled: keyOf({onWheel: true}),
15812
captured: keyOf({onWheelCapture: true})
15813
}
15814
}
15815
};
15816
15817
var topLevelEventsToDispatchConfig = {
15818
topBlur: eventTypes.blur,
15819
topClick: eventTypes.click,
15820
topContextMenu: eventTypes.contextMenu,
15821
topCopy: eventTypes.copy,
15822
topCut: eventTypes.cut,
15823
topDoubleClick: eventTypes.doubleClick,
15824
topDrag: eventTypes.drag,
15825
topDragEnd: eventTypes.dragEnd,
15826
topDragEnter: eventTypes.dragEnter,
15827
topDragExit: eventTypes.dragExit,
15828
topDragLeave: eventTypes.dragLeave,
15829
topDragOver: eventTypes.dragOver,
15830
topDragStart: eventTypes.dragStart,
15831
topDrop: eventTypes.drop,
15832
topError: eventTypes.error,
15833
topFocus: eventTypes.focus,
15834
topInput: eventTypes.input,
15835
topKeyDown: eventTypes.keyDown,
15836
topKeyPress: eventTypes.keyPress,
15837
topKeyUp: eventTypes.keyUp,
15838
topLoad: eventTypes.load,
15839
topMouseDown: eventTypes.mouseDown,
15840
topMouseMove: eventTypes.mouseMove,
15841
topMouseOut: eventTypes.mouseOut,
15842
topMouseOver: eventTypes.mouseOver,
15843
topMouseUp: eventTypes.mouseUp,
15844
topPaste: eventTypes.paste,
15845
topReset: eventTypes.reset,
15846
topScroll: eventTypes.scroll,
15847
topSubmit: eventTypes.submit,
15848
topTouchCancel: eventTypes.touchCancel,
15849
topTouchEnd: eventTypes.touchEnd,
15850
topTouchMove: eventTypes.touchMove,
15851
topTouchStart: eventTypes.touchStart,
15852
topWheel: eventTypes.wheel
15853
};
15854
15855
for (var type in topLevelEventsToDispatchConfig) {
15856
topLevelEventsToDispatchConfig[type].dependencies = [type];
15857
}
15858
15859
var SimpleEventPlugin = {
15860
15861
eventTypes: eventTypes,
15862
15863
/**
15864
* Same as the default implementation, except cancels the event when return
15865
* value is false. This behavior will be disabled in a future release.
15866
*
15867
* @param {object} Event to be dispatched.
15868
* @param {function} Application-level callback.
15869
* @param {string} domID DOM ID to pass to the callback.
15870
*/
15871
executeDispatch: function(event, listener, domID) {
15872
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
15873
15874
("production" !== process.env.NODE_ENV ? warning(
15875
typeof returnValue !== 'boolean',
15876
'Returning `false` from an event handler is deprecated and will be ' +
15877
'ignored in a future release. Instead, manually call ' +
15878
'e.stopPropagation() or e.preventDefault(), as appropriate.'
15879
) : null);
15880
15881
if (returnValue === false) {
15882
event.stopPropagation();
15883
event.preventDefault();
15884
}
15885
},
15886
15887
/**
15888
* @param {string} topLevelType Record from `EventConstants`.
15889
* @param {DOMEventTarget} topLevelTarget The listening component root node.
15890
* @param {string} topLevelTargetID ID of `topLevelTarget`.
15891
* @param {object} nativeEvent Native browser event.
15892
* @return {*} An accumulation of synthetic events.
15893
* @see {EventPluginHub.extractEvents}
15894
*/
15895
extractEvents: function(
15896
topLevelType,
15897
topLevelTarget,
15898
topLevelTargetID,
15899
nativeEvent) {
15900
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
15901
if (!dispatchConfig) {
15902
return null;
15903
}
15904
var EventConstructor;
15905
switch (topLevelType) {
15906
case topLevelTypes.topInput:
15907
case topLevelTypes.topLoad:
15908
case topLevelTypes.topError:
15909
case topLevelTypes.topReset:
15910
case topLevelTypes.topSubmit:
15911
// HTML Events
15912
// @see http://www.w3.org/TR/html5/index.html#events-0
15913
EventConstructor = SyntheticEvent;
15914
break;
15915
case topLevelTypes.topKeyPress:
15916
// FireFox creates a keypress event for function keys too. This removes
15917
// the unwanted keypress events. Enter is however both printable and
15918
// non-printable. One would expect Tab to be as well (but it isn't).
15919
if (getEventCharCode(nativeEvent) === 0) {
15920
return null;
15921
}
15922
/* falls through */
15923
case topLevelTypes.topKeyDown:
15924
case topLevelTypes.topKeyUp:
15925
EventConstructor = SyntheticKeyboardEvent;
15926
break;
15927
case topLevelTypes.topBlur:
15928
case topLevelTypes.topFocus:
15929
EventConstructor = SyntheticFocusEvent;
15930
break;
15931
case topLevelTypes.topClick:
15932
// Firefox creates a click event on right mouse clicks. This removes the
15933
// unwanted click events.
15934
if (nativeEvent.button === 2) {
15935
return null;
15936
}
15937
/* falls through */
15938
case topLevelTypes.topContextMenu:
15939
case topLevelTypes.topDoubleClick:
15940
case topLevelTypes.topMouseDown:
15941
case topLevelTypes.topMouseMove:
15942
case topLevelTypes.topMouseOut:
15943
case topLevelTypes.topMouseOver:
15944
case topLevelTypes.topMouseUp:
15945
EventConstructor = SyntheticMouseEvent;
15946
break;
15947
case topLevelTypes.topDrag:
15948
case topLevelTypes.topDragEnd:
15949
case topLevelTypes.topDragEnter:
15950
case topLevelTypes.topDragExit:
15951
case topLevelTypes.topDragLeave:
15952
case topLevelTypes.topDragOver:
15953
case topLevelTypes.topDragStart:
15954
case topLevelTypes.topDrop:
15955
EventConstructor = SyntheticDragEvent;
15956
break;
15957
case topLevelTypes.topTouchCancel:
15958
case topLevelTypes.topTouchEnd:
15959
case topLevelTypes.topTouchMove:
15960
case topLevelTypes.topTouchStart:
15961
EventConstructor = SyntheticTouchEvent;
15962
break;
15963
case topLevelTypes.topScroll:
15964
EventConstructor = SyntheticUIEvent;
15965
break;
15966
case topLevelTypes.topWheel:
15967
EventConstructor = SyntheticWheelEvent;
15968
break;
15969
case topLevelTypes.topCopy:
15970
case topLevelTypes.topCut:
15971
case topLevelTypes.topPaste:
15972
EventConstructor = SyntheticClipboardEvent;
15973
break;
15974
}
15975
("production" !== process.env.NODE_ENV ? invariant(
15976
EventConstructor,
15977
'SimpleEventPlugin: Unhandled event type, `%s`.',
15978
topLevelType
15979
) : invariant(EventConstructor));
15980
var event = EventConstructor.getPooled(
15981
dispatchConfig,
15982
topLevelTargetID,
15983
nativeEvent
15984
);
15985
EventPropagators.accumulateTwoPhaseDispatches(event);
15986
return event;
15987
}
15988
15989
};
15990
15991
module.exports = SimpleEventPlugin;
15992
15993
15994
}).call(this,require("FWaASH"))
15995
},{"./EventConstants":15,"./EventPluginUtils":19,"./EventPropagators":20,"./SyntheticClipboardEvent":93,"./SyntheticDragEvent":95,"./SyntheticEvent":96,"./SyntheticFocusEvent":97,"./SyntheticKeyboardEvent":99,"./SyntheticMouseEvent":100,"./SyntheticTouchEvent":101,"./SyntheticUIEvent":102,"./SyntheticWheelEvent":103,"./getEventCharCode":123,"./invariant":136,"./keyOf":142,"./warning":155,"FWaASH":1}],93:[function(require,module,exports){
15996
/**
15997
* Copyright 2013-2015, Facebook, Inc.
15998
* All rights reserved.
15999
*
16000
* This source code is licensed under the BSD-style license found in the
16001
* LICENSE file in the root directory of this source tree. An additional grant
16002
* of patent rights can be found in the PATENTS file in the same directory.
16003
*
16004
* @providesModule SyntheticClipboardEvent
16005
* @typechecks static-only
16006
*/
16007
16008
'use strict';
16009
16010
var SyntheticEvent = require("./SyntheticEvent");
16011
16012
/**
16013
* @interface Event
16014
* @see http://www.w3.org/TR/clipboard-apis/
16015
*/
16016
var ClipboardEventInterface = {
16017
clipboardData: function(event) {
16018
return (
16019
'clipboardData' in event ?
16020
event.clipboardData :
16021
window.clipboardData
16022
);
16023
}
16024
};
16025
16026
/**
16027
* @param {object} dispatchConfig Configuration used to dispatch this event.
16028
* @param {string} dispatchMarker Marker identifying the event target.
16029
* @param {object} nativeEvent Native browser event.
16030
* @extends {SyntheticUIEvent}
16031
*/
16032
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16033
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16034
}
16035
16036
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
16037
16038
module.exports = SyntheticClipboardEvent;
16039
16040
16041
},{"./SyntheticEvent":96}],94:[function(require,module,exports){
16042
/**
16043
* Copyright 2013-2015, Facebook, Inc.
16044
* All rights reserved.
16045
*
16046
* This source code is licensed under the BSD-style license found in the
16047
* LICENSE file in the root directory of this source tree. An additional grant
16048
* of patent rights can be found in the PATENTS file in the same directory.
16049
*
16050
* @providesModule SyntheticCompositionEvent
16051
* @typechecks static-only
16052
*/
16053
16054
'use strict';
16055
16056
var SyntheticEvent = require("./SyntheticEvent");
16057
16058
/**
16059
* @interface Event
16060
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
16061
*/
16062
var CompositionEventInterface = {
16063
data: null
16064
};
16065
16066
/**
16067
* @param {object} dispatchConfig Configuration used to dispatch this event.
16068
* @param {string} dispatchMarker Marker identifying the event target.
16069
* @param {object} nativeEvent Native browser event.
16070
* @extends {SyntheticUIEvent}
16071
*/
16072
function SyntheticCompositionEvent(
16073
dispatchConfig,
16074
dispatchMarker,
16075
nativeEvent) {
16076
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16077
}
16078
16079
SyntheticEvent.augmentClass(
16080
SyntheticCompositionEvent,
16081
CompositionEventInterface
16082
);
16083
16084
module.exports = SyntheticCompositionEvent;
16085
16086
16087
},{"./SyntheticEvent":96}],95:[function(require,module,exports){
16088
/**
16089
* Copyright 2013-2015, Facebook, Inc.
16090
* All rights reserved.
16091
*
16092
* This source code is licensed under the BSD-style license found in the
16093
* LICENSE file in the root directory of this source tree. An additional grant
16094
* of patent rights can be found in the PATENTS file in the same directory.
16095
*
16096
* @providesModule SyntheticDragEvent
16097
* @typechecks static-only
16098
*/
16099
16100
'use strict';
16101
16102
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
16103
16104
/**
16105
* @interface DragEvent
16106
* @see http://www.w3.org/TR/DOM-Level-3-Events/
16107
*/
16108
var DragEventInterface = {
16109
dataTransfer: null
16110
};
16111
16112
/**
16113
* @param {object} dispatchConfig Configuration used to dispatch this event.
16114
* @param {string} dispatchMarker Marker identifying the event target.
16115
* @param {object} nativeEvent Native browser event.
16116
* @extends {SyntheticUIEvent}
16117
*/
16118
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16119
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16120
}
16121
16122
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
16123
16124
module.exports = SyntheticDragEvent;
16125
16126
16127
},{"./SyntheticMouseEvent":100}],96:[function(require,module,exports){
16128
/**
16129
* Copyright 2013-2015, Facebook, Inc.
16130
* All rights reserved.
16131
*
16132
* This source code is licensed under the BSD-style license found in the
16133
* LICENSE file in the root directory of this source tree. An additional grant
16134
* of patent rights can be found in the PATENTS file in the same directory.
16135
*
16136
* @providesModule SyntheticEvent
16137
* @typechecks static-only
16138
*/
16139
16140
'use strict';
16141
16142
var PooledClass = require("./PooledClass");
16143
16144
var assign = require("./Object.assign");
16145
var emptyFunction = require("./emptyFunction");
16146
var getEventTarget = require("./getEventTarget");
16147
16148
/**
16149
* @interface Event
16150
* @see http://www.w3.org/TR/DOM-Level-3-Events/
16151
*/
16152
var EventInterface = {
16153
type: null,
16154
target: getEventTarget,
16155
// currentTarget is set when dispatching; no use in copying it here
16156
currentTarget: emptyFunction.thatReturnsNull,
16157
eventPhase: null,
16158
bubbles: null,
16159
cancelable: null,
16160
timeStamp: function(event) {
16161
return event.timeStamp || Date.now();
16162
},
16163
defaultPrevented: null,
16164
isTrusted: null
16165
};
16166
16167
/**
16168
* Synthetic events are dispatched by event plugins, typically in response to a
16169
* top-level event delegation handler.
16170
*
16171
* These systems should generally use pooling to reduce the frequency of garbage
16172
* collection. The system should check `isPersistent` to determine whether the
16173
* event should be released into the pool after being dispatched. Users that
16174
* need a persisted event should invoke `persist`.
16175
*
16176
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
16177
* normalizing browser quirks. Subclasses do not necessarily have to implement a
16178
* DOM interface; custom application-specific events can also subclass this.
16179
*
16180
* @param {object} dispatchConfig Configuration used to dispatch this event.
16181
* @param {string} dispatchMarker Marker identifying the event target.
16182
* @param {object} nativeEvent Native browser event.
16183
*/
16184
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16185
this.dispatchConfig = dispatchConfig;
16186
this.dispatchMarker = dispatchMarker;
16187
this.nativeEvent = nativeEvent;
16188
16189
var Interface = this.constructor.Interface;
16190
for (var propName in Interface) {
16191
if (!Interface.hasOwnProperty(propName)) {
16192
continue;
16193
}
16194
var normalize = Interface[propName];
16195
if (normalize) {
16196
this[propName] = normalize(nativeEvent);
16197
} else {
16198
this[propName] = nativeEvent[propName];
16199
}
16200
}
16201
16202
var defaultPrevented = nativeEvent.defaultPrevented != null ?
16203
nativeEvent.defaultPrevented :
16204
nativeEvent.returnValue === false;
16205
if (defaultPrevented) {
16206
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
16207
} else {
16208
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
16209
}
16210
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
16211
}
16212
16213
assign(SyntheticEvent.prototype, {
16214
16215
preventDefault: function() {
16216
this.defaultPrevented = true;
16217
var event = this.nativeEvent;
16218
if (event.preventDefault) {
16219
event.preventDefault();
16220
} else {
16221
event.returnValue = false;
16222
}
16223
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
16224
},
16225
16226
stopPropagation: function() {
16227
var event = this.nativeEvent;
16228
if (event.stopPropagation) {
16229
event.stopPropagation();
16230
} else {
16231
event.cancelBubble = true;
16232
}
16233
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
16234
},
16235
16236
/**
16237
* We release all dispatched `SyntheticEvent`s after each event loop, adding
16238
* them back into the pool. This allows a way to hold onto a reference that
16239
* won't be added back into the pool.
16240
*/
16241
persist: function() {
16242
this.isPersistent = emptyFunction.thatReturnsTrue;
16243
},
16244
16245
/**
16246
* Checks if this event should be released back into the pool.
16247
*
16248
* @return {boolean} True if this should not be released, false otherwise.
16249
*/
16250
isPersistent: emptyFunction.thatReturnsFalse,
16251
16252
/**
16253
* `PooledClass` looks for `destructor` on each instance it releases.
16254
*/
16255
destructor: function() {
16256
var Interface = this.constructor.Interface;
16257
for (var propName in Interface) {
16258
this[propName] = null;
16259
}
16260
this.dispatchConfig = null;
16261
this.dispatchMarker = null;
16262
this.nativeEvent = null;
16263
}
16264
16265
});
16266
16267
SyntheticEvent.Interface = EventInterface;
16268
16269
/**
16270
* Helper to reduce boilerplate when creating subclasses.
16271
*
16272
* @param {function} Class
16273
* @param {?object} Interface
16274
*/
16275
SyntheticEvent.augmentClass = function(Class, Interface) {
16276
var Super = this;
16277
16278
var prototype = Object.create(Super.prototype);
16279
assign(prototype, Class.prototype);
16280
Class.prototype = prototype;
16281
Class.prototype.constructor = Class;
16282
16283
Class.Interface = assign({}, Super.Interface, Interface);
16284
Class.augmentClass = Super.augmentClass;
16285
16286
PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
16287
};
16288
16289
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
16290
16291
module.exports = SyntheticEvent;
16292
16293
16294
},{"./Object.assign":27,"./PooledClass":28,"./emptyFunction":115,"./getEventTarget":126}],97:[function(require,module,exports){
16295
/**
16296
* Copyright 2013-2015, Facebook, Inc.
16297
* All rights reserved.
16298
*
16299
* This source code is licensed under the BSD-style license found in the
16300
* LICENSE file in the root directory of this source tree. An additional grant
16301
* of patent rights can be found in the PATENTS file in the same directory.
16302
*
16303
* @providesModule SyntheticFocusEvent
16304
* @typechecks static-only
16305
*/
16306
16307
'use strict';
16308
16309
var SyntheticUIEvent = require("./SyntheticUIEvent");
16310
16311
/**
16312
* @interface FocusEvent
16313
* @see http://www.w3.org/TR/DOM-Level-3-Events/
16314
*/
16315
var FocusEventInterface = {
16316
relatedTarget: null
16317
};
16318
16319
/**
16320
* @param {object} dispatchConfig Configuration used to dispatch this event.
16321
* @param {string} dispatchMarker Marker identifying the event target.
16322
* @param {object} nativeEvent Native browser event.
16323
* @extends {SyntheticUIEvent}
16324
*/
16325
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16326
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16327
}
16328
16329
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
16330
16331
module.exports = SyntheticFocusEvent;
16332
16333
16334
},{"./SyntheticUIEvent":102}],98:[function(require,module,exports){
16335
/**
16336
* Copyright 2013-2015, Facebook, Inc.
16337
* All rights reserved.
16338
*
16339
* This source code is licensed under the BSD-style license found in the
16340
* LICENSE file in the root directory of this source tree. An additional grant
16341
* of patent rights can be found in the PATENTS file in the same directory.
16342
*
16343
* @providesModule SyntheticInputEvent
16344
* @typechecks static-only
16345
*/
16346
16347
'use strict';
16348
16349
var SyntheticEvent = require("./SyntheticEvent");
16350
16351
/**
16352
* @interface Event
16353
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
16354
* /#events-inputevents
16355
*/
16356
var InputEventInterface = {
16357
data: null
16358
};
16359
16360
/**
16361
* @param {object} dispatchConfig Configuration used to dispatch this event.
16362
* @param {string} dispatchMarker Marker identifying the event target.
16363
* @param {object} nativeEvent Native browser event.
16364
* @extends {SyntheticUIEvent}
16365
*/
16366
function SyntheticInputEvent(
16367
dispatchConfig,
16368
dispatchMarker,
16369
nativeEvent) {
16370
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16371
}
16372
16373
SyntheticEvent.augmentClass(
16374
SyntheticInputEvent,
16375
InputEventInterface
16376
);
16377
16378
module.exports = SyntheticInputEvent;
16379
16380
16381
},{"./SyntheticEvent":96}],99:[function(require,module,exports){
16382
/**
16383
* Copyright 2013-2015, Facebook, Inc.
16384
* All rights reserved.
16385
*
16386
* This source code is licensed under the BSD-style license found in the
16387
* LICENSE file in the root directory of this source tree. An additional grant
16388
* of patent rights can be found in the PATENTS file in the same directory.
16389
*
16390
* @providesModule SyntheticKeyboardEvent
16391
* @typechecks static-only
16392
*/
16393
16394
'use strict';
16395
16396
var SyntheticUIEvent = require("./SyntheticUIEvent");
16397
16398
var getEventCharCode = require("./getEventCharCode");
16399
var getEventKey = require("./getEventKey");
16400
var getEventModifierState = require("./getEventModifierState");
16401
16402
/**
16403
* @interface KeyboardEvent
16404
* @see http://www.w3.org/TR/DOM-Level-3-Events/
16405
*/
16406
var KeyboardEventInterface = {
16407
key: getEventKey,
16408
location: null,
16409
ctrlKey: null,
16410
shiftKey: null,
16411
altKey: null,
16412
metaKey: null,
16413
repeat: null,
16414
locale: null,
16415
getModifierState: getEventModifierState,
16416
// Legacy Interface
16417
charCode: function(event) {
16418
// `charCode` is the result of a KeyPress event and represents the value of
16419
// the actual printable character.
16420
16421
// KeyPress is deprecated, but its replacement is not yet final and not
16422
// implemented in any major browser. Only KeyPress has charCode.
16423
if (event.type === 'keypress') {
16424
return getEventCharCode(event);
16425
}
16426
return 0;
16427
},
16428
keyCode: function(event) {
16429
// `keyCode` is the result of a KeyDown/Up event and represents the value of
16430
// physical keyboard key.
16431
16432
// The actual meaning of the value depends on the users' keyboard layout
16433
// which cannot be detected. Assuming that it is a US keyboard layout
16434
// provides a surprisingly accurate mapping for US and European users.
16435
// Due to this, it is left to the user to implement at this time.
16436
if (event.type === 'keydown' || event.type === 'keyup') {
16437
return event.keyCode;
16438
}
16439
return 0;
16440
},
16441
which: function(event) {
16442
// `which` is an alias for either `keyCode` or `charCode` depending on the
16443
// type of the event.
16444
if (event.type === 'keypress') {
16445
return getEventCharCode(event);
16446
}
16447
if (event.type === 'keydown' || event.type === 'keyup') {
16448
return event.keyCode;
16449
}
16450
return 0;
16451
}
16452
};
16453
16454
/**
16455
* @param {object} dispatchConfig Configuration used to dispatch this event.
16456
* @param {string} dispatchMarker Marker identifying the event target.
16457
* @param {object} nativeEvent Native browser event.
16458
* @extends {SyntheticUIEvent}
16459
*/
16460
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16461
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16462
}
16463
16464
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
16465
16466
module.exports = SyntheticKeyboardEvent;
16467
16468
16469
},{"./SyntheticUIEvent":102,"./getEventCharCode":123,"./getEventKey":124,"./getEventModifierState":125}],100:[function(require,module,exports){
16470
/**
16471
* Copyright 2013-2015, Facebook, Inc.
16472
* All rights reserved.
16473
*
16474
* This source code is licensed under the BSD-style license found in the
16475
* LICENSE file in the root directory of this source tree. An additional grant
16476
* of patent rights can be found in the PATENTS file in the same directory.
16477
*
16478
* @providesModule SyntheticMouseEvent
16479
* @typechecks static-only
16480
*/
16481
16482
'use strict';
16483
16484
var SyntheticUIEvent = require("./SyntheticUIEvent");
16485
var ViewportMetrics = require("./ViewportMetrics");
16486
16487
var getEventModifierState = require("./getEventModifierState");
16488
16489
/**
16490
* @interface MouseEvent
16491
* @see http://www.w3.org/TR/DOM-Level-3-Events/
16492
*/
16493
var MouseEventInterface = {
16494
screenX: null,
16495
screenY: null,
16496
clientX: null,
16497
clientY: null,
16498
ctrlKey: null,
16499
shiftKey: null,
16500
altKey: null,
16501
metaKey: null,
16502
getModifierState: getEventModifierState,
16503
button: function(event) {
16504
// Webkit, Firefox, IE9+
16505
// which: 1 2 3
16506
// button: 0 1 2 (standard)
16507
var button = event.button;
16508
if ('which' in event) {
16509
return button;
16510
}
16511
// IE<9
16512
// which: undefined
16513
// button: 0 0 0
16514
// button: 1 4 2 (onmouseup)
16515
return button === 2 ? 2 : button === 4 ? 1 : 0;
16516
},
16517
buttons: null,
16518
relatedTarget: function(event) {
16519
return event.relatedTarget || (
16520
((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
16521
);
16522
},
16523
// "Proprietary" Interface.
16524
pageX: function(event) {
16525
return 'pageX' in event ?
16526
event.pageX :
16527
event.clientX + ViewportMetrics.currentScrollLeft;
16528
},
16529
pageY: function(event) {
16530
return 'pageY' in event ?
16531
event.pageY :
16532
event.clientY + ViewportMetrics.currentScrollTop;
16533
}
16534
};
16535
16536
/**
16537
* @param {object} dispatchConfig Configuration used to dispatch this event.
16538
* @param {string} dispatchMarker Marker identifying the event target.
16539
* @param {object} nativeEvent Native browser event.
16540
* @extends {SyntheticUIEvent}
16541
*/
16542
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16543
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16544
}
16545
16546
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
16547
16548
module.exports = SyntheticMouseEvent;
16549
16550
16551
},{"./SyntheticUIEvent":102,"./ViewportMetrics":105,"./getEventModifierState":125}],101:[function(require,module,exports){
16552
/**
16553
* Copyright 2013-2015, Facebook, Inc.
16554
* All rights reserved.
16555
*
16556
* This source code is licensed under the BSD-style license found in the
16557
* LICENSE file in the root directory of this source tree. An additional grant
16558
* of patent rights can be found in the PATENTS file in the same directory.
16559
*
16560
* @providesModule SyntheticTouchEvent
16561
* @typechecks static-only
16562
*/
16563
16564
'use strict';
16565
16566
var SyntheticUIEvent = require("./SyntheticUIEvent");
16567
16568
var getEventModifierState = require("./getEventModifierState");
16569
16570
/**
16571
* @interface TouchEvent
16572
* @see http://www.w3.org/TR/touch-events/
16573
*/
16574
var TouchEventInterface = {
16575
touches: null,
16576
targetTouches: null,
16577
changedTouches: null,
16578
altKey: null,
16579
metaKey: null,
16580
ctrlKey: null,
16581
shiftKey: null,
16582
getModifierState: getEventModifierState
16583
};
16584
16585
/**
16586
* @param {object} dispatchConfig Configuration used to dispatch this event.
16587
* @param {string} dispatchMarker Marker identifying the event target.
16588
* @param {object} nativeEvent Native browser event.
16589
* @extends {SyntheticUIEvent}
16590
*/
16591
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16592
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16593
}
16594
16595
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
16596
16597
module.exports = SyntheticTouchEvent;
16598
16599
16600
},{"./SyntheticUIEvent":102,"./getEventModifierState":125}],102:[function(require,module,exports){
16601
/**
16602
* Copyright 2013-2015, Facebook, Inc.
16603
* All rights reserved.
16604
*
16605
* This source code is licensed under the BSD-style license found in the
16606
* LICENSE file in the root directory of this source tree. An additional grant
16607
* of patent rights can be found in the PATENTS file in the same directory.
16608
*
16609
* @providesModule SyntheticUIEvent
16610
* @typechecks static-only
16611
*/
16612
16613
'use strict';
16614
16615
var SyntheticEvent = require("./SyntheticEvent");
16616
16617
var getEventTarget = require("./getEventTarget");
16618
16619
/**
16620
* @interface UIEvent
16621
* @see http://www.w3.org/TR/DOM-Level-3-Events/
16622
*/
16623
var UIEventInterface = {
16624
view: function(event) {
16625
if (event.view) {
16626
return event.view;
16627
}
16628
16629
var target = getEventTarget(event);
16630
if (target != null && target.window === target) {
16631
// target is a window object
16632
return target;
16633
}
16634
16635
var doc = target.ownerDocument;
16636
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
16637
if (doc) {
16638
return doc.defaultView || doc.parentWindow;
16639
} else {
16640
return window;
16641
}
16642
},
16643
detail: function(event) {
16644
return event.detail || 0;
16645
}
16646
};
16647
16648
/**
16649
* @param {object} dispatchConfig Configuration used to dispatch this event.
16650
* @param {string} dispatchMarker Marker identifying the event target.
16651
* @param {object} nativeEvent Native browser event.
16652
* @extends {SyntheticEvent}
16653
*/
16654
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16655
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16656
}
16657
16658
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
16659
16660
module.exports = SyntheticUIEvent;
16661
16662
16663
},{"./SyntheticEvent":96,"./getEventTarget":126}],103:[function(require,module,exports){
16664
/**
16665
* Copyright 2013-2015, Facebook, Inc.
16666
* All rights reserved.
16667
*
16668
* This source code is licensed under the BSD-style license found in the
16669
* LICENSE file in the root directory of this source tree. An additional grant
16670
* of patent rights can be found in the PATENTS file in the same directory.
16671
*
16672
* @providesModule SyntheticWheelEvent
16673
* @typechecks static-only
16674
*/
16675
16676
'use strict';
16677
16678
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
16679
16680
/**
16681
* @interface WheelEvent
16682
* @see http://www.w3.org/TR/DOM-Level-3-Events/
16683
*/
16684
var WheelEventInterface = {
16685
deltaX: function(event) {
16686
return (
16687
'deltaX' in event ? event.deltaX :
16688
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
16689
'wheelDeltaX' in event ? -event.wheelDeltaX : 0
16690
);
16691
},
16692
deltaY: function(event) {
16693
return (
16694
'deltaY' in event ? event.deltaY :
16695
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
16696
'wheelDeltaY' in event ? -event.wheelDeltaY :
16697
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
16698
'wheelDelta' in event ? -event.wheelDelta : 0
16699
);
16700
},
16701
deltaZ: null,
16702
16703
// Browsers without "deltaMode" is reporting in raw wheel delta where one
16704
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
16705
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
16706
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
16707
deltaMode: null
16708
};
16709
16710
/**
16711
* @param {object} dispatchConfig Configuration used to dispatch this event.
16712
* @param {string} dispatchMarker Marker identifying the event target.
16713
* @param {object} nativeEvent Native browser event.
16714
* @extends {SyntheticMouseEvent}
16715
*/
16716
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
16717
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
16718
}
16719
16720
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
16721
16722
module.exports = SyntheticWheelEvent;
16723
16724
16725
},{"./SyntheticMouseEvent":100}],104:[function(require,module,exports){
16726
(function (process){
16727
/**
16728
* Copyright 2013-2015, Facebook, Inc.
16729
* All rights reserved.
16730
*
16731
* This source code is licensed under the BSD-style license found in the
16732
* LICENSE file in the root directory of this source tree. An additional grant
16733
* of patent rights can be found in the PATENTS file in the same directory.
16734
*
16735
* @providesModule Transaction
16736
*/
16737
16738
'use strict';
16739
16740
var invariant = require("./invariant");
16741
16742
/**
16743
* `Transaction` creates a black box that is able to wrap any method such that
16744
* certain invariants are maintained before and after the method is invoked
16745
* (Even if an exception is thrown while invoking the wrapped method). Whoever
16746
* instantiates a transaction can provide enforcers of the invariants at
16747
* creation time. The `Transaction` class itself will supply one additional
16748
* automatic invariant for you - the invariant that any transaction instance
16749
* should not be run while it is already being run. You would typically create a
16750
* single instance of a `Transaction` for reuse multiple times, that potentially
16751
* is used to wrap several different methods. Wrappers are extremely simple -
16752
* they only require implementing two methods.
16753
*
16754
* <pre>
16755
* wrappers (injected at creation time)
16756
* + +
16757
* | |
16758
* +-----------------|--------|--------------+
16759
* | v | |
16760
* | +---------------+ | |
16761
* | +--| wrapper1 |---|----+ |
16762
* | | +---------------+ v | |
16763
* | | +-------------+ | |
16764
* | | +----| wrapper2 |--------+ |
16765
* | | | +-------------+ | | |
16766
* | | | | | |
16767
* | v v v v | wrapper
16768
* | +---+ +---+ +---------+ +---+ +---+ | invariants
16769
* perform(anyMethod) | | | | | | | | | | | | maintained
16770
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
16771
* | | | | | | | | | | | |
16772
* | | | | | | | | | | | |
16773
* | | | | | | | | | | | |
16774
* | +---+ +---+ +---------+ +---+ +---+ |
16775
* | initialize close |
16776
* +-----------------------------------------+
16777
* </pre>
16778
*
16779
* Use cases:
16780
* - Preserving the input selection ranges before/after reconciliation.
16781
* Restoring selection even in the event of an unexpected error.
16782
* - Deactivating events while rearranging the DOM, preventing blurs/focuses,
16783
* while guaranteeing that afterwards, the event system is reactivated.
16784
* - Flushing a queue of collected DOM mutations to the main UI thread after a
16785
* reconciliation takes place in a worker thread.
16786
* - Invoking any collected `componentDidUpdate` callbacks after rendering new
16787
* content.
16788
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
16789
* to preserve the `scrollTop` (an automatic scroll aware DOM).
16790
* - (Future use case): Layout calculations before and after DOM updates.
16791
*
16792
* Transactional plugin API:
16793
* - A module that has an `initialize` method that returns any precomputation.
16794
* - and a `close` method that accepts the precomputation. `close` is invoked
16795
* when the wrapped process is completed, or has failed.
16796
*
16797
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
16798
* that implement `initialize` and `close`.
16799
* @return {Transaction} Single transaction for reuse in thread.
16800
*
16801
* @class Transaction
16802
*/
16803
var Mixin = {
16804
/**
16805
* Sets up this instance so that it is prepared for collecting metrics. Does
16806
* so such that this setup method may be used on an instance that is already
16807
* initialized, in a way that does not consume additional memory upon reuse.
16808
* That can be useful if you decide to make your subclass of this mixin a
16809
* "PooledClass".
16810
*/
16811
reinitializeTransaction: function() {
16812
this.transactionWrappers = this.getTransactionWrappers();
16813
if (!this.wrapperInitData) {
16814
this.wrapperInitData = [];
16815
} else {
16816
this.wrapperInitData.length = 0;
16817
}
16818
this._isInTransaction = false;
16819
},
16820
16821
_isInTransaction: false,
16822
16823
/**
16824
* @abstract
16825
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
16826
*/
16827
getTransactionWrappers: null,
16828
16829
isInTransaction: function() {
16830
return !!this._isInTransaction;
16831
},
16832
16833
/**
16834
* Executes the function within a safety window. Use this for the top level
16835
* methods that result in large amounts of computation/mutations that would
16836
* need to be safety checked.
16837
*
16838
* @param {function} method Member of scope to call.
16839
* @param {Object} scope Scope to invoke from.
16840
* @param {Object?=} args... Arguments to pass to the method (optional).
16841
* Helps prevent need to bind in many cases.
16842
* @return Return value from `method`.
16843
*/
16844
perform: function(method, scope, a, b, c, d, e, f) {
16845
("production" !== process.env.NODE_ENV ? invariant(
16846
!this.isInTransaction(),
16847
'Transaction.perform(...): Cannot initialize a transaction when there ' +
16848
'is already an outstanding transaction.'
16849
) : invariant(!this.isInTransaction()));
16850
var errorThrown;
16851
var ret;
16852
try {
16853
this._isInTransaction = true;
16854
// Catching errors makes debugging more difficult, so we start with
16855
// errorThrown set to true before setting it to false after calling
16856
// close -- if it's still set to true in the finally block, it means
16857
// one of these calls threw.
16858
errorThrown = true;
16859
this.initializeAll(0);
16860
ret = method.call(scope, a, b, c, d, e, f);
16861
errorThrown = false;
16862
} finally {
16863
try {
16864
if (errorThrown) {
16865
// If `method` throws, prefer to show that stack trace over any thrown
16866
// by invoking `closeAll`.
16867
try {
16868
this.closeAll(0);
16869
} catch (err) {
16870
}
16871
} else {
16872
// Since `method` didn't throw, we don't want to silence the exception
16873
// here.
16874
this.closeAll(0);
16875
}
16876
} finally {
16877
this._isInTransaction = false;
16878
}
16879
}
16880
return ret;
16881
},
16882
16883
initializeAll: function(startIndex) {
16884
var transactionWrappers = this.transactionWrappers;
16885
for (var i = startIndex; i < transactionWrappers.length; i++) {
16886
var wrapper = transactionWrappers[i];
16887
try {
16888
// Catching errors makes debugging more difficult, so we start with the
16889
// OBSERVED_ERROR state before overwriting it with the real return value
16890
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
16891
// block, it means wrapper.initialize threw.
16892
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
16893
this.wrapperInitData[i] = wrapper.initialize ?
16894
wrapper.initialize.call(this) :
16895
null;
16896
} finally {
16897
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
16898
// The initializer for wrapper i threw an error; initialize the
16899
// remaining wrappers but silence any exceptions from them to ensure
16900
// that the first error is the one to bubble up.
16901
try {
16902
this.initializeAll(i + 1);
16903
} catch (err) {
16904
}
16905
}
16906
}
16907
}
16908
},
16909
16910
/**
16911
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into
16912
* them the respective return values of `this.transactionWrappers.init[i]`
16913
* (`close`rs that correspond to initializers that failed will not be
16914
* invoked).
16915
*/
16916
closeAll: function(startIndex) {
16917
("production" !== process.env.NODE_ENV ? invariant(
16918
this.isInTransaction(),
16919
'Transaction.closeAll(): Cannot close transaction when none are open.'
16920
) : invariant(this.isInTransaction()));
16921
var transactionWrappers = this.transactionWrappers;
16922
for (var i = startIndex; i < transactionWrappers.length; i++) {
16923
var wrapper = transactionWrappers[i];
16924
var initData = this.wrapperInitData[i];
16925
var errorThrown;
16926
try {
16927
// Catching errors makes debugging more difficult, so we start with
16928
// errorThrown set to true before setting it to false after calling
16929
// close -- if it's still set to true in the finally block, it means
16930
// wrapper.close threw.
16931
errorThrown = true;
16932
if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
16933
wrapper.close.call(this, initData);
16934
}
16935
errorThrown = false;
16936
} finally {
16937
if (errorThrown) {
16938
// The closer for wrapper i threw an error; close the remaining
16939
// wrappers but silence any exceptions from them to ensure that the
16940
// first error is the one to bubble up.
16941
try {
16942
this.closeAll(i + 1);
16943
} catch (e) {
16944
}
16945
}
16946
}
16947
}
16948
this.wrapperInitData.length = 0;
16949
}
16950
};
16951
16952
var Transaction = {
16953
16954
Mixin: Mixin,
16955
16956
/**
16957
* Token to look for to determine if an error occured.
16958
*/
16959
OBSERVED_ERROR: {}
16960
16961
};
16962
16963
module.exports = Transaction;
16964
16965
16966
}).call(this,require("FWaASH"))
16967
},{"./invariant":136,"FWaASH":1}],105:[function(require,module,exports){
16968
/**
16969
* Copyright 2013-2015, Facebook, Inc.
16970
* All rights reserved.
16971
*
16972
* This source code is licensed under the BSD-style license found in the
16973
* LICENSE file in the root directory of this source tree. An additional grant
16974
* of patent rights can be found in the PATENTS file in the same directory.
16975
*
16976
* @providesModule ViewportMetrics
16977
*/
16978
16979
'use strict';
16980
16981
var ViewportMetrics = {
16982
16983
currentScrollLeft: 0,
16984
16985
currentScrollTop: 0,
16986
16987
refreshScrollValues: function(scrollPosition) {
16988
ViewportMetrics.currentScrollLeft = scrollPosition.x;
16989
ViewportMetrics.currentScrollTop = scrollPosition.y;
16990
}
16991
16992
};
16993
16994
module.exports = ViewportMetrics;
16995
16996
16997
},{}],106:[function(require,module,exports){
16998
(function (process){
16999
/**
17000
* Copyright 2014-2015, Facebook, Inc.
17001
* All rights reserved.
17002
*
17003
* This source code is licensed under the BSD-style license found in the
17004
* LICENSE file in the root directory of this source tree. An additional grant
17005
* of patent rights can be found in the PATENTS file in the same directory.
17006
*
17007
* @providesModule accumulateInto
17008
*/
17009
17010
'use strict';
17011
17012
var invariant = require("./invariant");
17013
17014
/**
17015
*
17016
* Accumulates items that must not be null or undefined into the first one. This
17017
* is used to conserve memory by avoiding array allocations, and thus sacrifices
17018
* API cleanness. Since `current` can be null before being passed in and not
17019
* null after this function, make sure to assign it back to `current`:
17020
*
17021
* `a = accumulateInto(a, b);`
17022
*
17023
* This API should be sparingly used. Try `accumulate` for something cleaner.
17024
*
17025
* @return {*|array<*>} An accumulation of items.
17026
*/
17027
17028
function accumulateInto(current, next) {
17029
("production" !== process.env.NODE_ENV ? invariant(
17030
next != null,
17031
'accumulateInto(...): Accumulated items must not be null or undefined.'
17032
) : invariant(next != null));
17033
if (current == null) {
17034
return next;
17035
}
17036
17037
// Both are not empty. Warning: Never call x.concat(y) when you are not
17038
// certain that x is an Array (x could be a string with concat method).
17039
var currentIsArray = Array.isArray(current);
17040
var nextIsArray = Array.isArray(next);
17041
17042
if (currentIsArray && nextIsArray) {
17043
current.push.apply(current, next);
17044
return current;
17045
}
17046
17047
if (currentIsArray) {
17048
current.push(next);
17049
return current;
17050
}
17051
17052
if (nextIsArray) {
17053
// A bit too dangerous to mutate `next`.
17054
return [current].concat(next);
17055
}
17056
17057
return [current, next];
17058
}
17059
17060
module.exports = accumulateInto;
17061
17062
17063
}).call(this,require("FWaASH"))
17064
},{"./invariant":136,"FWaASH":1}],107:[function(require,module,exports){
17065
/**
17066
* Copyright 2013-2015, Facebook, Inc.
17067
* All rights reserved.
17068
*
17069
* This source code is licensed under the BSD-style license found in the
17070
* LICENSE file in the root directory of this source tree. An additional grant
17071
* of patent rights can be found in the PATENTS file in the same directory.
17072
*
17073
* @providesModule adler32
17074
*/
17075
17076
/* jslint bitwise:true */
17077
17078
'use strict';
17079
17080
var MOD = 65521;
17081
17082
// This is a clean-room implementation of adler32 designed for detecting
17083
// if markup is not what we expect it to be. It does not need to be
17084
// cryptographically strong, only reasonably good at detecting if markup
17085
// generated on the server is different than that on the client.
17086
function adler32(data) {
17087
var a = 1;
17088
var b = 0;
17089
for (var i = 0; i < data.length; i++) {
17090
a = (a + data.charCodeAt(i)) % MOD;
17091
b = (b + a) % MOD;
17092
}
17093
return a | (b << 16);
17094
}
17095
17096
module.exports = adler32;
17097
17098
17099
},{}],108:[function(require,module,exports){
17100
/**
17101
* Copyright 2013-2015, Facebook, Inc.
17102
* All rights reserved.
17103
*
17104
* This source code is licensed under the BSD-style license found in the
17105
* LICENSE file in the root directory of this source tree. An additional grant
17106
* of patent rights can be found in the PATENTS file in the same directory.
17107
*
17108
* @providesModule camelize
17109
* @typechecks
17110
*/
17111
17112
var _hyphenPattern = /-(.)/g;
17113
17114
/**
17115
* Camelcases a hyphenated string, for example:
17116
*
17117
* > camelize('background-color')
17118
* < "backgroundColor"
17119
*
17120
* @param {string} string
17121
* @return {string}
17122
*/
17123
function camelize(string) {
17124
return string.replace(_hyphenPattern, function(_, character) {
17125
return character.toUpperCase();
17126
});
17127
}
17128
17129
module.exports = camelize;
17130
17131
17132
},{}],109:[function(require,module,exports){
17133
/**
17134
* Copyright 2014-2015, Facebook, Inc.
17135
* All rights reserved.
17136
*
17137
* This source code is licensed under the BSD-style license found in the
17138
* LICENSE file in the root directory of this source tree. An additional grant
17139
* of patent rights can be found in the PATENTS file in the same directory.
17140
*
17141
* @providesModule camelizeStyleName
17142
* @typechecks
17143
*/
17144
17145
"use strict";
17146
17147
var camelize = require("./camelize");
17148
17149
var msPattern = /^-ms-/;
17150
17151
/**
17152
* Camelcases a hyphenated CSS property name, for example:
17153
*
17154
* > camelizeStyleName('background-color')
17155
* < "backgroundColor"
17156
* > camelizeStyleName('-moz-transition')
17157
* < "MozTransition"
17158
* > camelizeStyleName('-ms-transition')
17159
* < "msTransition"
17160
*
17161
* As Andi Smith suggests
17162
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
17163
* is converted to lowercase `ms`.
17164
*
17165
* @param {string} string
17166
* @return {string}
17167
*/
17168
function camelizeStyleName(string) {
17169
return camelize(string.replace(msPattern, 'ms-'));
17170
}
17171
17172
module.exports = camelizeStyleName;
17173
17174
17175
},{"./camelize":108}],110:[function(require,module,exports){
17176
/**
17177
* Copyright 2013-2015, Facebook, Inc.
17178
* All rights reserved.
17179
*
17180
* This source code is licensed under the BSD-style license found in the
17181
* LICENSE file in the root directory of this source tree. An additional grant
17182
* of patent rights can be found in the PATENTS file in the same directory.
17183
*
17184
* @providesModule containsNode
17185
* @typechecks
17186
*/
17187
17188
var isTextNode = require("./isTextNode");
17189
17190
/*jslint bitwise:true */
17191
17192
/**
17193
* Checks if a given DOM node contains or is another DOM node.
17194
*
17195
* @param {?DOMNode} outerNode Outer DOM node.
17196
* @param {?DOMNode} innerNode Inner DOM node.
17197
* @return {boolean} True if `outerNode` contains or is `innerNode`.
17198
*/
17199
function containsNode(outerNode, innerNode) {
17200
if (!outerNode || !innerNode) {
17201
return false;
17202
} else if (outerNode === innerNode) {
17203
return true;
17204
} else if (isTextNode(outerNode)) {
17205
return false;
17206
} else if (isTextNode(innerNode)) {
17207
return containsNode(outerNode, innerNode.parentNode);
17208
} else if (outerNode.contains) {
17209
return outerNode.contains(innerNode);
17210
} else if (outerNode.compareDocumentPosition) {
17211
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
17212
} else {
17213
return false;
17214
}
17215
}
17216
17217
module.exports = containsNode;
17218
17219
17220
},{"./isTextNode":140}],111:[function(require,module,exports){
17221
/**
17222
* Copyright 2013-2015, Facebook, Inc.
17223
* All rights reserved.
17224
*
17225
* This source code is licensed under the BSD-style license found in the
17226
* LICENSE file in the root directory of this source tree. An additional grant
17227
* of patent rights can be found in the PATENTS file in the same directory.
17228
*
17229
* @providesModule createArrayFromMixed
17230
* @typechecks
17231
*/
17232
17233
var toArray = require("./toArray");
17234
17235
/**
17236
* Perform a heuristic test to determine if an object is "array-like".
17237
*
17238
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
17239
* Joshu replied: "Mu."
17240
*
17241
* This function determines if its argument has "array nature": it returns
17242
* true if the argument is an actual array, an `arguments' object, or an
17243
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
17244
*
17245
* It will return false for other array-like objects like Filelist.
17246
*
17247
* @param {*} obj
17248
* @return {boolean}
17249
*/
17250
function hasArrayNature(obj) {
17251
return (
17252
// not null/false
17253
!!obj &&
17254
// arrays are objects, NodeLists are functions in Safari
17255
(typeof obj == 'object' || typeof obj == 'function') &&
17256
// quacks like an array
17257
('length' in obj) &&
17258
// not window
17259
!('setInterval' in obj) &&
17260
// no DOM node should be considered an array-like
17261
// a 'select' element has 'length' and 'item' properties on IE8
17262
(typeof obj.nodeType != 'number') &&
17263
(
17264
// a real array
17265
(// HTMLCollection/NodeList
17266
(Array.isArray(obj) ||
17267
// arguments
17268
('callee' in obj) || 'item' in obj))
17269
)
17270
);
17271
}
17272
17273
/**
17274
* Ensure that the argument is an array by wrapping it in an array if it is not.
17275
* Creates a copy of the argument if it is already an array.
17276
*
17277
* This is mostly useful idiomatically:
17278
*
17279
* var createArrayFromMixed = require('createArrayFromMixed');
17280
*
17281
* function takesOneOrMoreThings(things) {
17282
* things = createArrayFromMixed(things);
17283
* ...
17284
* }
17285
*
17286
* This allows you to treat `things' as an array, but accept scalars in the API.
17287
*
17288
* If you need to convert an array-like object, like `arguments`, into an array
17289
* use toArray instead.
17290
*
17291
* @param {*} obj
17292
* @return {array}
17293
*/
17294
function createArrayFromMixed(obj) {
17295
if (!hasArrayNature(obj)) {
17296
return [obj];
17297
} else if (Array.isArray(obj)) {
17298
return obj.slice();
17299
} else {
17300
return toArray(obj);
17301
}
17302
}
17303
17304
module.exports = createArrayFromMixed;
17305
17306
17307
},{"./toArray":153}],112:[function(require,module,exports){
17308
(function (process){
17309
/**
17310
* Copyright 2013-2015, Facebook, Inc.
17311
* All rights reserved.
17312
*
17313
* This source code is licensed under the BSD-style license found in the
17314
* LICENSE file in the root directory of this source tree. An additional grant
17315
* of patent rights can be found in the PATENTS file in the same directory.
17316
*
17317
* @providesModule createFullPageComponent
17318
* @typechecks
17319
*/
17320
17321
'use strict';
17322
17323
// Defeat circular references by requiring this directly.
17324
var ReactClass = require("./ReactClass");
17325
var ReactElement = require("./ReactElement");
17326
17327
var invariant = require("./invariant");
17328
17329
/**
17330
* Create a component that will throw an exception when unmounted.
17331
*
17332
* Components like <html> <head> and <body> can't be removed or added
17333
* easily in a cross-browser way, however it's valuable to be able to
17334
* take advantage of React's reconciliation for styling and <title>
17335
* management. So we just document it and throw in dangerous cases.
17336
*
17337
* @param {string} tag The tag to wrap
17338
* @return {function} convenience constructor of new component
17339
*/
17340
function createFullPageComponent(tag) {
17341
var elementFactory = ReactElement.createFactory(tag);
17342
17343
var FullPageComponent = ReactClass.createClass({
17344
displayName: 'ReactFullPageComponent' + tag,
17345
17346
componentWillUnmount: function() {
17347
("production" !== process.env.NODE_ENV ? invariant(
17348
false,
17349
'%s tried to unmount. Because of cross-browser quirks it is ' +
17350
'impossible to unmount some top-level components (eg <html>, <head>, ' +
17351
'and <body>) reliably and efficiently. To fix this, have a single ' +
17352
'top-level component that never unmounts render these elements.',
17353
this.constructor.displayName
17354
) : invariant(false));
17355
},
17356
17357
render: function() {
17358
return elementFactory(this.props);
17359
}
17360
});
17361
17362
return FullPageComponent;
17363
}
17364
17365
module.exports = createFullPageComponent;
17366
17367
17368
}).call(this,require("FWaASH"))
17369
},{"./ReactClass":34,"./ReactElement":58,"./invariant":136,"FWaASH":1}],113:[function(require,module,exports){
17370
(function (process){
17371
/**
17372
* Copyright 2013-2015, Facebook, Inc.
17373
* All rights reserved.
17374
*
17375
* This source code is licensed under the BSD-style license found in the
17376
* LICENSE file in the root directory of this source tree. An additional grant
17377
* of patent rights can be found in the PATENTS file in the same directory.
17378
*
17379
* @providesModule createNodesFromMarkup
17380
* @typechecks
17381
*/
17382
17383
/*jslint evil: true, sub: true */
17384
17385
var ExecutionEnvironment = require("./ExecutionEnvironment");
17386
17387
var createArrayFromMixed = require("./createArrayFromMixed");
17388
var getMarkupWrap = require("./getMarkupWrap");
17389
var invariant = require("./invariant");
17390
17391
/**
17392
* Dummy container used to render all markup.
17393
*/
17394
var dummyNode =
17395
ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
17396
17397
/**
17398
* Pattern used by `getNodeName`.
17399
*/
17400
var nodeNamePattern = /^\s*<(\w+)/;
17401
17402
/**
17403
* Extracts the `nodeName` of the first element in a string of markup.
17404
*
17405
* @param {string} markup String of markup.
17406
* @return {?string} Node name of the supplied markup.
17407
*/
17408
function getNodeName(markup) {
17409
var nodeNameMatch = markup.match(nodeNamePattern);
17410
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
17411
}
17412
17413
/**
17414
* Creates an array containing the nodes rendered from the supplied markup. The
17415
* optionally supplied `handleScript` function will be invoked once for each
17416
* <script> element that is rendered. If no `handleScript` function is supplied,
17417
* an exception is thrown if any <script> elements are rendered.
17418
*
17419
* @param {string} markup A string of valid HTML markup.
17420
* @param {?function} handleScript Invoked once for each rendered <script>.
17421
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
17422
*/
17423
function createNodesFromMarkup(markup, handleScript) {
17424
var node = dummyNode;
17425
("production" !== process.env.NODE_ENV ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
17426
var nodeName = getNodeName(markup);
17427
17428
var wrap = nodeName && getMarkupWrap(nodeName);
17429
if (wrap) {
17430
node.innerHTML = wrap[1] + markup + wrap[2];
17431
17432
var wrapDepth = wrap[0];
17433
while (wrapDepth--) {
17434
node = node.lastChild;
17435
}
17436
} else {
17437
node.innerHTML = markup;
17438
}
17439
17440
var scripts = node.getElementsByTagName('script');
17441
if (scripts.length) {
17442
("production" !== process.env.NODE_ENV ? invariant(
17443
handleScript,
17444
'createNodesFromMarkup(...): Unexpected <script> element rendered.'
17445
) : invariant(handleScript));
17446
createArrayFromMixed(scripts).forEach(handleScript);
17447
}
17448
17449
var nodes = createArrayFromMixed(node.childNodes);
17450
while (node.lastChild) {
17451
node.removeChild(node.lastChild);
17452
}
17453
return nodes;
17454
}
17455
17456
module.exports = createNodesFromMarkup;
17457
17458
17459
}).call(this,require("FWaASH"))
17460
},{"./ExecutionEnvironment":21,"./createArrayFromMixed":111,"./getMarkupWrap":128,"./invariant":136,"FWaASH":1}],114:[function(require,module,exports){
17461
/**
17462
* Copyright 2013-2015, Facebook, Inc.
17463
* All rights reserved.
17464
*
17465
* This source code is licensed under the BSD-style license found in the
17466
* LICENSE file in the root directory of this source tree. An additional grant
17467
* of patent rights can be found in the PATENTS file in the same directory.
17468
*
17469
* @providesModule dangerousStyleValue
17470
* @typechecks static-only
17471
*/
17472
17473
'use strict';
17474
17475
var CSSProperty = require("./CSSProperty");
17476
17477
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
17478
17479
/**
17480
* Convert a value into the proper css writable value. The style name `name`
17481
* should be logical (no hyphens), as specified
17482
* in `CSSProperty.isUnitlessNumber`.
17483
*
17484
* @param {string} name CSS property name such as `topMargin`.
17485
* @param {*} value CSS property value such as `10px`.
17486
* @return {string} Normalized style value with dimensions applied.
17487
*/
17488
function dangerousStyleValue(name, value) {
17489
// Note that we've removed escapeTextForBrowser() calls here since the
17490
// whole string will be escaped when the attribute is injected into
17491
// the markup. If you provide unsafe user data here they can inject
17492
// arbitrary CSS which may be problematic (I couldn't repro this):
17493
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
17494
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
17495
// This is not an XSS hole but instead a potential CSS injection issue
17496
// which has lead to a greater discussion about how we're going to
17497
// trust URLs moving forward. See #2115901
17498
17499
var isEmpty = value == null || typeof value === 'boolean' || value === '';
17500
if (isEmpty) {
17501
return '';
17502
}
17503
17504
var isNonNumeric = isNaN(value);
17505
if (isNonNumeric || value === 0 ||
17506
isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
17507
return '' + value; // cast to string
17508
}
17509
17510
if (typeof value === 'string') {
17511
value = value.trim();
17512
}
17513
return value + 'px';
17514
}
17515
17516
module.exports = dangerousStyleValue;
17517
17518
17519
},{"./CSSProperty":4}],115:[function(require,module,exports){
17520
/**
17521
* Copyright 2013-2015, Facebook, Inc.
17522
* All rights reserved.
17523
*
17524
* This source code is licensed under the BSD-style license found in the
17525
* LICENSE file in the root directory of this source tree. An additional grant
17526
* of patent rights can be found in the PATENTS file in the same directory.
17527
*
17528
* @providesModule emptyFunction
17529
*/
17530
17531
function makeEmptyFunction(arg) {
17532
return function() {
17533
return arg;
17534
};
17535
}
17536
17537
/**
17538
* This function accepts and discards inputs; it has no side effects. This is
17539
* primarily useful idiomatically for overridable function endpoints which
17540
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
17541
*/
17542
function emptyFunction() {}
17543
17544
emptyFunction.thatReturns = makeEmptyFunction;
17545
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
17546
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
17547
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
17548
emptyFunction.thatReturnsThis = function() { return this; };
17549
emptyFunction.thatReturnsArgument = function(arg) { return arg; };
17550
17551
module.exports = emptyFunction;
17552
17553
17554
},{}],116:[function(require,module,exports){
17555
(function (process){
17556
/**
17557
* Copyright 2013-2015, Facebook, Inc.
17558
* All rights reserved.
17559
*
17560
* This source code is licensed under the BSD-style license found in the
17561
* LICENSE file in the root directory of this source tree. An additional grant
17562
* of patent rights can be found in the PATENTS file in the same directory.
17563
*
17564
* @providesModule emptyObject
17565
*/
17566
17567
"use strict";
17568
17569
var emptyObject = {};
17570
17571
if ("production" !== process.env.NODE_ENV) {
17572
Object.freeze(emptyObject);
17573
}
17574
17575
module.exports = emptyObject;
17576
17577
17578
}).call(this,require("FWaASH"))
17579
},{"FWaASH":1}],117:[function(require,module,exports){
17580
/**
17581
* Copyright 2013-2015, Facebook, Inc.
17582
* All rights reserved.
17583
*
17584
* This source code is licensed under the BSD-style license found in the
17585
* LICENSE file in the root directory of this source tree. An additional grant
17586
* of patent rights can be found in the PATENTS file in the same directory.
17587
*
17588
* @providesModule escapeTextContentForBrowser
17589
*/
17590
17591
'use strict';
17592
17593
var ESCAPE_LOOKUP = {
17594
'&': '&amp;',
17595
'>': '&gt;',
17596
'<': '&lt;',
17597
'"': '&quot;',
17598
'\'': '&#x27;'
17599
};
17600
17601
var ESCAPE_REGEX = /[&><"']/g;
17602
17603
function escaper(match) {
17604
return ESCAPE_LOOKUP[match];
17605
}
17606
17607
/**
17608
* Escapes text to prevent scripting attacks.
17609
*
17610
* @param {*} text Text value to escape.
17611
* @return {string} An escaped string.
17612
*/
17613
function escapeTextContentForBrowser(text) {
17614
return ('' + text).replace(ESCAPE_REGEX, escaper);
17615
}
17616
17617
module.exports = escapeTextContentForBrowser;
17618
17619
17620
},{}],118:[function(require,module,exports){
17621
(function (process){
17622
/**
17623
* Copyright 2013-2015, Facebook, Inc.
17624
* All rights reserved.
17625
*
17626
* This source code is licensed under the BSD-style license found in the
17627
* LICENSE file in the root directory of this source tree. An additional grant
17628
* of patent rights can be found in the PATENTS file in the same directory.
17629
*
17630
* @providesModule findDOMNode
17631
* @typechecks static-only
17632
*/
17633
17634
'use strict';
17635
17636
var ReactCurrentOwner = require("./ReactCurrentOwner");
17637
var ReactInstanceMap = require("./ReactInstanceMap");
17638
var ReactMount = require("./ReactMount");
17639
17640
var invariant = require("./invariant");
17641
var isNode = require("./isNode");
17642
var warning = require("./warning");
17643
17644
/**
17645
* Returns the DOM node rendered by this element.
17646
*
17647
* @param {ReactComponent|DOMElement} componentOrElement
17648
* @return {DOMElement} The root node of this element.
17649
*/
17650
function findDOMNode(componentOrElement) {
17651
if ("production" !== process.env.NODE_ENV) {
17652
var owner = ReactCurrentOwner.current;
17653
if (owner !== null) {
17654
("production" !== process.env.NODE_ENV ? warning(
17655
owner._warnedAboutRefsInRender,
17656
'%s is accessing getDOMNode or findDOMNode inside its render(). ' +
17657
'render() should be a pure function of props and state. It should ' +
17658
'never access something that requires stale data from the previous ' +
17659
'render, such as refs. Move this logic to componentDidMount and ' +
17660
'componentDidUpdate instead.',
17661
owner.getName() || 'A component'
17662
) : null);
17663
owner._warnedAboutRefsInRender = true;
17664
}
17665
}
17666
if (componentOrElement == null) {
17667
return null;
17668
}
17669
if (isNode(componentOrElement)) {
17670
return componentOrElement;
17671
}
17672
if (ReactInstanceMap.has(componentOrElement)) {
17673
return ReactMount.getNodeFromInstance(componentOrElement);
17674
}
17675
("production" !== process.env.NODE_ENV ? invariant(
17676
componentOrElement.render == null ||
17677
typeof componentOrElement.render !== 'function',
17678
'Component (with keys: %s) contains `render` method ' +
17679
'but is not mounted in the DOM',
17680
Object.keys(componentOrElement)
17681
) : invariant(componentOrElement.render == null ||
17682
typeof componentOrElement.render !== 'function'));
17683
("production" !== process.env.NODE_ENV ? invariant(
17684
false,
17685
'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
17686
Object.keys(componentOrElement)
17687
) : invariant(false));
17688
}
17689
17690
module.exports = findDOMNode;
17691
17692
17693
}).call(this,require("FWaASH"))
17694
},{"./ReactCurrentOwner":40,"./ReactInstanceMap":68,"./ReactMount":71,"./invariant":136,"./isNode":138,"./warning":155,"FWaASH":1}],119:[function(require,module,exports){
17695
(function (process){
17696
/**
17697
* Copyright 2013-2015, Facebook, Inc.
17698
* All rights reserved.
17699
*
17700
* This source code is licensed under the BSD-style license found in the
17701
* LICENSE file in the root directory of this source tree. An additional grant
17702
* of patent rights can be found in the PATENTS file in the same directory.
17703
*
17704
* @providesModule flattenChildren
17705
*/
17706
17707
'use strict';
17708
17709
var traverseAllChildren = require("./traverseAllChildren");
17710
var warning = require("./warning");
17711
17712
/**
17713
* @param {function} traverseContext Context passed through traversal.
17714
* @param {?ReactComponent} child React child component.
17715
* @param {!string} name String name of key path to child.
17716
*/
17717
function flattenSingleChildIntoContext(traverseContext, child, name) {
17718
// We found a component instance.
17719
var result = traverseContext;
17720
var keyUnique = !result.hasOwnProperty(name);
17721
if ("production" !== process.env.NODE_ENV) {
17722
("production" !== process.env.NODE_ENV ? warning(
17723
keyUnique,
17724
'flattenChildren(...): Encountered two children with the same key, ' +
17725
'`%s`. Child keys must be unique; when two children share a key, only ' +
17726
'the first child will be used.',
17727
name
17728
) : null);
17729
}
17730
if (keyUnique && child != null) {
17731
result[name] = child;
17732
}
17733
}
17734
17735
/**
17736
* Flattens children that are typically specified as `props.children`. Any null
17737
* children will not be included in the resulting object.
17738
* @return {!object} flattened children keyed by name.
17739
*/
17740
function flattenChildren(children) {
17741
if (children == null) {
17742
return children;
17743
}
17744
var result = {};
17745
traverseAllChildren(children, flattenSingleChildIntoContext, result);
17746
return result;
17747
}
17748
17749
module.exports = flattenChildren;
17750
17751
17752
}).call(this,require("FWaASH"))
17753
},{"./traverseAllChildren":154,"./warning":155,"FWaASH":1}],120:[function(require,module,exports){
17754
/**
17755
* Copyright 2014-2015, Facebook, Inc.
17756
* All rights reserved.
17757
*
17758
* This source code is licensed under the BSD-style license found in the
17759
* LICENSE file in the root directory of this source tree. An additional grant
17760
* of patent rights can be found in the PATENTS file in the same directory.
17761
*
17762
* @providesModule focusNode
17763
*/
17764
17765
"use strict";
17766
17767
/**
17768
* @param {DOMElement} node input/textarea to focus
17769
*/
17770
function focusNode(node) {
17771
// IE8 can throw "Can't move focus to the control because it is invisible,
17772
// not enabled, or of a type that does not accept the focus." for all kinds of
17773
// reasons that are too expensive and fragile to test.
17774
try {
17775
node.focus();
17776
} catch(e) {
17777
}
17778
}
17779
17780
module.exports = focusNode;
17781
17782
17783
},{}],121:[function(require,module,exports){
17784
/**
17785
* Copyright 2013-2015, Facebook, Inc.
17786
* All rights reserved.
17787
*
17788
* This source code is licensed under the BSD-style license found in the
17789
* LICENSE file in the root directory of this source tree. An additional grant
17790
* of patent rights can be found in the PATENTS file in the same directory.
17791
*
17792
* @providesModule forEachAccumulated
17793
*/
17794
17795
'use strict';
17796
17797
/**
17798
* @param {array} an "accumulation" of items which is either an Array or
17799
* a single item. Useful when paired with the `accumulate` module. This is a
17800
* simple utility that allows us to reason about a collection of items, but
17801
* handling the case when there is exactly one item (and we do not need to
17802
* allocate an array).
17803
*/
17804
var forEachAccumulated = function(arr, cb, scope) {
17805
if (Array.isArray(arr)) {
17806
arr.forEach(cb, scope);
17807
} else if (arr) {
17808
cb.call(scope, arr);
17809
}
17810
};
17811
17812
module.exports = forEachAccumulated;
17813
17814
17815
},{}],122:[function(require,module,exports){
17816
/**
17817
* Copyright 2013-2015, Facebook, Inc.
17818
* All rights reserved.
17819
*
17820
* This source code is licensed under the BSD-style license found in the
17821
* LICENSE file in the root directory of this source tree. An additional grant
17822
* of patent rights can be found in the PATENTS file in the same directory.
17823
*
17824
* @providesModule getActiveElement
17825
* @typechecks
17826
*/
17827
17828
/**
17829
* Same as document.activeElement but wraps in a try-catch block. In IE it is
17830
* not safe to call document.activeElement if there is nothing focused.
17831
*
17832
* The activeElement will be null only if the document body is not yet defined.
17833
*/
17834
function getActiveElement() /*?DOMElement*/ {
17835
try {
17836
return document.activeElement || document.body;
17837
} catch (e) {
17838
return document.body;
17839
}
17840
}
17841
17842
module.exports = getActiveElement;
17843
17844
17845
},{}],123:[function(require,module,exports){
17846
/**
17847
* Copyright 2013-2015, Facebook, Inc.
17848
* All rights reserved.
17849
*
17850
* This source code is licensed under the BSD-style license found in the
17851
* LICENSE file in the root directory of this source tree. An additional grant
17852
* of patent rights can be found in the PATENTS file in the same directory.
17853
*
17854
* @providesModule getEventCharCode
17855
* @typechecks static-only
17856
*/
17857
17858
'use strict';
17859
17860
/**
17861
* `charCode` represents the actual "character code" and is safe to use with
17862
* `String.fromCharCode`. As such, only keys that correspond to printable
17863
* characters produce a valid `charCode`, the only exception to this is Enter.
17864
* The Tab-key is considered non-printable and does not have a `charCode`,
17865
* presumably because it does not produce a tab-character in browsers.
17866
*
17867
* @param {object} nativeEvent Native browser event.
17868
* @return {string} Normalized `charCode` property.
17869
*/
17870
function getEventCharCode(nativeEvent) {
17871
var charCode;
17872
var keyCode = nativeEvent.keyCode;
17873
17874
if ('charCode' in nativeEvent) {
17875
charCode = nativeEvent.charCode;
17876
17877
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
17878
if (charCode === 0 && keyCode === 13) {
17879
charCode = 13;
17880
}
17881
} else {
17882
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
17883
charCode = keyCode;
17884
}
17885
17886
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
17887
// Must not discard the (non-)printable Enter-key.
17888
if (charCode >= 32 || charCode === 13) {
17889
return charCode;
17890
}
17891
17892
return 0;
17893
}
17894
17895
module.exports = getEventCharCode;
17896
17897
17898
},{}],124:[function(require,module,exports){
17899
/**
17900
* Copyright 2013-2015, Facebook, Inc.
17901
* All rights reserved.
17902
*
17903
* This source code is licensed under the BSD-style license found in the
17904
* LICENSE file in the root directory of this source tree. An additional grant
17905
* of patent rights can be found in the PATENTS file in the same directory.
17906
*
17907
* @providesModule getEventKey
17908
* @typechecks static-only
17909
*/
17910
17911
'use strict';
17912
17913
var getEventCharCode = require("./getEventCharCode");
17914
17915
/**
17916
* Normalization of deprecated HTML5 `key` values
17917
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
17918
*/
17919
var normalizeKey = {
17920
'Esc': 'Escape',
17921
'Spacebar': ' ',
17922
'Left': 'ArrowLeft',
17923
'Up': 'ArrowUp',
17924
'Right': 'ArrowRight',
17925
'Down': 'ArrowDown',
17926
'Del': 'Delete',
17927
'Win': 'OS',
17928
'Menu': 'ContextMenu',
17929
'Apps': 'ContextMenu',
17930
'Scroll': 'ScrollLock',
17931
'MozPrintableKey': 'Unidentified'
17932
};
17933
17934
/**
17935
* Translation from legacy `keyCode` to HTML5 `key`
17936
* Only special keys supported, all others depend on keyboard layout or browser
17937
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
17938
*/
17939
var translateToKey = {
17940
8: 'Backspace',
17941
9: 'Tab',
17942
12: 'Clear',
17943
13: 'Enter',
17944
16: 'Shift',
17945
17: 'Control',
17946
18: 'Alt',
17947
19: 'Pause',
17948
20: 'CapsLock',
17949
27: 'Escape',
17950
32: ' ',
17951
33: 'PageUp',
17952
34: 'PageDown',
17953
35: 'End',
17954
36: 'Home',
17955
37: 'ArrowLeft',
17956
38: 'ArrowUp',
17957
39: 'ArrowRight',
17958
40: 'ArrowDown',
17959
45: 'Insert',
17960
46: 'Delete',
17961
112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
17962
118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
17963
144: 'NumLock',
17964
145: 'ScrollLock',
17965
224: 'Meta'
17966
};
17967
17968
/**
17969
* @param {object} nativeEvent Native browser event.
17970
* @return {string} Normalized `key` property.
17971
*/
17972
function getEventKey(nativeEvent) {
17973
if (nativeEvent.key) {
17974
// Normalize inconsistent values reported by browsers due to
17975
// implementations of a working draft specification.
17976
17977
// FireFox implements `key` but returns `MozPrintableKey` for all
17978
// printable characters (normalized to `Unidentified`), ignore it.
17979
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
17980
if (key !== 'Unidentified') {
17981
return key;
17982
}
17983
}
17984
17985
// Browser does not implement `key`, polyfill as much of it as we can.
17986
if (nativeEvent.type === 'keypress') {
17987
var charCode = getEventCharCode(nativeEvent);
17988
17989
// The enter-key is technically both printable and non-printable and can
17990
// thus be captured by `keypress`, no other non-printable key should.
17991
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
17992
}
17993
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
17994
// While user keyboard layout determines the actual meaning of each
17995
// `keyCode` value, almost all function keys have a universal value.
17996
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
17997
}
17998
return '';
17999
}
18000
18001
module.exports = getEventKey;
18002
18003
18004
},{"./getEventCharCode":123}],125:[function(require,module,exports){
18005
/**
18006
* Copyright 2013-2015, Facebook, Inc.
18007
* All rights reserved.
18008
*
18009
* This source code is licensed under the BSD-style license found in the
18010
* LICENSE file in the root directory of this source tree. An additional grant
18011
* of patent rights can be found in the PATENTS file in the same directory.
18012
*
18013
* @providesModule getEventModifierState
18014
* @typechecks static-only
18015
*/
18016
18017
'use strict';
18018
18019
/**
18020
* Translation from modifier key to the associated property in the event.
18021
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
18022
*/
18023
18024
var modifierKeyToProp = {
18025
'Alt': 'altKey',
18026
'Control': 'ctrlKey',
18027
'Meta': 'metaKey',
18028
'Shift': 'shiftKey'
18029
};
18030
18031
// IE8 does not implement getModifierState so we simply map it to the only
18032
// modifier keys exposed by the event itself, does not support Lock-keys.
18033
// Currently, all major browsers except Chrome seems to support Lock-keys.
18034
function modifierStateGetter(keyArg) {
18035
/*jshint validthis:true */
18036
var syntheticEvent = this;
18037
var nativeEvent = syntheticEvent.nativeEvent;
18038
if (nativeEvent.getModifierState) {
18039
return nativeEvent.getModifierState(keyArg);
18040
}
18041
var keyProp = modifierKeyToProp[keyArg];
18042
return keyProp ? !!nativeEvent[keyProp] : false;
18043
}
18044
18045
function getEventModifierState(nativeEvent) {
18046
return modifierStateGetter;
18047
}
18048
18049
module.exports = getEventModifierState;
18050
18051
18052
},{}],126:[function(require,module,exports){
18053
/**
18054
* Copyright 2013-2015, Facebook, Inc.
18055
* All rights reserved.
18056
*
18057
* This source code is licensed under the BSD-style license found in the
18058
* LICENSE file in the root directory of this source tree. An additional grant
18059
* of patent rights can be found in the PATENTS file in the same directory.
18060
*
18061
* @providesModule getEventTarget
18062
* @typechecks static-only
18063
*/
18064
18065
'use strict';
18066
18067
/**
18068
* Gets the target node from a native browser event by accounting for
18069
* inconsistencies in browser DOM APIs.
18070
*
18071
* @param {object} nativeEvent Native browser event.
18072
* @return {DOMEventTarget} Target node.
18073
*/
18074
function getEventTarget(nativeEvent) {
18075
var target = nativeEvent.target || nativeEvent.srcElement || window;
18076
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
18077
// @see http://www.quirksmode.org/js/events_properties.html
18078
return target.nodeType === 3 ? target.parentNode : target;
18079
}
18080
18081
module.exports = getEventTarget;
18082
18083
18084
},{}],127:[function(require,module,exports){
18085
/**
18086
* Copyright 2013-2015, Facebook, Inc.
18087
* All rights reserved.
18088
*
18089
* This source code is licensed under the BSD-style license found in the
18090
* LICENSE file in the root directory of this source tree. An additional grant
18091
* of patent rights can be found in the PATENTS file in the same directory.
18092
*
18093
* @providesModule getIteratorFn
18094
* @typechecks static-only
18095
*/
18096
18097
'use strict';
18098
18099
/* global Symbol */
18100
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
18101
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
18102
18103
/**
18104
* Returns the iterator method function contained on the iterable object.
18105
*
18106
* Be sure to invoke the function with the iterable as context:
18107
*
18108
* var iteratorFn = getIteratorFn(myIterable);
18109
* if (iteratorFn) {
18110
* var iterator = iteratorFn.call(myIterable);
18111
* ...
18112
* }
18113
*
18114
* @param {?object} maybeIterable
18115
* @return {?function}
18116
*/
18117
function getIteratorFn(maybeIterable) {
18118
var iteratorFn = maybeIterable && (
18119
(ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
18120
);
18121
if (typeof iteratorFn === 'function') {
18122
return iteratorFn;
18123
}
18124
}
18125
18126
module.exports = getIteratorFn;
18127
18128
18129
},{}],128:[function(require,module,exports){
18130
(function (process){
18131
/**
18132
* Copyright 2013-2015, Facebook, Inc.
18133
* All rights reserved.
18134
*
18135
* This source code is licensed under the BSD-style license found in the
18136
* LICENSE file in the root directory of this source tree. An additional grant
18137
* of patent rights can be found in the PATENTS file in the same directory.
18138
*
18139
* @providesModule getMarkupWrap
18140
*/
18141
18142
var ExecutionEnvironment = require("./ExecutionEnvironment");
18143
18144
var invariant = require("./invariant");
18145
18146
/**
18147
* Dummy container used to detect which wraps are necessary.
18148
*/
18149
var dummyNode =
18150
ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
18151
18152
/**
18153
* Some browsers cannot use `innerHTML` to render certain elements standalone,
18154
* so we wrap them, render the wrapped nodes, then extract the desired node.
18155
*
18156
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
18157
*/
18158
var shouldWrap = {
18159
// Force wrapping for SVG elements because if they get created inside a <div>,
18160
// they will be initialized in the wrong namespace (and will not display).
18161
'circle': true,
18162
'defs': true,
18163
'ellipse': true,
18164
'g': true,
18165
'line': true,
18166
'linearGradient': true,
18167
'path': true,
18168
'polygon': true,
18169
'polyline': true,
18170
'radialGradient': true,
18171
'rect': true,
18172
'stop': true,
18173
'text': true
18174
};
18175
18176
var selectWrap = [1, '<select multiple="true">', '</select>'];
18177
var tableWrap = [1, '<table>', '</table>'];
18178
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
18179
18180
var svgWrap = [1, '<svg>', '</svg>'];
18181
18182
var markupWrap = {
18183
'*': [1, '?<div>', '</div>'],
18184
18185
'area': [1, '<map>', '</map>'],
18186
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
18187
'legend': [1, '<fieldset>', '</fieldset>'],
18188
'param': [1, '<object>', '</object>'],
18189
'tr': [2, '<table><tbody>', '</tbody></table>'],
18190
18191
'optgroup': selectWrap,
18192
'option': selectWrap,
18193
18194
'caption': tableWrap,
18195
'colgroup': tableWrap,
18196
'tbody': tableWrap,
18197
'tfoot': tableWrap,
18198
'thead': tableWrap,
18199
18200
'td': trWrap,
18201
'th': trWrap,
18202
18203
'circle': svgWrap,
18204
'defs': svgWrap,
18205
'ellipse': svgWrap,
18206
'g': svgWrap,
18207
'line': svgWrap,
18208
'linearGradient': svgWrap,
18209
'path': svgWrap,
18210
'polygon': svgWrap,
18211
'polyline': svgWrap,
18212
'radialGradient': svgWrap,
18213
'rect': svgWrap,
18214
'stop': svgWrap,
18215
'text': svgWrap
18216
};
18217
18218
/**
18219
* Gets the markup wrap configuration for the supplied `nodeName`.
18220
*
18221
* NOTE: This lazily detects which wraps are necessary for the current browser.
18222
*
18223
* @param {string} nodeName Lowercase `nodeName`.
18224
* @return {?array} Markup wrap configuration, if applicable.
18225
*/
18226
function getMarkupWrap(nodeName) {
18227
("production" !== process.env.NODE_ENV ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
18228
if (!markupWrap.hasOwnProperty(nodeName)) {
18229
nodeName = '*';
18230
}
18231
if (!shouldWrap.hasOwnProperty(nodeName)) {
18232
if (nodeName === '*') {
18233
dummyNode.innerHTML = '<link />';
18234
} else {
18235
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
18236
}
18237
shouldWrap[nodeName] = !dummyNode.firstChild;
18238
}
18239
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
18240
}
18241
18242
18243
module.exports = getMarkupWrap;
18244
18245
18246
}).call(this,require("FWaASH"))
18247
},{"./ExecutionEnvironment":21,"./invariant":136,"FWaASH":1}],129:[function(require,module,exports){
18248
/**
18249
* Copyright 2013-2015, Facebook, Inc.
18250
* All rights reserved.
18251
*
18252
* This source code is licensed under the BSD-style license found in the
18253
* LICENSE file in the root directory of this source tree. An additional grant
18254
* of patent rights can be found in the PATENTS file in the same directory.
18255
*
18256
* @providesModule getNodeForCharacterOffset
18257
*/
18258
18259
'use strict';
18260
18261
/**
18262
* Given any node return the first leaf node without children.
18263
*
18264
* @param {DOMElement|DOMTextNode} node
18265
* @return {DOMElement|DOMTextNode}
18266
*/
18267
function getLeafNode(node) {
18268
while (node && node.firstChild) {
18269
node = node.firstChild;
18270
}
18271
return node;
18272
}
18273
18274
/**
18275
* Get the next sibling within a container. This will walk up the
18276
* DOM if a node's siblings have been exhausted.
18277
*
18278
* @param {DOMElement|DOMTextNode} node
18279
* @return {?DOMElement|DOMTextNode}
18280
*/
18281
function getSiblingNode(node) {
18282
while (node) {
18283
if (node.nextSibling) {
18284
return node.nextSibling;
18285
}
18286
node = node.parentNode;
18287
}
18288
}
18289
18290
/**
18291
* Get object describing the nodes which contain characters at offset.
18292
*
18293
* @param {DOMElement|DOMTextNode} root
18294
* @param {number} offset
18295
* @return {?object}
18296
*/
18297
function getNodeForCharacterOffset(root, offset) {
18298
var node = getLeafNode(root);
18299
var nodeStart = 0;
18300
var nodeEnd = 0;
18301
18302
while (node) {
18303
if (node.nodeType === 3) {
18304
nodeEnd = nodeStart + node.textContent.length;
18305
18306
if (nodeStart <= offset && nodeEnd >= offset) {
18307
return {
18308
node: node,
18309
offset: offset - nodeStart
18310
};
18311
}
18312
18313
nodeStart = nodeEnd;
18314
}
18315
18316
node = getLeafNode(getSiblingNode(node));
18317
}
18318
}
18319
18320
module.exports = getNodeForCharacterOffset;
18321
18322
18323
},{}],130:[function(require,module,exports){
18324
/**
18325
* Copyright 2013-2015, Facebook, Inc.
18326
* All rights reserved.
18327
*
18328
* This source code is licensed under the BSD-style license found in the
18329
* LICENSE file in the root directory of this source tree. An additional grant
18330
* of patent rights can be found in the PATENTS file in the same directory.
18331
*
18332
* @providesModule getReactRootElementInContainer
18333
*/
18334
18335
'use strict';
18336
18337
var DOC_NODE_TYPE = 9;
18338
18339
/**
18340
* @param {DOMElement|DOMDocument} container DOM element that may contain
18341
* a React component
18342
* @return {?*} DOM element that may have the reactRoot ID, or null.
18343
*/
18344
function getReactRootElementInContainer(container) {
18345
if (!container) {
18346
return null;
18347
}
18348
18349
if (container.nodeType === DOC_NODE_TYPE) {
18350
return container.documentElement;
18351
} else {
18352
return container.firstChild;
18353
}
18354
}
18355
18356
module.exports = getReactRootElementInContainer;
18357
18358
18359
},{}],131:[function(require,module,exports){
18360
/**
18361
* Copyright 2013-2015, Facebook, Inc.
18362
* All rights reserved.
18363
*
18364
* This source code is licensed under the BSD-style license found in the
18365
* LICENSE file in the root directory of this source tree. An additional grant
18366
* of patent rights can be found in the PATENTS file in the same directory.
18367
*
18368
* @providesModule getTextContentAccessor
18369
*/
18370
18371
'use strict';
18372
18373
var ExecutionEnvironment = require("./ExecutionEnvironment");
18374
18375
var contentKey = null;
18376
18377
/**
18378
* Gets the key used to access text content on a DOM node.
18379
*
18380
* @return {?string} Key used to access text content.
18381
* @internal
18382
*/
18383
function getTextContentAccessor() {
18384
if (!contentKey && ExecutionEnvironment.canUseDOM) {
18385
// Prefer textContent to innerText because many browsers support both but
18386
// SVG <text> elements don't support innerText even when <div> does.
18387
contentKey = 'textContent' in document.documentElement ?
18388
'textContent' :
18389
'innerText';
18390
}
18391
return contentKey;
18392
}
18393
18394
module.exports = getTextContentAccessor;
18395
18396
18397
},{"./ExecutionEnvironment":21}],132:[function(require,module,exports){
18398
/**
18399
* Copyright 2013-2015, Facebook, Inc.
18400
* All rights reserved.
18401
*
18402
* This source code is licensed under the BSD-style license found in the
18403
* LICENSE file in the root directory of this source tree. An additional grant
18404
* of patent rights can be found in the PATENTS file in the same directory.
18405
*
18406
* @providesModule getUnboundedScrollPosition
18407
* @typechecks
18408
*/
18409
18410
"use strict";
18411
18412
/**
18413
* Gets the scroll position of the supplied element or window.
18414
*
18415
* The return values are unbounded, unlike `getScrollPosition`. This means they
18416
* may be negative or exceed the element boundaries (which is possible using
18417
* inertial scrolling).
18418
*
18419
* @param {DOMWindow|DOMElement} scrollable
18420
* @return {object} Map with `x` and `y` keys.
18421
*/
18422
function getUnboundedScrollPosition(scrollable) {
18423
if (scrollable === window) {
18424
return {
18425
x: window.pageXOffset || document.documentElement.scrollLeft,
18426
y: window.pageYOffset || document.documentElement.scrollTop
18427
};
18428
}
18429
return {
18430
x: scrollable.scrollLeft,
18431
y: scrollable.scrollTop
18432
};
18433
}
18434
18435
module.exports = getUnboundedScrollPosition;
18436
18437
18438
},{}],133:[function(require,module,exports){
18439
/**
18440
* Copyright 2013-2015, Facebook, Inc.
18441
* All rights reserved.
18442
*
18443
* This source code is licensed under the BSD-style license found in the
18444
* LICENSE file in the root directory of this source tree. An additional grant
18445
* of patent rights can be found in the PATENTS file in the same directory.
18446
*
18447
* @providesModule hyphenate
18448
* @typechecks
18449
*/
18450
18451
var _uppercasePattern = /([A-Z])/g;
18452
18453
/**
18454
* Hyphenates a camelcased string, for example:
18455
*
18456
* > hyphenate('backgroundColor')
18457
* < "background-color"
18458
*
18459
* For CSS style names, use `hyphenateStyleName` instead which works properly
18460
* with all vendor prefixes, including `ms`.
18461
*
18462
* @param {string} string
18463
* @return {string}
18464
*/
18465
function hyphenate(string) {
18466
return string.replace(_uppercasePattern, '-$1').toLowerCase();
18467
}
18468
18469
module.exports = hyphenate;
18470
18471
18472
},{}],134:[function(require,module,exports){
18473
/**
18474
* Copyright 2013-2015, Facebook, Inc.
18475
* All rights reserved.
18476
*
18477
* This source code is licensed under the BSD-style license found in the
18478
* LICENSE file in the root directory of this source tree. An additional grant
18479
* of patent rights can be found in the PATENTS file in the same directory.
18480
*
18481
* @providesModule hyphenateStyleName
18482
* @typechecks
18483
*/
18484
18485
"use strict";
18486
18487
var hyphenate = require("./hyphenate");
18488
18489
var msPattern = /^ms-/;
18490
18491
/**
18492
* Hyphenates a camelcased CSS property name, for example:
18493
*
18494
* > hyphenateStyleName('backgroundColor')
18495
* < "background-color"
18496
* > hyphenateStyleName('MozTransition')
18497
* < "-moz-transition"
18498
* > hyphenateStyleName('msTransition')
18499
* < "-ms-transition"
18500
*
18501
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
18502
* is converted to `-ms-`.
18503
*
18504
* @param {string} string
18505
* @return {string}
18506
*/
18507
function hyphenateStyleName(string) {
18508
return hyphenate(string).replace(msPattern, '-ms-');
18509
}
18510
18511
module.exports = hyphenateStyleName;
18512
18513
18514
},{"./hyphenate":133}],135:[function(require,module,exports){
18515
(function (process){
18516
/**
18517
* Copyright 2013-2015, Facebook, Inc.
18518
* All rights reserved.
18519
*
18520
* This source code is licensed under the BSD-style license found in the
18521
* LICENSE file in the root directory of this source tree. An additional grant
18522
* of patent rights can be found in the PATENTS file in the same directory.
18523
*
18524
* @providesModule instantiateReactComponent
18525
* @typechecks static-only
18526
*/
18527
18528
'use strict';
18529
18530
var ReactCompositeComponent = require("./ReactCompositeComponent");
18531
var ReactEmptyComponent = require("./ReactEmptyComponent");
18532
var ReactNativeComponent = require("./ReactNativeComponent");
18533
18534
var assign = require("./Object.assign");
18535
var invariant = require("./invariant");
18536
var warning = require("./warning");
18537
18538
// To avoid a cyclic dependency, we create the final class in this module
18539
var ReactCompositeComponentWrapper = function() { };
18540
assign(
18541
ReactCompositeComponentWrapper.prototype,
18542
ReactCompositeComponent.Mixin,
18543
{
18544
_instantiateReactComponent: instantiateReactComponent
18545
}
18546
);
18547
18548
/**
18549
* Check if the type reference is a known internal type. I.e. not a user
18550
* provided composite type.
18551
*
18552
* @param {function} type
18553
* @return {boolean} Returns true if this is a valid internal type.
18554
*/
18555
function isInternalComponentType(type) {
18556
return (
18557
typeof type === 'function' &&
18558
typeof type.prototype.mountComponent === 'function' &&
18559
typeof type.prototype.receiveComponent === 'function'
18560
);
18561
}
18562
18563
/**
18564
* Given a ReactNode, create an instance that will actually be mounted.
18565
*
18566
* @param {ReactNode} node
18567
* @param {*} parentCompositeType The composite type that resolved this.
18568
* @return {object} A new instance of the element's constructor.
18569
* @protected
18570
*/
18571
function instantiateReactComponent(node, parentCompositeType) {
18572
var instance;
18573
18574
if (node === null || node === false) {
18575
node = ReactEmptyComponent.emptyElement;
18576
}
18577
18578
if (typeof node === 'object') {
18579
var element = node;
18580
if ("production" !== process.env.NODE_ENV) {
18581
("production" !== process.env.NODE_ENV ? warning(
18582
element && (typeof element.type === 'function' ||
18583
typeof element.type === 'string'),
18584
'Only functions or strings can be mounted as React components.'
18585
) : null);
18586
}
18587
18588
// Special case string values
18589
if (parentCompositeType === element.type &&
18590
typeof element.type === 'string') {
18591
// Avoid recursion if the wrapper renders itself.
18592
instance = ReactNativeComponent.createInternalComponent(element);
18593
// All native components are currently wrapped in a composite so we're
18594
// safe to assume that this is what we should instantiate.
18595
} else if (isInternalComponentType(element.type)) {
18596
// This is temporarily available for custom components that are not string
18597
// represenations. I.e. ART. Once those are updated to use the string
18598
// representation, we can drop this code path.
18599
instance = new element.type(element);
18600
} else {
18601
instance = new ReactCompositeComponentWrapper();
18602
}
18603
} else if (typeof node === 'string' || typeof node === 'number') {
18604
instance = ReactNativeComponent.createInstanceForText(node);
18605
} else {
18606
("production" !== process.env.NODE_ENV ? invariant(
18607
false,
18608
'Encountered invalid React node of type %s',
18609
typeof node
18610
) : invariant(false));
18611
}
18612
18613
if ("production" !== process.env.NODE_ENV) {
18614
("production" !== process.env.NODE_ENV ? warning(
18615
typeof instance.construct === 'function' &&
18616
typeof instance.mountComponent === 'function' &&
18617
typeof instance.receiveComponent === 'function' &&
18618
typeof instance.unmountComponent === 'function',
18619
'Only React Components can be mounted.'
18620
) : null);
18621
}
18622
18623
// Sets up the instance. This can probably just move into the constructor now.
18624
instance.construct(node);
18625
18626
// These two fields are used by the DOM and ART diffing algorithms
18627
// respectively. Instead of using expandos on components, we should be
18628
// storing the state needed by the diffing algorithms elsewhere.
18629
instance._mountIndex = 0;
18630
instance._mountImage = null;
18631
18632
if ("production" !== process.env.NODE_ENV) {
18633
instance._isOwnerNecessary = false;
18634
instance._warnedAboutRefsInRender = false;
18635
}
18636
18637
// Internal instances should fully constructed at this point, so they should
18638
// not get any new fields added to them at this point.
18639
if ("production" !== process.env.NODE_ENV) {
18640
if (Object.preventExtensions) {
18641
Object.preventExtensions(instance);
18642
}
18643
}
18644
18645
return instance;
18646
}
18647
18648
module.exports = instantiateReactComponent;
18649
18650
18651
}).call(this,require("FWaASH"))
18652
},{"./Object.assign":27,"./ReactCompositeComponent":38,"./ReactEmptyComponent":60,"./ReactNativeComponent":74,"./invariant":136,"./warning":155,"FWaASH":1}],136:[function(require,module,exports){
18653
(function (process){
18654
/**
18655
* Copyright 2013-2015, Facebook, Inc.
18656
* All rights reserved.
18657
*
18658
* This source code is licensed under the BSD-style license found in the
18659
* LICENSE file in the root directory of this source tree. An additional grant
18660
* of patent rights can be found in the PATENTS file in the same directory.
18661
*
18662
* @providesModule invariant
18663
*/
18664
18665
"use strict";
18666
18667
/**
18668
* Use invariant() to assert state which your program assumes to be true.
18669
*
18670
* Provide sprintf-style format (only %s is supported) and arguments
18671
* to provide information about what broke and what you were
18672
* expecting.
18673
*
18674
* The invariant message will be stripped in production, but the invariant
18675
* will remain to ensure logic does not differ in production.
18676
*/
18677
18678
var invariant = function(condition, format, a, b, c, d, e, f) {
18679
if ("production" !== process.env.NODE_ENV) {
18680
if (format === undefined) {
18681
throw new Error('invariant requires an error message argument');
18682
}
18683
}
18684
18685
if (!condition) {
18686
var error;
18687
if (format === undefined) {
18688
error = new Error(
18689
'Minified exception occurred; use the non-minified dev environment ' +
18690
'for the full error message and additional helpful warnings.'
18691
);
18692
} else {
18693
var args = [a, b, c, d, e, f];
18694
var argIndex = 0;
18695
error = new Error(
18696
'Invariant Violation: ' +
18697
format.replace(/%s/g, function() { return args[argIndex++]; })
18698
);
18699
}
18700
18701
error.framesToPop = 1; // we don't care about invariant's own frame
18702
throw error;
18703
}
18704
};
18705
18706
module.exports = invariant;
18707
18708
18709
}).call(this,require("FWaASH"))
18710
},{"FWaASH":1}],137:[function(require,module,exports){
18711
/**
18712
* Copyright 2013-2015, Facebook, Inc.
18713
* All rights reserved.
18714
*
18715
* This source code is licensed under the BSD-style license found in the
18716
* LICENSE file in the root directory of this source tree. An additional grant
18717
* of patent rights can be found in the PATENTS file in the same directory.
18718
*
18719
* @providesModule isEventSupported
18720
*/
18721
18722
'use strict';
18723
18724
var ExecutionEnvironment = require("./ExecutionEnvironment");
18725
18726
var useHasFeature;
18727
if (ExecutionEnvironment.canUseDOM) {
18728
useHasFeature =
18729
document.implementation &&
18730
document.implementation.hasFeature &&
18731
// always returns true in newer browsers as per the standard.
18732
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
18733
document.implementation.hasFeature('', '') !== true;
18734
}
18735
18736
/**
18737
* Checks if an event is supported in the current execution environment.
18738
*
18739
* NOTE: This will not work correctly for non-generic events such as `change`,
18740
* `reset`, `load`, `error`, and `select`.
18741
*
18742
* Borrows from Modernizr.
18743
*
18744
* @param {string} eventNameSuffix Event name, e.g. "click".
18745
* @param {?boolean} capture Check if the capture phase is supported.
18746
* @return {boolean} True if the event is supported.
18747
* @internal
18748
* @license Modernizr 3.0.0pre (Custom Build) | MIT
18749
*/
18750
function isEventSupported(eventNameSuffix, capture) {
18751
if (!ExecutionEnvironment.canUseDOM ||
18752
capture && !('addEventListener' in document)) {
18753
return false;
18754
}
18755
18756
var eventName = 'on' + eventNameSuffix;
18757
var isSupported = eventName in document;
18758
18759
if (!isSupported) {
18760
var element = document.createElement('div');
18761
element.setAttribute(eventName, 'return;');
18762
isSupported = typeof element[eventName] === 'function';
18763
}
18764
18765
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
18766
// This is the only way to test support for the `wheel` event in IE9+.
18767
isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
18768
}
18769
18770
return isSupported;
18771
}
18772
18773
module.exports = isEventSupported;
18774
18775
18776
},{"./ExecutionEnvironment":21}],138:[function(require,module,exports){
18777
/**
18778
* Copyright 2013-2015, Facebook, Inc.
18779
* All rights reserved.
18780
*
18781
* This source code is licensed under the BSD-style license found in the
18782
* LICENSE file in the root directory of this source tree. An additional grant
18783
* of patent rights can be found in the PATENTS file in the same directory.
18784
*
18785
* @providesModule isNode
18786
* @typechecks
18787
*/
18788
18789
/**
18790
* @param {*} object The object to check.
18791
* @return {boolean} Whether or not the object is a DOM node.
18792
*/
18793
function isNode(object) {
18794
return !!(object && (
18795
((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
18796
typeof object.nodeType === 'number' &&
18797
typeof object.nodeName === 'string'))
18798
));
18799
}
18800
18801
module.exports = isNode;
18802
18803
18804
},{}],139:[function(require,module,exports){
18805
/**
18806
* Copyright 2013-2015, Facebook, Inc.
18807
* All rights reserved.
18808
*
18809
* This source code is licensed under the BSD-style license found in the
18810
* LICENSE file in the root directory of this source tree. An additional grant
18811
* of patent rights can be found in the PATENTS file in the same directory.
18812
*
18813
* @providesModule isTextInputElement
18814
*/
18815
18816
'use strict';
18817
18818
/**
18819
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
18820
*/
18821
var supportedInputTypes = {
18822
'color': true,
18823
'date': true,
18824
'datetime': true,
18825
'datetime-local': true,
18826
'email': true,
18827
'month': true,
18828
'number': true,
18829
'password': true,
18830
'range': true,
18831
'search': true,
18832
'tel': true,
18833
'text': true,
18834
'time': true,
18835
'url': true,
18836
'week': true
18837
};
18838
18839
function isTextInputElement(elem) {
18840
return elem && (
18841
(elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
18842
);
18843
}
18844
18845
module.exports = isTextInputElement;
18846
18847
18848
},{}],140:[function(require,module,exports){
18849
/**
18850
* Copyright 2013-2015, Facebook, Inc.
18851
* All rights reserved.
18852
*
18853
* This source code is licensed under the BSD-style license found in the
18854
* LICENSE file in the root directory of this source tree. An additional grant
18855
* of patent rights can be found in the PATENTS file in the same directory.
18856
*
18857
* @providesModule isTextNode
18858
* @typechecks
18859
*/
18860
18861
var isNode = require("./isNode");
18862
18863
/**
18864
* @param {*} object The object to check.
18865
* @return {boolean} Whether or not the object is a DOM text node.
18866
*/
18867
function isTextNode(object) {
18868
return isNode(object) && object.nodeType == 3;
18869
}
18870
18871
module.exports = isTextNode;
18872
18873
18874
},{"./isNode":138}],141:[function(require,module,exports){
18875
(function (process){
18876
/**
18877
* Copyright 2013-2015, Facebook, Inc.
18878
* All rights reserved.
18879
*
18880
* This source code is licensed under the BSD-style license found in the
18881
* LICENSE file in the root directory of this source tree. An additional grant
18882
* of patent rights can be found in the PATENTS file in the same directory.
18883
*
18884
* @providesModule keyMirror
18885
* @typechecks static-only
18886
*/
18887
18888
'use strict';
18889
18890
var invariant = require("./invariant");
18891
18892
/**
18893
* Constructs an enumeration with keys equal to their value.
18894
*
18895
* For example:
18896
*
18897
* var COLORS = keyMirror({blue: null, red: null});
18898
* var myColor = COLORS.blue;
18899
* var isColorValid = !!COLORS[myColor];
18900
*
18901
* The last line could not be performed if the values of the generated enum were
18902
* not equal to their keys.
18903
*
18904
* Input: {key1: val1, key2: val2}
18905
* Output: {key1: key1, key2: key2}
18906
*
18907
* @param {object} obj
18908
* @return {object}
18909
*/
18910
var keyMirror = function(obj) {
18911
var ret = {};
18912
var key;
18913
("production" !== process.env.NODE_ENV ? invariant(
18914
obj instanceof Object && !Array.isArray(obj),
18915
'keyMirror(...): Argument must be an object.'
18916
) : invariant(obj instanceof Object && !Array.isArray(obj)));
18917
for (key in obj) {
18918
if (!obj.hasOwnProperty(key)) {
18919
continue;
18920
}
18921
ret[key] = key;
18922
}
18923
return ret;
18924
};
18925
18926
module.exports = keyMirror;
18927
18928
18929
}).call(this,require("FWaASH"))
18930
},{"./invariant":136,"FWaASH":1}],142:[function(require,module,exports){
18931
/**
18932
* Copyright 2013-2015, Facebook, Inc.
18933
* All rights reserved.
18934
*
18935
* This source code is licensed under the BSD-style license found in the
18936
* LICENSE file in the root directory of this source tree. An additional grant
18937
* of patent rights can be found in the PATENTS file in the same directory.
18938
*
18939
* @providesModule keyOf
18940
*/
18941
18942
/**
18943
* Allows extraction of a minified key. Let's the build system minify keys
18944
* without loosing the ability to dynamically use key strings as values
18945
* themselves. Pass in an object with a single key/val pair and it will return
18946
* you the string key of that single record. Suppose you want to grab the
18947
* value for a key 'className' inside of an object. Key/val minification may
18948
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
18949
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
18950
* reuse those resolutions.
18951
*/
18952
var keyOf = function(oneKeyObj) {
18953
var key;
18954
for (key in oneKeyObj) {
18955
if (!oneKeyObj.hasOwnProperty(key)) {
18956
continue;
18957
}
18958
return key;
18959
}
18960
return null;
18961
};
18962
18963
18964
module.exports = keyOf;
18965
18966
18967
},{}],143:[function(require,module,exports){
18968
/**
18969
* Copyright 2013-2015, Facebook, Inc.
18970
* All rights reserved.
18971
*
18972
* This source code is licensed under the BSD-style license found in the
18973
* LICENSE file in the root directory of this source tree. An additional grant
18974
* of patent rights can be found in the PATENTS file in the same directory.
18975
*
18976
* @providesModule mapObject
18977
*/
18978
18979
'use strict';
18980
18981
var hasOwnProperty = Object.prototype.hasOwnProperty;
18982
18983
/**
18984
* Executes the provided `callback` once for each enumerable own property in the
18985
* object and constructs a new object from the results. The `callback` is
18986
* invoked with three arguments:
18987
*
18988
* - the property value
18989
* - the property name
18990
* - the object being traversed
18991
*
18992
* Properties that are added after the call to `mapObject` will not be visited
18993
* by `callback`. If the values of existing properties are changed, the value
18994
* passed to `callback` will be the value at the time `mapObject` visits them.
18995
* Properties that are deleted before being visited are not visited.
18996
*
18997
* @grep function objectMap()
18998
* @grep function objMap()
18999
*
19000
* @param {?object} object
19001
* @param {function} callback
19002
* @param {*} context
19003
* @return {?object}
19004
*/
19005
function mapObject(object, callback, context) {
19006
if (!object) {
19007
return null;
19008
}
19009
var result = {};
19010
for (var name in object) {
19011
if (hasOwnProperty.call(object, name)) {
19012
result[name] = callback.call(context, object[name], name, object);
19013
}
19014
}
19015
return result;
19016
}
19017
19018
module.exports = mapObject;
19019
19020
19021
},{}],144:[function(require,module,exports){
19022
/**
19023
* Copyright 2013-2015, Facebook, Inc.
19024
* All rights reserved.
19025
*
19026
* This source code is licensed under the BSD-style license found in the
19027
* LICENSE file in the root directory of this source tree. An additional grant
19028
* of patent rights can be found in the PATENTS file in the same directory.
19029
*
19030
* @providesModule memoizeStringOnly
19031
* @typechecks static-only
19032
*/
19033
19034
'use strict';
19035
19036
/**
19037
* Memoizes the return value of a function that accepts one string argument.
19038
*
19039
* @param {function} callback
19040
* @return {function}
19041
*/
19042
function memoizeStringOnly(callback) {
19043
var cache = {};
19044
return function(string) {
19045
if (!cache.hasOwnProperty(string)) {
19046
cache[string] = callback.call(this, string);
19047
}
19048
return cache[string];
19049
};
19050
}
19051
19052
module.exports = memoizeStringOnly;
19053
19054
19055
},{}],145:[function(require,module,exports){
19056
(function (process){
19057
/**
19058
* Copyright 2013-2015, Facebook, Inc.
19059
* All rights reserved.
19060
*
19061
* This source code is licensed under the BSD-style license found in the
19062
* LICENSE file in the root directory of this source tree. An additional grant
19063
* of patent rights can be found in the PATENTS file in the same directory.
19064
*
19065
* @providesModule onlyChild
19066
*/
19067
'use strict';
19068
19069
var ReactElement = require("./ReactElement");
19070
19071
var invariant = require("./invariant");
19072
19073
/**
19074
* Returns the first child in a collection of children and verifies that there
19075
* is only one child in the collection. The current implementation of this
19076
* function assumes that a single child gets passed without a wrapper, but the
19077
* purpose of this helper function is to abstract away the particular structure
19078
* of children.
19079
*
19080
* @param {?object} children Child collection structure.
19081
* @return {ReactComponent} The first and only `ReactComponent` contained in the
19082
* structure.
19083
*/
19084
function onlyChild(children) {
19085
("production" !== process.env.NODE_ENV ? invariant(
19086
ReactElement.isValidElement(children),
19087
'onlyChild must be passed a children with exactly one child.'
19088
) : invariant(ReactElement.isValidElement(children)));
19089
return children;
19090
}
19091
19092
module.exports = onlyChild;
19093
19094
19095
}).call(this,require("FWaASH"))
19096
},{"./ReactElement":58,"./invariant":136,"FWaASH":1}],146:[function(require,module,exports){
19097
/**
19098
* Copyright 2013-2015, Facebook, Inc.
19099
* All rights reserved.
19100
*
19101
* This source code is licensed under the BSD-style license found in the
19102
* LICENSE file in the root directory of this source tree. An additional grant
19103
* of patent rights can be found in the PATENTS file in the same directory.
19104
*
19105
* @providesModule performance
19106
* @typechecks
19107
*/
19108
19109
"use strict";
19110
19111
var ExecutionEnvironment = require("./ExecutionEnvironment");
19112
19113
var performance;
19114
19115
if (ExecutionEnvironment.canUseDOM) {
19116
performance =
19117
window.performance ||
19118
window.msPerformance ||
19119
window.webkitPerformance;
19120
}
19121
19122
module.exports = performance || {};
19123
19124
19125
},{"./ExecutionEnvironment":21}],147:[function(require,module,exports){
19126
/**
19127
* Copyright 2013-2015, Facebook, Inc.
19128
* All rights reserved.
19129
*
19130
* This source code is licensed under the BSD-style license found in the
19131
* LICENSE file in the root directory of this source tree. An additional grant
19132
* of patent rights can be found in the PATENTS file in the same directory.
19133
*
19134
* @providesModule performanceNow
19135
* @typechecks
19136
*/
19137
19138
var performance = require("./performance");
19139
19140
/**
19141
* Detect if we can use `window.performance.now()` and gracefully fallback to
19142
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
19143
* because of Facebook's testing infrastructure.
19144
*/
19145
if (!performance || !performance.now) {
19146
performance = Date;
19147
}
19148
19149
var performanceNow = performance.now.bind(performance);
19150
19151
module.exports = performanceNow;
19152
19153
19154
},{"./performance":146}],148:[function(require,module,exports){
19155
/**
19156
* Copyright 2013-2015, Facebook, Inc.
19157
* All rights reserved.
19158
*
19159
* This source code is licensed under the BSD-style license found in the
19160
* LICENSE file in the root directory of this source tree. An additional grant
19161
* of patent rights can be found in the PATENTS file in the same directory.
19162
*
19163
* @providesModule quoteAttributeValueForBrowser
19164
*/
19165
19166
'use strict';
19167
19168
var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
19169
19170
/**
19171
* Escapes attribute value to prevent scripting attacks.
19172
*
19173
* @param {*} value Value to escape.
19174
* @return {string} An escaped string.
19175
*/
19176
function quoteAttributeValueForBrowser(value) {
19177
return '"' + escapeTextContentForBrowser(value) + '"';
19178
}
19179
19180
module.exports = quoteAttributeValueForBrowser;
19181
19182
19183
},{"./escapeTextContentForBrowser":117}],149:[function(require,module,exports){
19184
/**
19185
* Copyright 2013-2015, Facebook, Inc.
19186
* All rights reserved.
19187
*
19188
* This source code is licensed under the BSD-style license found in the
19189
* LICENSE file in the root directory of this source tree. An additional grant
19190
* of patent rights can be found in the PATENTS file in the same directory.
19191
*
19192
* @providesModule setInnerHTML
19193
*/
19194
19195
/* globals MSApp */
19196
19197
'use strict';
19198
19199
var ExecutionEnvironment = require("./ExecutionEnvironment");
19200
19201
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
19202
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
19203
19204
/**
19205
* Set the innerHTML property of a node, ensuring that whitespace is preserved
19206
* even in IE8.
19207
*
19208
* @param {DOMElement} node
19209
* @param {string} html
19210
* @internal
19211
*/
19212
var setInnerHTML = function(node, html) {
19213
node.innerHTML = html;
19214
};
19215
19216
// Win8 apps: Allow all html to be inserted
19217
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
19218
setInnerHTML = function(node, html) {
19219
MSApp.execUnsafeLocalFunction(function() {
19220
node.innerHTML = html;
19221
});
19222
};
19223
}
19224
19225
if (ExecutionEnvironment.canUseDOM) {
19226
// IE8: When updating a just created node with innerHTML only leading
19227
// whitespace is removed. When updating an existing node with innerHTML
19228
// whitespace in root TextNodes is also collapsed.
19229
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
19230
19231
// Feature detection; only IE8 is known to behave improperly like this.
19232
var testElement = document.createElement('div');
19233
testElement.innerHTML = ' ';
19234
if (testElement.innerHTML === '') {
19235
setInnerHTML = function(node, html) {
19236
// Magic theory: IE8 supposedly differentiates between added and updated
19237
// nodes when processing innerHTML, innerHTML on updated nodes suffers
19238
// from worse whitespace behavior. Re-adding a node like this triggers
19239
// the initial and more favorable whitespace behavior.
19240
// TODO: What to do on a detached node?
19241
if (node.parentNode) {
19242
node.parentNode.replaceChild(node, node);
19243
}
19244
19245
// We also implement a workaround for non-visible tags disappearing into
19246
// thin air on IE8, this only happens if there is no visible text
19247
// in-front of the non-visible tags. Piggyback on the whitespace fix
19248
// and simply check if any non-visible tags appear in the source.
19249
if (WHITESPACE_TEST.test(html) ||
19250
html[0] === '<' && NONVISIBLE_TEST.test(html)) {
19251
// Recover leading whitespace by temporarily prepending any character.
19252
// \uFEFF has the potential advantage of being zero-width/invisible.
19253
node.innerHTML = '\uFEFF' + html;
19254
19255
// deleteData leaves an empty `TextNode` which offsets the index of all
19256
// children. Definitely want to avoid this.
19257
var textNode = node.firstChild;
19258
if (textNode.data.length === 1) {
19259
node.removeChild(textNode);
19260
} else {
19261
textNode.deleteData(0, 1);
19262
}
19263
} else {
19264
node.innerHTML = html;
19265
}
19266
};
19267
}
19268
}
19269
19270
module.exports = setInnerHTML;
19271
19272
19273
},{"./ExecutionEnvironment":21}],150:[function(require,module,exports){
19274
/**
19275
* Copyright 2013-2015, Facebook, Inc.
19276
* All rights reserved.
19277
*
19278
* This source code is licensed under the BSD-style license found in the
19279
* LICENSE file in the root directory of this source tree. An additional grant
19280
* of patent rights can be found in the PATENTS file in the same directory.
19281
*
19282
* @providesModule setTextContent
19283
*/
19284
19285
'use strict';
19286
19287
var ExecutionEnvironment = require("./ExecutionEnvironment");
19288
var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
19289
var setInnerHTML = require("./setInnerHTML");
19290
19291
/**
19292
* Set the textContent property of a node, ensuring that whitespace is preserved
19293
* even in IE8. innerText is a poor substitute for textContent and, among many
19294
* issues, inserts <br> instead of the literal newline chars. innerHTML behaves
19295
* as it should.
19296
*
19297
* @param {DOMElement} node
19298
* @param {string} text
19299
* @internal
19300
*/
19301
var setTextContent = function(node, text) {
19302
node.textContent = text;
19303
};
19304
19305
if (ExecutionEnvironment.canUseDOM) {
19306
if (!('textContent' in document.documentElement)) {
19307
setTextContent = function(node, text) {
19308
setInnerHTML(node, escapeTextContentForBrowser(text));
19309
};
19310
}
19311
}
19312
19313
module.exports = setTextContent;
19314
19315
19316
},{"./ExecutionEnvironment":21,"./escapeTextContentForBrowser":117,"./setInnerHTML":149}],151:[function(require,module,exports){
19317
/**
19318
* Copyright 2013-2015, Facebook, Inc.
19319
* All rights reserved.
19320
*
19321
* This source code is licensed under the BSD-style license found in the
19322
* LICENSE file in the root directory of this source tree. An additional grant
19323
* of patent rights can be found in the PATENTS file in the same directory.
19324
*
19325
* @providesModule shallowEqual
19326
*/
19327
19328
'use strict';
19329
19330
/**
19331
* Performs equality by iterating through keys on an object and returning
19332
* false when any key has values which are not strictly equal between
19333
* objA and objB. Returns true when the values of all keys are strictly equal.
19334
*
19335
* @return {boolean}
19336
*/
19337
function shallowEqual(objA, objB) {
19338
if (objA === objB) {
19339
return true;
19340
}
19341
var key;
19342
// Test for A's keys different from B.
19343
for (key in objA) {
19344
if (objA.hasOwnProperty(key) &&
19345
(!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
19346
return false;
19347
}
19348
}
19349
// Test for B's keys missing from A.
19350
for (key in objB) {
19351
if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
19352
return false;
19353
}
19354
}
19355
return true;
19356
}
19357
19358
module.exports = shallowEqual;
19359
19360
19361
},{}],152:[function(require,module,exports){
19362
(function (process){
19363
/**
19364
* Copyright 2013-2015, Facebook, Inc.
19365
* All rights reserved.
19366
*
19367
* This source code is licensed under the BSD-style license found in the
19368
* LICENSE file in the root directory of this source tree. An additional grant
19369
* of patent rights can be found in the PATENTS file in the same directory.
19370
*
19371
* @providesModule shouldUpdateReactComponent
19372
* @typechecks static-only
19373
*/
19374
19375
'use strict';
19376
19377
var warning = require("./warning");
19378
19379
/**
19380
* Given a `prevElement` and `nextElement`, determines if the existing
19381
* instance should be updated as opposed to being destroyed or replaced by a new
19382
* instance. Both arguments are elements. This ensures that this logic can
19383
* operate on stateless trees without any backing instance.
19384
*
19385
* @param {?object} prevElement
19386
* @param {?object} nextElement
19387
* @return {boolean} True if the existing instance should be updated.
19388
* @protected
19389
*/
19390
function shouldUpdateReactComponent(prevElement, nextElement) {
19391
if (prevElement != null && nextElement != null) {
19392
var prevType = typeof prevElement;
19393
var nextType = typeof nextElement;
19394
if (prevType === 'string' || prevType === 'number') {
19395
return (nextType === 'string' || nextType === 'number');
19396
} else {
19397
if (nextType === 'object' &&
19398
prevElement.type === nextElement.type &&
19399
prevElement.key === nextElement.key) {
19400
var ownersMatch = prevElement._owner === nextElement._owner;
19401
var prevName = null;
19402
var nextName = null;
19403
var nextDisplayName = null;
19404
if ("production" !== process.env.NODE_ENV) {
19405
if (!ownersMatch) {
19406
if (prevElement._owner != null &&
19407
prevElement._owner.getPublicInstance() != null &&
19408
prevElement._owner.getPublicInstance().constructor != null) {
19409
prevName =
19410
prevElement._owner.getPublicInstance().constructor.displayName;
19411
}
19412
if (nextElement._owner != null &&
19413
nextElement._owner.getPublicInstance() != null &&
19414
nextElement._owner.getPublicInstance().constructor != null) {
19415
nextName =
19416
nextElement._owner.getPublicInstance().constructor.displayName;
19417
}
19418
if (nextElement.type != null &&
19419
nextElement.type.displayName != null) {
19420
nextDisplayName = nextElement.type.displayName;
19421
}
19422
if (nextElement.type != null && typeof nextElement.type === 'string') {
19423
nextDisplayName = nextElement.type;
19424
}
19425
if (typeof nextElement.type !== 'string' ||
19426
nextElement.type === 'input' ||
19427
nextElement.type === 'textarea') {
19428
if ((prevElement._owner != null &&
19429
prevElement._owner._isOwnerNecessary === false) ||
19430
(nextElement._owner != null &&
19431
nextElement._owner._isOwnerNecessary === false)) {
19432
if (prevElement._owner != null) {
19433
prevElement._owner._isOwnerNecessary = true;
19434
}
19435
if (nextElement._owner != null) {
19436
nextElement._owner._isOwnerNecessary = true;
19437
}
19438
("production" !== process.env.NODE_ENV ? warning(
19439
false,
19440
'<%s /> is being rendered by both %s and %s using the same ' +
19441
'key (%s) in the same place. Currently, this means that ' +
19442
'they don\'t preserve state. This behavior should be very ' +
19443
'rare so we\'re considering deprecating it. Please contact ' +
19444
'the React team and explain your use case so that we can ' +
19445
'take that into consideration.',
19446
nextDisplayName || 'Unknown Component',
19447
prevName || '[Unknown]',
19448
nextName || '[Unknown]',
19449
prevElement.key
19450
) : null);
19451
}
19452
}
19453
}
19454
}
19455
return ownersMatch;
19456
}
19457
}
19458
}
19459
return false;
19460
}
19461
19462
module.exports = shouldUpdateReactComponent;
19463
19464
19465
}).call(this,require("FWaASH"))
19466
},{"./warning":155,"FWaASH":1}],153:[function(require,module,exports){
19467
(function (process){
19468
/**
19469
* Copyright 2014-2015, Facebook, Inc.
19470
* All rights reserved.
19471
*
19472
* This source code is licensed under the BSD-style license found in the
19473
* LICENSE file in the root directory of this source tree. An additional grant
19474
* of patent rights can be found in the PATENTS file in the same directory.
19475
*
19476
* @providesModule toArray
19477
* @typechecks
19478
*/
19479
19480
var invariant = require("./invariant");
19481
19482
/**
19483
* Convert array-like objects to arrays.
19484
*
19485
* This API assumes the caller knows the contents of the data type. For less
19486
* well defined inputs use createArrayFromMixed.
19487
*
19488
* @param {object|function|filelist} obj
19489
* @return {array}
19490
*/
19491
function toArray(obj) {
19492
var length = obj.length;
19493
19494
// Some browse builtin objects can report typeof 'function' (e.g. NodeList in
19495
// old versions of Safari).
19496
("production" !== process.env.NODE_ENV ? invariant(
19497
!Array.isArray(obj) &&
19498
(typeof obj === 'object' || typeof obj === 'function'),
19499
'toArray: Array-like object expected'
19500
) : invariant(!Array.isArray(obj) &&
19501
(typeof obj === 'object' || typeof obj === 'function')));
19502
19503
("production" !== process.env.NODE_ENV ? invariant(
19504
typeof length === 'number',
19505
'toArray: Object needs a length property'
19506
) : invariant(typeof length === 'number'));
19507
19508
("production" !== process.env.NODE_ENV ? invariant(
19509
length === 0 ||
19510
(length - 1) in obj,
19511
'toArray: Object should have keys for indices'
19512
) : invariant(length === 0 ||
19513
(length - 1) in obj));
19514
19515
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
19516
// without method will throw during the slice call and skip straight to the
19517
// fallback.
19518
if (obj.hasOwnProperty) {
19519
try {
19520
return Array.prototype.slice.call(obj);
19521
} catch (e) {
19522
// IE < 9 does not support Array#slice on collections objects
19523
}
19524
}
19525
19526
// Fall back to copying key by key. This assumes all keys have a value,
19527
// so will not preserve sparsely populated inputs.
19528
var ret = Array(length);
19529
for (var ii = 0; ii < length; ii++) {
19530
ret[ii] = obj[ii];
19531
}
19532
return ret;
19533
}
19534
19535
module.exports = toArray;
19536
19537
19538
}).call(this,require("FWaASH"))
19539
},{"./invariant":136,"FWaASH":1}],154:[function(require,module,exports){
19540
(function (process){
19541
/**
19542
* Copyright 2013-2015, Facebook, Inc.
19543
* All rights reserved.
19544
*
19545
* This source code is licensed under the BSD-style license found in the
19546
* LICENSE file in the root directory of this source tree. An additional grant
19547
* of patent rights can be found in the PATENTS file in the same directory.
19548
*
19549
* @providesModule traverseAllChildren
19550
*/
19551
19552
'use strict';
19553
19554
var ReactElement = require("./ReactElement");
19555
var ReactFragment = require("./ReactFragment");
19556
var ReactInstanceHandles = require("./ReactInstanceHandles");
19557
19558
var getIteratorFn = require("./getIteratorFn");
19559
var invariant = require("./invariant");
19560
var warning = require("./warning");
19561
19562
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
19563
var SUBSEPARATOR = ':';
19564
19565
/**
19566
* TODO: Test that a single child and an array with one item have the same key
19567
* pattern.
19568
*/
19569
19570
var userProvidedKeyEscaperLookup = {
19571
'=': '=0',
19572
'.': '=1',
19573
':': '=2'
19574
};
19575
19576
var userProvidedKeyEscapeRegex = /[=.:]/g;
19577
19578
var didWarnAboutMaps = false;
19579
19580
function userProvidedKeyEscaper(match) {
19581
return userProvidedKeyEscaperLookup[match];
19582
}
19583
19584
/**
19585
* Generate a key string that identifies a component within a set.
19586
*
19587
* @param {*} component A component that could contain a manual key.
19588
* @param {number} index Index that is used if a manual key is not provided.
19589
* @return {string}
19590
*/
19591
function getComponentKey(component, index) {
19592
if (component && component.key != null) {
19593
// Explicit key
19594
return wrapUserProvidedKey(component.key);
19595
}
19596
// Implicit key determined by the index in the set
19597
return index.toString(36);
19598
}
19599
19600
/**
19601
* Escape a component key so that it is safe to use in a reactid.
19602
*
19603
* @param {*} key Component key to be escaped.
19604
* @return {string} An escaped string.
19605
*/
19606
function escapeUserProvidedKey(text) {
19607
return ('' + text).replace(
19608
userProvidedKeyEscapeRegex,
19609
userProvidedKeyEscaper
19610
);
19611
}
19612
19613
/**
19614
* Wrap a `key` value explicitly provided by the user to distinguish it from
19615
* implicitly-generated keys generated by a component's index in its parent.
19616
*
19617
* @param {string} key Value of a user-provided `key` attribute
19618
* @return {string}
19619
*/
19620
function wrapUserProvidedKey(key) {
19621
return '$' + escapeUserProvidedKey(key);
19622
}
19623
19624
/**
19625
* @param {?*} children Children tree container.
19626
* @param {!string} nameSoFar Name of the key path so far.
19627
* @param {!number} indexSoFar Number of children encountered until this point.
19628
* @param {!function} callback Callback to invoke with each child found.
19629
* @param {?*} traverseContext Used to pass information throughout the traversal
19630
* process.
19631
* @return {!number} The number of children in this subtree.
19632
*/
19633
function traverseAllChildrenImpl(
19634
children,
19635
nameSoFar,
19636
indexSoFar,
19637
callback,
19638
traverseContext
19639
) {
19640
var type = typeof children;
19641
19642
if (type === 'undefined' || type === 'boolean') {
19643
// All of the above are perceived as null.
19644
children = null;
19645
}
19646
19647
if (children === null ||
19648
type === 'string' ||
19649
type === 'number' ||
19650
ReactElement.isValidElement(children)) {
19651
callback(
19652
traverseContext,
19653
children,
19654
// If it's the only child, treat the name as if it was wrapped in an array
19655
// so that it's consistent if the number of children grows.
19656
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
19657
indexSoFar
19658
);
19659
return 1;
19660
}
19661
19662
var child, nextName, nextIndex;
19663
var subtreeCount = 0; // Count of children found in the current subtree.
19664
19665
if (Array.isArray(children)) {
19666
for (var i = 0; i < children.length; i++) {
19667
child = children[i];
19668
nextName = (
19669
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
19670
getComponentKey(child, i)
19671
);
19672
nextIndex = indexSoFar + subtreeCount;
19673
subtreeCount += traverseAllChildrenImpl(
19674
child,
19675
nextName,
19676
nextIndex,
19677
callback,
19678
traverseContext
19679
);
19680
}
19681
} else {
19682
var iteratorFn = getIteratorFn(children);
19683
if (iteratorFn) {
19684
var iterator = iteratorFn.call(children);
19685
var step;
19686
if (iteratorFn !== children.entries) {
19687
var ii = 0;
19688
while (!(step = iterator.next()).done) {
19689
child = step.value;
19690
nextName = (
19691
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
19692
getComponentKey(child, ii++)
19693
);
19694
nextIndex = indexSoFar + subtreeCount;
19695
subtreeCount += traverseAllChildrenImpl(
19696
child,
19697
nextName,
19698
nextIndex,
19699
callback,
19700
traverseContext
19701
);
19702
}
19703
} else {
19704
if ("production" !== process.env.NODE_ENV) {
19705
("production" !== process.env.NODE_ENV ? warning(
19706
didWarnAboutMaps,
19707
'Using Maps as children is not yet fully supported. It is an ' +
19708
'experimental feature that might be removed. Convert it to a ' +
19709
'sequence / iterable of keyed ReactElements instead.'
19710
) : null);
19711
didWarnAboutMaps = true;
19712
}
19713
// Iterator will provide entry [k,v] tuples rather than values.
19714
while (!(step = iterator.next()).done) {
19715
var entry = step.value;
19716
if (entry) {
19717
child = entry[1];
19718
nextName = (
19719
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
19720
wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
19721
getComponentKey(child, 0)
19722
);
19723
nextIndex = indexSoFar + subtreeCount;
19724
subtreeCount += traverseAllChildrenImpl(
19725
child,
19726
nextName,
19727
nextIndex,
19728
callback,
19729
traverseContext
19730
);
19731
}
19732
}
19733
}
19734
} else if (type === 'object') {
19735
("production" !== process.env.NODE_ENV ? invariant(
19736
children.nodeType !== 1,
19737
'traverseAllChildren(...): Encountered an invalid child; DOM ' +
19738
'elements are not valid children of React components.'
19739
) : invariant(children.nodeType !== 1));
19740
var fragment = ReactFragment.extract(children);
19741
for (var key in fragment) {
19742
if (fragment.hasOwnProperty(key)) {
19743
child = fragment[key];
19744
nextName = (
19745
(nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
19746
wrapUserProvidedKey(key) + SUBSEPARATOR +
19747
getComponentKey(child, 0)
19748
);
19749
nextIndex = indexSoFar + subtreeCount;
19750
subtreeCount += traverseAllChildrenImpl(
19751
child,
19752
nextName,
19753
nextIndex,
19754
callback,
19755
traverseContext
19756
);
19757
}
19758
}
19759
}
19760
}
19761
19762
return subtreeCount;
19763
}
19764
19765
/**
19766
* Traverses children that are typically specified as `props.children`, but
19767
* might also be specified through attributes:
19768
*
19769
* - `traverseAllChildren(this.props.children, ...)`
19770
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
19771
*
19772
* The `traverseContext` is an optional argument that is passed through the
19773
* entire traversal. It can be used to store accumulations or anything else that
19774
* the callback might find relevant.
19775
*
19776
* @param {?*} children Children tree object.
19777
* @param {!function} callback To invoke upon traversing each child.
19778
* @param {?*} traverseContext Context for traversal.
19779
* @return {!number} The number of children in this subtree.
19780
*/
19781
function traverseAllChildren(children, callback, traverseContext) {
19782
if (children == null) {
19783
return 0;
19784
}
19785
19786
return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
19787
}
19788
19789
module.exports = traverseAllChildren;
19790
19791
19792
}).call(this,require("FWaASH"))
19793
},{"./ReactElement":58,"./ReactFragment":64,"./ReactInstanceHandles":67,"./getIteratorFn":127,"./invariant":136,"./warning":155,"FWaASH":1}],155:[function(require,module,exports){
19794
(function (process){
19795
/**
19796
* Copyright 2014-2015, Facebook, Inc.
19797
* All rights reserved.
19798
*
19799
* This source code is licensed under the BSD-style license found in the
19800
* LICENSE file in the root directory of this source tree. An additional grant
19801
* of patent rights can be found in the PATENTS file in the same directory.
19802
*
19803
* @providesModule warning
19804
*/
19805
19806
"use strict";
19807
19808
var emptyFunction = require("./emptyFunction");
19809
19810
/**
19811
* Similar to invariant but only logs a warning if the condition is not met.
19812
* This can be used to log issues in development environments in critical
19813
* paths. Removing the logging code for production environments will keep the
19814
* same logic and follow the same code paths.
19815
*/
19816
19817
var warning = emptyFunction;
19818
19819
if ("production" !== process.env.NODE_ENV) {
19820
warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
19821
if (format === undefined) {
19822
throw new Error(
19823
'`warning(condition, format, ...args)` requires a warning ' +
19824
'message argument'
19825
);
19826
}
19827
19828
if (format.length < 10 || /^[s\W]*$/.test(format)) {
19829
throw new Error(
19830
'The warning format should be able to uniquely identify this ' +
19831
'warning. Please, use a more descriptive format than: ' + format
19832
);
19833
}
19834
19835
if (format.indexOf('Failed Composite propType: ') === 0) {
19836
return; // Ignore CompositeComponent proptype check.
19837
}
19838
19839
if (!condition) {
19840
var argIndex = 0;
19841
var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
19842
console.warn(message);
19843
try {
19844
// --- Welcome to debugging React ---
19845
// This error was thrown as a convenience so that you can use this stack
19846
// to find the callsite that caused this warning to fire.
19847
throw new Error(message);
19848
} catch(x) {}
19849
}
19850
};
19851
}
19852
19853
module.exports = warning;
19854
19855
19856
}).call(this,require("FWaASH"))
19857
},{"./emptyFunction":115,"FWaASH":1}],"react":[function(require,module,exports){
19858
module.exports=require('M6d2gk');
19859
},{}],"M6d2gk":[function(require,module,exports){
19860
module.exports = require('./lib/React');
19861
19862
19863
},{"./lib/React":29}],"FLHjPV":[function(require,module,exports){
19864
'use strict';
19865
19866
var React = require('react');
19867
19868
var App = React.createClass({displayName: "App",
19869
render: function() {
19870
return React.createElement("h1", null, "Hello ", this.props.name, "!");
19871
}
19872
});
19873
19874
module.exports = App;
19875
19876
19877
},{"react":"M6d2gk"}],"./src/App":[function(require,module,exports){
19878
module.exports=require('FLHjPV');
19879
},{}]},{},[])
19880