Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: react @ 0.13.3 .. 0.14.9

addons.js

@@ -1 +1,13 @@
+'use strict';
+
+var warning = require('fbjs/lib/warning');
+warning(
+ false,
+ // Require examples in this string must be split to prevent React's
+ // build tools from mistaking them for real requires.
+ // Otherwise the build tools will attempt to build a 'react-addons-{addon}' module.
+ 'require' + "('react/addons') is deprecated. " +
+ 'Access using require' + "('react-addons-{addon}') instead."
+);
+
module.exports = require('./lib/ReactWithAddons');

dist/JSXTransformer.js

@@ -1,15919 +0,0 @@
-/**
- * JSXTransformer v0.13.3
- */
-(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSXTransformer = f()}})(function(){var define,module,exports;return (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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-/* jshint browser: true */
-/* jslint evil: true */
-/*eslint-disable no-eval */
-/*eslint-disable block-scoped-var */
-
-'use strict';
-
-var ReactTools = _dereq_('../main');
-var inlineSourceMap = _dereq_('./inline-source-map');
-
-var headEl;
-var dummyAnchor;
-var inlineScriptCount = 0;
-
-// The source-map library relies on Object.defineProperty, but IE8 doesn't
-// support it fully even with es5-sham. Indeed, es5-sham's defineProperty
-// throws when Object.prototype.__defineGetter__ is missing, so we skip building
-// the source map in that case.
-var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
-
-/**
- * Run provided code through jstransform.
- *
- * @param {string} source Original source code
- * @param {object?} options Options to pass to jstransform
- * @return {object} object as returned from jstransform
- */
-function transformReact(source, options) {
- options = options || {};
-
- // Force the sourcemaps option manually. We don't want to use it if it will
- // break (see above note about supportsAccessors). We'll only override the
- // value here if sourceMap was specified and is truthy. This guarantees that
- // we won't override any user intent (since this method is exposed publicly).
- if (options.sourceMap) {
- options.sourceMap = supportsAccessors;
- }
-
- // Otherwise just pass all options straight through to react-tools.
- return ReactTools.transformWithDetails(source, options);
-}
-
-/**
- * Eval provided source after transforming it.
- *
- * @param {string} source Original source code
- * @param {object?} options Options to pass to jstransform
- */
-function exec(source, options) {
- return eval(transformReact(source, options).code);
-}
-
-/**
- * This method returns a nicely formated line of code pointing to the exact
- * location of the error `e`. The line is limited in size so big lines of code
- * are also shown in a readable way.
- *
- * Example:
- * ... x', overflow:'scroll'}} id={} onScroll={this.scroll} class=" ...
- * ^
- *
- * @param {string} code The full string of code
- * @param {Error} e The error being thrown
- * @return {string} formatted message
- * @internal
- */
-function createSourceCodeErrorMessage(code, e) {
- var sourceLines = code.split('\n');
- // e.lineNumber is non-standard so we can't depend on its availability. If
- // we're in a browser where it isn't supported, don't even bother trying to
- // format anything. We may also hit a case where the line number is reported
- // incorrectly and is outside the bounds of the actual code. Handle that too.
- if (!e.lineNumber || e.lineNumber > sourceLines.length) {
- return '';
- }
- var erroneousLine = sourceLines[e.lineNumber - 1];
-
- // Removes any leading indenting spaces and gets the number of
- // chars indenting the `erroneousLine`
- var indentation = 0;
- erroneousLine = erroneousLine.replace(/^\s+/, function(leadingSpaces) {
- indentation = leadingSpaces.length;
- return '';
- });
-
- // Defines the number of characters that are going to show
- // before and after the erroneous code
- var LIMIT = 30;
- var errorColumn = e.column - indentation;
-
- if (errorColumn > LIMIT) {
- erroneousLine = '... ' + erroneousLine.slice(errorColumn - LIMIT);
- errorColumn = 4 + LIMIT;
- }
- if (erroneousLine.length - errorColumn > LIMIT) {
- erroneousLine = erroneousLine.slice(0, errorColumn + LIMIT) + ' ...';
- }
- var message = '\n\n' + erroneousLine + '\n';
- message += new Array(errorColumn - 1).join(' ') + '^';
- return message;
-}
-
-/**
- * Actually transform the code.
- *
- * @param {string} code
- * @param {string?} url
- * @param {object?} options
- * @return {string} The transformed code.
- * @internal
- */
-function transformCode(code, url, options) {
- try {
- var transformed = transformReact(code, options);
- } catch(e) {
- e.message += '\n at ';
- if (url) {
- if ('fileName' in e) {
- // We set `fileName` if it's supported by this error object and
- // a `url` was provided.
- // The error will correctly point to `url` in Firefox.
- e.fileName = url;
- }
- e.message += url + ':' + e.lineNumber + ':' + e.columnNumber;
- } else {
- e.message += location.href;
- }
- e.message += createSourceCodeErrorMessage(code, e);
- throw e;
- }
-
- if (!transformed.sourceMap) {
- return transformed.code;
- }
-
- var source;
- if (url == null) {
- source = 'Inline JSX script';
- inlineScriptCount++;
- if (inlineScriptCount > 1) {
- source += ' (' + inlineScriptCount + ')';
- }
- } else if (dummyAnchor) {
- // Firefox has problems when the sourcemap source is a proper URL with a
- // protocol and hostname, so use the pathname. We could use just the
- // filename, but hopefully using the full path will prevent potential
- // issues where the same filename exists in multiple directories.
- dummyAnchor.href = url;
- source = dummyAnchor.pathname.substr(1);
- }
-
- return (
- transformed.code +
- '\n' +
- inlineSourceMap(transformed.sourceMap, code, source)
- );
-}
-
-
-/**
- * Appends a script element at the end of the <head> with the content of code,
- * after transforming it.
- *
- * @param {string} code The original source code
- * @param {string?} url Where the code came from. null if inline
- * @param {object?} options Options to pass to jstransform
- * @internal
- */
-function run(code, url, options) {
- var scriptEl = document.createElement('script');
- scriptEl.text = transformCode(code, url, options);
- headEl.appendChild(scriptEl);
-}
-
-/**
- * Load script from the provided url and pass the content to the callback.
- *
- * @param {string} url The location of the script src
- * @param {function} callback Function to call with the content of url
- * @internal
- */
-function load(url, successCallback, errorCallback) {
- var xhr;
- xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP')
- : new XMLHttpRequest();
-
- // async, however scripts will be executed in the order they are in the
- // DOM to mirror normal script loading.
- xhr.open('GET', url, true);
- if ('overrideMimeType' in xhr) {
- xhr.overrideMimeType('text/plain');
- }
- xhr.onreadystatechange = function() {
- if (xhr.readyState === 4) {
- if (xhr.status === 0 || xhr.status === 200) {
- successCallback(xhr.responseText);
- } else {
- errorCallback();
- throw new Error('Could not load ' + url);
- }
- }
- };
- return xhr.send(null);
-}
-
-/**
- * Loop over provided script tags and get the content, via innerHTML if an
- * inline script, or by using XHR. Transforms are applied if needed. The scripts
- * are executed in the order they are found on the page.
- *
- * @param {array} scripts The <script> elements to load and run.
- * @internal
- */
-function loadScripts(scripts) {
- var result = [];
- var count = scripts.length;
-
- function check() {
- var script, i;
-
- for (i = 0; i < count; i++) {
- script = result[i];
-
- if (script.loaded && !script.executed) {
- script.executed = true;
- run(script.content, script.url, script.options);
- } else if (!script.loaded && !script.error && !script.async) {
- break;
- }
- }
- }
-
- scripts.forEach(function(script, i) {
- var options = {
- sourceMap: true
- };
- if (/;harmony=true(;|$)/.test(script.type)) {
- options.harmony = true;
- }
- if (/;stripTypes=true(;|$)/.test(script.type)) {
- options.stripTypes = true;
- }
-
- // script.async is always true for non-javascript script tags
- var async = script.hasAttribute('async');
-
- if (script.src) {
- result[i] = {
- async: async,
- error: false,
- executed: false,
- content: null,
- loaded: false,
- url: script.src,
- options: options
- };
-
- load(script.src, function(content) {
- result[i].loaded = true;
- result[i].content = content;
- check();
- }, function() {
- result[i].error = true;
- check();
- });
- } else {
- result[i] = {
- async: async,
- error: false,
- executed: false,
- content: script.innerHTML,
- loaded: true,
- url: null,
- options: options
- };
- }
- });
-
- check();
-}
-
-/**
- * Find and run all script tags with type="text/jsx".
- *
- * @internal
- */
-function runScripts() {
- var scripts = document.getElementsByTagName('script');
-
- // Array.prototype.slice cannot be used on NodeList on IE8
- var jsxScripts = [];
- for (var i = 0; i < scripts.length; i++) {
- if (/^text\/jsx(;|$)/.test(scripts.item(i).type)) {
- jsxScripts.push(scripts.item(i));
- }
- }
-
- if (jsxScripts.length < 1) {
- return;
- }
-
- console.warn(
- 'You are using the in-browser JSX transformer. Be sure to precompile ' +
- 'your JSX for production - ' +
- 'http://facebook.github.io/react/docs/tooling-integration.html#jsx'
- );
-
- loadScripts(jsxScripts);
-}
-
-// Listen for load event if we're in a browser and then kick off finding and
-// running of scripts.
-if (typeof window !== 'undefined' && window !== null) {
- headEl = document.getElementsByTagName('head')[0];
- dummyAnchor = document.createElement('a');
-
- if (window.addEventListener) {
- window.addEventListener('DOMContentLoaded', runScripts, false);
- } else {
- window.attachEvent('onload', runScripts);
- }
-}
-
-module.exports = {
- transform: transformReact,
- exec: exec
-};
-
-},{"../main":2,"./inline-source-map":41}],2:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-/*eslint-disable no-undef*/
-var visitors = _dereq_('./vendor/fbtransform/visitors');
-var transform = _dereq_('jstransform').transform;
-var typesSyntax = _dereq_('jstransform/visitors/type-syntax');
-var inlineSourceMap = _dereq_('./vendor/inline-source-map');
-
-module.exports = {
- transform: function(input, options) {
- options = processOptions(options);
- var output = innerTransform(input, options);
- var result = output.code;
- if (options.sourceMap) {
- var map = inlineSourceMap(
- output.sourceMap,
- input,
- options.filename
- );
- result += '\n' + map;
- }
- return result;
- },
- transformWithDetails: function(input, options) {
- options = processOptions(options);
- var output = innerTransform(input, options);
- var result = {};
- result.code = output.code;
- if (options.sourceMap) {
- result.sourceMap = output.sourceMap.toJSON();
- }
- if (options.filename) {
- result.sourceMap.sources = [options.filename];
- }
- return result;
- }
-};
-
-/**
- * Only copy the values that we need. We'll do some preprocessing to account for
- * converting command line flags to options that jstransform can actually use.
- */
-function processOptions(opts) {
- opts = opts || {};
- var options = {};
-
- options.harmony = opts.harmony;
- options.stripTypes = opts.stripTypes;
- options.sourceMap = opts.sourceMap;
- options.filename = opts.sourceFilename;
-
- if (opts.es6module) {
- options.sourceType = 'module';
- }
- if (opts.nonStrictEs6module) {
- options.sourceType = 'nonStrictModule';
- }
-
- // Instead of doing any fancy validation, only look for 'es3'. If we have
- // that, then use it. Otherwise use 'es5'.
- options.es3 = opts.target === 'es3';
- options.es5 = !options.es3;
-
- return options;
-}
-
-function innerTransform(input, options) {
- var visitorSets = ['react'];
- if (options.harmony) {
- visitorSets.push('harmony');
- }
-
- if (options.es3) {
- visitorSets.push('es3');
- }
-
- if (options.stripTypes) {
- // Stripping types needs to happen before the other transforms
- // unfortunately, due to bad interactions. For example,
- // es6-rest-param-visitors conflict with stripping rest param type
- // annotation
- input = transform(typesSyntax.visitorList, input, options).code;
- }
-
- var visitorList = visitors.getVisitorsBySet(visitorSets);
- return transform(visitorList, input, options);
-}
-
-},{"./vendor/fbtransform/visitors":40,"./vendor/inline-source-map":41,"jstransform":22,"jstransform/visitors/type-syntax":36}],3:[function(_dereq_,module,exports){
-/*!
- * The buffer module from node.js, for the browser.
- *
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
- * @license MIT
- */
-
-var base64 = _dereq_('base64-js')
-var ieee754 = _dereq_('ieee754')
-var isArray = _dereq_('is-array')
-
-exports.Buffer = Buffer
-exports.SlowBuffer = SlowBuffer
-exports.INSPECT_MAX_BYTES = 50
-Buffer.poolSize = 8192 // not used by this implementation
-
-var kMaxLength = 0x3fffffff
-var rootParent = {}
-
-/**
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
- * === true Use Uint8Array implementation (fastest)
- * === false Use Object implementation (most compatible, even IE6)
- *
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
- * Opera 11.6+, iOS 4.2+.
- *
- * Note:
- *
- * - Implementation must support adding new properties to `Uint8Array` instances.
- * Firefox 4-29 lacked support, fixed in Firefox 30+.
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
- *
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
- *
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
- * incorrect length in some situations.
- *
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they will
- * get the Object implementation, which is slower but will work correctly.
- */
-Buffer.TYPED_ARRAY_SUPPORT = (function () {
- try {
- var buf = new ArrayBuffer(0)
- var arr = new Uint8Array(buf)
- arr.foo = function () { return 42 }
- return arr.foo() === 42 && // typed array instances can be augmented
- typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
- new Uint8Array(1).subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
- } catch (e) {
- return false
- }
-})()
-
-/**
- * Class: Buffer
- * =============
- *
- * The Buffer constructor returns instances of `Uint8Array` that are augmented
- * with function properties for all the node `Buffer` API functions. We use
- * `Uint8Array` so that square bracket notation works as expected -- it returns
- * a single octet.
- *
- * By augmenting the instances, we can avoid modifying the `Uint8Array`
- * prototype.
- */
-function Buffer (subject, encoding) {
- var self = this
- if (!(self instanceof Buffer)) return new Buffer(subject, encoding)
-
- var type = typeof subject
- var length
-
- if (type === 'number') {
- length = +subject
- } else if (type === 'string') {
- length = Buffer.byteLength(subject, encoding)
- } else if (type === 'object' && subject !== null) {
- // assume object is array-like
- if (subject.type === 'Buffer' && isArray(subject.data)) subject = subject.data
- length = +subject.length
- } else {
- throw new TypeError('must start with number, buffer, array or string')
- }
-
- if (length > kMaxLength) {
- throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x' +
- kMaxLength.toString(16) + ' bytes')
- }
-
- if (length < 0) length = 0
- else length >>>= 0 // coerce to uint32
-
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Preferred: Return an augmented `Uint8Array` instance for best performance
- self = Buffer._augment(new Uint8Array(length)) // eslint-disable-line consistent-this
- } else {
- // Fallback: Return THIS instance of Buffer (created by `new`)
- self.length = length
- self._isBuffer = true
- }
-
- var i
- if (Buffer.TYPED_ARRAY_SUPPORT && typeof subject.byteLength === 'number') {
- // Speed optimization -- use set if we're copying from a typed array
- self._set(subject)
- } else if (isArrayish(subject)) {
- // Treat array-ish objects as a byte array
- if (Buffer.isBuffer(subject)) {
- for (i = 0; i < length; i++) {
- self[i] = subject.readUInt8(i)
- }
- } else {
- for (i = 0; i < length; i++) {
- self[i] = ((subject[i] % 256) + 256) % 256
- }
- }
- } else if (type === 'string') {
- self.write(subject, 0, encoding)
- } else if (type === 'number' && !Buffer.TYPED_ARRAY_SUPPORT) {
- for (i = 0; i < length; i++) {
- self[i] = 0
- }
- }
-
- if (length > 0 && length <= Buffer.poolSize) self.parent = rootParent
-
- return self
-}
-
-function SlowBuffer (subject, encoding) {
- if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
-
- var buf = new Buffer(subject, encoding)
- delete buf.parent
- return buf
-}
-
-Buffer.isBuffer = function isBuffer (b) {
- return !!(b != null && b._isBuffer)
-}
-
-Buffer.compare = function compare (a, b) {
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
- throw new TypeError('Arguments must be Buffers')
- }
-
- if (a === b) return 0
-
- var x = a.length
- var y = b.length
- for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}
- if (i !== len) {
- x = a[i]
- y = b[i]
- }
- if (x < y) return -1
- if (y < x) return 1
- return 0
-}
-
-Buffer.isEncoding = function isEncoding (encoding) {
- switch (String(encoding).toLowerCase()) {
- case 'hex':
- case 'utf8':
- case 'utf-8':
- case 'ascii':
- case 'binary':
- case 'base64':
- case 'raw':
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return true
- default:
- return false
- }
-}
-
-Buffer.concat = function concat (list, totalLength) {
- if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
-
- if (list.length === 0) {
- return new Buffer(0)
- } else if (list.length === 1) {
- return list[0]
- }
-
- var i
- if (totalLength === undefined) {
- totalLength = 0
- for (i = 0; i < list.length; i++) {
- totalLength += list[i].length
- }
- }
-
- var buf = new Buffer(totalLength)
- var pos = 0
- for (i = 0; i < list.length; i++) {
- var item = list[i]
- item.copy(buf, pos)
- pos += item.length
- }
- return buf
-}
-
-Buffer.byteLength = function byteLength (str, encoding) {
- var ret
- str = str + ''
- switch (encoding || 'utf8') {
- case 'ascii':
- case 'binary':
- case 'raw':
- ret = str.length
- break
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- ret = str.length * 2
- break
- case 'hex':
- ret = str.length >>> 1
- break
- case 'utf8':
- case 'utf-8':
- ret = utf8ToBytes(str).length
- break
- case 'base64':
- ret = base64ToBytes(str).length
- break
- default:
- ret = str.length
- }
- return ret
-}
-
-// pre-set for values that may exist in the future
-Buffer.prototype.length = undefined
-Buffer.prototype.parent = undefined
-
-// toString(encoding, start=0, end=buffer.length)
-Buffer.prototype.toString = function toString (encoding, start, end) {
- var loweredCase = false
-
- start = start >>> 0
- end = end === undefined || end === Infinity ? this.length : end >>> 0
-
- if (!encoding) encoding = 'utf8'
- if (start < 0) start = 0
- if (end > this.length) end = this.length
- if (end <= start) return ''
-
- while (true) {
- switch (encoding) {
- case 'hex':
- return hexSlice(this, start, end)
-
- case 'utf8':
- case 'utf-8':
- return utf8Slice(this, start, end)
-
- case 'ascii':
- return asciiSlice(this, start, end)
-
- case 'binary':
- return binarySlice(this, start, end)
-
- case 'base64':
- return base64Slice(this, start, end)
-
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return utf16leSlice(this, start, end)
-
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
- encoding = (encoding + '').toLowerCase()
- loweredCase = true
- }
- }
-}
-
-Buffer.prototype.equals = function equals (b) {
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
- if (this === b) return true
- return Buffer.compare(this, b) === 0
-}
-
-Buffer.prototype.inspect = function inspect () {
- var str = ''
- var max = exports.INSPECT_MAX_BYTES
- if (this.length > 0) {
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
- if (this.length > max) str += ' ... '
- }
- return '<Buffer ' + str + '>'
-}
-
-Buffer.prototype.compare = function compare (b) {
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
- if (this === b) return 0
- return Buffer.compare(this, b)
-}
-
-Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
- if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
- else if (byteOffset < -0x80000000) byteOffset = -0x80000000
- byteOffset >>= 0
-
- if (this.length === 0) return -1
- if (byteOffset >= this.length) return -1
-
- // Negative offsets start from the end of the buffer
- if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
-
- if (typeof val === 'string') {
- if (val.length === 0) return -1 // special case: looking for empty string always fails
- return String.prototype.indexOf.call(this, val, byteOffset)
- }
- if (Buffer.isBuffer(val)) {
- return arrayIndexOf(this, val, byteOffset)
- }
- if (typeof val === 'number') {
- if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
- return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
- }
- return arrayIndexOf(this, [ val ], byteOffset)
- }
-
- function arrayIndexOf (arr, val, byteOffset) {
- var foundIndex = -1
- for (var i = 0; byteOffset + i < arr.length; i++) {
- if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
- if (foundIndex === -1) foundIndex = i
- if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
- } else {
- foundIndex = -1
- }
- }
- return -1
- }
-
- throw new TypeError('val must be string, number or Buffer')
-}
-
-// `get` will be removed in Node 0.13+
-Buffer.prototype.get = function get (offset) {
- console.log('.get() is deprecated. Access using array indexes instead.')
- return this.readUInt8(offset)
-}
-
-// `set` will be removed in Node 0.13+
-Buffer.prototype.set = function set (v, offset) {
- console.log('.set() is deprecated. Access using array indexes instead.')
- return this.writeUInt8(v, offset)
-}
-
-function hexWrite (buf, string, offset, length) {
- offset = Number(offset) || 0
- var remaining = buf.length - offset
- if (!length) {
- length = remaining
- } else {
- length = Number(length)
- if (length > remaining) {
- length = remaining
- }
- }
-
- // must be an even number of digits
- var strLen = string.length
- if (strLen % 2 !== 0) throw new Error('Invalid hex string')
-
- if (length > strLen / 2) {
- length = strLen / 2
- }
- for (var i = 0; i < length; i++) {
- var parsed = parseInt(string.substr(i * 2, 2), 16)
- if (isNaN(parsed)) throw new Error('Invalid hex string')
- buf[offset + i] = parsed
- }
- return i
-}
-
-function utf8Write (buf, string, offset, length) {
- var charsWritten = blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
- return charsWritten
-}
-
-function asciiWrite (buf, string, offset, length) {
- var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)
- return charsWritten
-}
-
-function binaryWrite (buf, string, offset, length) {
- return asciiWrite(buf, string, offset, length)
-}
-
-function base64Write (buf, string, offset, length) {
- var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)
- return charsWritten
-}
-
-function utf16leWrite (buf, string, offset, length) {
- var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
- return charsWritten
-}
-
-Buffer.prototype.write = function write (string, offset, length, encoding) {
- // Support both (string, offset, length, encoding)
- // and the legacy (string, encoding, offset, length)
- if (isFinite(offset)) {
- if (!isFinite(length)) {
- encoding = length
- length = undefined
- }
- } else { // legacy
- var swap = encoding
- encoding = offset
- offset = length
- length = swap
- }
-
- offset = Number(offset) || 0
-
- if (length < 0 || offset < 0 || offset > this.length) {
- throw new RangeError('attempt to write outside buffer bounds')
- }
-
- var remaining = this.length - offset
- if (!length) {
- length = remaining
- } else {
- length = Number(length)
- if (length > remaining) {
- length = remaining
- }
- }
- encoding = String(encoding || 'utf8').toLowerCase()
-
- var ret
- switch (encoding) {
- case 'hex':
- ret = hexWrite(this, string, offset, length)
- break
- case 'utf8':
- case 'utf-8':
- ret = utf8Write(this, string, offset, length)
- break
- case 'ascii':
- ret = asciiWrite(this, string, offset, length)
- break
- case 'binary':
- ret = binaryWrite(this, string, offset, length)
- break
- case 'base64':
- ret = base64Write(this, string, offset, length)
- break
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- ret = utf16leWrite(this, string, offset, length)
- break
- default:
- throw new TypeError('Unknown encoding: ' + encoding)
- }
- return ret
-}
-
-Buffer.prototype.toJSON = function toJSON () {
- return {
- type: 'Buffer',
- data: Array.prototype.slice.call(this._arr || this, 0)
- }
-}
-
-function base64Slice (buf, start, end) {
- if (start === 0 && end === buf.length) {
- return base64.fromByteArray(buf)
- } else {
- return base64.fromByteArray(buf.slice(start, end))
- }
-}
-
-function utf8Slice (buf, start, end) {
- var res = ''
- var tmp = ''
- end = Math.min(buf.length, end)
-
- for (var i = start; i < end; i++) {
- if (buf[i] <= 0x7F) {
- res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
- tmp = ''
- } else {
- tmp += '%' + buf[i].toString(16)
- }
- }
-
- return res + decodeUtf8Char(tmp)
-}
-
-function asciiSlice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
-
- for (var i = start; i < end; i++) {
- ret += String.fromCharCode(buf[i] & 0x7F)
- }
- return ret
-}
-
-function binarySlice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
-
- for (var i = start; i < end; i++) {
- ret += String.fromCharCode(buf[i])
- }
- return ret
-}
-
-function hexSlice (buf, start, end) {
- var len = buf.length
-
- if (!start || start < 0) start = 0
- if (!end || end < 0 || end > len) end = len
-
- var out = ''
- for (var i = start; i < end; i++) {
- out += toHex(buf[i])
- }
- return out
-}
-
-function utf16leSlice (buf, start, end) {
- var bytes = buf.slice(start, end)
- var res = ''
- for (var i = 0; i < bytes.length; i += 2) {
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
- }
- return res
-}
-
-Buffer.prototype.slice = function slice (start, end) {
- var len = this.length
- start = ~~start
- end = end === undefined ? len : ~~end
-
- if (start < 0) {
- start += len
- if (start < 0) start = 0
- } else if (start > len) {
- start = len
- }
-
- if (end < 0) {
- end += len
- if (end < 0) end = 0
- } else if (end > len) {
- end = len
- }
-
- if (end < start) end = start
-
- var newBuf
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- newBuf = Buffer._augment(this.subarray(start, end))
- } else {
- var sliceLen = end - start
- newBuf = new Buffer(sliceLen, undefined)
- for (var i = 0; i < sliceLen; i++) {
- newBuf[i] = this[i + start]
- }
- }
-
- if (newBuf.length) newBuf.parent = this.parent || this
-
- return newBuf
-}
-
-/*
- * Need to make sure that buffer isn't trying to write out of bounds.
- */
-function checkOffset (offset, ext, length) {
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
-}
-
-Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
-
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
-
- return val
-}
-
-Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length)
- }
-
- var val = this[offset + --byteLength]
- var mul = 1
- while (byteLength > 0 && (mul *= 0x100)) {
- val += this[offset + --byteLength] * mul
- }
-
- return val
-}
-
-Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- return this[offset]
-}
-
-Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return this[offset] | (this[offset + 1] << 8)
-}
-
-Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return (this[offset] << 8) | this[offset + 1]
-}
-
-Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return ((this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16)) +
- (this[offset + 3] * 0x1000000)
-}
-
-Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return (this[offset] * 0x1000000) +
- ((this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- this[offset + 3])
-}
-
-Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
-
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
- mul *= 0x80
-
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
-
- return val
-}
-
-Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
- offset = offset >>> 0
- byteLength = byteLength >>> 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
-
- var i = byteLength
- var mul = 1
- var val = this[offset + --i]
- while (i > 0 && (mul *= 0x100)) {
- val += this[offset + --i] * mul
- }
- mul *= 0x80
-
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
-
- return val
-}
-
-Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- if (!(this[offset] & 0x80)) return (this[offset])
- return ((0xff - this[offset] + 1) * -1)
-}
-
-Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset] | (this[offset + 1] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
-}
-
-Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset + 1] | (this[offset] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
-}
-
-Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return (this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16) |
- (this[offset + 3] << 24)
-}
-
-Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
-
- return (this[offset] << 24) |
- (this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- (this[offset + 3])
-}
-
-Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, true, 23, 4)
-}
-
-Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, false, 23, 4)
-}
-
-Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, true, 52, 8)
-}
-
-Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, false, 52, 8)
-}
-
-function checkInt (buf, value, offset, ext, max, min) {
- if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
- if (value > max || value < min) throw new RangeError('value is out of bounds')
- if (offset + ext > buf.length) throw new RangeError('index out of range')
-}
-
-Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset >>> 0
- byteLength = byteLength >>> 0
- if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
-
- var mul = 1
- var i = 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- this[offset + i] = (value / mul) >>> 0 & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset >>> 0
- byteLength = byteLength >>> 0
- if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
-
- var i = byteLength - 1
- var mul = 1
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- this[offset + i] = (value / mul) >>> 0 & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- this[offset] = value
- return offset + 1
-}
-
-function objectWriteUInt16 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
- (littleEndian ? i : 1 - i) * 8
- }
-}
-
-Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
-}
-
-Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = value
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
-}
-
-function objectWriteUInt32 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffffffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
- }
-}
-
-Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset + 3] = (value >>> 24)
- this[offset + 2] = (value >>> 16)
- this[offset + 1] = (value >>> 8)
- this[offset] = value
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
-}
-
-Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = value
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
-}
-
-Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) {
- checkInt(
- this, value, offset, byteLength,
- Math.pow(2, 8 * byteLength - 1) - 1,
- -Math.pow(2, 8 * byteLength - 1)
- )
- }
-
- var i = 0
- var mul = 1
- var sub = value < 0 ? 1 : 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) {
- checkInt(
- this, value, offset, byteLength,
- Math.pow(2, 8 * byteLength - 1) - 1,
- -Math.pow(2, 8 * byteLength - 1)
- )
- }
-
- var i = byteLength - 1
- var mul = 1
- var sub = value < 0 ? 1 : 0
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
-
- return offset + byteLength
-}
-
-Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- if (value < 0) value = 0xff + value + 1
- this[offset] = value
- return offset + 1
-}
-
-Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
-}
-
-Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = value
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
-}
-
-Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = value
- this[offset + 1] = (value >>> 8)
- this[offset + 2] = (value >>> 16)
- this[offset + 3] = (value >>> 24)
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
-}
-
-Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset >>> 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (value < 0) value = 0xffffffff + value + 1
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = value
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
-}
-
-function checkIEEE754 (buf, value, offset, ext, max, min) {
- if (value > max || value < min) throw new RangeError('value is out of bounds')
- if (offset + ext > buf.length) throw new RangeError('index out of range')
- if (offset < 0) throw new RangeError('index out of range')
-}
-
-function writeFloat (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
- }
- ieee754.write(buf, value, offset, littleEndian, 23, 4)
- return offset + 4
-}
-
-Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
- return writeFloat(this, value, offset, true, noAssert)
-}
-
-Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
- return writeFloat(this, value, offset, false, noAssert)
-}
-
-function writeDouble (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
- }
- ieee754.write(buf, value, offset, littleEndian, 52, 8)
- return offset + 8
-}
-
-Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
- return writeDouble(this, value, offset, true, noAssert)
-}
-
-Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
- return writeDouble(this, value, offset, false, noAssert)
-}
-
-// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
-Buffer.prototype.copy = function copy (target, target_start, start, end) {
- if (!start) start = 0
- if (!end && end !== 0) end = this.length
- if (target_start >= target.length) target_start = target.length
- if (!target_start) target_start = 0
- if (end > 0 && end < start) end = start
-
- // Copy 0 bytes; we're done
- if (end === start) return 0
- if (target.length === 0 || this.length === 0) return 0
-
- // Fatal error conditions
- if (target_start < 0) {
- throw new RangeError('targetStart out of bounds')
- }
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
-
- // Are we oob?
- if (end > this.length) end = this.length
- if (target.length - target_start < end - start) {
- end = target.length - target_start + start
- }
-
- var len = end - start
-
- if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
- for (var i = 0; i < len; i++) {
- target[i + target_start] = this[i + start]
- }
- } else {
- target._set(this.subarray(start, start + len), target_start)
- }
-
- return len
-}
-
-// fill(value, start=0, end=buffer.length)
-Buffer.prototype.fill = function fill (value, start, end) {
- if (!value) value = 0
- if (!start) start = 0
- if (!end) end = this.length
-
- if (end < start) throw new RangeError('end < start')
-
- // Fill 0 bytes; we're done
- if (end === start) return
- if (this.length === 0) return
-
- if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
- if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
-
- var i
- if (typeof value === 'number') {
- for (i = start; i < end; i++) {
- this[i] = value
- }
- } else {
- var bytes = utf8ToBytes(value.toString())
- var len = bytes.length
- for (i = start; i < end; i++) {
- this[i] = bytes[i % len]
- }
- }
-
- return this
-}
-
-/**
- * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
- * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
- */
-Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
- if (typeof Uint8Array !== 'undefined') {
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- return (new Buffer(this)).buffer
- } else {
- var buf = new Uint8Array(this.length)
- for (var i = 0, len = buf.length; i < len; i += 1) {
- buf[i] = this[i]
- }
- return buf.buffer
- }
- } else {
- throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
- }
-}
-
-// HELPER FUNCTIONS
-// ================
-
-var BP = Buffer.prototype
-
-/**
- * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
- */
-Buffer._augment = function _augment (arr) {
- arr.constructor = Buffer
- arr._isBuffer = true
-
- // save reference to original Uint8Array set method before overwriting
- arr._set = arr.set
-
- // deprecated, will be removed in node 0.13+
- arr.get = BP.get
- arr.set = BP.set
-
- arr.write = BP.write
- arr.toString = BP.toString
- arr.toLocaleString = BP.toString
- arr.toJSON = BP.toJSON
- arr.equals = BP.equals
- arr.compare = BP.compare
- arr.indexOf = BP.indexOf
- arr.copy = BP.copy
- arr.slice = BP.slice
- arr.readUIntLE = BP.readUIntLE
- arr.readUIntBE = BP.readUIntBE
- arr.readUInt8 = BP.readUInt8
- arr.readUInt16LE = BP.readUInt16LE
- arr.readUInt16BE = BP.readUInt16BE
- arr.readUInt32LE = BP.readUInt32LE
- arr.readUInt32BE = BP.readUInt32BE
- arr.readIntLE = BP.readIntLE
- arr.readIntBE = BP.readIntBE
- arr.readInt8 = BP.readInt8
- arr.readInt16LE = BP.readInt16LE
- arr.readInt16BE = BP.readInt16BE
- arr.readInt32LE = BP.readInt32LE
- arr.readInt32BE = BP.readInt32BE
- arr.readFloatLE = BP.readFloatLE
- arr.readFloatBE = BP.readFloatBE
- arr.readDoubleLE = BP.readDoubleLE
- arr.readDoubleBE = BP.readDoubleBE
- arr.writeUInt8 = BP.writeUInt8
- arr.writeUIntLE = BP.writeUIntLE
- arr.writeUIntBE = BP.writeUIntBE
- arr.writeUInt16LE = BP.writeUInt16LE
- arr.writeUInt16BE = BP.writeUInt16BE
- arr.writeUInt32LE = BP.writeUInt32LE
- arr.writeUInt32BE = BP.writeUInt32BE
- arr.writeIntLE = BP.writeIntLE
- arr.writeIntBE = BP.writeIntBE
- arr.writeInt8 = BP.writeInt8
- arr.writeInt16LE = BP.writeInt16LE
- arr.writeInt16BE = BP.writeInt16BE
- arr.writeInt32LE = BP.writeInt32LE
- arr.writeInt32BE = BP.writeInt32BE
- arr.writeFloatLE = BP.writeFloatLE
- arr.writeFloatBE = BP.writeFloatBE
- arr.writeDoubleLE = BP.writeDoubleLE
- arr.writeDoubleBE = BP.writeDoubleBE
- arr.fill = BP.fill
- arr.inspect = BP.inspect
- arr.toArrayBuffer = BP.toArrayBuffer
-
- return arr
-}
-
-var INVALID_BASE64_RE = /[^+\/0-9A-z\-]/g
-
-function base64clean (str) {
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
- str = stringtrim(str).replace(INVALID_BASE64_RE, '')
- // Node converts strings with length < 2 to ''
- if (str.length < 2) return ''
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
- while (str.length % 4 !== 0) {
- str = str + '='
- }
- return str
-}
-
-function stringtrim (str) {
- if (str.trim) return str.trim()
- return str.replace(/^\s+|\s+$/g, '')
-}
-
-function isArrayish (subject) {
- return isArray(subject) || Buffer.isBuffer(subject) ||
- subject && typeof subject === 'object' &&
- typeof subject.length === 'number'
-}
-
-function toHex (n) {
- if (n < 16) return '0' + n.toString(16)
- return n.toString(16)
-}
-
-function utf8ToBytes (string, units) {
- units = units || Infinity
- var codePoint
- var length = string.length
- var leadSurrogate = null
- var bytes = []
- var i = 0
-
- for (; i < length; i++) {
- codePoint = string.charCodeAt(i)
-
- // is surrogate component
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
- // last char was a lead
- if (leadSurrogate) {
- // 2 leads in a row
- if (codePoint < 0xDC00) {
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- leadSurrogate = codePoint
- continue
- } else {
- // valid surrogate pair
- codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
- leadSurrogate = null
- }
- } else {
- // no lead yet
-
- if (codePoint > 0xDBFF) {
- // unexpected trail
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- } else if (i + 1 === length) {
- // unpaired lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- } else {
- // valid lead
- leadSurrogate = codePoint
- continue
- }
- }
- } else if (leadSurrogate) {
- // valid bmp char, but last char was a lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- leadSurrogate = null
- }
-
- // encode utf8
- if (codePoint < 0x80) {
- if ((units -= 1) < 0) break
- bytes.push(codePoint)
- } else if (codePoint < 0x800) {
- if ((units -= 2) < 0) break
- bytes.push(
- codePoint >> 0x6 | 0xC0,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x10000) {
- if ((units -= 3) < 0) break
- bytes.push(
- codePoint >> 0xC | 0xE0,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x200000) {
- if ((units -= 4) < 0) break
- bytes.push(
- codePoint >> 0x12 | 0xF0,
- codePoint >> 0xC & 0x3F | 0x80,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else {
- throw new Error('Invalid code point')
- }
- }
-
- return bytes
-}
-
-function asciiToBytes (str) {
- var byteArray = []
- for (var i = 0; i < str.length; i++) {
- // Node's code seems to be doing this and not & 0x7F..
- byteArray.push(str.charCodeAt(i) & 0xFF)
- }
- return byteArray
-}
-
-function utf16leToBytes (str, units) {
- var c, hi, lo
- var byteArray = []
- for (var i = 0; i < str.length; i++) {
- if ((units -= 2) < 0) break
-
- c = str.charCodeAt(i)
- hi = c >> 8
- lo = c % 256
- byteArray.push(lo)
- byteArray.push(hi)
- }
-
- return byteArray
-}
-
-function base64ToBytes (str) {
- return base64.toByteArray(base64clean(str))
-}
-
-function blitBuffer (src, dst, offset, length) {
- for (var i = 0; i < length; i++) {
- if ((i + offset >= dst.length) || (i >= src.length)) break
- dst[i + offset] = src[i]
- }
- return i
-}
-
-function decodeUtf8Char (str) {
- try {
- return decodeURIComponent(str)
- } catch (err) {
- return String.fromCharCode(0xFFFD) // UTF 8 invalid char
- }
-}
-
-},{"base64-js":4,"ieee754":5,"is-array":6}],4:[function(_dereq_,module,exports){
-var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
-
-;(function (exports) {
- 'use strict';
-
- var Arr = (typeof Uint8Array !== 'undefined')
- ? Uint8Array
- : Array
-
- var PLUS = '+'.charCodeAt(0)
- var SLASH = '/'.charCodeAt(0)
- var NUMBER = '0'.charCodeAt(0)
- var LOWER = 'a'.charCodeAt(0)
- var UPPER = 'A'.charCodeAt(0)
- var PLUS_URL_SAFE = '-'.charCodeAt(0)
- var SLASH_URL_SAFE = '_'.charCodeAt(0)
-
- function decode (elt) {
- var code = elt.charCodeAt(0)
- if (code === PLUS ||
- code === PLUS_URL_SAFE)
- return 62 // '+'
- if (code === SLASH ||
- code === SLASH_URL_SAFE)
- return 63 // '/'
- if (code < NUMBER)
- return -1 //no match
- if (code < NUMBER + 10)
- return code - NUMBER + 26 + 26
- if (code < UPPER + 26)
- return code - UPPER
- if (code < LOWER + 26)
- return code - LOWER + 26
- }
-
- function b64ToByteArray (b64) {
- var i, j, l, tmp, placeHolders, arr
-
- if (b64.length % 4 > 0) {
- throw new Error('Invalid string. Length must be a multiple of 4')
- }
-
- // the number of equal signs (place holders)
- // if there are two placeholders, than the two characters before it
- // represent one byte
- // if there is only one, then the three characters before it represent 2 bytes
- // this is just a cheap hack to not do indexOf twice
- var len = b64.length
- placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
-
- // base64 is 4/3 + up to two characters of the original data
- arr = new Arr(b64.length * 3 / 4 - placeHolders)
-
- // if there are placeholders, only get up to the last complete 4 chars
- l = placeHolders > 0 ? b64.length - 4 : b64.length
-
- var L = 0
-
- function push (v) {
- arr[L++] = v
- }
-
- for (i = 0, j = 0; i < l; i += 4, j += 3) {
- tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
- push((tmp & 0xFF0000) >> 16)
- push((tmp & 0xFF00) >> 8)
- push(tmp & 0xFF)
- }
-
- if (placeHolders === 2) {
- tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
- push(tmp & 0xFF)
- } else if (placeHolders === 1) {
- tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
- push((tmp >> 8) & 0xFF)
- push(tmp & 0xFF)
- }
-
- return arr
- }
-
- function uint8ToBase64 (uint8) {
- var i,
- extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
- output = "",
- temp, length
-
- function encode (num) {
- return lookup.charAt(num)
- }
-
- function tripletToBase64 (num) {
- return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
- }
-
- // go through the array every three bytes, we'll deal with trailing stuff later
- for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
- temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
- output += tripletToBase64(temp)
- }
-
- // pad the end with zeros, but make sure to not forget the extra bytes
- switch (extraBytes) {
- case 1:
- temp = uint8[uint8.length - 1]
- output += encode(temp >> 2)
- output += encode((temp << 4) & 0x3F)
- output += '=='
- break
- case 2:
- temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
- output += encode(temp >> 10)
- output += encode((temp >> 4) & 0x3F)
- output += encode((temp << 2) & 0x3F)
- output += '='
- break
- }
-
- return output
- }
-
- exports.toByteArray = b64ToByteArray
- exports.fromByteArray = uint8ToBase64
-}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
-
-},{}],5:[function(_dereq_,module,exports){
-exports.read = function(buffer, offset, isLE, mLen, nBytes) {
- var e, m,
- eLen = nBytes * 8 - mLen - 1,
- eMax = (1 << eLen) - 1,
- eBias = eMax >> 1,
- nBits = -7,
- i = isLE ? (nBytes - 1) : 0,
- d = isLE ? -1 : 1,
- s = buffer[offset + i];
-
- i += d;
-
- e = s & ((1 << (-nBits)) - 1);
- s >>= (-nBits);
- nBits += eLen;
- for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8);
-
- m = e & ((1 << (-nBits)) - 1);
- e >>= (-nBits);
- nBits += mLen;
- for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8);
-
- if (e === 0) {
- e = 1 - eBias;
- } else if (e === eMax) {
- return m ? NaN : ((s ? -1 : 1) * Infinity);
- } else {
- m = m + Math.pow(2, mLen);
- e = e - eBias;
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
-};
-
-exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c,
- eLen = nBytes * 8 - mLen - 1,
- eMax = (1 << eLen) - 1,
- eBias = eMax >> 1,
- rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
- i = isLE ? 0 : (nBytes - 1),
- d = isLE ? 1 : -1,
- s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
-
- value = Math.abs(value);
-
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0;
- e = eMax;
- } else {
- e = Math.floor(Math.log(value) / Math.LN2);
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--;
- c *= 2;
- }
- if (e + eBias >= 1) {
- value += rt / c;
- } else {
- value += rt * Math.pow(2, 1 - eBias);
- }
- if (value * c >= 2) {
- e++;
- c /= 2;
- }
-
- if (e + eBias >= eMax) {
- m = 0;
- e = eMax;
- } else if (e + eBias >= 1) {
- m = (value * c - 1) * Math.pow(2, mLen);
- e = e + eBias;
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
- e = 0;
- }
- }
-
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8);
-
- e = (e << mLen) | m;
- eLen += mLen;
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8);
-
- buffer[offset + i - d] |= s * 128;
-};
-
-},{}],6:[function(_dereq_,module,exports){
-
-/**
- * isArray
- */
-
-var isArray = Array.isArray;
-
-/**
- * toString
- */
-
-var str = Object.prototype.toString;
-
-/**
- * Whether or not the given `val`
- * is an array.
- *
- * example:
- *
- * isArray([]);
- * // > true
- * isArray(arguments);
- * // > false
- * isArray('');
- * // > false
- *
- * @param {mixed} val
- * @return {bool}
- */
-
-module.exports = isArray || function (val) {
- return !! val && '[object Array]' == str.call(val);
-};
-
-},{}],7:[function(_dereq_,module,exports){
-(function (process){
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// resolves . and .. elements in a path array with directory names there
-// must be no slashes, empty elements, or device names (c:\) in the array
-// (so also no leading and trailing slashes - it does not distinguish
-// relative and absolute paths)
-function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- }
-
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
-
- return parts;
-}
-
-// Split a filename into [root, dir, basename, ext], unix version
-// 'root' is just a slash, or nothing.
-var splitPathRe =
- /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
-var splitPath = function(filename) {
- return splitPathRe.exec(filename).slice(1);
-};
-
-// path.resolve([from ...], to)
-// posix version
-exports.resolve = function() {
- var resolvedPath = '',
- resolvedAbsolute = false;
-
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = (i >= 0) ? arguments[i] : process.cwd();
-
- // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
-
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- }
-
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
-
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
-
- return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
-};
-
-// path.normalize(path)
-// posix version
-exports.normalize = function(path) {
- var isAbsolute = exports.isAbsolute(path),
- trailingSlash = substr(path, -1) === '/';
-
- // Normalize the path
- path = normalizeArray(filter(path.split('/'), function(p) {
- return !!p;
- }), !isAbsolute).join('/');
-
- if (!path && !isAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
-
- return (isAbsolute ? '/' : '') + path;
-};
-
-// posix version
-exports.isAbsolute = function(path) {
- return path.charAt(0) === '/';
-};
-
-// posix version
-exports.join = function() {
- var paths = Array.prototype.slice.call(arguments, 0);
- return exports.normalize(filter(paths, function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
-};
-
-
-// path.relative(from, to)
-// posix version
-exports.relative = function(from, to) {
- from = exports.resolve(from).substr(1);
- to = exports.resolve(to).substr(1);
-
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
-
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
-
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
-
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
-
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
-
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
-
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
-
- return outputParts.join('/');
-};
-
-exports.sep = '/';
-exports.delimiter = ':';
-
-exports.dirname = function(path) {
- var result = splitPath(path),
- root = result[0],
- dir = result[1];
-
- if (!root && !dir) {
- // No dirname whatsoever
- return '.';
- }
-
- if (dir) {
- // It has a dirname, strip trailing slash
- dir = dir.substr(0, dir.length - 1);
- }
-
- return root + dir;
-};
-
-
-exports.basename = function(path, ext) {
- var f = splitPath(path)[2];
- // TODO: make this comparison case-insensitive on windows?
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
-};
-
-
-exports.extname = function(path) {
- return splitPath(path)[3];
-};
-
-function filter (xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
-}
-
-// String.prototype.substr - negative index don't work in IE8
-var substr = 'ab'.substr(-1) === 'b'
- ? function (str, start, len) { return str.substr(start, len) }
- : function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
- }
-;
-
-}).call(this,_dereq_('_process'))
-},{"_process":8}],8:[function(_dereq_,module,exports){
-// shim for using process in browser
-
-var process = module.exports = {};
-var queue = [];
-var draining = false;
-
-function drainQueue() {
- if (draining) {
- return;
- }
- draining = true;
- var currentQueue;
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- var i = -1;
- while (++i < len) {
- currentQueue[i]();
- }
- len = queue.length;
- }
- draining = false;
-}
-process.nextTick = function (fun) {
- queue.push(fun);
- if (!draining) {
- setTimeout(drainQueue, 0);
- }
-};
-
-process.title = 'browser';
-process.browser = true;
-process.env = {};
-process.argv = [];
-process.version = ''; // empty string to avoid regexp issues
-process.versions = {};
-
-function noop() {}
-
-process.on = noop;
-process.addListener = noop;
-process.once = noop;
-process.off = noop;
-process.removeListener = noop;
-process.removeAllListeners = noop;
-process.emit = noop;
-
-process.binding = function (name) {
- throw new Error('process.binding is not supported');
-};
-
-// TODO(shtylman)
-process.cwd = function () { return '/' };
-process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
-};
-process.umask = function() { return 0; };
-
-},{}],9:[function(_dereq_,module,exports){
-/*
- Copyright (C) 2013 Ariya Hidayat <ariya.hidayat@gmail.com>
- Copyright (C) 2013 Thaddee Tyl <thaddee.tyl@gmail.com>
- Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
- Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
- Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
- Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
- Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
- Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
- Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-(function (root, factory) {
- 'use strict';
-
- // Universal Module Definition (UMD) to support AMD, CommonJS/Node.js,
- // Rhino, and plain browser loading.
-
- /* istanbul ignore next */
- if (typeof define === 'function' && define.amd) {
- define(['exports'], factory);
- } else if (typeof exports !== 'undefined') {
- factory(exports);
- } else {
- factory((root.esprima = {}));
- }
-}(this, function (exports) {
- 'use strict';
-
- var Token,
- TokenName,
- FnExprTokens,
- Syntax,
- PropertyKind,
- Messages,
- Regex,
- SyntaxTreeDelegate,
- XHTMLEntities,
- ClassPropertyType,
- source,
- strict,
- index,
- lineNumber,
- lineStart,
- length,
- delegate,
- lookahead,
- state,
- extra;
-
- Token = {
- BooleanLiteral: 1,
- EOF: 2,
- Identifier: 3,
- Keyword: 4,
- NullLiteral: 5,
- NumericLiteral: 6,
- Punctuator: 7,
- StringLiteral: 8,
- RegularExpression: 9,
- Template: 10,
- JSXIdentifier: 11,
- JSXText: 12
- };
-
- TokenName = {};
- TokenName[Token.BooleanLiteral] = 'Boolean';
- TokenName[Token.EOF] = '<end>';
- TokenName[Token.Identifier] = 'Identifier';
- TokenName[Token.Keyword] = 'Keyword';
- TokenName[Token.NullLiteral] = 'Null';
- TokenName[Token.NumericLiteral] = 'Numeric';
- TokenName[Token.Punctuator] = 'Punctuator';
- TokenName[Token.StringLiteral] = 'String';
- TokenName[Token.JSXIdentifier] = 'JSXIdentifier';
- TokenName[Token.JSXText] = 'JSXText';
- TokenName[Token.RegularExpression] = 'RegularExpression';
-
- // A function following one of those tokens is an expression.
- FnExprTokens = ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
- 'return', 'case', 'delete', 'throw', 'void',
- // assignment operators
- '=', '+=', '-=', '*=', '/=', '%=', '<<=', '>>=', '>>>=',
- '&=', '|=', '^=', ',',
- // binary/unary operators
- '+', '-', '*', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
- '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
- '<=', '<', '>', '!=', '!=='];
-
- Syntax = {
- AnyTypeAnnotation: 'AnyTypeAnnotation',
- ArrayExpression: 'ArrayExpression',
- ArrayPattern: 'ArrayPattern',
- ArrayTypeAnnotation: 'ArrayTypeAnnotation',
- ArrowFunctionExpression: 'ArrowFunctionExpression',
- AssignmentExpression: 'AssignmentExpression',
- BinaryExpression: 'BinaryExpression',
- BlockStatement: 'BlockStatement',
- BooleanTypeAnnotation: 'BooleanTypeAnnotation',
- BreakStatement: 'BreakStatement',
- CallExpression: 'CallExpression',
- CatchClause: 'CatchClause',
- ClassBody: 'ClassBody',
- ClassDeclaration: 'ClassDeclaration',
- ClassExpression: 'ClassExpression',
- ClassImplements: 'ClassImplements',
- ClassProperty: 'ClassProperty',
- ComprehensionBlock: 'ComprehensionBlock',
- ComprehensionExpression: 'ComprehensionExpression',
- ConditionalExpression: 'ConditionalExpression',
- ContinueStatement: 'ContinueStatement',
- DebuggerStatement: 'DebuggerStatement',
- DeclareClass: 'DeclareClass',
- DeclareFunction: 'DeclareFunction',
- DeclareModule: 'DeclareModule',
- DeclareVariable: 'DeclareVariable',
- DoWhileStatement: 'DoWhileStatement',
- EmptyStatement: 'EmptyStatement',
- ExportDeclaration: 'ExportDeclaration',
- ExportBatchSpecifier: 'ExportBatchSpecifier',
- ExportSpecifier: 'ExportSpecifier',
- ExpressionStatement: 'ExpressionStatement',
- ForInStatement: 'ForInStatement',
- ForOfStatement: 'ForOfStatement',
- ForStatement: 'ForStatement',
- FunctionDeclaration: 'FunctionDeclaration',
- FunctionExpression: 'FunctionExpression',
- FunctionTypeAnnotation: 'FunctionTypeAnnotation',
- FunctionTypeParam: 'FunctionTypeParam',
- GenericTypeAnnotation: 'GenericTypeAnnotation',
- Identifier: 'Identifier',
- IfStatement: 'IfStatement',
- ImportDeclaration: 'ImportDeclaration',
- ImportDefaultSpecifier: 'ImportDefaultSpecifier',
- ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
- ImportSpecifier: 'ImportSpecifier',
- InterfaceDeclaration: 'InterfaceDeclaration',
- InterfaceExtends: 'InterfaceExtends',
- IntersectionTypeAnnotation: 'IntersectionTypeAnnotation',
- LabeledStatement: 'LabeledStatement',
- Literal: 'Literal',
- LogicalExpression: 'LogicalExpression',
- MemberExpression: 'MemberExpression',
- MethodDefinition: 'MethodDefinition',
- ModuleSpecifier: 'ModuleSpecifier',
- NewExpression: 'NewExpression',
- NullableTypeAnnotation: 'NullableTypeAnnotation',
- NumberTypeAnnotation: 'NumberTypeAnnotation',
- ObjectExpression: 'ObjectExpression',
- ObjectPattern: 'ObjectPattern',
- ObjectTypeAnnotation: 'ObjectTypeAnnotation',
- ObjectTypeCallProperty: 'ObjectTypeCallProperty',
- ObjectTypeIndexer: 'ObjectTypeIndexer',
- ObjectTypeProperty: 'ObjectTypeProperty',
- Program: 'Program',
- Property: 'Property',
- QualifiedTypeIdentifier: 'QualifiedTypeIdentifier',
- ReturnStatement: 'ReturnStatement',
- SequenceExpression: 'SequenceExpression',
- SpreadElement: 'SpreadElement',
- SpreadProperty: 'SpreadProperty',
- StringLiteralTypeAnnotation: 'StringLiteralTypeAnnotation',
- StringTypeAnnotation: 'StringTypeAnnotation',
- SwitchCase: 'SwitchCase',
- SwitchStatement: 'SwitchStatement',
- TaggedTemplateExpression: 'TaggedTemplateExpression',
- TemplateElement: 'TemplateElement',
- TemplateLiteral: 'TemplateLiteral',
- ThisExpression: 'ThisExpression',
- ThrowStatement: 'ThrowStatement',
- TupleTypeAnnotation: 'TupleTypeAnnotation',
- TryStatement: 'TryStatement',
- TypeAlias: 'TypeAlias',
- TypeAnnotation: 'TypeAnnotation',
- TypeCastExpression: 'TypeCastExpression',
- TypeofTypeAnnotation: 'TypeofTypeAnnotation',
- TypeParameterDeclaration: 'TypeParameterDeclaration',
- TypeParameterInstantiation: 'TypeParameterInstantiation',
- UnaryExpression: 'UnaryExpression',
- UnionTypeAnnotation: 'UnionTypeAnnotation',
- UpdateExpression: 'UpdateExpression',
- VariableDeclaration: 'VariableDeclaration',
- VariableDeclarator: 'VariableDeclarator',
- VoidTypeAnnotation: 'VoidTypeAnnotation',
- WhileStatement: 'WhileStatement',
- WithStatement: 'WithStatement',
- JSXIdentifier: 'JSXIdentifier',
- JSXNamespacedName: 'JSXNamespacedName',
- JSXMemberExpression: 'JSXMemberExpression',
- JSXEmptyExpression: 'JSXEmptyExpression',
- JSXExpressionContainer: 'JSXExpressionContainer',
- JSXElement: 'JSXElement',
- JSXClosingElement: 'JSXClosingElement',
- JSXOpeningElement: 'JSXOpeningElement',
- JSXAttribute: 'JSXAttribute',
- JSXSpreadAttribute: 'JSXSpreadAttribute',
- JSXText: 'JSXText',
- YieldExpression: 'YieldExpression',
- AwaitExpression: 'AwaitExpression'
- };
-
- PropertyKind = {
- Data: 1,
- Get: 2,
- Set: 4
- };
-
- ClassPropertyType = {
- 'static': 'static',
- prototype: 'prototype'
- };
-
- // Error messages should be identical to V8.
- Messages = {
- UnexpectedToken: 'Unexpected token %0',
- UnexpectedNumber: 'Unexpected number',
- UnexpectedString: 'Unexpected string',
- UnexpectedIdentifier: 'Unexpected identifier',
- UnexpectedReserved: 'Unexpected reserved word',
- UnexpectedTemplate: 'Unexpected quasi %0',
- UnexpectedEOS: 'Unexpected end of input',
- NewlineAfterThrow: 'Illegal newline after throw',
- InvalidRegExp: 'Invalid regular expression',
- UnterminatedRegExp: 'Invalid regular expression: missing /',
- InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
- InvalidLHSInFormalsList: 'Invalid left-hand side in formals list',
- InvalidLHSInForIn: 'Invalid left-hand side in for-in',
- MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
- NoCatchOrFinally: 'Missing catch or finally after try',
- UnknownLabel: 'Undefined label \'%0\'',
- Redeclaration: '%0 \'%1\' has already been declared',
- IllegalContinue: 'Illegal continue statement',
- IllegalBreak: 'Illegal break statement',
- IllegalDuplicateClassProperty: 'Illegal duplicate property in class definition',
- IllegalClassConstructorProperty: 'Illegal constructor property in class definition',
- IllegalReturn: 'Illegal return statement',
- IllegalSpread: 'Illegal spread element',
- StrictModeWith: 'Strict mode code may not include a with statement',
- StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
- StrictVarName: 'Variable name may not be eval or arguments in strict mode',
- StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
- StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
- ParameterAfterRestParameter: 'Rest parameter must be final parameter of an argument list',
- DefaultRestParameter: 'Rest parameter can not have a default value',
- ElementAfterSpreadElement: 'Spread must be the final element of an element list',
- PropertyAfterSpreadProperty: 'A rest property must be the final property of an object literal',
- ObjectPatternAsRestParameter: 'Invalid rest parameter',
- ObjectPatternAsSpread: 'Invalid spread argument',
- StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
- StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
- StrictDelete: 'Delete of an unqualified identifier in strict mode.',
- StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',
- AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',
- AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',
- StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
- StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
- StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
- StrictReservedWord: 'Use of future reserved word in strict mode',
- MissingFromClause: 'Missing from clause',
- NoAsAfterImportNamespace: 'Missing as after import *',
- InvalidModuleSpecifier: 'Invalid module specifier',
- IllegalImportDeclaration: 'Illegal import declaration',
- IllegalExportDeclaration: 'Illegal export declaration',
- NoUninitializedConst: 'Const must be initialized',
- ComprehensionRequiresBlock: 'Comprehension must have at least one block',
- ComprehensionError: 'Comprehension Error',
- EachNotAllowed: 'Each is not supported',
- InvalidJSXAttributeValue: 'JSX value should be either an expression or a quoted JSX text',
- ExpectedJSXClosingTag: 'Expected corresponding JSX closing tag for %0',
- AdjacentJSXElements: 'Adjacent JSX elements must be wrapped in an enclosing tag',
- ConfusedAboutFunctionType: 'Unexpected token =>. It looks like ' +
- 'you are trying to write a function type, but you ended up ' +
- 'writing a grouped type followed by an =>, which is a syntax ' +
- 'error. Remember, function type parameters are named so function ' +
- 'types look like (name1: type1, name2: type2) => returnType. You ' +
- 'probably wrote (type1) => returnType'
- };
-
- // See also tools/generate-unicode-regex.py.
- Regex = {
- NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
- NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),
- LeadingZeros: new RegExp('^0+(?!$)')
- };
-
- // Ensure the condition is true, otherwise throw an error.
- // This is only to have a better contract semantic, i.e. another safety net
- // to catch a logic error. The condition shall be fulfilled in normal case.
- // Do NOT use this to enforce a certain condition on any user input.
-
- function assert(condition, message) {
- /* istanbul ignore if */
- if (!condition) {
- throw new Error('ASSERT: ' + message);
- }
- }
-
- function StringMap() {
- this.$data = {};
- }
-
- StringMap.prototype.get = function (key) {
- key = '$' + key;
- return this.$data[key];
- };
-
- StringMap.prototype.set = function (key, value) {
- key = '$' + key;
- this.$data[key] = value;
- return this;
- };
-
- StringMap.prototype.has = function (key) {
- key = '$' + key;
- return Object.prototype.hasOwnProperty.call(this.$data, key);
- };
-
- StringMap.prototype["delete"] = function (key) {
- key = '$' + key;
- return delete this.$data[key];
- };
-
- function isDecimalDigit(ch) {
- return (ch >= 48 && ch <= 57); // 0..9
- }
-
- function isHexDigit(ch) {
- return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;
- }
-
- function isOctalDigit(ch) {
- return '01234567'.indexOf(ch) >= 0;
- }
-
-
- // 7.2 White Space
-
- function isWhiteSpace(ch) {
- return (ch === 32) || // space
- (ch === 9) || // tab
- (ch === 0xB) ||
- (ch === 0xC) ||
- (ch === 0xA0) ||
- (ch >= 0x1680 && '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);
- }
-
- // 7.3 Line Terminators
-
- function isLineTerminator(ch) {
- return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);
- }
-
- // 7.6 Identifier Names and Identifiers
-
- function isIdentifierStart(ch) {
- return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
- (ch >= 65 && ch <= 90) || // A..Z
- (ch >= 97 && ch <= 122) || // a..z
- (ch === 92) || // \ (backslash)
- ((ch >= 0x80) && Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch)));
- }
-
- function isIdentifierPart(ch) {
- return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
- (ch >= 65 && ch <= 90) || // A..Z
- (ch >= 97 && ch <= 122) || // a..z
- (ch >= 48 && ch <= 57) || // 0..9
- (ch === 92) || // \ (backslash)
- ((ch >= 0x80) && Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
- }
-
- // 7.6.1.2 Future Reserved Words
-
- function isFutureReservedWord(id) {
- switch (id) {
- case 'class':
- case 'enum':
- case 'export':
- case 'extends':
- case 'import':
- case 'super':
- return true;
- default:
- return false;
- }
- }
-
- function isStrictModeReservedWord(id) {
- switch (id) {
- case 'implements':
- case 'interface':
- case 'package':
- case 'private':
- case 'protected':
- case 'public':
- case 'static':
- case 'yield':
- case 'let':
- return true;
- default:
- return false;
- }
- }
-
- function isRestrictedWord(id) {
- return id === 'eval' || id === 'arguments';
- }
-
- // 7.6.1.1 Keywords
-
- function isKeyword(id) {
- if (strict && isStrictModeReservedWord(id)) {
- return true;
- }
-
- // 'const' is specialized as Keyword in V8.
- // 'yield' is only treated as a keyword in strict mode.
- // 'let' is for compatiblity with SpiderMonkey and ES.next.
- // Some others are from future reserved words.
-
- switch (id.length) {
- case 2:
- return (id === 'if') || (id === 'in') || (id === 'do');
- case 3:
- return (id === 'var') || (id === 'for') || (id === 'new') ||
- (id === 'try') || (id === 'let');
- case 4:
- return (id === 'this') || (id === 'else') || (id === 'case') ||
- (id === 'void') || (id === 'with') || (id === 'enum');
- case 5:
- return (id === 'while') || (id === 'break') || (id === 'catch') ||
- (id === 'throw') || (id === 'const') ||
- (id === 'class') || (id === 'super');
- case 6:
- return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
- (id === 'switch') || (id === 'export') || (id === 'import');
- case 7:
- return (id === 'default') || (id === 'finally') || (id === 'extends');
- case 8:
- return (id === 'function') || (id === 'continue') || (id === 'debugger');
- case 10:
- return (id === 'instanceof');
- default:
- return false;
- }
- }
-
- // 7.4 Comments
-
- function addComment(type, value, start, end, loc) {
- var comment;
- assert(typeof start === 'number', 'Comment must have valid position');
-
- // Because the way the actual token is scanned, often the comments
- // (if any) are skipped twice during the lexical analysis.
- // Thus, we need to skip adding a comment if the comment array already
- // handled it.
- if (state.lastCommentStart >= start) {
- return;
- }
- state.lastCommentStart = start;
-
- comment = {
- type: type,
- value: value
- };
- if (extra.range) {
- comment.range = [start, end];
- }
- if (extra.loc) {
- comment.loc = loc;
- }
- extra.comments.push(comment);
- if (extra.attachComment) {
- extra.leadingComments.push(comment);
- extra.trailingComments.push(comment);
- }
- }
-
- function skipSingleLineComment() {
- var start, loc, ch, comment;
-
- start = index - 2;
- loc = {
- start: {
- line: lineNumber,
- column: index - lineStart - 2
- }
- };
-
- while (index < length) {
- ch = source.charCodeAt(index);
- ++index;
- if (isLineTerminator(ch)) {
- if (extra.comments) {
- comment = source.slice(start + 2, index - 1);
- loc.end = {
- line: lineNumber,
- column: index - lineStart - 1
- };
- addComment('Line', comment, start, index - 1, loc);
- }
- if (ch === 13 && source.charCodeAt(index) === 10) {
- ++index;
- }
- ++lineNumber;
- lineStart = index;
- return;
- }
- }
-
- if (extra.comments) {
- comment = source.slice(start + 2, index);
- loc.end = {
- line: lineNumber,
- column: index - lineStart
- };
- addComment('Line', comment, start, index, loc);
- }
- }
-
- function skipMultiLineComment() {
- var start, loc, ch, comment;
-
- if (extra.comments) {
- start = index - 2;
- loc = {
- start: {
- line: lineNumber,
- column: index - lineStart - 2
- }
- };
- }
-
- while (index < length) {
- ch = source.charCodeAt(index);
- if (isLineTerminator(ch)) {
- if (ch === 13 && source.charCodeAt(index + 1) === 10) {
- ++index;
- }
- ++lineNumber;
- ++index;
- lineStart = index;
- if (index >= length) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- } else if (ch === 42) {
- // Block comment ends with '*/' (char #42, char #47).
- if (source.charCodeAt(index + 1) === 47) {
- ++index;
- ++index;
- if (extra.comments) {
- comment = source.slice(start + 2, index - 2);
- loc.end = {
- line: lineNumber,
- column: index - lineStart
- };
- addComment('Block', comment, start, index, loc);
- }
- return;
- }
- ++index;
- } else {
- ++index;
- }
- }
-
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- function skipComment() {
- var ch;
-
- while (index < length) {
- ch = source.charCodeAt(index);
-
- if (isWhiteSpace(ch)) {
- ++index;
- } else if (isLineTerminator(ch)) {
- ++index;
- if (ch === 13 && source.charCodeAt(index) === 10) {
- ++index;
- }
- ++lineNumber;
- lineStart = index;
- } else if (ch === 47) { // 47 is '/'
- ch = source.charCodeAt(index + 1);
- if (ch === 47) {
- ++index;
- ++index;
- skipSingleLineComment();
- } else if (ch === 42) { // 42 is '*'
- ++index;
- ++index;
- skipMultiLineComment();
- } else {
- break;
- }
- } else {
- break;
- }
- }
- }
-
- function scanHexEscape(prefix) {
- var i, len, ch, code = 0;
-
- len = (prefix === 'u') ? 4 : 2;
- for (i = 0; i < len; ++i) {
- if (index < length && isHexDigit(source[index])) {
- ch = source[index++];
- code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
- } else {
- return '';
- }
- }
- return String.fromCharCode(code);
- }
-
- function scanUnicodeCodePointEscape() {
- var ch, code, cu1, cu2;
-
- ch = source[index];
- code = 0;
-
- // At least, one hex digit is required.
- if (ch === '}') {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- while (index < length) {
- ch = source[index++];
- if (!isHexDigit(ch)) {
- break;
- }
- code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
- }
-
- if (code > 0x10FFFF || ch !== '}') {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- // UTF-16 Encoding
- if (code <= 0xFFFF) {
- return String.fromCharCode(code);
- }
- cu1 = ((code - 0x10000) >> 10) + 0xD800;
- cu2 = ((code - 0x10000) & 1023) + 0xDC00;
- return String.fromCharCode(cu1, cu2);
- }
-
- function getEscapedIdentifier() {
- var ch, id;
-
- ch = source.charCodeAt(index++);
- id = String.fromCharCode(ch);
-
- // '\u' (char #92, char #117) denotes an escaped character.
- if (ch === 92) {
- if (source.charCodeAt(index) !== 117) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- ++index;
- ch = scanHexEscape('u');
- if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- id = ch;
- }
-
- while (index < length) {
- ch = source.charCodeAt(index);
- if (!isIdentifierPart(ch)) {
- break;
- }
- ++index;
- id += String.fromCharCode(ch);
-
- // '\u' (char #92, char #117) denotes an escaped character.
- if (ch === 92) {
- id = id.substr(0, id.length - 1);
- if (source.charCodeAt(index) !== 117) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- ++index;
- ch = scanHexEscape('u');
- if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- id += ch;
- }
- }
-
- return id;
- }
-
- function getIdentifier() {
- var start, ch;
-
- start = index++;
- while (index < length) {
- ch = source.charCodeAt(index);
- if (ch === 92) {
- // Blackslash (char #92) marks Unicode escape sequence.
- index = start;
- return getEscapedIdentifier();
- }
- if (isIdentifierPart(ch)) {
- ++index;
- } else {
- break;
- }
- }
-
- return source.slice(start, index);
- }
-
- function scanIdentifier() {
- var start, id, type;
-
- start = index;
-
- // Backslash (char #92) starts an escaped character.
- id = (source.charCodeAt(index) === 92) ? getEscapedIdentifier() : getIdentifier();
-
- // There is no keyword or literal with only one character.
- // Thus, it must be an identifier.
- if (id.length === 1) {
- type = Token.Identifier;
- } else if (isKeyword(id)) {
- type = Token.Keyword;
- } else if (id === 'null') {
- type = Token.NullLiteral;
- } else if (id === 'true' || id === 'false') {
- type = Token.BooleanLiteral;
- } else {
- type = Token.Identifier;
- }
-
- return {
- type: type,
- value: id,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
-
- // 7.7 Punctuators
-
- function scanPunctuator() {
- var start = index,
- code = source.charCodeAt(index),
- code2,
- ch1 = source[index],
- ch2,
- ch3,
- ch4;
-
- if (state.inJSXTag || state.inJSXChild) {
- // Don't need to check for '{' and '}' as it's already handled
- // correctly by default.
- switch (code) {
- case 60: // <
- case 62: // >
- ++index;
- return {
- type: Token.Punctuator,
- value: String.fromCharCode(code),
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
- }
-
- switch (code) {
- // Check for most common single-character punctuators.
- case 40: // ( open bracket
- case 41: // ) close bracket
- case 59: // ; semicolon
- case 44: // , comma
- case 123: // { open curly brace
- case 125: // } close curly brace
- case 91: // [
- case 93: // ]
- case 58: // :
- case 63: // ?
- case 126: // ~
- ++index;
- if (extra.tokenize) {
- if (code === 40) {
- extra.openParenToken = extra.tokens.length;
- } else if (code === 123) {
- extra.openCurlyToken = extra.tokens.length;
- }
- }
- return {
- type: Token.Punctuator,
- value: String.fromCharCode(code),
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
-
- default:
- code2 = source.charCodeAt(index + 1);
-
- // '=' (char #61) marks an assignment or comparison operator.
- if (code2 === 61) {
- switch (code) {
- case 37: // %
- case 38: // &
- case 42: // *:
- case 43: // +
- case 45: // -
- case 47: // /
- case 60: // <
- case 62: // >
- case 94: // ^
- case 124: // |
- index += 2;
- return {
- type: Token.Punctuator,
- value: String.fromCharCode(code) + String.fromCharCode(code2),
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
-
- case 33: // !
- case 61: // =
- index += 2;
-
- // !== and ===
- if (source.charCodeAt(index) === 61) {
- ++index;
- }
- return {
- type: Token.Punctuator,
- value: source.slice(start, index),
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- default:
- break;
- }
- }
- break;
- }
-
- // Peek more characters.
-
- ch2 = source[index + 1];
- ch3 = source[index + 2];
- ch4 = source[index + 3];
-
- // 4-character punctuator: >>>=
-
- if (ch1 === '>' && ch2 === '>' && ch3 === '>') {
- if (ch4 === '=') {
- index += 4;
- return {
- type: Token.Punctuator,
- value: '>>>=',
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
- }
-
- // 3-character punctuators: === !== >>> <<= >>=
-
- if (ch1 === '>' && ch2 === '>' && ch3 === '>' && !state.inType) {
- index += 3;
- return {
- type: Token.Punctuator,
- value: '>>>',
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- if (ch1 === '<' && ch2 === '<' && ch3 === '=') {
- index += 3;
- return {
- type: Token.Punctuator,
- value: '<<=',
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- if (ch1 === '>' && ch2 === '>' && ch3 === '=') {
- index += 3;
- return {
- type: Token.Punctuator,
- value: '>>=',
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- if (ch1 === '.' && ch2 === '.' && ch3 === '.') {
- index += 3;
- return {
- type: Token.Punctuator,
- value: '...',
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- // Other 2-character punctuators: ++ -- << >> && ||
-
- // Don't match these tokens if we're in a type, since they never can
- // occur and can mess up types like Map<string, Array<string>>
- if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0) && !state.inType) {
- index += 2;
- return {
- type: Token.Punctuator,
- value: ch1 + ch2,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- if (ch1 === '=' && ch2 === '>') {
- index += 2;
- return {
- type: Token.Punctuator,
- value: '=>',
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
- ++index;
- return {
- type: Token.Punctuator,
- value: ch1,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- if (ch1 === '.') {
- ++index;
- return {
- type: Token.Punctuator,
- value: ch1,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- // 7.8.3 Numeric Literals
-
- function scanHexLiteral(start) {
- var number = '';
-
- while (index < length) {
- if (!isHexDigit(source[index])) {
- break;
- }
- number += source[index++];
- }
-
- if (number.length === 0) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- if (isIdentifierStart(source.charCodeAt(index))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- return {
- type: Token.NumericLiteral,
- value: parseInt('0x' + number, 16),
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- function scanBinaryLiteral(start) {
- var ch, number;
-
- number = '';
-
- while (index < length) {
- ch = source[index];
- if (ch !== '0' && ch !== '1') {
- break;
- }
- number += source[index++];
- }
-
- if (number.length === 0) {
- // only 0b or 0B
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- if (index < length) {
- ch = source.charCodeAt(index);
- /* istanbul ignore else */
- if (isIdentifierStart(ch) || isDecimalDigit(ch)) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- }
-
- return {
- type: Token.NumericLiteral,
- value: parseInt(number, 2),
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- function scanOctalLiteral(prefix, start) {
- var number, octal;
-
- if (isOctalDigit(prefix)) {
- octal = true;
- number = '0' + source[index++];
- } else {
- octal = false;
- ++index;
- number = '';
- }
-
- while (index < length) {
- if (!isOctalDigit(source[index])) {
- break;
- }
- number += source[index++];
- }
-
- if (!octal && number.length === 0) {
- // only 0o or 0O
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- return {
- type: Token.NumericLiteral,
- value: parseInt(number, 8),
- octal: octal,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- function scanNumericLiteral() {
- var number, start, ch;
-
- ch = source[index];
- assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
- 'Numeric literal must start with a decimal digit or a decimal point');
-
- start = index;
- number = '';
- if (ch !== '.') {
- number = source[index++];
- ch = source[index];
-
- // Hex number starts with '0x'.
- // Octal number starts with '0'.
- // Octal number in ES6 starts with '0o'.
- // Binary number in ES6 starts with '0b'.
- if (number === '0') {
- if (ch === 'x' || ch === 'X') {
- ++index;
- return scanHexLiteral(start);
- }
- if (ch === 'b' || ch === 'B') {
- ++index;
- return scanBinaryLiteral(start);
- }
- if (ch === 'o' || ch === 'O' || isOctalDigit(ch)) {
- return scanOctalLiteral(ch, start);
- }
- // decimal number starts with '0' such as '09' is illegal.
- if (ch && isDecimalDigit(ch.charCodeAt(0))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- }
-
- while (isDecimalDigit(source.charCodeAt(index))) {
- number += source[index++];
- }
- ch = source[index];
- }
-
- if (ch === '.') {
- number += source[index++];
- while (isDecimalDigit(source.charCodeAt(index))) {
- number += source[index++];
- }
- ch = source[index];
- }
-
- if (ch === 'e' || ch === 'E') {
- number += source[index++];
-
- ch = source[index];
- if (ch === '+' || ch === '-') {
- number += source[index++];
- }
- if (isDecimalDigit(source.charCodeAt(index))) {
- while (isDecimalDigit(source.charCodeAt(index))) {
- number += source[index++];
- }
- } else {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- }
-
- if (isIdentifierStart(source.charCodeAt(index))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- return {
- type: Token.NumericLiteral,
- value: parseFloat(number),
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- // 7.8.4 String Literals
-
- function scanStringLiteral() {
- var str = '', quote, start, ch, code, unescaped, restore, octal = false;
-
- quote = source[index];
- assert((quote === '\'' || quote === '"'),
- 'String literal must starts with a quote');
-
- start = index;
- ++index;
-
- while (index < length) {
- ch = source[index++];
-
- if (ch === quote) {
- quote = '';
- break;
- } else if (ch === '\\') {
- ch = source[index++];
- if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
- switch (ch) {
- case 'n':
- str += '\n';
- break;
- case 'r':
- str += '\r';
- break;
- case 't':
- str += '\t';
- break;
- case 'u':
- case 'x':
- if (source[index] === '{') {
- ++index;
- str += scanUnicodeCodePointEscape();
- } else {
- restore = index;
- unescaped = scanHexEscape(ch);
- if (unescaped) {
- str += unescaped;
- } else {
- index = restore;
- str += ch;
- }
- }
- break;
- case 'b':
- str += '\b';
- break;
- case 'f':
- str += '\f';
- break;
- case 'v':
- str += '\x0B';
- break;
-
- default:
- if (isOctalDigit(ch)) {
- code = '01234567'.indexOf(ch);
-
- // \0 is not octal escape sequence
- if (code !== 0) {
- octal = true;
- }
-
- /* istanbul ignore else */
- if (index < length && isOctalDigit(source[index])) {
- octal = true;
- code = code * 8 + '01234567'.indexOf(source[index++]);
-
- // 3 digits are only allowed when string starts
- // with 0, 1, 2, 3
- if ('0123'.indexOf(ch) >= 0 &&
- index < length &&
- isOctalDigit(source[index])) {
- code = code * 8 + '01234567'.indexOf(source[index++]);
- }
- }
- str += String.fromCharCode(code);
- } else {
- str += ch;
- }
- break;
- }
- } else {
- ++lineNumber;
- if (ch === '\r' && source[index] === '\n') {
- ++index;
- }
- lineStart = index;
- }
- } else if (isLineTerminator(ch.charCodeAt(0))) {
- break;
- } else {
- str += ch;
- }
- }
-
- if (quote !== '') {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- return {
- type: Token.StringLiteral,
- value: str,
- octal: octal,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- function scanTemplate() {
- var cooked = '', ch, start, terminated, tail, restore, unescaped, code, octal;
-
- terminated = false;
- tail = false;
- start = index;
-
- ++index;
-
- while (index < length) {
- ch = source[index++];
- if (ch === '`') {
- tail = true;
- terminated = true;
- break;
- } else if (ch === '$') {
- if (source[index] === '{') {
- ++index;
- terminated = true;
- break;
- }
- cooked += ch;
- } else if (ch === '\\') {
- ch = source[index++];
- if (!isLineTerminator(ch.charCodeAt(0))) {
- switch (ch) {
- case 'n':
- cooked += '\n';
- break;
- case 'r':
- cooked += '\r';
- break;
- case 't':
- cooked += '\t';
- break;
- case 'u':
- case 'x':
- if (source[index] === '{') {
- ++index;
- cooked += scanUnicodeCodePointEscape();
- } else {
- restore = index;
- unescaped = scanHexEscape(ch);
- if (unescaped) {
- cooked += unescaped;
- } else {
- index = restore;
- cooked += ch;
- }
- }
- break;
- case 'b':
- cooked += '\b';
- break;
- case 'f':
- cooked += '\f';
- break;
- case 'v':
- cooked += '\v';
- break;
-
- default:
- if (isOctalDigit(ch)) {
- code = '01234567'.indexOf(ch);
-
- // \0 is not octal escape sequence
- if (code !== 0) {
- octal = true;
- }
-
- /* istanbul ignore else */
- if (index < length && isOctalDigit(source[index])) {
- octal = true;
- code = code * 8 + '01234567'.indexOf(source[index++]);
-
- // 3 digits are only allowed when string starts
- // with 0, 1, 2, 3
- if ('0123'.indexOf(ch) >= 0 &&
- index < length &&
- isOctalDigit(source[index])) {
- code = code * 8 + '01234567'.indexOf(source[index++]);
- }
- }
- cooked += String.fromCharCode(code);
- } else {
- cooked += ch;
- }
- break;
- }
- } else {
- ++lineNumber;
- if (ch === '\r' && source[index] === '\n') {
- ++index;
- }
- lineStart = index;
- }
- } else if (isLineTerminator(ch.charCodeAt(0))) {
- ++lineNumber;
- if (ch === '\r' && source[index] === '\n') {
- ++index;
- }
- lineStart = index;
- cooked += '\n';
- } else {
- cooked += ch;
- }
- }
-
- if (!terminated) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- return {
- type: Token.Template,
- value: {
- cooked: cooked,
- raw: source.slice(start + 1, index - ((tail) ? 1 : 2))
- },
- tail: tail,
- octal: octal,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- function scanTemplateElement(option) {
- var startsWith, template;
-
- lookahead = null;
- skipComment();
-
- startsWith = (option.head) ? '`' : '}';
-
- if (source[index] !== startsWith) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- template = scanTemplate();
-
- peek();
-
- return template;
- }
-
- function testRegExp(pattern, flags) {
- var tmp = pattern,
- value;
-
- if (flags.indexOf('u') >= 0) {
- // Replace each astral symbol and every Unicode code point
- // escape sequence with a single ASCII symbol to avoid throwing on
- // regular expressions that are only valid in combination with the
- // `/u` flag.
- // Note: replacing with the ASCII symbol `x` might cause false
- // negatives in unlikely scenarios. For example, `[\u{61}-b]` is a
- // perfectly valid pattern that is equivalent to `[a-b]`, but it
- // would be replaced by `[x-b]` which throws an error.
- tmp = tmp
- .replace(/\\u\{([0-9a-fA-F]+)\}/g, function ($0, $1) {
- if (parseInt($1, 16) <= 0x10FFFF) {
- return 'x';
- }
- throwError({}, Messages.InvalidRegExp);
- })
- .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, 'x');
- }
-
- // First, detect invalid regular expressions.
- try {
- value = new RegExp(tmp);
- } catch (e) {
- throwError({}, Messages.InvalidRegExp);
- }
-
- // Return a regular expression object for this pattern-flag pair, or
- // `null` in case the current environment doesn't support the flags it
- // uses.
- try {
- return new RegExp(pattern, flags);
- } catch (exception) {
- return null;
- }
- }
-
- function scanRegExpBody() {
- var ch, str, classMarker, terminated, body;
-
- ch = source[index];
- assert(ch === '/', 'Regular expression literal must start with a slash');
- str = source[index++];
-
- classMarker = false;
- terminated = false;
- while (index < length) {
- ch = source[index++];
- str += ch;
- if (ch === '\\') {
- ch = source[index++];
- // ECMA-262 7.8.5
- if (isLineTerminator(ch.charCodeAt(0))) {
- throwError({}, Messages.UnterminatedRegExp);
- }
- str += ch;
- } else if (isLineTerminator(ch.charCodeAt(0))) {
- throwError({}, Messages.UnterminatedRegExp);
- } else if (classMarker) {
- if (ch === ']') {
- classMarker = false;
- }
- } else {
- if (ch === '/') {
- terminated = true;
- break;
- } else if (ch === '[') {
- classMarker = true;
- }
- }
- }
-
- if (!terminated) {
- throwError({}, Messages.UnterminatedRegExp);
- }
-
- // Exclude leading and trailing slash.
- body = str.substr(1, str.length - 2);
- return {
- value: body,
- literal: str
- };
- }
-
- function scanRegExpFlags() {
- var ch, str, flags, restore;
-
- str = '';
- flags = '';
- while (index < length) {
- ch = source[index];
- if (!isIdentifierPart(ch.charCodeAt(0))) {
- break;
- }
-
- ++index;
- if (ch === '\\' && index < length) {
- ch = source[index];
- if (ch === 'u') {
- ++index;
- restore = index;
- ch = scanHexEscape('u');
- if (ch) {
- flags += ch;
- for (str += '\\u'; restore < index; ++restore) {
- str += source[restore];
- }
- } else {
- index = restore;
- flags += 'u';
- str += '\\u';
- }
- throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
- } else {
- str += '\\';
- throwErrorTolerant({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- } else {
- flags += ch;
- str += ch;
- }
- }
-
- return {
- value: flags,
- literal: str
- };
- }
-
- function scanRegExp() {
- var start, body, flags, value;
-
- lookahead = null;
- skipComment();
- start = index;
-
- body = scanRegExpBody();
- flags = scanRegExpFlags();
- value = testRegExp(body.value, flags.value);
-
- if (extra.tokenize) {
- return {
- type: Token.RegularExpression,
- value: value,
- regex: {
- pattern: body.value,
- flags: flags.value
- },
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- return {
- literal: body.literal + flags.literal,
- value: value,
- regex: {
- pattern: body.value,
- flags: flags.value
- },
- range: [start, index]
- };
- }
-
- function isIdentifierName(token) {
- return token.type === Token.Identifier ||
- token.type === Token.Keyword ||
- token.type === Token.BooleanLiteral ||
- token.type === Token.NullLiteral;
- }
-
- function advanceSlash() {
- var prevToken,
- checkToken;
- // Using the following algorithm:
- // https://github.com/mozilla/sweet.js/wiki/design
- prevToken = extra.tokens[extra.tokens.length - 1];
- if (!prevToken) {
- // Nothing before that: it cannot be a division.
- return scanRegExp();
- }
- if (prevToken.type === 'Punctuator') {
- if (prevToken.value === ')') {
- checkToken = extra.tokens[extra.openParenToken - 1];
- if (checkToken &&
- checkToken.type === 'Keyword' &&
- (checkToken.value === 'if' ||
- checkToken.value === 'while' ||
- checkToken.value === 'for' ||
- checkToken.value === 'with')) {
- return scanRegExp();
- }
- return scanPunctuator();
- }
- if (prevToken.value === '}') {
- // Dividing a function by anything makes little sense,
- // but we have to check for that.
- if (extra.tokens[extra.openCurlyToken - 3] &&
- extra.tokens[extra.openCurlyToken - 3].type === 'Keyword') {
- // Anonymous function.
- checkToken = extra.tokens[extra.openCurlyToken - 4];
- if (!checkToken) {
- return scanPunctuator();
- }
- } else if (extra.tokens[extra.openCurlyToken - 4] &&
- extra.tokens[extra.openCurlyToken - 4].type === 'Keyword') {
- // Named function.
- checkToken = extra.tokens[extra.openCurlyToken - 5];
- if (!checkToken) {
- return scanRegExp();
- }
- } else {
- return scanPunctuator();
- }
- // checkToken determines whether the function is
- // a declaration or an expression.
- if (FnExprTokens.indexOf(checkToken.value) >= 0) {
- // It is an expression.
- return scanPunctuator();
- }
- // It is a declaration.
- return scanRegExp();
- }
- return scanRegExp();
- }
- if (prevToken.type === 'Keyword' && prevToken.value !== 'this') {
- return scanRegExp();
- }
- return scanPunctuator();
- }
-
- function advance() {
- var ch;
-
- if (!state.inJSXChild) {
- skipComment();
- }
-
- if (index >= length) {
- return {
- type: Token.EOF,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [index, index]
- };
- }
-
- if (state.inJSXChild) {
- return advanceJSXChild();
- }
-
- ch = source.charCodeAt(index);
-
- // Very common: ( and ) and ;
- if (ch === 40 || ch === 41 || ch === 58) {
- return scanPunctuator();
- }
-
- // String literal starts with single quote (#39) or double quote (#34).
- if (ch === 39 || ch === 34) {
- if (state.inJSXTag) {
- return scanJSXStringLiteral();
- }
- return scanStringLiteral();
- }
-
- if (state.inJSXTag && isJSXIdentifierStart(ch)) {
- return scanJSXIdentifier();
- }
-
- if (ch === 96) {
- return scanTemplate();
- }
- if (isIdentifierStart(ch)) {
- return scanIdentifier();
- }
-
- // Dot (.) char #46 can also start a floating-point number, hence the need
- // to check the next character.
- if (ch === 46) {
- if (isDecimalDigit(source.charCodeAt(index + 1))) {
- return scanNumericLiteral();
- }
- return scanPunctuator();
- }
-
- if (isDecimalDigit(ch)) {
- return scanNumericLiteral();
- }
-
- // Slash (/) char #47 can also start a regex.
- if (extra.tokenize && ch === 47) {
- return advanceSlash();
- }
-
- return scanPunctuator();
- }
-
- function lex() {
- var token;
-
- token = lookahead;
- index = token.range[1];
- lineNumber = token.lineNumber;
- lineStart = token.lineStart;
-
- lookahead = advance();
-
- index = token.range[1];
- lineNumber = token.lineNumber;
- lineStart = token.lineStart;
-
- return token;
- }
-
- function peek() {
- var pos, line, start;
-
- pos = index;
- line = lineNumber;
- start = lineStart;
- lookahead = advance();
- index = pos;
- lineNumber = line;
- lineStart = start;
- }
-
- function lookahead2() {
- var adv, pos, line, start, result;
-
- // If we are collecting the tokens, don't grab the next one yet.
- /* istanbul ignore next */
- adv = (typeof extra.advance === 'function') ? extra.advance : advance;
-
- pos = index;
- line = lineNumber;
- start = lineStart;
-
- // Scan for the next immediate token.
- /* istanbul ignore if */
- if (lookahead === null) {
- lookahead = adv();
- }
- index = lookahead.range[1];
- lineNumber = lookahead.lineNumber;
- lineStart = lookahead.lineStart;
-
- // Grab the token right after.
- result = adv();
- index = pos;
- lineNumber = line;
- lineStart = start;
-
- return result;
- }
-
- function rewind(token) {
- index = token.range[0];
- lineNumber = token.lineNumber;
- lineStart = token.lineStart;
- lookahead = token;
- }
-
- function markerCreate() {
- if (!extra.loc && !extra.range) {
- return undefined;
- }
- skipComment();
- return {offset: index, line: lineNumber, col: index - lineStart};
- }
-
- function markerCreatePreserveWhitespace() {
- if (!extra.loc && !extra.range) {
- return undefined;
- }
- return {offset: index, line: lineNumber, col: index - lineStart};
- }
-
- function processComment(node) {
- var lastChild,
- trailingComments,
- bottomRight = extra.bottomRightStack,
- last = bottomRight[bottomRight.length - 1];
-
- if (node.type === Syntax.Program) {
- /* istanbul ignore else */
- if (node.body.length > 0) {
- return;
- }
- }
-
- if (extra.trailingComments.length > 0) {
- if (extra.trailingComments[0].range[0] >= node.range[1]) {
- trailingComments = extra.trailingComments;
- extra.trailingComments = [];
- } else {
- extra.trailingComments.length = 0;
- }
- } else {
- if (last && last.trailingComments && last.trailingComments[0].range[0] >= node.range[1]) {
- trailingComments = last.trailingComments;
- delete last.trailingComments;
- }
- }
-
- // Eating the stack.
- if (last) {
- while (last && last.range[0] >= node.range[0]) {
- lastChild = last;
- last = bottomRight.pop();
- }
- }
-
- if (lastChild) {
- if (lastChild.leadingComments && lastChild.leadingComments[lastChild.leadingComments.length - 1].range[1] <= node.range[0]) {
- node.leadingComments = lastChild.leadingComments;
- delete lastChild.leadingComments;
- }
- } else if (extra.leadingComments.length > 0 && extra.leadingComments[extra.leadingComments.length - 1].range[1] <= node.range[0]) {
- node.leadingComments = extra.leadingComments;
- extra.leadingComments = [];
- }
-
- if (trailingComments) {
- node.trailingComments = trailingComments;
- }
-
- bottomRight.push(node);
- }
-
- function markerApply(marker, node) {
- if (extra.range) {
- node.range = [marker.offset, index];
- }
- if (extra.loc) {
- node.loc = {
- start: {
- line: marker.line,
- column: marker.col
- },
- end: {
- line: lineNumber,
- column: index - lineStart
- }
- };
- node = delegate.postProcess(node);
- }
- if (extra.attachComment) {
- processComment(node);
- }
- return node;
- }
-
- SyntaxTreeDelegate = {
-
- name: 'SyntaxTree',
-
- postProcess: function (node) {
- return node;
- },
-
- createArrayExpression: function (elements) {
- return {
- type: Syntax.ArrayExpression,
- elements: elements
- };
- },
-
- createAssignmentExpression: function (operator, left, right) {
- return {
- type: Syntax.AssignmentExpression,
- operator: operator,
- left: left,
- right: right
- };
- },
-
- createBinaryExpression: function (operator, left, right) {
- var type = (operator === '||' || operator === '&&') ? Syntax.LogicalExpression :
- Syntax.BinaryExpression;
- return {
- type: type,
- operator: operator,
- left: left,
- right: right
- };
- },
-
- createBlockStatement: function (body) {
- return {
- type: Syntax.BlockStatement,
- body: body
- };
- },
-
- createBreakStatement: function (label) {
- return {
- type: Syntax.BreakStatement,
- label: label
- };
- },
-
- createCallExpression: function (callee, args) {
- return {
- type: Syntax.CallExpression,
- callee: callee,
- 'arguments': args
- };
- },
-
- createCatchClause: function (param, body) {
- return {
- type: Syntax.CatchClause,
- param: param,
- body: body
- };
- },
-
- createConditionalExpression: function (test, consequent, alternate) {
- return {
- type: Syntax.ConditionalExpression,
- test: test,
- consequent: consequent,
- alternate: alternate
- };
- },
-
- createContinueStatement: function (label) {
- return {
- type: Syntax.ContinueStatement,
- label: label
- };
- },
-
- createDebuggerStatement: function () {
- return {
- type: Syntax.DebuggerStatement
- };
- },
-
- createDoWhileStatement: function (body, test) {
- return {
- type: Syntax.DoWhileStatement,
- body: body,
- test: test
- };
- },
-
- createEmptyStatement: function () {
- return {
- type: Syntax.EmptyStatement
- };
- },
-
- createExpressionStatement: function (expression) {
- return {
- type: Syntax.ExpressionStatement,
- expression: expression
- };
- },
-
- createForStatement: function (init, test, update, body) {
- return {
- type: Syntax.ForStatement,
- init: init,
- test: test,
- update: update,
- body: body
- };
- },
-
- createForInStatement: function (left, right, body) {
- return {
- type: Syntax.ForInStatement,
- left: left,
- right: right,
- body: body,
- each: false
- };
- },
-
- createForOfStatement: function (left, right, body) {
- return {
- type: Syntax.ForOfStatement,
- left: left,
- right: right,
- body: body
- };
- },
-
- createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression,
- isAsync, returnType, typeParameters) {
- var funDecl = {
- type: Syntax.FunctionDeclaration,
- id: id,
- params: params,
- defaults: defaults,
- body: body,
- rest: rest,
- generator: generator,
- expression: expression,
- returnType: returnType,
- typeParameters: typeParameters
- };
-
- if (isAsync) {
- funDecl.async = true;
- }
-
- return funDecl;
- },
-
- createFunctionExpression: function (id, params, defaults, body, rest, generator, expression,
- isAsync, returnType, typeParameters) {
- var funExpr = {
- type: Syntax.FunctionExpression,
- id: id,
- params: params,
- defaults: defaults,
- body: body,
- rest: rest,
- generator: generator,
- expression: expression,
- returnType: returnType,
- typeParameters: typeParameters
- };
-
- if (isAsync) {
- funExpr.async = true;
- }
-
- return funExpr;
- },
-
- createIdentifier: function (name) {
- return {
- type: Syntax.Identifier,
- name: name,
- // Only here to initialize the shape of the object to ensure
- // that the 'typeAnnotation' key is ordered before others that
- // are added later (like 'loc' and 'range'). This just helps
- // keep the shape of Identifier nodes consistent with everything
- // else.
- typeAnnotation: undefined,
- optional: undefined
- };
- },
-
- createTypeAnnotation: function (typeAnnotation) {
- return {
- type: Syntax.TypeAnnotation,
- typeAnnotation: typeAnnotation
- };
- },
-
- createTypeCast: function (expression, typeAnnotation) {
- return {
- type: Syntax.TypeCastExpression,
- expression: expression,
- typeAnnotation: typeAnnotation
- };
- },
-
- createFunctionTypeAnnotation: function (params, returnType, rest, typeParameters) {
- return {
- type: Syntax.FunctionTypeAnnotation,
- params: params,
- returnType: returnType,
- rest: rest,
- typeParameters: typeParameters
- };
- },
-
- createFunctionTypeParam: function (name, typeAnnotation, optional) {
- return {
- type: Syntax.FunctionTypeParam,
- name: name,
- typeAnnotation: typeAnnotation,
- optional: optional
- };
- },
-
- createNullableTypeAnnotation: function (typeAnnotation) {
- return {
- type: Syntax.NullableTypeAnnotation,
- typeAnnotation: typeAnnotation
- };
- },
-
- createArrayTypeAnnotation: function (elementType) {
- return {
- type: Syntax.ArrayTypeAnnotation,
- elementType: elementType
- };
- },
-
- createGenericTypeAnnotation: function (id, typeParameters) {
- return {
- type: Syntax.GenericTypeAnnotation,
- id: id,
- typeParameters: typeParameters
- };
- },
-
- createQualifiedTypeIdentifier: function (qualification, id) {
- return {
- type: Syntax.QualifiedTypeIdentifier,
- qualification: qualification,
- id: id
- };
- },
-
- createTypeParameterDeclaration: function (params) {
- return {
- type: Syntax.TypeParameterDeclaration,
- params: params
- };
- },
-
- createTypeParameterInstantiation: function (params) {
- return {
- type: Syntax.TypeParameterInstantiation,
- params: params
- };
- },
-
- createAnyTypeAnnotation: function () {
- return {
- type: Syntax.AnyTypeAnnotation
- };
- },
-
- createBooleanTypeAnnotation: function () {
- return {
- type: Syntax.BooleanTypeAnnotation
- };
- },
-
- createNumberTypeAnnotation: function () {
- return {
- type: Syntax.NumberTypeAnnotation
- };
- },
-
- createStringTypeAnnotation: function () {
- return {
- type: Syntax.StringTypeAnnotation
- };
- },
-
- createStringLiteralTypeAnnotation: function (token) {
- return {
- type: Syntax.StringLiteralTypeAnnotation,
- value: token.value,
- raw: source.slice(token.range[0], token.range[1])
- };
- },
-
- createVoidTypeAnnotation: function () {
- return {
- type: Syntax.VoidTypeAnnotation
- };
- },
-
- createTypeofTypeAnnotation: function (argument) {
- return {
- type: Syntax.TypeofTypeAnnotation,
- argument: argument
- };
- },
-
- createTupleTypeAnnotation: function (types) {
- return {
- type: Syntax.TupleTypeAnnotation,
- types: types
- };
- },
-
- createObjectTypeAnnotation: function (properties, indexers, callProperties) {
- return {
- type: Syntax.ObjectTypeAnnotation,
- properties: properties,
- indexers: indexers,
- callProperties: callProperties
- };
- },
-
- createObjectTypeIndexer: function (id, key, value, isStatic) {
- return {
- type: Syntax.ObjectTypeIndexer,
- id: id,
- key: key,
- value: value,
- "static": isStatic
- };
- },
-
- createObjectTypeCallProperty: function (value, isStatic) {
- return {
- type: Syntax.ObjectTypeCallProperty,
- value: value,
- "static": isStatic
- };
- },
-
- createObjectTypeProperty: function (key, value, optional, isStatic) {
- return {
- type: Syntax.ObjectTypeProperty,
- key: key,
- value: value,
- optional: optional,
- "static": isStatic
- };
- },
-
- createUnionTypeAnnotation: function (types) {
- return {
- type: Syntax.UnionTypeAnnotation,
- types: types
- };
- },
-
- createIntersectionTypeAnnotation: function (types) {
- return {
- type: Syntax.IntersectionTypeAnnotation,
- types: types
- };
- },
-
- createTypeAlias: function (id, typeParameters, right) {
- return {
- type: Syntax.TypeAlias,
- id: id,
- typeParameters: typeParameters,
- right: right
- };
- },
-
- createInterface: function (id, typeParameters, body, extended) {
- return {
- type: Syntax.InterfaceDeclaration,
- id: id,
- typeParameters: typeParameters,
- body: body,
- "extends": extended
- };
- },
-
- createInterfaceExtends: function (id, typeParameters) {
- return {
- type: Syntax.InterfaceExtends,
- id: id,
- typeParameters: typeParameters
- };
- },
-
- createDeclareFunction: function (id) {
- return {
- type: Syntax.DeclareFunction,
- id: id
- };
- },
-
- createDeclareVariable: function (id) {
- return {
- type: Syntax.DeclareVariable,
- id: id
- };
- },
-
- createDeclareModule: function (id, body) {
- return {
- type: Syntax.DeclareModule,
- id: id,
- body: body
- };
- },
-
- createJSXAttribute: function (name, value) {
- return {
- type: Syntax.JSXAttribute,
- name: name,
- value: value || null
- };
- },
-
- createJSXSpreadAttribute: function (argument) {
- return {
- type: Syntax.JSXSpreadAttribute,
- argument: argument
- };
- },
-
- createJSXIdentifier: function (name) {
- return {
- type: Syntax.JSXIdentifier,
- name: name
- };
- },
-
- createJSXNamespacedName: function (namespace, name) {
- return {
- type: Syntax.JSXNamespacedName,
- namespace: namespace,
- name: name
- };
- },
-
- createJSXMemberExpression: function (object, property) {
- return {
- type: Syntax.JSXMemberExpression,
- object: object,
- property: property
- };
- },
-
- createJSXElement: function (openingElement, closingElement, children) {
- return {
- type: Syntax.JSXElement,
- openingElement: openingElement,
- closingElement: closingElement,
- children: children
- };
- },
-
- createJSXEmptyExpression: function () {
- return {
- type: Syntax.JSXEmptyExpression
- };
- },
-
- createJSXExpressionContainer: function (expression) {
- return {
- type: Syntax.JSXExpressionContainer,
- expression: expression
- };
- },
-
- createJSXOpeningElement: function (name, attributes, selfClosing) {
- return {
- type: Syntax.JSXOpeningElement,
- name: name,
- selfClosing: selfClosing,
- attributes: attributes
- };
- },
-
- createJSXClosingElement: function (name) {
- return {
- type: Syntax.JSXClosingElement,
- name: name
- };
- },
-
- createIfStatement: function (test, consequent, alternate) {
- return {
- type: Syntax.IfStatement,
- test: test,
- consequent: consequent,
- alternate: alternate
- };
- },
-
- createLabeledStatement: function (label, body) {
- return {
- type: Syntax.LabeledStatement,
- label: label,
- body: body
- };
- },
-
- createLiteral: function (token) {
- var object = {
- type: Syntax.Literal,
- value: token.value,
- raw: source.slice(token.range[0], token.range[1])
- };
- if (token.regex) {
- object.regex = token.regex;
- }
- return object;
- },
-
- createMemberExpression: function (accessor, object, property) {
- return {
- type: Syntax.MemberExpression,
- computed: accessor === '[',
- object: object,
- property: property
- };
- },
-
- createNewExpression: function (callee, args) {
- return {
- type: Syntax.NewExpression,
- callee: callee,
- 'arguments': args
- };
- },
-
- createObjectExpression: function (properties) {
- return {
- type: Syntax.ObjectExpression,
- properties: properties
- };
- },
-
- createPostfixExpression: function (operator, argument) {
- return {
- type: Syntax.UpdateExpression,
- operator: operator,
- argument: argument,
- prefix: false
- };
- },
-
- createProgram: function (body) {
- return {
- type: Syntax.Program,
- body: body
- };
- },
-
- createProperty: function (kind, key, value, method, shorthand, computed) {
- return {
- type: Syntax.Property,
- key: key,
- value: value,
- kind: kind,
- method: method,
- shorthand: shorthand,
- computed: computed
- };
- },
-
- createReturnStatement: function (argument) {
- return {
- type: Syntax.ReturnStatement,
- argument: argument
- };
- },
-
- createSequenceExpression: function (expressions) {
- return {
- type: Syntax.SequenceExpression,
- expressions: expressions
- };
- },
-
- createSwitchCase: function (test, consequent) {
- return {
- type: Syntax.SwitchCase,
- test: test,
- consequent: consequent
- };
- },
-
- createSwitchStatement: function (discriminant, cases) {
- return {
- type: Syntax.SwitchStatement,
- discriminant: discriminant,
- cases: cases
- };
- },
-
- createThisExpression: function () {
- return {
- type: Syntax.ThisExpression
- };
- },
-
- createThrowStatement: function (argument) {
- return {
- type: Syntax.ThrowStatement,
- argument: argument
- };
- },
-
- createTryStatement: function (block, guardedHandlers, handlers, finalizer) {
- return {
- type: Syntax.TryStatement,
- block: block,
- guardedHandlers: guardedHandlers,
- handlers: handlers,
- finalizer: finalizer
- };
- },
-
- createUnaryExpression: function (operator, argument) {
- if (operator === '++' || operator === '--') {
- return {
- type: Syntax.UpdateExpression,
- operator: operator,
- argument: argument,
- prefix: true
- };
- }
- return {
- type: Syntax.UnaryExpression,
- operator: operator,
- argument: argument,
- prefix: true
- };
- },
-
- createVariableDeclaration: function (declarations, kind) {
- return {
- type: Syntax.VariableDeclaration,
- declarations: declarations,
- kind: kind
- };
- },
-
- createVariableDeclarator: function (id, init) {
- return {
- type: Syntax.VariableDeclarator,
- id: id,
- init: init
- };
- },
-
- createWhileStatement: function (test, body) {
- return {
- type: Syntax.WhileStatement,
- test: test,
- body: body
- };
- },
-
- createWithStatement: function (object, body) {
- return {
- type: Syntax.WithStatement,
- object: object,
- body: body
- };
- },
-
- createTemplateElement: function (value, tail) {
- return {
- type: Syntax.TemplateElement,
- value: value,
- tail: tail
- };
- },
-
- createTemplateLiteral: function (quasis, expressions) {
- return {
- type: Syntax.TemplateLiteral,
- quasis: quasis,
- expressions: expressions
- };
- },
-
- createSpreadElement: function (argument) {
- return {
- type: Syntax.SpreadElement,
- argument: argument
- };
- },
-
- createSpreadProperty: function (argument) {
- return {
- type: Syntax.SpreadProperty,
- argument: argument
- };
- },
-
- createTaggedTemplateExpression: function (tag, quasi) {
- return {
- type: Syntax.TaggedTemplateExpression,
- tag: tag,
- quasi: quasi
- };
- },
-
- createArrowFunctionExpression: function (params, defaults, body, rest, expression, isAsync) {
- var arrowExpr = {
- type: Syntax.ArrowFunctionExpression,
- id: null,
- params: params,
- defaults: defaults,
- body: body,
- rest: rest,
- generator: false,
- expression: expression
- };
-
- if (isAsync) {
- arrowExpr.async = true;
- }
-
- return arrowExpr;
- },
-
- createMethodDefinition: function (propertyType, kind, key, value, computed) {
- return {
- type: Syntax.MethodDefinition,
- key: key,
- value: value,
- kind: kind,
- 'static': propertyType === ClassPropertyType["static"],
- computed: computed
- };
- },
-
- createClassProperty: function (key, typeAnnotation, computed, isStatic) {
- return {
- type: Syntax.ClassProperty,
- key: key,
- typeAnnotation: typeAnnotation,
- computed: computed,
- "static": isStatic
- };
- },
-
- createClassBody: function (body) {
- return {
- type: Syntax.ClassBody,
- body: body
- };
- },
-
- createClassImplements: function (id, typeParameters) {
- return {
- type: Syntax.ClassImplements,
- id: id,
- typeParameters: typeParameters
- };
- },
-
- createClassExpression: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
- return {
- type: Syntax.ClassExpression,
- id: id,
- superClass: superClass,
- body: body,
- typeParameters: typeParameters,
- superTypeParameters: superTypeParameters,
- "implements": implemented
- };
- },
-
- createClassDeclaration: function (id, superClass, body, typeParameters, superTypeParameters, implemented) {
- return {
- type: Syntax.ClassDeclaration,
- id: id,
- superClass: superClass,
- body: body,
- typeParameters: typeParameters,
- superTypeParameters: superTypeParameters,
- "implements": implemented
- };
- },
-
- createModuleSpecifier: function (token) {
- return {
- type: Syntax.ModuleSpecifier,
- value: token.value,
- raw: source.slice(token.range[0], token.range[1])
- };
- },
-
- createExportSpecifier: function (id, name) {
- return {
- type: Syntax.ExportSpecifier,
- id: id,
- name: name
- };
- },
-
- createExportBatchSpecifier: function () {
- return {
- type: Syntax.ExportBatchSpecifier
- };
- },
-
- createImportDefaultSpecifier: function (id) {
- return {
- type: Syntax.ImportDefaultSpecifier,
- id: id
- };
- },
-
- createImportNamespaceSpecifier: function (id) {
- return {
- type: Syntax.ImportNamespaceSpecifier,
- id: id
- };
- },
-
- createExportDeclaration: function (isDefault, declaration, specifiers, src) {
- return {
- type: Syntax.ExportDeclaration,
- 'default': !!isDefault,
- declaration: declaration,
- specifiers: specifiers,
- source: src
- };
- },
-
- createImportSpecifier: function (id, name) {
- return {
- type: Syntax.ImportSpecifier,
- id: id,
- name: name
- };
- },
-
- createImportDeclaration: function (specifiers, src, isType) {
- return {
- type: Syntax.ImportDeclaration,
- specifiers: specifiers,
- source: src,
- isType: isType
- };
- },
-
- createYieldExpression: function (argument, dlg) {
- return {
- type: Syntax.YieldExpression,
- argument: argument,
- delegate: dlg
- };
- },
-
- createAwaitExpression: function (argument) {
- return {
- type: Syntax.AwaitExpression,
- argument: argument
- };
- },
-
- createComprehensionExpression: function (filter, blocks, body) {
- return {
- type: Syntax.ComprehensionExpression,
- filter: filter,
- blocks: blocks,
- body: body
- };
- }
-
- };
-
- // Return true if there is a line terminator before the next token.
-
- function peekLineTerminator() {
- var pos, line, start, found;
-
- pos = index;
- line = lineNumber;
- start = lineStart;
- skipComment();
- found = lineNumber !== line;
- index = pos;
- lineNumber = line;
- lineStart = start;
-
- return found;
- }
-
- // Throw an exception
-
- function throwError(token, messageFormat) {
- var error,
- args = Array.prototype.slice.call(arguments, 2),
- msg = messageFormat.replace(
- /%(\d)/g,
- function (whole, idx) {
- assert(idx < args.length, 'Message reference must be in range');
- return args[idx];
- }
- );
-
- if (typeof token.lineNumber === 'number') {
- error = new Error('Line ' + token.lineNumber + ': ' + msg);
- error.index = token.range[0];
- error.lineNumber = token.lineNumber;
- error.column = token.range[0] - lineStart + 1;
- } else {
- error = new Error('Line ' + lineNumber + ': ' + msg);
- error.index = index;
- error.lineNumber = lineNumber;
- error.column = index - lineStart + 1;
- }
-
- error.description = msg;
- throw error;
- }
-
- function throwErrorTolerant() {
- try {
- throwError.apply(null, arguments);
- } catch (e) {
- if (extra.errors) {
- extra.errors.push(e);
- } else {
- throw e;
- }
- }
- }
-
-
- // Throw an exception because of the token.
-
- function throwUnexpected(token) {
- if (token.type === Token.EOF) {
- throwError(token, Messages.UnexpectedEOS);
- }
-
- if (token.type === Token.NumericLiteral) {
- throwError(token, Messages.UnexpectedNumber);
- }
-
- if (token.type === Token.StringLiteral || token.type === Token.JSXText) {
- throwError(token, Messages.UnexpectedString);
- }
-
- if (token.type === Token.Identifier) {
- throwError(token, Messages.UnexpectedIdentifier);
- }
-
- if (token.type === Token.Keyword) {
- if (isFutureReservedWord(token.value)) {
- throwError(token, Messages.UnexpectedReserved);
- } else if (strict && isStrictModeReservedWord(token.value)) {
- throwErrorTolerant(token, Messages.StrictReservedWord);
- return;
- }
- throwError(token, Messages.UnexpectedToken, token.value);
- }
-
- if (token.type === Token.Template) {
- throwError(token, Messages.UnexpectedTemplate, token.value.raw);
- }
-
- // BooleanLiteral, NullLiteral, or Punctuator.
- throwError(token, Messages.UnexpectedToken, token.value);
- }
-
- // Expect the next token to match the specified punctuator.
- // If not, an exception will be thrown.
-
- function expect(value) {
- var token = lex();
- if (token.type !== Token.Punctuator || token.value !== value) {
- throwUnexpected(token);
- }
- }
-
- // Expect the next token to match the specified keyword.
- // If not, an exception will be thrown.
-
- function expectKeyword(keyword, contextual) {
- var token = lex();
- if (token.type !== (contextual ? Token.Identifier : Token.Keyword) ||
- token.value !== keyword) {
- throwUnexpected(token);
- }
- }
-
- // Expect the next token to match the specified contextual keyword.
- // If not, an exception will be thrown.
-
- function expectContextualKeyword(keyword) {
- return expectKeyword(keyword, true);
- }
-
- // Return true if the next token matches the specified punctuator.
-
- function match(value) {
- return lookahead.type === Token.Punctuator && lookahead.value === value;
- }
-
- // Return true if the next token matches the specified keyword
-
- function matchKeyword(keyword, contextual) {
- var expectedType = contextual ? Token.Identifier : Token.Keyword;
- return lookahead.type === expectedType && lookahead.value === keyword;
- }
-
- // Return true if the next token matches the specified contextual keyword
-
- function matchContextualKeyword(keyword) {
- return matchKeyword(keyword, true);
- }
-
- // Return true if the next token is an assignment operator
-
- function matchAssign() {
- var op;
-
- if (lookahead.type !== Token.Punctuator) {
- return false;
- }
- op = lookahead.value;
- return op === '=' ||
- op === '*=' ||
- op === '/=' ||
- op === '%=' ||
- op === '+=' ||
- op === '-=' ||
- op === '<<=' ||
- op === '>>=' ||
- op === '>>>=' ||
- op === '&=' ||
- op === '^=' ||
- op === '|=';
- }
-
- // Note that 'yield' is treated as a keyword in strict mode, but a
- // contextual keyword (identifier) in non-strict mode, so we need to
- // use matchKeyword('yield', false) and matchKeyword('yield', true)
- // (i.e. matchContextualKeyword) appropriately.
- function matchYield() {
- return state.yieldAllowed && matchKeyword('yield', !strict);
- }
-
- function matchAsync() {
- var backtrackToken = lookahead, matches = false;
-
- if (matchContextualKeyword('async')) {
- lex(); // Make sure peekLineTerminator() starts after 'async'.
- matches = !peekLineTerminator();
- rewind(backtrackToken); // Revert the lex().
- }
-
- return matches;
- }
-
- function matchAwait() {
- return state.awaitAllowed && matchContextualKeyword('await');
- }
-
- function consumeSemicolon() {
- var line, oldIndex = index, oldLineNumber = lineNumber,
- oldLineStart = lineStart, oldLookahead = lookahead;
-
- // Catch the very common case first: immediately a semicolon (char #59).
- if (source.charCodeAt(index) === 59) {
- lex();
- return;
- }
-
- line = lineNumber;
- skipComment();
- if (lineNumber !== line) {
- index = oldIndex;
- lineNumber = oldLineNumber;
- lineStart = oldLineStart;
- lookahead = oldLookahead;
- return;
- }
-
- if (match(';')) {
- lex();
- return;
- }
-
- if (lookahead.type !== Token.EOF && !match('}')) {
- throwUnexpected(lookahead);
- }
- }
-
- // Return true if provided expression is LeftHandSideExpression
-
- function isLeftHandSide(expr) {
- return expr.type === Syntax.Identifier || expr.type === Syntax.MemberExpression;
- }
-
- function isAssignableLeftHandSide(expr) {
- return isLeftHandSide(expr) || expr.type === Syntax.ObjectPattern || expr.type === Syntax.ArrayPattern;
- }
-
- // 11.1.4 Array Initialiser
-
- function parseArrayInitialiser() {
- var elements = [], blocks = [], filter = null, tmp, possiblecomprehension = true,
- marker = markerCreate();
-
- expect('[');
- while (!match(']')) {
- if (lookahead.value === 'for' &&
- lookahead.type === Token.Keyword) {
- if (!possiblecomprehension) {
- throwError({}, Messages.ComprehensionError);
- }
- matchKeyword('for');
- tmp = parseForStatement({ignoreBody: true});
- tmp.of = tmp.type === Syntax.ForOfStatement;
- tmp.type = Syntax.ComprehensionBlock;
- if (tmp.left.kind) { // can't be let or const
- throwError({}, Messages.ComprehensionError);
- }
- blocks.push(tmp);
- } else if (lookahead.value === 'if' &&
- lookahead.type === Token.Keyword) {
- if (!possiblecomprehension) {
- throwError({}, Messages.ComprehensionError);
- }
- expectKeyword('if');
- expect('(');
- filter = parseExpression();
- expect(')');
- } else if (lookahead.value === ',' &&
- lookahead.type === Token.Punctuator) {
- possiblecomprehension = false; // no longer allowed.
- lex();
- elements.push(null);
- } else {
- tmp = parseSpreadOrAssignmentExpression();
- elements.push(tmp);
- if (tmp && tmp.type === Syntax.SpreadElement) {
- if (!match(']')) {
- throwError({}, Messages.ElementAfterSpreadElement);
- }
- } else if (!(match(']') || matchKeyword('for') || matchKeyword('if'))) {
- expect(','); // this lexes.
- possiblecomprehension = false;
- }
- }
- }
-
- expect(']');
-
- if (filter && !blocks.length) {
- throwError({}, Messages.ComprehensionRequiresBlock);
- }
-
- if (blocks.length) {
- if (elements.length !== 1) {
- throwError({}, Messages.ComprehensionError);
- }
- return markerApply(marker, delegate.createComprehensionExpression(filter, blocks, elements[0]));
- }
- return markerApply(marker, delegate.createArrayExpression(elements));
- }
-
- // 11.1.5 Object Initialiser
-
- function parsePropertyFunction(options) {
- var previousStrict, previousYieldAllowed, previousAwaitAllowed,
- params, defaults, body, marker = markerCreate();
-
- previousStrict = strict;
- previousYieldAllowed = state.yieldAllowed;
- state.yieldAllowed = options.generator;
- previousAwaitAllowed = state.awaitAllowed;
- state.awaitAllowed = options.async;
- params = options.params || [];
- defaults = options.defaults || [];
-
- body = parseConciseBody();
- if (options.name && strict && isRestrictedWord(params[0].name)) {
- throwErrorTolerant(options.name, Messages.StrictParamName);
- }
- strict = previousStrict;
- state.yieldAllowed = previousYieldAllowed;
- state.awaitAllowed = previousAwaitAllowed;
-
- return markerApply(marker, delegate.createFunctionExpression(
- null,
- params,
- defaults,
- body,
- options.rest || null,
- options.generator,
- body.type !== Syntax.BlockStatement,
- options.async,
- options.returnType,
- options.typeParameters
- ));
- }
-
-
- function parsePropertyMethodFunction(options) {
- var previousStrict, tmp, method;
-
- previousStrict = strict;
- strict = true;
-
- tmp = parseParams();
-
- if (tmp.stricted) {
- throwErrorTolerant(tmp.stricted, tmp.message);
- }
-
- method = parsePropertyFunction({
- params: tmp.params,
- defaults: tmp.defaults,
- rest: tmp.rest,
- generator: options.generator,
- async: options.async,
- returnType: tmp.returnType,
- typeParameters: options.typeParameters
- });
-
- strict = previousStrict;
-
- return method;
- }
-
-
- function parseObjectPropertyKey() {
- var marker = markerCreate(),
- token = lex(),
- propertyKey,
- result;
-
- // Note: This function is called only from parseObjectProperty(), where
- // EOF and Punctuator tokens are already filtered out.
-
- if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {
- if (strict && token.octal) {
- throwErrorTolerant(token, Messages.StrictOctalLiteral);
- }
- return markerApply(marker, delegate.createLiteral(token));
- }
-
- if (token.type === Token.Punctuator && token.value === '[') {
- // For computed properties we should skip the [ and ], and
- // capture in marker only the assignment expression itself.
- marker = markerCreate();
- propertyKey = parseAssignmentExpression();
- result = markerApply(marker, propertyKey);
- expect(']');
- return result;
- }
-
- return markerApply(marker, delegate.createIdentifier(token.value));
- }
-
- function parseObjectProperty() {
- var token, key, id, param, computed,
- marker = markerCreate(), returnType, typeParameters;
-
- token = lookahead;
- computed = (token.value === '[' && token.type === Token.Punctuator);
-
- if (token.type === Token.Identifier || computed || matchAsync()) {
- id = parseObjectPropertyKey();
-
- if (match(':')) {
- lex();
-
- return markerApply(
- marker,
- delegate.createProperty(
- 'init',
- id,
- parseAssignmentExpression(),
- false,
- false,
- computed
- )
- );
- }
-
- if (match('(') || match('<')) {
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
- return markerApply(
- marker,
- delegate.createProperty(
- 'init',
- id,
- parsePropertyMethodFunction({
- generator: false,
- async: false,
- typeParameters: typeParameters
- }),
- true,
- false,
- computed
- )
- );
- }
-
- // Property Assignment: Getter and Setter.
-
- if (token.value === 'get') {
- computed = (lookahead.value === '[');
- key = parseObjectPropertyKey();
-
- expect('(');
- expect(')');
- if (match(':')) {
- returnType = parseTypeAnnotation();
- }
-
- return markerApply(
- marker,
- delegate.createProperty(
- 'get',
- key,
- parsePropertyFunction({
- generator: false,
- async: false,
- returnType: returnType
- }),
- false,
- false,
- computed
- )
- );
- }
-
- if (token.value === 'set') {
- computed = (lookahead.value === '[');
- key = parseObjectPropertyKey();
-
- expect('(');
- token = lookahead;
- param = [ parseTypeAnnotatableIdentifier() ];
- expect(')');
- if (match(':')) {
- returnType = parseTypeAnnotation();
- }
-
- return markerApply(
- marker,
- delegate.createProperty(
- 'set',
- key,
- parsePropertyFunction({
- params: param,
- generator: false,
- async: false,
- name: token,
- returnType: returnType
- }),
- false,
- false,
- computed
- )
- );
- }
-
- if (token.value === 'async') {
- computed = (lookahead.value === '[');
- key = parseObjectPropertyKey();
-
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- return markerApply(
- marker,
- delegate.createProperty(
- 'init',
- key,
- parsePropertyMethodFunction({
- generator: false,
- async: true,
- typeParameters: typeParameters
- }),
- true,
- false,
- computed
- )
- );
- }
-
- if (computed) {
- // Computed properties can only be used with full notation.
- throwUnexpected(lookahead);
- }
-
- return markerApply(
- marker,
- delegate.createProperty('init', id, id, false, true, false)
- );
- }
-
- if (token.type === Token.EOF || token.type === Token.Punctuator) {
- if (!match('*')) {
- throwUnexpected(token);
- }
- lex();
-
- computed = (lookahead.type === Token.Punctuator && lookahead.value === '[');
-
- id = parseObjectPropertyKey();
-
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- if (!match('(')) {
- throwUnexpected(lex());
- }
-
- return markerApply(marker, delegate.createProperty(
- 'init',
- id,
- parsePropertyMethodFunction({
- generator: true,
- typeParameters: typeParameters
- }),
- true,
- false,
- computed
- ));
- }
- key = parseObjectPropertyKey();
- if (match(':')) {
- lex();
- return markerApply(marker, delegate.createProperty('init', key, parseAssignmentExpression(), false, false, false));
- }
- if (match('(') || match('<')) {
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
- return markerApply(marker, delegate.createProperty(
- 'init',
- key,
- parsePropertyMethodFunction({
- generator: false,
- typeParameters: typeParameters
- }),
- true,
- false,
- false
- ));
- }
- throwUnexpected(lex());
- }
-
- function parseObjectSpreadProperty() {
- var marker = markerCreate();
- expect('...');
- return markerApply(marker, delegate.createSpreadProperty(parseAssignmentExpression()));
- }
-
- function getFieldName(key) {
- var toString = String;
- if (key.type === Syntax.Identifier) {
- return key.name;
- }
- return toString(key.value);
- }
-
- function parseObjectInitialiser() {
- var properties = [], property, name, kind, storedKind, map = new StringMap(),
- marker = markerCreate(), toString = String;
-
- expect('{');
-
- while (!match('}')) {
- if (match('...')) {
- property = parseObjectSpreadProperty();
- } else {
- property = parseObjectProperty();
-
- if (property.key.type === Syntax.Identifier) {
- name = property.key.name;
- } else {
- name = toString(property.key.value);
- }
- kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;
-
- if (map.has(name)) {
- storedKind = map.get(name);
- if (storedKind === PropertyKind.Data) {
- if (strict && kind === PropertyKind.Data) {
- throwErrorTolerant({}, Messages.StrictDuplicateProperty);
- } else if (kind !== PropertyKind.Data) {
- throwErrorTolerant({}, Messages.AccessorDataProperty);
- }
- } else {
- if (kind === PropertyKind.Data) {
- throwErrorTolerant({}, Messages.AccessorDataProperty);
- } else if (storedKind & kind) {
- throwErrorTolerant({}, Messages.AccessorGetSet);
- }
- }
- map.set(name, storedKind | kind);
- } else {
- map.set(name, kind);
- }
- }
-
- properties.push(property);
-
- if (!match('}')) {
- expect(',');
- }
- }
-
- expect('}');
-
- return markerApply(marker, delegate.createObjectExpression(properties));
- }
-
- function parseTemplateElement(option) {
- var marker = markerCreate(),
- token = scanTemplateElement(option);
- if (strict && token.octal) {
- throwError(token, Messages.StrictOctalLiteral);
- }
- return markerApply(marker, delegate.createTemplateElement({ raw: token.value.raw, cooked: token.value.cooked }, token.tail));
- }
-
- function parseTemplateLiteral() {
- var quasi, quasis, expressions, marker = markerCreate();
-
- quasi = parseTemplateElement({ head: true });
- quasis = [ quasi ];
- expressions = [];
-
- while (!quasi.tail) {
- expressions.push(parseExpression());
- quasi = parseTemplateElement({ head: false });
- quasis.push(quasi);
- }
-
- return markerApply(marker, delegate.createTemplateLiteral(quasis, expressions));
- }
-
- // 11.1.6 The Grouping Operator
-
- function parseGroupExpression() {
- var expr, marker, typeAnnotation;
-
- expect('(');
-
- ++state.parenthesizedCount;
-
- marker = markerCreate();
-
- expr = parseExpression();
-
- if (match(':')) {
- typeAnnotation = parseTypeAnnotation();
- expr = markerApply(marker, delegate.createTypeCast(
- expr,
- typeAnnotation
- ));
- }
-
- expect(')');
-
- return expr;
- }
-
- function matchAsyncFuncExprOrDecl() {
- var token;
-
- if (matchAsync()) {
- token = lookahead2();
- if (token.type === Token.Keyword && token.value === 'function') {
- return true;
- }
- }
-
- return false;
- }
-
- // 11.1 Primary Expressions
-
- function parsePrimaryExpression() {
- var marker, type, token, expr;
-
- type = lookahead.type;
-
- if (type === Token.Identifier) {
- marker = markerCreate();
- return markerApply(marker, delegate.createIdentifier(lex().value));
- }
-
- if (type === Token.StringLiteral || type === Token.NumericLiteral) {
- if (strict && lookahead.octal) {
- throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);
- }
- marker = markerCreate();
- return markerApply(marker, delegate.createLiteral(lex()));
- }
-
- if (type === Token.Keyword) {
- if (matchKeyword('this')) {
- marker = markerCreate();
- lex();
- return markerApply(marker, delegate.createThisExpression());
- }
-
- if (matchKeyword('function')) {
- return parseFunctionExpression();
- }
-
- if (matchKeyword('class')) {
- return parseClassExpression();
- }
-
- if (matchKeyword('super')) {
- marker = markerCreate();
- lex();
- return markerApply(marker, delegate.createIdentifier('super'));
- }
- }
-
- if (type === Token.BooleanLiteral) {
- marker = markerCreate();
- token = lex();
- token.value = (token.value === 'true');
- return markerApply(marker, delegate.createLiteral(token));
- }
-
- if (type === Token.NullLiteral) {
- marker = markerCreate();
- token = lex();
- token.value = null;
- return markerApply(marker, delegate.createLiteral(token));
- }
-
- if (match('[')) {
- return parseArrayInitialiser();
- }
-
- if (match('{')) {
- return parseObjectInitialiser();
- }
-
- if (match('(')) {
- return parseGroupExpression();
- }
-
- if (match('/') || match('/=')) {
- marker = markerCreate();
- expr = delegate.createLiteral(scanRegExp());
- peek();
- return markerApply(marker, expr);
- }
-
- if (type === Token.Template) {
- return parseTemplateLiteral();
- }
-
- if (match('<')) {
- return parseJSXElement();
- }
-
- throwUnexpected(lex());
- }
-
- // 11.2 Left-Hand-Side Expressions
-
- function parseArguments() {
- var args = [], arg;
-
- expect('(');
-
- if (!match(')')) {
- while (index < length) {
- arg = parseSpreadOrAssignmentExpression();
- args.push(arg);
-
- if (match(')')) {
- break;
- } else if (arg.type === Syntax.SpreadElement) {
- throwError({}, Messages.ElementAfterSpreadElement);
- }
-
- expect(',');
- }
- }
-
- expect(')');
-
- return args;
- }
-
- function parseSpreadOrAssignmentExpression() {
- if (match('...')) {
- var marker = markerCreate();
- lex();
- return markerApply(marker, delegate.createSpreadElement(parseAssignmentExpression()));
- }
- return parseAssignmentExpression();
- }
-
- function parseNonComputedProperty() {
- var marker = markerCreate(),
- token = lex();
-
- if (!isIdentifierName(token)) {
- throwUnexpected(token);
- }
-
- return markerApply(marker, delegate.createIdentifier(token.value));
- }
-
- function parseNonComputedMember() {
- expect('.');
-
- return parseNonComputedProperty();
- }
-
- function parseComputedMember() {
- var expr;
-
- expect('[');
-
- expr = parseExpression();
-
- expect(']');
-
- return expr;
- }
-
- function parseNewExpression() {
- var callee, args, marker = markerCreate();
-
- expectKeyword('new');
- callee = parseLeftHandSideExpression();
- args = match('(') ? parseArguments() : [];
-
- return markerApply(marker, delegate.createNewExpression(callee, args));
- }
-
- function parseLeftHandSideExpressionAllowCall() {
- var expr, args, marker = markerCreate();
-
- expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
-
- while (match('.') || match('[') || match('(') || lookahead.type === Token.Template) {
- if (match('(')) {
- args = parseArguments();
- expr = markerApply(marker, delegate.createCallExpression(expr, args));
- } else if (match('[')) {
- expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));
- } else if (match('.')) {
- expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));
- } else {
- expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));
- }
- }
-
- return expr;
- }
-
- function parseLeftHandSideExpression() {
- var expr, marker = markerCreate();
-
- expr = matchKeyword('new') ? parseNewExpression() : parsePrimaryExpression();
-
- while (match('.') || match('[') || lookahead.type === Token.Template) {
- if (match('[')) {
- expr = markerApply(marker, delegate.createMemberExpression('[', expr, parseComputedMember()));
- } else if (match('.')) {
- expr = markerApply(marker, delegate.createMemberExpression('.', expr, parseNonComputedMember()));
- } else {
- expr = markerApply(marker, delegate.createTaggedTemplateExpression(expr, parseTemplateLiteral()));
- }
- }
-
- return expr;
- }
-
- // 11.3 Postfix Expressions
-
- function parsePostfixExpression() {
- var marker = markerCreate(),
- expr = parseLeftHandSideExpressionAllowCall(),
- token;
-
- if (lookahead.type !== Token.Punctuator) {
- return expr;
- }
-
- if ((match('++') || match('--')) && !peekLineTerminator()) {
- // 11.3.1, 11.3.2
- if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
- throwErrorTolerant({}, Messages.StrictLHSPostfix);
- }
-
- if (!isLeftHandSide(expr)) {
- throwError({}, Messages.InvalidLHSInAssignment);
- }
-
- token = lex();
- expr = markerApply(marker, delegate.createPostfixExpression(token.value, expr));
- }
-
- return expr;
- }
-
- // 11.4 Unary Operators
-
- function parseUnaryExpression() {
- var marker, token, expr;
-
- if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
- return parsePostfixExpression();
- }
-
- if (match('++') || match('--')) {
- marker = markerCreate();
- token = lex();
- expr = parseUnaryExpression();
- // 11.4.4, 11.4.5
- if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
- throwErrorTolerant({}, Messages.StrictLHSPrefix);
- }
-
- if (!isLeftHandSide(expr)) {
- throwError({}, Messages.InvalidLHSInAssignment);
- }
-
- return markerApply(marker, delegate.createUnaryExpression(token.value, expr));
- }
-
- if (match('+') || match('-') || match('~') || match('!')) {
- marker = markerCreate();
- token = lex();
- expr = parseUnaryExpression();
- return markerApply(marker, delegate.createUnaryExpression(token.value, expr));
- }
-
- if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
- marker = markerCreate();
- token = lex();
- expr = parseUnaryExpression();
- expr = markerApply(marker, delegate.createUnaryExpression(token.value, expr));
- if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {
- throwErrorTolerant({}, Messages.StrictDelete);
- }
- return expr;
- }
-
- return parsePostfixExpression();
- }
-
- function binaryPrecedence(token, allowIn) {
- var prec = 0;
-
- if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
- return 0;
- }
-
- switch (token.value) {
- case '||':
- prec = 1;
- break;
-
- case '&&':
- prec = 2;
- break;
-
- case '|':
- prec = 3;
- break;
-
- case '^':
- prec = 4;
- break;
-
- case '&':
- prec = 5;
- break;
-
- case '==':
- case '!=':
- case '===':
- case '!==':
- prec = 6;
- break;
-
- case '<':
- case '>':
- case '<=':
- case '>=':
- case 'instanceof':
- prec = 7;
- break;
-
- case 'in':
- prec = allowIn ? 7 : 0;
- break;
-
- case '<<':
- case '>>':
- case '>>>':
- prec = 8;
- break;
-
- case '+':
- case '-':
- prec = 9;
- break;
-
- case '*':
- case '/':
- case '%':
- prec = 11;
- break;
-
- default:
- break;
- }
-
- return prec;
- }
-
- // 11.5 Multiplicative Operators
- // 11.6 Additive Operators
- // 11.7 Bitwise Shift Operators
- // 11.8 Relational Operators
- // 11.9 Equality Operators
- // 11.10 Binary Bitwise Operators
- // 11.11 Binary Logical Operators
-
- function parseBinaryExpression() {
- var expr, token, prec, previousAllowIn, stack, right, operator, left, i,
- marker, markers;
-
- previousAllowIn = state.allowIn;
- state.allowIn = true;
-
- marker = markerCreate();
- left = parseUnaryExpression();
-
- token = lookahead;
- prec = binaryPrecedence(token, previousAllowIn);
- if (prec === 0) {
- return left;
- }
- token.prec = prec;
- lex();
-
- markers = [marker, markerCreate()];
- right = parseUnaryExpression();
-
- stack = [left, token, right];
-
- while ((prec = binaryPrecedence(lookahead, previousAllowIn)) > 0) {
-
- // Reduce: make a binary expression from the three topmost entries.
- while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
- right = stack.pop();
- operator = stack.pop().value;
- left = stack.pop();
- expr = delegate.createBinaryExpression(operator, left, right);
- markers.pop();
- marker = markers.pop();
- markerApply(marker, expr);
- stack.push(expr);
- markers.push(marker);
- }
-
- // Shift.
- token = lex();
- token.prec = prec;
- stack.push(token);
- markers.push(markerCreate());
- expr = parseUnaryExpression();
- stack.push(expr);
- }
-
- state.allowIn = previousAllowIn;
-
- // Final reduce to clean-up the stack.
- i = stack.length - 1;
- expr = stack[i];
- markers.pop();
- while (i > 1) {
- expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
- i -= 2;
- marker = markers.pop();
- markerApply(marker, expr);
- }
-
- return expr;
- }
-
-
- // 11.12 Conditional Operator
-
- function parseConditionalExpression() {
- var expr, previousAllowIn, consequent, alternate, marker = markerCreate();
- expr = parseBinaryExpression();
-
- if (match('?')) {
- lex();
- previousAllowIn = state.allowIn;
- state.allowIn = true;
- consequent = parseAssignmentExpression();
- state.allowIn = previousAllowIn;
- expect(':');
- alternate = parseAssignmentExpression();
-
- expr = markerApply(marker, delegate.createConditionalExpression(expr, consequent, alternate));
- }
-
- return expr;
- }
-
- // 11.13 Assignment Operators
-
- // 12.14.5 AssignmentPattern
-
- function reinterpretAsAssignmentBindingPattern(expr) {
- var i, len, property, element;
-
- if (expr.type === Syntax.ObjectExpression) {
- expr.type = Syntax.ObjectPattern;
- for (i = 0, len = expr.properties.length; i < len; i += 1) {
- property = expr.properties[i];
- if (property.type === Syntax.SpreadProperty) {
- if (i < len - 1) {
- throwError({}, Messages.PropertyAfterSpreadProperty);
- }
- reinterpretAsAssignmentBindingPattern(property.argument);
- } else {
- if (property.kind !== 'init') {
- throwError({}, Messages.InvalidLHSInAssignment);
- }
- reinterpretAsAssignmentBindingPattern(property.value);
- }
- }
- } else if (expr.type === Syntax.ArrayExpression) {
- expr.type = Syntax.ArrayPattern;
- for (i = 0, len = expr.elements.length; i < len; i += 1) {
- element = expr.elements[i];
- /* istanbul ignore else */
- if (element) {
- reinterpretAsAssignmentBindingPattern(element);
- }
- }
- } else if (expr.type === Syntax.Identifier) {
- if (isRestrictedWord(expr.name)) {
- throwError({}, Messages.InvalidLHSInAssignment);
- }
- } else if (expr.type === Syntax.SpreadElement) {
- reinterpretAsAssignmentBindingPattern(expr.argument);
- if (expr.argument.type === Syntax.ObjectPattern) {
- throwError({}, Messages.ObjectPatternAsSpread);
- }
- } else {
- /* istanbul ignore else */
- if (expr.type !== Syntax.MemberExpression && expr.type !== Syntax.CallExpression && expr.type !== Syntax.NewExpression) {
- throwError({}, Messages.InvalidLHSInAssignment);
- }
- }
- }
-
- // 13.2.3 BindingPattern
-
- function reinterpretAsDestructuredParameter(options, expr) {
- var i, len, property, element;
-
- if (expr.type === Syntax.ObjectExpression) {
- expr.type = Syntax.ObjectPattern;
- for (i = 0, len = expr.properties.length; i < len; i += 1) {
- property = expr.properties[i];
- if (property.type === Syntax.SpreadProperty) {
- if (i < len - 1) {
- throwError({}, Messages.PropertyAfterSpreadProperty);
- }
- reinterpretAsDestructuredParameter(options, property.argument);
- } else {
- if (property.kind !== 'init') {
- throwError({}, Messages.InvalidLHSInFormalsList);
- }
- reinterpretAsDestructuredParameter(options, property.value);
- }
- }
- } else if (expr.type === Syntax.ArrayExpression) {
- expr.type = Syntax.ArrayPattern;
- for (i = 0, len = expr.elements.length; i < len; i += 1) {
- element = expr.elements[i];
- if (element) {
- reinterpretAsDestructuredParameter(options, element);
- }
- }
- } else if (expr.type === Syntax.Identifier) {
- validateParam(options, expr, expr.name);
- } else if (expr.type === Syntax.SpreadElement) {
- // BindingRestElement only allows BindingIdentifier
- if (expr.argument.type !== Syntax.Identifier) {
- throwError({}, Messages.InvalidLHSInFormalsList);
- }
- validateParam(options, expr.argument, expr.argument.name);
- } else {
- throwError({}, Messages.InvalidLHSInFormalsList);
- }
- }
-
- function reinterpretAsCoverFormalsList(expressions) {
- var i, len, param, params, defaults, defaultCount, options, rest;
-
- params = [];
- defaults = [];
- defaultCount = 0;
- rest = null;
- options = {
- paramSet: new StringMap()
- };
-
- for (i = 0, len = expressions.length; i < len; i += 1) {
- param = expressions[i];
- if (param.type === Syntax.Identifier) {
- params.push(param);
- defaults.push(null);
- validateParam(options, param, param.name);
- } else if (param.type === Syntax.ObjectExpression || param.type === Syntax.ArrayExpression) {
- reinterpretAsDestructuredParameter(options, param);
- params.push(param);
- defaults.push(null);
- } else if (param.type === Syntax.SpreadElement) {
- assert(i === len - 1, 'It is guaranteed that SpreadElement is last element by parseExpression');
- if (param.argument.type !== Syntax.Identifier) {
- throwError({}, Messages.InvalidLHSInFormalsList);
- }
- reinterpretAsDestructuredParameter(options, param.argument);
- rest = param.argument;
- } else if (param.type === Syntax.AssignmentExpression) {
- params.push(param.left);
- defaults.push(param.right);
- ++defaultCount;
- validateParam(options, param.left, param.left.name);
- } else {
- return null;
- }
- }
-
- if (options.message === Messages.StrictParamDupe) {
- throwError(
- strict ? options.stricted : options.firstRestricted,
- options.message
- );
- }
-
- if (defaultCount === 0) {
- defaults = [];
- }
-
- return {
- params: params,
- defaults: defaults,
- rest: rest,
- stricted: options.stricted,
- firstRestricted: options.firstRestricted,
- message: options.message
- };
- }
-
- function parseArrowFunctionExpression(options, marker) {
- var previousStrict, previousYieldAllowed, previousAwaitAllowed, body;
-
- expect('=>');
-
- previousStrict = strict;
- previousYieldAllowed = state.yieldAllowed;
- state.yieldAllowed = false;
- previousAwaitAllowed = state.awaitAllowed;
- state.awaitAllowed = !!options.async;
- body = parseConciseBody();
-
- if (strict && options.firstRestricted) {
- throwError(options.firstRestricted, options.message);
- }
- if (strict && options.stricted) {
- throwErrorTolerant(options.stricted, options.message);
- }
-
- strict = previousStrict;
- state.yieldAllowed = previousYieldAllowed;
- state.awaitAllowed = previousAwaitAllowed;
-
- return markerApply(marker, delegate.createArrowFunctionExpression(
- options.params,
- options.defaults,
- body,
- options.rest,
- body.type !== Syntax.BlockStatement,
- !!options.async
- ));
- }
-
- function parseAssignmentExpression() {
- var marker, expr, token, params, oldParenthesizedCount,
- startsWithParen = false, backtrackToken = lookahead,
- possiblyAsync = false;
-
- if (matchYield()) {
- return parseYieldExpression();
- }
-
- if (matchAwait()) {
- return parseAwaitExpression();
- }
-
- oldParenthesizedCount = state.parenthesizedCount;
-
- marker = markerCreate();
-
- if (matchAsyncFuncExprOrDecl()) {
- return parseFunctionExpression();
- }
-
- if (matchAsync()) {
- // We can't be completely sure that this 'async' token is
- // actually a contextual keyword modifying a function
- // expression, so we might have to un-lex() it later by
- // calling rewind(backtrackToken).
- possiblyAsync = true;
- lex();
- }
-
- if (match('(')) {
- token = lookahead2();
- if ((token.type === Token.Punctuator && token.value === ')') || token.value === '...') {
- params = parseParams();
- if (!match('=>')) {
- throwUnexpected(lex());
- }
- params.async = possiblyAsync;
- return parseArrowFunctionExpression(params, marker);
- }
- startsWithParen = true;
- }
-
- token = lookahead;
-
- // If the 'async' keyword is not followed by a '(' character or an
- // identifier, then it can't be an arrow function modifier, and we
- // should interpret it as a normal identifer.
- if (possiblyAsync && !match('(') && token.type !== Token.Identifier) {
- possiblyAsync = false;
- rewind(backtrackToken);
- }
-
- expr = parseConditionalExpression();
-
- if (match('=>') &&
- (state.parenthesizedCount === oldParenthesizedCount ||
- state.parenthesizedCount === (oldParenthesizedCount + 1))) {
- if (expr.type === Syntax.Identifier) {
- params = reinterpretAsCoverFormalsList([ expr ]);
- } else if (expr.type === Syntax.AssignmentExpression ||
- expr.type === Syntax.ArrayExpression ||
- expr.type === Syntax.ObjectExpression) {
- if (!startsWithParen) {
- throwUnexpected(lex());
- }
- params = reinterpretAsCoverFormalsList([ expr ]);
- } else if (expr.type === Syntax.SequenceExpression) {
- params = reinterpretAsCoverFormalsList(expr.expressions);
- }
- if (params) {
- params.async = possiblyAsync;
- return parseArrowFunctionExpression(params, marker);
- }
- }
-
- // If we haven't returned by now, then the 'async' keyword was not
- // a function modifier, and we should rewind and interpret it as a
- // normal identifier.
- if (possiblyAsync) {
- possiblyAsync = false;
- rewind(backtrackToken);
- expr = parseConditionalExpression();
- }
-
- if (matchAssign()) {
- // 11.13.1
- if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {
- throwErrorTolerant(token, Messages.StrictLHSAssignment);
- }
-
- // ES.next draf 11.13 Runtime Semantics step 1
- if (match('=') && (expr.type === Syntax.ObjectExpression || expr.type === Syntax.ArrayExpression)) {
- reinterpretAsAssignmentBindingPattern(expr);
- } else if (!isLeftHandSide(expr)) {
- throwError({}, Messages.InvalidLHSInAssignment);
- }
-
- expr = markerApply(marker, delegate.createAssignmentExpression(lex().value, expr, parseAssignmentExpression()));
- }
-
- return expr;
- }
-
- // 11.14 Comma Operator
-
- function parseExpression() {
- var marker, expr, expressions, sequence, spreadFound;
-
- marker = markerCreate();
- expr = parseAssignmentExpression();
- expressions = [ expr ];
-
- if (match(',')) {
- while (index < length) {
- if (!match(',')) {
- break;
- }
-
- lex();
- expr = parseSpreadOrAssignmentExpression();
- expressions.push(expr);
-
- if (expr.type === Syntax.SpreadElement) {
- spreadFound = true;
- if (!match(')')) {
- throwError({}, Messages.ElementAfterSpreadElement);
- }
- break;
- }
- }
-
- sequence = markerApply(marker, delegate.createSequenceExpression(expressions));
- }
-
- if (spreadFound && lookahead2().value !== '=>') {
- throwError({}, Messages.IllegalSpread);
- }
-
- return sequence || expr;
- }
-
- // 12.1 Block
-
- function parseStatementList() {
- var list = [],
- statement;
-
- while (index < length) {
- if (match('}')) {
- break;
- }
- statement = parseSourceElement();
- if (typeof statement === 'undefined') {
- break;
- }
- list.push(statement);
- }
-
- return list;
- }
-
- function parseBlock() {
- var block, marker = markerCreate();
-
- expect('{');
-
- block = parseStatementList();
-
- expect('}');
-
- return markerApply(marker, delegate.createBlockStatement(block));
- }
-
- // 12.2 Variable Statement
-
- function parseTypeParameterDeclaration() {
- var marker = markerCreate(), paramTypes = [];
-
- expect('<');
- while (!match('>')) {
- paramTypes.push(parseTypeAnnotatableIdentifier());
- if (!match('>')) {
- expect(',');
- }
- }
- expect('>');
-
- return markerApply(marker, delegate.createTypeParameterDeclaration(
- paramTypes
- ));
- }
-
- function parseTypeParameterInstantiation() {
- var marker = markerCreate(), oldInType = state.inType, paramTypes = [];
-
- state.inType = true;
-
- expect('<');
- while (!match('>')) {
- paramTypes.push(parseType());
- if (!match('>')) {
- expect(',');
- }
- }
- expect('>');
-
- state.inType = oldInType;
-
- return markerApply(marker, delegate.createTypeParameterInstantiation(
- paramTypes
- ));
- }
-
- function parseObjectTypeIndexer(marker, isStatic) {
- var id, key, value;
-
- expect('[');
- id = parseObjectPropertyKey();
- expect(':');
- key = parseType();
- expect(']');
- expect(':');
- value = parseType();
-
- return markerApply(marker, delegate.createObjectTypeIndexer(
- id,
- key,
- value,
- isStatic
- ));
- }
-
- function parseObjectTypeMethodish(marker) {
- var params = [], rest = null, returnType, typeParameters = null;
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- expect('(');
- while (lookahead.type === Token.Identifier) {
- params.push(parseFunctionTypeParam());
- if (!match(')')) {
- expect(',');
- }
- }
-
- if (match('...')) {
- lex();
- rest = parseFunctionTypeParam();
- }
- expect(')');
- expect(':');
- returnType = parseType();
-
- return markerApply(marker, delegate.createFunctionTypeAnnotation(
- params,
- returnType,
- rest,
- typeParameters
- ));
- }
-
- function parseObjectTypeMethod(marker, isStatic, key) {
- var optional = false, value;
- value = parseObjectTypeMethodish(marker);
-
- return markerApply(marker, delegate.createObjectTypeProperty(
- key,
- value,
- optional,
- isStatic
- ));
- }
-
- function parseObjectTypeCallProperty(marker, isStatic) {
- var valueMarker = markerCreate();
- return markerApply(marker, delegate.createObjectTypeCallProperty(
- parseObjectTypeMethodish(valueMarker),
- isStatic
- ));
- }
-
- function parseObjectType(allowStatic) {
- var callProperties = [], indexers = [], marker, optional = false,
- properties = [], propertyKey, propertyTypeAnnotation,
- token, isStatic, matchStatic;
-
- expect('{');
-
- while (!match('}')) {
- marker = markerCreate();
- matchStatic =
- strict
- ? matchKeyword('static')
- : matchContextualKeyword('static');
-
- if (allowStatic && matchStatic) {
- token = lex();
- isStatic = true;
- }
-
- if (match('[')) {
- indexers.push(parseObjectTypeIndexer(marker, isStatic));
- } else if (match('(') || match('<')) {
- callProperties.push(parseObjectTypeCallProperty(marker, allowStatic));
- } else {
- if (isStatic && match(':')) {
- propertyKey = markerApply(marker, delegate.createIdentifier(token));
- throwErrorTolerant(token, Messages.StrictReservedWord);
- } else {
- propertyKey = parseObjectPropertyKey();
- }
- if (match('<') || match('(')) {
- // This is a method property
- properties.push(parseObjectTypeMethod(marker, isStatic, propertyKey));
- } else {
- if (match('?')) {
- lex();
- optional = true;
- }
- expect(':');
- propertyTypeAnnotation = parseType();
- properties.push(markerApply(marker, delegate.createObjectTypeProperty(
- propertyKey,
- propertyTypeAnnotation,
- optional,
- isStatic
- )));
- }
- }
-
- if (match(';')) {
- lex();
- } else if (!match('}')) {
- throwUnexpected(lookahead);
- }
- }
-
- expect('}');
-
- return delegate.createObjectTypeAnnotation(
- properties,
- indexers,
- callProperties
- );
- }
-
- function parseGenericType() {
- var marker = markerCreate(),
- typeParameters = null, typeIdentifier;
-
- typeIdentifier = parseVariableIdentifier();
-
- while (match('.')) {
- expect('.');
- typeIdentifier = markerApply(marker, delegate.createQualifiedTypeIdentifier(
- typeIdentifier,
- parseVariableIdentifier()
- ));
- }
-
- if (match('<')) {
- typeParameters = parseTypeParameterInstantiation();
- }
-
- return markerApply(marker, delegate.createGenericTypeAnnotation(
- typeIdentifier,
- typeParameters
- ));
- }
-
- function parseVoidType() {
- var marker = markerCreate();
- expectKeyword('void');
- return markerApply(marker, delegate.createVoidTypeAnnotation());
- }
-
- function parseTypeofType() {
- var argument, marker = markerCreate();
- expectKeyword('typeof');
- argument = parsePrimaryType();
- return markerApply(marker, delegate.createTypeofTypeAnnotation(
- argument
- ));
- }
-
- function parseTupleType() {
- var marker = markerCreate(), types = [];
- expect('[');
- // We allow trailing commas
- while (index < length && !match(']')) {
- types.push(parseType());
- if (match(']')) {
- break;
- }
- expect(',');
- }
- expect(']');
- return markerApply(marker, delegate.createTupleTypeAnnotation(
- types
- ));
- }
-
- function parseFunctionTypeParam() {
- var marker = markerCreate(), name, optional = false, typeAnnotation;
- name = parseVariableIdentifier();
- if (match('?')) {
- lex();
- optional = true;
- }
- expect(':');
- typeAnnotation = parseType();
- return markerApply(marker, delegate.createFunctionTypeParam(
- name,
- typeAnnotation,
- optional
- ));
- }
-
- function parseFunctionTypeParams() {
- var ret = { params: [], rest: null };
- while (lookahead.type === Token.Identifier) {
- ret.params.push(parseFunctionTypeParam());
- if (!match(')')) {
- expect(',');
- }
- }
-
- if (match('...')) {
- lex();
- ret.rest = parseFunctionTypeParam();
- }
- return ret;
- }
-
- // The parsing of types roughly parallels the parsing of expressions, and
- // primary types are kind of like primary expressions...they're the
- // primitives with which other types are constructed.
- function parsePrimaryType() {
- var params = null, returnType = null,
- marker = markerCreate(), rest = null, tmp,
- typeParameters, token, type, isGroupedType = false;
-
- switch (lookahead.type) {
- case Token.Identifier:
- switch (lookahead.value) {
- case 'any':
- lex();
- return markerApply(marker, delegate.createAnyTypeAnnotation());
- case 'bool': // fallthrough
- case 'boolean':
- lex();
- return markerApply(marker, delegate.createBooleanTypeAnnotation());
- case 'number':
- lex();
- return markerApply(marker, delegate.createNumberTypeAnnotation());
- case 'string':
- lex();
- return markerApply(marker, delegate.createStringTypeAnnotation());
- }
- return markerApply(marker, parseGenericType());
- case Token.Punctuator:
- switch (lookahead.value) {
- case '{':
- return markerApply(marker, parseObjectType());
- case '[':
- return parseTupleType();
- case '<':
- typeParameters = parseTypeParameterDeclaration();
- expect('(');
- tmp = parseFunctionTypeParams();
- params = tmp.params;
- rest = tmp.rest;
- expect(')');
-
- expect('=>');
-
- returnType = parseType();
-
- return markerApply(marker, delegate.createFunctionTypeAnnotation(
- params,
- returnType,
- rest,
- typeParameters
- ));
- case '(':
- lex();
- // Check to see if this is actually a grouped type
- if (!match(')') && !match('...')) {
- if (lookahead.type === Token.Identifier) {
- token = lookahead2();
- isGroupedType = token.value !== '?' && token.value !== ':';
- } else {
- isGroupedType = true;
- }
- }
-
- if (isGroupedType) {
- type = parseType();
- expect(')');
-
- // If we see a => next then someone was probably confused about
- // function types, so we can provide a better error message
- if (match('=>')) {
- throwError({}, Messages.ConfusedAboutFunctionType);
- }
-
- return type;
- }
-
- tmp = parseFunctionTypeParams();
- params = tmp.params;
- rest = tmp.rest;
-
- expect(')');
-
- expect('=>');
-
- returnType = parseType();
-
- return markerApply(marker, delegate.createFunctionTypeAnnotation(
- params,
- returnType,
- rest,
- null /* typeParameters */
- ));
- }
- break;
- case Token.Keyword:
- switch (lookahead.value) {
- case 'void':
- return markerApply(marker, parseVoidType());
- case 'typeof':
- return markerApply(marker, parseTypeofType());
- }
- break;
- case Token.StringLiteral:
- token = lex();
- if (token.octal) {
- throwError(token, Messages.StrictOctalLiteral);
- }
- return markerApply(marker, delegate.createStringLiteralTypeAnnotation(
- token
- ));
- }
-
- throwUnexpected(lookahead);
- }
-
- function parsePostfixType() {
- var marker = markerCreate(), t = parsePrimaryType();
- if (match('[')) {
- expect('[');
- expect(']');
- return markerApply(marker, delegate.createArrayTypeAnnotation(t));
- }
- return t;
- }
-
- function parsePrefixType() {
- var marker = markerCreate();
- if (match('?')) {
- lex();
- return markerApply(marker, delegate.createNullableTypeAnnotation(
- parsePrefixType()
- ));
- }
- return parsePostfixType();
- }
-
-
- function parseIntersectionType() {
- var marker = markerCreate(), type, types;
- type = parsePrefixType();
- types = [type];
- while (match('&')) {
- lex();
- types.push(parsePrefixType());
- }
-
- return types.length === 1 ?
- type :
- markerApply(marker, delegate.createIntersectionTypeAnnotation(
- types
- ));
- }
-
- function parseUnionType() {
- var marker = markerCreate(), type, types;
- type = parseIntersectionType();
- types = [type];
- while (match('|')) {
- lex();
- types.push(parseIntersectionType());
- }
- return types.length === 1 ?
- type :
- markerApply(marker, delegate.createUnionTypeAnnotation(
- types
- ));
- }
-
- function parseType() {
- var oldInType = state.inType, type;
- state.inType = true;
-
- type = parseUnionType();
-
- state.inType = oldInType;
- return type;
- }
-
- function parseTypeAnnotation() {
- var marker = markerCreate(), type;
-
- expect(':');
- type = parseType();
-
- return markerApply(marker, delegate.createTypeAnnotation(type));
- }
-
- function parseVariableIdentifier() {
- var marker = markerCreate(),
- token = lex();
-
- if (token.type !== Token.Identifier) {
- throwUnexpected(token);
- }
-
- return markerApply(marker, delegate.createIdentifier(token.value));
- }
-
- function parseTypeAnnotatableIdentifier(requireTypeAnnotation, canBeOptionalParam) {
- var marker = markerCreate(),
- ident = parseVariableIdentifier(),
- isOptionalParam = false;
-
- if (canBeOptionalParam && match('?')) {
- expect('?');
- isOptionalParam = true;
- }
-
- if (requireTypeAnnotation || match(':')) {
- ident.typeAnnotation = parseTypeAnnotation();
- ident = markerApply(marker, ident);
- }
-
- if (isOptionalParam) {
- ident.optional = true;
- ident = markerApply(marker, ident);
- }
-
- return ident;
- }
-
- function parseVariableDeclaration(kind) {
- var id,
- marker = markerCreate(),
- init = null,
- typeAnnotationMarker = markerCreate();
- if (match('{')) {
- id = parseObjectInitialiser();
- reinterpretAsAssignmentBindingPattern(id);
- if (match(':')) {
- id.typeAnnotation = parseTypeAnnotation();
- markerApply(typeAnnotationMarker, id);
- }
- } else if (match('[')) {
- id = parseArrayInitialiser();
- reinterpretAsAssignmentBindingPattern(id);
- if (match(':')) {
- id.typeAnnotation = parseTypeAnnotation();
- markerApply(typeAnnotationMarker, id);
- }
- } else {
- /* istanbul ignore next */
- id = state.allowKeyword ? parseNonComputedProperty() : parseTypeAnnotatableIdentifier();
- // 12.2.1
- if (strict && isRestrictedWord(id.name)) {
- throwErrorTolerant({}, Messages.StrictVarName);
- }
- }
-
- if (kind === 'const') {
- if (!match('=')) {
- throwError({}, Messages.NoUninitializedConst);
- }
- expect('=');
- init = parseAssignmentExpression();
- } else if (match('=')) {
- lex();
- init = parseAssignmentExpression();
- }
-
- return markerApply(marker, delegate.createVariableDeclarator(id, init));
- }
-
- function parseVariableDeclarationList(kind) {
- var list = [];
-
- do {
- list.push(parseVariableDeclaration(kind));
- if (!match(',')) {
- break;
- }
- lex();
- } while (index < length);
-
- return list;
- }
-
- function parseVariableStatement() {
- var declarations, marker = markerCreate();
-
- expectKeyword('var');
-
- declarations = parseVariableDeclarationList();
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createVariableDeclaration(declarations, 'var'));
- }
-
- // kind may be `const` or `let`
- // Both are experimental and not in the specification yet.
- // see http://wiki.ecmascript.org/doku.php?id=harmony:const
- // and http://wiki.ecmascript.org/doku.php?id=harmony:let
- function parseConstLetDeclaration(kind) {
- var declarations, marker = markerCreate();
-
- expectKeyword(kind);
-
- declarations = parseVariableDeclarationList(kind);
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createVariableDeclaration(declarations, kind));
- }
-
- // people.mozilla.org/~jorendorff/es6-draft.html
-
- function parseModuleSpecifier() {
- var marker = markerCreate(),
- specifier;
-
- if (lookahead.type !== Token.StringLiteral) {
- throwError({}, Messages.InvalidModuleSpecifier);
- }
- specifier = delegate.createModuleSpecifier(lookahead);
- lex();
- return markerApply(marker, specifier);
- }
-
- function parseExportBatchSpecifier() {
- var marker = markerCreate();
- expect('*');
- return markerApply(marker, delegate.createExportBatchSpecifier());
- }
-
- function parseExportSpecifier() {
- var id, name = null, marker = markerCreate(), from;
- if (matchKeyword('default')) {
- lex();
- id = markerApply(marker, delegate.createIdentifier('default'));
- // export {default} from "something";
- } else {
- id = parseVariableIdentifier();
- }
- if (matchContextualKeyword('as')) {
- lex();
- name = parseNonComputedProperty();
- }
-
- return markerApply(marker, delegate.createExportSpecifier(id, name));
- }
-
- function parseExportDeclaration() {
- var declaration = null,
- possibleIdentifierToken, sourceElement,
- isExportFromIdentifier,
- src = null, specifiers = [],
- marker = markerCreate();
-
- expectKeyword('export');
-
- if (matchKeyword('default')) {
- // covers:
- // export default ...
- lex();
- if (matchKeyword('function') || matchKeyword('class')) {
- possibleIdentifierToken = lookahead2();
- if (isIdentifierName(possibleIdentifierToken)) {
- // covers:
- // export default function foo () {}
- // export default class foo {}
- sourceElement = parseSourceElement();
- return markerApply(marker, delegate.createExportDeclaration(true, sourceElement, [sourceElement.id], null));
- }
- // covers:
- // export default function () {}
- // export default class {}
- switch (lookahead.value) {
- case 'class':
- return markerApply(marker, delegate.createExportDeclaration(true, parseClassExpression(), [], null));
- case 'function':
- return markerApply(marker, delegate.createExportDeclaration(true, parseFunctionExpression(), [], null));
- }
- }
-
- if (matchContextualKeyword('from')) {
- throwError({}, Messages.UnexpectedToken, lookahead.value);
- }
-
- // covers:
- // export default {};
- // export default [];
- if (match('{')) {
- declaration = parseObjectInitialiser();
- } else if (match('[')) {
- declaration = parseArrayInitialiser();
- } else {
- declaration = parseAssignmentExpression();
- }
- consumeSemicolon();
- return markerApply(marker, delegate.createExportDeclaration(true, declaration, [], null));
- }
-
- // non-default export
- if (lookahead.type === Token.Keyword || matchContextualKeyword('type')) {
- // covers:
- // export var f = 1;
- switch (lookahead.value) {
- case 'type':
- case 'let':
- case 'const':
- case 'var':
- case 'class':
- case 'function':
- return markerApply(marker, delegate.createExportDeclaration(false, parseSourceElement(), specifiers, null));
- }
- }
-
- if (match('*')) {
- // covers:
- // export * from "foo";
- specifiers.push(parseExportBatchSpecifier());
-
- if (!matchContextualKeyword('from')) {
- throwError({}, lookahead.value ?
- Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
- }
- lex();
- src = parseModuleSpecifier();
- consumeSemicolon();
-
- return markerApply(marker, delegate.createExportDeclaration(false, null, specifiers, src));
- }
-
- expect('{');
- if (!match('}')) {
- do {
- isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default');
- specifiers.push(parseExportSpecifier());
- } while (match(',') && lex());
- }
- expect('}');
-
- if (matchContextualKeyword('from')) {
- // covering:
- // export {default} from "foo";
- // export {foo} from "foo";
- lex();
- src = parseModuleSpecifier();
- consumeSemicolon();
- } else if (isExportFromIdentifier) {
- // covering:
- // export {default}; // missing fromClause
- throwError({}, lookahead.value ?
- Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
- } else {
- // cover
- // export {foo};
- consumeSemicolon();
- }
- return markerApply(marker, delegate.createExportDeclaration(false, declaration, specifiers, src));
- }
-
-
- function parseImportSpecifier() {
- // import {<foo as bar>} ...;
- var id, name = null, marker = markerCreate();
-
- id = parseNonComputedProperty();
- if (matchContextualKeyword('as')) {
- lex();
- name = parseVariableIdentifier();
- }
-
- return markerApply(marker, delegate.createImportSpecifier(id, name));
- }
-
- function parseNamedImports() {
- var specifiers = [];
- // {foo, bar as bas}
- expect('{');
- if (!match('}')) {
- do {
- specifiers.push(parseImportSpecifier());
- } while (match(',') && lex());
- }
- expect('}');
- return specifiers;
- }
-
- function parseImportDefaultSpecifier() {
- // import <foo> ...;
- var id, marker = markerCreate();
-
- id = parseNonComputedProperty();
-
- return markerApply(marker, delegate.createImportDefaultSpecifier(id));
- }
-
- function parseImportNamespaceSpecifier() {
- // import <* as foo> ...;
- var id, marker = markerCreate();
-
- expect('*');
- if (!matchContextualKeyword('as')) {
- throwError({}, Messages.NoAsAfterImportNamespace);
- }
- lex();
- id = parseNonComputedProperty();
-
- return markerApply(marker, delegate.createImportNamespaceSpecifier(id));
- }
-
- function parseImportDeclaration() {
- var specifiers, src, marker = markerCreate(), isType = false, token2;
-
- expectKeyword('import');
-
- if (matchContextualKeyword('type')) {
- token2 = lookahead2();
- if ((token2.type === Token.Identifier && token2.value !== 'from') ||
- (token2.type === Token.Punctuator &&
- (token2.value === '{' || token2.value === '*'))) {
- isType = true;
- lex();
- }
- }
-
- specifiers = [];
-
- if (lookahead.type === Token.StringLiteral) {
- // covers:
- // import "foo";
- src = parseModuleSpecifier();
- consumeSemicolon();
- return markerApply(marker, delegate.createImportDeclaration(specifiers, src, isType));
- }
-
- if (!matchKeyword('default') && isIdentifierName(lookahead)) {
- // covers:
- // import foo
- // import foo, ...
- specifiers.push(parseImportDefaultSpecifier());
- if (match(',')) {
- lex();
- }
- }
- if (match('*')) {
- // covers:
- // import foo, * as foo
- // import * as foo
- specifiers.push(parseImportNamespaceSpecifier());
- } else if (match('{')) {
- // covers:
- // import foo, {bar}
- // import {bar}
- specifiers = specifiers.concat(parseNamedImports());
- }
-
- if (!matchContextualKeyword('from')) {
- throwError({}, lookahead.value ?
- Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value);
- }
- lex();
- src = parseModuleSpecifier();
- consumeSemicolon();
-
- return markerApply(marker, delegate.createImportDeclaration(specifiers, src, isType));
- }
-
- // 12.3 Empty Statement
-
- function parseEmptyStatement() {
- var marker = markerCreate();
- expect(';');
- return markerApply(marker, delegate.createEmptyStatement());
- }
-
- // 12.4 Expression Statement
-
- function parseExpressionStatement() {
- var marker = markerCreate(), expr = parseExpression();
- consumeSemicolon();
- return markerApply(marker, delegate.createExpressionStatement(expr));
- }
-
- // 12.5 If statement
-
- function parseIfStatement() {
- var test, consequent, alternate, marker = markerCreate();
-
- expectKeyword('if');
-
- expect('(');
-
- test = parseExpression();
-
- expect(')');
-
- consequent = parseStatement();
-
- if (matchKeyword('else')) {
- lex();
- alternate = parseStatement();
- } else {
- alternate = null;
- }
-
- return markerApply(marker, delegate.createIfStatement(test, consequent, alternate));
- }
-
- // 12.6 Iteration Statements
-
- function parseDoWhileStatement() {
- var body, test, oldInIteration, marker = markerCreate();
-
- expectKeyword('do');
-
- oldInIteration = state.inIteration;
- state.inIteration = true;
-
- body = parseStatement();
-
- state.inIteration = oldInIteration;
-
- expectKeyword('while');
-
- expect('(');
-
- test = parseExpression();
-
- expect(')');
-
- if (match(';')) {
- lex();
- }
-
- return markerApply(marker, delegate.createDoWhileStatement(body, test));
- }
-
- function parseWhileStatement() {
- var test, body, oldInIteration, marker = markerCreate();
-
- expectKeyword('while');
-
- expect('(');
-
- test = parseExpression();
-
- expect(')');
-
- oldInIteration = state.inIteration;
- state.inIteration = true;
-
- body = parseStatement();
-
- state.inIteration = oldInIteration;
-
- return markerApply(marker, delegate.createWhileStatement(test, body));
- }
-
- function parseForVariableDeclaration() {
- var marker = markerCreate(),
- token = lex(),
- declarations = parseVariableDeclarationList();
-
- return markerApply(marker, delegate.createVariableDeclaration(declarations, token.value));
- }
-
- function parseForStatement(opts) {
- var init, test, update, left, right, body, operator, oldInIteration,
- marker = markerCreate();
- init = test = update = null;
- expectKeyword('for');
-
- // http://wiki.ecmascript.org/doku.php?id=proposals:iterators_and_generators&s=each
- if (matchContextualKeyword('each')) {
- throwError({}, Messages.EachNotAllowed);
- }
-
- expect('(');
-
- if (match(';')) {
- lex();
- } else {
- if (matchKeyword('var') || matchKeyword('let') || matchKeyword('const')) {
- state.allowIn = false;
- init = parseForVariableDeclaration();
- state.allowIn = true;
-
- if (init.declarations.length === 1) {
- if (matchKeyword('in') || matchContextualKeyword('of')) {
- operator = lookahead;
- if (!((operator.value === 'in' || init.kind !== 'var') && init.declarations[0].init)) {
- lex();
- left = init;
- right = parseExpression();
- init = null;
- }
- }
- }
- } else {
- state.allowIn = false;
- init = parseExpression();
- state.allowIn = true;
-
- if (matchContextualKeyword('of')) {
- operator = lex();
- left = init;
- right = parseExpression();
- init = null;
- } else if (matchKeyword('in')) {
- // LeftHandSideExpression
- if (!isAssignableLeftHandSide(init)) {
- throwError({}, Messages.InvalidLHSInForIn);
- }
- operator = lex();
- left = init;
- right = parseExpression();
- init = null;
- }
- }
-
- if (typeof left === 'undefined') {
- expect(';');
- }
- }
-
- if (typeof left === 'undefined') {
-
- if (!match(';')) {
- test = parseExpression();
- }
- expect(';');
-
- if (!match(')')) {
- update = parseExpression();
- }
- }
-
- expect(')');
-
- oldInIteration = state.inIteration;
- state.inIteration = true;
-
- if (!(opts !== undefined && opts.ignoreBody)) {
- body = parseStatement();
- }
-
- state.inIteration = oldInIteration;
-
- if (typeof left === 'undefined') {
- return markerApply(marker, delegate.createForStatement(init, test, update, body));
- }
-
- if (operator.value === 'in') {
- return markerApply(marker, delegate.createForInStatement(left, right, body));
- }
- return markerApply(marker, delegate.createForOfStatement(left, right, body));
- }
-
- // 12.7 The continue statement
-
- function parseContinueStatement() {
- var label = null, marker = markerCreate();
-
- expectKeyword('continue');
-
- // Optimize the most common form: 'continue;'.
- if (source.charCodeAt(index) === 59) {
- lex();
-
- if (!state.inIteration) {
- throwError({}, Messages.IllegalContinue);
- }
-
- return markerApply(marker, delegate.createContinueStatement(null));
- }
-
- if (peekLineTerminator()) {
- if (!state.inIteration) {
- throwError({}, Messages.IllegalContinue);
- }
-
- return markerApply(marker, delegate.createContinueStatement(null));
- }
-
- if (lookahead.type === Token.Identifier) {
- label = parseVariableIdentifier();
-
- if (!state.labelSet.has(label.name)) {
- throwError({}, Messages.UnknownLabel, label.name);
- }
- }
-
- consumeSemicolon();
-
- if (label === null && !state.inIteration) {
- throwError({}, Messages.IllegalContinue);
- }
-
- return markerApply(marker, delegate.createContinueStatement(label));
- }
-
- // 12.8 The break statement
-
- function parseBreakStatement() {
- var label = null, marker = markerCreate();
-
- expectKeyword('break');
-
- // Catch the very common case first: immediately a semicolon (char #59).
- if (source.charCodeAt(index) === 59) {
- lex();
-
- if (!(state.inIteration || state.inSwitch)) {
- throwError({}, Messages.IllegalBreak);
- }
-
- return markerApply(marker, delegate.createBreakStatement(null));
- }
-
- if (peekLineTerminator()) {
- if (!(state.inIteration || state.inSwitch)) {
- throwError({}, Messages.IllegalBreak);
- }
-
- return markerApply(marker, delegate.createBreakStatement(null));
- }
-
- if (lookahead.type === Token.Identifier) {
- label = parseVariableIdentifier();
-
- if (!state.labelSet.has(label.name)) {
- throwError({}, Messages.UnknownLabel, label.name);
- }
- }
-
- consumeSemicolon();
-
- if (label === null && !(state.inIteration || state.inSwitch)) {
- throwError({}, Messages.IllegalBreak);
- }
-
- return markerApply(marker, delegate.createBreakStatement(label));
- }
-
- // 12.9 The return statement
-
- function parseReturnStatement() {
- var argument = null, marker = markerCreate();
-
- expectKeyword('return');
-
- if (!state.inFunctionBody) {
- throwErrorTolerant({}, Messages.IllegalReturn);
- }
-
- // 'return' followed by a space and an identifier is very common.
- if (source.charCodeAt(index) === 32) {
- if (isIdentifierStart(source.charCodeAt(index + 1))) {
- argument = parseExpression();
- consumeSemicolon();
- return markerApply(marker, delegate.createReturnStatement(argument));
- }
- }
-
- if (peekLineTerminator()) {
- return markerApply(marker, delegate.createReturnStatement(null));
- }
-
- if (!match(';')) {
- if (!match('}') && lookahead.type !== Token.EOF) {
- argument = parseExpression();
- }
- }
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createReturnStatement(argument));
- }
-
- // 12.10 The with statement
-
- function parseWithStatement() {
- var object, body, marker = markerCreate();
-
- if (strict) {
- throwErrorTolerant({}, Messages.StrictModeWith);
- }
-
- expectKeyword('with');
-
- expect('(');
-
- object = parseExpression();
-
- expect(')');
-
- body = parseStatement();
-
- return markerApply(marker, delegate.createWithStatement(object, body));
- }
-
- // 12.10 The swith statement
-
- function parseSwitchCase() {
- var test,
- consequent = [],
- sourceElement,
- marker = markerCreate();
-
- if (matchKeyword('default')) {
- lex();
- test = null;
- } else {
- expectKeyword('case');
- test = parseExpression();
- }
- expect(':');
-
- while (index < length) {
- if (match('}') || matchKeyword('default') || matchKeyword('case')) {
- break;
- }
- sourceElement = parseSourceElement();
- if (typeof sourceElement === 'undefined') {
- break;
- }
- consequent.push(sourceElement);
- }
-
- return markerApply(marker, delegate.createSwitchCase(test, consequent));
- }
-
- function parseSwitchStatement() {
- var discriminant, cases, clause, oldInSwitch, defaultFound, marker = markerCreate();
-
- expectKeyword('switch');
-
- expect('(');
-
- discriminant = parseExpression();
-
- expect(')');
-
- expect('{');
-
- cases = [];
-
- if (match('}')) {
- lex();
- return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));
- }
-
- oldInSwitch = state.inSwitch;
- state.inSwitch = true;
- defaultFound = false;
-
- while (index < length) {
- if (match('}')) {
- break;
- }
- clause = parseSwitchCase();
- if (clause.test === null) {
- if (defaultFound) {
- throwError({}, Messages.MultipleDefaultsInSwitch);
- }
- defaultFound = true;
- }
- cases.push(clause);
- }
-
- state.inSwitch = oldInSwitch;
-
- expect('}');
-
- return markerApply(marker, delegate.createSwitchStatement(discriminant, cases));
- }
-
- // 12.13 The throw statement
-
- function parseThrowStatement() {
- var argument, marker = markerCreate();
-
- expectKeyword('throw');
-
- if (peekLineTerminator()) {
- throwError({}, Messages.NewlineAfterThrow);
- }
-
- argument = parseExpression();
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createThrowStatement(argument));
- }
-
- // 12.14 The try statement
-
- function parseCatchClause() {
- var param, body, marker = markerCreate();
-
- expectKeyword('catch');
-
- expect('(');
- if (match(')')) {
- throwUnexpected(lookahead);
- }
-
- param = parseExpression();
- // 12.14.1
- if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) {
- throwErrorTolerant({}, Messages.StrictCatchVariable);
- }
-
- expect(')');
- body = parseBlock();
- return markerApply(marker, delegate.createCatchClause(param, body));
- }
-
- function parseTryStatement() {
- var block, handlers = [], finalizer = null, marker = markerCreate();
-
- expectKeyword('try');
-
- block = parseBlock();
-
- if (matchKeyword('catch')) {
- handlers.push(parseCatchClause());
- }
-
- if (matchKeyword('finally')) {
- lex();
- finalizer = parseBlock();
- }
-
- if (handlers.length === 0 && !finalizer) {
- throwError({}, Messages.NoCatchOrFinally);
- }
-
- return markerApply(marker, delegate.createTryStatement(block, [], handlers, finalizer));
- }
-
- // 12.15 The debugger statement
-
- function parseDebuggerStatement() {
- var marker = markerCreate();
- expectKeyword('debugger');
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createDebuggerStatement());
- }
-
- // 12 Statements
-
- function parseStatement() {
- var type = lookahead.type,
- marker,
- expr,
- labeledBody;
-
- if (type === Token.EOF) {
- throwUnexpected(lookahead);
- }
-
- if (type === Token.Punctuator) {
- switch (lookahead.value) {
- case ';':
- return parseEmptyStatement();
- case '{':
- return parseBlock();
- case '(':
- return parseExpressionStatement();
- default:
- break;
- }
- }
-
- if (type === Token.Keyword) {
- switch (lookahead.value) {
- case 'break':
- return parseBreakStatement();
- case 'continue':
- return parseContinueStatement();
- case 'debugger':
- return parseDebuggerStatement();
- case 'do':
- return parseDoWhileStatement();
- case 'for':
- return parseForStatement();
- case 'function':
- return parseFunctionDeclaration();
- case 'class':
- return parseClassDeclaration();
- case 'if':
- return parseIfStatement();
- case 'return':
- return parseReturnStatement();
- case 'switch':
- return parseSwitchStatement();
- case 'throw':
- return parseThrowStatement();
- case 'try':
- return parseTryStatement();
- case 'var':
- return parseVariableStatement();
- case 'while':
- return parseWhileStatement();
- case 'with':
- return parseWithStatement();
- default:
- break;
- }
- }
-
- if (matchAsyncFuncExprOrDecl()) {
- return parseFunctionDeclaration();
- }
-
- marker = markerCreate();
- expr = parseExpression();
-
- // 12.12 Labelled Statements
- if ((expr.type === Syntax.Identifier) && match(':')) {
- lex();
-
- if (state.labelSet.has(expr.name)) {
- throwError({}, Messages.Redeclaration, 'Label', expr.name);
- }
-
- state.labelSet.set(expr.name, true);
- labeledBody = parseStatement();
- state.labelSet["delete"](expr.name);
- return markerApply(marker, delegate.createLabeledStatement(expr, labeledBody));
- }
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createExpressionStatement(expr));
- }
-
- // 13 Function Definition
-
- function parseConciseBody() {
- if (match('{')) {
- return parseFunctionSourceElements();
- }
- return parseAssignmentExpression();
- }
-
- function parseFunctionSourceElements() {
- var sourceElement, sourceElements = [], token, directive, firstRestricted,
- oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesizedCount,
- marker = markerCreate();
-
- expect('{');
-
- while (index < length) {
- if (lookahead.type !== Token.StringLiteral) {
- break;
- }
- token = lookahead;
-
- sourceElement = parseSourceElement();
- sourceElements.push(sourceElement);
- if (sourceElement.expression.type !== Syntax.Literal) {
- // this is not directive
- break;
- }
- directive = source.slice(token.range[0] + 1, token.range[1] - 1);
- if (directive === 'use strict') {
- strict = true;
- if (firstRestricted) {
- throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
- }
- } else {
- if (!firstRestricted && token.octal) {
- firstRestricted = token;
- }
- }
- }
-
- oldLabelSet = state.labelSet;
- oldInIteration = state.inIteration;
- oldInSwitch = state.inSwitch;
- oldInFunctionBody = state.inFunctionBody;
- oldParenthesizedCount = state.parenthesizedCount;
-
- state.labelSet = new StringMap();
- state.inIteration = false;
- state.inSwitch = false;
- state.inFunctionBody = true;
- state.parenthesizedCount = 0;
-
- while (index < length) {
- if (match('}')) {
- break;
- }
- sourceElement = parseSourceElement();
- if (typeof sourceElement === 'undefined') {
- break;
- }
- sourceElements.push(sourceElement);
- }
-
- expect('}');
-
- state.labelSet = oldLabelSet;
- state.inIteration = oldInIteration;
- state.inSwitch = oldInSwitch;
- state.inFunctionBody = oldInFunctionBody;
- state.parenthesizedCount = oldParenthesizedCount;
-
- return markerApply(marker, delegate.createBlockStatement(sourceElements));
- }
-
- function validateParam(options, param, name) {
- if (strict) {
- if (isRestrictedWord(name)) {
- options.stricted = param;
- options.message = Messages.StrictParamName;
- }
- if (options.paramSet.has(name)) {
- options.stricted = param;
- options.message = Messages.StrictParamDupe;
- }
- } else if (!options.firstRestricted) {
- if (isRestrictedWord(name)) {
- options.firstRestricted = param;
- options.message = Messages.StrictParamName;
- } else if (isStrictModeReservedWord(name)) {
- options.firstRestricted = param;
- options.message = Messages.StrictReservedWord;
- } else if (options.paramSet.has(name)) {
- options.firstRestricted = param;
- options.message = Messages.StrictParamDupe;
- }
- }
- options.paramSet.set(name, true);
- }
-
- function parseParam(options) {
- var marker, token, rest, param, def;
-
- token = lookahead;
- if (token.value === '...') {
- token = lex();
- rest = true;
- }
-
- if (match('[')) {
- marker = markerCreate();
- param = parseArrayInitialiser();
- reinterpretAsDestructuredParameter(options, param);
- if (match(':')) {
- param.typeAnnotation = parseTypeAnnotation();
- markerApply(marker, param);
- }
- } else if (match('{')) {
- marker = markerCreate();
- if (rest) {
- throwError({}, Messages.ObjectPatternAsRestParameter);
- }
- param = parseObjectInitialiser();
- reinterpretAsDestructuredParameter(options, param);
- if (match(':')) {
- param.typeAnnotation = parseTypeAnnotation();
- markerApply(marker, param);
- }
- } else {
- param =
- rest
- ? parseTypeAnnotatableIdentifier(
- false, /* requireTypeAnnotation */
- false /* canBeOptionalParam */
- )
- : parseTypeAnnotatableIdentifier(
- false, /* requireTypeAnnotation */
- true /* canBeOptionalParam */
- );
-
- validateParam(options, token, token.value);
- }
-
- if (match('=')) {
- if (rest) {
- throwErrorTolerant(lookahead, Messages.DefaultRestParameter);
- }
- lex();
- def = parseAssignmentExpression();
- ++options.defaultCount;
- }
-
- if (rest) {
- if (!match(')')) {
- throwError({}, Messages.ParameterAfterRestParameter);
- }
- options.rest = param;
- return false;
- }
-
- options.params.push(param);
- options.defaults.push(def);
- return !match(')');
- }
-
- function parseParams(firstRestricted) {
- var options, marker = markerCreate();
-
- options = {
- params: [],
- defaultCount: 0,
- defaults: [],
- rest: null,
- firstRestricted: firstRestricted
- };
-
- expect('(');
-
- if (!match(')')) {
- options.paramSet = new StringMap();
- while (index < length) {
- if (!parseParam(options)) {
- break;
- }
- expect(',');
- }
- }
-
- expect(')');
-
- if (options.defaultCount === 0) {
- options.defaults = [];
- }
-
- if (match(':')) {
- options.returnType = parseTypeAnnotation();
- }
-
- return markerApply(marker, options);
- }
-
- function parseFunctionDeclaration() {
- var id, body, token, tmp, firstRestricted, message, generator, isAsync,
- previousStrict, previousYieldAllowed, previousAwaitAllowed,
- marker = markerCreate(), typeParameters;
-
- isAsync = false;
- if (matchAsync()) {
- lex();
- isAsync = true;
- }
-
- expectKeyword('function');
-
- generator = false;
- if (match('*')) {
- lex();
- generator = true;
- }
-
- token = lookahead;
-
- id = parseVariableIdentifier();
-
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- if (strict) {
- if (isRestrictedWord(token.value)) {
- throwErrorTolerant(token, Messages.StrictFunctionName);
- }
- } else {
- if (isRestrictedWord(token.value)) {
- firstRestricted = token;
- message = Messages.StrictFunctionName;
- } else if (isStrictModeReservedWord(token.value)) {
- firstRestricted = token;
- message = Messages.StrictReservedWord;
- }
- }
-
- tmp = parseParams(firstRestricted);
- firstRestricted = tmp.firstRestricted;
- if (tmp.message) {
- message = tmp.message;
- }
-
- previousStrict = strict;
- previousYieldAllowed = state.yieldAllowed;
- state.yieldAllowed = generator;
- previousAwaitAllowed = state.awaitAllowed;
- state.awaitAllowed = isAsync;
-
- body = parseFunctionSourceElements();
-
- if (strict && firstRestricted) {
- throwError(firstRestricted, message);
- }
- if (strict && tmp.stricted) {
- throwErrorTolerant(tmp.stricted, message);
- }
- strict = previousStrict;
- state.yieldAllowed = previousYieldAllowed;
- state.awaitAllowed = previousAwaitAllowed;
-
- return markerApply(
- marker,
- delegate.createFunctionDeclaration(
- id,
- tmp.params,
- tmp.defaults,
- body,
- tmp.rest,
- generator,
- false,
- isAsync,
- tmp.returnType,
- typeParameters
- )
- );
- }
-
- function parseFunctionExpression() {
- var token, id = null, firstRestricted, message, tmp, body, generator, isAsync,
- previousStrict, previousYieldAllowed, previousAwaitAllowed,
- marker = markerCreate(), typeParameters;
-
- isAsync = false;
- if (matchAsync()) {
- lex();
- isAsync = true;
- }
-
- expectKeyword('function');
-
- generator = false;
-
- if (match('*')) {
- lex();
- generator = true;
- }
-
- if (!match('(')) {
- if (!match('<')) {
- token = lookahead;
- id = parseVariableIdentifier();
-
- if (strict) {
- if (isRestrictedWord(token.value)) {
- throwErrorTolerant(token, Messages.StrictFunctionName);
- }
- } else {
- if (isRestrictedWord(token.value)) {
- firstRestricted = token;
- message = Messages.StrictFunctionName;
- } else if (isStrictModeReservedWord(token.value)) {
- firstRestricted = token;
- message = Messages.StrictReservedWord;
- }
- }
- }
-
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
- }
-
- tmp = parseParams(firstRestricted);
- firstRestricted = tmp.firstRestricted;
- if (tmp.message) {
- message = tmp.message;
- }
-
- previousStrict = strict;
- previousYieldAllowed = state.yieldAllowed;
- state.yieldAllowed = generator;
- previousAwaitAllowed = state.awaitAllowed;
- state.awaitAllowed = isAsync;
-
- body = parseFunctionSourceElements();
-
- if (strict && firstRestricted) {
- throwError(firstRestricted, message);
- }
- if (strict && tmp.stricted) {
- throwErrorTolerant(tmp.stricted, message);
- }
- strict = previousStrict;
- state.yieldAllowed = previousYieldAllowed;
- state.awaitAllowed = previousAwaitAllowed;
-
- return markerApply(
- marker,
- delegate.createFunctionExpression(
- id,
- tmp.params,
- tmp.defaults,
- body,
- tmp.rest,
- generator,
- false,
- isAsync,
- tmp.returnType,
- typeParameters
- )
- );
- }
-
- function parseYieldExpression() {
- var delegateFlag, expr, marker = markerCreate();
-
- expectKeyword('yield', !strict);
-
- delegateFlag = false;
- if (match('*')) {
- lex();
- delegateFlag = true;
- }
-
- expr = parseAssignmentExpression();
-
- return markerApply(marker, delegate.createYieldExpression(expr, delegateFlag));
- }
-
- function parseAwaitExpression() {
- var expr, marker = markerCreate();
- expectContextualKeyword('await');
- expr = parseAssignmentExpression();
- return markerApply(marker, delegate.createAwaitExpression(expr));
- }
-
- // 14 Functions and classes
-
- // 14.1 Functions is defined above (13 in ES5)
- // 14.2 Arrow Functions Definitions is defined in (7.3 assignments)
-
- // 14.3 Method Definitions
- // 14.3.7
- function specialMethod(methodDefinition) {
- return methodDefinition.kind === 'get' ||
- methodDefinition.kind === 'set' ||
- methodDefinition.value.generator;
- }
-
- function parseMethodDefinition(key, isStatic, generator, computed) {
- var token, param, propType,
- isAsync, typeParameters, tokenValue, returnType;
-
- propType = isStatic ? ClassPropertyType["static"] : ClassPropertyType.prototype;
-
- if (generator) {
- return delegate.createMethodDefinition(
- propType,
- '',
- key,
- parsePropertyMethodFunction({ generator: true }),
- computed
- );
- }
-
- tokenValue = key.type === 'Identifier' && key.name;
-
- if (tokenValue === 'get' && !match('(')) {
- key = parseObjectPropertyKey();
-
- expect('(');
- expect(')');
- if (match(':')) {
- returnType = parseTypeAnnotation();
- }
- return delegate.createMethodDefinition(
- propType,
- 'get',
- key,
- parsePropertyFunction({ generator: false, returnType: returnType }),
- computed
- );
- }
- if (tokenValue === 'set' && !match('(')) {
- key = parseObjectPropertyKey();
-
- expect('(');
- token = lookahead;
- param = [ parseTypeAnnotatableIdentifier() ];
- expect(')');
- if (match(':')) {
- returnType = parseTypeAnnotation();
- }
- return delegate.createMethodDefinition(
- propType,
- 'set',
- key,
- parsePropertyFunction({
- params: param,
- generator: false,
- name: token,
- returnType: returnType
- }),
- computed
- );
- }
-
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- isAsync = tokenValue === 'async' && !match('(');
- if (isAsync) {
- key = parseObjectPropertyKey();
- }
-
- return delegate.createMethodDefinition(
- propType,
- '',
- key,
- parsePropertyMethodFunction({
- generator: false,
- async: isAsync,
- typeParameters: typeParameters
- }),
- computed
- );
- }
-
- function parseClassProperty(key, computed, isStatic) {
- var typeAnnotation;
-
- typeAnnotation = parseTypeAnnotation();
- expect(';');
-
- return delegate.createClassProperty(
- key,
- typeAnnotation,
- computed,
- isStatic
- );
- }
-
- function parseClassElement() {
- var computed = false, generator = false, key, marker = markerCreate(),
- isStatic = false, possiblyOpenBracketToken;
- if (match(';')) {
- lex();
- return undefined;
- }
-
- if (lookahead.value === 'static') {
- lex();
- isStatic = true;
- }
-
- if (match('*')) {
- lex();
- generator = true;
- }
-
- possiblyOpenBracketToken = lookahead;
- if (matchContextualKeyword('get') || matchContextualKeyword('set')) {
- possiblyOpenBracketToken = lookahead2();
- }
-
- if (possiblyOpenBracketToken.type === Token.Punctuator
- && possiblyOpenBracketToken.value === '[') {
- computed = true;
- }
-
- key = parseObjectPropertyKey();
-
- if (!generator && lookahead.value === ':') {
- return markerApply(marker, parseClassProperty(key, computed, isStatic));
- }
-
- return markerApply(marker, parseMethodDefinition(
- key,
- isStatic,
- generator,
- computed
- ));
- }
-
- function parseClassBody() {
- var classElement, classElements = [], existingProps = {},
- marker = markerCreate(), propName, propType;
-
- existingProps[ClassPropertyType["static"]] = new StringMap();
- existingProps[ClassPropertyType.prototype] = new StringMap();
-
- expect('{');
-
- while (index < length) {
- if (match('}')) {
- break;
- }
- classElement = parseClassElement(existingProps);
-
- if (typeof classElement !== 'undefined') {
- classElements.push(classElement);
-
- propName = !classElement.computed && getFieldName(classElement.key);
- if (propName !== false) {
- propType = classElement["static"] ?
- ClassPropertyType["static"] :
- ClassPropertyType.prototype;
-
- if (classElement.type === Syntax.MethodDefinition) {
- if (propName === 'constructor' && !classElement["static"]) {
- if (specialMethod(classElement)) {
- throwError(classElement, Messages.IllegalClassConstructorProperty);
- }
- if (existingProps[ClassPropertyType.prototype].has('constructor')) {
- throwError(classElement.key, Messages.IllegalDuplicateClassProperty);
- }
- }
- existingProps[propType].set(propName, true);
- }
- }
- }
- }
-
- expect('}');
-
- return markerApply(marker, delegate.createClassBody(classElements));
- }
-
- function parseClassImplements() {
- var id, implemented = [], marker, typeParameters;
- if (strict) {
- expectKeyword('implements');
- } else {
- expectContextualKeyword('implements');
- }
- while (index < length) {
- marker = markerCreate();
- id = parseVariableIdentifier();
- if (match('<')) {
- typeParameters = parseTypeParameterInstantiation();
- } else {
- typeParameters = null;
- }
- implemented.push(markerApply(marker, delegate.createClassImplements(
- id,
- typeParameters
- )));
- if (!match(',')) {
- break;
- }
- expect(',');
- }
- return implemented;
- }
-
- function parseClassExpression() {
- var id, implemented, previousYieldAllowed, superClass = null,
- superTypeParameters, marker = markerCreate(), typeParameters,
- matchImplements;
-
- expectKeyword('class');
-
- matchImplements =
- strict
- ? matchKeyword('implements')
- : matchContextualKeyword('implements');
-
- if (!matchKeyword('extends') && !matchImplements && !match('{')) {
- id = parseVariableIdentifier();
- }
-
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- if (matchKeyword('extends')) {
- expectKeyword('extends');
- previousYieldAllowed = state.yieldAllowed;
- state.yieldAllowed = false;
- superClass = parseLeftHandSideExpressionAllowCall();
- if (match('<')) {
- superTypeParameters = parseTypeParameterInstantiation();
- }
- state.yieldAllowed = previousYieldAllowed;
- }
-
- if (strict ? matchKeyword('implements') : matchContextualKeyword('implements')) {
- implemented = parseClassImplements();
- }
-
- return markerApply(marker, delegate.createClassExpression(
- id,
- superClass,
- parseClassBody(),
- typeParameters,
- superTypeParameters,
- implemented
- ));
- }
-
- function parseClassDeclaration() {
- var id, implemented, previousYieldAllowed, superClass = null,
- superTypeParameters, marker = markerCreate(), typeParameters;
-
- expectKeyword('class');
-
- id = parseVariableIdentifier();
-
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- if (matchKeyword('extends')) {
- expectKeyword('extends');
- previousYieldAllowed = state.yieldAllowed;
- state.yieldAllowed = false;
- superClass = parseLeftHandSideExpressionAllowCall();
- if (match('<')) {
- superTypeParameters = parseTypeParameterInstantiation();
- }
- state.yieldAllowed = previousYieldAllowed;
- }
-
- if (strict ? matchKeyword('implements') : matchContextualKeyword('implements')) {
- implemented = parseClassImplements();
- }
-
- return markerApply(marker, delegate.createClassDeclaration(
- id,
- superClass,
- parseClassBody(),
- typeParameters,
- superTypeParameters,
- implemented
- ));
- }
-
- // 15 Program
-
- function parseSourceElement() {
- var token;
- if (lookahead.type === Token.Keyword) {
- switch (lookahead.value) {
- case 'const':
- case 'let':
- return parseConstLetDeclaration(lookahead.value);
- case 'function':
- return parseFunctionDeclaration();
- case 'export':
- throwErrorTolerant({}, Messages.IllegalExportDeclaration);
- return parseExportDeclaration();
- case 'import':
- throwErrorTolerant({}, Messages.IllegalImportDeclaration);
- return parseImportDeclaration();
- case 'interface':
- if (lookahead2().type === Token.Identifier) {
- return parseInterface();
- }
- return parseStatement();
- default:
- return parseStatement();
- }
- }
-
- if (matchContextualKeyword('type')
- && lookahead2().type === Token.Identifier) {
- return parseTypeAlias();
- }
-
- if (matchContextualKeyword('interface')
- && lookahead2().type === Token.Identifier) {
- return parseInterface();
- }
-
- if (matchContextualKeyword('declare')) {
- token = lookahead2();
- if (token.type === Token.Keyword) {
- switch (token.value) {
- case 'class':
- return parseDeclareClass();
- case 'function':
- return parseDeclareFunction();
- case 'var':
- return parseDeclareVariable();
- }
- } else if (token.type === Token.Identifier
- && token.value === 'module') {
- return parseDeclareModule();
- }
- }
-
- if (lookahead.type !== Token.EOF) {
- return parseStatement();
- }
- }
-
- function parseProgramElement() {
- var isModule = extra.sourceType === 'module' || extra.sourceType === 'nonStrictModule';
-
- if (isModule && lookahead.type === Token.Keyword) {
- switch (lookahead.value) {
- case 'export':
- return parseExportDeclaration();
- case 'import':
- return parseImportDeclaration();
- }
- }
-
- return parseSourceElement();
- }
-
- function parseProgramElements() {
- var sourceElement, sourceElements = [], token, directive, firstRestricted;
-
- while (index < length) {
- token = lookahead;
- if (token.type !== Token.StringLiteral) {
- break;
- }
-
- sourceElement = parseProgramElement();
- sourceElements.push(sourceElement);
- if (sourceElement.expression.type !== Syntax.Literal) {
- // this is not directive
- break;
- }
- directive = source.slice(token.range[0] + 1, token.range[1] - 1);
- if (directive === 'use strict') {
- strict = true;
- if (firstRestricted) {
- throwErrorTolerant(firstRestricted, Messages.StrictOctalLiteral);
- }
- } else {
- if (!firstRestricted && token.octal) {
- firstRestricted = token;
- }
- }
- }
-
- while (index < length) {
- sourceElement = parseProgramElement();
- if (typeof sourceElement === 'undefined') {
- break;
- }
- sourceElements.push(sourceElement);
- }
- return sourceElements;
- }
-
- function parseProgram() {
- var body, marker = markerCreate();
- strict = extra.sourceType === 'module';
- peek();
- body = parseProgramElements();
- return markerApply(marker, delegate.createProgram(body));
- }
-
- // 16 JSX
-
- XHTMLEntities = {
- quot: '\u0022',
- amp: '&',
- apos: '\u0027',
- lt: '<',
- gt: '>',
- nbsp: '\u00A0',
- iexcl: '\u00A1',
- cent: '\u00A2',
- pound: '\u00A3',
- curren: '\u00A4',
- yen: '\u00A5',
- brvbar: '\u00A6',
- sect: '\u00A7',
- uml: '\u00A8',
- copy: '\u00A9',
- ordf: '\u00AA',
- laquo: '\u00AB',
- not: '\u00AC',
- shy: '\u00AD',
- reg: '\u00AE',
- macr: '\u00AF',
- deg: '\u00B0',
- plusmn: '\u00B1',
- sup2: '\u00B2',
- sup3: '\u00B3',
- acute: '\u00B4',
- micro: '\u00B5',
- para: '\u00B6',
- middot: '\u00B7',
- cedil: '\u00B8',
- sup1: '\u00B9',
- ordm: '\u00BA',
- raquo: '\u00BB',
- frac14: '\u00BC',
- frac12: '\u00BD',
- frac34: '\u00BE',
- iquest: '\u00BF',
- Agrave: '\u00C0',
- Aacute: '\u00C1',
- Acirc: '\u00C2',
- Atilde: '\u00C3',
- Auml: '\u00C4',
- Aring: '\u00C5',
- AElig: '\u00C6',
- Ccedil: '\u00C7',
- Egrave: '\u00C8',
- Eacute: '\u00C9',
- Ecirc: '\u00CA',
- Euml: '\u00CB',
- Igrave: '\u00CC',
- Iacute: '\u00CD',
- Icirc: '\u00CE',
- Iuml: '\u00CF',
- ETH: '\u00D0',
- Ntilde: '\u00D1',
- Ograve: '\u00D2',
- Oacute: '\u00D3',
- Ocirc: '\u00D4',
- Otilde: '\u00D5',
- Ouml: '\u00D6',
- times: '\u00D7',
- Oslash: '\u00D8',
- Ugrave: '\u00D9',
- Uacute: '\u00DA',
- Ucirc: '\u00DB',
- Uuml: '\u00DC',
- Yacute: '\u00DD',
- THORN: '\u00DE',
- szlig: '\u00DF',
- agrave: '\u00E0',
- aacute: '\u00E1',
- acirc: '\u00E2',
- atilde: '\u00E3',
- auml: '\u00E4',
- aring: '\u00E5',
- aelig: '\u00E6',
- ccedil: '\u00E7',
- egrave: '\u00E8',
- eacute: '\u00E9',
- ecirc: '\u00EA',
- euml: '\u00EB',
- igrave: '\u00EC',
- iacute: '\u00ED',
- icirc: '\u00EE',
- iuml: '\u00EF',
- eth: '\u00F0',
- ntilde: '\u00F1',
- ograve: '\u00F2',
- oacute: '\u00F3',
- ocirc: '\u00F4',
- otilde: '\u00F5',
- ouml: '\u00F6',
- divide: '\u00F7',
- oslash: '\u00F8',
- ugrave: '\u00F9',
- uacute: '\u00FA',
- ucirc: '\u00FB',
- uuml: '\u00FC',
- yacute: '\u00FD',
- thorn: '\u00FE',
- yuml: '\u00FF',
- OElig: '\u0152',
- oelig: '\u0153',
- Scaron: '\u0160',
- scaron: '\u0161',
- Yuml: '\u0178',
- fnof: '\u0192',
- circ: '\u02C6',
- tilde: '\u02DC',
- Alpha: '\u0391',
- Beta: '\u0392',
- Gamma: '\u0393',
- Delta: '\u0394',
- Epsilon: '\u0395',
- Zeta: '\u0396',
- Eta: '\u0397',
- Theta: '\u0398',
- Iota: '\u0399',
- Kappa: '\u039A',
- Lambda: '\u039B',
- Mu: '\u039C',
- Nu: '\u039D',
- Xi: '\u039E',
- Omicron: '\u039F',
- Pi: '\u03A0',
- Rho: '\u03A1',
- Sigma: '\u03A3',
- Tau: '\u03A4',
- Upsilon: '\u03A5',
- Phi: '\u03A6',
- Chi: '\u03A7',
- Psi: '\u03A8',
- Omega: '\u03A9',
- alpha: '\u03B1',
- beta: '\u03B2',
- gamma: '\u03B3',
- delta: '\u03B4',
- epsilon: '\u03B5',
- zeta: '\u03B6',
- eta: '\u03B7',
- theta: '\u03B8',
- iota: '\u03B9',
- kappa: '\u03BA',
- lambda: '\u03BB',
- mu: '\u03BC',
- nu: '\u03BD',
- xi: '\u03BE',
- omicron: '\u03BF',
- pi: '\u03C0',
- rho: '\u03C1',
- sigmaf: '\u03C2',
- sigma: '\u03C3',
- tau: '\u03C4',
- upsilon: '\u03C5',
- phi: '\u03C6',
- chi: '\u03C7',
- psi: '\u03C8',
- omega: '\u03C9',
- thetasym: '\u03D1',
- upsih: '\u03D2',
- piv: '\u03D6',
- ensp: '\u2002',
- emsp: '\u2003',
- thinsp: '\u2009',
- zwnj: '\u200C',
- zwj: '\u200D',
- lrm: '\u200E',
- rlm: '\u200F',
- ndash: '\u2013',
- mdash: '\u2014',
- lsquo: '\u2018',
- rsquo: '\u2019',
- sbquo: '\u201A',
- ldquo: '\u201C',
- rdquo: '\u201D',
- bdquo: '\u201E',
- dagger: '\u2020',
- Dagger: '\u2021',
- bull: '\u2022',
- hellip: '\u2026',
- permil: '\u2030',
- prime: '\u2032',
- Prime: '\u2033',
- lsaquo: '\u2039',
- rsaquo: '\u203A',
- oline: '\u203E',
- frasl: '\u2044',
- euro: '\u20AC',
- image: '\u2111',
- weierp: '\u2118',
- real: '\u211C',
- trade: '\u2122',
- alefsym: '\u2135',
- larr: '\u2190',
- uarr: '\u2191',
- rarr: '\u2192',
- darr: '\u2193',
- harr: '\u2194',
- crarr: '\u21B5',
- lArr: '\u21D0',
- uArr: '\u21D1',
- rArr: '\u21D2',
- dArr: '\u21D3',
- hArr: '\u21D4',
- forall: '\u2200',
- part: '\u2202',
- exist: '\u2203',
- empty: '\u2205',
- nabla: '\u2207',
- isin: '\u2208',
- notin: '\u2209',
- ni: '\u220B',
- prod: '\u220F',
- sum: '\u2211',
- minus: '\u2212',
- lowast: '\u2217',
- radic: '\u221A',
- prop: '\u221D',
- infin: '\u221E',
- ang: '\u2220',
- and: '\u2227',
- or: '\u2228',
- cap: '\u2229',
- cup: '\u222A',
- 'int': '\u222B',
- there4: '\u2234',
- sim: '\u223C',
- cong: '\u2245',
- asymp: '\u2248',
- ne: '\u2260',
- equiv: '\u2261',
- le: '\u2264',
- ge: '\u2265',
- sub: '\u2282',
- sup: '\u2283',
- nsub: '\u2284',
- sube: '\u2286',
- supe: '\u2287',
- oplus: '\u2295',
- otimes: '\u2297',
- perp: '\u22A5',
- sdot: '\u22C5',
- lceil: '\u2308',
- rceil: '\u2309',
- lfloor: '\u230A',
- rfloor: '\u230B',
- lang: '\u2329',
- rang: '\u232A',
- loz: '\u25CA',
- spades: '\u2660',
- clubs: '\u2663',
- hearts: '\u2665',
- diams: '\u2666'
- };
-
- function getQualifiedJSXName(object) {
- if (object.type === Syntax.JSXIdentifier) {
- return object.name;
- }
- if (object.type === Syntax.JSXNamespacedName) {
- return object.namespace.name + ':' + object.name.name;
- }
- /* istanbul ignore else */
- if (object.type === Syntax.JSXMemberExpression) {
- return (
- getQualifiedJSXName(object.object) + '.' +
- getQualifiedJSXName(object.property)
- );
- }
- /* istanbul ignore next */
- throwUnexpected(object);
- }
-
- function isJSXIdentifierStart(ch) {
- // exclude backslash (\)
- return (ch !== 92) && isIdentifierStart(ch);
- }
-
- function isJSXIdentifierPart(ch) {
- // exclude backslash (\) and add hyphen (-)
- return (ch !== 92) && (ch === 45 || isIdentifierPart(ch));
- }
-
- function scanJSXIdentifier() {
- var ch, start, value = '';
-
- start = index;
- while (index < length) {
- ch = source.charCodeAt(index);
- if (!isJSXIdentifierPart(ch)) {
- break;
- }
- value += source[index++];
- }
-
- return {
- type: Token.JSXIdentifier,
- value: value,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- function scanJSXEntity() {
- var ch, str = '', start = index, count = 0, code;
- ch = source[index];
- assert(ch === '&', 'Entity must start with an ampersand');
- index++;
- while (index < length && count++ < 10) {
- ch = source[index++];
- if (ch === ';') {
- break;
- }
- str += ch;
- }
-
- // Well-formed entity (ending was found).
- if (ch === ';') {
- // Numeric entity.
- if (str[0] === '#') {
- if (str[1] === 'x') {
- code = +('0' + str.substr(1));
- } else {
- // Removing leading zeros in order to avoid treating as octal in old browsers.
- code = +str.substr(1).replace(Regex.LeadingZeros, '');
- }
-
- if (!isNaN(code)) {
- return String.fromCharCode(code);
- }
- /* istanbul ignore else */
- } else if (XHTMLEntities[str]) {
- return XHTMLEntities[str];
- }
- }
-
- // Treat non-entity sequences as regular text.
- index = start + 1;
- return '&';
- }
-
- function scanJSXText(stopChars) {
- var ch, str = '', start;
- start = index;
- while (index < length) {
- ch = source[index];
- if (stopChars.indexOf(ch) !== -1) {
- break;
- }
- if (ch === '&') {
- str += scanJSXEntity();
- } else {
- index++;
- if (ch === '\r' && source[index] === '\n') {
- str += ch;
- ch = source[index];
- index++;
- }
- if (isLineTerminator(ch.charCodeAt(0))) {
- ++lineNumber;
- lineStart = index;
- }
- str += ch;
- }
- }
- return {
- type: Token.JSXText,
- value: str,
- lineNumber: lineNumber,
- lineStart: lineStart,
- range: [start, index]
- };
- }
-
- function scanJSXStringLiteral() {
- var innerToken, quote, start;
-
- quote = source[index];
- assert((quote === '\'' || quote === '"'),
- 'String literal must starts with a quote');
-
- start = index;
- ++index;
-
- innerToken = scanJSXText([quote]);
-
- if (quote !== source[index]) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- ++index;
-
- innerToken.range = [start, index];
-
- return innerToken;
- }
-
- /**
- * Between JSX opening and closing tags (e.g. <foo>HERE</foo>), anything that
- * is not another JSX tag and is not an expression wrapped by {} is text.
- */
- function advanceJSXChild() {
- var ch = source.charCodeAt(index);
-
- // '<' 60, '>' 62, '{' 123, '}' 125
- if (ch !== 60 && ch !== 62 && ch !== 123 && ch !== 125) {
- return scanJSXText(['<', '>', '{', '}']);
- }
-
- return scanPunctuator();
- }
-
- function parseJSXIdentifier() {
- var token, marker = markerCreate();
-
- if (lookahead.type !== Token.JSXIdentifier) {
- throwUnexpected(lookahead);
- }
-
- token = lex();
- return markerApply(marker, delegate.createJSXIdentifier(token.value));
- }
-
- function parseJSXNamespacedName() {
- var namespace, name, marker = markerCreate();
-
- namespace = parseJSXIdentifier();
- expect(':');
- name = parseJSXIdentifier();
-
- return markerApply(marker, delegate.createJSXNamespacedName(namespace, name));
- }
-
- function parseJSXMemberExpression() {
- var marker = markerCreate(),
- expr = parseJSXIdentifier();
-
- while (match('.')) {
- lex();
- expr = markerApply(marker, delegate.createJSXMemberExpression(expr, parseJSXIdentifier()));
- }
-
- return expr;
- }
-
- function parseJSXElementName() {
- if (lookahead2().value === ':') {
- return parseJSXNamespacedName();
- }
- if (lookahead2().value === '.') {
- return parseJSXMemberExpression();
- }
-
- return parseJSXIdentifier();
- }
-
- function parseJSXAttributeName() {
- if (lookahead2().value === ':') {
- return parseJSXNamespacedName();
- }
-
- return parseJSXIdentifier();
- }
-
- function parseJSXAttributeValue() {
- var value, marker;
- if (match('{')) {
- value = parseJSXExpressionContainer();
- if (value.expression.type === Syntax.JSXEmptyExpression) {
- throwError(
- value,
- 'JSX attributes must only be assigned a non-empty ' +
- 'expression'
- );
- }
- } else if (match('<')) {
- value = parseJSXElement();
- } else if (lookahead.type === Token.JSXText) {
- marker = markerCreate();
- value = markerApply(marker, delegate.createLiteral(lex()));
- } else {
- throwError({}, Messages.InvalidJSXAttributeValue);
- }
- return value;
- }
-
- function parseJSXEmptyExpression() {
- var marker = markerCreatePreserveWhitespace();
- while (source.charAt(index) !== '}') {
- index++;
- }
- return markerApply(marker, delegate.createJSXEmptyExpression());
- }
-
- function parseJSXExpressionContainer() {
- var expression, origInJSXChild, origInJSXTag, marker = markerCreate();
-
- origInJSXChild = state.inJSXChild;
- origInJSXTag = state.inJSXTag;
- state.inJSXChild = false;
- state.inJSXTag = false;
-
- expect('{');
-
- if (match('}')) {
- expression = parseJSXEmptyExpression();
- } else {
- expression = parseExpression();
- }
-
- state.inJSXChild = origInJSXChild;
- state.inJSXTag = origInJSXTag;
-
- expect('}');
-
- return markerApply(marker, delegate.createJSXExpressionContainer(expression));
- }
-
- function parseJSXSpreadAttribute() {
- var expression, origInJSXChild, origInJSXTag, marker = markerCreate();
-
- origInJSXChild = state.inJSXChild;
- origInJSXTag = state.inJSXTag;
- state.inJSXChild = false;
- state.inJSXTag = false;
-
- expect('{');
- expect('...');
-
- expression = parseAssignmentExpression();
-
- state.inJSXChild = origInJSXChild;
- state.inJSXTag = origInJSXTag;
-
- expect('}');
-
- return markerApply(marker, delegate.createJSXSpreadAttribute(expression));
- }
-
- function parseJSXAttribute() {
- var name, marker;
-
- if (match('{')) {
- return parseJSXSpreadAttribute();
- }
-
- marker = markerCreate();
-
- name = parseJSXAttributeName();
-
- // HTML empty attribute
- if (match('=')) {
- lex();
- return markerApply(marker, delegate.createJSXAttribute(name, parseJSXAttributeValue()));
- }
-
- return markerApply(marker, delegate.createJSXAttribute(name));
- }
-
- function parseJSXChild() {
- var token, marker;
- if (match('{')) {
- token = parseJSXExpressionContainer();
- } else if (lookahead.type === Token.JSXText) {
- marker = markerCreatePreserveWhitespace();
- token = markerApply(marker, delegate.createLiteral(lex()));
- } else if (match('<')) {
- token = parseJSXElement();
- } else {
- throwUnexpected(lookahead);
- }
- return token;
- }
-
- function parseJSXClosingElement() {
- var name, origInJSXChild, origInJSXTag, marker = markerCreate();
- origInJSXChild = state.inJSXChild;
- origInJSXTag = state.inJSXTag;
- state.inJSXChild = false;
- state.inJSXTag = true;
- expect('<');
- expect('/');
- name = parseJSXElementName();
- // Because advance() (called by lex() called by expect()) expects there
- // to be a valid token after >, it needs to know whether to look for a
- // standard JS token or an JSX text node
- state.inJSXChild = origInJSXChild;
- state.inJSXTag = origInJSXTag;
- expect('>');
- return markerApply(marker, delegate.createJSXClosingElement(name));
- }
-
- function parseJSXOpeningElement() {
- var name, attributes = [], selfClosing = false, origInJSXChild, origInJSXTag, marker = markerCreate();
-
- origInJSXChild = state.inJSXChild;
- origInJSXTag = state.inJSXTag;
- state.inJSXChild = false;
- state.inJSXTag = true;
-
- expect('<');
-
- name = parseJSXElementName();
-
- while (index < length &&
- lookahead.value !== '/' &&
- lookahead.value !== '>') {
- attributes.push(parseJSXAttribute());
- }
-
- state.inJSXTag = origInJSXTag;
-
- if (lookahead.value === '/') {
- expect('/');
- // Because advance() (called by lex() called by expect()) expects
- // there to be a valid token after >, it needs to know whether to
- // look for a standard JS token or an JSX text node
- state.inJSXChild = origInJSXChild;
- expect('>');
- selfClosing = true;
- } else {
- state.inJSXChild = true;
- expect('>');
- }
- return markerApply(marker, delegate.createJSXOpeningElement(name, attributes, selfClosing));
- }
-
- function parseJSXElement() {
- var openingElement, closingElement = null, children = [], origInJSXChild, origInJSXTag, marker = markerCreate();
-
- origInJSXChild = state.inJSXChild;
- origInJSXTag = state.inJSXTag;
- openingElement = parseJSXOpeningElement();
-
- if (!openingElement.selfClosing) {
- while (index < length) {
- state.inJSXChild = false; // Call lookahead2() with inJSXChild = false because </ should not be considered in the child
- if (lookahead.value === '<' && lookahead2().value === '/') {
- break;
- }
- state.inJSXChild = true;
- children.push(parseJSXChild());
- }
- state.inJSXChild = origInJSXChild;
- state.inJSXTag = origInJSXTag;
- closingElement = parseJSXClosingElement();
- if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
- throwError({}, Messages.ExpectedJSXClosingTag, getQualifiedJSXName(openingElement.name));
- }
- }
-
- // When (erroneously) writing two adjacent tags like
- //
- // var x = <div>one</div><div>two</div>;
- //
- // the default error message is a bit incomprehensible. Since it's
- // rarely (never?) useful to write a less-than sign after an JSX
- // element, we disallow it here in the parser in order to provide a
- // better error message. (In the rare case that the less-than operator
- // was intended, the left tag can be wrapped in parentheses.)
- if (!origInJSXChild && match('<')) {
- throwError(lookahead, Messages.AdjacentJSXElements);
- }
-
- return markerApply(marker, delegate.createJSXElement(openingElement, closingElement, children));
- }
-
- function parseTypeAlias() {
- var id, marker = markerCreate(), typeParameters = null, right;
- expectContextualKeyword('type');
- id = parseVariableIdentifier();
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
- expect('=');
- right = parseType();
- consumeSemicolon();
- return markerApply(marker, delegate.createTypeAlias(id, typeParameters, right));
- }
-
- function parseInterfaceExtends() {
- var marker = markerCreate(), id, typeParameters = null;
-
- id = parseVariableIdentifier();
- if (match('<')) {
- typeParameters = parseTypeParameterInstantiation();
- }
-
- return markerApply(marker, delegate.createInterfaceExtends(
- id,
- typeParameters
- ));
- }
-
- function parseInterfaceish(marker, allowStatic) {
- var body, bodyMarker, extended = [], id,
- typeParameters = null;
-
- id = parseVariableIdentifier();
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
-
- if (matchKeyword('extends')) {
- expectKeyword('extends');
-
- while (index < length) {
- extended.push(parseInterfaceExtends());
- if (!match(',')) {
- break;
- }
- expect(',');
- }
- }
-
- bodyMarker = markerCreate();
- body = markerApply(bodyMarker, parseObjectType(allowStatic));
-
- return markerApply(marker, delegate.createInterface(
- id,
- typeParameters,
- body,
- extended
- ));
- }
-
- function parseInterface() {
- var marker = markerCreate();
-
- if (strict) {
- expectKeyword('interface');
- } else {
- expectContextualKeyword('interface');
- }
-
- return parseInterfaceish(marker, /* allowStatic */false);
- }
-
- function parseDeclareClass() {
- var marker = markerCreate(), ret;
- expectContextualKeyword('declare');
- expectKeyword('class');
-
- ret = parseInterfaceish(marker, /* allowStatic */true);
- ret.type = Syntax.DeclareClass;
- return ret;
- }
-
- function parseDeclareFunction() {
- var id, idMarker,
- marker = markerCreate(), params, returnType, rest, tmp,
- typeParameters = null, value, valueMarker;
-
- expectContextualKeyword('declare');
- expectKeyword('function');
- idMarker = markerCreate();
- id = parseVariableIdentifier();
-
- valueMarker = markerCreate();
- if (match('<')) {
- typeParameters = parseTypeParameterDeclaration();
- }
- expect('(');
- tmp = parseFunctionTypeParams();
- params = tmp.params;
- rest = tmp.rest;
- expect(')');
-
- expect(':');
- returnType = parseType();
-
- value = markerApply(valueMarker, delegate.createFunctionTypeAnnotation(
- params,
- returnType,
- rest,
- typeParameters
- ));
-
- id.typeAnnotation = markerApply(valueMarker, delegate.createTypeAnnotation(
- value
- ));
- markerApply(idMarker, id);
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createDeclareFunction(
- id
- ));
- }
-
- function parseDeclareVariable() {
- var id, marker = markerCreate();
- expectContextualKeyword('declare');
- expectKeyword('var');
- id = parseTypeAnnotatableIdentifier();
-
- consumeSemicolon();
-
- return markerApply(marker, delegate.createDeclareVariable(
- id
- ));
- }
-
- function parseDeclareModule() {
- var body = [], bodyMarker, id, idMarker, marker = markerCreate(), token;
- expectContextualKeyword('declare');
- expectContextualKeyword('module');
-
- if (lookahead.type === Token.StringLiteral) {
- if (strict && lookahead.octal) {
- throwErrorTolerant(lookahead, Messages.StrictOctalLiteral);
- }
- idMarker = markerCreate();
- id = markerApply(idMarker, delegate.createLiteral(lex()));
- } else {
- id = parseVariableIdentifier();
- }
-
- bodyMarker = markerCreate();
- expect('{');
- while (index < length && !match('}')) {
- token = lookahead2();
- switch (token.value) {
- case 'class':
- body.push(parseDeclareClass());
- break;
- case 'function':
- body.push(parseDeclareFunction());
- break;
- case 'var':
- body.push(parseDeclareVariable());
- break;
- default:
- throwUnexpected(lookahead);
- }
- }
- expect('}');
-
- return markerApply(marker, delegate.createDeclareModule(
- id,
- markerApply(bodyMarker, delegate.createBlockStatement(body))
- ));
- }
-
- function collectToken() {
- var loc, token, range, value, entry;
-
- /* istanbul ignore else */
- if (!state.inJSXChild) {
- skipComment();
- }
-
- loc = {
- start: {
- line: lineNumber,
- column: index - lineStart
- }
- };
-
- token = extra.advance();
- loc.end = {
- line: lineNumber,
- column: index - lineStart
- };
-
- if (token.type !== Token.EOF) {
- range = [token.range[0], token.range[1]];
- value = source.slice(token.range[0], token.range[1]);
- entry = {
- type: TokenName[token.type],
- value: value,
- range: range,
- loc: loc
- };
- if (token.regex) {
- entry.regex = {
- pattern: token.regex.pattern,
- flags: token.regex.flags
- };
- }
- extra.tokens.push(entry);
- }
-
- return token;
- }
-
- function collectRegex() {
- var pos, loc, regex, token;
-
- skipComment();
-
- pos = index;
- loc = {
- start: {
- line: lineNumber,
- column: index - lineStart
- }
- };
-
- regex = extra.scanRegExp();
- loc.end = {
- line: lineNumber,
- column: index - lineStart
- };
-
- if (!extra.tokenize) {
- /* istanbul ignore next */
- // Pop the previous token, which is likely '/' or '/='
- if (extra.tokens.length > 0) {
- token = extra.tokens[extra.tokens.length - 1];
- if (token.range[0] === pos && token.type === 'Punctuator') {
- if (token.value === '/' || token.value === '/=') {
- extra.tokens.pop();
- }
- }
- }
-
- extra.tokens.push({
- type: 'RegularExpression',
- value: regex.literal,
- regex: regex.regex,
- range: [pos, index],
- loc: loc
- });
- }
-
- return regex;
- }
-
- function filterTokenLocation() {
- var i, entry, token, tokens = [];
-
- for (i = 0; i < extra.tokens.length; ++i) {
- entry = extra.tokens[i];
- token = {
- type: entry.type,
- value: entry.value
- };
- if (entry.regex) {
- token.regex = {
- pattern: entry.regex.pattern,
- flags: entry.regex.flags
- };
- }
- if (extra.range) {
- token.range = entry.range;
- }
- if (extra.loc) {
- token.loc = entry.loc;
- }
- tokens.push(token);
- }
-
- extra.tokens = tokens;
- }
-
- function patch() {
- if (typeof extra.tokens !== 'undefined') {
- extra.advance = advance;
- extra.scanRegExp = scanRegExp;
-
- advance = collectToken;
- scanRegExp = collectRegex;
- }
- }
-
- function unpatch() {
- if (typeof extra.scanRegExp === 'function') {
- advance = extra.advance;
- scanRegExp = extra.scanRegExp;
- }
- }
-
- // This is used to modify the delegate.
-
- function extend(object, properties) {
- var entry, result = {};
-
- for (entry in object) {
- /* istanbul ignore else */
- if (object.hasOwnProperty(entry)) {
- result[entry] = object[entry];
- }
- }
-
- for (entry in properties) {
- /* istanbul ignore else */
- if (properties.hasOwnProperty(entry)) {
- result[entry] = properties[entry];
- }
- }
-
- return result;
- }
-
- function tokenize(code, options) {
- var toString,
- token,
- tokens;
-
- toString = String;
- if (typeof code !== 'string' && !(code instanceof String)) {
- code = toString(code);
- }
-
- delegate = SyntaxTreeDelegate;
- source = code;
- index = 0;
- lineNumber = (source.length > 0) ? 1 : 0;
- lineStart = 0;
- length = source.length;
- lookahead = null;
- state = {
- allowKeyword: true,
- allowIn: true,
- labelSet: new StringMap(),
- inFunctionBody: false,
- inIteration: false,
- inSwitch: false,
- lastCommentStart: -1
- };
-
- extra = {};
-
- // Options matching.
- options = options || {};
-
- // Of course we collect tokens here.
- options.tokens = true;
- extra.tokens = [];
- extra.tokenize = true;
- // The following two fields are necessary to compute the Regex tokens.
- extra.openParenToken = -1;
- extra.openCurlyToken = -1;
-
- extra.range = (typeof options.range === 'boolean') && options.range;
- extra.loc = (typeof options.loc === 'boolean') && options.loc;
-
- if (typeof options.comment === 'boolean' && options.comment) {
- extra.comments = [];
- }
- if (typeof options.tolerant === 'boolean' && options.tolerant) {
- extra.errors = [];
- }
-
- patch();
-
- try {
- peek();
- if (lookahead.type === Token.EOF) {
- return extra.tokens;
- }
-
- token = lex();
- while (lookahead.type !== Token.EOF) {
- try {
- token = lex();
- } catch (lexError) {
- token = lookahead;
- if (extra.errors) {
- extra.errors.push(lexError);
- // We have to break on the first error
- // to avoid infinite loops.
- break;
- } else {
- throw lexError;
- }
- }
- }
-
- filterTokenLocation();
- tokens = extra.tokens;
- if (typeof extra.comments !== 'undefined') {
- tokens.comments = extra.comments;
- }
- if (typeof extra.errors !== 'undefined') {
- tokens.errors = extra.errors;
- }
- } catch (e) {
- throw e;
- } finally {
- unpatch();
- extra = {};
- }
- return tokens;
- }
-
- function parse(code, options) {
- var program, toString;
-
- toString = String;
- if (typeof code !== 'string' && !(code instanceof String)) {
- code = toString(code);
- }
-
- delegate = SyntaxTreeDelegate;
- source = code;
- index = 0;
- lineNumber = (source.length > 0) ? 1 : 0;
- lineStart = 0;
- length = source.length;
- lookahead = null;
- state = {
- allowKeyword: false,
- allowIn: true,
- labelSet: new StringMap(),
- parenthesizedCount: 0,
- inFunctionBody: false,
- inIteration: false,
- inSwitch: false,
- inJSXChild: false,
- inJSXTag: false,
- inType: false,
- lastCommentStart: -1,
- yieldAllowed: false,
- awaitAllowed: false
- };
-
- extra = {};
- if (typeof options !== 'undefined') {
- extra.range = (typeof options.range === 'boolean') && options.range;
- extra.loc = (typeof options.loc === 'boolean') && options.loc;
- extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment;
-
- if (extra.loc && options.source !== null && options.source !== undefined) {
- delegate = extend(delegate, {
- 'postProcess': function (node) {
- node.loc.source = toString(options.source);
- return node;
- }
- });
- }
-
- extra.sourceType = options.sourceType;
- if (typeof options.tokens === 'boolean' && options.tokens) {
- extra.tokens = [];
- }
- if (typeof options.comment === 'boolean' && options.comment) {
- extra.comments = [];
- }
- if (typeof options.tolerant === 'boolean' && options.tolerant) {
- extra.errors = [];
- }
- if (extra.attachComment) {
- extra.range = true;
- extra.comments = [];
- extra.bottomRightStack = [];
- extra.trailingComments = [];
- extra.leadingComments = [];
- }
- }
-
- patch();
- try {
- program = parseProgram();
- if (typeof extra.comments !== 'undefined') {
- program.comments = extra.comments;
- }
- if (typeof extra.tokens !== 'undefined') {
- filterTokenLocation();
- program.tokens = extra.tokens;
- }
- if (typeof extra.errors !== 'undefined') {
- program.errors = extra.errors;
- }
- } catch (e) {
- throw e;
- } finally {
- unpatch();
- extra = {};
- }
-
- return program;
- }
-
- // Sync with *.json manifests.
- exports.version = '13001.1001.0-dev-harmony-fb';
-
- exports.tokenize = tokenize;
-
- exports.parse = parse;
-
- // Deep copy.
- /* istanbul ignore next */
- exports.Syntax = (function () {
- var name, types = {};
-
- if (typeof Object.create === 'function') {
- types = Object.create(null);
- }
-
- for (name in Syntax) {
- if (Syntax.hasOwnProperty(name)) {
- types[name] = Syntax[name];
- }
- }
-
- if (typeof Object.freeze === 'function') {
- Object.freeze(types);
- }
-
- return types;
- }());
-
-}));
-/* vim: set sw=4 ts=4 et tw=80 : */
-
-},{}],10:[function(_dereq_,module,exports){
-var Base62 = (function (my) {
- my.chars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
-
- my.encode = function(i){
- if (i === 0) {return '0'}
- var s = ''
- while (i > 0) {
- s = this.chars[i % 62] + s
- i = Math.floor(i/62)
- }
- return s
- };
- my.decode = function(a,b,c,d){
- for (
- b = c = (
- a === (/\W|_|^$/.test(a += "") || a)
- ) - 1;
- d = a.charCodeAt(c++);
- )
- b = b * 62 + d - [, 48, 29, 87][d >> 5];
- return b
- };
-
- return my;
-}({}));
-
-module.exports = Base62
-},{}],11:[function(_dereq_,module,exports){
-/*
- * Copyright 2009-2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE.txt or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-exports.SourceMapGenerator = _dereq_('./source-map/source-map-generator').SourceMapGenerator;
-exports.SourceMapConsumer = _dereq_('./source-map/source-map-consumer').SourceMapConsumer;
-exports.SourceNode = _dereq_('./source-map/source-node').SourceNode;
-
-},{"./source-map/source-map-consumer":16,"./source-map/source-map-generator":17,"./source-map/source-node":18}],12:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- var util = _dereq_('./util');
-
- /**
- * A data structure which is a combination of an array and a set. Adding a new
- * member is O(1), testing for membership is O(1), and finding the index of an
- * element is O(1). Removing elements from the set is not supported. Only
- * strings are supported for membership.
- */
- function ArraySet() {
- this._array = [];
- this._set = {};
- }
-
- /**
- * Static method for creating ArraySet instances from an existing array.
- */
- ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
- var set = new ArraySet();
- for (var i = 0, len = aArray.length; i < len; i++) {
- set.add(aArray[i], aAllowDuplicates);
- }
- return set;
- };
-
- /**
- * Add the given string to this set.
- *
- * @param String aStr
- */
- ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
- var isDuplicate = this.has(aStr);
- var idx = this._array.length;
- if (!isDuplicate || aAllowDuplicates) {
- this._array.push(aStr);
- }
- if (!isDuplicate) {
- this._set[util.toSetString(aStr)] = idx;
- }
- };
-
- /**
- * Is the given string a member of this set?
- *
- * @param String aStr
- */
- ArraySet.prototype.has = function ArraySet_has(aStr) {
- return Object.prototype.hasOwnProperty.call(this._set,
- util.toSetString(aStr));
- };
-
- /**
- * What is the index of the given string in the array?
- *
- * @param String aStr
- */
- ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
- if (this.has(aStr)) {
- return this._set[util.toSetString(aStr)];
- }
- throw new Error('"' + aStr + '" is not in the set.');
- };
-
- /**
- * What is the element at the given index?
- *
- * @param Number aIdx
- */
- ArraySet.prototype.at = function ArraySet_at(aIdx) {
- if (aIdx >= 0 && aIdx < this._array.length) {
- return this._array[aIdx];
- }
- throw new Error('No element indexed by ' + aIdx);
- };
-
- /**
- * Returns the array representation of this set (which has the proper indices
- * indicated by indexOf). Note that this is a copy of the internal array used
- * for storing the members so that no one can mess with internal state.
- */
- ArraySet.prototype.toArray = function ArraySet_toArray() {
- return this._array.slice();
- };
-
- exports.ArraySet = ArraySet;
-
-});
-
-},{"./util":19,"amdefine":20}],13:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- *
- * Based on the Base 64 VLQ implementation in Closure Compiler:
- * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
- *
- * Copyright 2011 The Closure Compiler Authors. All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- var base64 = _dereq_('./base64');
-
- // A single base 64 digit can contain 6 bits of data. For the base 64 variable
- // length quantities we use in the source map spec, the first bit is the sign,
- // the next four bits are the actual value, and the 6th bit is the
- // continuation bit. The continuation bit tells us whether there are more
- // digits in this value following this digit.
- //
- // Continuation
- // | Sign
- // | |
- // V V
- // 101011
-
- var VLQ_BASE_SHIFT = 5;
-
- // binary: 100000
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
-
- // binary: 011111
- var VLQ_BASE_MASK = VLQ_BASE - 1;
-
- // binary: 100000
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
-
- /**
- * Converts from a two-complement value to a value where the sign bit is
- * is placed in the least significant bit. For example, as decimals:
- * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
- * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
- */
- function toVLQSigned(aValue) {
- return aValue < 0
- ? ((-aValue) << 1) + 1
- : (aValue << 1) + 0;
- }
-
- /**
- * Converts to a two-complement value from a value where the sign bit is
- * is placed in the least significant bit. For example, as decimals:
- * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
- * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
- */
- function fromVLQSigned(aValue) {
- var isNegative = (aValue & 1) === 1;
- var shifted = aValue >> 1;
- return isNegative
- ? -shifted
- : shifted;
- }
-
- /**
- * Returns the base 64 VLQ encoded value.
- */
- exports.encode = function base64VLQ_encode(aValue) {
- var encoded = "";
- var digit;
-
- var vlq = toVLQSigned(aValue);
-
- do {
- digit = vlq & VLQ_BASE_MASK;
- vlq >>>= VLQ_BASE_SHIFT;
- if (vlq > 0) {
- // There are still more digits in this value, so we must make sure the
- // continuation bit is marked.
- digit |= VLQ_CONTINUATION_BIT;
- }
- encoded += base64.encode(digit);
- } while (vlq > 0);
-
- return encoded;
- };
-
- /**
- * Decodes the next base 64 VLQ value from the given string and returns the
- * value and the rest of the string.
- */
- exports.decode = function base64VLQ_decode(aStr) {
- var i = 0;
- var strLen = aStr.length;
- var result = 0;
- var shift = 0;
- var continuation, digit;
-
- do {
- if (i >= strLen) {
- throw new Error("Expected more digits in base 64 VLQ value.");
- }
- digit = base64.decode(aStr.charAt(i++));
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
- digit &= VLQ_BASE_MASK;
- result = result + (digit << shift);
- shift += VLQ_BASE_SHIFT;
- } while (continuation);
-
- return {
- value: fromVLQSigned(result),
- rest: aStr.slice(i)
- };
- };
-
-});
-
-},{"./base64":14,"amdefine":20}],14:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- var charToIntMap = {};
- var intToCharMap = {};
-
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
- .split('')
- .forEach(function (ch, index) {
- charToIntMap[ch] = index;
- intToCharMap[index] = ch;
- });
-
- /**
- * Encode an integer in the range of 0 to 63 to a single base 64 digit.
- */
- exports.encode = function base64_encode(aNumber) {
- if (aNumber in intToCharMap) {
- return intToCharMap[aNumber];
- }
- throw new TypeError("Must be between 0 and 63: " + aNumber);
- };
-
- /**
- * Decode a single base 64 digit to an integer.
- */
- exports.decode = function base64_decode(aChar) {
- if (aChar in charToIntMap) {
- return charToIntMap[aChar];
- }
- throw new TypeError("Not a valid base 64 digit: " + aChar);
- };
-
-});
-
-},{"amdefine":20}],15:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- /**
- * Recursive implementation of binary search.
- *
- * @param aLow Indices here and lower do not contain the needle.
- * @param aHigh Indices here and higher do not contain the needle.
- * @param aNeedle The element being searched for.
- * @param aHaystack The non-empty array being searched.
- * @param aCompare Function which takes two elements and returns -1, 0, or 1.
- */
- function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare) {
- // This function terminates when one of the following is true:
- //
- // 1. We find the exact element we are looking for.
- //
- // 2. We did not find the exact element, but we can return the next
- // closest element that is less than that element.
- //
- // 3. We did not find the exact element, and there is no next-closest
- // element which is less than the one we are searching for, so we
- // return null.
- var mid = Math.floor((aHigh - aLow) / 2) + aLow;
- var cmp = aCompare(aNeedle, aHaystack[mid], true);
- if (cmp === 0) {
- // Found the element we are looking for.
- return aHaystack[mid];
- }
- else if (cmp > 0) {
- // aHaystack[mid] is greater than our needle.
- if (aHigh - mid > 1) {
- // The element is in the upper half.
- return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare);
- }
- // We did not find an exact match, return the next closest one
- // (termination case 2).
- return aHaystack[mid];
- }
- else {
- // aHaystack[mid] is less than our needle.
- if (mid - aLow > 1) {
- // The element is in the lower half.
- return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare);
- }
- // The exact needle element was not found in this haystack. Determine if
- // we are in termination case (2) or (3) and return the appropriate thing.
- return aLow < 0
- ? null
- : aHaystack[aLow];
- }
- }
-
- /**
- * This is an implementation of binary search which will always try and return
- * the next lowest value checked if there is no exact hit. This is because
- * mappings between original and generated line/col pairs are single points,
- * and there is an implicit region between each of them, so a miss just means
- * that you aren't on the very start of a region.
- *
- * @param aNeedle The element you are looking for.
- * @param aHaystack The array that is being searched.
- * @param aCompare A function which takes the needle and an element in the
- * array and returns -1, 0, or 1 depending on whether the needle is less
- * than, equal to, or greater than the element, respectively.
- */
- exports.search = function search(aNeedle, aHaystack, aCompare) {
- return aHaystack.length > 0
- ? recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare)
- : null;
- };
-
-});
-
-},{"amdefine":20}],16:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- var util = _dereq_('./util');
- var binarySearch = _dereq_('./binary-search');
- var ArraySet = _dereq_('./array-set').ArraySet;
- var base64VLQ = _dereq_('./base64-vlq');
-
- /**
- * A SourceMapConsumer instance represents a parsed source map which we can
- * query for information about the original file positions by giving it a file
- * position in the generated source.
- *
- * The only parameter is the raw source map (either as a JSON string, or
- * already parsed to an object). According to the spec, source maps have the
- * following attributes:
- *
- * - version: Which version of the source map spec this map is following.
- * - sources: An array of URLs to the original source files.
- * - names: An array of identifiers which can be referrenced by individual mappings.
- * - sourceRoot: Optional. The URL root from which all sources are relative.
- * - sourcesContent: Optional. An array of contents of the original source files.
- * - mappings: A string of base64 VLQs which contain the actual mappings.
- * - file: The generated file this source map is associated with.
- *
- * Here is an example source map, taken from the source map spec[0]:
- *
- * {
- * version : 3,
- * file: "out.js",
- * sourceRoot : "",
- * sources: ["foo.js", "bar.js"],
- * names: ["src", "maps", "are", "fun"],
- * mappings: "AA,AB;;ABCDE;"
- * }
- *
- * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
- */
- function SourceMapConsumer(aSourceMap) {
- var sourceMap = aSourceMap;
- if (typeof aSourceMap === 'string') {
- sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
- }
-
- var version = util.getArg(sourceMap, 'version');
- var sources = util.getArg(sourceMap, 'sources');
- // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
- // requires the array) to play nice here.
- var names = util.getArg(sourceMap, 'names', []);
- var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
- var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
- var mappings = util.getArg(sourceMap, 'mappings');
- var file = util.getArg(sourceMap, 'file', null);
-
- // Once again, Sass deviates from the spec and supplies the version as a
- // string rather than a number, so we use loose equality checking here.
- if (version != this._version) {
- throw new Error('Unsupported version: ' + version);
- }
-
- // Pass `true` below to allow duplicate names and sources. While source maps
- // are intended to be compressed and deduplicated, the TypeScript compiler
- // sometimes generates source maps with duplicates in them. See Github issue
- // #72 and bugzil.la/889492.
- this._names = ArraySet.fromArray(names, true);
- this._sources = ArraySet.fromArray(sources, true);
-
- this.sourceRoot = sourceRoot;
- this.sourcesContent = sourcesContent;
- this._mappings = mappings;
- this.file = file;
- }
-
- /**
- * Create a SourceMapConsumer from a SourceMapGenerator.
- *
- * @param SourceMapGenerator aSourceMap
- * The source map that will be consumed.
- * @returns SourceMapConsumer
- */
- SourceMapConsumer.fromSourceMap =
- function SourceMapConsumer_fromSourceMap(aSourceMap) {
- var smc = Object.create(SourceMapConsumer.prototype);
-
- smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
- smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
- smc.sourceRoot = aSourceMap._sourceRoot;
- smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
- smc.sourceRoot);
- smc.file = aSourceMap._file;
-
- smc.__generatedMappings = aSourceMap._mappings.slice()
- .sort(util.compareByGeneratedPositions);
- smc.__originalMappings = aSourceMap._mappings.slice()
- .sort(util.compareByOriginalPositions);
-
- return smc;
- };
-
- /**
- * The version of the source mapping spec that we are consuming.
- */
- SourceMapConsumer.prototype._version = 3;
-
- /**
- * The list of original sources.
- */
- Object.defineProperty(SourceMapConsumer.prototype, 'sources', {
- get: function () {
- return this._sources.toArray().map(function (s) {
- return this.sourceRoot ? util.join(this.sourceRoot, s) : s;
- }, this);
- }
- });
-
- // `__generatedMappings` and `__originalMappings` are arrays that hold the
- // parsed mapping coordinates from the source map's "mappings" attribute. They
- // are lazily instantiated, accessed via the `_generatedMappings` and
- // `_originalMappings` getters respectively, and we only parse the mappings
- // and create these arrays once queried for a source location. We jump through
- // these hoops because there can be many thousands of mappings, and parsing
- // them is expensive, so we only want to do it if we must.
- //
- // Each object in the arrays is of the form:
- //
- // {
- // generatedLine: The line number in the generated code,
- // generatedColumn: The column number in the generated code,
- // source: The path to the original source file that generated this
- // chunk of code,
- // originalLine: The line number in the original source that
- // corresponds to this chunk of generated code,
- // originalColumn: The column number in the original source that
- // corresponds to this chunk of generated code,
- // name: The name of the original symbol which generated this chunk of
- // code.
- // }
- //
- // All properties except for `generatedLine` and `generatedColumn` can be
- // `null`.
- //
- // `_generatedMappings` is ordered by the generated positions.
- //
- // `_originalMappings` is ordered by the original positions.
-
- SourceMapConsumer.prototype.__generatedMappings = null;
- Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
- get: function () {
- if (!this.__generatedMappings) {
- this.__generatedMappings = [];
- this.__originalMappings = [];
- this._parseMappings(this._mappings, this.sourceRoot);
- }
-
- return this.__generatedMappings;
- }
- });
-
- SourceMapConsumer.prototype.__originalMappings = null;
- Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
- get: function () {
- if (!this.__originalMappings) {
- this.__generatedMappings = [];
- this.__originalMappings = [];
- this._parseMappings(this._mappings, this.sourceRoot);
- }
-
- return this.__originalMappings;
- }
- });
-
- /**
- * Parse the mappings in a string in to a data structure which we can easily
- * query (the ordered arrays in the `this.__generatedMappings` and
- * `this.__originalMappings` properties).
- */
- SourceMapConsumer.prototype._parseMappings =
- function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
- var generatedLine = 1;
- var previousGeneratedColumn = 0;
- var previousOriginalLine = 0;
- var previousOriginalColumn = 0;
- var previousSource = 0;
- var previousName = 0;
- var mappingSeparator = /^[,;]/;
- var str = aStr;
- var mapping;
- var temp;
-
- while (str.length > 0) {
- if (str.charAt(0) === ';') {
- generatedLine++;
- str = str.slice(1);
- previousGeneratedColumn = 0;
- }
- else if (str.charAt(0) === ',') {
- str = str.slice(1);
- }
- else {
- mapping = {};
- mapping.generatedLine = generatedLine;
-
- // Generated column.
- temp = base64VLQ.decode(str);
- mapping.generatedColumn = previousGeneratedColumn + temp.value;
- previousGeneratedColumn = mapping.generatedColumn;
- str = temp.rest;
-
- if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
- // Original source.
- temp = base64VLQ.decode(str);
- mapping.source = this._sources.at(previousSource + temp.value);
- previousSource += temp.value;
- str = temp.rest;
- if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
- throw new Error('Found a source, but no line and column');
- }
-
- // Original line.
- temp = base64VLQ.decode(str);
- mapping.originalLine = previousOriginalLine + temp.value;
- previousOriginalLine = mapping.originalLine;
- // Lines are stored 0-based
- mapping.originalLine += 1;
- str = temp.rest;
- if (str.length === 0 || mappingSeparator.test(str.charAt(0))) {
- throw new Error('Found a source and line, but no column');
- }
-
- // Original column.
- temp = base64VLQ.decode(str);
- mapping.originalColumn = previousOriginalColumn + temp.value;
- previousOriginalColumn = mapping.originalColumn;
- str = temp.rest;
-
- if (str.length > 0 && !mappingSeparator.test(str.charAt(0))) {
- // Original name.
- temp = base64VLQ.decode(str);
- mapping.name = this._names.at(previousName + temp.value);
- previousName += temp.value;
- str = temp.rest;
- }
- }
-
- this.__generatedMappings.push(mapping);
- if (typeof mapping.originalLine === 'number') {
- this.__originalMappings.push(mapping);
- }
- }
- }
-
- this.__originalMappings.sort(util.compareByOriginalPositions);
- };
-
- /**
- * Find the mapping that best matches the hypothetical "needle" mapping that
- * we are searching for in the given "haystack" of mappings.
- */
- SourceMapConsumer.prototype._findMapping =
- function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
- aColumnName, aComparator) {
- // To return the position we are searching for, we must first find the
- // mapping for the given position and then return the opposite position it
- // points to. Because the mappings are sorted, we can use binary search to
- // find the best mapping.
-
- if (aNeedle[aLineName] <= 0) {
- throw new TypeError('Line must be greater than or equal to 1, got '
- + aNeedle[aLineName]);
- }
- if (aNeedle[aColumnName] < 0) {
- throw new TypeError('Column must be greater than or equal to 0, got '
- + aNeedle[aColumnName]);
- }
-
- return binarySearch.search(aNeedle, aMappings, aComparator);
- };
-
- /**
- * Returns the original source, line, and column information for the generated
- * source's line and column positions provided. The only argument is an object
- * with the following properties:
- *
- * - line: The line number in the generated source.
- * - column: The column number in the generated source.
- *
- * and an object is returned with the following properties:
- *
- * - source: The original source file, or null.
- * - line: The line number in the original source, or null.
- * - column: The column number in the original source, or null.
- * - name: The original identifier, or null.
- */
- SourceMapConsumer.prototype.originalPositionFor =
- function SourceMapConsumer_originalPositionFor(aArgs) {
- var needle = {
- generatedLine: util.getArg(aArgs, 'line'),
- generatedColumn: util.getArg(aArgs, 'column')
- };
-
- var mapping = this._findMapping(needle,
- this._generatedMappings,
- "generatedLine",
- "generatedColumn",
- util.compareByGeneratedPositions);
-
- if (mapping) {
- var source = util.getArg(mapping, 'source', null);
- if (source && this.sourceRoot) {
- source = util.join(this.sourceRoot, source);
- }
- return {
- source: source,
- line: util.getArg(mapping, 'originalLine', null),
- column: util.getArg(mapping, 'originalColumn', null),
- name: util.getArg(mapping, 'name', null)
- };
- }
-
- return {
- source: null,
- line: null,
- column: null,
- name: null
- };
- };
-
- /**
- * Returns the original source content. The only argument is the url of the
- * original source file. Returns null if no original source content is
- * availible.
- */
- SourceMapConsumer.prototype.sourceContentFor =
- function SourceMapConsumer_sourceContentFor(aSource) {
- if (!this.sourcesContent) {
- return null;
- }
-
- if (this.sourceRoot) {
- aSource = util.relative(this.sourceRoot, aSource);
- }
-
- if (this._sources.has(aSource)) {
- return this.sourcesContent[this._sources.indexOf(aSource)];
- }
-
- var url;
- if (this.sourceRoot
- && (url = util.urlParse(this.sourceRoot))) {
- // XXX: file:// URIs and absolute paths lead to unexpected behavior for
- // many users. We can help them out when they expect file:// URIs to
- // behave like it would if they were running a local HTTP server. See
- // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
- var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
- if (url.scheme == "file"
- && this._sources.has(fileUriAbsPath)) {
- return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
- }
-
- if ((!url.path || url.path == "/")
- && this._sources.has("/" + aSource)) {
- return this.sourcesContent[this._sources.indexOf("/" + aSource)];
- }
- }
-
- throw new Error('"' + aSource + '" is not in the SourceMap.');
- };
-
- /**
- * Returns the generated line and column information for the original source,
- * line, and column positions provided. The only argument is an object with
- * the following properties:
- *
- * - source: The filename of the original source.
- * - line: The line number in the original source.
- * - column: The column number in the original source.
- *
- * and an object is returned with the following properties:
- *
- * - line: The line number in the generated source, or null.
- * - column: The column number in the generated source, or null.
- */
- SourceMapConsumer.prototype.generatedPositionFor =
- function SourceMapConsumer_generatedPositionFor(aArgs) {
- var needle = {
- source: util.getArg(aArgs, 'source'),
- originalLine: util.getArg(aArgs, 'line'),
- originalColumn: util.getArg(aArgs, 'column')
- };
-
- if (this.sourceRoot) {
- needle.source = util.relative(this.sourceRoot, needle.source);
- }
-
- var mapping = this._findMapping(needle,
- this._originalMappings,
- "originalLine",
- "originalColumn",
- util.compareByOriginalPositions);
-
- if (mapping) {
- return {
- line: util.getArg(mapping, 'generatedLine', null),
- column: util.getArg(mapping, 'generatedColumn', null)
- };
- }
-
- return {
- line: null,
- column: null
- };
- };
-
- SourceMapConsumer.GENERATED_ORDER = 1;
- SourceMapConsumer.ORIGINAL_ORDER = 2;
-
- /**
- * Iterate over each mapping between an original source/line/column and a
- * generated line/column in this source map.
- *
- * @param Function aCallback
- * The function that is called with each mapping.
- * @param Object aContext
- * Optional. If specified, this object will be the value of `this` every
- * time that `aCallback` is called.
- * @param aOrder
- * Either `SourceMapConsumer.GENERATED_ORDER` or
- * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
- * iterate over the mappings sorted by the generated file's line/column
- * order or the original's source/line/column order, respectively. Defaults to
- * `SourceMapConsumer.GENERATED_ORDER`.
- */
- SourceMapConsumer.prototype.eachMapping =
- function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
- var context = aContext || null;
- var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
-
- var mappings;
- switch (order) {
- case SourceMapConsumer.GENERATED_ORDER:
- mappings = this._generatedMappings;
- break;
- case SourceMapConsumer.ORIGINAL_ORDER:
- mappings = this._originalMappings;
- break;
- default:
- throw new Error("Unknown order of iteration.");
- }
-
- var sourceRoot = this.sourceRoot;
- mappings.map(function (mapping) {
- var source = mapping.source;
- if (source && sourceRoot) {
- source = util.join(sourceRoot, source);
- }
- return {
- source: source,
- generatedLine: mapping.generatedLine,
- generatedColumn: mapping.generatedColumn,
- originalLine: mapping.originalLine,
- originalColumn: mapping.originalColumn,
- name: mapping.name
- };
- }).forEach(aCallback, context);
- };
-
- exports.SourceMapConsumer = SourceMapConsumer;
-
-});
-
-},{"./array-set":12,"./base64-vlq":13,"./binary-search":15,"./util":19,"amdefine":20}],17:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- var base64VLQ = _dereq_('./base64-vlq');
- var util = _dereq_('./util');
- var ArraySet = _dereq_('./array-set').ArraySet;
-
- /**
- * An instance of the SourceMapGenerator represents a source map which is
- * being built incrementally. To create a new one, you must pass an object
- * with the following properties:
- *
- * - file: The filename of the generated source.
- * - sourceRoot: An optional root for all URLs in this source map.
- */
- function SourceMapGenerator(aArgs) {
- this._file = util.getArg(aArgs, 'file');
- this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
- this._sources = new ArraySet();
- this._names = new ArraySet();
- this._mappings = [];
- this._sourcesContents = null;
- }
-
- SourceMapGenerator.prototype._version = 3;
-
- /**
- * Creates a new SourceMapGenerator based on a SourceMapConsumer
- *
- * @param aSourceMapConsumer The SourceMap.
- */
- SourceMapGenerator.fromSourceMap =
- function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
- var sourceRoot = aSourceMapConsumer.sourceRoot;
- var generator = new SourceMapGenerator({
- file: aSourceMapConsumer.file,
- sourceRoot: sourceRoot
- });
- aSourceMapConsumer.eachMapping(function (mapping) {
- var newMapping = {
- generated: {
- line: mapping.generatedLine,
- column: mapping.generatedColumn
- }
- };
-
- if (mapping.source) {
- newMapping.source = mapping.source;
- if (sourceRoot) {
- newMapping.source = util.relative(sourceRoot, newMapping.source);
- }
-
- newMapping.original = {
- line: mapping.originalLine,
- column: mapping.originalColumn
- };
-
- if (mapping.name) {
- newMapping.name = mapping.name;
- }
- }
-
- generator.addMapping(newMapping);
- });
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content) {
- generator.setSourceContent(sourceFile, content);
- }
- });
- return generator;
- };
-
- /**
- * Add a single mapping from original source line and column to the generated
- * source's line and column for this source map being created. The mapping
- * object should have the following properties:
- *
- * - generated: An object with the generated line and column positions.
- * - original: An object with the original line and column positions.
- * - source: The original source file (relative to the sourceRoot).
- * - name: An optional original token name for this mapping.
- */
- SourceMapGenerator.prototype.addMapping =
- function SourceMapGenerator_addMapping(aArgs) {
- var generated = util.getArg(aArgs, 'generated');
- var original = util.getArg(aArgs, 'original', null);
- var source = util.getArg(aArgs, 'source', null);
- var name = util.getArg(aArgs, 'name', null);
-
- this._validateMapping(generated, original, source, name);
-
- if (source && !this._sources.has(source)) {
- this._sources.add(source);
- }
-
- if (name && !this._names.has(name)) {
- this._names.add(name);
- }
-
- this._mappings.push({
- generatedLine: generated.line,
- generatedColumn: generated.column,
- originalLine: original != null && original.line,
- originalColumn: original != null && original.column,
- source: source,
- name: name
- });
- };
-
- /**
- * Set the source content for a source file.
- */
- SourceMapGenerator.prototype.setSourceContent =
- function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
- var source = aSourceFile;
- if (this._sourceRoot) {
- source = util.relative(this._sourceRoot, source);
- }
-
- if (aSourceContent !== null) {
- // Add the source content to the _sourcesContents map.
- // Create a new _sourcesContents map if the property is null.
- if (!this._sourcesContents) {
- this._sourcesContents = {};
- }
- this._sourcesContents[util.toSetString(source)] = aSourceContent;
- } else {
- // Remove the source file from the _sourcesContents map.
- // If the _sourcesContents map is empty, set the property to null.
- delete this._sourcesContents[util.toSetString(source)];
- if (Object.keys(this._sourcesContents).length === 0) {
- this._sourcesContents = null;
- }
- }
- };
-
- /**
- * Applies the mappings of a sub-source-map for a specific source file to the
- * source map being generated. Each mapping to the supplied source file is
- * rewritten using the supplied source map. Note: The resolution for the
- * resulting mappings is the minimium of this map and the supplied map.
- *
- * @param aSourceMapConsumer The source map to be applied.
- * @param aSourceFile Optional. The filename of the source file.
- * If omitted, SourceMapConsumer's file property will be used.
- */
- SourceMapGenerator.prototype.applySourceMap =
- function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile) {
- // If aSourceFile is omitted, we will use the file property of the SourceMap
- if (!aSourceFile) {
- aSourceFile = aSourceMapConsumer.file;
- }
- var sourceRoot = this._sourceRoot;
- // Make "aSourceFile" relative if an absolute Url is passed.
- if (sourceRoot) {
- aSourceFile = util.relative(sourceRoot, aSourceFile);
- }
- // Applying the SourceMap can add and remove items from the sources and
- // the names array.
- var newSources = new ArraySet();
- var newNames = new ArraySet();
-
- // Find mappings for the "aSourceFile"
- this._mappings.forEach(function (mapping) {
- if (mapping.source === aSourceFile && mapping.originalLine) {
- // Check if it can be mapped by the source map, then update the mapping.
- var original = aSourceMapConsumer.originalPositionFor({
- line: mapping.originalLine,
- column: mapping.originalColumn
- });
- if (original.source !== null) {
- // Copy mapping
- if (sourceRoot) {
- mapping.source = util.relative(sourceRoot, original.source);
- } else {
- mapping.source = original.source;
- }
- mapping.originalLine = original.line;
- mapping.originalColumn = original.column;
- if (original.name !== null && mapping.name !== null) {
- // Only use the identifier name if it's an identifier
- // in both SourceMaps
- mapping.name = original.name;
- }
- }
- }
-
- var source = mapping.source;
- if (source && !newSources.has(source)) {
- newSources.add(source);
- }
-
- var name = mapping.name;
- if (name && !newNames.has(name)) {
- newNames.add(name);
- }
-
- }, this);
- this._sources = newSources;
- this._names = newNames;
-
- // Copy sourcesContents of applied map.
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content) {
- if (sourceRoot) {
- sourceFile = util.relative(sourceRoot, sourceFile);
- }
- this.setSourceContent(sourceFile, content);
- }
- }, this);
- };
-
- /**
- * A mapping can have one of the three levels of data:
- *
- * 1. Just the generated position.
- * 2. The Generated position, original position, and original source.
- * 3. Generated and original position, original source, as well as a name
- * token.
- *
- * To maintain consistency, we validate that any new mapping being added falls
- * in to one of these categories.
- */
- SourceMapGenerator.prototype._validateMapping =
- function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
- aName) {
- if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
- && aGenerated.line > 0 && aGenerated.column >= 0
- && !aOriginal && !aSource && !aName) {
- // Case 1.
- return;
- }
- else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
- && aOriginal && 'line' in aOriginal && 'column' in aOriginal
- && aGenerated.line > 0 && aGenerated.column >= 0
- && aOriginal.line > 0 && aOriginal.column >= 0
- && aSource) {
- // Cases 2 and 3.
- return;
- }
- else {
- throw new Error('Invalid mapping: ' + JSON.stringify({
- generated: aGenerated,
- source: aSource,
- orginal: aOriginal,
- name: aName
- }));
- }
- };
-
- /**
- * Serialize the accumulated mappings in to the stream of base 64 VLQs
- * specified by the source map format.
- */
- SourceMapGenerator.prototype._serializeMappings =
- function SourceMapGenerator_serializeMappings() {
- var previousGeneratedColumn = 0;
- var previousGeneratedLine = 1;
- var previousOriginalColumn = 0;
- var previousOriginalLine = 0;
- var previousName = 0;
- var previousSource = 0;
- var result = '';
- var mapping;
-
- // The mappings must be guaranteed to be in sorted order before we start
- // serializing them or else the generated line numbers (which are defined
- // via the ';' separators) will be all messed up. Note: it might be more
- // performant to maintain the sorting as we insert them, rather than as we
- // serialize them, but the big O is the same either way.
- this._mappings.sort(util.compareByGeneratedPositions);
-
- for (var i = 0, len = this._mappings.length; i < len; i++) {
- mapping = this._mappings[i];
-
- if (mapping.generatedLine !== previousGeneratedLine) {
- previousGeneratedColumn = 0;
- while (mapping.generatedLine !== previousGeneratedLine) {
- result += ';';
- previousGeneratedLine++;
- }
- }
- else {
- if (i > 0) {
- if (!util.compareByGeneratedPositions(mapping, this._mappings[i - 1])) {
- continue;
- }
- result += ',';
- }
- }
-
- result += base64VLQ.encode(mapping.generatedColumn
- - previousGeneratedColumn);
- previousGeneratedColumn = mapping.generatedColumn;
-
- if (mapping.source) {
- result += base64VLQ.encode(this._sources.indexOf(mapping.source)
- - previousSource);
- previousSource = this._sources.indexOf(mapping.source);
-
- // lines are stored 0-based in SourceMap spec version 3
- result += base64VLQ.encode(mapping.originalLine - 1
- - previousOriginalLine);
- previousOriginalLine = mapping.originalLine - 1;
-
- result += base64VLQ.encode(mapping.originalColumn
- - previousOriginalColumn);
- previousOriginalColumn = mapping.originalColumn;
-
- if (mapping.name) {
- result += base64VLQ.encode(this._names.indexOf(mapping.name)
- - previousName);
- previousName = this._names.indexOf(mapping.name);
- }
- }
- }
-
- return result;
- };
-
- SourceMapGenerator.prototype._generateSourcesContent =
- function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
- return aSources.map(function (source) {
- if (!this._sourcesContents) {
- return null;
- }
- if (aSourceRoot) {
- source = util.relative(aSourceRoot, source);
- }
- var key = util.toSetString(source);
- return Object.prototype.hasOwnProperty.call(this._sourcesContents,
- key)
- ? this._sourcesContents[key]
- : null;
- }, this);
- };
-
- /**
- * Externalize the source map.
- */
- SourceMapGenerator.prototype.toJSON =
- function SourceMapGenerator_toJSON() {
- var map = {
- version: this._version,
- file: this._file,
- sources: this._sources.toArray(),
- names: this._names.toArray(),
- mappings: this._serializeMappings()
- };
- if (this._sourceRoot) {
- map.sourceRoot = this._sourceRoot;
- }
- if (this._sourcesContents) {
- map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
- }
-
- return map;
- };
-
- /**
- * Render the source map being generated to a string.
- */
- SourceMapGenerator.prototype.toString =
- function SourceMapGenerator_toString() {
- return JSON.stringify(this);
- };
-
- exports.SourceMapGenerator = SourceMapGenerator;
-
-});
-
-},{"./array-set":12,"./base64-vlq":13,"./util":19,"amdefine":20}],18:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- var SourceMapGenerator = _dereq_('./source-map-generator').SourceMapGenerator;
- var util = _dereq_('./util');
-
- /**
- * SourceNodes provide a way to abstract over interpolating/concatenating
- * snippets of generated JavaScript source code while maintaining the line and
- * column information associated with the original source code.
- *
- * @param aLine The original line number.
- * @param aColumn The original column number.
- * @param aSource The original source's filename.
- * @param aChunks Optional. An array of strings which are snippets of
- * generated JS, or other SourceNodes.
- * @param aName The original identifier.
- */
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
- this.children = [];
- this.sourceContents = {};
- this.line = aLine === undefined ? null : aLine;
- this.column = aColumn === undefined ? null : aColumn;
- this.source = aSource === undefined ? null : aSource;
- this.name = aName === undefined ? null : aName;
- if (aChunks != null) this.add(aChunks);
- }
-
- /**
- * Creates a SourceNode from generated code and a SourceMapConsumer.
- *
- * @param aGeneratedCode The generated code
- * @param aSourceMapConsumer The SourceMap for the generated code
- */
- SourceNode.fromStringWithSourceMap =
- function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer) {
- // The SourceNode we want to fill with the generated code
- // and the SourceMap
- var node = new SourceNode();
-
- // The generated code
- // Processed fragments are removed from this array.
- var remainingLines = aGeneratedCode.split('\n');
-
- // We need to remember the position of "remainingLines"
- var lastGeneratedLine = 1, lastGeneratedColumn = 0;
-
- // The generate SourceNodes we need a code range.
- // To extract it current and last mapping is used.
- // Here we store the last mapping.
- var lastMapping = null;
-
- aSourceMapConsumer.eachMapping(function (mapping) {
- if (lastMapping === null) {
- // We add the generated code until the first mapping
- // to the SourceNode without any mapping.
- // Each line is added as separate string.
- while (lastGeneratedLine < mapping.generatedLine) {
- node.add(remainingLines.shift() + "\n");
- lastGeneratedLine++;
- }
- if (lastGeneratedColumn < mapping.generatedColumn) {
- var nextLine = remainingLines[0];
- node.add(nextLine.substr(0, mapping.generatedColumn));
- remainingLines[0] = nextLine.substr(mapping.generatedColumn);
- lastGeneratedColumn = mapping.generatedColumn;
- }
- } else {
- // We add the code from "lastMapping" to "mapping":
- // First check if there is a new line in between.
- if (lastGeneratedLine < mapping.generatedLine) {
- var code = "";
- // Associate full lines with "lastMapping"
- do {
- code += remainingLines.shift() + "\n";
- lastGeneratedLine++;
- lastGeneratedColumn = 0;
- } while (lastGeneratedLine < mapping.generatedLine);
- // When we reached the correct line, we add code until we
- // reach the correct column too.
- if (lastGeneratedColumn < mapping.generatedColumn) {
- var nextLine = remainingLines[0];
- code += nextLine.substr(0, mapping.generatedColumn);
- remainingLines[0] = nextLine.substr(mapping.generatedColumn);
- lastGeneratedColumn = mapping.generatedColumn;
- }
- // Create the SourceNode.
- addMappingWithCode(lastMapping, code);
- } else {
- // There is no new line in between.
- // Associate the code between "lastGeneratedColumn" and
- // "mapping.generatedColumn" with "lastMapping"
- var nextLine = remainingLines[0];
- var code = nextLine.substr(0, mapping.generatedColumn -
- lastGeneratedColumn);
- remainingLines[0] = nextLine.substr(mapping.generatedColumn -
- lastGeneratedColumn);
- lastGeneratedColumn = mapping.generatedColumn;
- addMappingWithCode(lastMapping, code);
- }
- }
- lastMapping = mapping;
- }, this);
- // We have processed all mappings.
- // Associate the remaining code in the current line with "lastMapping"
- // and add the remaining lines without any mapping
- addMappingWithCode(lastMapping, remainingLines.join("\n"));
-
- // Copy sourcesContent into SourceNode
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content) {
- node.setSourceContent(sourceFile, content);
- }
- });
-
- return node;
-
- function addMappingWithCode(mapping, code) {
- if (mapping === null || mapping.source === undefined) {
- node.add(code);
- } else {
- node.add(new SourceNode(mapping.originalLine,
- mapping.originalColumn,
- mapping.source,
- code,
- mapping.name));
- }
- }
- };
-
- /**
- * Add a chunk of generated JS to this source node.
- *
- * @param aChunk A string snippet of generated JS code, another instance of
- * SourceNode, or an array where each member is one of those things.
- */
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
- if (Array.isArray(aChunk)) {
- aChunk.forEach(function (chunk) {
- this.add(chunk);
- }, this);
- }
- else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
- if (aChunk) {
- this.children.push(aChunk);
- }
- }
- else {
- throw new TypeError(
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
- );
- }
- return this;
- };
-
- /**
- * Add a chunk of generated JS to the beginning of this source node.
- *
- * @param aChunk A string snippet of generated JS code, another instance of
- * SourceNode, or an array where each member is one of those things.
- */
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
- if (Array.isArray(aChunk)) {
- for (var i = aChunk.length-1; i >= 0; i--) {
- this.prepend(aChunk[i]);
- }
- }
- else if (aChunk instanceof SourceNode || typeof aChunk === "string") {
- this.children.unshift(aChunk);
- }
- else {
- throw new TypeError(
- "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
- );
- }
- return this;
- };
-
- /**
- * Walk over the tree of JS snippets in this node and its children. The
- * walking function is called once for each snippet of JS and is passed that
- * snippet and the its original associated source's line/column location.
- *
- * @param aFn The traversal function.
- */
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
- var chunk;
- for (var i = 0, len = this.children.length; i < len; i++) {
- chunk = this.children[i];
- if (chunk instanceof SourceNode) {
- chunk.walk(aFn);
- }
- else {
- if (chunk !== '') {
- aFn(chunk, { source: this.source,
- line: this.line,
- column: this.column,
- name: this.name });
- }
- }
- }
- };
-
- /**
- * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
- * each of `this.children`.
- *
- * @param aSep The separator.
- */
- SourceNode.prototype.join = function SourceNode_join(aSep) {
- var newChildren;
- var i;
- var len = this.children.length;
- if (len > 0) {
- newChildren = [];
- for (i = 0; i < len-1; i++) {
- newChildren.push(this.children[i]);
- newChildren.push(aSep);
- }
- newChildren.push(this.children[i]);
- this.children = newChildren;
- }
- return this;
- };
-
- /**
- * Call String.prototype.replace on the very right-most source snippet. Useful
- * for trimming whitespace from the end of a source node, etc.
- *
- * @param aPattern The pattern to replace.
- * @param aReplacement The thing to replace the pattern with.
- */
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
- var lastChild = this.children[this.children.length - 1];
- if (lastChild instanceof SourceNode) {
- lastChild.replaceRight(aPattern, aReplacement);
- }
- else if (typeof lastChild === 'string') {
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
- }
- else {
- this.children.push(''.replace(aPattern, aReplacement));
- }
- return this;
- };
-
- /**
- * Set the source content for a source file. This will be added to the SourceMapGenerator
- * in the sourcesContent field.
- *
- * @param aSourceFile The filename of the source file
- * @param aSourceContent The content of the source file
- */
- SourceNode.prototype.setSourceContent =
- function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
- };
-
- /**
- * Walk over the tree of SourceNodes. The walking function is called for each
- * source file content and is passed the filename and source content.
- *
- * @param aFn The traversal function.
- */
- SourceNode.prototype.walkSourceContents =
- function SourceNode_walkSourceContents(aFn) {
- for (var i = 0, len = this.children.length; i < len; i++) {
- if (this.children[i] instanceof SourceNode) {
- this.children[i].walkSourceContents(aFn);
- }
- }
-
- var sources = Object.keys(this.sourceContents);
- for (var i = 0, len = sources.length; i < len; i++) {
- aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
- }
- };
-
- /**
- * Return the string representation of this source node. Walks over the tree
- * and concatenates all the various snippets together to one string.
- */
- SourceNode.prototype.toString = function SourceNode_toString() {
- var str = "";
- this.walk(function (chunk) {
- str += chunk;
- });
- return str;
- };
-
- /**
- * Returns the string representation of this source node along with a source
- * map.
- */
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
- var generated = {
- code: "",
- line: 1,
- column: 0
- };
- var map = new SourceMapGenerator(aArgs);
- var sourceMappingActive = false;
- var lastOriginalSource = null;
- var lastOriginalLine = null;
- var lastOriginalColumn = null;
- var lastOriginalName = null;
- this.walk(function (chunk, original) {
- generated.code += chunk;
- if (original.source !== null
- && original.line !== null
- && original.column !== null) {
- if(lastOriginalSource !== original.source
- || lastOriginalLine !== original.line
- || lastOriginalColumn !== original.column
- || lastOriginalName !== original.name) {
- map.addMapping({
- source: original.source,
- original: {
- line: original.line,
- column: original.column
- },
- generated: {
- line: generated.line,
- column: generated.column
- },
- name: original.name
- });
- }
- lastOriginalSource = original.source;
- lastOriginalLine = original.line;
- lastOriginalColumn = original.column;
- lastOriginalName = original.name;
- sourceMappingActive = true;
- } else if (sourceMappingActive) {
- map.addMapping({
- generated: {
- line: generated.line,
- column: generated.column
- }
- });
- lastOriginalSource = null;
- sourceMappingActive = false;
- }
- chunk.split('').forEach(function (ch) {
- if (ch === '\n') {
- generated.line++;
- generated.column = 0;
- } else {
- generated.column++;
- }
- });
- });
- this.walkSourceContents(function (sourceFile, sourceContent) {
- map.setSourceContent(sourceFile, sourceContent);
- });
-
- return { code: generated.code, map: map };
- };
-
- exports.SourceNode = SourceNode;
-
-});
-
-},{"./source-map-generator":17,"./util":19,"amdefine":20}],19:[function(_dereq_,module,exports){
-/* -*- Mode: js; js-indent-level: 2; -*- */
-/*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
-if (typeof define !== 'function') {
- var define = _dereq_('amdefine')(module, _dereq_);
-}
-define(function (_dereq_, exports, module) {
-
- /**
- * This is a helper function for getting values from parameter/options
- * objects.
- *
- * @param args The object we are extracting values from
- * @param name The name of the property we are getting.
- * @param defaultValue An optional value to return if the property is missing
- * from the object. If this is not specified and the property is missing, an
- * error will be thrown.
- */
- function getArg(aArgs, aName, aDefaultValue) {
- if (aName in aArgs) {
- return aArgs[aName];
- } else if (arguments.length === 3) {
- return aDefaultValue;
- } else {
- throw new Error('"' + aName + '" is a required argument.');
- }
- }
- exports.getArg = getArg;
-
- var urlRegexp = /([\w+\-.]+):\/\/((\w+:\w+)@)?([\w.]+)?(:(\d+))?(\S+)?/;
- var dataUrlRegexp = /^data:.+\,.+/;
-
- function urlParse(aUrl) {
- var match = aUrl.match(urlRegexp);
- if (!match) {
- return null;
- }
- return {
- scheme: match[1],
- auth: match[3],
- host: match[4],
- port: match[6],
- path: match[7]
- };
- }
- exports.urlParse = urlParse;
-
- function urlGenerate(aParsedUrl) {
- var url = aParsedUrl.scheme + "://";
- if (aParsedUrl.auth) {
- url += aParsedUrl.auth + "@"
- }
- if (aParsedUrl.host) {
- url += aParsedUrl.host;
- }
- if (aParsedUrl.port) {
- url += ":" + aParsedUrl.port
- }
- if (aParsedUrl.path) {
- url += aParsedUrl.path;
- }
- return url;
- }
- exports.urlGenerate = urlGenerate;
-
- function join(aRoot, aPath) {
- var url;
-
- if (aPath.match(urlRegexp) || aPath.match(dataUrlRegexp)) {
- return aPath;
- }
-
- if (aPath.charAt(0) === '/' && (url = urlParse(aRoot))) {
- url.path = aPath;
- return urlGenerate(url);
- }
-
- return aRoot.replace(/\/$/, '') + '/' + aPath;
- }
- exports.join = join;
-
- /**
- * Because behavior goes wacky when you set `__proto__` on objects, we
- * have to prefix all the strings in our set with an arbitrary character.
- *
- * See https://github.com/mozilla/source-map/pull/31 and
- * https://github.com/mozilla/source-map/issues/30
- *
- * @param String aStr
- */
- function toSetString(aStr) {
- return '$' + aStr;
- }
- exports.toSetString = toSetString;
-
- function fromSetString(aStr) {
- return aStr.substr(1);
- }
- exports.fromSetString = fromSetString;
-
- function relative(aRoot, aPath) {
- aRoot = aRoot.replace(/\/$/, '');
-
- var url = urlParse(aRoot);
- if (aPath.charAt(0) == "/" && url && url.path == "/") {
- return aPath.slice(1);
- }
-
- return aPath.indexOf(aRoot + '/') === 0
- ? aPath.substr(aRoot.length + 1)
- : aPath;
- }
- exports.relative = relative;
-
- function strcmp(aStr1, aStr2) {
- var s1 = aStr1 || "";
- var s2 = aStr2 || "";
- return (s1 > s2) - (s1 < s2);
- }
-
- /**
- * Comparator between two mappings where the original positions are compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same original source/line/column, but different generated
- * line and column the same. Useful when searching for a mapping with a
- * stubbed out mapping.
- */
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
- var cmp;
-
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp) {
- return cmp;
- }
-
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp) {
- return cmp;
- }
-
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp || onlyCompareOriginal) {
- return cmp;
- }
-
- cmp = strcmp(mappingA.name, mappingB.name);
- if (cmp) {
- return cmp;
- }
-
- cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp) {
- return cmp;
- }
-
- return mappingA.generatedColumn - mappingB.generatedColumn;
- };
- exports.compareByOriginalPositions = compareByOriginalPositions;
-
- /**
- * Comparator between two mappings where the generated positions are
- * compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same generated line and column, but different
- * source/name/original line and column the same. Useful when searching for a
- * mapping with a stubbed out mapping.
- */
- function compareByGeneratedPositions(mappingA, mappingB, onlyCompareGenerated) {
- var cmp;
-
- cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp) {
- return cmp;
- }
-
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp || onlyCompareGenerated) {
- return cmp;
- }
-
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp) {
- return cmp;
- }
-
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp) {
- return cmp;
- }
-
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp) {
- return cmp;
- }
-
- return strcmp(mappingA.name, mappingB.name);
- };
- exports.compareByGeneratedPositions = compareByGeneratedPositions;
-
-});
-
-},{"amdefine":20}],20:[function(_dereq_,module,exports){
-(function (process,__filename){
-/** vim: et:ts=4:sw=4:sts=4
- * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/amdefine for details
- */
-
-/*jslint node: true */
-/*global module, process */
-'use strict';
-
-/**
- * Creates a define for node.
- * @param {Object} module the "module" object that is defined by Node for the
- * current module.
- * @param {Function} [requireFn]. Node's require function for the current module.
- * It only needs to be passed in Node versions before 0.5, when module.require
- * did not exist.
- * @returns {Function} a define function that is usable for the current node
- * module.
- */
-function amdefine(module, requireFn) {
- 'use strict';
- var defineCache = {},
- loaderCache = {},
- alreadyCalled = false,
- path = _dereq_('path'),
- makeRequire, stringRequire;
-
- /**
- * Trims the . and .. from an array of path segments.
- * It will keep a leading path segment if a .. will become
- * the first path segment, to help with module name lookups,
- * which act like paths, but can be remapped. But the end result,
- * all paths that use this function should look normalized.
- * NOTE: this method MODIFIES the input array.
- * @param {Array} ary the array of path segments.
- */
- function trimDots(ary) {
- var i, part;
- for (i = 0; ary[i]; i+= 1) {
- part = ary[i];
- if (part === '.') {
- ary.splice(i, 1);
- i -= 1;
- } else if (part === '..') {
- if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
- //End of the line. Keep at least one non-dot
- //path segment at the front so it can be mapped
- //correctly to disk. Otherwise, there is likely
- //no path mapping for a path starting with '..'.
- //This can still fail, but catches the most reasonable
- //uses of ..
- break;
- } else if (i > 0) {
- ary.splice(i - 1, 2);
- i -= 2;
- }
- }
- }
- }
-
- function normalize(name, baseName) {
- var baseParts;
-
- //Adjust any relative paths.
- if (name && name.charAt(0) === '.') {
- //If have a base name, try to normalize against it,
- //otherwise, assume it is a top-level require that will
- //be relative to baseUrl in the end.
- if (baseName) {
- baseParts = baseName.split('/');
- baseParts = baseParts.slice(0, baseParts.length - 1);
- baseParts = baseParts.concat(name.split('/'));
- trimDots(baseParts);
- name = baseParts.join('/');
- }
- }
-
- return name;
- }
-
- /**
- * Create the normalize() function passed to a loader plugin's
- * normalize method.
- */
- function makeNormalize(relName) {
- return function (name) {
- return normalize(name, relName);
- };
- }
-
- function makeLoad(id) {
- function load(value) {
- loaderCache[id] = value;
- }
-
- load.fromText = function (id, text) {
- //This one is difficult because the text can/probably uses
- //define, and any relative paths and requires should be relative
- //to that id was it would be found on disk. But this would require
- //bootstrapping a module/require fairly deeply from node core.
- //Not sure how best to go about that yet.
- throw new Error('amdefine does not implement load.fromText');
- };
-
- return load;
- }
-
- makeRequire = function (systemRequire, exports, module, relId) {
- function amdRequire(deps, callback) {
- if (typeof deps === 'string') {
- //Synchronous, single module require('')
- return stringRequire(systemRequire, exports, module, deps, relId);
- } else {
- //Array of dependencies with a callback.
-
- //Convert the dependencies to modules.
- deps = deps.map(function (depName) {
- return stringRequire(systemRequire, exports, module, depName, relId);
- });
-
- //Wait for next tick to call back the require call.
- process.nextTick(function () {
- callback.apply(null, deps);
- });
- }
- }
-
- amdRequire.toUrl = function (filePath) {
- if (filePath.indexOf('.') === 0) {
- return normalize(filePath, path.dirname(module.filename));
- } else {
- return filePath;
- }
- };
-
- return amdRequire;
- };
-
- //Favor explicit value, passed in if the module wants to support Node 0.4.
- requireFn = requireFn || function req() {
- return module.require.apply(module, arguments);
- };
-
- function runFactory(id, deps, factory) {
- var r, e, m, result;
-
- if (id) {
- e = loaderCache[id] = {};
- m = {
- id: id,
- uri: __filename,
- exports: e
- };
- r = makeRequire(requireFn, e, m, id);
- } else {
- //Only support one define call per file
- if (alreadyCalled) {
- throw new Error('amdefine with no module ID cannot be called more than once per file.');
- }
- alreadyCalled = true;
-
- //Use the real variables from node
- //Use module.exports for exports, since
- //the exports in here is amdefine exports.
- e = module.exports;
- m = module;
- r = makeRequire(requireFn, e, m, module.id);
- }
-
- //If there are dependencies, they are strings, so need
- //to convert them to dependency values.
- if (deps) {
- deps = deps.map(function (depName) {
- return r(depName);
- });
- }
-
- //Call the factory with the right dependencies.
- if (typeof factory === 'function') {
- result = factory.apply(m.exports, deps);
- } else {
- result = factory;
- }
-
- if (result !== undefined) {
- m.exports = result;
- if (id) {
- loaderCache[id] = m.exports;
- }
- }
- }
-
- stringRequire = function (systemRequire, exports, module, id, relId) {
- //Split the ID by a ! so that
- var index = id.indexOf('!'),
- originalId = id,
- prefix, plugin;
-
- if (index === -1) {
- id = normalize(id, relId);
-
- //Straight module lookup. If it is one of the special dependencies,
- //deal with it, otherwise, delegate to node.
- if (id === 'require') {
- return makeRequire(systemRequire, exports, module, relId);
- } else if (id === 'exports') {
- return exports;
- } else if (id === 'module') {
- return module;
- } else if (loaderCache.hasOwnProperty(id)) {
- return loaderCache[id];
- } else if (defineCache[id]) {
- runFactory.apply(null, defineCache[id]);
- return loaderCache[id];
- } else {
- if(systemRequire) {
- return systemRequire(originalId);
- } else {
- throw new Error('No module with ID: ' + id);
- }
- }
- } else {
- //There is a plugin in play.
- prefix = id.substring(0, index);
- id = id.substring(index + 1, id.length);
-
- plugin = stringRequire(systemRequire, exports, module, prefix, relId);
-
- if (plugin.normalize) {
- id = plugin.normalize(id, makeNormalize(relId));
- } else {
- //Normalize the ID normally.
- id = normalize(id, relId);
- }
-
- if (loaderCache[id]) {
- return loaderCache[id];
- } else {
- plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
-
- return loaderCache[id];
- }
- }
- };
-
- //Create a define function specific to the module asking for amdefine.
- function define(id, deps, factory) {
- if (Array.isArray(id)) {
- factory = deps;
- deps = id;
- id = undefined;
- } else if (typeof id !== 'string') {
- factory = id;
- id = deps = undefined;
- }
-
- if (deps && !Array.isArray(deps)) {
- factory = deps;
- deps = undefined;
- }
-
- if (!deps) {
- deps = ['require', 'exports', 'module'];
- }
-
- //Set up properties for this module. If an ID, then use
- //internal cache. If no ID, then use the external variables
- //for this node module.
- if (id) {
- //Put the module in deep freeze until there is a
- //require call for it.
- defineCache[id] = [id, deps, factory];
- } else {
- runFactory(id, deps, factory);
- }
- }
-
- //define.require, which has access to all the values in the
- //cache. Useful for AMD modules that all have IDs in the file,
- //but need to finally export a value to node based on one of those
- //IDs.
- define.require = function (id) {
- if (loaderCache[id]) {
- return loaderCache[id];
- }
-
- if (defineCache[id]) {
- runFactory.apply(null, defineCache[id]);
- return loaderCache[id];
- }
- };
-
- define.amd = {};
-
- return define;
-}
-
-module.exports = amdefine;
-
-}).call(this,_dereq_('_process'),"/node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js")
-},{"_process":8,"path":7}],21:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var docblockRe = /^\s*(\/\*\*(.|\r?\n)*?\*\/)/;
-var ltrimRe = /^\s*/;
-/**
- * @param {String} contents
- * @return {String}
- */
-function extract(contents) {
- var match = contents.match(docblockRe);
- if (match) {
- return match[0].replace(ltrimRe, '') || '';
- }
- return '';
-}
-
-
-var commentStartRe = /^\/\*\*?/;
-var commentEndRe = /\*+\/$/;
-var wsRe = /[\t ]+/g;
-var stringStartRe = /(\r?\n|^) *\*/g;
-var multilineRe = /(?:^|\r?\n) *(@[^\r\n]*?) *\r?\n *([^@\r\n\s][^@\r\n]+?) *\r?\n/g;
-var propertyRe = /(?:^|\r?\n) *@(\S+) *([^\r\n]*)/g;
-
-/**
- * @param {String} contents
- * @return {Array}
- */
-function parse(docblock) {
- docblock = docblock
- .replace(commentStartRe, '')
- .replace(commentEndRe, '')
- .replace(wsRe, ' ')
- .replace(stringStartRe, '$1');
-
- // Normalize multi-line directives
- var prev = '';
- while (prev != docblock) {
- prev = docblock;
- docblock = docblock.replace(multilineRe, "\n$1 $2\n");
- }
- docblock = docblock.trim();
-
- var result = [];
- var match;
- while (match = propertyRe.exec(docblock)) {
- result.push([match[1], match[2]]);
- }
-
- return result;
-}
-
-/**
- * Same as parse but returns an object of prop: value instead of array of paris
- * If a property appers more than once the last one will be returned
- *
- * @param {String} contents
- * @return {Object}
- */
-function parseAsObject(docblock) {
- var pairs = parse(docblock);
- var result = {};
- for (var i = 0; i < pairs.length; i++) {
- result[pairs[i][0]] = pairs[i][1];
- }
- return result;
-}
-
-
-exports.extract = extract;
-exports.parse = parse;
-exports.parseAsObject = parseAsObject;
-
-},{}],22:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/*jslint node: true*/
-"use strict";
-
-var esprima = _dereq_('esprima-fb');
-var utils = _dereq_('./utils');
-
-var getBoundaryNode = utils.getBoundaryNode;
-var declareIdentInScope = utils.declareIdentInLocalScope;
-var initScopeMetadata = utils.initScopeMetadata;
-var Syntax = esprima.Syntax;
-
-/**
- * @param {object} node
- * @param {object} parentNode
- * @return {boolean}
- */
-function _nodeIsClosureScopeBoundary(node, parentNode) {
- if (node.type === Syntax.Program) {
- return true;
- }
-
- var parentIsFunction =
- parentNode.type === Syntax.FunctionDeclaration
- || parentNode.type === Syntax.FunctionExpression
- || parentNode.type === Syntax.ArrowFunctionExpression;
-
- var parentIsCurlylessArrowFunc =
- parentNode.type === Syntax.ArrowFunctionExpression
- && node === parentNode.body;
-
- return parentIsFunction
- && (node.type === Syntax.BlockStatement || parentIsCurlylessArrowFunc);
-}
-
-function _nodeIsBlockScopeBoundary(node, parentNode) {
- if (node.type === Syntax.Program) {
- return false;
- }
-
- return node.type === Syntax.BlockStatement
- && parentNode.type === Syntax.CatchClause;
-}
-
-/**
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function traverse(node, path, state) {
- /*jshint -W004*/
- // Create a scope stack entry if this is the first node we've encountered in
- // its local scope
- var startIndex = null;
- var parentNode = path[0];
- if (!Array.isArray(node) && state.localScope.parentNode !== parentNode) {
- if (_nodeIsClosureScopeBoundary(node, parentNode)) {
- var scopeIsStrict = state.scopeIsStrict;
- if (!scopeIsStrict
- && (node.type === Syntax.BlockStatement
- || node.type === Syntax.Program)) {
- scopeIsStrict =
- node.body.length > 0
- && node.body[0].type === Syntax.ExpressionStatement
- && node.body[0].expression.type === Syntax.Literal
- && node.body[0].expression.value === 'use strict';
- }
-
- if (node.type === Syntax.Program) {
- startIndex = state.g.buffer.length;
- state = utils.updateState(state, {
- scopeIsStrict: scopeIsStrict
- });
- } else {
- startIndex = state.g.buffer.length + 1;
- state = utils.updateState(state, {
- localScope: {
- parentNode: parentNode,
- parentScope: state.localScope,
- identifiers: {},
- tempVarIndex: 0,
- tempVars: []
- },
- scopeIsStrict: scopeIsStrict
- });
-
- // All functions have an implicit 'arguments' object in scope
- declareIdentInScope('arguments', initScopeMetadata(node), state);
-
- // Include function arg identifiers in the scope boundaries of the
- // function
- if (parentNode.params.length > 0) {
- var param;
- var metadata = initScopeMetadata(parentNode, path.slice(1), path[0]);
- for (var i = 0; i < parentNode.params.length; i++) {
- param = parentNode.params[i];
- if (param.type === Syntax.Identifier) {
- declareIdentInScope(param.name, metadata, state);
- }
- }
- }
-
- // Include rest arg identifiers in the scope boundaries of their
- // functions
- if (parentNode.rest) {
- var metadata = initScopeMetadata(
- parentNode,
- path.slice(1),
- path[0]
- );
- declareIdentInScope(parentNode.rest.name, metadata, state);
- }
-
- // Named FunctionExpressions scope their name within the body block of
- // themselves only
- if (parentNode.type === Syntax.FunctionExpression && parentNode.id) {
- var metaData =
- initScopeMetadata(parentNode, path.parentNodeslice, parentNode);
- declareIdentInScope(parentNode.id.name, metaData, state);
- }
- }
-
- // Traverse and find all local identifiers in this closure first to
- // account for function/variable declaration hoisting
- collectClosureIdentsAndTraverse(node, path, state);
- }
-
- if (_nodeIsBlockScopeBoundary(node, parentNode)) {
- startIndex = state.g.buffer.length;
- state = utils.updateState(state, {
- localScope: {
- parentNode: parentNode,
- parentScope: state.localScope,
- identifiers: {},
- tempVarIndex: 0,
- tempVars: []
- }
- });
-
- if (parentNode.type === Syntax.CatchClause) {
- var metadata = initScopeMetadata(
- parentNode,
- path.slice(1),
- parentNode
- );
- declareIdentInScope(parentNode.param.name, metadata, state);
- }
- collectBlockIdentsAndTraverse(node, path, state);
- }
- }
-
- // Only catchup() before and after traversing a child node
- function traverser(node, path, state) {
- node.range && utils.catchup(node.range[0], state);
- traverse(node, path, state);
- node.range && utils.catchup(node.range[1], state);
- }
-
- utils.analyzeAndTraverse(walker, traverser, node, path, state);
-
- // Inject temp variables into the scope.
- if (startIndex !== null) {
- utils.injectTempVarDeclarations(state, startIndex);
- }
-}
-
-function collectClosureIdentsAndTraverse(node, path, state) {
- utils.analyzeAndTraverse(
- visitLocalClosureIdentifiers,
- collectClosureIdentsAndTraverse,
- node,
- path,
- state
- );
-}
-
-function collectBlockIdentsAndTraverse(node, path, state) {
- utils.analyzeAndTraverse(
- visitLocalBlockIdentifiers,
- collectBlockIdentsAndTraverse,
- node,
- path,
- state
- );
-}
-
-function visitLocalClosureIdentifiers(node, path, state) {
- var metaData;
- switch (node.type) {
- case Syntax.ArrowFunctionExpression:
- case Syntax.FunctionExpression:
- // Function expressions don't get their names (if there is one) added to
- // the closure scope they're defined in
- return false;
- case Syntax.ClassDeclaration:
- case Syntax.ClassExpression:
- case Syntax.FunctionDeclaration:
- if (node.id) {
- metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);
- declareIdentInScope(node.id.name, metaData, state);
- }
- return false;
- case Syntax.VariableDeclarator:
- // Variables have function-local scope
- if (path[0].kind === 'var') {
- metaData = initScopeMetadata(getBoundaryNode(path), path.slice(), node);
- declareIdentInScope(node.id.name, metaData, state);
- }
- break;
- }
-}
-
-function visitLocalBlockIdentifiers(node, path, state) {
- // TODO: Support 'let' here...maybe...one day...or something...
- if (node.type === Syntax.CatchClause) {
- return false;
- }
-}
-
-function walker(node, path, state) {
- var visitors = state.g.visitors;
- for (var i = 0; i < visitors.length; i++) {
- if (visitors[i].test(node, path, state)) {
- return visitors[i](traverse, node, path, state);
- }
- }
-}
-
-var _astCache = {};
-
-function getAstForSource(source, options) {
- if (_astCache[source] && !options.disableAstCache) {
- return _astCache[source];
- }
- var ast = esprima.parse(source, {
- comment: true,
- loc: true,
- range: true,
- sourceType: options.sourceType
- });
- if (!options.disableAstCache) {
- _astCache[source] = ast;
- }
- return ast;
-}
-
-/**
- * Applies all available transformations to the source
- * @param {array} visitors
- * @param {string} source
- * @param {?object} options
- * @return {object}
- */
-function transform(visitors, source, options) {
- options = options || {};
- var ast;
- try {
- ast = getAstForSource(source, options);
- } catch (e) {
- e.message = 'Parse Error: ' + e.message;
- throw e;
- }
- var state = utils.createState(source, ast, options);
- state.g.visitors = visitors;
-
- if (options.sourceMap) {
- var SourceMapGenerator = _dereq_('source-map').SourceMapGenerator;
- state.g.sourceMap = new SourceMapGenerator({file: options.filename || 'transformed.js'});
- }
-
- traverse(ast, [], state);
- utils.catchup(source.length, state);
-
- var ret = {code: state.g.buffer, extra: state.g.extra};
- if (options.sourceMap) {
- ret.sourceMap = state.g.sourceMap;
- ret.sourceMapFilename = options.filename || 'source.js';
- }
- return ret;
-}
-
-exports.transform = transform;
-exports.Syntax = Syntax;
-
-},{"./utils":23,"esprima-fb":9,"source-map":11}],23:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/*jslint node: true*/
-var Syntax = _dereq_('esprima-fb').Syntax;
-var leadingIndentRegexp = /(^|\n)( {2}|\t)/g;
-var nonWhiteRegexp = /(\S)/g;
-
-/**
- * A `state` object represents the state of the parser. It has "local" and
- * "global" parts. Global contains parser position, source, etc. Local contains
- * scope based properties like current class name. State should contain all the
- * info required for transformation. It's the only mandatory object that is
- * being passed to every function in transform chain.
- *
- * @param {string} source
- * @param {object} transformOptions
- * @return {object}
- */
-function createState(source, rootNode, transformOptions) {
- return {
- /**
- * A tree representing the current local scope (and its lexical scope chain)
- * Useful for tracking identifiers from parent scopes, etc.
- * @type {Object}
- */
- localScope: {
- parentNode: rootNode,
- parentScope: null,
- identifiers: {},
- tempVarIndex: 0,
- tempVars: []
- },
- /**
- * The name (and, if applicable, expression) of the super class
- * @type {Object}
- */
- superClass: null,
- /**
- * The namespace to use when munging identifiers
- * @type {String}
- */
- mungeNamespace: '',
- /**
- * Ref to the node for the current MethodDefinition
- * @type {Object}
- */
- methodNode: null,
- /**
- * Ref to the node for the FunctionExpression of the enclosing
- * MethodDefinition
- * @type {Object}
- */
- methodFuncNode: null,
- /**
- * Name of the enclosing class
- * @type {String}
- */
- className: null,
- /**
- * Whether we're currently within a `strict` scope
- * @type {Bool}
- */
- scopeIsStrict: null,
- /**
- * Indentation offset
- * @type {Number}
- */
- indentBy: 0,
- /**
- * Global state (not affected by updateState)
- * @type {Object}
- */
- g: {
- /**
- * A set of general options that transformations can consider while doing
- * a transformation:
- *
- * - minify
- * Specifies that transformation steps should do their best to minify
- * the output source when possible. This is useful for places where
- * minification optimizations are possible with higher-level context
- * info than what jsxmin can provide.
- *
- * For example, the ES6 class transform will minify munged private
- * variables if this flag is set.
- */
- opts: transformOptions,
- /**
- * Current position in the source code
- * @type {Number}
- */
- position: 0,
- /**
- * Auxiliary data to be returned by transforms
- * @type {Object}
- */
- extra: {},
- /**
- * Buffer containing the result
- * @type {String}
- */
- buffer: '',
- /**
- * Source that is being transformed
- * @type {String}
- */
- source: source,
-
- /**
- * Cached parsed docblock (see getDocblock)
- * @type {object}
- */
- docblock: null,
-
- /**
- * Whether the thing was used
- * @type {Boolean}
- */
- tagNamespaceUsed: false,
-
- /**
- * If using bolt xjs transformation
- * @type {Boolean}
- */
- isBolt: undefined,
-
- /**
- * Whether to record source map (expensive) or not
- * @type {SourceMapGenerator|null}
- */
- sourceMap: null,
-
- /**
- * Filename of the file being processed. Will be returned as a source
- * attribute in the source map
- */
- sourceMapFilename: 'source.js',
-
- /**
- * Only when source map is used: last line in the source for which
- * source map was generated
- * @type {Number}
- */
- sourceLine: 1,
-
- /**
- * Only when source map is used: last line in the buffer for which
- * source map was generated
- * @type {Number}
- */
- bufferLine: 1,
-
- /**
- * The top-level Program AST for the original file.
- */
- originalProgramAST: null,
-
- sourceColumn: 0,
- bufferColumn: 0
- }
- };
-}
-
-/**
- * Updates a copy of a given state with "update" and returns an updated state.
- *
- * @param {object} state
- * @param {object} update
- * @return {object}
- */
-function updateState(state, update) {
- var ret = Object.create(state);
- Object.keys(update).forEach(function(updatedKey) {
- ret[updatedKey] = update[updatedKey];
- });
- return ret;
-}
-
-/**
- * Given a state fill the resulting buffer from the original source up to
- * the end
- *
- * @param {number} end
- * @param {object} state
- * @param {?function} contentTransformer Optional callback to transform newly
- * added content.
- */
-function catchup(end, state, contentTransformer) {
- if (end < state.g.position) {
- // cannot move backwards
- return;
- }
- var source = state.g.source.substring(state.g.position, end);
- var transformed = updateIndent(source, state);
- if (state.g.sourceMap && transformed) {
- // record where we are
- state.g.sourceMap.addMapping({
- generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
- original: { line: state.g.sourceLine, column: state.g.sourceColumn },
- source: state.g.sourceMapFilename
- });
-
- // record line breaks in transformed source
- var sourceLines = source.split('\n');
- var transformedLines = transformed.split('\n');
- // Add line break mappings between last known mapping and the end of the
- // added piece. So for the code piece
- // (foo, bar);
- // > var x = 2;
- // > var b = 3;
- // var c =
- // only add lines marked with ">": 2, 3.
- for (var i = 1; i < sourceLines.length - 1; i++) {
- state.g.sourceMap.addMapping({
- generated: { line: state.g.bufferLine, column: 0 },
- original: { line: state.g.sourceLine, column: 0 },
- source: state.g.sourceMapFilename
- });
- state.g.sourceLine++;
- state.g.bufferLine++;
- }
- // offset for the last piece
- if (sourceLines.length > 1) {
- state.g.sourceLine++;
- state.g.bufferLine++;
- state.g.sourceColumn = 0;
- state.g.bufferColumn = 0;
- }
- state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;
- state.g.bufferColumn +=
- transformedLines[transformedLines.length - 1].length;
- }
- state.g.buffer +=
- contentTransformer ? contentTransformer(transformed) : transformed;
- state.g.position = end;
-}
-
-/**
- * Returns original source for an AST node.
- * @param {object} node
- * @param {object} state
- * @return {string}
- */
-function getNodeSourceText(node, state) {
- return state.g.source.substring(node.range[0], node.range[1]);
-}
-
-function _replaceNonWhite(value) {
- return value.replace(nonWhiteRegexp, ' ');
-}
-
-/**
- * Removes all non-whitespace characters
- */
-function _stripNonWhite(value) {
- return value.replace(nonWhiteRegexp, '');
-}
-
-/**
- * Finds the position of the next instance of the specified syntactic char in
- * the pending source.
- *
- * NOTE: This will skip instances of the specified char if they sit inside a
- * comment body.
- *
- * NOTE: This function also assumes that the buffer's current position is not
- * already within a comment or a string. This is rarely the case since all
- * of the buffer-advancement utility methods tend to be used on syntactic
- * nodes' range values -- but it's a small gotcha that's worth mentioning.
- */
-function getNextSyntacticCharOffset(char, state) {
- var pendingSource = state.g.source.substring(state.g.position);
- var pendingSourceLines = pendingSource.split('\n');
-
- var charOffset = 0;
- var line;
- var withinBlockComment = false;
- var withinString = false;
- lineLoop: while ((line = pendingSourceLines.shift()) !== undefined) {
- var lineEndPos = charOffset + line.length;
- charLoop: for (; charOffset < lineEndPos; charOffset++) {
- var currChar = pendingSource[charOffset];
- if (currChar === '"' || currChar === '\'') {
- withinString = !withinString;
- continue charLoop;
- } else if (withinString) {
- continue charLoop;
- } else if (charOffset + 1 < lineEndPos) {
- var nextTwoChars = currChar + line[charOffset + 1];
- if (nextTwoChars === '//') {
- charOffset = lineEndPos + 1;
- continue lineLoop;
- } else if (nextTwoChars === '/*') {
- withinBlockComment = true;
- charOffset += 1;
- continue charLoop;
- } else if (nextTwoChars === '*/') {
- withinBlockComment = false;
- charOffset += 1;
- continue charLoop;
- }
- }
-
- if (!withinBlockComment && currChar === char) {
- return charOffset + state.g.position;
- }
- }
-
- // Account for '\n'
- charOffset++;
- withinString = false;
- }
-
- throw new Error('`' + char + '` not found!');
-}
-
-/**
- * Catches up as `catchup` but replaces non-whitespace chars with spaces.
- */
-function catchupWhiteOut(end, state) {
- catchup(end, state, _replaceNonWhite);
-}
-
-/**
- * Catches up as `catchup` but removes all non-whitespace characters.
- */
-function catchupWhiteSpace(end, state) {
- catchup(end, state, _stripNonWhite);
-}
-
-/**
- * Removes all non-newline characters
- */
-var reNonNewline = /[^\n]/g;
-function stripNonNewline(value) {
- return value.replace(reNonNewline, function() {
- return '';
- });
-}
-
-/**
- * Catches up as `catchup` but removes all non-newline characters.
- *
- * Equivalent to appending as many newlines as there are in the original source
- * between the current position and `end`.
- */
-function catchupNewlines(end, state) {
- catchup(end, state, stripNonNewline);
-}
-
-
-/**
- * Same as catchup but does not touch the buffer
- *
- * @param {number} end
- * @param {object} state
- */
-function move(end, state) {
- // move the internal cursors
- if (state.g.sourceMap) {
- if (end < state.g.position) {
- state.g.position = 0;
- state.g.sourceLine = 1;
- state.g.sourceColumn = 0;
- }
-
- var source = state.g.source.substring(state.g.position, end);
- var sourceLines = source.split('\n');
- if (sourceLines.length > 1) {
- state.g.sourceLine += sourceLines.length - 1;
- state.g.sourceColumn = 0;
- }
- state.g.sourceColumn += sourceLines[sourceLines.length - 1].length;
- }
- state.g.position = end;
-}
-
-/**
- * Appends a string of text to the buffer
- *
- * @param {string} str
- * @param {object} state
- */
-function append(str, state) {
- if (state.g.sourceMap && str) {
- state.g.sourceMap.addMapping({
- generated: { line: state.g.bufferLine, column: state.g.bufferColumn },
- original: { line: state.g.sourceLine, column: state.g.sourceColumn },
- source: state.g.sourceMapFilename
- });
- var transformedLines = str.split('\n');
- if (transformedLines.length > 1) {
- state.g.bufferLine += transformedLines.length - 1;
- state.g.bufferColumn = 0;
- }
- state.g.bufferColumn +=
- transformedLines[transformedLines.length - 1].length;
- }
- state.g.buffer += str;
-}
-
-/**
- * Update indent using state.indentBy property. Indent is measured in
- * double spaces. Updates a single line only.
- *
- * @param {string} str
- * @param {object} state
- * @return {string}
- */
-function updateIndent(str, state) {
- /*jshint -W004*/
- var indentBy = state.indentBy;
- if (indentBy < 0) {
- for (var i = 0; i < -indentBy; i++) {
- str = str.replace(leadingIndentRegexp, '$1');
- }
- } else {
- for (var i = 0; i < indentBy; i++) {
- str = str.replace(leadingIndentRegexp, '$1$2$2');
- }
- }
- return str;
-}
-
-/**
- * Calculates indent from the beginning of the line until "start" or the first
- * character before start.
- * @example
- * " foo.bar()"
- * ^
- * start
- * indent will be " "
- *
- * @param {number} start
- * @param {object} state
- * @return {string}
- */
-function indentBefore(start, state) {
- var end = start;
- start = start - 1;
-
- while (start > 0 && state.g.source[start] != '\n') {
- if (!state.g.source[start].match(/[ \t]/)) {
- end = start;
- }
- start--;
- }
- return state.g.source.substring(start + 1, end);
-}
-
-function getDocblock(state) {
- if (!state.g.docblock) {
- var docblock = _dereq_('./docblock');
- state.g.docblock =
- docblock.parseAsObject(docblock.extract(state.g.source));
- }
- return state.g.docblock;
-}
-
-function identWithinLexicalScope(identName, state, stopBeforeNode) {
- var currScope = state.localScope;
- while (currScope) {
- if (currScope.identifiers[identName] !== undefined) {
- return true;
- }
-
- if (stopBeforeNode && currScope.parentNode === stopBeforeNode) {
- break;
- }
-
- currScope = currScope.parentScope;
- }
- return false;
-}
-
-function identInLocalScope(identName, state) {
- return state.localScope.identifiers[identName] !== undefined;
-}
-
-/**
- * @param {object} boundaryNode
- * @param {?array} path
- * @return {?object} node
- */
-function initScopeMetadata(boundaryNode, path, node) {
- return {
- boundaryNode: boundaryNode,
- bindingPath: path,
- bindingNode: node
- };
-}
-
-function declareIdentInLocalScope(identName, metaData, state) {
- state.localScope.identifiers[identName] = {
- boundaryNode: metaData.boundaryNode,
- path: metaData.bindingPath,
- node: metaData.bindingNode,
- state: Object.create(state)
- };
-}
-
-function getLexicalBindingMetadata(identName, state) {
- var currScope = state.localScope;
- while (currScope) {
- if (currScope.identifiers[identName] !== undefined) {
- return currScope.identifiers[identName];
- }
-
- currScope = currScope.parentScope;
- }
-}
-
-function getLocalBindingMetadata(identName, state) {
- return state.localScope.identifiers[identName];
-}
-
-/**
- * Apply the given analyzer function to the current node. If the analyzer
- * doesn't return false, traverse each child of the current node using the given
- * traverser function.
- *
- * @param {function} analyzer
- * @param {function} traverser
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function analyzeAndTraverse(analyzer, traverser, node, path, state) {
- if (node.type) {
- if (analyzer(node, path, state) === false) {
- return;
- }
- path.unshift(node);
- }
-
- getOrderedChildren(node).forEach(function(child) {
- traverser(child, path, state);
- });
-
- node.type && path.shift();
-}
-
-/**
- * It is crucial that we traverse in order, or else catchup() on a later
- * node that is processed out of order can move the buffer past a node
- * that we haven't handled yet, preventing us from modifying that node.
- *
- * This can happen when a node has multiple properties containing children.
- * For example, XJSElement nodes have `openingElement`, `closingElement` and
- * `children`. If we traverse `openingElement`, then `closingElement`, then
- * when we get to `children`, the buffer has already caught up to the end of
- * the closing element, after the children.
- *
- * This is basically a Schwartzian transform. Collects an array of children,
- * each one represented as [child, startIndex]; sorts the array by start
- * index; then traverses the children in that order.
- */
-function getOrderedChildren(node) {
- var queue = [];
- for (var key in node) {
- if (node.hasOwnProperty(key)) {
- enqueueNodeWithStartIndex(queue, node[key]);
- }
- }
- queue.sort(function(a, b) { return a[1] - b[1]; });
- return queue.map(function(pair) { return pair[0]; });
-}
-
-/**
- * Helper function for analyzeAndTraverse which queues up all of the children
- * of the given node.
- *
- * Children can also be found in arrays, so we basically want to merge all of
- * those arrays together so we can sort them and then traverse the children
- * in order.
- *
- * One example is the Program node. It contains `body` and `comments`, both
- * arrays. Lexographically, comments are interspersed throughout the body
- * nodes, but esprima's AST groups them together.
- */
-function enqueueNodeWithStartIndex(queue, node) {
- if (typeof node !== 'object' || node === null) {
- return;
- }
- if (node.range) {
- queue.push([node, node.range[0]]);
- } else if (Array.isArray(node)) {
- for (var ii = 0; ii < node.length; ii++) {
- enqueueNodeWithStartIndex(queue, node[ii]);
- }
- }
-}
-
-/**
- * Checks whether a node or any of its sub-nodes contains
- * a syntactic construct of the passed type.
- * @param {object} node - AST node to test.
- * @param {string} type - node type to lookup.
- */
-function containsChildOfType(node, type) {
- return containsChildMatching(node, function(node) {
- return node.type === type;
- });
-}
-
-function containsChildMatching(node, matcher) {
- var foundMatchingChild = false;
- function nodeTypeAnalyzer(node) {
- if (matcher(node) === true) {
- foundMatchingChild = true;
- return false;
- }
- }
- function nodeTypeTraverser(child, path, state) {
- if (!foundMatchingChild) {
- foundMatchingChild = containsChildMatching(child, matcher);
- }
- }
- analyzeAndTraverse(
- nodeTypeAnalyzer,
- nodeTypeTraverser,
- node,
- []
- );
- return foundMatchingChild;
-}
-
-var scopeTypes = {};
-scopeTypes[Syntax.ArrowFunctionExpression] = true;
-scopeTypes[Syntax.FunctionExpression] = true;
-scopeTypes[Syntax.FunctionDeclaration] = true;
-scopeTypes[Syntax.Program] = true;
-
-function getBoundaryNode(path) {
- for (var ii = 0; ii < path.length; ++ii) {
- if (scopeTypes[path[ii].type]) {
- return path[ii];
- }
- }
- throw new Error(
- 'Expected to find a node with one of the following types in path:\n' +
- JSON.stringify(Object.keys(scopeTypes))
- );
-}
-
-function getTempVar(tempVarIndex) {
- return '$__' + tempVarIndex;
-}
-
-function injectTempVar(state) {
- var tempVar = '$__' + (state.localScope.tempVarIndex++);
- state.localScope.tempVars.push(tempVar);
- return tempVar;
-}
-
-function injectTempVarDeclarations(state, index) {
- if (state.localScope.tempVars.length) {
- state.g.buffer =
- state.g.buffer.slice(0, index) +
- 'var ' + state.localScope.tempVars.join(', ') + ';' +
- state.g.buffer.slice(index);
- state.localScope.tempVars = [];
- }
-}
-
-exports.analyzeAndTraverse = analyzeAndTraverse;
-exports.append = append;
-exports.catchup = catchup;
-exports.catchupNewlines = catchupNewlines;
-exports.catchupWhiteOut = catchupWhiteOut;
-exports.catchupWhiteSpace = catchupWhiteSpace;
-exports.containsChildMatching = containsChildMatching;
-exports.containsChildOfType = containsChildOfType;
-exports.createState = createState;
-exports.declareIdentInLocalScope = declareIdentInLocalScope;
-exports.getBoundaryNode = getBoundaryNode;
-exports.getDocblock = getDocblock;
-exports.getLexicalBindingMetadata = getLexicalBindingMetadata;
-exports.getLocalBindingMetadata = getLocalBindingMetadata;
-exports.getNextSyntacticCharOffset = getNextSyntacticCharOffset;
-exports.getNodeSourceText = getNodeSourceText;
-exports.getOrderedChildren = getOrderedChildren;
-exports.getTempVar = getTempVar;
-exports.identInLocalScope = identInLocalScope;
-exports.identWithinLexicalScope = identWithinLexicalScope;
-exports.indentBefore = indentBefore;
-exports.initScopeMetadata = initScopeMetadata;
-exports.injectTempVar = injectTempVar;
-exports.injectTempVarDeclarations = injectTempVarDeclarations;
-exports.move = move;
-exports.scopeTypes = scopeTypes;
-exports.updateIndent = updateIndent;
-exports.updateState = updateState;
-
-},{"./docblock":21,"esprima-fb":9}],24:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*global exports:true*/
-
-/**
- * Desugars ES6 Arrow functions to ES3 function expressions.
- * If the function contains `this` expression -- automatically
- * binds the function to current value of `this`.
- *
- * Single parameter, simple expression:
- *
- * [1, 2, 3].map(x => x * x);
- *
- * [1, 2, 3].map(function(x) { return x * x; });
- *
- * Several parameters, complex block:
- *
- * this.users.forEach((user, idx) => {
- * return this.isActive(idx) && this.send(user);
- * });
- *
- * this.users.forEach(function(user, idx) {
- * return this.isActive(idx) && this.send(user);
- * }.bind(this));
- *
- */
-var restParamVisitors = _dereq_('./es6-rest-param-visitors');
-var destructuringVisitors = _dereq_('./es6-destructuring-visitors');
-
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-
-/**
- * @public
- */
-function visitArrowFunction(traverse, node, path, state) {
- var notInExpression = (path[0].type === Syntax.ExpressionStatement);
-
- // Wrap a function into a grouping operator, if it's not
- // in the expression position.
- if (notInExpression) {
- utils.append('(', state);
- }
-
- utils.append('function', state);
- renderParams(traverse, node, path, state);
-
- // Skip arrow.
- utils.catchupWhiteSpace(node.body.range[0], state);
-
- var renderBody = node.body.type == Syntax.BlockStatement
- ? renderStatementBody
- : renderExpressionBody;
-
- path.unshift(node);
- renderBody(traverse, node, path, state);
- path.shift();
-
- // Bind the function only if `this` value is used
- // inside it or inside any sub-expression.
- var containsBindingSyntax =
- utils.containsChildMatching(node.body, function(node) {
- return node.type === Syntax.ThisExpression
- || (node.type === Syntax.Identifier
- && node.name === "super");
- });
-
- if (containsBindingSyntax) {
- utils.append('.bind(this)', state);
- }
-
- utils.catchupWhiteSpace(node.range[1], state);
-
- // Close wrapper if not in the expression.
- if (notInExpression) {
- utils.append(')', state);
- }
-
- return false;
-}
-
-function renderParams(traverse, node, path, state) {
- // To preserve inline typechecking directives, we
- // distinguish between parens-free and paranthesized single param.
- if (isParensFreeSingleParam(node, state) || !node.params.length) {
- utils.append('(', state);
- }
- if (node.params.length !== 0) {
- path.unshift(node);
- traverse(node.params, path, state);
- path.unshift();
- }
- utils.append(')', state);
-}
-
-function isParensFreeSingleParam(node, state) {
- return node.params.length === 1 &&
- state.g.source[state.g.position] !== '(';
-}
-
-function renderExpressionBody(traverse, node, path, state) {
- // Wrap simple expression bodies into a block
- // with explicit return statement.
- utils.append('{', state);
-
- // Special handling of rest param.
- if (node.rest) {
- utils.append(
- restParamVisitors.renderRestParamSetup(node, state),
- state
- );
- }
-
- // Special handling of destructured params.
- destructuringVisitors.renderDestructuredComponents(
- node,
- utils.updateState(state, {
- localScope: {
- parentNode: state.parentNode,
- parentScope: state.parentScope,
- identifiers: state.identifiers,
- tempVarIndex: 0
- }
- })
- );
-
- utils.append('return ', state);
- renderStatementBody(traverse, node, path, state);
- utils.append(';}', state);
-}
-
-function renderStatementBody(traverse, node, path, state) {
- traverse(node.body, path, state);
- utils.catchup(node.body.range[1], state);
-}
-
-visitArrowFunction.test = function(node, path, state) {
- return node.type === Syntax.ArrowFunctionExpression;
-};
-
-exports.visitorList = [
- visitArrowFunction
-];
-
-
-},{"../src/utils":23,"./es6-destructuring-visitors":27,"./es6-rest-param-visitors":30,"esprima-fb":9}],25:[function(_dereq_,module,exports){
-/**
- * Copyright 2004-present Facebook. All Rights Reserved.
- */
-/*global exports:true*/
-
-/**
- * Implements ES6 call spread.
- *
- * instance.method(a, b, c, ...d)
- *
- * instance.method.apply(instance, [a, b, c].concat(d))
- *
- */
-
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-
-function process(traverse, node, path, state) {
- utils.move(node.range[0], state);
- traverse(node, path, state);
- utils.catchup(node.range[1], state);
-}
-
-function visitCallSpread(traverse, node, path, state) {
- utils.catchup(node.range[0], state);
-
- if (node.type === Syntax.NewExpression) {
- // Input = new Set(1, 2, ...list)
- // Output = new (Function.prototype.bind.apply(Set, [null, 1, 2].concat(list)))
- utils.append('new (Function.prototype.bind.apply(', state);
- process(traverse, node.callee, path, state);
- } else if (node.callee.type === Syntax.MemberExpression) {
- // Input = get().fn(1, 2, ...more)
- // Output = (_ = get()).fn.apply(_, [1, 2].apply(more))
- var tempVar = utils.injectTempVar(state);
- utils.append('(' + tempVar + ' = ', state);
- process(traverse, node.callee.object, path, state);
- utils.append(')', state);
- if (node.callee.property.type === Syntax.Identifier) {
- utils.append('.', state);
- process(traverse, node.callee.property, path, state);
- } else {
- utils.append('[', state);
- process(traverse, node.callee.property, path, state);
- utils.append(']', state);
- }
- utils.append('.apply(' + tempVar, state);
- } else {
- // Input = max(1, 2, ...list)
- // Output = max.apply(null, [1, 2].concat(list))
- var needsToBeWrappedInParenthesis =
- node.callee.type === Syntax.FunctionDeclaration ||
- node.callee.type === Syntax.FunctionExpression;
- if (needsToBeWrappedInParenthesis) {
- utils.append('(', state);
- }
- process(traverse, node.callee, path, state);
- if (needsToBeWrappedInParenthesis) {
- utils.append(')', state);
- }
- utils.append('.apply(null', state);
- }
- utils.append(', ', state);
-
- var args = node.arguments.slice();
- var spread = args.pop();
- if (args.length || node.type === Syntax.NewExpression) {
- utils.append('[', state);
- if (node.type === Syntax.NewExpression) {
- utils.append('null' + (args.length ? ', ' : ''), state);
- }
- while (args.length) {
- var arg = args.shift();
- utils.move(arg.range[0], state);
- traverse(arg, path, state);
- if (args.length) {
- utils.catchup(args[0].range[0], state);
- } else {
- utils.catchup(arg.range[1], state);
- }
- }
- utils.append('].concat(', state);
- process(traverse, spread.argument, path, state);
- utils.append(')', state);
- } else {
- process(traverse, spread.argument, path, state);
- }
- utils.append(node.type === Syntax.NewExpression ? '))' : ')', state);
-
- utils.move(node.range[1], state);
- return false;
-}
-
-visitCallSpread.test = function(node, path, state) {
- return (
- (
- node.type === Syntax.CallExpression ||
- node.type === Syntax.NewExpression
- ) &&
- node.arguments.length > 0 &&
- node.arguments[node.arguments.length - 1].type === Syntax.SpreadElement
- );
-};
-
-exports.visitorList = [
- visitCallSpread
-];
-
-},{"../src/utils":23,"esprima-fb":9}],26:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*jslint node:true*/
-
-/**
- * @typechecks
- */
-'use strict';
-
-var base62 = _dereq_('base62');
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-var reservedWordsHelper = _dereq_('./reserved-words-helper');
-
-var declareIdentInLocalScope = utils.declareIdentInLocalScope;
-var initScopeMetadata = utils.initScopeMetadata;
-
-var SUPER_PROTO_IDENT_PREFIX = '____SuperProtoOf';
-
-var _anonClassUUIDCounter = 0;
-var _mungedSymbolMaps = {};
-
-function resetSymbols() {
- _anonClassUUIDCounter = 0;
- _mungedSymbolMaps = {};
-}
-
-/**
- * Used to generate a unique class for use with code-gens for anonymous class
- * expressions.
- *
- * @param {object} state
- * @return {string}
- */
-function _generateAnonymousClassName(state) {
- var mungeNamespace = state.mungeNamespace || '';
- return '____Class' + mungeNamespace + base62.encode(_anonClassUUIDCounter++);
-}
-
-/**
- * Given an identifier name, munge it using the current state's mungeNamespace.
- *
- * @param {string} identName
- * @param {object} state
- * @return {string}
- */
-function _getMungedName(identName, state) {
- var mungeNamespace = state.mungeNamespace;
- var shouldMinify = state.g.opts.minify;
-
- if (shouldMinify) {
- if (!_mungedSymbolMaps[mungeNamespace]) {
- _mungedSymbolMaps[mungeNamespace] = {
- symbolMap: {},
- identUUIDCounter: 0
- };
- }
-
- var symbolMap = _mungedSymbolMaps[mungeNamespace].symbolMap;
- if (!symbolMap[identName]) {
- symbolMap[identName] =
- base62.encode(_mungedSymbolMaps[mungeNamespace].identUUIDCounter++);
- }
- identName = symbolMap[identName];
- }
- return '$' + mungeNamespace + identName;
-}
-
-/**
- * Extracts super class information from a class node.
- *
- * Information includes name of the super class and/or the expression string
- * (if extending from an expression)
- *
- * @param {object} node
- * @param {object} state
- * @return {object}
- */
-function _getSuperClassInfo(node, state) {
- var ret = {
- name: null,
- expression: null
- };
- if (node.superClass) {
- if (node.superClass.type === Syntax.Identifier) {
- ret.name = node.superClass.name;
- } else {
- // Extension from an expression
- ret.name = _generateAnonymousClassName(state);
- ret.expression = state.g.source.substring(
- node.superClass.range[0],
- node.superClass.range[1]
- );
- }
- }
- return ret;
-}
-
-/**
- * Used with .filter() to find the constructor method in a list of
- * MethodDefinition nodes.
- *
- * @param {object} classElement
- * @return {boolean}
- */
-function _isConstructorMethod(classElement) {
- return classElement.type === Syntax.MethodDefinition &&
- classElement.key.type === Syntax.Identifier &&
- classElement.key.name === 'constructor';
-}
-
-/**
- * @param {object} node
- * @param {object} state
- * @return {boolean}
- */
-function _shouldMungeIdentifier(node, state) {
- return (
- !!state.methodFuncNode &&
- !utils.getDocblock(state).hasOwnProperty('preventMunge') &&
- /^_(?!_)/.test(node.name)
- );
-}
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function visitClassMethod(traverse, node, path, state) {
- if (!state.g.opts.es5 && (node.kind === 'get' || node.kind === 'set')) {
- throw new Error(
- 'This transform does not support ' + node.kind + 'ter methods for ES6 ' +
- 'classes. (line: ' + node.loc.start.line + ', col: ' +
- node.loc.start.column + ')'
- );
- }
- state = utils.updateState(state, {
- methodNode: node
- });
- utils.catchup(node.range[0], state);
- path.unshift(node);
- traverse(node.value, path, state);
- path.shift();
- return false;
-}
-visitClassMethod.test = function(node, path, state) {
- return node.type === Syntax.MethodDefinition;
-};
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function visitClassFunctionExpression(traverse, node, path, state) {
- var methodNode = path[0];
- var isGetter = methodNode.kind === 'get';
- var isSetter = methodNode.kind === 'set';
-
- state = utils.updateState(state, {
- methodFuncNode: node
- });
-
- if (methodNode.key.name === 'constructor') {
- utils.append('function ' + state.className, state);
- } else {
- var methodAccessorComputed = false;
- var methodAccessor;
- var prototypeOrStatic = methodNode["static"] ? '' : '.prototype';
- var objectAccessor = state.className + prototypeOrStatic;
-
- if (methodNode.key.type === Syntax.Identifier) {
- // foo() {}
- methodAccessor = methodNode.key.name;
- if (_shouldMungeIdentifier(methodNode.key, state)) {
- methodAccessor = _getMungedName(methodAccessor, state);
- }
- if (isGetter || isSetter) {
- methodAccessor = JSON.stringify(methodAccessor);
- } else if (reservedWordsHelper.isReservedWord(methodAccessor)) {
- methodAccessorComputed = true;
- methodAccessor = JSON.stringify(methodAccessor);
- }
- } else if (methodNode.key.type === Syntax.Literal) {
- // 'foo bar'() {} | get 'foo bar'() {} | set 'foo bar'() {}
- methodAccessor = JSON.stringify(methodNode.key.value);
- methodAccessorComputed = true;
- }
-
- if (isSetter || isGetter) {
- utils.append(
- 'Object.defineProperty(' +
- objectAccessor + ',' +
- methodAccessor + ',' +
- '{configurable:true,' +
- methodNode.kind + ':function',
- state
- );
- } else {
- if (state.g.opts.es3) {
- if (methodAccessorComputed) {
- methodAccessor = '[' + methodAccessor + ']';
- } else {
- methodAccessor = '.' + methodAccessor;
- }
- utils.append(
- objectAccessor +
- methodAccessor + '=function' + (node.generator ? '*' : ''),
- state
- );
- } else {
- if (!methodAccessorComputed) {
- methodAccessor = JSON.stringify(methodAccessor);
- }
- utils.append(
- 'Object.defineProperty(' +
- objectAccessor + ',' +
- methodAccessor + ',' +
- '{writable:true,configurable:true,' +
- 'value:function' + (node.generator ? '*' : ''),
- state
- );
- }
- }
- }
- utils.move(methodNode.key.range[1], state);
- utils.append('(', state);
-
- var params = node.params;
- if (params.length > 0) {
- utils.catchupNewlines(params[0].range[0], state);
- for (var i = 0; i < params.length; i++) {
- utils.catchup(node.params[i].range[0], state);
- path.unshift(node);
- traverse(params[i], path, state);
- path.shift();
- }
- }
-
- var closingParenPosition = utils.getNextSyntacticCharOffset(')', state);
- utils.catchupWhiteSpace(closingParenPosition, state);
-
- var openingBracketPosition = utils.getNextSyntacticCharOffset('{', state);
- utils.catchup(openingBracketPosition + 1, state);
-
- if (!state.scopeIsStrict) {
- utils.append('"use strict";', state);
- state = utils.updateState(state, {
- scopeIsStrict: true
- });
- }
- utils.move(node.body.range[0] + '{'.length, state);
-
- path.unshift(node);
- traverse(node.body, path, state);
- path.shift();
- utils.catchup(node.body.range[1], state);
-
- if (methodNode.key.name !== 'constructor') {
- if (isGetter || isSetter || !state.g.opts.es3) {
- utils.append('})', state);
- }
- utils.append(';', state);
- }
- return false;
-}
-visitClassFunctionExpression.test = function(node, path, state) {
- return node.type === Syntax.FunctionExpression
- && path[0].type === Syntax.MethodDefinition;
-};
-
-function visitClassMethodParam(traverse, node, path, state) {
- var paramName = node.name;
- if (_shouldMungeIdentifier(node, state)) {
- paramName = _getMungedName(node.name, state);
- }
- utils.append(paramName, state);
- utils.move(node.range[1], state);
-}
-visitClassMethodParam.test = function(node, path, state) {
- if (!path[0] || !path[1]) {
- return;
- }
-
- var parentFuncExpr = path[0];
- var parentClassMethod = path[1];
-
- return parentFuncExpr.type === Syntax.FunctionExpression
- && parentClassMethod.type === Syntax.MethodDefinition
- && node.type === Syntax.Identifier;
-};
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function _renderClassBody(traverse, node, path, state) {
- var className = state.className;
- var superClass = state.superClass;
-
- // Set up prototype of constructor on same line as `extends` for line-number
- // preservation. This relies on function-hoisting if a constructor function is
- // defined in the class body.
- if (superClass.name) {
- // If the super class is an expression, we need to memoize the output of the
- // expression into the generated class name variable and use that to refer
- // to the super class going forward. Example:
- //
- // class Foo extends mixin(Bar, Baz) {}
- // --transforms to--
- // function Foo() {} var ____Class0Blah = mixin(Bar, Baz);
- if (superClass.expression !== null) {
- utils.append(
- 'var ' + superClass.name + '=' + superClass.expression + ';',
- state
- );
- }
-
- var keyName = superClass.name + '____Key';
- var keyNameDeclarator = '';
- if (!utils.identWithinLexicalScope(keyName, state)) {
- keyNameDeclarator = 'var ';
- declareIdentInLocalScope(keyName, initScopeMetadata(node), state);
- }
- utils.append(
- 'for(' + keyNameDeclarator + keyName + ' in ' + superClass.name + '){' +
- 'if(' + superClass.name + '.hasOwnProperty(' + keyName + ')){' +
- className + '[' + keyName + ']=' +
- superClass.name + '[' + keyName + '];' +
- '}' +
- '}',
- state
- );
-
- var superProtoIdentStr = SUPER_PROTO_IDENT_PREFIX + superClass.name;
- if (!utils.identWithinLexicalScope(superProtoIdentStr, state)) {
- utils.append(
- 'var ' + superProtoIdentStr + '=' + superClass.name + '===null?' +
- 'null:' + superClass.name + '.prototype;',
- state
- );
- declareIdentInLocalScope(superProtoIdentStr, initScopeMetadata(node), state);
- }
-
- utils.append(
- className + '.prototype=Object.create(' + superProtoIdentStr + ');',
- state
- );
- utils.append(
- className + '.prototype.constructor=' + className + ';',
- state
- );
- utils.append(
- className + '.__superConstructor__=' + superClass.name + ';',
- state
- );
- }
-
- // If there's no constructor method specified in the class body, create an
- // empty constructor function at the top (same line as the class keyword)
- if (!node.body.body.filter(_isConstructorMethod).pop()) {
- utils.append('function ' + className + '(){', state);
- if (!state.scopeIsStrict) {
- utils.append('"use strict";', state);
- }
- if (superClass.name) {
- utils.append(
- 'if(' + superClass.name + '!==null){' +
- superClass.name + '.apply(this,arguments);}',
- state
- );
- }
- utils.append('}', state);
- }
-
- utils.move(node.body.range[0] + '{'.length, state);
- traverse(node.body, path, state);
- utils.catchupWhiteSpace(node.range[1], state);
-}
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function visitClassDeclaration(traverse, node, path, state) {
- var className = node.id.name;
- var superClass = _getSuperClassInfo(node, state);
-
- state = utils.updateState(state, {
- mungeNamespace: className,
- className: className,
- superClass: superClass
- });
-
- _renderClassBody(traverse, node, path, state);
-
- return false;
-}
-visitClassDeclaration.test = function(node, path, state) {
- return node.type === Syntax.ClassDeclaration;
-};
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function visitClassExpression(traverse, node, path, state) {
- var className = node.id && node.id.name || _generateAnonymousClassName(state);
- var superClass = _getSuperClassInfo(node, state);
-
- utils.append('(function(){', state);
-
- state = utils.updateState(state, {
- mungeNamespace: className,
- className: className,
- superClass: superClass
- });
-
- _renderClassBody(traverse, node, path, state);
-
- utils.append('return ' + className + ';})()', state);
- return false;
-}
-visitClassExpression.test = function(node, path, state) {
- return node.type === Syntax.ClassExpression;
-};
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function visitPrivateIdentifier(traverse, node, path, state) {
- utils.append(_getMungedName(node.name, state), state);
- utils.move(node.range[1], state);
-}
-visitPrivateIdentifier.test = function(node, path, state) {
- if (node.type === Syntax.Identifier && _shouldMungeIdentifier(node, state)) {
- // Always munge non-computed properties of MemberExpressions
- // (a la preventing access of properties of unowned objects)
- if (path[0].type === Syntax.MemberExpression && path[0].object !== node
- && path[0].computed === false) {
- return true;
- }
-
- // Always munge identifiers that were declared within the method function
- // scope
- if (utils.identWithinLexicalScope(node.name, state, state.methodFuncNode)) {
- return true;
- }
-
- // Always munge private keys on object literals defined within a method's
- // scope.
- if (path[0].type === Syntax.Property
- && path[1].type === Syntax.ObjectExpression) {
- return true;
- }
-
- // Always munge function parameters
- if (path[0].type === Syntax.FunctionExpression
- || path[0].type === Syntax.FunctionDeclaration
- || path[0].type === Syntax.ArrowFunctionExpression) {
- for (var i = 0; i < path[0].params.length; i++) {
- if (path[0].params[i] === node) {
- return true;
- }
- }
- }
- }
- return false;
-};
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function visitSuperCallExpression(traverse, node, path, state) {
- var superClassName = state.superClass.name;
-
- if (node.callee.type === Syntax.Identifier) {
- if (_isConstructorMethod(state.methodNode)) {
- utils.append(superClassName + '.call(', state);
- } else {
- var protoProp = SUPER_PROTO_IDENT_PREFIX + superClassName;
- if (state.methodNode.key.type === Syntax.Identifier) {
- protoProp += '.' + state.methodNode.key.name;
- } else if (state.methodNode.key.type === Syntax.Literal) {
- protoProp += '[' + JSON.stringify(state.methodNode.key.value) + ']';
- }
- utils.append(protoProp + ".call(", state);
- }
- utils.move(node.callee.range[1], state);
- } else if (node.callee.type === Syntax.MemberExpression) {
- utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state);
- utils.move(node.callee.object.range[1], state);
-
- if (node.callee.computed) {
- // ["a" + "b"]
- utils.catchup(node.callee.property.range[1] + ']'.length, state);
- } else {
- // .ab
- utils.append('.' + node.callee.property.name, state);
- }
-
- utils.append('.call(', state);
- utils.move(node.callee.range[1], state);
- }
-
- utils.append('this', state);
- if (node.arguments.length > 0) {
- utils.append(',', state);
- utils.catchupWhiteSpace(node.arguments[0].range[0], state);
- traverse(node.arguments, path, state);
- }
-
- utils.catchupWhiteSpace(node.range[1], state);
- utils.append(')', state);
- return false;
-}
-visitSuperCallExpression.test = function(node, path, state) {
- if (state.superClass && node.type === Syntax.CallExpression) {
- var callee = node.callee;
- if (callee.type === Syntax.Identifier && callee.name === 'super'
- || callee.type == Syntax.MemberExpression
- && callee.object.name === 'super') {
- return true;
- }
- }
- return false;
-};
-
-/**
- * @param {function} traverse
- * @param {object} node
- * @param {array} path
- * @param {object} state
- */
-function visitSuperMemberExpression(traverse, node, path, state) {
- var superClassName = state.superClass.name;
-
- utils.append(SUPER_PROTO_IDENT_PREFIX + superClassName, state);
- utils.move(node.object.range[1], state);
-}
-visitSuperMemberExpression.test = function(node, path, state) {
- return state.superClass
- && node.type === Syntax.MemberExpression
- && node.object.type === Syntax.Identifier
- && node.object.name === 'super';
-};
-
-exports.resetSymbols = resetSymbols;
-
-exports.visitorList = [
- visitClassDeclaration,
- visitClassExpression,
- visitClassFunctionExpression,
- visitClassMethod,
- visitClassMethodParam,
- visitPrivateIdentifier,
- visitSuperCallExpression,
- visitSuperMemberExpression
-];
-
-},{"../src/utils":23,"./reserved-words-helper":34,"base62":10,"esprima-fb":9}],27:[function(_dereq_,module,exports){
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*global exports:true*/
-
-/**
- * Implements ES6 destructuring assignment and pattern matchng.
- *
- * function init({port, ip, coords: [x, y]}) {
- * return (x && y) ? {id, port} : {ip};
- * };
- *
- * function init($__0) {
- * var
- * port = $__0.port,
- * ip = $__0.ip,
- * $__1 = $__0.coords,
- * x = $__1[0],
- * y = $__1[1];
- * return (x && y) ? {id, port} : {ip};
- * }
- *
- * var x, {ip, port} = init({ip, port});
- *
- * var x, $__0 = init({ip, port}), ip = $__0.ip, port = $__0.port;
- *
- */
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-
-var reservedWordsHelper = _dereq_('./reserved-words-helper');
-var restParamVisitors = _dereq_('./es6-rest-param-visitors');
-var restPropertyHelpers = _dereq_('./es7-rest-property-helpers');
-
-// -------------------------------------------------------
-// 1. Structured variable declarations.
-//
-// var [a, b] = [b, a];
-// var {x, y} = {y, x};
-// -------------------------------------------------------
-
-function visitStructuredVariable(traverse, node, path, state) {
- // Allocate new temp for the pattern.
- utils.append(utils.getTempVar(state.localScope.tempVarIndex) + '=', state);
- // Skip the pattern and assign the init to the temp.
- utils.catchupWhiteSpace(node.init.range[0], state);
- traverse(node.init, path, state);
- utils.catchup(node.init.range[1], state);
- // Render the destructured data.
- utils.append(',' + getDestructuredComponents(node.id, state), state);
- state.localScope.tempVarIndex++;
- return false;
-}
-
-visitStructuredVariable.test = function(node, path, state) {
- return node.type === Syntax.VariableDeclarator &&
- isStructuredPattern(node.id);
-};
-
-function isStructuredPattern(node) {
- return node.type === Syntax.ObjectPattern ||
- node.type === Syntax.ArrayPattern;
-}
-
-// Main function which does actual recursive destructuring
-// of nested complex structures.
-function getDestructuredComponents(node, state) {
- var tmpIndex = state.localScope.tempVarIndex;
- var components = [];
- var patternItems = getPatternItems(node);
-
- for (var idx = 0; idx < patternItems.length; idx++) {
- var item = patternItems[idx];
- if (!item) {
- continue;
- }
-
- if (item.type === Syntax.SpreadElement) {
- // Spread/rest of an array.
- // TODO(dmitrys): support spread in the middle of a pattern
- // and also for function param patterns: [x, ...xs, y]
- components.push(item.argument.name +
- '=Array.prototype.slice.call(' +
- utils.getTempVar(tmpIndex) + ',' + idx + ')'
- );
- continue;
- }
-
- if (item.type === Syntax.SpreadProperty) {
- var restExpression = restPropertyHelpers.renderRestExpression(
- utils.getTempVar(tmpIndex),
- patternItems
- );
- components.push(item.argument.name + '=' + restExpression);
- continue;
- }
-
- // Depending on pattern type (Array or Object), we get
- // corresponding pattern item parts.
- var accessor = getPatternItemAccessor(node, item, tmpIndex, idx);
- var value = getPatternItemValue(node, item);
-
- // TODO(dmitrys): implement default values: {x, y=5}
- if (value.type === Syntax.Identifier) {
- // Simple pattern item.
- components.push(value.name + '=' + accessor);
- } else {
- // Complex sub-structure.
- components.push(
- utils.getTempVar(++state.localScope.tempVarIndex) + '=' + accessor +
- ',' + getDestructuredComponents(value, state)
- );
- }
- }
-
- return components.join(',');
-}
-
-function getPatternItems(node) {
- return node.properties || node.elements;
-}
-
-function getPatternItemAccessor(node, patternItem, tmpIndex, idx) {
- var tmpName = utils.getTempVar(tmpIndex);
- if (node.type === Syntax.ObjectPattern) {
- if (reservedWordsHelper.isReservedWord(patternItem.key.name)) {
- return tmpName + '["' + patternItem.key.name + '"]';
- } else if (patternItem.key.type === Syntax.Literal) {
- return tmpName + '[' + JSON.stringify(patternItem.key.value) + ']';
- } else if (patternItem.key.type === Syntax.Identifier) {
- return tmpName + '.' + patternItem.key.name;
- }
- } else if (node.type === Syntax.ArrayPattern) {
- return tmpName + '[' + idx + ']';
- }
-}
-
-function getPatternItemValue(node, patternItem) {
- return node.type === Syntax.ObjectPattern
- ? patternItem.value
- : patternItem;
-}
-
-// -------------------------------------------------------
-// 2. Assignment expression.
-//
-// [a, b] = [b, a];
-// ({x, y} = {y, x});
-// -------------------------------------------------------
-
-function visitStructuredAssignment(traverse, node, path, state) {
- var exprNode = node.expression;
- utils.append('var ' + utils.getTempVar(state.localScope.tempVarIndex) + '=', state);
-
- utils.catchupWhiteSpace(exprNode.right.range[0], state);
- traverse(exprNode.right, path, state);
- utils.catchup(exprNode.right.range[1], state);
-
- utils.append(
- ';' + getDestructuredComponents(exprNode.left, state) + ';',
- state
- );
-
- utils.catchupWhiteSpace(node.range[1], state);
- state.localScope.tempVarIndex++;
- return false;
-}
-
-visitStructuredAssignment.test = function(node, path, state) {
- // We consider the expression statement rather than just assignment
- // expression to cover case with object patters which should be
- // wrapped in grouping operator: ({x, y} = {y, x});
- return node.type === Syntax.ExpressionStatement &&
- node.expression.type === Syntax.AssignmentExpression &&
- isStructuredPattern(node.expression.left);
-};
-
-// -------------------------------------------------------
-// 3. Structured parameter.
-//
-// function foo({x, y}) { ... }
-// -------------------------------------------------------
-
-function visitStructuredParameter(traverse, node, path, state) {
- utils.append(utils.getTempVar(getParamIndex(node, path)), state);
- utils.catchupWhiteSpace(node.range[1], state);
- return true;
-}
-
-function getParamIndex(paramNode, path) {
- var funcNode = path[0];
- var tmpIndex = 0;
- for (var k = 0; k < funcNode.params.length; k++) {
- var param = funcNode.params[k];
- if (param === paramNode) {
- break;
- }
- if (isStructuredPattern(param)) {
- tmpIndex++;
- }
- }
- return tmpIndex;
-}
-
-visitStructuredParameter.test = function(node, path, state) {
- return isStructuredPattern(node) && isFunctionNode(path[0]);
-};
-
-function isFunctionNode(node) {
- return (node.type == Syntax.FunctionDeclaration ||
- node.type == Syntax.FunctionExpression ||
- node.type == Syntax.MethodDefinition ||
- node.type == Syntax.ArrowFunctionExpression);
-}
-
-// -------------------------------------------------------
-// 4. Function body for structured parameters.
-//
-// function foo({x, y}) { x; y; }
-// -------------------------------------------------------
-
-function visitFunctionBodyForStructuredParameter(traverse, node, path, state) {
- var funcNode = path[0];
-
- utils.catchup(funcNode.body.range[0] + 1, state);
- renderDestructuredComponents(funcNode, state);
-
- if (funcNode.rest) {
- utils.append(
- restParamVisitors.renderRestParamSetup(funcNode, state),
- state
- );
- }
-
- return true;
-}
-
-function renderDestructuredComponents(funcNode, state) {
- var destructuredComponents = [];
-
- for (var k = 0; k < funcNode.params.length; k++) {
- var param = funcNode.params[k];
- if (isStructuredPattern(param)) {
- destructuredComponents.push(
- getDestructuredComponents(param, state)
- );
- state.localScope.tempVarIndex++;
- }
- }
-
- if (destructuredComponents.length) {
- utils.append('var ' + destructuredComponents.join(',') + ';', state);
- }
-}
-
-visitFunctionBodyForStructuredParameter.test = function(node, path, state) {
- return node.type === Syntax.BlockStatement && isFunctionNode(path[0]);
-};
-
-exports.visitorList = [
- visitStructuredVariable,
- visitStructuredAssignment,
- visitStructuredParameter,
- visitFunctionBodyForStructuredParameter
-];
-
-exports.renderDestructuredComponents = renderDestructuredComponents;
-
-
-},{"../src/utils":23,"./es6-rest-param-visitors":30,"./es7-rest-property-helpers":32,"./reserved-words-helper":34,"esprima-fb":9}],28:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*jslint node:true*/
-
-/**
- * Desugars concise methods of objects to function expressions.
- *
- * var foo = {
- * method(x, y) { ... }
- * };
- *
- * var foo = {
- * method: function(x, y) { ... }
- * };
- *
- */
-
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-var reservedWordsHelper = _dereq_('./reserved-words-helper');
-
-function visitObjectConciseMethod(traverse, node, path, state) {
- var isGenerator = node.value.generator;
- if (isGenerator) {
- utils.catchupWhiteSpace(node.range[0] + 1, state);
- }
- if (node.computed) { // [<expr>]() { ...}
- utils.catchup(node.key.range[1] + 1, state);
- } else if (reservedWordsHelper.isReservedWord(node.key.name)) {
- utils.catchup(node.key.range[0], state);
- utils.append('"', state);
- utils.catchup(node.key.range[1], state);
- utils.append('"', state);
- }
-
- utils.catchup(node.key.range[1], state);
- utils.append(
- ':function' + (isGenerator ? '*' : ''),
- state
- );
- path.unshift(node);
- traverse(node.value, path, state);
- path.shift();
- return false;
-}
-
-visitObjectConciseMethod.test = function(node, path, state) {
- return node.type === Syntax.Property &&
- node.value.type === Syntax.FunctionExpression &&
- node.method === true;
-};
-
-exports.visitorList = [
- visitObjectConciseMethod
-];
-
-},{"../src/utils":23,"./reserved-words-helper":34,"esprima-fb":9}],29:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*jslint node: true*/
-
-/**
- * Desugars ES6 Object Literal short notations into ES3 full notation.
- *
- * // Easier return values.
- * function foo(x, y) {
- * return {x, y}; // {x: x, y: y}
- * };
- *
- * // Destructuring.
- * function init({port, ip, coords: {x, y}}) { ... }
- *
- */
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-
-/**
- * @public
- */
-function visitObjectLiteralShortNotation(traverse, node, path, state) {
- utils.catchup(node.key.range[1], state);
- utils.append(':' + node.key.name, state);
- return false;
-}
-
-visitObjectLiteralShortNotation.test = function(node, path, state) {
- return node.type === Syntax.Property &&
- node.kind === 'init' &&
- node.shorthand === true &&
- path[0].type !== Syntax.ObjectPattern;
-};
-
-exports.visitorList = [
- visitObjectLiteralShortNotation
-];
-
-
-},{"../src/utils":23,"esprima-fb":9}],30:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*jslint node:true*/
-
-/**
- * Desugars ES6 rest parameters into an ES3 arguments array.
- *
- * function printf(template, ...args) {
- * args.forEach(...);
- * }
- *
- * We could use `Array.prototype.slice.call`, but that usage of arguments causes
- * functions to be deoptimized in V8, so instead we use a for-loop.
- *
- * function printf(template) {
- * for (var args = [], $__0 = 1, $__1 = arguments.length; $__0 < $__1; $__0++)
- * args.push(arguments[$__0]);
- * args.forEach(...);
- * }
- *
- */
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-
-
-
-function _nodeIsFunctionWithRestParam(node) {
- return (node.type === Syntax.FunctionDeclaration
- || node.type === Syntax.FunctionExpression
- || node.type === Syntax.ArrowFunctionExpression)
- && node.rest;
-}
-
-function visitFunctionParamsWithRestParam(traverse, node, path, state) {
- if (node.parametricType) {
- utils.catchup(node.parametricType.range[0], state);
- path.unshift(node);
- traverse(node.parametricType, path, state);
- path.shift();
- }
-
- // Render params.
- if (node.params.length) {
- path.unshift(node);
- traverse(node.params, path, state);
- path.shift();
- } else {
- // -3 is for ... of the rest.
- utils.catchup(node.rest.range[0] - 3, state);
- }
- utils.catchupWhiteSpace(node.rest.range[1], state);
-
- path.unshift(node);
- traverse(node.body, path, state);
- path.shift();
-
- return false;
-}
-
-visitFunctionParamsWithRestParam.test = function(node, path, state) {
- return _nodeIsFunctionWithRestParam(node);
-};
-
-function renderRestParamSetup(functionNode, state) {
- var idx = state.localScope.tempVarIndex++;
- var len = state.localScope.tempVarIndex++;
-
- return 'for (var ' + functionNode.rest.name + '=[],' +
- utils.getTempVar(idx) + '=' + functionNode.params.length + ',' +
- utils.getTempVar(len) + '=arguments.length;' +
- utils.getTempVar(idx) + '<' + utils.getTempVar(len) + ';' +
- utils.getTempVar(idx) + '++) ' +
- functionNode.rest.name + '.push(arguments[' + utils.getTempVar(idx) + ']);';
-}
-
-function visitFunctionBodyWithRestParam(traverse, node, path, state) {
- utils.catchup(node.range[0] + 1, state);
- var parentNode = path[0];
- utils.append(renderRestParamSetup(parentNode, state), state);
- return true;
-}
-
-visitFunctionBodyWithRestParam.test = function(node, path, state) {
- return node.type === Syntax.BlockStatement
- && _nodeIsFunctionWithRestParam(path[0]);
-};
-
-exports.renderRestParamSetup = renderRestParamSetup;
-exports.visitorList = [
- visitFunctionParamsWithRestParam,
- visitFunctionBodyWithRestParam
-];
-
-},{"../src/utils":23,"esprima-fb":9}],31:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*jslint node:true*/
-
-/**
- * @typechecks
- */
-'use strict';
-
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-
-/**
- * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.1.9
- */
-function visitTemplateLiteral(traverse, node, path, state) {
- var templateElements = node.quasis;
-
- utils.append('(', state);
- for (var ii = 0; ii < templateElements.length; ii++) {
- var templateElement = templateElements[ii];
- if (templateElement.value.raw !== '') {
- utils.append(getCookedValue(templateElement), state);
- if (!templateElement.tail) {
- // + between element and substitution
- utils.append(' + ', state);
- }
- // maintain line numbers
- utils.move(templateElement.range[0], state);
- utils.catchupNewlines(templateElement.range[1], state);
- } else { // templateElement.value.raw === ''
- // Concatenat adjacent substitutions, e.g. `${x}${y}`. Empty templates
- // appear before the first and after the last element - nothing to add in
- // those cases.
- if (ii > 0 && !templateElement.tail) {
- // + between substitution and substitution
- utils.append(' + ', state);
- }
- }
-
- utils.move(templateElement.range[1], state);
- if (!templateElement.tail) {
- var substitution = node.expressions[ii];
- if (substitution.type === Syntax.Identifier ||
- substitution.type === Syntax.MemberExpression ||
- substitution.type === Syntax.CallExpression) {
- utils.catchup(substitution.range[1], state);
- } else {
- utils.append('(', state);
- traverse(substitution, path, state);
- utils.catchup(substitution.range[1], state);
- utils.append(')', state);
- }
- // if next templateElement isn't empty...
- if (templateElements[ii + 1].value.cooked !== '') {
- utils.append(' + ', state);
- }
- }
- }
- utils.move(node.range[1], state);
- utils.append(')', state);
- return false;
-}
-
-visitTemplateLiteral.test = function(node, path, state) {
- return node.type === Syntax.TemplateLiteral;
-};
-
-/**
- * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.2.6
- */
-function visitTaggedTemplateExpression(traverse, node, path, state) {
- var template = node.quasi;
- var numQuasis = template.quasis.length;
-
- // print the tag
- utils.move(node.tag.range[0], state);
- traverse(node.tag, path, state);
- utils.catchup(node.tag.range[1], state);
-
- // print array of template elements
- utils.append('(function() { var siteObj = [', state);
- for (var ii = 0; ii < numQuasis; ii++) {
- utils.append(getCookedValue(template.quasis[ii]), state);
- if (ii !== numQuasis - 1) {
- utils.append(', ', state);
- }
- }
- utils.append(']; siteObj.raw = [', state);
- for (ii = 0; ii < numQuasis; ii++) {
- utils.append(getRawValue(template.quasis[ii]), state);
- if (ii !== numQuasis - 1) {
- utils.append(', ', state);
- }
- }
- utils.append(
- ']; Object.freeze(siteObj.raw); Object.freeze(siteObj); return siteObj; }()',
- state
- );
-
- // print substitutions
- if (numQuasis > 1) {
- for (ii = 0; ii < template.expressions.length; ii++) {
- var expression = template.expressions[ii];
- utils.append(', ', state);
-
- // maintain line numbers by calling catchupWhiteSpace over the whole
- // previous TemplateElement
- utils.move(template.quasis[ii].range[0], state);
- utils.catchupNewlines(template.quasis[ii].range[1], state);
-
- utils.move(expression.range[0], state);
- traverse(expression, path, state);
- utils.catchup(expression.range[1], state);
- }
- }
-
- // print blank lines to push the closing ) down to account for the final
- // TemplateElement.
- utils.catchupNewlines(node.range[1], state);
-
- utils.append(')', state);
-
- return false;
-}
-
-visitTaggedTemplateExpression.test = function(node, path, state) {
- return node.type === Syntax.TaggedTemplateExpression;
-};
-
-function getCookedValue(templateElement) {
- return JSON.stringify(templateElement.value.cooked);
-}
-
-function getRawValue(templateElement) {
- return JSON.stringify(templateElement.value.raw);
-}
-
-exports.visitorList = [
- visitTemplateLiteral,
- visitTaggedTemplateExpression
-];
-
-},{"../src/utils":23,"esprima-fb":9}],32:[function(_dereq_,module,exports){
-/**
- * Copyright 2013 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*jslint node:true*/
-
-/**
- * Desugars ES7 rest properties into ES5 object iteration.
- */
-
-var Syntax = _dereq_('esprima-fb').Syntax;
-
-// TODO: This is a pretty massive helper, it should only be defined once, in the
-// transform's runtime environment. We don't currently have a runtime though.
-var restFunction =
- '(function(source, exclusion) {' +
- 'var rest = {};' +
- 'var hasOwn = Object.prototype.hasOwnProperty;' +
- 'if (source == null) {' +
- 'throw new TypeError();' +
- '}' +
- 'for (var key in source) {' +
- 'if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {' +
- 'rest[key] = source[key];' +
- '}' +
- '}' +
- 'return rest;' +
- '})';
-
-function getPropertyNames(properties) {
- var names = [];
- for (var i = 0; i < properties.length; i++) {
- var property = properties[i];
- if (property.type === Syntax.SpreadProperty) {
- continue;
- }
- if (property.type === Syntax.Identifier) {
- names.push(property.name);
- } else {
- names.push(property.key.name);
- }
- }
- return names;
-}
-
-function getRestFunctionCall(source, exclusion) {
- return restFunction + '(' + source + ',' + exclusion + ')';
-}
-
-function getSimpleShallowCopy(accessorExpression) {
- // This could be faster with 'Object.assign({}, ' + accessorExpression + ')'
- // but to unify code paths and avoid a ES6 dependency we use the same
- // helper as for the exclusion case.
- return getRestFunctionCall(accessorExpression, '{}');
-}
-
-function renderRestExpression(accessorExpression, excludedProperties) {
- var excludedNames = getPropertyNames(excludedProperties);
- if (!excludedNames.length) {
- return getSimpleShallowCopy(accessorExpression);
- }
- return getRestFunctionCall(
- accessorExpression,
- '{' + excludedNames.join(':1,') + ':1}'
- );
-}
-
-exports.renderRestExpression = renderRestExpression;
-
-},{"esprima-fb":9}],33:[function(_dereq_,module,exports){
-/**
- * Copyright 2004-present Facebook. All Rights Reserved.
- */
-/*global exports:true*/
-
-/**
- * Implements ES7 object spread property.
- * https://gist.github.com/sebmarkbage/aa849c7973cb4452c547
- *
- * { ...a, x: 1 }
- *
- * Object.assign({}, a, {x: 1 })
- *
- */
-
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-
-function visitObjectLiteralSpread(traverse, node, path, state) {
- utils.catchup(node.range[0], state);
-
- utils.append('Object.assign({', state);
-
- // Skip the original {
- utils.move(node.range[0] + 1, state);
-
- var previousWasSpread = false;
-
- for (var i = 0; i < node.properties.length; i++) {
- var property = node.properties[i];
- if (property.type === Syntax.SpreadProperty) {
-
- // Close the previous object or initial object
- if (!previousWasSpread) {
- utils.append('}', state);
- }
-
- if (i === 0) {
- // Normally there will be a comma when we catch up, but not before
- // the first property.
- utils.append(',', state);
- }
-
- utils.catchup(property.range[0], state);
-
- // skip ...
- utils.move(property.range[0] + 3, state);
-
- traverse(property.argument, path, state);
-
- utils.catchup(property.range[1], state);
-
- previousWasSpread = true;
-
- } else {
-
- utils.catchup(property.range[0], state);
-
- if (previousWasSpread) {
- utils.append('{', state);
- }
-
- traverse(property, path, state);
-
- utils.catchup(property.range[1], state);
-
- previousWasSpread = false;
-
- }
- }
-
- // Strip any non-whitespace between the last item and the end.
- // We only catch up on whitespace so that we ignore any trailing commas which
- // are stripped out for IE8 support. Unfortunately, this also strips out any
- // trailing comments.
- utils.catchupWhiteSpace(node.range[1] - 1, state);
-
- // Skip the trailing }
- utils.move(node.range[1], state);
-
- if (!previousWasSpread) {
- utils.append('}', state);
- }
-
- utils.append(')', state);
- return false;
-}
-
-visitObjectLiteralSpread.test = function(node, path, state) {
- if (node.type !== Syntax.ObjectExpression) {
- return false;
- }
- // Tight loop optimization
- var hasAtLeastOneSpreadProperty = false;
- for (var i = 0; i < node.properties.length; i++) {
- var property = node.properties[i];
- if (property.type === Syntax.SpreadProperty) {
- hasAtLeastOneSpreadProperty = true;
- } else if (property.kind !== 'init') {
- return false;
- }
- }
- return hasAtLeastOneSpreadProperty;
-};
-
-exports.visitorList = [
- visitObjectLiteralSpread
-];
-
-},{"../src/utils":23,"esprima-fb":9}],34:[function(_dereq_,module,exports){
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var KEYWORDS = [
- 'break', 'do', 'in', 'typeof', 'case', 'else', 'instanceof', 'var', 'catch',
- 'export', 'new', 'void', 'class', 'extends', 'return', 'while', 'const',
- 'finally', 'super', 'with', 'continue', 'for', 'switch', 'yield', 'debugger',
- 'function', 'this', 'default', 'if', 'throw', 'delete', 'import', 'try'
-];
-
-var FUTURE_RESERVED_WORDS = [
- 'enum', 'await', 'implements', 'package', 'protected', 'static', 'interface',
- 'private', 'public'
-];
-
-var LITERALS = [
- 'null',
- 'true',
- 'false'
-];
-
-// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-reserved-words
-var RESERVED_WORDS = [].concat(
- KEYWORDS,
- FUTURE_RESERVED_WORDS,
- LITERALS
-);
-
-var reservedWordsMap = Object.create(null);
-RESERVED_WORDS.forEach(function(k) {
- reservedWordsMap[k] = true;
-});
-
-/**
- * This list should not grow as new reserved words are introdued. This list is
- * of words that need to be quoted because ES3-ish browsers do not allow their
- * use as identifier names.
- */
-var ES3_FUTURE_RESERVED_WORDS = [
- 'enum', 'implements', 'package', 'protected', 'static', 'interface',
- 'private', 'public'
-];
-
-var ES3_RESERVED_WORDS = [].concat(
- KEYWORDS,
- ES3_FUTURE_RESERVED_WORDS,
- LITERALS
-);
-
-var es3ReservedWordsMap = Object.create(null);
-ES3_RESERVED_WORDS.forEach(function(k) {
- es3ReservedWordsMap[k] = true;
-});
-
-exports.isReservedWord = function(word) {
- return !!reservedWordsMap[word];
-};
-
-exports.isES3ReservedWord = function(word) {
- return !!es3ReservedWordsMap[word];
-};
-
-},{}],35:[function(_dereq_,module,exports){
-/**
- * Copyright 2014 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-/*global exports:true*/
-
-var Syntax = _dereq_('esprima-fb').Syntax;
-var utils = _dereq_('../src/utils');
-var reserverdWordsHelper = _dereq_('./reserved-words-helper');
-
-/**
- * Code adapted from https://github.com/spicyj/es3ify
- * The MIT License (MIT)
- * Copyright (c) 2014 Ben Alpert
- */
-
-function visitProperty(traverse, node, path, state) {
- utils.catchup(node.key.range[0], state);
- utils.append('"', state);
- utils.catchup(node.key.range[1], state);
- utils.append('"', state);
- utils.catchup(node.value.range[0], state);
- traverse(node.value, path, state);
- return false;
-}
-
-visitProperty.test = function(node) {
- return node.type === Syntax.Property &&
- node.key.type === Syntax.Identifier &&
- !node.method &&
- !node.shorthand &&
- !node.computed &&
- reserverdWordsHelper.isES3ReservedWord(node.key.name);
-};
-
-function visitMemberExpression(traverse, node, path, state) {
- traverse(node.object, path, state);
- utils.catchup(node.property.range[0] - 1, state);
- utils.append('[', state);
- utils.catchupWhiteSpace(node.property.range[0], state);
- utils.append('"', state);
- utils.catchup(node.property.range[1], state);
- utils.append('"]', state);
- return false;
-}
-
-visitMemberExpression.test = function(node) {
- return node.type === Syntax.MemberExpression &&
- node.property.type === Syntax.Identifier &&
- reserverdWordsHelper.isES3ReservedWord(node.property.name);
-};
-
-exports.visitorList = [
- visitProperty,
- visitMemberExpression
-];
-
-},{"../src/utils":23,"./reserved-words-helper":34,"esprima-fb":9}],36:[function(_dereq_,module,exports){
-var esprima = _dereq_('esprima-fb');
-var utils = _dereq_('../src/utils');
-
-var Syntax = esprima.Syntax;
-
-function _isFunctionNode(node) {
- return node.type === Syntax.FunctionDeclaration
- || node.type === Syntax.FunctionExpression
- || node.type === Syntax.ArrowFunctionExpression;
-}
-
-function visitClassProperty(traverse, node, path, state) {
- utils.catchup(node.range[0], state);
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitClassProperty.test = function(node, path, state) {
- return node.type === Syntax.ClassProperty;
-};
-
-function visitTypeAlias(traverse, node, path, state) {
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitTypeAlias.test = function(node, path, state) {
- return node.type === Syntax.TypeAlias;
-};
-
-function visitTypeCast(traverse, node, path, state) {
- path.unshift(node);
- traverse(node.expression, path, state);
- path.shift();
-
- utils.catchup(node.typeAnnotation.range[0], state);
- utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
- return false;
-}
-visitTypeCast.test = function(node, path, state) {
- return node.type === Syntax.TypeCastExpression;
-};
-
-function visitInterfaceDeclaration(traverse, node, path, state) {
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitInterfaceDeclaration.test = function(node, path, state) {
- return node.type === Syntax.InterfaceDeclaration;
-};
-
-function visitDeclare(traverse, node, path, state) {
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitDeclare.test = function(node, path, state) {
- switch (node.type) {
- case Syntax.DeclareVariable:
- case Syntax.DeclareFunction:
- case Syntax.DeclareClass:
- case Syntax.DeclareModule:
- return true;
- }
- return false;
-};
-
-function visitFunctionParametricAnnotation(traverse, node, path, state) {
- utils.catchup(node.range[0], state);
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitFunctionParametricAnnotation.test = function(node, path, state) {
- return node.type === Syntax.TypeParameterDeclaration
- && path[0]
- && _isFunctionNode(path[0])
- && node === path[0].typeParameters;
-};
-
-function visitFunctionReturnAnnotation(traverse, node, path, state) {
- utils.catchup(node.range[0], state);
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitFunctionReturnAnnotation.test = function(node, path, state) {
- return path[0] && _isFunctionNode(path[0]) && node === path[0].returnType;
-};
-
-function visitOptionalFunctionParameterAnnotation(traverse, node, path, state) {
- utils.catchup(node.range[0] + node.name.length, state);
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitOptionalFunctionParameterAnnotation.test = function(node, path, state) {
- return node.type === Syntax.Identifier
- && node.optional
- && path[0]
- && _isFunctionNode(path[0]);
-};
-
-function visitTypeAnnotatedIdentifier(traverse, node, path, state) {
- utils.catchup(node.typeAnnotation.range[0], state);
- utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
- return false;
-}
-visitTypeAnnotatedIdentifier.test = function(node, path, state) {
- return node.type === Syntax.Identifier && node.typeAnnotation;
-};
-
-function visitTypeAnnotatedObjectOrArrayPattern(traverse, node, path, state) {
- utils.catchup(node.typeAnnotation.range[0], state);
- utils.catchupWhiteOut(node.typeAnnotation.range[1], state);
- return false;
-}
-visitTypeAnnotatedObjectOrArrayPattern.test = function(node, path, state) {
- var rightType = node.type === Syntax.ObjectPattern
- || node.type === Syntax.ArrayPattern;
- return rightType && node.typeAnnotation;
-};
-
-/**
- * Methods cause trouble, since esprima parses them as a key/value pair, where
- * the location of the value starts at the method body. For example
- * { bar(x:number,...y:Array<number>):number {} }
- * is parsed as
- * { bar: function(x: number, ...y:Array<number>): number {} }
- * except that the location of the FunctionExpression value is 40-something,
- * which is the location of the function body. This means that by the time we
- * visit the params, rest param, and return type organically, we've already
- * catchup()'d passed them.
- */
-function visitMethod(traverse, node, path, state) {
- path.unshift(node);
- traverse(node.key, path, state);
-
- path.unshift(node.value);
- traverse(node.value.params, path, state);
- node.value.rest && traverse(node.value.rest, path, state);
- node.value.returnType && traverse(node.value.returnType, path, state);
- traverse(node.value.body, path, state);
-
- path.shift();
-
- path.shift();
- return false;
-}
-
-visitMethod.test = function(node, path, state) {
- return (node.type === "Property" && (node.method || node.kind === "set" || node.kind === "get"))
- || (node.type === "MethodDefinition");
-};
-
-function visitImportType(traverse, node, path, state) {
- utils.catchupWhiteOut(node.range[1], state);
- return false;
-}
-visitImportType.test = function(node, path, state) {
- return node.type === 'ImportDeclaration'
- && node.isType;
-};
-
-exports.visitorList = [
- visitClassProperty,
- visitDeclare,
- visitImportType,
- visitInterfaceDeclaration,
- visitFunctionParametricAnnotation,
- visitFunctionReturnAnnotation,
- visitMethod,
- visitOptionalFunctionParameterAnnotation,
- visitTypeAlias,
- visitTypeCast,
- visitTypeAnnotatedIdentifier,
- visitTypeAnnotatedObjectOrArrayPattern
-];
-
-},{"../src/utils":23,"esprima-fb":9}],37:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-/*global exports:true*/
-'use strict';
-var Syntax = _dereq_('jstransform').Syntax;
-var utils = _dereq_('jstransform/src/utils');
-
-function renderJSXLiteral(object, isLast, state, start, end) {
- var lines = object.value.split(/\r\n|\n|\r/);
-
- if (start) {
- utils.append(start, state);
- }
-
- var lastNonEmptyLine = 0;
-
- lines.forEach(function(line, index) {
- if (line.match(/[^ \t]/)) {
- lastNonEmptyLine = index;
- }
- });
-
- lines.forEach(function(line, index) {
- var isFirstLine = index === 0;
- var isLastLine = index === lines.length - 1;
- var isLastNonEmptyLine = index === lastNonEmptyLine;
-
- // replace rendered whitespace tabs with spaces
- var trimmedLine = line.replace(/\t/g, ' ');
-
- // trim whitespace touching a newline
- if (!isFirstLine) {
- trimmedLine = trimmedLine.replace(/^[ ]+/, '');
- }
- if (!isLastLine) {
- trimmedLine = trimmedLine.replace(/[ ]+$/, '');
- }
-
- if (!isFirstLine) {
- utils.append(line.match(/^[ \t]*/)[0], state);
- }
-
- if (trimmedLine || isLastNonEmptyLine) {
- utils.append(
- JSON.stringify(trimmedLine) +
- (!isLastNonEmptyLine ? ' + \' \' +' : ''),
- state);
-
- if (isLastNonEmptyLine) {
- if (end) {
- utils.append(end, state);
- }
- if (!isLast) {
- utils.append(', ', state);
- }
- }
-
- // only restore tail whitespace if line had literals
- if (trimmedLine && !isLastLine) {
- utils.append(line.match(/[ \t]*$/)[0], state);
- }
- }
-
- if (!isLastLine) {
- utils.append('\n', state);
- }
- });
-
- utils.move(object.range[1], state);
-}
-
-function renderJSXExpressionContainer(traverse, object, isLast, path, state) {
- // Plus 1 to skip `{`.
- utils.move(object.range[0] + 1, state);
- utils.catchup(object.expression.range[0], state);
- traverse(object.expression, path, state);
-
- if (!isLast && object.expression.type !== Syntax.JSXEmptyExpression) {
- // If we need to append a comma, make sure to do so after the expression.
- utils.catchup(object.expression.range[1], state, trimLeft);
- utils.append(', ', state);
- }
-
- // Minus 1 to skip `}`.
- utils.catchup(object.range[1] - 1, state, trimLeft);
- utils.move(object.range[1], state);
- return false;
-}
-
-function quoteAttrName(attr) {
- // Quote invalid JS identifiers.
- if (!/^[a-z_$][a-z\d_$]*$/i.test(attr)) {
- return '"' + attr + '"';
- }
- return attr;
-}
-
-function trimLeft(value) {
- return value.replace(/^[ ]+/, '');
-}
-
-exports.renderJSXExpressionContainer = renderJSXExpressionContainer;
-exports.renderJSXLiteral = renderJSXLiteral;
-exports.quoteAttrName = quoteAttrName;
-exports.trimLeft = trimLeft;
-
-},{"jstransform":22,"jstransform/src/utils":23}],38:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-/*global exports:true*/
-'use strict';
-
-var Syntax = _dereq_('jstransform').Syntax;
-var utils = _dereq_('jstransform/src/utils');
-
-var renderJSXExpressionContainer =
- _dereq_('./jsx').renderJSXExpressionContainer;
-var renderJSXLiteral = _dereq_('./jsx').renderJSXLiteral;
-var quoteAttrName = _dereq_('./jsx').quoteAttrName;
-
-var trimLeft = _dereq_('./jsx').trimLeft;
-
-/**
- * Customized desugar processor for React JSX. Currently:
- *
- * <X> </X> => React.createElement(X, null)
- * <X prop="1" /> => React.createElement(X, {prop: '1'}, null)
- * <X prop="2"><Y /></X> => React.createElement(X, {prop:'2'},
- * React.createElement(Y, null)
- * )
- * <div /> => React.createElement("div", null)
- */
-
-/**
- * Removes all non-whitespace/parenthesis characters
- */
-var reNonWhiteParen = /([^\s\(\)])/g;
-function stripNonWhiteParen(value) {
- return value.replace(reNonWhiteParen, '');
-}
-
-var tagConvention = /^[a-z]|\-/;
-function isTagName(name) {
- return tagConvention.test(name);
-}
-
-function visitReactTag(traverse, object, path, state) {
- var openingElement = object.openingElement;
- var nameObject = openingElement.name;
- var attributesObject = openingElement.attributes;
-
- utils.catchup(openingElement.range[0], state, trimLeft);
-
- if (nameObject.type === Syntax.JSXNamespacedName && nameObject.namespace) {
- throw new Error('Namespace tags are not supported. ReactJSX is not XML.');
- }
-
- // We assume that the React runtime is already in scope
- utils.append('React.createElement(', state);
-
- if (nameObject.type === Syntax.JSXIdentifier && isTagName(nameObject.name)) {
- utils.append('"' + nameObject.name + '"', state);
- utils.move(nameObject.range[1], state);
- } else {
- // Use utils.catchup in this case so we can easily handle
- // JSXMemberExpressions which look like Foo.Bar.Baz. This also handles
- // JSXIdentifiers that aren't fallback tags.
- utils.move(nameObject.range[0], state);
- utils.catchup(nameObject.range[1], state);
- }
-
- utils.append(', ', state);
-
- var hasAttributes = attributesObject.length;
-
- var hasAtLeastOneSpreadProperty = attributesObject.some(function(attr) {
- return attr.type === Syntax.JSXSpreadAttribute;
- });
-
- // if we don't have any attributes, pass in null
- if (hasAtLeastOneSpreadProperty) {
- utils.append('React.__spread({', state);
- } else if (hasAttributes) {
- utils.append('{', state);
- } else {
- utils.append('null', state);
- }
-
- // keep track of if the previous attribute was a spread attribute
- var previousWasSpread = false;
-
- // write attributes
- attributesObject.forEach(function(attr, index) {
- var isLast = index === attributesObject.length - 1;
-
- if (attr.type === Syntax.JSXSpreadAttribute) {
- // Close the previous object or initial object
- if (!previousWasSpread) {
- utils.append('}, ', state);
- }
-
- // Move to the expression start, ignoring everything except parenthesis
- // and whitespace.
- utils.catchup(attr.range[0], state, stripNonWhiteParen);
- // Plus 1 to skip `{`.
- utils.move(attr.range[0] + 1, state);
- utils.catchup(attr.argument.range[0], state, stripNonWhiteParen);
-
- traverse(attr.argument, path, state);
-
- utils.catchup(attr.argument.range[1], state);
-
- // Move to the end, ignoring parenthesis and the closing `}`
- utils.catchup(attr.range[1] - 1, state, stripNonWhiteParen);
-
- if (!isLast) {
- utils.append(', ', state);
- }
-
- utils.move(attr.range[1], state);
-
- previousWasSpread = true;
-
- return;
- }
-
- // If the next attribute is a spread, we're effective last in this object
- if (!isLast) {
- isLast = attributesObject[index + 1].type === Syntax.JSXSpreadAttribute;
- }
-
- if (attr.name.namespace) {
- throw new Error(
- 'Namespace attributes are not supported. ReactJSX is not XML.');
- }
- var name = attr.name.name;
-
- utils.catchup(attr.range[0], state, trimLeft);
-
- if (previousWasSpread) {
- utils.append('{', state);
- }
-
- utils.append(quoteAttrName(name), state);
- utils.append(': ', state);
-
- if (!attr.value) {
- state.g.buffer += 'true';
- state.g.position = attr.name.range[1];
- if (!isLast) {
- utils.append(', ', state);
- }
- } else {
- utils.move(attr.name.range[1], state);
- // Use catchupNewlines to skip over the '=' in the attribute
- utils.catchupNewlines(attr.value.range[0], state);
- if (attr.value.type === Syntax.Literal) {
- renderJSXLiteral(attr.value, isLast, state);
- } else {
- renderJSXExpressionContainer(traverse, attr.value, isLast, path, state);
- }
- }
-
- utils.catchup(attr.range[1], state, trimLeft);
-
- previousWasSpread = false;
-
- });
-
- if (!openingElement.selfClosing) {
- utils.catchup(openingElement.range[1] - 1, state, trimLeft);
- utils.move(openingElement.range[1], state);
- }
-
- if (hasAttributes && !previousWasSpread) {
- utils.append('}', state);
- }
-
- if (hasAtLeastOneSpreadProperty) {
- utils.append(')', state);
- }
-
- // filter out whitespace
- var childrenToRender = object.children.filter(function(child) {
- return !(child.type === Syntax.Literal
- && typeof child.value === 'string'
- && child.value.match(/^[ \t]*[\r\n][ \t\r\n]*$/));
- });
- if (childrenToRender.length > 0) {
- var lastRenderableIndex;
-
- childrenToRender.forEach(function(child, index) {
- if (child.type !== Syntax.JSXExpressionContainer ||
- child.expression.type !== Syntax.JSXEmptyExpression) {
- lastRenderableIndex = index;
- }
- });
-
- if (lastRenderableIndex !== undefined) {
- utils.append(', ', state);
- }
-
- childrenToRender.forEach(function(child, index) {
- utils.catchup(child.range[0], state, trimLeft);
-
- var isLast = index >= lastRenderableIndex;
-
- if (child.type === Syntax.Literal) {
- renderJSXLiteral(child, isLast, state);
- } else if (child.type === Syntax.JSXExpressionContainer) {
- renderJSXExpressionContainer(traverse, child, isLast, path, state);
- } else {
- traverse(child, path, state);
- if (!isLast) {
- utils.append(', ', state);
- }
- }
-
- utils.catchup(child.range[1], state, trimLeft);
- });
- }
-
- if (openingElement.selfClosing) {
- // everything up to />
- utils.catchup(openingElement.range[1] - 2, state, trimLeft);
- utils.move(openingElement.range[1], state);
- } else {
- // everything up to </ sdflksjfd>
- utils.catchup(object.closingElement.range[0], state, trimLeft);
- utils.move(object.closingElement.range[1], state);
- }
-
- utils.append(')', state);
- return false;
-}
-
-visitReactTag.test = function(object, path, state) {
- return object.type === Syntax.JSXElement;
-};
-
-exports.visitorList = [
- visitReactTag
-];
-
-},{"./jsx":37,"jstransform":22,"jstransform/src/utils":23}],39:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-/*global exports:true*/
-'use strict';
-
-var Syntax = _dereq_('jstransform').Syntax;
-var utils = _dereq_('jstransform/src/utils');
-
-function addDisplayName(displayName, object, state) {
- if (object &&
- object.type === Syntax.CallExpression &&
- object.callee.type === Syntax.MemberExpression &&
- object.callee.object.type === Syntax.Identifier &&
- object.callee.object.name === 'React' &&
- object.callee.property.type === Syntax.Identifier &&
- object.callee.property.name === 'createClass' &&
- object.arguments.length === 1 &&
- object.arguments[0].type === Syntax.ObjectExpression) {
- // Verify that the displayName property isn't already set
- var properties = object.arguments[0].properties;
- var safe = properties.every(function(property) {
- var value = property.key.type === Syntax.Identifier ?
- property.key.name :
- property.key.value;
- return value !== 'displayName';
- });
-
- if (safe) {
- utils.catchup(object.arguments[0].range[0] + 1, state);
- utils.append('displayName: "' + displayName + '",', state);
- }
- }
-}
-
-/**
- * Transforms the following:
- *
- * var MyComponent = React.createClass({
- * render: ...
- * });
- *
- * into:
- *
- * var MyComponent = React.createClass({
- * displayName: 'MyComponent',
- * render: ...
- * });
- *
- * Also catches:
- *
- * MyComponent = React.createClass(...);
- * exports.MyComponent = React.createClass(...);
- * module.exports = {MyComponent: React.createClass(...)};
- */
-function visitReactDisplayName(traverse, object, path, state) {
- var left, right;
-
- if (object.type === Syntax.AssignmentExpression) {
- left = object.left;
- right = object.right;
- } else if (object.type === Syntax.Property) {
- left = object.key;
- right = object.value;
- } else if (object.type === Syntax.VariableDeclarator) {
- left = object.id;
- right = object.init;
- }
-
- if (left && left.type === Syntax.MemberExpression) {
- left = left.property;
- }
- if (left && left.type === Syntax.Identifier) {
- addDisplayName(left.name, right, state);
- }
-}
-
-visitReactDisplayName.test = function(object, path, state) {
- return (
- object.type === Syntax.AssignmentExpression ||
- object.type === Syntax.Property ||
- object.type === Syntax.VariableDeclarator
- );
-};
-
-exports.visitorList = [
- visitReactDisplayName
-];
-
-},{"jstransform":22,"jstransform/src/utils":23}],40:[function(_dereq_,module,exports){
-/*global exports:true*/
-
-'use strict';
-
-var es6ArrowFunctions =
- _dereq_('jstransform/visitors/es6-arrow-function-visitors');
-var es6Classes = _dereq_('jstransform/visitors/es6-class-visitors');
-var es6Destructuring =
- _dereq_('jstransform/visitors/es6-destructuring-visitors');
-var es6ObjectConciseMethod =
- _dereq_('jstransform/visitors/es6-object-concise-method-visitors');
-var es6ObjectShortNotation =
- _dereq_('jstransform/visitors/es6-object-short-notation-visitors');
-var es6RestParameters = _dereq_('jstransform/visitors/es6-rest-param-visitors');
-var es6Templates = _dereq_('jstransform/visitors/es6-template-visitors');
-var es6CallSpread =
- _dereq_('jstransform/visitors/es6-call-spread-visitors');
-var es7SpreadProperty =
- _dereq_('jstransform/visitors/es7-spread-property-visitors');
-var react = _dereq_('./transforms/react');
-var reactDisplayName = _dereq_('./transforms/reactDisplayName');
-var reservedWords = _dereq_('jstransform/visitors/reserved-words-visitors');
-
-/**
- * Map from transformName => orderedListOfVisitors.
- */
-var transformVisitors = {
- 'es6-arrow-functions': es6ArrowFunctions.visitorList,
- 'es6-classes': es6Classes.visitorList,
- 'es6-destructuring': es6Destructuring.visitorList,
- 'es6-object-concise-method': es6ObjectConciseMethod.visitorList,
- 'es6-object-short-notation': es6ObjectShortNotation.visitorList,
- 'es6-rest-params': es6RestParameters.visitorList,
- 'es6-templates': es6Templates.visitorList,
- 'es6-call-spread': es6CallSpread.visitorList,
- 'es7-spread-property': es7SpreadProperty.visitorList,
- 'react': react.visitorList.concat(reactDisplayName.visitorList),
- 'reserved-words': reservedWords.visitorList
-};
-
-var transformSets = {
- 'harmony': [
- 'es6-arrow-functions',
- 'es6-object-concise-method',
- 'es6-object-short-notation',
- 'es6-classes',
- 'es6-rest-params',
- 'es6-templates',
- 'es6-destructuring',
- 'es6-call-spread',
- 'es7-spread-property'
- ],
- 'es3': [
- 'reserved-words'
- ],
- 'react': [
- 'react'
- ]
-};
-
-/**
- * Specifies the order in which each transform should run.
- */
-var transformRunOrder = [
- 'reserved-words',
- 'es6-arrow-functions',
- 'es6-object-concise-method',
- 'es6-object-short-notation',
- 'es6-classes',
- 'es6-rest-params',
- 'es6-templates',
- 'es6-destructuring',
- 'es6-call-spread',
- 'es7-spread-property',
- 'react'
-];
-
-/**
- * Given a list of transform names, return the ordered list of visitors to be
- * passed to the transform() function.
- *
- * @param {array?} excludes
- * @return {array}
- */
-function getAllVisitors(excludes) {
- var ret = [];
- for (var i = 0, il = transformRunOrder.length; i < il; i++) {
- if (!excludes || excludes.indexOf(transformRunOrder[i]) === -1) {
- ret = ret.concat(transformVisitors[transformRunOrder[i]]);
- }
- }
- return ret;
-}
-
-/**
- * Given a list of visitor set names, return the ordered list of visitors to be
- * passed to jstransform.
- *
- * @param {array}
- * @return {array}
- */
-function getVisitorsBySet(sets) {
- var visitorsToInclude = sets.reduce(function(visitors, set) {
- if (!transformSets.hasOwnProperty(set)) {
- throw new Error('Unknown visitor set: ' + set);
- }
- transformSets[set].forEach(function(visitor) {
- visitors[visitor] = true;
- });
- return visitors;
- }, {});
-
- var visitorList = [];
- for (var i = 0; i < transformRunOrder.length; i++) {
- if (visitorsToInclude.hasOwnProperty(transformRunOrder[i])) {
- visitorList = visitorList.concat(transformVisitors[transformRunOrder[i]]);
- }
- }
-
- return visitorList;
-}
-
-exports.getVisitorsBySet = getVisitorsBySet;
-exports.getAllVisitors = getAllVisitors;
-exports.transformVisitors = transformVisitors;
-
-},{"./transforms/react":38,"./transforms/reactDisplayName":39,"jstransform/visitors/es6-arrow-function-visitors":24,"jstransform/visitors/es6-call-spread-visitors":25,"jstransform/visitors/es6-class-visitors":26,"jstransform/visitors/es6-destructuring-visitors":27,"jstransform/visitors/es6-object-concise-method-visitors":28,"jstransform/visitors/es6-object-short-notation-visitors":29,"jstransform/visitors/es6-rest-param-visitors":30,"jstransform/visitors/es6-template-visitors":31,"jstransform/visitors/es7-spread-property-visitors":33,"jstransform/visitors/reserved-words-visitors":35}],41:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- */
-
-'use strict';
-/*eslint-disable no-undef*/
-var Buffer = _dereq_('buffer').Buffer;
-
-function inlineSourceMap(sourceMap, sourceCode, sourceFilename) {
- // This can be used with a sourcemap that has already has toJSON called on it.
- // Check first.
- var json = sourceMap;
- if (typeof sourceMap.toJSON === 'function') {
- json = sourceMap.toJSON();
- }
- json.sources = [sourceFilename];
- json.sourcesContent = [sourceCode];
- var base64 = Buffer(JSON.stringify(json)).toString('base64');
- return '//# sourceMappingURL=data:application/json;base64,' + base64;
-}
-
-module.exports = inlineSourceMap;
-
-},{"buffer":3}]},{},[1])(1)
-});
\ No newline at end of file

dist/react.js

@@ -1,5 +1,5 @@
-/**
- * React v0.13.3
+ /**
+ * React v0.14.9
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(_dereq_,module,exports){
/**
@@ -13,145 +13,36 @@
* @providesModule React
*/
-/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
-
'use strict';
-var EventPluginUtils = _dereq_(19);
-var ReactChildren = _dereq_(32);
-var ReactComponent = _dereq_(34);
-var ReactClass = _dereq_(33);
-var ReactContext = _dereq_(38);
-var ReactCurrentOwner = _dereq_(39);
-var ReactElement = _dereq_(57);
-var ReactElementValidator = _dereq_(58);
-var ReactDOM = _dereq_(40);
-var ReactDOMTextComponent = _dereq_(51);
-var ReactDefaultInjection = _dereq_(54);
-var ReactInstanceHandles = _dereq_(66);
-var ReactMount = _dereq_(70);
-var ReactPerf = _dereq_(75);
-var ReactPropTypes = _dereq_(78);
-var ReactReconciler = _dereq_(81);
-var ReactServerRendering = _dereq_(84);
-
-var assign = _dereq_(27);
-var findDOMNode = _dereq_(117);
-var onlyChild = _dereq_(144);
-
-ReactDefaultInjection.inject();
-
-var createElement = ReactElement.createElement;
-var createFactory = ReactElement.createFactory;
-var cloneElement = ReactElement.cloneElement;
-
-if ("production" !== "development") {
- createElement = ReactElementValidator.createElement;
- createFactory = ReactElementValidator.createFactory;
- cloneElement = ReactElementValidator.cloneElement;
-}
-
-var render = ReactPerf.measure('React', 'render', ReactMount.render);
-
-var React = {
- Children: {
- map: ReactChildren.map,
- forEach: ReactChildren.forEach,
- count: ReactChildren.count,
- only: onlyChild
- },
- Component: ReactComponent,
- DOM: ReactDOM,
- PropTypes: ReactPropTypes,
- initializeTouchEvents: function(shouldUseTouch) {
- EventPluginUtils.useTouchEvents = shouldUseTouch;
- },
- createClass: ReactClass.createClass,
- createElement: createElement,
- cloneElement: cloneElement,
- createFactory: createFactory,
- createMixin: function(mixin) {
- // Currently a noop. Will be used to validate and trace mixins.
- return mixin;
- },
- constructAndRenderComponent: ReactMount.constructAndRenderComponent,
- constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
- findDOMNode: findDOMNode,
- render: render,
- renderToString: ReactServerRendering.renderToString,
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
- unmountComponentAtNode: ReactMount.unmountComponentAtNode,
- isValidElement: ReactElement.isValidElement,
- withContext: ReactContext.withContext,
-
- // Hook for JSX spread, don't use this for anything else.
- __spread: assign
-};
-
-// Inject the runtime into a devtools global hook regardless of browser.
-// Allows for debugging when the hook is injected on the page.
-if (
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
- __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
- CurrentOwner: ReactCurrentOwner,
- InstanceHandles: ReactInstanceHandles,
- Mount: ReactMount,
- Reconciler: ReactReconciler,
- TextComponent: ReactDOMTextComponent
- });
-}
-
-if ("production" !== "development") {
- var ExecutionEnvironment = _dereq_(21);
- if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
-
- // If we're in Chrome, look for the devtools marker and provide a download
- // link if not installed.
- if (navigator.userAgent.indexOf('Chrome') > -1) {
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
- console.debug(
- 'Download the React DevTools for a better development experience: ' +
- 'https://fb.me/react-devtools'
- );
- }
- }
-
- var expectedFeatures = [
- // shims
- Array.isArray,
- Array.prototype.every,
- Array.prototype.forEach,
- Array.prototype.indexOf,
- Array.prototype.map,
- Date.now,
- Function.prototype.bind,
- Object.keys,
- String.prototype.split,
- String.prototype.trim,
-
- // shams
- Object.create,
- Object.freeze
- ];
-
- for (var i = 0; i < expectedFeatures.length; i++) {
- if (!expectedFeatures[i]) {
- console.error(
- 'One or more ES5 shim/shams expected by React are not available: ' +
- 'https://fb.me/react-warning-polyfills'
- );
- break;
- }
- }
- }
-}
+var ReactDOM = _dereq_(35);
+var ReactDOMServer = _dereq_(45);
+var ReactIsomorphic = _dereq_(63);
+
+var assign = _dereq_(23);
+var deprecated = _dereq_(106);
+
+// `version` will be added here by ReactIsomorphic.
+var React = {};
+
+assign(React, ReactIsomorphic);
+
+assign(React, {
+ // ReactDOM
+ findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
+ render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
+ unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
+
+ // ReactDOMServer
+ renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
+ renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
+});
-React.version = '0.13.3';
+React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
+React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
module.exports = React;
-
-},{"117":117,"144":144,"19":19,"21":21,"27":27,"32":32,"33":33,"34":34,"38":38,"39":39,"40":40,"51":51,"54":54,"57":57,"58":58,"66":66,"70":70,"75":75,"78":78,"81":81,"84":84}],2:[function(_dereq_,module,exports){
+},{"106":106,"23":23,"35":35,"45":45,"63":63}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -160,25 +51,35 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule AutoFocusMixin
+ * @providesModule AutoFocusUtils
* @typechecks static-only
*/
'use strict';
-var focusNode = _dereq_(119);
+var ReactMount = _dereq_(65);
+
+var findDOMNode = _dereq_(108);
+var focusNode = _dereq_(138);
-var AutoFocusMixin = {
- componentDidMount: function() {
+var Mixin = {
+ componentDidMount: function () {
if (this.props.autoFocus) {
- focusNode(this.getDOMNode());
+ focusNode(findDOMNode(this));
}
}
};
-module.exports = AutoFocusMixin;
+var AutoFocusUtils = {
+ Mixin: Mixin,
+
+ focusDOMComponent: function () {
+ focusNode(ReactMount.getNode(this._rootNodeID));
+ }
+};
-},{"119":119}],3:[function(_dereq_,module,exports){
+module.exports = AutoFocusUtils;
+},{"108":108,"138":138,"65":65}],3:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015 Facebook, Inc.
* All rights reserved.
@@ -194,21 +95,18 @@
'use strict';
var EventConstants = _dereq_(15);
-var EventPropagators = _dereq_(20);
-var ExecutionEnvironment = _dereq_(21);
-var FallbackCompositionState = _dereq_(22);
-var SyntheticCompositionEvent = _dereq_(93);
-var SyntheticInputEvent = _dereq_(97);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(130);
+var FallbackCompositionState = _dereq_(20);
+var SyntheticCompositionEvent = _dereq_(90);
+var SyntheticInputEvent = _dereq_(94);
-var keyOf = _dereq_(141);
+var keyOf = _dereq_(148);
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
-var canUseCompositionEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'CompositionEvent' in window
-);
+var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
@@ -218,22 +116,12 @@
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
-var canUseTextInputEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'TextEvent' in window &&
- !documentMode &&
- !isPresto()
-);
+var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
-var useFallbackCompositionData = (
- ExecutionEnvironment.canUseDOM &&
- (
- (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
- )
-);
+var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
@@ -241,11 +129,7 @@
*/
function isPresto() {
var opera = window.opera;
- return (
- typeof opera === 'object' &&
- typeof opera.version === 'function' &&
- parseInt(opera.version(), 10) <= 12
- );
+ return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
@@ -257,57 +141,31 @@
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
- bubbled: keyOf({onBeforeInput: null}),
- captured: keyOf({onBeforeInputCapture: null})
+ bubbled: keyOf({ onBeforeInput: null }),
+ captured: keyOf({ onBeforeInputCapture: null })
},
- dependencies: [
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyPress,
- topLevelTypes.topTextInput,
- topLevelTypes.topPaste
- ]
+ dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionEnd: null}),
- captured: keyOf({onCompositionEndCapture: null})
+ bubbled: keyOf({ onCompositionEnd: null }),
+ captured: keyOf({ onCompositionEndCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionStart: null}),
- captured: keyOf({onCompositionStartCapture: null})
+ bubbled: keyOf({ onCompositionStart: null }),
+ captured: keyOf({ onCompositionStartCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionStart,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionUpdate: null}),
- captured: keyOf({onCompositionUpdateCapture: null})
+ bubbled: keyOf({ onCompositionUpdate: null }),
+ captured: keyOf({ onCompositionUpdateCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionUpdate,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
@@ -320,14 +178,11 @@
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
- return (
- (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
+ return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
- !(nativeEvent.ctrlKey && nativeEvent.altKey)
- );
+ !(nativeEvent.ctrlKey && nativeEvent.altKey);
}
-
/**
* Translate native top level events into event types.
*
@@ -354,10 +209,7 @@
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return (
- topLevelType === topLevelTypes.topKeyDown &&
- nativeEvent.keyCode === START_KEYCODE
- );
+ return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
@@ -371,11 +223,11 @@
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
- return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
+ return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
- return (nativeEvent.keyCode !== START_KEYCODE);
+ return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
@@ -413,12 +265,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
-function extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
@@ -448,11 +295,7 @@
}
}
- var event = SyntheticCompositionEvent.getPooled(
- eventType,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
@@ -532,10 +375,7 @@
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
- if (
- topLevelType === topLevelTypes.topCompositionEnd ||
- isFallbackCompositionEnd(topLevelType, nativeEvent)
- ) {
+ if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
@@ -587,12 +427,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
-function extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
@@ -607,11 +442,7 @@
return null;
}
- var event = SyntheticInputEvent.getPooled(
- eventTypes.beforeInput,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
@@ -648,32 +479,13 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ) {
- return [
- extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ),
- extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- )
- ];
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
-
-},{"141":141,"15":15,"20":20,"21":21,"22":22,"93":93,"97":97}],4:[function(_dereq_,module,exports){
+},{"130":130,"148":148,"15":15,"19":19,"20":20,"90":90,"94":94}],4:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -691,26 +503,31 @@
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
+ animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
+ boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
+ flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
+ tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
+ stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
@@ -734,8 +551,8 @@
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function(prop) {
- prefixes.forEach(function(prefix) {
+Object.keys(isUnitlessNumber).forEach(function (prop) {
+ prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
@@ -751,10 +568,16 @@
*/
var shorthandPropertyExpansions = {
background: {
+ backgroundAttachment: true,
+ backgroundColor: true,
backgroundImage: true,
- backgroundPosition: true,
- backgroundRepeat: true,
- backgroundColor: true
+ backgroundPositionX: true,
+ backgroundPositionY: true,
+ backgroundRepeat: true
+ },
+ backgroundPosition: {
+ backgroundPositionX: true,
+ backgroundPositionY: true
},
border: {
borderWidth: true,
@@ -788,6 +611,11 @@
fontSize: true,
lineHeight: true,
fontFamily: true
+ },
+ outline: {
+ outlineWidth: true,
+ outlineStyle: true,
+ outlineColor: true
}
};
@@ -814,27 +641,36 @@
'use strict';
var CSSProperty = _dereq_(4);
-var ExecutionEnvironment = _dereq_(21);
+var ExecutionEnvironment = _dereq_(130);
+var ReactPerf = _dereq_(71);
-var camelizeStyleName = _dereq_(108);
-var dangerousStyleValue = _dereq_(113);
-var hyphenateStyleName = _dereq_(133);
-var memoizeStringOnly = _dereq_(143);
-var warning = _dereq_(154);
+var camelizeStyleName = _dereq_(132);
+var dangerousStyleValue = _dereq_(105);
+var hyphenateStyleName = _dereq_(143);
+var memoizeStringOnly = _dereq_(150);
+var warning = _dereq_(155);
-var processStyleName = memoizeStringOnly(function(styleName) {
+var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
+var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
+ var tempStyle = document.createElement('div').style;
+ try {
+ // IE8 throws "Invalid argument." if resetting shorthand style properties.
+ tempStyle.font = '';
+ } catch (e) {
+ hasShorthandPropertyBug = true;
+ }
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
@@ -844,54 +680,38 @@
var warnedStyleNames = {};
var warnedStyleValues = {};
- var warnHyphenatedStyleName = function(name) {
+ var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported style property %s. Did you mean %s?',
- name,
- camelizeStyleName(name)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
- var warnBadVendoredStyleName = function(name) {
+ var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
- name,
- name.charAt(0).toUpperCase() + name.slice(1)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
- var warnStyleValueWithSemicolon = function(name, value) {
+ var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- ("production" !== "development" ? warning(
- false,
- 'Style property values shouldn\'t contain a semicolon. ' +
- 'Try "%s: %s" instead.',
- name,
- value.replace(badStyleValueWithSemicolonPattern, '')
- ) : null);
+ "development" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
- var warnValidStyle = function(name, value) {
+ var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
@@ -919,14 +739,14 @@
* @param {object} styles
* @return {?string}
*/
- createMarkupForStyles: function(styles) {
+ createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
@@ -944,13 +764,13 @@
* @param {DOMElement} node
* @param {object} styles
*/
- setValueForStyles: function(node, styles) {
+ setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
@@ -960,7 +780,7 @@
if (styleValue) {
style[styleName] = styleValue;
} else {
- var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
+ var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
@@ -976,9 +796,12 @@
};
-module.exports = CSSPropertyOperations;
+ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
+ setValueForStyles: 'setValueForStyles'
+});
-},{"108":108,"113":113,"133":133,"143":143,"154":154,"21":21,"4":4}],6:[function(_dereq_,module,exports){
+module.exports = CSSPropertyOperations;
+},{"105":105,"130":130,"132":132,"143":143,"150":150,"155":155,"4":4,"71":71}],6:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -992,10 +815,10 @@
'use strict';
-var PooledClass = _dereq_(28);
+var PooledClass = _dereq_(24);
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
+var assign = _dereq_(23);
+var invariant = _dereq_(144);
/**
* A specialized pseudo-event module to help keep track of components waiting to
@@ -1022,7 +845,7 @@
* @param {?object} context Context to call `callback` with.
* @internal
*/
- enqueue: function(callback, context) {
+ enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
@@ -1035,17 +858,14 @@
*
* @internal
*/
- notifyAll: function() {
+ notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
- ("production" !== "development" ? invariant(
- callbacks.length === contexts.length,
- 'Mismatched list of contexts in callback queue'
- ) : invariant(callbacks.length === contexts.length));
+ !(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
- for (var i = 0, l = callbacks.length; i < l; i++) {
+ for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
@@ -1058,7 +878,7 @@
*
* @internal
*/
- reset: function() {
+ reset: function () {
this._callbacks = null;
this._contexts = null;
},
@@ -1066,7 +886,7 @@
/**
* `PooledClass` looks for this.
*/
- destructor: function() {
+ destructor: function () {
this.reset();
}
@@ -1075,8 +895,7 @@
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
-
-},{"135":135,"27":27,"28":28}],7:[function(_dereq_,module,exports){
+},{"144":144,"23":23,"24":24}],7:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1091,34 +910,26 @@
'use strict';
var EventConstants = _dereq_(15);
-var EventPluginHub = _dereq_(17);
-var EventPropagators = _dereq_(20);
-var ExecutionEnvironment = _dereq_(21);
-var ReactUpdates = _dereq_(87);
-var SyntheticEvent = _dereq_(95);
-
-var isEventSupported = _dereq_(136);
-var isTextInputElement = _dereq_(138);
-var keyOf = _dereq_(141);
+var EventPluginHub = _dereq_(16);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(130);
+var ReactUpdates = _dereq_(83);
+var SyntheticEvent = _dereq_(92);
+
+var getEventTarget = _dereq_(114);
+var isEventSupported = _dereq_(119);
+var isTextInputElement = _dereq_(120);
+var keyOf = _dereq_(148);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
- bubbled: keyOf({onChange: null}),
- captured: keyOf({onChangeCapture: null})
+ bubbled: keyOf({ onChange: null }),
+ captured: keyOf({ onChangeCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topChange,
- topLevelTypes.topClick,
- topLevelTypes.topFocus,
- topLevelTypes.topInput,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
@@ -1134,26 +945,18 @@
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
- return (
- elem.nodeName === 'SELECT' ||
- (elem.nodeName === 'INPUT' && elem.type === 'file')
- );
+ var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
- doesChangeEventBubble = isEventSupported('change') && (
- (!('documentMode' in document) || document.documentMode > 8)
- );
+ doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- activeElementID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
@@ -1172,7 +975,7 @@
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
@@ -1190,18 +993,12 @@
activeElementID = null;
}
-function getTargetIDForChangeEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
-function handleEventsForChangeEventIE8(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
@@ -1220,9 +1016,7 @@
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (
- (!('documentMode' in document) || document.documentMode > 9)
- );
+ isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
@@ -1230,10 +1024,10 @@
* set on the active element.
*/
var newValueProp = {
- get: function() {
+ get: function () {
return activeElementValueProp.get.call(this);
},
- set: function(val) {
+ set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
@@ -1249,11 +1043,10 @@
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
- activeElementValueProp = Object.getOwnPropertyDescriptor(
- target.constructor.prototype,
- 'value'
- );
+ activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
+ // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
+ // on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
@@ -1297,10 +1090,7 @@
/**
* If a `change` event should be fired, returns the target's ID.
*/
-function getTargetIDForInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
@@ -1309,10 +1099,7 @@
}
// For IE8 and IE9.
-function handleEventsForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
@@ -1335,13 +1122,8 @@
}
// For IE8 and IE9.
-function getTargetIDForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
- if (topLevelType === topLevelTypes.topSelectionChange ||
- topLevelType === topLevelTypes.topKeyUp ||
- topLevelType === topLevelTypes.topKeyDown) {
+function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
+ if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
@@ -1367,16 +1148,10 @@
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
- return (
- elem.nodeName === 'INPUT' &&
- (elem.type === 'checkbox' || elem.type === 'radio')
- );
+ return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
-function getTargetIDForClickEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
@@ -1404,11 +1179,7 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
@@ -1429,36 +1200,24 @@
}
if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- targetID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
+ event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
- handleEventFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}
};
module.exports = ChangeEventPlugin;
-
-},{"136":136,"138":138,"141":141,"15":15,"17":17,"20":20,"21":21,"87":87,"95":95}],8:[function(_dereq_,module,exports){
+},{"114":114,"119":119,"120":120,"130":130,"148":148,"15":15,"16":16,"19":19,"83":83,"92":92}],8:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1476,7 +1235,7 @@
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return nextReactRootIndex++;
}
};
@@ -1499,10 +1257,12 @@
'use strict';
var Danger = _dereq_(12);
-var ReactMultiChildUpdateTypes = _dereq_(72);
+var ReactMultiChildUpdateTypes = _dereq_(67);
+var ReactPerf = _dereq_(71);
-var setTextContent = _dereq_(149);
-var invariant = _dereq_(135);
+var setInnerHTML = _dereq_(124);
+var setTextContent = _dereq_(125);
+var invariant = _dereq_(144);
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
@@ -1517,10 +1277,12 @@
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
- parentNode.insertBefore(
- childNode,
- parentNode.childNodes[index] || null
- );
+
+ // fix render order error in safari
+ // IE8 will throw error when index out of list size.
+ var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
+
+ parentNode.insertBefore(childNode, beforeChild);
}
/**
@@ -1540,7 +1302,7 @@
* @param {array<string>} markupList List of markup strings.
* @internal
*/
- processUpdates: function(updates, markupList) {
+ processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
@@ -1549,23 +1311,12 @@
for (var i = 0; i < updates.length; i++) {
update = updates[i];
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
- update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
+ if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
- ("production" !== "development" ? invariant(
- updatedChild,
- 'processUpdates(): Unable to find child %s of element. This ' +
- 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
- 'browser), usually due to forgetting a <tbody> when using tables, ' +
- 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
- 'in an <svg> parent. Try inspecting the child nodes of the element ' +
- 'with React ID `%s`.',
- updatedIndex,
- parentID
- ) : invariant(updatedChild));
+ !updatedChild ? "development" !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
@@ -1576,7 +1327,13 @@
}
}
- var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ var renderedMarkup;
+ // markupList is either a list of markup or just a list of elements
+ if (markupList.length && typeof markupList[0] === 'string') {
+ renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ } else {
+ renderedMarkup = markupList;
+ }
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
@@ -1589,24 +1346,16 @@
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
- insertChildAt(
- update.parentNode,
- renderedMarkup[update.markupIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
- insertChildAt(
- update.parentNode,
- initialChildren[update.parentID][update.fromIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
+ break;
+ case ReactMultiChildUpdateTypes.SET_MARKUP:
+ setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
- setTextContent(
- update.parentNode,
- update.textContent
- );
+ setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
@@ -1617,9 +1366,12 @@
};
-module.exports = DOMChildrenOperations;
+ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
+ updateTextContent: 'updateTextContent'
+});
-},{"12":12,"135":135,"149":149,"72":72}],10:[function(_dereq_,module,exports){
+module.exports = DOMChildrenOperations;
+},{"12":12,"124":124,"125":125,"144":144,"67":67,"71":71}],10:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1632,11 +1384,9 @@
* @typechecks static-only
*/
-/*jslint bitwise: true */
-
'use strict';
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
@@ -1672,6 +1422,9 @@
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
+ * DOMAttributeNamespaces: object mapping React attribute name to the DOM
+ * attribute namespace URL. (Attribute names not specified use no namespace.)
+ *
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
@@ -1680,92 +1433,68 @@
*
* @param {object} domPropertyConfig the config as described above.
*/
- injectDOMPropertyConfig: function(domPropertyConfig) {
+ injectDOMPropertyConfig: function (domPropertyConfig) {
+ var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
+ var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
- DOMProperty._isCustomAttributeFunctions.push(
- domPropertyConfig.isCustomAttribute
- );
+ DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
- ("production" !== "development" ? invariant(
- !DOMProperty.isStandardName.hasOwnProperty(propName),
- 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
- '\'%s\' which has already been injected. You may be accidentally ' +
- 'injecting the same DOM property config twice, or you may be ' +
- 'injecting two configs that have conflicting property names.',
- propName
- ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
-
- DOMProperty.isStandardName[propName] = true;
+ !!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
var lowerCased = propName.toLowerCase();
+ var propConfig = Properties[propName];
+
+ var propertyInfo = {
+ attributeName: lowerCased,
+ attributeNamespace: null,
+ propertyName: propName,
+ mutationMethod: null,
+
+ mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
+ mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
+ hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
+ hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
+ hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
+ hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
+ hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
+ };
+
+ !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
+ }
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
+ propertyInfo.attributeName = attributeName;
+ if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[attributeName] = propName;
- DOMProperty.getAttributeName[propName] = attributeName;
- } else {
- DOMProperty.getAttributeName[propName] = lowerCased;
+ }
}
- DOMProperty.getPropertyName[propName] =
- DOMPropertyNames.hasOwnProperty(propName) ?
- DOMPropertyNames[propName] :
- propName;
+ if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
+ propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
+ }
+
+ if (DOMPropertyNames.hasOwnProperty(propName)) {
+ propertyInfo.propertyName = DOMPropertyNames[propName];
+ }
if (DOMMutationMethods.hasOwnProperty(propName)) {
- DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
- } else {
- DOMProperty.getMutationMethod[propName] = null;
+ propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
- var propConfig = Properties[propName];
- DOMProperty.mustUseAttribute[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
- DOMProperty.mustUseProperty[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
- DOMProperty.hasSideEffects[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
- DOMProperty.hasBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
- DOMProperty.hasNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
- DOMProperty.hasPositiveNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
- DOMProperty.hasOverloadedBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
-
- ("production" !== "development" ? invariant(
- !DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName],
- 'DOMProperty: Cannot require using both attribute and property: %s',
- propName
- ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName]));
- ("production" !== "development" ? invariant(
- DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName],
- 'DOMProperty: Properties that have side effects must use property: %s',
- propName
- ) : invariant(DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName]));
- ("production" !== "development" ? invariant(
- !!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
- 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
- 'numeric value, but not a combination: %s',
- propName
- ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
+ DOMProperty.properties[propName] = propertyInfo;
}
}
};
@@ -1789,87 +1518,49 @@
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
- * Checks whether a property name is a standard property.
- * @type {Object}
- */
- isStandardName: {},
-
- /**
- * Mapping from lowercase property names to the properly cased version, used
- * to warn in the case of missing properties.
- * @type {Object}
- */
- getPossibleStandardName: {},
-
- /**
- * Mapping from normalized names to attribute names that differ. Attribute
- * names are used when rendering markup or with `*Attribute()`.
- * @type {Object}
- */
- getAttributeName: {},
-
- /**
- * Mapping from normalized names to properties on DOM node instances.
- * (This includes properties that mutate due to external factors.)
- * @type {Object}
- */
- getPropertyName: {},
-
- /**
- * Mapping from normalized names to mutation methods. This will only exist if
- * mutation cannot be set simply by the property or `setAttribute()`.
- * @type {Object}
- */
- getMutationMethod: {},
-
- /**
- * Whether the property must be accessed and mutated as an object property.
- * @type {Object}
- */
- mustUseAttribute: {},
-
- /**
+ * Map from property "standard name" to an object with info about how to set
+ * the property in the DOM. Each object contains:
+ *
+ * attributeName:
+ * Used when rendering markup or with `*Attribute()`.
+ * attributeNamespace
+ * propertyName:
+ * Used on DOM node instances. (This includes properties that mutate due to
+ * external factors.)
+ * mutationMethod:
+ * If non-null, used instead of the property or `setAttribute()` after
+ * initial render.
+ * mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
- * @type {Object}
- */
- mustUseProperty: {},
-
- /**
+ * mustUseProperty:
+ * Whether the property must be accessed and mutated as an object property.
+ * hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
- * resources to be loaded or text selection changes. We must ensure that
- * the value is only set if it has changed.
- * @type {Object}
- */
- hasSideEffects: {},
-
- /**
+ * resources to be loaded or text selection changes. If true, we read from
+ * the DOM before updating to ensure that the value is only set if it has
+ * changed.
+ * hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
- * @type {Object}
- */
- hasBooleanValue: {},
-
- /**
- * Whether the property must be numeric or parse as a
- * numeric and should be removed when set to a falsey value.
- * @type {Object}
- */
- hasNumericValue: {},
-
- /**
+ * hasNumericValue:
+ * Whether the property must be numeric or parse as a numeric and should be
+ * removed when set to a falsey value.
+ * hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
- * @type {Object}
+ * hasOverloadedBooleanValue:
+ * Whether the property can be used as a flag as well as with a value.
+ * Removed when strictly equal to false; present without a value when
+ * strictly equal to true; present with a value otherwise.
*/
- hasPositiveNumericValue: {},
+ properties: {},
/**
- * Whether the property can be used as a flag as well as with a value. Removed
- * when strictly equal to false; present without a value when strictly equal
- * to true; present with a value otherwise.
+ * Mapping from lowercase property names to the properly cased version, used
+ * to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
- hasOverloadedBooleanValue: {},
+ getPossibleStandardName: "development" !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
@@ -1880,7 +1571,7 @@
* Checks whether a property name is a custom attribute.
* @method
*/
- isCustomAttribute: function(attributeName) {
+ isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
@@ -1898,7 +1589,7 @@
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
- getDefaultValueForProperty: function(nodeName, prop) {
+ getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
@@ -1915,8 +1606,7 @@
};
module.exports = DOMProperty;
-
-},{"135":135}],11:[function(_dereq_,module,exports){
+},{"144":144}],11:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1932,19 +1622,37 @@
'use strict';
var DOMProperty = _dereq_(10);
+var ReactPerf = _dereq_(71);
+
+var quoteAttributeValueForBrowser = _dereq_(122);
+var warning = _dereq_(155);
-var quoteAttributeValueForBrowser = _dereq_(147);
-var warning = _dereq_(154);
+// Simplified subset
+var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
+
+function isAttributeNameSafe(attributeName) {
+ if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
+ return true;
+ }
+ if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
+ return false;
+ }
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ "development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
+ return false;
+}
-function shouldIgnoreValue(name, value) {
- return value == null ||
- (DOMProperty.hasBooleanValue[name] && !value) ||
- (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
- (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
+function shouldIgnoreValue(propertyInfo, value) {
+ return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
@@ -1953,9 +1661,8 @@
};
var warnedProperties = {};
- var warnUnknownProperty = function(name) {
- if (reactProps.hasOwnProperty(name) && reactProps[name] ||
- warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
+ var warnUnknownProperty = function (name) {
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
@@ -1963,23 +1670,11 @@
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
- var standardName = (
- DOMProperty.isCustomAttribute(lowerCasedName) ?
- lowerCasedName :
- DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
- DOMProperty.getPossibleStandardName[lowerCasedName] :
- null
- );
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
- ("production" !== "development" ? warning(
- standardName == null,
- 'Unknown DOM property %s. Did you mean %s?',
- name,
- standardName
- ) : null);
-
+ "development" !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
@@ -1994,9 +1689,12 @@
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
- createMarkupForID: function(id) {
- return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
- quoteAttributeValueForBrowser(id);
+ createMarkupForID: function (id) {
+ return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
+ },
+
+ setAttributeForID: function (node, id) {
+ node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
@@ -2006,16 +1704,15 @@
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
- createMarkupForProperty: function(name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- if (shouldIgnoreValue(name, value)) {
+ createMarkupForProperty: function (name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
- var attributeName = DOMProperty.getAttributeName[name];
- if (DOMProperty.hasBooleanValue[name] ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
- return attributeName;
+ var attributeName = propertyInfo.attributeName;
+ if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
@@ -2023,51 +1720,79 @@
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
+ * Creates markup for a custom property.
+ *
+ * @param {string} name
+ * @param {*} value
+ * @return {string} Markup string, or empty string if the property was invalid.
+ */
+ createMarkupForCustomAttribute: function (name, value) {
+ if (!isAttributeNameSafe(name) || value == null) {
+ return '';
+ }
+ return name + '=' + quoteAttributeValueForBrowser(value);
+ },
+
+ /**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
- setValueForProperty: function(node, name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ setValueForProperty: function (node, name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
- } else if (shouldIgnoreValue(name, value)) {
+ } else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
- } else if (DOMProperty.mustUseAttribute[name]) {
+ } else if (propertyInfo.mustUseAttribute) {
+ var attributeName = propertyInfo.attributeName;
+ var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
- node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
+ if (namespace) {
+ node.setAttributeNS(namespace, attributeName, '' + value);
+ } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ node.setAttribute(attributeName, '');
+ } else {
+ node.setAttribute(attributeName, '' + value);
+ }
} else {
- var propName = DOMProperty.getPropertyName[name];
+ var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== ('' + value)) {
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
+ DOMPropertyOperations.setValueForAttribute(node, name, value);
+ } else if ("development" !== 'production') {
+ warnUnknownProperty(name);
+ }
+ },
+
+ setValueForAttribute: function (node, name, value) {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
- } else if ("production" !== "development") {
- warnUnknownProperty(name);
- }
},
/**
@@ -2076,37 +1801,38 @@
* @param {DOMElement} node
* @param {string} name
*/
- deleteValueForProperty: function(node, name) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ deleteValueForProperty: function (node, name) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
- } else if (DOMProperty.mustUseAttribute[name]) {
- node.removeAttribute(DOMProperty.getAttributeName[name]);
+ } else if (propertyInfo.mustUseAttribute) {
+ node.removeAttribute(propertyInfo.attributeName);
} else {
- var propName = DOMProperty.getPropertyName[name];
- var defaultValue = DOMProperty.getDefaultValueForProperty(
- node.nodeName,
- propName
- );
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== defaultValue) {
+ var propName = propertyInfo.propertyName;
+ var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
}
};
-module.exports = DOMPropertyOperations;
+ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
+ setValueForProperty: 'setValueForProperty',
+ setValueForAttribute: 'setValueForAttribute',
+ deleteValueForProperty: 'deleteValueForProperty'
+});
-},{"10":10,"147":147,"154":154}],12:[function(_dereq_,module,exports){
+module.exports = DOMPropertyOperations;
+},{"10":10,"122":122,"155":155,"71":71}],12:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2119,16 +1845,14 @@
* @typechecks static-only
*/
-/*jslint evil: true, sub: true */
-
'use strict';
-var ExecutionEnvironment = _dereq_(21);
+var ExecutionEnvironment = _dereq_(130);
-var createNodesFromMarkup = _dereq_(112);
-var emptyFunction = _dereq_(114);
-var getMarkupWrap = _dereq_(127);
-var invariant = _dereq_(135);
+var createNodesFromMarkup = _dereq_(135);
+var emptyFunction = _dereq_(136);
+var getMarkupWrap = _dereq_(140);
+var invariant = _dereq_(144);
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
@@ -2159,22 +1883,13 @@
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
- dangerouslyRenderMarkup: function(markupList) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
- 'thread. Make sure `window` and `document` are available globally ' +
- 'before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
+ dangerouslyRenderMarkup: function (markupList) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
- ("production" !== "development" ? invariant(
- markupList[i],
- 'dangerouslyRenderMarkup(...): Missing markup.'
- ) : invariant(markupList[i]));
+ !markupList[i] ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -2199,61 +1914,41 @@
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
- markupListByNodeName[resultIndex] = markup.replace(
- OPEN_TAG_NAME_EXP,
+ markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
- '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
- );
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
- var renderNodes = createNodesFromMarkup(
- markupListByNodeName.join(''),
- emptyFunction // Do nothing special with <script> tags.
+ var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
- if (renderNode.hasAttribute &&
- renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
+ if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
- ("production" !== "development" ? invariant(
- !resultList.hasOwnProperty(resultIndex),
- 'Danger: Assigning to an already-occupied result index.'
- ) : invariant(!resultList.hasOwnProperty(resultIndex)));
+ !!resultList.hasOwnProperty(resultIndex) ? "development" !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
-
- } else if ("production" !== "development") {
- console.error(
- 'Danger: Discarding unexpected node:',
- renderNode
- );
+ } else if ("development" !== 'production') {
+ console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
- ("production" !== "development" ? invariant(
- resultListAssignmentCount === resultList.length,
- 'Danger: Did not assign to every index of resultList.'
- ) : invariant(resultListAssignmentCount === resultList.length));
-
- ("production" !== "development" ? invariant(
- resultList.length === markupList.length,
- 'Danger: Expected markup to render %s nodes, but rendered %s.',
- markupList.length,
- resultList.length
- ) : invariant(resultList.length === markupList.length));
+ !(resultListAssignmentCount === resultList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
+
+ !(resultList.length === markupList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
@@ -2266,32 +1961,24 @@
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
- dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
- 'worker thread. Make sure `window` and `document` are available ' +
- 'globally before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
- ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
- ("production" !== "development" ? invariant(
- oldChild.tagName.toLowerCase() !== 'html',
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
- '<html> node. This is because browser quirks make this unreliable ' +
- 'and/or slow. If you want to render to the root you must use ' +
- 'server rendering. See React.renderToString().'
- ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
-
- var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
+ !markup ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
+ !(oldChild.tagName.toLowerCase() !== 'html') ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
+
+ var newChild;
+ if (typeof markup === 'string') {
+ newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ } else {
+ newChild = markup;
+ }
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
-
-},{"112":112,"114":114,"127":127,"135":135,"21":21}],13:[function(_dereq_,module,exports){
+},{"130":130,"135":135,"136":136,"140":140,"144":144}],13:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2305,7 +1992,7 @@
'use strict';
-var keyOf = _dereq_(141);
+var keyOf = _dereq_(148);
/**
* Module that is injectable into `EventPluginHub`, that specifies a
@@ -2316,21 +2003,10 @@
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
-var DefaultEventPluginOrder = [
- keyOf({ResponderEventPlugin: null}),
- keyOf({SimpleEventPlugin: null}),
- keyOf({TapEventPlugin: null}),
- keyOf({EnterLeaveEventPlugin: null}),
- keyOf({ChangeEventPlugin: null}),
- keyOf({SelectEventPlugin: null}),
- keyOf({BeforeInputEventPlugin: null}),
- keyOf({AnalyticsEventPlugin: null}),
- keyOf({MobileSafariClickEventPlugin: null})
-];
+var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
-
-},{"141":141}],14:[function(_dereq_,module,exports){
+},{"148":148}],14:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2346,29 +2022,23 @@
'use strict';
var EventConstants = _dereq_(15);
-var EventPropagators = _dereq_(20);
-var SyntheticMouseEvent = _dereq_(99);
+var EventPropagators = _dereq_(19);
+var SyntheticMouseEvent = _dereq_(96);
-var ReactMount = _dereq_(70);
-var keyOf = _dereq_(141);
+var ReactMount = _dereq_(65);
+var keyOf = _dereq_(148);
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
- registrationName: keyOf({onMouseEnter: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseEnter: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
- registrationName: keyOf({onMouseLeave: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseLeave: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
@@ -2392,17 +2062,11 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topMouseOver &&
- (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
- if (topLevelType !== topLevelTypes.topMouseOut &&
- topLevelType !== topLevelTypes.topMouseOver) {
+ if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
@@ -2421,15 +2085,24 @@
}
}
- var from, to;
+ var from;
+ var to;
+ var fromID = '';
+ var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
- to =
- getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
- win;
+ fromID = topLevelTargetID;
+ to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
+ if (to) {
+ toID = ReactMount.getID(to);
+ } else {
+ to = win;
+ }
+ to = to || win;
} else {
from = win;
to = topLevelTarget;
+ toID = topLevelTargetID;
}
if (from === to) {
@@ -2437,23 +2110,12 @@
return null;
}
- var fromID = from ? ReactMount.getID(from) : '';
- var toID = to ? ReactMount.getID(to) : '';
-
- var leave = SyntheticMouseEvent.getPooled(
- eventTypes.mouseLeave,
- fromID,
- nativeEvent
- );
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
- var enter = SyntheticMouseEvent.getPooled(
- eventTypes.mouseEnter,
- toID,
- nativeEvent
- );
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
@@ -2469,8 +2131,7 @@
};
module.exports = EnterLeaveEventPlugin;
-
-},{"141":141,"15":15,"20":20,"70":70,"99":99}],15:[function(_dereq_,module,exports){
+},{"148":148,"15":15,"19":19,"65":65,"96":96}],15:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2484,15 +2145,18 @@
'use strict';
-var keyMirror = _dereq_(140);
+var keyMirror = _dereq_(147);
-var PropagationPhases = keyMirror({bubbled: null, captured: null});
+var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
+ topAbort: null,
topBlur: null,
+ topCanPlay: null,
+ topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
@@ -2510,6 +2174,10 @@
topDragOver: null,
topDragStart: null,
topDrop: null,
+ topDurationChange: null,
+ topEmptied: null,
+ topEncrypted: null,
+ topEnded: null,
topError: null,
topFocus: null,
topInput: null,
@@ -2517,21 +2185,36 @@
topKeyPress: null,
topKeyUp: null,
topLoad: null,
+ topLoadedData: null,
+ topLoadedMetadata: null,
+ topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
+ topPause: null,
+ topPlay: null,
+ topPlaying: null,
+ topProgress: null,
+ topRateChange: null,
topReset: null,
topScroll: null,
+ topSeeked: null,
+ topSeeking: null,
topSelectionChange: null,
+ topStalled: null,
topSubmit: null,
+ topSuspend: null,
topTextInput: null,
+ topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
+ topVolumeChange: null,
+ topWaiting: null,
topWheel: null
});
@@ -2541,96 +2224,7 @@
};
module.exports = EventConstants;
-
-},{"140":140}],16:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @providesModule EventListener
- * @typechecks
- */
-
-var emptyFunction = _dereq_(114);
-
-/**
- * Upstream version of event listener. Does not take into account specific
- * nature of platform.
- */
-var EventListener = {
- /**
- * Listen to DOM events during the bubble phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- listen: function(target, eventType, callback) {
- if (target.addEventListener) {
- target.addEventListener(eventType, callback, false);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, false);
- }
- };
- } else if (target.attachEvent) {
- target.attachEvent('on' + eventType, callback);
- return {
- remove: function() {
- target.detachEvent('on' + eventType, callback);
- }
- };
- }
- },
-
- /**
- * Listen to DOM events during the capture phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- capture: function(target, eventType, callback) {
- if (!target.addEventListener) {
- if ("production" !== "development") {
- console.error(
- 'Attempted to listen to events during the capture phase on a ' +
- 'browser that does not support the capture phase. Your application ' +
- 'will not receive some events.'
- );
- }
- return {
- remove: emptyFunction
- };
- } else {
- target.addEventListener(eventType, callback, true);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, true);
- }
- };
- }
- },
-
- registerDefault: function() {}
-};
-
-module.exports = EventListener;
-
-},{"114":114}],17:[function(_dereq_,module,exports){
+},{"147":147}],16:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2644,12 +2238,14 @@
'use strict';
-var EventPluginRegistry = _dereq_(18);
-var EventPluginUtils = _dereq_(19);
-
-var accumulateInto = _dereq_(105);
-var forEachAccumulated = _dereq_(120);
-var invariant = _dereq_(135);
+var EventPluginRegistry = _dereq_(17);
+var EventPluginUtils = _dereq_(18);
+var ReactErrorUtils = _dereq_(56);
+
+var accumulateInto = _dereq_(102);
+var forEachAccumulated = _dereq_(110);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
/**
* Internal store for event listeners
@@ -2666,23 +2262,24 @@
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
-var executeDispatchesAndRelease = function(event) {
+var executeDispatchesAndRelease = function (event, simulated) {
if (event) {
- var executeDispatch = EventPluginUtils.executeDispatch;
- // Plugins can provide custom behavior when dispatching events.
- var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
- if (PluginModule && PluginModule.executeDispatch) {
- executeDispatch = PluginModule.executeDispatch;
- }
- EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
+ EventPluginUtils.executeDispatchesInOrder(event, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
+var executeDispatchesAndReleaseSimulated = function (e) {
+ return executeDispatchesAndRelease(e, true);
+};
+var executeDispatchesAndReleaseTopLevel = function (e) {
+ return executeDispatchesAndRelease(e, false);
+};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
@@ -2691,14 +2288,8 @@
var InstanceHandle = null;
function validateInstanceHandle() {
- var valid =
- InstanceHandle &&
- InstanceHandle.traverseTwoPhase &&
- InstanceHandle.traverseEnterLeave;
- ("production" !== "development" ? invariant(
- valid,
- 'InstanceHandle not injected before use!'
- ) : invariant(valid));
+ var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
+ "development" !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
}
/**
@@ -2740,15 +2331,15 @@
* @param {object} InjectedInstanceHandle
* @public
*/
- injectInstanceHandle: function(InjectedInstanceHandle) {
+ injectInstanceHandle: function (InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateInstanceHandle();
}
},
- getInstanceHandle: function() {
- if ("production" !== "development") {
+ getInstanceHandle: function () {
+ if ("development" !== 'production') {
validateInstanceHandle();
}
return InstanceHandle;
@@ -2778,16 +2369,16 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
- putListener: function(id, registrationName, listener) {
- ("production" !== "development" ? invariant(
- !listener || typeof listener === 'function',
- 'Expected %s listener to be a function, instead got type %s',
- registrationName, typeof listener
- ) : invariant(!listener || typeof listener === 'function'));
+ putListener: function (id, registrationName, listener) {
+ !(typeof listener === 'function') ? "development" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
- var bankForRegistrationName =
- listenerBank[registrationName] || (listenerBank[registrationName] = {});
+ var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.didPutListener) {
+ PluginModule.didPutListener(id, registrationName, listener);
+ }
},
/**
@@ -2795,7 +2386,7 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
- getListener: function(id, registrationName) {
+ getListener: function (id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
@@ -2806,8 +2397,14 @@
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
- deleteListener: function(id, registrationName) {
+ deleteListener: function (id, registrationName) {
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
var bankForRegistrationName = listenerBank[registrationName];
+ // TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
@@ -2818,8 +2415,17 @@
*
* @param {string} id ID of the DOM element.
*/
- deleteAllListeners: function(id) {
+ deleteAllListeners: function (id) {
for (var registrationName in listenerBank) {
+ if (!listenerBank[registrationName][id]) {
+ continue;
+ }
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
delete listenerBank[registrationName][id];
}
},
@@ -2835,23 +2441,14 @@
* @return {*} An accumulation of synthetic events.
* @internal
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
- for (var i = 0, l = plugins.length; i < l; i++) {
+ for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
- var extractedEvents = possiblePlugin.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
@@ -2867,7 +2464,7 @@
* @param {*} events An accumulation of synthetic events.
* @internal
*/
- enqueueEvents: function(events) {
+ enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
@@ -2878,35 +2475,36 @@
*
* @internal
*/
- processEventQueue: function() {
+ processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
- forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
- ("production" !== "development" ? invariant(
- !eventQueue,
- 'processEventQueue(): Additional events were enqueued while processing ' +
- 'an event queue. Support for this has not yet been implemented.'
- ) : invariant(!eventQueue));
+ if (simulated) {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
+ } else {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
+ }
+ !!eventQueue ? "development" !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
+ // This would be a good time to rethrow if any of the event handlers threw.
+ ReactErrorUtils.rethrowCaughtError();
},
/**
* These are needed for tests only. Do not use!
*/
- __purge: function() {
+ __purge: function () {
listenerBank = {};
},
- __getListenerBank: function() {
+ __getListenerBank: function () {
return listenerBank;
}
};
module.exports = EventPluginHub;
-
-},{"105":105,"120":120,"135":135,"18":18,"19":19}],18:[function(_dereq_,module,exports){
+},{"102":102,"110":110,"144":144,"155":155,"17":17,"18":18,"56":56}],17:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2921,7 +2519,7 @@
'use strict';
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
/**
* Injectable ordering of event plugins.
@@ -2946,38 +2544,15 @@
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
- ("production" !== "development" ? invariant(
- pluginIndex > -1,
- 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
- 'the plugin ordering, `%s`.',
- pluginName
- ) : invariant(pluginIndex > -1));
+ !(pluginIndex > -1) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
- ("production" !== "development" ? invariant(
- PluginModule.extractEvents,
- 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
- 'method, but `%s` does not.',
- pluginName
- ) : invariant(PluginModule.extractEvents));
+ !PluginModule.extractEvents ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
- ("production" !== "development" ? invariant(
- publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- ),
- 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
- eventName,
- pluginName
- ) : invariant(publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- )));
+ !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
}
}
}
@@ -2991,12 +2566,7 @@
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
- ("production" !== "development" ? invariant(
- !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'event name, `%s`.',
- eventName
- ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
@@ -3004,20 +2574,12 @@
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
- publishRegistrationName(
- phasedRegistrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
- publishRegistrationName(
- dispatchConfig.registrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
return true;
}
return false;
@@ -3032,15 +2594,9 @@
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
- ("production" !== "development" ? invariant(
- !EventPluginRegistry.registrationNameModules[registrationName],
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'registration name, `%s`.',
- registrationName
- ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
- EventPluginRegistry.registrationNameDependencies[registrationName] =
- PluginModule.eventTypes[eventName].dependencies;
+ EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
}
/**
@@ -3079,12 +2635,8 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
- injectEventPluginOrder: function(InjectedEventPluginOrder) {
- ("production" !== "development" ? invariant(
- !EventPluginOrder,
- 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
- 'once. You are likely trying to load more than one copy of React.'
- ) : invariant(!EventPluginOrder));
+ injectEventPluginOrder: function (InjectedEventPluginOrder) {
+ !!EventPluginOrder ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
@@ -3100,21 +2652,15 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
- injectEventPluginsByName: function(injectedNamesToPlugins) {
+ injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
- if (!namesToPlugins.hasOwnProperty(pluginName) ||
- namesToPlugins[pluginName] !== PluginModule) {
- ("production" !== "development" ? invariant(
- !namesToPlugins[pluginName],
- 'EventPluginRegistry: Cannot inject two different event plugins ' +
- 'using the same name, `%s`.',
- pluginName
- ) : invariant(!namesToPlugins[pluginName]));
+ if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
+ !!namesToPlugins[pluginName] ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
@@ -3131,20 +2677,16 @@
* @return {?object} The plugin that created the supplied event.
* @internal
*/
- getPluginModuleForEvent: function(event) {
+ getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
- return EventPluginRegistry.registrationNameModules[
- dispatchConfig.registrationName
- ] || null;
+ return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
- var PluginModule = EventPluginRegistry.registrationNameModules[
- dispatchConfig.phasedRegistrationNames[phase]
- ];
+ var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
if (PluginModule) {
return PluginModule;
}
@@ -3156,7 +2698,7 @@
* Exposed for unit testing.
* @private
*/
- _resetEventPlugins: function() {
+ _resetEventPlugins: function () {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
@@ -3183,8 +2725,7 @@
};
module.exports = EventPluginRegistry;
-
-},{"135":135}],19:[function(_dereq_,module,exports){
+},{"144":144}],18:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3199,8 +2740,10 @@
'use strict';
var EventConstants = _dereq_(15);
+var ReactErrorUtils = _dereq_(56);
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
/**
* Injected dependencies:
@@ -3212,14 +2755,10 @@
*/
var injection = {
Mount: null,
- injectMount: function(InjectedMount) {
+ injectMount: function (InjectedMount) {
injection.Mount = InjectedMount;
- if ("production" !== "development") {
- ("production" !== "development" ? invariant(
- InjectedMount && InjectedMount.getNode,
- 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
- 'is missing getNode.'
- ) : invariant(InjectedMount && InjectedMount.getNode));
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
}
}
};
@@ -3227,50 +2766,56 @@
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseUp ||
- topLevelType === topLevelTypes.topTouchEnd ||
- topLevelType === topLevelTypes.topTouchCancel;
+ return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseMove ||
- topLevelType === topLevelTypes.topTouchMove;
+ return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseDown ||
- topLevelType === topLevelTypes.topTouchStart;
+ return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
}
-
var validateEventDispatches;
-if ("production" !== "development") {
- validateEventDispatches = function(event) {
+if ("development" !== 'production') {
+ validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
- var listenersLen = listenersIsArr ?
- dispatchListeners.length :
- dispatchListeners ? 1 : 0;
-
- ("production" !== "development" ? invariant(
- idsIsArr === listenersIsArr && IDsLen === listenersLen,
- 'EventPluginUtils: Invalid `event`.'
- ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
+ var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
+
+ "development" !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
};
}
/**
- * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
- * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
- * kept separate to conserve memory.
+ * Dispatch the event to the listener.
+ * @param {SyntheticEvent} event SyntheticEvent to handle
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
+ * @param {function} listener Application-level callback
+ * @param {string} domID DOM id to pass to the callback.
+ */
+function executeDispatch(event, simulated, listener, domID) {
+ var type = event.type || 'unknown-event';
+ event.currentTarget = injection.Mount.getNode(domID);
+ if (simulated) {
+ ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
+ } else {
+ ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
+ }
+ event.currentTarget = null;
+}
+
+/**
+ * Standard/simple iteration through an event's collected dispatches.
*/
-function forEachEventDispatch(event, cb) {
+function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -3279,31 +2824,11 @@
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
- cb(event, dispatchListeners[i], dispatchIDs[i]);
+ executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
- cb(event, dispatchListeners, dispatchIDs);
+ executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
}
-}
-
-/**
- * Default implementation of PluginModule.executeDispatch().
- * @param {SyntheticEvent} SyntheticEvent to handle
- * @param {function} Application-level callback
- * @param {string} domID DOM id to pass to the callback.
- */
-function executeDispatch(event, listener, domID) {
- event.currentTarget = injection.Mount.getNode(domID);
- var returnValue = listener(event, domID);
- event.currentTarget = null;
- return returnValue;
-}
-
-/**
- * Standard/simple iteration through an event's collected dispatches.
- */
-function executeDispatchesInOrder(event, cb) {
- forEachEventDispatch(event, cb);
event._dispatchListeners = null;
event._dispatchIDs = null;
}
@@ -3312,13 +2837,13 @@
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
- * @return id of the first dispatch execution who's listener returns true, or
- * null if no listener returned true.
+ * @return {?string} id of the first dispatch execution who's listener returns
+ * true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -3356,21 +2881,16 @@
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
- * @return The return value of executing the single dispatch.
+ * @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
- ("production" !== "development" ? invariant(
- !Array.isArray(dispatchListener),
- 'executeDirectDispatch(...): Invalid `event`.'
- ) : invariant(!Array.isArray(dispatchListener)));
- var res = dispatchListener ?
- dispatchListener(event, dispatchID) :
- null;
+ !!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
+ var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
@@ -3378,7 +2898,7 @@
/**
* @param {SyntheticEvent} event
- * @return {bool} True iff number of dispatches accumulated is greater than 0.
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
@@ -3393,17 +2913,22 @@
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
- executeDispatch: executeDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
- injection: injection,
- useTouchEvents: false
+
+ getNode: function (id) {
+ return injection.Mount.getNode(id);
+ },
+ getID: function (node) {
+ return injection.Mount.getID(node);
+ },
+
+ injection: injection
};
module.exports = EventPluginUtils;
-
-},{"135":135,"15":15}],20:[function(_dereq_,module,exports){
+},{"144":144,"15":15,"155":155,"56":56}],19:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3418,10 +2943,12 @@
'use strict';
var EventConstants = _dereq_(15);
-var EventPluginHub = _dereq_(17);
+var EventPluginHub = _dereq_(16);
+
+var warning = _dereq_(155);
-var accumulateInto = _dereq_(105);
-var forEachAccumulated = _dereq_(120);
+var accumulateInto = _dereq_(102);
+var forEachAccumulated = _dereq_(110);
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
@@ -3431,8 +2958,7 @@
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
- var registrationName =
- event.dispatchConfig.phasedRegistrationNames[propagationPhase];
+ var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
@@ -3443,16 +2969,13 @@
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
- if ("production" !== "development") {
- if (!domID) {
- throw new Error('Dispatching id must not be null');
- }
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
@@ -3460,20 +2983,24 @@
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
- * each event and perform the traversal for each one. We can not perform a
+ * each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
- event.dispatchMarker,
- accumulateDirectionalDispatches,
- event
- );
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
+/**
+ * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
+ */
+function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
+ if (event && event.dispatchConfig.phasedRegistrationNames) {
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
+ }
+}
/**
* Accumulates without regard to direction, does not look for phased
@@ -3485,8 +3012,7 @@
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
@@ -3507,16 +3033,13 @@
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
-function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
- EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
- fromID,
- toID,
- accumulateDispatches,
- leave,
- enter
- );
+function accumulateTwoPhaseDispatchesSkipTarget(events) {
+ forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
+function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
+ EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
+}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
@@ -3537,57 +3058,13 @@
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
+ accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
-
-},{"105":105,"120":120,"15":15,"17":17}],21:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ExecutionEnvironment
- */
-
-/*jslint evil: true */
-
-"use strict";
-
-var canUseDOM = !!(
- (typeof window !== 'undefined' &&
- window.document && window.document.createElement)
-);
-
-/**
- * Simple, lightweight module assisting with the detection and context of
- * Worker. Helps avoid circular dependencies and allows code to reason about
- * whether or not they are in a Worker, even if they never include the main
- * `ReactWorker` dependency.
- */
-var ExecutionEnvironment = {
-
- canUseDOM: canUseDOM,
-
- canUseWorkers: typeof Worker !== 'undefined',
-
- canUseEventListeners:
- canUseDOM && !!(window.addEventListener || window.attachEvent),
-
- canUseViewport: canUseDOM && !!window.screen,
-
- isInWorker: !canUseDOM // For now, this is true - might change in the future.
-
-};
-
-module.exports = ExecutionEnvironment;
-
-},{}],22:[function(_dereq_,module,exports){
+},{"102":102,"110":110,"15":15,"155":155,"16":16}],20:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3602,10 +3079,10 @@
'use strict';
-var PooledClass = _dereq_(28);
+var PooledClass = _dereq_(24);
-var assign = _dereq_(27);
-var getTextContentAccessor = _dereq_(130);
+var assign = _dereq_(23);
+var getTextContentAccessor = _dereq_(117);
/**
* This helper class stores information about text content of a target node,
@@ -3625,12 +3102,18 @@
}
assign(FallbackCompositionState.prototype, {
+ destructor: function () {
+ this._root = null;
+ this._startText = null;
+ this._fallbackText = null;
+ },
+
/**
* Get current text of input.
*
* @return {string}
*/
- getText: function() {
+ getText: function () {
if ('value' in this._root) {
return this._root.value;
}
@@ -3643,7 +3126,7 @@
*
* @return {string}
*/
- getData: function() {
+ getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}
@@ -3677,8 +3160,7 @@
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
-
-},{"130":130,"27":27,"28":28}],23:[function(_dereq_,module,exports){
+},{"117":117,"23":23,"24":24}],21:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3690,41 +3172,27 @@
* @providesModule HTMLDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
var DOMProperty = _dereq_(10);
-var ExecutionEnvironment = _dereq_(21);
+var ExecutionEnvironment = _dereq_(130);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE =
- DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE =
- DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
+var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
+var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
- hasSVG = (
- implementation &&
- implementation.hasFeature &&
- implementation.hasFeature(
- 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
- '1.1'
- )
- );
+ hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
}
-
var HTMLDOMPropertyConfig = {
- isCustomAttribute: RegExp.prototype.test.bind(
- /^(data|aria)-[a-z_][a-z\d_.\-]*$/
- ),
+ isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
Properties: {
/**
* Standard Properties
@@ -3738,12 +3206,14 @@
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
- // autoFocus is polyfilled/normalized by AutoFocusMixin
+ // autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
+ capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
+ challenge: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
@@ -3762,6 +3232,7 @@
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
+ 'default': HAS_BOOLEAN_VALUE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
@@ -3785,6 +3256,12 @@
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
+ inputMode: MUST_USE_ATTRIBUTE,
+ integrity: null,
+ is: MUST_USE_ATTRIBUTE,
+ keyParams: MUST_USE_ATTRIBUTE,
+ keyType: MUST_USE_ATTRIBUTE,
+ kind: null,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
@@ -3799,9 +3276,11 @@
mediaGroup: null,
method: null,
min: null,
+ minLength: MUST_USE_ATTRIBUTE,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
+ nonce: MUST_USE_ATTRIBUTE,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
optimum: null,
@@ -3813,6 +3292,7 @@
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
+ reversed: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
@@ -3829,10 +3309,12 @@
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
+ srcLang: null,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
+ summary: null,
tabIndex: null,
target: null,
title: null,
@@ -3841,14 +3323,32 @@
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
+ wrap: null,
+
+ /**
+ * RDFa Properties
+ */
+ about: MUST_USE_ATTRIBUTE,
+ datatype: MUST_USE_ATTRIBUTE,
+ inlist: MUST_USE_ATTRIBUTE,
+ prefix: MUST_USE_ATTRIBUTE,
+ // property is also supported for OpenGraph in meta tags.
+ property: MUST_USE_ATTRIBUTE,
+ resource: MUST_USE_ATTRIBUTE,
+ 'typeof': MUST_USE_ATTRIBUTE,
+ vocab: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
- autoCapitalize: null,
- autoCorrect: null,
+ autoCapitalize: MUST_USE_ATTRIBUTE,
+ autoCorrect: MUST_USE_ATTRIBUTE,
+ // autoSave allows WebKit/Blink to persist values of input fields on page reloads
+ autoSave: null,
+ // color is for Safari mask-icon link
+ color: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
@@ -3859,8 +3359,12 @@
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
- // property is supported for OpenGraph in meta tags.
- property: null,
+ // results show looking glass icon and recent searches on input
+ // search fields in WebKit/Blink
+ results: null,
+ // IE-only attribute that specifies security restrictions on an iframe
+ // as an alternative to the sandbox attribute on IE<10
+ security: MUST_USE_ATTRIBUTE,
// IE-only attribute that controls focus behavior
unselectable: MUST_USE_ATTRIBUTE
},
@@ -3871,11 +3375,10 @@
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
- autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
- autoCorrect: 'autocorrect',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
+ autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',
@@ -3888,8 +3391,7 @@
};
module.exports = HTMLDOMPropertyConfig;
-
-},{"10":10,"21":21}],24:[function(_dereq_,module,exports){
+},{"10":10,"130":130}],22:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3904,9 +3406,11 @@
'use strict';
-var ReactPropTypes = _dereq_(78);
+var ReactPropTypes = _dereq_(74);
+var ReactPropTypeLocations = _dereq_(73);
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
var hasReadOnlyValue = {
'button': true,
@@ -3918,46 +3422,44 @@
'submit': true
};
-function _assertSingleLink(input) {
- ("production" !== "development" ? invariant(
- input.props.checkedLink == null || input.props.valueLink == null,
- 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
- 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
- ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
+function _assertSingleLink(inputProps) {
+ !(inputProps.checkedLink == null || inputProps.valueLink == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
}
-function _assertValueLink(input) {
- _assertSingleLink(input);
- ("production" !== "development" ? invariant(
- input.props.value == null && input.props.onChange == null,
- 'Cannot provide a valueLink and a value or onChange event. If you want ' +
- 'to use value or onChange, you probably don\'t want to use valueLink.'
- ) : invariant(input.props.value == null && input.props.onChange == null));
+function _assertValueLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.value == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
}
-function _assertCheckedLink(input) {
- _assertSingleLink(input);
- ("production" !== "development" ? invariant(
- input.props.checked == null && input.props.onChange == null,
- 'Cannot provide a checkedLink and a checked property or onChange event. ' +
- 'If you want to use checked or onChange, you probably don\'t want to ' +
- 'use checkedLink'
- ) : invariant(input.props.checked == null && input.props.onChange == null));
+function _assertCheckedLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.checked == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
}
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedValueChange(e) {
- /*jshint validthis:true */
- this.props.valueLink.requestChange(e.target.value);
-}
+var propTypes = {
+ value: function (props, propName, componentName) {
+ if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ checked: function (props, propName, componentName) {
+ if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ onChange: ReactPropTypes.func
+};
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedCheckChange(e) {
- /*jshint validthis:true */
- this.props.checkedLink.requestChange(e.target.checked);
+var loggedTypeFailures = {};
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
+ }
+ return '';
}
/**
@@ -3965,198 +3467,66 @@
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
- Mixin: {
- propTypes: {
- value: function(props, propName, componentName) {
- if (!props[propName] ||
- hasReadOnlyValue[props.type] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
+ checkPropTypes: function (tagName, props, owner) {
+ for (var propName in propTypes) {
+ if (propTypes.hasOwnProperty(propName)) {
+ var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
}
- return new Error(
- 'You provided a `value` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultValue`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- checked: function(props, propName, componentName) {
- if (!props[propName] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
+ // Only monitor this failure once because there tends to be a lot of the
+ // same error.
+ loggedTypeFailures[error.message] = true;
+
+ var addendum = getDeclarationErrorAddendum(owner);
+ "development" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
}
- return new Error(
- 'You provided a `checked` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultChecked`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- onChange: ReactPropTypes.func
}
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
- getValue: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return input.props.valueLink.value;
+ getValue: function (inputProps) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.value;
}
- return input.props.value;
+ return inputProps.value;
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
- getChecked: function(input) {
- if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return input.props.checkedLink.value;
- }
- return input.props.checked;
+ getChecked: function (inputProps) {
+ if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.value;
+ }
+ return inputProps.checked;
},
/**
- * @param {ReactComponent} input Form component
- * @return {function} change callback either from onChange prop or link.
- */
- getOnChange: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return _handleLinkedValueChange;
- } else if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return _handleLinkedCheckChange;
+ * @param {object} inputProps Props for form component
+ * @param {SyntheticEvent} event change event to handle
+ */
+ executeOnChange: function (inputProps, event) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.requestChange(event.target.value);
+ } else if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.requestChange(event.target.checked);
+ } else if (inputProps.onChange) {
+ return inputProps.onChange.call(undefined, event);
}
- return input.props.onChange;
}
};
module.exports = LinkedValueUtils;
-
-},{"135":135,"78":78}],25:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule LocalEventTrapMixin
- */
-
-'use strict';
-
-var ReactBrowserEventEmitter = _dereq_(30);
-
-var accumulateInto = _dereq_(105);
-var forEachAccumulated = _dereq_(120);
-var invariant = _dereq_(135);
-
-function remove(event) {
- event.remove();
-}
-
-var LocalEventTrapMixin = {
- trapBubbledEvent:function(topLevelType, handlerBaseName) {
- ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
- // If a component renders to null or if another component fatals and causes
- // the state of the tree to be corrupted, `node` here can be null.
- var node = this.getDOMNode();
- ("production" !== "development" ? invariant(
- node,
- 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
- ) : invariant(node));
- var listener = ReactBrowserEventEmitter.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- node
- );
- this._localEventListeners =
- accumulateInto(this._localEventListeners, listener);
- },
-
- // trapCapturedEvent would look nearly identical. We don't implement that
- // method because it isn't currently needed.
-
- componentWillUnmount:function() {
- if (this._localEventListeners) {
- forEachAccumulated(this._localEventListeners, remove);
- }
- }
-};
-
-module.exports = LocalEventTrapMixin;
-
-},{"105":105,"120":120,"135":135,"30":30}],26:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule MobileSafariClickEventPlugin
- * @typechecks static-only
- */
-
-'use strict';
-
-var EventConstants = _dereq_(15);
-
-var emptyFunction = _dereq_(114);
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-/**
- * Mobile Safari does not fire properly bubble click events on non-interactive
- * elements, which means delegated click listeners do not fire. The workaround
- * for this bug involves attaching an empty click listener on the target node.
- *
- * This particular plugin works around the bug by attaching an empty click
- * listener on `touchstart` (which does fire on every element).
- */
-var MobileSafariClickEventPlugin = {
-
- eventTypes: null,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topTouchStart) {
- var target = nativeEvent.target;
- if (target && !target.onclick) {
- target.onclick = emptyFunction;
- }
- }
- }
-
-};
-
-module.exports = MobileSafariClickEventPlugin;
-
-},{"114":114,"15":15}],27:[function(_dereq_,module,exports){
+},{"144":144,"155":155,"73":73,"74":74}],23:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -4204,8 +3574,7 @@
}
module.exports = assign;
-
-},{}],28:[function(_dereq_,module,exports){
+},{}],24:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4219,7 +3588,7 @@
'use strict';
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
/**
* Static poolers. Several custom versions for each potential number of
@@ -4228,7 +3597,7 @@
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
-var oneArgumentPooler = function(copyFieldsFrom) {
+var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4239,7 +3608,7 @@
}
};
-var twoArgumentPooler = function(a1, a2) {
+var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4250,7 +3619,7 @@
}
};
-var threeArgumentPooler = function(a1, a2, a3) {
+var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4261,7 +3630,18 @@
}
};
-var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
+var fourArgumentPooler = function (a1, a2, a3, a4) {
+ var Klass = this;
+ if (Klass.instancePool.length) {
+ var instance = Klass.instancePool.pop();
+ Klass.call(instance, a1, a2, a3, a4);
+ return instance;
+ } else {
+ return new Klass(a1, a2, a3, a4);
+ }
+};
+
+var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4272,15 +3652,10 @@
}
};
-var standardReleaser = function(instance) {
+var standardReleaser = function (instance) {
var Klass = this;
- ("production" !== "development" ? invariant(
- instance instanceof Klass,
- 'Trying to release an instance into a pool of a different type.'
- ) : invariant(instance instanceof Klass));
- if (instance.destructor) {
+ !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
instance.destructor();
- }
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
@@ -4298,7 +3673,7 @@
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
-var addPoolingTo = function(CopyConstructor, pooler) {
+var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
@@ -4314,12 +3689,12 @@
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
+ fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
-
-},{"135":135}],29:[function(_dereq_,module,exports){
+},{"144":144}],25:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4333,7 +3708,12 @@
'use strict';
-var findDOMNode = _dereq_(117);
+var ReactInstanceMap = _dereq_(62);
+
+var findDOMNode = _dereq_(108);
+var warning = _dereq_(155);
+
+var didWarnKey = '_getDOMNodeDidWarn';
var ReactBrowserComponentMixin = {
/**
@@ -4343,14 +3723,15 @@
* @final
* @protected
*/
- getDOMNode: function() {
+ getDOMNode: function () {
+ "development" !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
+ this.constructor[didWarnKey] = true;
return findDOMNode(this);
}
};
module.exports = ReactBrowserComponentMixin;
-
-},{"117":117}],30:[function(_dereq_,module,exports){
+},{"108":108,"155":155,"62":62}],26:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4366,13 +3747,14 @@
'use strict';
var EventConstants = _dereq_(15);
-var EventPluginHub = _dereq_(17);
-var EventPluginRegistry = _dereq_(18);
-var ReactEventEmitterMixin = _dereq_(61);
-var ViewportMetrics = _dereq_(104);
+var EventPluginHub = _dereq_(16);
+var EventPluginRegistry = _dereq_(17);
+var ReactEventEmitterMixin = _dereq_(57);
+var ReactPerf = _dereq_(71);
+var ViewportMetrics = _dereq_(101);
-var assign = _dereq_(27);
-var isEventSupported = _dereq_(136);
+var assign = _dereq_(23);
+var isEventSupported = _dereq_(119);
/**
* Summary of `ReactBrowserEventEmitter` event handling:
@@ -4437,7 +3819,10 @@
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
+ topAbort: 'abort',
topBlur: 'blur',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
@@ -4455,24 +3840,44 @@
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
topScroll: 'scroll',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
topTextInput: 'textInput',
+ topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting',
topWheel: 'wheel'
};
@@ -4512,10 +3917,8 @@
/**
* @param {object} ReactEventListener
*/
- injectReactEventListener: function(ReactEventListener) {
- ReactEventListener.setHandleTopLevel(
- ReactBrowserEventEmitter.handleTopLevel
- );
+ injectReactEventListener: function (ReactEventListener) {
+ ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
@@ -4525,7 +3928,7 @@
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
@@ -4534,10 +3937,8 @@
/**
* @return {boolean} True if callbacks are enabled.
*/
- isEnabled: function() {
- return !!(
- (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
- );
+ isEnabled: function () {
+ return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
@@ -4561,93 +3962,49 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
- listenTo: function(registrationName, contentDocumentHandle) {
+ listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
- var dependencies = EventPluginRegistry.
- registrationNameDependencies[registrationName];
+ var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
- for (var i = 0, l = dependencies.length; i < l; i++) {
+ for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
- if (!(
- (isListening.hasOwnProperty(dependency) && isListening[dependency])
- )) {
+ if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'wheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'mousewheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'DOMMouseScroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topScroll,
- 'scroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topScroll,
- 'scroll',
- ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
- } else if (dependency === topLevelTypes.topFocus ||
- dependency === topLevelTypes.topBlur) {
+ } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topFocus,
- 'focus',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topBlur,
- 'blur',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topFocus,
- 'focusin',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topBlur,
- 'focusout',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- dependency,
- topEventMapping[dependency],
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
@@ -4655,20 +4012,12 @@
}
},
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
@@ -4679,7 +4028,7 @@
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
- ensureScrollValueMonitoring: function() {
+ ensureScrollValueMonitoring: function () {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
@@ -4701,9 +4050,13 @@
});
-module.exports = ReactBrowserEventEmitter;
+ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
+ putListener: 'putListener',
+ deleteListener: 'deleteListener'
+});
-},{"104":104,"136":136,"15":15,"17":17,"18":18,"27":27,"61":61}],31:[function(_dereq_,module,exports){
+module.exports = ReactBrowserEventEmitter;
+},{"101":101,"119":119,"15":15,"16":16,"17":17,"23":23,"57":57,"71":71}],27:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -4718,11 +4071,23 @@
'use strict';
-var ReactReconciler = _dereq_(81);
+var ReactReconciler = _dereq_(76);
+
+var instantiateReactComponent = _dereq_(118);
+var shouldUpdateReactComponent = _dereq_(126);
+var traverseAllChildren = _dereq_(127);
+var warning = _dereq_(155);
-var flattenChildren = _dereq_(118);
-var instantiateReactComponent = _dereq_(134);
-var shouldUpdateReactComponent = _dereq_(151);
+function instantiateChild(childInstances, child, name) {
+ // We found a component instance.
+ var keyUnique = childInstances[name] === undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
+ }
+ if (child != null && keyUnique) {
+ childInstances[name] = instantiateReactComponent(child, null);
+ }
+}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
@@ -4739,41 +4103,31 @@
* @return {?object} A set of child instances.
* @internal
*/
- instantiateChildren: function(nestedChildNodes, transaction, context) {
- var children = flattenChildren(nestedChildNodes);
- for (var name in children) {
- if (children.hasOwnProperty(name)) {
- var child = children[name];
- // The rendered children must be turned into instances as they're
- // mounted.
- var childInstance = instantiateReactComponent(child, null);
- children[name] = childInstance;
- }
+ instantiateChildren: function (nestedChildNodes, transaction, context) {
+ if (nestedChildNodes == null) {
+ return null;
}
- return children;
+ var childInstances = {};
+ traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
+ return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
- * @param {?object} nextNestedChildNodes Nested child maps.
+ * @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
- updateChildren: function(
- prevChildren,
- nextNestedChildNodes,
- transaction,
- context) {
+ updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
- var nextChildren = flattenChildren(nextNestedChildNodes);
if (!nextChildren && !prevChildren) {
return null;
}
@@ -4785,27 +4139,21 @@
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
- if (shouldUpdateReactComponent(prevElement, nextElement)) {
- ReactReconciler.receiveComponent(
- prevChild, nextElement, transaction, context
- );
+ if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
+ ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
- var nextChildInstance = instantiateReactComponent(
- nextElement,
- null
- );
+ var nextChildInstance = instantiateReactComponent(nextElement, null);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
@@ -4819,18 +4167,19 @@
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
- unmountChildren: function(renderedChildren) {
+ unmountChildren: function (renderedChildren) {
for (var name in renderedChildren) {
+ if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
+ }
};
module.exports = ReactChildReconciler;
-
-},{"118":118,"134":134,"151":151,"81":81}],32:[function(_dereq_,module,exports){
+},{"118":118,"126":126,"127":127,"155":155,"76":76}],28:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4844,14 +4193,19 @@
'use strict';
-var PooledClass = _dereq_(28);
-var ReactFragment = _dereq_(63);
+var PooledClass = _dereq_(24);
+var ReactElement = _dereq_(52);
-var traverseAllChildren = _dereq_(153);
-var warning = _dereq_(154);
+var emptyFunction = _dereq_(136);
+var traverseAllChildren = _dereq_(127);
var twoArgumentPooler = PooledClass.twoArgumentPooler;
-var threeArgumentPooler = PooledClass.threeArgumentPooler;
+var fourArgumentPooler = PooledClass.fourArgumentPooler;
+
+var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
+function escapeUserProvidedKey(text) {
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
+}
/**
* PooledClass representing the bookkeeping associated with performing a child
@@ -4862,15 +4216,22 @@
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
- this.forEachFunction = forEachFunction;
- this.forEachContext = forEachContext;
-}
+ this.func = forEachFunction;
+ this.context = forEachContext;
+ this.count = 0;
+}
+ForEachBookKeeping.prototype.destructor = function () {
+ this.func = null;
+ this.context = null;
+ this.count = 0;
+};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
-function forEachSingleChild(traverseContext, child, name, i) {
- var forEachBookKeeping = traverseContext;
- forEachBookKeeping.forEachFunction.call(
- forEachBookKeeping.forEachContext, child, i);
+function forEachSingleChild(bookKeeping, child, name) {
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ func.call(context, child, bookKeeping.count++);
}
/**
@@ -4880,16 +4241,14 @@
* leaf child.
*
* @param {?*} children Children tree container.
- * @param {function(*, int)} forEachFunc.
+ * @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
-
- var traverseContext =
- ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
+ var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
@@ -4903,62 +4262,73 @@
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
-function MapBookKeeping(mapResult, mapFunction, mapContext) {
- this.mapResult = mapResult;
- this.mapFunction = mapFunction;
- this.mapContext = mapContext;
-}
-PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
-
-function mapSingleChildIntoContext(traverseContext, child, name, i) {
- var mapBookKeeping = traverseContext;
- var mapResult = mapBookKeeping.mapResult;
-
- var keyUnique = !mapResult.hasOwnProperty(name);
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- keyUnique,
- 'ReactChildren.map(...): Encountered two children with the same key, ' +
- '`%s`. Child keys must be unique; when two children share a key, only ' +
- 'the first child will be used.',
- name
- ) : null);
- }
-
- if (keyUnique) {
- var mappedChild =
- mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
- mapResult[name] = mappedChild;
+function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
+ this.result = mapResult;
+ this.keyPrefix = keyPrefix;
+ this.func = mapFunction;
+ this.context = mapContext;
+ this.count = 0;
+}
+MapBookKeeping.prototype.destructor = function () {
+ this.result = null;
+ this.keyPrefix = null;
+ this.func = null;
+ this.context = null;
+ this.count = 0;
+};
+PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
+
+function mapSingleChildIntoContext(bookKeeping, child, childKey) {
+ var result = bookKeeping.result;
+ var keyPrefix = bookKeeping.keyPrefix;
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ var mappedChild = func.call(context, child, bookKeeping.count++);
+ if (Array.isArray(mappedChild)) {
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
+ } else if (mappedChild != null) {
+ if (ReactElement.isValidElement(mappedChild)) {
+ mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
+ // Keep both the (mapped) and old keys if they differ, just as
+ // traverseAllChildren used to do for objects as children
+ keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
+ }
+ result.push(mappedChild);
}
}
+function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
+ var escapedPrefix = '';
+ if (prefix != null) {
+ escapedPrefix = escapeUserProvidedKey(prefix) + '/';
+ }
+ var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
+ traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
+ MapBookKeeping.release(traverseContext);
+}
+
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
- * TODO: This may likely break any calls to `ReactChildren.map` that were
- * previously relying on the fact that we guarded against null children.
- *
* @param {?*} children Children tree container.
- * @param {function(*, int)} mapFunction.
- * @param {*} mapContext Context for mapFunction.
+ * @param {function(*, int)} func The map function.
+ * @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
-
- var mapResult = {};
- var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
- MapBookKeeping.release(traverseContext);
- return ReactFragment.create(mapResult);
+ var result = [];
+ mapIntoWithKeyPrefixInternal(children, result, null, func, context);
+ return result;
}
-function forEachSingleChildDummy(traverseContext, child, name, i) {
+function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
@@ -4973,15 +4343,26 @@
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
+/**
+ * Flatten a children object (typically specified as `props.children`) and
+ * return an array with appropriately re-keyed children.
+ */
+function toArray(children) {
+ var result = [];
+ mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
+ return result;
+}
+
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
- count: countChildren
+ mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
+ count: countChildren,
+ toArray: toArray
};
module.exports = ReactChildren;
-
-},{"153":153,"154":154,"28":28,"63":63}],33:[function(_dereq_,module,exports){
+},{"127":127,"136":136,"24":24,"52":52}],29:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4995,23 +4376,20 @@
'use strict';
-var ReactComponent = _dereq_(34);
-var ReactCurrentOwner = _dereq_(39);
-var ReactElement = _dereq_(57);
-var ReactErrorUtils = _dereq_(60);
-var ReactInstanceMap = _dereq_(67);
-var ReactLifeCycle = _dereq_(68);
-var ReactPropTypeLocations = _dereq_(77);
-var ReactPropTypeLocationNames = _dereq_(76);
-var ReactUpdateQueue = _dereq_(86);
-
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
-var keyMirror = _dereq_(140);
-var keyOf = _dereq_(141);
-var warning = _dereq_(154);
+var ReactComponent = _dereq_(30);
+var ReactElement = _dereq_(52);
+var ReactPropTypeLocations = _dereq_(73);
+var ReactPropTypeLocationNames = _dereq_(72);
+var ReactNoopUpdateQueue = _dereq_(69);
+
+var assign = _dereq_(23);
+var emptyObject = _dereq_(137);
+var invariant = _dereq_(144);
+var keyMirror = _dereq_(147);
+var keyOf = _dereq_(148);
+var warning = _dereq_(155);
-var MIXINS_KEY = keyOf({mixins: null});
+var MIXINS_KEY = keyOf({ mixins: null });
/**
* Policies that describe methods in `ReactClassInterface`.
@@ -5038,9 +4416,16 @@
DEFINE_MANY_MERGED: null
});
-
var injectedMixins = [];
+var warnedSetProps = false;
+function warnSetProps() {
+ if (!warnedSetProps) {
+ warnedSetProps = true;
+ "development" !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
+ }
+}
+
/**
* Composite components are higher-level components that compose other composite
* or native components.
@@ -5058,7 +4443,7 @@
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
- * class specification will available on the prototype.
+ * class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
@@ -5300,121 +4681,72 @@
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
- displayName: function(Constructor, displayName) {
+ displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
- mixins: function(Constructor, mixins) {
+ mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
- childContextTypes: function(Constructor, childContextTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- childContextTypes,
- ReactPropTypeLocations.childContext
- );
+ childContextTypes: function (Constructor, childContextTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
}
- Constructor.childContextTypes = assign(
- {},
- Constructor.childContextTypes,
- childContextTypes
- );
+ Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
},
- contextTypes: function(Constructor, contextTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- contextTypes,
- ReactPropTypeLocations.context
- );
+ contextTypes: function (Constructor, contextTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
}
- Constructor.contextTypes = assign(
- {},
- Constructor.contextTypes,
- contextTypes
- );
+ Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
- getDefaultProps: function(Constructor, getDefaultProps) {
+ getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
- Constructor.getDefaultProps = createMergedResultFunction(
- Constructor.getDefaultProps,
- getDefaultProps
- );
+ Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
- propTypes: function(Constructor, propTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- propTypes,
- ReactPropTypeLocations.prop
- );
+ propTypes: function (Constructor, propTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
}
- Constructor.propTypes = assign(
- {},
- Constructor.propTypes,
- propTypes
- );
+ Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
},
- statics: function(Constructor, statics) {
+ statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
- }
-};
+ },
+ autobind: function () {} };
+// noop
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but not in __DEV__
- ("production" !== "development" ? warning(
- typeof typeDef[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- Constructor.displayName || 'ReactClass',
- ReactPropTypeLocationNames[location],
- propName
- ) : null);
+ "development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
}
}
}
function validateMethodOverride(proto, name) {
- var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
- ReactClassInterface[name] :
- null;
+ var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
- ("production" !== "development" ? invariant(
- specPolicy === SpecPolicy.OVERRIDE_BASE,
- 'ReactClassInterface: You are attempting to override ' +
- '`%s` from your class specification. Ensure that your method names ' +
- 'do not overlap with React methods.',
- name
- ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
+ !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
- ("production" !== "development" ? invariant(
- specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
- 'ReactClassInterface: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be due ' +
- 'to a mixin.',
- name
- ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
+ !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
}
}
@@ -5427,16 +4759,8 @@
return;
}
- ("production" !== "development" ? invariant(
- typeof spec !== 'function',
- 'ReactClass: You\'re attempting to ' +
- 'use a component class as a mixin. Instead, just use a regular object.'
- ) : invariant(typeof spec !== 'function'));
- ("production" !== "development" ? invariant(
- !ReactElement.isValidElement(spec),
- 'ReactClass: You\'re attempting to ' +
- 'use a component as a mixin. Instead, just use a regular object.'
- ) : invariant(!ReactElement.isValidElement(spec)));
+ !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
+ !!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
var proto = Constructor.prototype;
@@ -5453,7 +4777,7 @@
}
if (name === MIXINS_KEY) {
- // We have already handled mixins in a special case above
+ // We have already handled mixins in a special case above.
continue;
}
@@ -5467,16 +4791,10 @@
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
- var isReactClassMethod =
- ReactClassInterface.hasOwnProperty(name);
+ var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
- var markedDontBind = property && property.__reactDontBind;
var isFunction = typeof property === 'function';
- var shouldAutoBind =
- isFunction &&
- !isReactClassMethod &&
- !isAlreadyDefined &&
- !markedDontBind;
+ var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
@@ -5488,18 +4806,8 @@
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
- // These cases should already be caught by validateMethodOverride
- ("production" !== "development" ? invariant(
- isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- ),
- 'ReactClass: Unexpected spec policy %s for key %s ' +
- 'when mixing in component specs.',
- specPolicy,
- name
- ) : invariant(isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- )));
+ // These cases should already be caught by validateMethodOverride.
+ !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
@@ -5510,7 +4818,7 @@
}
} else {
proto[name] = property;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
@@ -5533,24 +4841,11 @@
continue;
}
- var isReserved = name in RESERVED_SPEC_KEYS;
- ("production" !== "development" ? invariant(
- !isReserved,
- 'ReactClass: You are attempting to define a reserved ' +
- 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
- 'as an instance property instead; it will still be accessible on the ' +
- 'constructor.',
- name
- ) : invariant(!isReserved));
-
- var isInherited = name in Constructor;
- ("production" !== "development" ? invariant(
- !isInherited,
- 'ReactClass: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be ' +
- 'due to a mixin.',
- name
- ) : invariant(!isInherited));
+ var isReserved = (name in RESERVED_SPEC_KEYS);
+ !!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
+
+ var isInherited = (name in Constructor);
+ !!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
Constructor[name] = property;
}
}
@@ -5563,22 +4858,11 @@
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
- ("production" !== "development" ? invariant(
- one && two && typeof one === 'object' && typeof two === 'object',
- 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
- ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
for (var key in two) {
if (two.hasOwnProperty(key)) {
- ("production" !== "development" ? invariant(
- one[key] === undefined,
- 'mergeIntoWithNoDuplicateKeys(): ' +
- 'Tried to merge two objects with the same key: `%s`. This conflict ' +
- 'may be due to a mixin; in particular, this may be caused by two ' +
- 'getInitialState() or getDefaultProps() methods returning objects ' +
- 'with clashing keys.',
- key
- ) : invariant(one[key] === undefined));
+ !(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
one[key] = two[key];
}
}
@@ -5633,32 +4917,25 @@
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
- boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ boundMethod.bind = function (newThis) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
- ("production" !== "development" ? warning(
- false,
- 'bind(): React component methods may only be bound to the ' +
- 'component instance. See %s',
- componentName
- ) : null);
+ "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
} else if (!args.length) {
- ("production" !== "development" ? warning(
- false,
- 'bind(): You are binding a component method to the component. ' +
- 'React does this for you automatically in a high-performance ' +
- 'way, so you can safely remove this call. See %s',
- componentName
- ) : null);
+ "development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -5681,34 +4958,11 @@
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
- component[autoBindKey] = bindAutoBindMethod(
- component,
- ReactErrorUtils.guard(
- method,
- component.constructor.displayName + '.' + autoBindKey
- )
- );
+ component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
}
-var typeDeprecationDescriptor = {
- enumerable: false,
- get: function() {
- var displayName = this.displayName || this.name || 'Component';
- ("production" !== "development" ? warning(
- false,
- '%s.type is deprecated. Use %s directly to access the class.',
- displayName,
- displayName
- ) : null);
- Object.defineProperty(this, 'type', {
- value: this
- });
- return this;
- }
-};
-
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
@@ -5719,10 +4973,10 @@
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
- replaceState: function(newState, callback) {
- ReactUpdateQueue.enqueueReplaceState(this, newState);
+ replaceState: function (newState, callback) {
+ this.updater.enqueueReplaceState(this, newState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -5732,27 +4986,8 @@
* @protected
* @final
*/
- isMounted: function() {
- if ("production" !== "development") {
- var owner = ReactCurrentOwner.current;
- if (owner !== null) {
- ("production" !== "development" ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing isMounted inside its render() function. ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
- owner._warnedAboutRefsInRender = true;
- }
- }
- var internalInstance = ReactInstanceMap.get(this);
- return (
- internalInstance &&
- internalInstance !== ReactLifeCycle.currentlyMountingInstance
- );
+ isMounted: function () {
+ return this.updater.isMounted(this);
},
/**
@@ -5764,10 +4999,13 @@
* @public
* @deprecated
*/
- setProps: function(partialProps, callback) {
- ReactUpdateQueue.enqueueSetProps(this, partialProps);
+ setProps: function (partialProps, callback) {
+ if ("development" !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueSetProps(this, partialProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -5780,20 +5018,19 @@
* @public
* @deprecated
*/
- replaceProps: function(newProps, callback) {
- ReactUpdateQueue.enqueueReplaceProps(this, newProps);
+ replaceProps: function (newProps, callback) {
+ if ("development" !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueReplaceProps(this, newProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
}
};
-var ReactClassComponent = function() {};
-assign(
- ReactClassComponent.prototype,
- ReactComponent.prototype,
- ReactClassMixin
-);
+var ReactClassComponent = function () {};
+assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
@@ -5809,17 +5046,13 @@
* @return {function} Component constructor function.
* @public
*/
- createClass: function(spec) {
- var Constructor = function(props, context) {
+ createClass: function (spec) {
+ var Constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- this instanceof Constructor,
- 'Something is calling a React component directly. Use a factory or ' +
- 'JSX instead. See: https://fb.me/react-legacyfactory'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
@@ -5829,44 +5062,40 @@
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ this.updater = updater || ReactNoopUpdateQueue;
+
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof initialState === 'undefined' &&
- this.getInitialState._isMockFunction) {
+ if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
- ("production" !== "development" ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.getInitialState(): must return an object or null',
- Constructor.displayName || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
- injectedMixins.forEach(
- mixSpecIntoComponent.bind(null, Constructor)
- );
+ injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
- // Initialize the defaultProps property after all mixins have been merged
+ // Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
@@ -5879,20 +5108,11 @@
}
}
- ("production" !== "development" ? invariant(
- Constructor.prototype.render,
- 'createClass(...): Class specification must implement a `render` method.'
- ) : invariant(Constructor.prototype.render));
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- !Constructor.prototype.componentShouldUpdate,
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- spec.displayName || 'A component'
- ) : null);
+ !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
+ "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
}
// Reduce time spent doing lookups by setting these on the prototype.
@@ -5902,21 +5122,11 @@
}
}
- // Legacy hook
- Constructor.type = Constructor;
- if ("production" !== "development") {
- try {
- Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
- }
- }
-
return Constructor;
},
injection: {
- injectMixin: function(mixin) {
+ injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}
@@ -5924,8 +5134,7 @@
};
module.exports = ReactClass;
-
-},{"135":135,"140":140,"141":141,"154":154,"27":27,"34":34,"39":39,"57":57,"60":60,"67":67,"68":68,"76":76,"77":77,"86":86}],34:[function(_dereq_,module,exports){
+},{"137":137,"144":144,"147":147,"148":148,"155":155,"23":23,"30":30,"52":52,"69":69,"72":72,"73":73}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -5939,19 +5148,27 @@
'use strict';
-var ReactUpdateQueue = _dereq_(86);
+var ReactNoopUpdateQueue = _dereq_(69);
-var invariant = _dereq_(135);
-var warning = _dereq_(154);
+var canDefineProperty = _dereq_(104);
+var emptyObject = _dereq_(137);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
/**
* Base class helpers for the updating state of a component.
*/
-function ReactComponent(props, context) {
+function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ // We initialize the default updater but the real one gets injected by the
+ // renderer.
+ this.updater = updater || ReactNoopUpdateQueue;
}
+ReactComponent.prototype.isReactComponent = {};
+
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
@@ -5977,26 +5194,14 @@
* @final
* @protected
*/
-ReactComponent.prototype.setState = function(partialState, callback) {
- ("production" !== "development" ? invariant(
- typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null,
- 'setState(...): takes an object of state variables to update or a ' +
- 'function which returns an object of state variables.'
- ) : invariant(typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null));
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- partialState != null,
- 'setState(...): You passed an undefined or null state object; ' +
- 'instead, use forceUpdate().'
- ) : null);
+ReactComponent.prototype.setState = function (partialState, callback) {
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
}
- ReactUpdateQueue.enqueueSetState(this, partialState);
+ this.updater.enqueueSetState(this, partialState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -6014,10 +5219,10 @@
* @final
* @protected
*/
-ReactComponent.prototype.forceUpdate = function(callback) {
- ReactUpdateQueue.enqueueForceUpdate(this);
+ReactComponent.prototype.forceUpdate = function (callback) {
+ this.updater.enqueueForceUpdate(this);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -6026,46 +5231,22 @@
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
-if ("production" !== "development") {
+if ("development" !== 'production') {
var deprecatedAPIs = {
- getDOMNode: [
- 'getDOMNode',
- 'Use React.findDOMNode(component) instead.'
- ],
- isMounted: [
- 'isMounted',
- 'Instead, make sure to clean up subscriptions and pending requests in ' +
- 'componentWillUnmount to prevent memory leaks.'
- ],
- replaceProps: [
- 'replaceProps',
- 'Instead call React.render again at the top level.'
- ],
- replaceState: [
- 'replaceState',
- 'Refactor your code to use setState instead (see ' +
- 'https://github.com/facebook/react/issues/3236).'
- ],
- setProps: [
- 'setProps',
- 'Instead call React.render again at the top level.'
- ]
+ getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
+ replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
+ setProps: ['setProps', 'Instead, call render again at the top level.']
};
- var defineDeprecationWarning = function(methodName, info) {
- try {
+ var defineDeprecationWarning = function (methodName, info) {
+ if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
- get: function() {
- ("production" !== "development" ? warning(
- false,
- '%s(...) is deprecated in plain JavaScript React classes. %s',
- info[0],
- info[1]
- ) : null);
+ get: function () {
+ "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
return undefined;
}
});
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
}
};
for (var fnName in deprecatedAPIs) {
@@ -6076,8 +5257,7 @@
}
module.exports = ReactComponent;
-
-},{"135":135,"154":154,"86":86}],35:[function(_dereq_,module,exports){
+},{"104":104,"137":137,"144":144,"155":155,"69":69}],31:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6089,12 +5269,10 @@
* @providesModule ReactComponentBrowserEnvironment
*/
-/*jslint evil: true */
-
'use strict';
-var ReactDOMIDOperations = _dereq_(44);
-var ReactMount = _dereq_(70);
+var ReactDOMIDOperations = _dereq_(40);
+var ReactMount = _dereq_(65);
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
@@ -6103,11 +5281,9 @@
*/
var ReactComponentBrowserEnvironment = {
- processChildrenUpdates:
- ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
+ processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
- replaceNodeWithMarkupByID:
- ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
+ replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
@@ -6116,15 +5292,14 @@
*
* @private
*/
- unmountIDFromEnvironment: function(rootNodeID) {
+ unmountIDFromEnvironment: function (rootNodeID) {
ReactMount.purgeID(rootNodeID);
}
};
module.exports = ReactComponentBrowserEnvironment;
-
-},{"44":44,"70":70}],36:[function(_dereq_,module,exports){
+},{"40":40,"65":65}],32:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -6138,7 +5313,7 @@
'use strict';
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
var injected = false;
@@ -6164,17 +5339,11 @@
processChildrenUpdates: null,
injection: {
- injectEnvironment: function(environment) {
- ("production" !== "development" ? invariant(
- !injected,
- 'ReactCompositeComponent: injectEnvironment() can only be called once.'
- ) : invariant(!injected));
- ReactComponentEnvironment.unmountIDFromEnvironment =
- environment.unmountIDFromEnvironment;
- ReactComponentEnvironment.replaceNodeWithMarkupByID =
- environment.replaceNodeWithMarkupByID;
- ReactComponentEnvironment.processChildrenUpdates =
- environment.processChildrenUpdates;
+ injectEnvironment: function (environment) {
+ !!injected ? "development" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
+ ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
+ ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
+ ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}
@@ -6182,8 +5351,7 @@
};
module.exports = ReactComponentEnvironment;
-
-},{"135":135}],37:[function(_dereq_,module,exports){
+},{"144":144}],33:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6197,25 +5365,21 @@
'use strict';
-var ReactComponentEnvironment = _dereq_(36);
-var ReactContext = _dereq_(38);
-var ReactCurrentOwner = _dereq_(39);
-var ReactElement = _dereq_(57);
-var ReactElementValidator = _dereq_(58);
-var ReactInstanceMap = _dereq_(67);
-var ReactLifeCycle = _dereq_(68);
-var ReactNativeComponent = _dereq_(73);
-var ReactPerf = _dereq_(75);
-var ReactPropTypeLocations = _dereq_(77);
-var ReactPropTypeLocationNames = _dereq_(76);
-var ReactReconciler = _dereq_(81);
-var ReactUpdates = _dereq_(87);
-
-var assign = _dereq_(27);
-var emptyObject = _dereq_(115);
-var invariant = _dereq_(135);
-var shouldUpdateReactComponent = _dereq_(151);
-var warning = _dereq_(154);
+var ReactComponentEnvironment = _dereq_(32);
+var ReactCurrentOwner = _dereq_(34);
+var ReactElement = _dereq_(52);
+var ReactInstanceMap = _dereq_(62);
+var ReactPerf = _dereq_(71);
+var ReactPropTypeLocations = _dereq_(73);
+var ReactPropTypeLocationNames = _dereq_(72);
+var ReactReconciler = _dereq_(76);
+var ReactUpdateQueue = _dereq_(82);
+
+var assign = _dereq_(23);
+var emptyObject = _dereq_(137);
+var invariant = _dereq_(144);
+var shouldUpdateReactComponent = _dereq_(126);
+var warning = _dereq_(155);
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
@@ -6228,6 +5392,12 @@
return '';
}
+function StatelessComponent(Component) {}
+StatelessComponent.prototype.render = function () {
+ var Component = ReactInstanceMap.get(this)._currentElement.type;
+ return Component(this.props, this.context, this.updater);
+};
+
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
@@ -6275,7 +5445,7 @@
* @final
* @internal
*/
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
@@ -6290,7 +5460,7 @@
this._context = null;
this._mountOrder = 0;
- this._isTopLevel = false;
+ this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
@@ -6305,32 +5475,54 @@
* @final
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
- var publicContext = this._processContext(this._currentElement._context);
+ var publicContext = this._processContext(context);
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ var Component = this._currentElement.type;
// Initialize the public class
- var inst = new Component(publicProps, publicContext);
+ var inst;
+ var renderedElement;
+
+ // This is a way to detect if Component is a stateless arrow function
+ // component, which is not newable. It might not be 100% reliable but is
+ // something we can do until we start detecting that Component extends
+ // React.Component. We already assume that typeof Component === 'function'.
+ var canInstantiate = ('prototype' in Component);
+
+ if (canInstantiate) {
+ if ("development" !== 'production') {
+ ReactCurrentOwner.current = this;
+ try {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ } else {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ }
+ }
- if ("production" !== "development") {
+ if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
+ renderedElement = inst;
+ inst = new StatelessComponent(Component);
+ }
+
+ if ("development" !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
- ("production" !== "development" ? warning(
- inst.render != null,
- '%s(...): No `render` method found on the returned component ' +
- 'instance: you may have forgotten to define `render` in your ' +
- 'component or you may have accidentally tried to render an element ' +
- 'whose type is a function that isn\'t a React component.',
- Component.displayName || Component.name || 'Component'
- ) : null);
+ if (inst.render == null) {
+ "development" !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
+ } else {
+ // We support ES6 inheriting from React.Component, the module pattern,
+ // and stateless components, but not ES6 classes that don't extend
+ "development" !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
+ }
}
// These should be set up in the constructor, but as a convenience for
@@ -6338,78 +5530,36 @@
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
+ inst.updater = ReactUpdateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
- if ("production" !== "development") {
- this._warnIfContextsDiffer(this._currentElement._context, context);
- }
-
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
- ("production" !== "development" ? warning(
- !inst.getInitialState ||
- inst.getInitialState.isReactClassApproved,
- 'getInitialState was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Did you mean to define a state property instead?',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.getDefaultProps ||
- inst.getDefaultProps.isReactClassApproved,
- 'getDefaultProps was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Use a static property to define defaultProps instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.propTypes,
- 'propTypes was defined as an instance property on %s. Use a static ' +
- 'property to define propTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.contextTypes,
- 'contextTypes was defined as an instance property on %s. Use a ' +
- 'static property to define contextTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- typeof inst.componentShouldUpdate !== 'function',
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- (this.getName() || 'A component')
- ) : null);
+ "development" !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
- ("production" !== "development" ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.state: must be set to an object or null',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
- var childContext;
- var renderedElement;
-
- var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
- ReactLifeCycle.currentlyMountingInstance = this;
- try {
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
@@ -6419,23 +5569,14 @@
}
}
- childContext = this._getValidatedChildContext(context);
- renderedElement = this._renderValidatedComponent(childContext);
- } finally {
- ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
+ // If not a stateless component, we now render
+ if (renderedElement === undefined) {
+ renderedElement = this._renderValidatedComponent();
}
- this._renderedComponent = this._instantiateReactComponent(
- renderedElement,
- this._currentElement.type // The wrapping type
- );
+ this._renderedComponent = this._instantiateReactComponent(renderedElement);
- var markup = ReactReconciler.mountComponent(
- this._renderedComponent,
- rootID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
@@ -6449,23 +5590,20 @@
* @final
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
var inst = this._instance;
if (inst.componentWillUnmount) {
- var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
- ReactLifeCycle.currentlyUnmountingInstance = this;
- try {
inst.componentWillUnmount();
- } finally {
- ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
- }
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
+ this._instance = null;
// Reset pending fields
+ // Even if this component is scheduled for another update in ReactUpdates,
+ // it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
@@ -6476,6 +5614,7 @@
// longer accessible.
this._context = null;
this._rootNodeID = null;
+ this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
@@ -6490,25 +5629,6 @@
},
/**
- * Schedule a partial update to the props. Only used for internal testing.
- *
- * @param {object} partialProps Subset of the next props.
- * @param {?function} callback Called after props are updated.
- * @final
- * @internal
- */
- _setPropsInternal: function(partialProps, callback) {
- // This is a deoptimized path. We optimize for always having an element.
- // This creates an extra internal element.
- var element = this._pendingElement || this._currentElement;
- this._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- assign({}, element.props, partialProps)
- );
- ReactUpdates.enqueueUpdate(this, callback);
- },
-
- /**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
@@ -6516,14 +5636,10 @@
* @return {?object}
* @private
*/
- _maskContext: function(context) {
+ _maskContext: function (context) {
var maskedContext = null;
- // This really should be getting the component class for the element,
- // but we know that we're not going to need it for built-ins.
- if (typeof this._currentElement.type === 'string') {
- return emptyObject;
- }
- var contextTypes = this._currentElement.type.contextTypes;
+ var Component = this._currentElement.type;
+ var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
@@ -6542,18 +5658,12 @@
* @return {?object}
* @private
*/
- _processContext: function(context) {
+ _processContext: function (context) {
var maskedContext = this._maskContext(context);
- if ("production" !== "development") {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ if ("development" !== 'production') {
+ var Component = this._currentElement.type;
if (Component.contextTypes) {
- this._checkPropTypes(
- Component.contextTypes,
- maskedContext,
- ReactPropTypeLocations.context
- );
+ this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
}
}
return maskedContext;
@@ -6564,38 +5674,18 @@
* @return {object}
* @private
*/
- _getValidatedChildContext: function(currentContext) {
+ _processChildContext: function (currentContext) {
+ var Component = this._currentElement.type;
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
- ("production" !== "development" ? invariant(
- typeof inst.constructor.childContextTypes === 'object',
- '%s.getChildContext(): childContextTypes must be defined in order to ' +
- 'use getChildContext().',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
- if ("production" !== "development") {
- this._checkPropTypes(
- inst.constructor.childContextTypes,
- childContext,
- ReactPropTypeLocations.childContext
- );
+ !(typeof Component.childContextTypes === 'object') ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
+ if ("development" !== 'production') {
+ this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
- ("production" !== "development" ? invariant(
- name in inst.constructor.childContextTypes,
- '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
- this.getName() || 'ReactCompositeComponent',
- name
- ) : invariant(name in inst.constructor.childContextTypes));
+ !(name in Component.childContextTypes) ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
}
- return childContext;
- }
- return null;
- },
-
- _mergeChildContext: function(currentContext, childContext) {
- if (childContext) {
return assign({}, currentContext, childContext);
}
return currentContext;
@@ -6610,17 +5700,11 @@
* @return {object}
* @private
*/
- _processProps: function(newProps) {
- if ("production" !== "development") {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ _processProps: function (newProps) {
+ if ("development" !== 'production') {
+ var Component = this._currentElement.type;
if (Component.propTypes) {
- this._checkPropTypes(
- Component.propTypes,
- newProps,
- ReactPropTypeLocations.prop
- );
+ this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
}
}
return newProps;
@@ -6634,7 +5718,7 @@
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
- _checkPropTypes: function(propTypes, props, location) {
+ _checkPropTypes: function (propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
@@ -6644,58 +5728,35 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== "development" ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually ' +
- 'from React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
- // React.render calls, so I'm abstracting it away into
+ // top-level render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
- ("production" !== "development" ? warning(
- false,
- 'Failed Composite propType: %s%s',
- error.message,
- addendum
- ) : null);
+ "development" !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
} else {
- ("production" !== "development" ? warning(
- false,
- 'Failed Context Types: %s%s',
- error.message,
- addendum
- ) : null);
+ "development" !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
}
}
}
}
},
- receiveComponent: function(nextElement, transaction, nextContext) {
+ receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
- this.updateComponent(
- transaction,
- prevElement,
- nextElement,
- prevContext,
- nextContext
- );
+ this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
@@ -6705,54 +5766,13 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(transaction) {
+ performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
- ReactReconciler.receiveComponent(
- this,
- this._pendingElement || this._currentElement,
- transaction,
- this._context
- );
+ ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(
- this._currentElement
- );
- }
-
- this.updateComponent(
- transaction,
- this._currentElement,
- this._currentElement,
- this._context,
- this._context
- );
- }
- },
-
- /**
- * Compare two contexts, warning if they are different
- * TODO: Remove this check when owner-context is removed
- */
- _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
- ownerBasedContext = this._maskContext(ownerBasedContext);
- parentBasedContext = this._maskContext(parentBasedContext);
- var parentKeys = Object.keys(parentBasedContext).sort();
- var displayName = this.getName() || 'ReactCompositeComponent';
- for (var i = 0; i < parentKeys.length; i++) {
- var key = parentKeys[i];
- ("production" !== "development" ? warning(
- ownerBasedContext[key] === parentBasedContext[key],
- 'owner-based and parent-based contexts differ ' +
- '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
- '(see: http://fb.me/react-context-by-parent)',
- ownerBasedContext[key],
- parentBasedContext[key],
- key,
- displayName
- ) : null);
+ this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
}
},
@@ -6771,32 +5791,19 @@
* @internal
* @overridable
*/
- updateComponent: function(
- transaction,
- prevParentElement,
- nextParentElement,
- prevUnmaskedContext,
- nextUnmaskedContext
- ) {
+ updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
- var nextContext = inst.context;
- var nextProps = inst.props;
+ var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
+ var nextProps;
// Distinguish between a props update versus a simple state update
- if (prevParentElement !== nextParentElement) {
- nextContext = this._processContext(nextParentElement._context);
+ if (prevParentElement === nextParentElement) {
+ // Skip checking prop types again -- we don't read inst.props to avoid
+ // warning for DOM component props in this upgrade
+ nextProps = nextParentElement.props;
+ } else {
nextProps = this._processProps(nextParentElement.props);
-
- if ("production" !== "development") {
- if (nextUnmaskedContext != null) {
- this._warnIfContextsDiffer(
- nextParentElement._context,
- nextUnmaskedContext
- );
- }
- }
-
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
@@ -6808,31 +5815,16 @@
var nextState = this._processPendingState(nextProps, nextContext);
- var shouldUpdate =
- this._pendingForceUpdate ||
- !inst.shouldComponentUpdate ||
- inst.shouldComponentUpdate(nextProps, nextState, nextContext);
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- typeof shouldUpdate !== 'undefined',
- '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
- 'boolean value. Make sure to return true or false.',
- this.getName() || 'ReactCompositeComponent'
- ) : null);
+ var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
- this._performComponentUpdate(
- nextParentElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- nextUnmaskedContext
- );
+ this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
@@ -6844,7 +5836,7 @@
}
},
- _processPendingState: function(props, context) {
+ _processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
@@ -6862,12 +5854,7 @@
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
- assign(
- nextState,
- typeof partial === 'function' ?
- partial.call(inst, nextState, props, context) :
- partial
- );
+ assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
@@ -6885,19 +5872,18 @@
* @param {?object} unmaskedContext
* @private
*/
- _performComponentUpdate: function(
- nextElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- unmaskedContext
- ) {
+ _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var inst = this._instance;
- var prevProps = inst.props;
- var prevState = inst.state;
- var prevContext = inst.context;
+ var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
+ var prevProps;
+ var prevState;
+ var prevContext;
+ if (hasComponentDidUpdate) {
+ prevProps = inst.props;
+ prevState = inst.state;
+ prevContext = inst.context;
+ }
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
@@ -6911,11 +5897,8 @@
this._updateRenderedComponent(transaction, unmaskedContext);
- if (inst.componentDidUpdate) {
- transaction.getReactMountReady().enqueue(
- inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
- inst
- );
+ if (hasComponentDidUpdate) {
+ transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
},
@@ -6925,34 +5908,20 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- _updateRenderedComponent: function(transaction, context) {
+ _updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
- var childContext = this._getValidatedChildContext();
- var nextRenderedElement = this._renderValidatedComponent(childContext);
+ var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
- ReactReconciler.receiveComponent(
- prevComponentInstance,
- nextRenderedElement,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
- this._renderedComponent = this._instantiateReactComponent(
- nextRenderedElement,
- this._currentElement.type
- );
- var nextMarkup = ReactReconciler.mountComponent(
- this._renderedComponent,
- thisID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
+ var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
@@ -6960,23 +5929,19 @@
/**
* @protected
*/
- _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
- ReactComponentEnvironment.replaceNodeWithMarkupByID(
- prevComponentID,
- nextMarkup
- );
+ _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
+ ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
},
/**
* @protected
*/
- _renderValidatedComponentWithoutOwnerOrContext: function() {
+ _renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedComponent = inst.render();
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof renderedComponent === 'undefined' &&
- inst.render._isMockFunction) {
+ if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
@@ -6989,31 +5954,17 @@
/**
* @private
*/
- _renderValidatedComponent: function(childContext) {
+ _renderValidatedComponent: function () {
var renderedComponent;
- var previousContext = ReactContext.current;
- ReactContext.current = this._mergeChildContext(
- this._currentElement._context,
- childContext
- );
ReactCurrentOwner.current = this;
try {
- renderedComponent =
- this._renderValidatedComponentWithoutOwnerOrContext();
+ renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
- ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
- ("production" !== "development" ? invariant(
+ !(
// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent),
- '%s.render(): A valid ReactComponent must be returned. You may have ' +
- 'returned undefined, an array or some other invalid object.',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent)));
+ renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? "development" !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
return renderedComponent;
},
@@ -7025,10 +5976,16 @@
* @final
* @private
*/
- attachRef: function(ref, component) {
+ attachRef: function (ref, component) {
var inst = this.getPublicInstance();
- var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
- refs[ref] = component.getPublicInstance();
+ !(inst != null) ? "development" !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
+ var publicComponentInstance = component.getPublicInstance();
+ if ("development" !== 'production') {
+ var componentName = component && component.getName ? component.getName() : 'a component';
+ "development" !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
+ }
+ var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
+ refs[ref] = publicComponentInstance;
},
/**
@@ -7038,7 +5995,7 @@
* @final
* @private
*/
- detachRef: function(ref) {
+ detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
@@ -7049,26 +6006,26 @@
* @return {string} The name or null.
* @internal
*/
- getName: function() {
+ getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
- return (
- type.displayName || (constructor && constructor.displayName) ||
- type.name || (constructor && constructor.name) ||
- null
- );
+ return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
- * is exposed by refs and returned by React.render. Can be null for stateless
+ * is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
- getPublicInstance: function() {
- return this._instance;
+ getPublicInstance: function () {
+ var inst = this._instance;
+ if (inst instanceof StatelessComponent) {
+ return null;
+ }
+ return inst;
},
// Stub
@@ -7076,15 +6033,11 @@
};
-ReactPerf.measureMethods(
- ReactCompositeComponentMixin,
- 'ReactCompositeComponent',
- {
+ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
- }
-);
+});
var ReactCompositeComponent = {
@@ -7093,84 +6046,7 @@
};
module.exports = ReactCompositeComponent;
-
-},{"115":115,"135":135,"151":151,"154":154,"27":27,"36":36,"38":38,"39":39,"57":57,"58":58,"67":67,"68":68,"73":73,"75":75,"76":76,"77":77,"81":81,"87":87}],38:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactContext
- */
-
-'use strict';
-
-var assign = _dereq_(27);
-var emptyObject = _dereq_(115);
-var warning = _dereq_(154);
-
-var didWarn = false;
-
-/**
- * Keeps track of the current context.
- *
- * The context is automatically passed down the component ownership hierarchy
- * and is accessible via `this.context` on ReactCompositeComponents.
- */
-var ReactContext = {
-
- /**
- * @internal
- * @type {object}
- */
- current: emptyObject,
-
- /**
- * Temporarily extends the current context while executing scopedCallback.
- *
- * A typical use case might look like
- *
- * render: function() {
- * var children = ReactContext.withContext({foo: 'foo'}, () => (
- *
- * ));
- * return <div>{children}</div>;
- * }
- *
- * @param {object} newContext New context to merge into the existing context
- * @param {function} scopedCallback Callback to run with the new context
- * @return {ReactComponent|array<ReactComponent>}
- */
- withContext: function(newContext, scopedCallback) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- didWarn,
- 'withContext is deprecated and will be removed in a future version. ' +
- 'Use a wrapper component with getChildContext instead.'
- ) : null);
-
- didWarn = true;
- }
-
- var result;
- var previousContext = ReactContext.current;
- ReactContext.current = assign({}, previousContext, newContext);
- try {
- result = scopedCallback();
- } finally {
- ReactContext.current = previousContext;
- }
- return result;
- }
-
-};
-
-module.exports = ReactContext;
-
-},{"115":115,"154":154,"27":27}],39:[function(_dereq_,module,exports){
+},{"126":126,"137":137,"144":144,"155":155,"23":23,"32":32,"34":34,"52":52,"62":62,"71":71,"72":72,"73":73,"76":76,"82":82}],34:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7189,8 +6065,6 @@
*
* The current owner is the component who should own any components that are
* currently being constructed.
- *
- * The depth indicate how many composite components are above this render level.
*/
var ReactCurrentOwner = {
@@ -7203,8 +6077,7 @@
};
module.exports = ReactCurrentOwner;
-
-},{}],40:[function(_dereq_,module,exports){
+},{}],35:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7214,174 +6087,90 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOM
- * @typechecks static-only
*/
+/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
+
'use strict';
-var ReactElement = _dereq_(57);
-var ReactElementValidator = _dereq_(58);
+var ReactCurrentOwner = _dereq_(34);
+var ReactDOMTextComponent = _dereq_(46);
+var ReactDefaultInjection = _dereq_(49);
+var ReactInstanceHandles = _dereq_(61);
+var ReactMount = _dereq_(65);
+var ReactPerf = _dereq_(71);
+var ReactReconciler = _dereq_(76);
+var ReactUpdates = _dereq_(83);
+var ReactVersion = _dereq_(84);
+
+var findDOMNode = _dereq_(108);
+var renderSubtreeIntoContainer = _dereq_(123);
+var warning = _dereq_(155);
-var mapObject = _dereq_(142);
+ReactDefaultInjection.inject();
-/**
- * Create a factory that creates HTML tag elements.
- *
- * @param {string} tag Tag name (e.g. `div`).
- * @private
- */
-function createDOMFactory(tag) {
- if ("production" !== "development") {
- return ReactElementValidator.createFactory(tag);
- }
- return ReactElement.createFactory(tag);
+var render = ReactPerf.measure('React', 'render', ReactMount.render);
+
+var React = {
+ findDOMNode: findDOMNode,
+ render: render,
+ unmountComponentAtNode: ReactMount.unmountComponentAtNode,
+ version: ReactVersion,
+
+ /* eslint-disable camelcase */
+ unstable_batchedUpdates: ReactUpdates.batchedUpdates,
+ unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
+};
+
+// Inject the runtime into a devtools global hook regardless of browser.
+// Allows for debugging when the hook is injected on the page.
+/* eslint-enable camelcase */
+if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
+ CurrentOwner: ReactCurrentOwner,
+ InstanceHandles: ReactInstanceHandles,
+ Mount: ReactMount,
+ Reconciler: ReactReconciler,
+ TextComponent: ReactDOMTextComponent
+ });
}
-/**
- * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
- * This is also accessible via `React.DOM`.
- *
- * @public
- */
-var ReactDOM = mapObject({
- a: 'a',
- abbr: 'abbr',
- address: 'address',
- area: 'area',
- article: 'article',
- aside: 'aside',
- audio: 'audio',
- b: 'b',
- base: 'base',
- bdi: 'bdi',
- bdo: 'bdo',
- big: 'big',
- blockquote: 'blockquote',
- body: 'body',
- br: 'br',
- button: 'button',
- canvas: 'canvas',
- caption: 'caption',
- cite: 'cite',
- code: 'code',
- col: 'col',
- colgroup: 'colgroup',
- data: 'data',
- datalist: 'datalist',
- dd: 'dd',
- del: 'del',
- details: 'details',
- dfn: 'dfn',
- dialog: 'dialog',
- div: 'div',
- dl: 'dl',
- dt: 'dt',
- em: 'em',
- embed: 'embed',
- fieldset: 'fieldset',
- figcaption: 'figcaption',
- figure: 'figure',
- footer: 'footer',
- form: 'form',
- h1: 'h1',
- h2: 'h2',
- h3: 'h3',
- h4: 'h4',
- h5: 'h5',
- h6: 'h6',
- head: 'head',
- header: 'header',
- hr: 'hr',
- html: 'html',
- i: 'i',
- iframe: 'iframe',
- img: 'img',
- input: 'input',
- ins: 'ins',
- kbd: 'kbd',
- keygen: 'keygen',
- label: 'label',
- legend: 'legend',
- li: 'li',
- link: 'link',
- main: 'main',
- map: 'map',
- mark: 'mark',
- menu: 'menu',
- menuitem: 'menuitem',
- meta: 'meta',
- meter: 'meter',
- nav: 'nav',
- noscript: 'noscript',
- object: 'object',
- ol: 'ol',
- optgroup: 'optgroup',
- option: 'option',
- output: 'output',
- p: 'p',
- param: 'param',
- picture: 'picture',
- pre: 'pre',
- progress: 'progress',
- q: 'q',
- rp: 'rp',
- rt: 'rt',
- ruby: 'ruby',
- s: 's',
- samp: 'samp',
- script: 'script',
- section: 'section',
- select: 'select',
- small: 'small',
- source: 'source',
- span: 'span',
- strong: 'strong',
- style: 'style',
- sub: 'sub',
- summary: 'summary',
- sup: 'sup',
- table: 'table',
- tbody: 'tbody',
- td: 'td',
- textarea: 'textarea',
- tfoot: 'tfoot',
- th: 'th',
- thead: 'thead',
- time: 'time',
- title: 'title',
- tr: 'tr',
- track: 'track',
- u: 'u',
- ul: 'ul',
- 'var': 'var',
- video: 'video',
- wbr: 'wbr',
+if ("development" !== 'production') {
+ var ExecutionEnvironment = _dereq_(130);
+ if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
- // SVG
- circle: 'circle',
- clipPath: 'clipPath',
- defs: 'defs',
- ellipse: 'ellipse',
- g: 'g',
- line: 'line',
- linearGradient: 'linearGradient',
- mask: 'mask',
- path: 'path',
- pattern: 'pattern',
- polygon: 'polygon',
- polyline: 'polyline',
- radialGradient: 'radialGradient',
- rect: 'rect',
- stop: 'stop',
- svg: 'svg',
- text: 'text',
- tspan: 'tspan'
+ // First check if devtools is not installed
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
+ // If we're in Chrome or Firefox, provide a download link if not installed.
+ if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
+ console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
+ }
+ }
-}, createDOMFactory);
+ // If we're in IE8, check to see if we are in compatibility mode and provide
+ // information on preventing compatibility mode
+ var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
+
+ "development" !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
+
+ var expectedFeatures = [
+ // shims
+ Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
+
+ // shams
+ Object.create, Object.freeze];
-module.exports = ReactDOM;
+ for (var i = 0; i < expectedFeatures.length; i++) {
+ if (!expectedFeatures[i]) {
+ console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
+ break;
+ }
+ }
+ }
+}
-},{"142":142,"57":57,"58":58}],41:[function(_dereq_,module,exports){
+module.exports = React;
+},{"108":108,"123":123,"130":130,"155":155,"34":34,"46":46,"49":49,"61":61,"65":65,"71":71,"76":76,"83":83,"84":84}],36:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7395,16 +6184,7 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
-
-var keyMirror = _dereq_(140);
-
-var button = ReactElement.createFactory('button');
-
-var mouseListenerNames = keyMirror({
+var mouseListenerNames = {
onClick: true,
onDoubleClick: true,
onMouseDown: true,
@@ -7410,42 +6190,38 @@
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
+
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
-});
+};
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
-var ReactDOMButton = ReactClass.createClass({
- displayName: 'ReactDOMButton',
- tagName: 'BUTTON',
-
- mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
-
- render: function() {
- var props = {};
+var ReactDOMButton = {
+ getNativeProps: function (inst, props, context) {
+ if (!props.disabled) {
+ return props;
+ }
- // Copy the props; except the mouse listeners if we're disabled
- for (var key in this.props) {
- if (this.props.hasOwnProperty(key) &&
- (!this.props.disabled || !mouseListenerNames[key])) {
- props[key] = this.props[key];
+ // Copy the props, except the mouse listeners
+ var nativeProps = {};
+ for (var key in props) {
+ if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
+ nativeProps[key] = props[key];
}
}
- return button(props, this.props.children);
+ return nativeProps;
}
-
-});
+};
module.exports = ReactDOMButton;
-
-},{"140":140,"2":2,"29":29,"33":33,"57":57}],42:[function(_dereq_,module,exports){
+},{}],37:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7462,104 +6238,293 @@
'use strict';
+var AutoFocusUtils = _dereq_(2);
var CSSPropertyOperations = _dereq_(5);
var DOMProperty = _dereq_(10);
var DOMPropertyOperations = _dereq_(11);
-var ReactBrowserEventEmitter = _dereq_(30);
-var ReactComponentBrowserEnvironment =
- _dereq_(35);
-var ReactMount = _dereq_(70);
-var ReactMultiChild = _dereq_(71);
-var ReactPerf = _dereq_(75);
-
-var assign = _dereq_(27);
-var escapeTextContentForBrowser = _dereq_(116);
-var invariant = _dereq_(135);
-var isEventSupported = _dereq_(136);
-var keyOf = _dereq_(141);
-var warning = _dereq_(154);
+var EventConstants = _dereq_(15);
+var ReactBrowserEventEmitter = _dereq_(26);
+var ReactComponentBrowserEnvironment = _dereq_(31);
+var ReactDOMButton = _dereq_(36);
+var ReactDOMInput = _dereq_(41);
+var ReactDOMOption = _dereq_(42);
+var ReactDOMSelect = _dereq_(43);
+var ReactDOMTextarea = _dereq_(47);
+var ReactMount = _dereq_(65);
+var ReactMultiChild = _dereq_(66);
+var ReactPerf = _dereq_(71);
+var ReactUpdateQueue = _dereq_(82);
+
+var assign = _dereq_(23);
+var canDefineProperty = _dereq_(104);
+var escapeTextContentForBrowser = _dereq_(107);
+var invariant = _dereq_(144);
+var isEventSupported = _dereq_(119);
+var keyOf = _dereq_(148);
+var setInnerHTML = _dereq_(124);
+var setTextContent = _dereq_(125);
+var shallowEqual = _dereq_(153);
+var validateDOMNesting = _dereq_(128);
+var warning = _dereq_(155);
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
-var CONTENT_TYPES = {'string': true, 'number': true};
+var CONTENT_TYPES = { 'string': true, 'number': true };
-var STYLE = keyOf({style: null});
+var CHILDREN = keyOf({ children: null });
+var STYLE = keyOf({ style: null });
+var HTML = keyOf({ __html: null });
var ELEMENT_NODE_TYPE = 1;
-/**
- * Optionally injectable operations for mutating the DOM
- */
-var BackendIDOperations = null;
+function getDeclarationErrorAddendum(internalInstance) {
+ if (internalInstance) {
+ var owner = internalInstance._currentElement._owner || null;
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' This DOM node was rendered by `' + name + '`.';
+ }
+ }
+ }
+ return '';
+}
+
+var legacyPropsDescriptor;
+if ("development" !== 'production') {
+ legacyPropsDescriptor = {
+ props: {
+ enumerable: false,
+ get: function () {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
+ return component._currentElement.props;
+ }
+ }
+ };
+}
+
+function legacyGetDOMNode() {
+ if ("development" !== 'production') {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return this;
+}
+
+function legacyIsMounted() {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return !!component;
+}
+
+function legacySetStateEtc() {
+ if ("development" !== 'production') {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+}
+
+function legacySetProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function legacyReplaceProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function friendlyStringify(obj) {
+ if (typeof obj === 'object') {
+ if (Array.isArray(obj)) {
+ return '[' + obj.map(friendlyStringify).join(', ') + ']';
+ } else {
+ var pairs = [];
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
+ pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
+ }
+ }
+ return '{' + pairs.join(', ') + '}';
+ }
+ } else if (typeof obj === 'string') {
+ return JSON.stringify(obj);
+ } else if (typeof obj === 'function') {
+ return '[function object]';
+ }
+ // Differs from JSON.stringify in that undefined becauses undefined and that
+ // inf and nan don't become null
+ return String(obj);
+}
+
+var styleMutationWarning = {};
+
+function checkAndWarnForMutatedStyle(style1, style2, component) {
+ if (style1 == null || style2 == null) {
+ return;
+ }
+ if (shallowEqual(style1, style2)) {
+ return;
+ }
+
+ var componentName = component._tag;
+ var owner = component._currentElement._owner;
+ var ownerName;
+ if (owner) {
+ ownerName = owner.getName();
+ }
+
+ var hash = ownerName + '|' + componentName;
+
+ if (styleMutationWarning.hasOwnProperty(hash)) {
+ return;
+ }
+
+ styleMutationWarning[hash] = true;
+
+ "development" !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
+}
/**
+ * @param {object} component
* @param {?object} props
*/
-function assertValidProps(props) {
+function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
+ if ("development" !== 'production') {
+ if (voidElementTags[component._tag]) {
+ "development" !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
+ }
+ }
if (props.dangerouslySetInnerHTML != null) {
- ("production" !== "development" ? invariant(
- props.children == null,
- 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
- ) : invariant(props.children == null));
- ("production" !== "development" ? invariant(
- typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML,
- '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
- 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
- 'for more information.'
- ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML));
- }
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- props.innerHTML == null,
- 'Directly setting property `innerHTML` is not permitted. ' +
- 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
- ) : null);
- ("production" !== "development" ? warning(
- !props.contentEditable || props.children == null,
- 'A component is `contentEditable` and contains `children` managed by ' +
- 'React. It is now your responsibility to guarantee that none of ' +
- 'those nodes are unexpectedly modified or duplicated. This is ' +
- 'probably not intentional.'
- ) : null);
- }
- ("production" !== "development" ? invariant(
- props.style == null || typeof props.style === 'object',
- 'The `style` prop expects a mapping from style properties to values, ' +
- 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
- 'using JSX.'
- ) : invariant(props.style == null || typeof props.style === 'object'));
+ !(props.children == null) ? "development" !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
+ !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? "development" !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
+ }
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
+ "development" !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
+ }
+ !(props.style == null || typeof props.style === 'object') ? "development" !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
}
-function putListener(id, registrationName, listener, transaction) {
- if ("production" !== "development") {
+function enqueuePutListener(id, registrationName, listener, transaction) {
+ if ("development" !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
- ("production" !== "development" ? warning(
- registrationName !== 'onScroll' || isEventSupported('scroll', true),
- 'This browser doesn\'t support the `onScroll` event'
- ) : null);
+ "development" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
- var doc = container.nodeType === ELEMENT_NODE_TYPE ?
- container.ownerDocument :
- container;
+ var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
listenTo(registrationName, doc);
}
- transaction.getPutListenerQueue().enqueuePutListener(
- id,
- registrationName,
- listener
- );
+ transaction.getReactMountReady().enqueue(putListener, {
+ id: id,
+ registrationName: registrationName,
+ listener: listener
+ });
+}
+
+function putListener() {
+ var listenerToPut = this;
+ ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
+}
+
+// There are so many media events, it makes sense to just
+// maintain a list rather than create a `trapBubbledEvent` for each
+var mediaEvents = {
+ topAbort: 'abort',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
+ topTimeUpdate: 'timeupdate',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting'
+};
+
+function trapBubbledEventsLocal() {
+ var inst = this;
+ // If a component renders to null or if another component fatals and causes
+ // the state of the tree to be corrupted, `node` here can be null.
+ !inst._rootNodeID ? "development" !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
+ var node = ReactMount.getNode(inst._rootNodeID);
+ !node ? "development" !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
+
+ switch (inst._tag) {
+ case 'iframe':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'video':
+ case 'audio':
+
+ inst._wrapperState.listeners = [];
+ // create listener for each media event
+ for (var event in mediaEvents) {
+ if (mediaEvents.hasOwnProperty(event)) {
+ inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
+ }
+ }
+
+ break;
+ case 'img':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'form':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
+ break;
+ }
+}
+
+function mountReadyInputWrapper() {
+ ReactDOMInput.mountReadyWrapper(this);
+}
+
+function postUpdateSelectWrapper() {
+ ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
@@ -7581,24 +6546,49 @@
'source': true,
'track': true,
'wbr': true
- // NOTE: menuitem's close tag should be omitted, but that causes problems.
};
-// We accept any tag to be rendered but since this gets injected into abitrary
+// NOTE: menuitem's close tag should be omitted, but that causes problems.
+var newlineEatingTags = {
+ 'listing': true,
+ 'pre': true,
+ 'textarea': true
+};
+
+// For HTML, certain tags cannot have children. This has the same purpose as
+// `omittedCloseTags` except that `menuitem` should still have its closing tag.
+
+var voidElementTags = assign({
+ 'menuitem': true
+}, omittedCloseTags);
+
+// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
-var hasOwnProperty = {}.hasOwnProperty;
+var hasOwnProperty = ({}).hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
- ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
+ !VALID_TAG_REGEX.test(tag) ? "development" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
validatedTagCache[tag] = true;
}
}
+function processChildContextDev(context, inst) {
+ // Pass down our tag name to child components for validation purposes
+ context = assign({}, context);
+ var info = context[validateDOMNesting.ancestorInfoContextKey];
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
+ return context;
+}
+
+function isCustomComponent(tagName, props) {
+ return tagName.indexOf('-') >= 0 || props.is != null;
+}
+
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
@@ -7615,17 +6605,25 @@
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
- this._tag = tag;
+ this._tag = tag.toLowerCase();
this._renderedChildren = null;
+ this._previousStyle = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
+ this._wrapperState = null;
+ this._topLevelWrapper = null;
+ this._nodeWithLegacyProperties = null;
+ if ("development" !== 'production') {
+ this._unprocessedContextDev = null;
+ this._processedContextDev = null;
+ }
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
},
@@ -7636,17 +6634,94 @@
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
* @return {string} The computed markup.
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._rootNodeID = rootID;
- assertValidProps(this._currentElement.props);
- var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
- return (
- this._createOpenTagMarkupAndPutListeners(transaction) +
- this._createContentMarkup(transaction, context) +
- closeTag
- );
+
+ var props = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ this._wrapperState = {
+ listeners: null
+ };
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
+ break;
+ case 'button':
+ props = ReactDOMButton.getNativeProps(this, props, context);
+ break;
+ case 'input':
+ ReactDOMInput.mountWrapper(this, props, context);
+ props = ReactDOMInput.getNativeProps(this, props, context);
+ break;
+ case 'option':
+ ReactDOMOption.mountWrapper(this, props, context);
+ props = ReactDOMOption.getNativeProps(this, props, context);
+ break;
+ case 'select':
+ ReactDOMSelect.mountWrapper(this, props, context);
+ props = ReactDOMSelect.getNativeProps(this, props, context);
+ context = ReactDOMSelect.processChildContext(this, props, context);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.mountWrapper(this, props, context);
+ props = ReactDOMTextarea.getNativeProps(this, props, context);
+ break;
+ }
+
+ assertValidProps(this, props);
+ if ("development" !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
+ if ("development" !== 'production') {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ context = this._processedContextDev;
+ }
+
+ var mountImage;
+ if (transaction.useCreateElement) {
+ var ownerDocument = context[ReactMount.ownerDocumentContextKey];
+ var el = ownerDocument.createElement(this._currentElement.type);
+ DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
+ // Populate node cache
+ ReactMount.getID(el);
+ this._updateDOMProperties({}, props, transaction, el);
+ this._createInitialChildren(transaction, props, context, el);
+ mountImage = el;
+ } else {
+ var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
+ var tagContent = this._createContentMarkup(transaction, props, context);
+ if (!tagContent && omittedCloseTags[this._tag]) {
+ mountImage = tagOpen + '/>';
+ } else {
+ mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
+ }
+ }
+
+ switch (this._tag) {
+ case 'input':
+ transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
+ // falls through
+ case 'button':
+ case 'select':
+ case 'textarea':
+ if (props.autoFocus) {
+ transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
+ }
+ break;
+ }
+
+ return mountImage;
},
/**
@@ -7659,11 +6734,11 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @return {string} Markup of opening tag.
*/
- _createOpenTagMarkupAndPutListeners: function(transaction) {
- var props = this._currentElement.props;
- var ret = '<' + this._tag;
+ _createOpenTagMarkupAndPutListeners: function (transaction, props) {
+ var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
@@ -7674,16 +6749,28 @@
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, propValue, transaction);
+ if (propValue) {
+ enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
+ }
} else {
if (propKey === STYLE) {
if (propValue) {
+ if ("development" !== 'production') {
+ // See `_updateDOMProperties`. style block
+ this._previousStyle = propValue;
+ }
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
- var markup =
- DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ var markup = null;
+ if (this._tag != null && isCustomComponent(this._tag, props)) {
+ if (propKey !== CHILDREN) {
+ markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
+ }
+ } else {
+ markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ }
if (markup) {
ret += ' ' + markup;
}
@@ -7693,11 +6780,11 @@
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
- return ret + '>';
+ return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
- return ret + ' ' + markupForID + '>';
+ return ret + ' ' + markupForID;
},
/**
@@ -7705,47 +6792,78 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
- _createContentMarkup: function(transaction, context) {
- var prefix = '';
- if (this._tag === 'listing' ||
- this._tag === 'pre' ||
- this._tag === 'textarea') {
- // Add an initial newline because browsers ignore the first newline in
- // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
- prefix = '\n';
- }
+ _createContentMarkup: function (transaction, props, context) {
+ var ret = '';
- var props = this._currentElement.props;
+ // Intentional use of != to avoid catching zero/false.
+ var innerHTML = props.dangerouslySetInnerHTML;
+ if (innerHTML != null) {
+ if (innerHTML.__html != null) {
+ ret = innerHTML.__html;
+ }
+ } else {
+ var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
+ var childrenToUse = contentToUse != null ? null : props.children;
+ if (contentToUse != null) {
+ // TODO: Validate that text is allowed as a child of this node
+ ret = escapeTextContentForBrowser(contentToUse);
+ } else if (childrenToUse != null) {
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ ret = mountImages.join('');
+ }
+ }
+ if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
+ // text/html ignores the first character in these tags if it's a newline
+ // Prefer to break application/xml over text/html (for now) by adding
+ // a newline specifically to get eaten by the parser. (Alternately for
+ // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
+ // \r is normalized out by HTMLTextAreaElement#value.)
+ // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
+ // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
+ // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
+ // See: Parsing of "textarea" "listing" and "pre" elements
+ // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
+ return '\n' + ret;
+ } else {
+ return ret;
+ }
+ },
+ _createInitialChildren: function (transaction, props, context, el) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
- return prefix + innerHTML.__html;
+ setInnerHTML(el, innerHTML.__html);
}
} else {
- var contentToUse =
- CONTENT_TYPES[typeof props.children] ? props.children : null;
+ var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
- return prefix + escapeTextContentForBrowser(contentToUse);
+ // TODO: Validate that text is allowed as a child of this node
+ setTextContent(el, contentToUse);
} else if (childrenToUse != null) {
- var mountImages = this.mountChildren(
- childrenToUse,
- transaction,
- context
- );
- return prefix + mountImages.join('');
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ for (var i = 0; i < mountImages.length; i++) {
+ el.appendChild(mountImages[i]);
+ }
}
}
- return prefix;
},
- receiveComponent: function(nextElement, transaction, context) {
+ /**
+ * Receives a next element and updates the component.
+ *
+ * @internal
+ * @param {ReactElement} nextElement
+ * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
+ */
+ receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
@@ -7761,10 +6879,59 @@
* @internal
* @overridable
*/
- updateComponent: function(transaction, prevElement, nextElement, context) {
- assertValidProps(this._currentElement.props);
- this._updateDOMProperties(prevElement.props, transaction);
- this._updateDOMChildren(prevElement.props, transaction, context);
+ updateComponent: function (transaction, prevElement, nextElement, context) {
+ var lastProps = prevElement.props;
+ var nextProps = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'button':
+ lastProps = ReactDOMButton.getNativeProps(this, lastProps);
+ nextProps = ReactDOMButton.getNativeProps(this, nextProps);
+ break;
+ case 'input':
+ ReactDOMInput.updateWrapper(this);
+ lastProps = ReactDOMInput.getNativeProps(this, lastProps);
+ nextProps = ReactDOMInput.getNativeProps(this, nextProps);
+ break;
+ case 'option':
+ lastProps = ReactDOMOption.getNativeProps(this, lastProps);
+ nextProps = ReactDOMOption.getNativeProps(this, nextProps);
+ break;
+ case 'select':
+ lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
+ nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.updateWrapper(this);
+ lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
+ nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
+ break;
+ }
+
+ if ("development" !== 'production') {
+ // If the context is reference-equal to the old one, pass down the same
+ // processed object so the update bailout in ReactReconciler behaves
+ // correctly (and identically in dev and prod). See #5005.
+ if (this._unprocessedContextDev !== context) {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ }
+ context = this._processedContextDev;
+ }
+
+ assertValidProps(this, nextProps);
+ this._updateDOMProperties(lastProps, nextProps, transaction, null);
+ this._updateDOMChildren(lastProps, nextProps, transaction, context);
+
+ if (!canDefineProperty && this._nodeWithLegacyProperties) {
+ this._nodeWithLegacyProperties.props = nextProps;
+ }
+
+ if (this._tag === 'select') {
+ // <select> value update needs to occur after <option> children
+ // reconciliation
+ transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
+ }
},
/**
@@ -7780,16 +6947,16 @@
*
* @private
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {?DOMElement} node
*/
- _updateDOMProperties: function(lastProps, transaction) {
- var nextProps = this._currentElement.props;
+ _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
- if (nextProps.hasOwnProperty(propKey) ||
- !lastProps.hasOwnProperty(propKey)) {
+ if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
@@ -7802,26 +6969,31 @@
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
+ if (lastProps[propKey]) {
+ // Only call deleteListener if there was a listener previously or
+ // else willDeleteListener gets called when there wasn't actually a
+ // listener (e.g., onClick={null})
deleteListener(this._rootNodeID, propKey);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.deletePropertyByID(
- this._rootNodeID,
- propKey
- );
+ }
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
- var lastProp = propKey === STYLE ?
- this._previousStyleCopy :
- lastProps[propKey];
+ var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
+ if ("development" !== 'production') {
+ checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
+ this._previousStyle = nextProp;
+ }
nextProp = this._previousStyleCopy = assign({}, nextProp);
} else {
this._previousStyleCopy = null;
@@ -7829,16 +7001,14 @@
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
- if (lastProp.hasOwnProperty(styleName) &&
- (!nextProp || !nextProp.hasOwnProperty(styleName))) {
+ if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
- if (nextProp.hasOwnProperty(styleName) &&
- lastProp[styleName] !== nextProp[styleName]) {
+ if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
@@ -7848,22 +7018,38 @@
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, nextProp, transaction);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.updatePropertyByID(
- this._rootNodeID,
- propKey,
- nextProp
- );
+ if (nextProp) {
+ enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
+ } else if (lastProp) {
+ deleteListener(this._rootNodeID, propKey);
+ }
+ } else if (isCustomComponent(this._tag, nextProps)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ if (propKey === CHILDREN) {
+ nextProp = null;
+ }
+ DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ // If we're updating to null or undefined, we should remove the property
+ // from the DOM node instead of inadvertantly setting to a string. This
+ // brings us in line with the same behavior we have on initial render.
+ if (nextProp != null) {
+ DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
+ } else {
+ DOMPropertyOperations.deleteValueForProperty(node, propKey);
+ }
}
}
if (styleUpdates) {
- BackendIDOperations.updateStylesByID(
- this._rootNodeID,
- styleUpdates
- );
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ CSSPropertyOperations.setValueForStyles(node, styleUpdates);
}
},
@@ -7872,22 +7058,16 @@
* children content.
*
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {object} context
*/
- _updateDOMChildren: function(lastProps, transaction, context) {
- var nextProps = this._currentElement.props;
+ _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
+ var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
+ var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
- var lastContent =
- CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
- var nextContent =
- CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
-
- var lastHtml =
- lastProps.dangerouslySetInnerHTML &&
- lastProps.dangerouslySetInnerHTML.__html;
- var nextHtml =
- nextProps.dangerouslySetInnerHTML &&
- nextProps.dangerouslySetInnerHTML.__html;
+ var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
+ var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
@@ -7909,10 +7089,7 @@
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
- BackendIDOperations.updateInnerHTMLByID(
- this._rootNodeID,
- nextHtml
- );
+ this.updateMarkup('' + nextHtml);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
@@ -7925,11 +7102,76 @@
*
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ var listeners = this._wrapperState.listeners;
+ if (listeners) {
+ for (var i = 0; i < listeners.length; i++) {
+ listeners[i].remove();
+ }
+ }
+ break;
+ case 'input':
+ ReactDOMInput.unmountWrapper(this);
+ break;
+ case 'html':
+ case 'head':
+ case 'body':
+ /**
+ * Components like <html> <head> and <body> can't be removed or added
+ * easily in a cross-browser way, however it's valuable to be able to
+ * take advantage of React's reconciliation for styling and <title>
+ * management. So we just document it and throw in dangerous cases.
+ */
+ !false ? "development" !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
+ break;
+ }
+
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
+ this._wrapperState = null;
+ if (this._nodeWithLegacyProperties) {
+ var node = this._nodeWithLegacyProperties;
+ node._reactInternalComponent = null;
+ this._nodeWithLegacyProperties = null;
+ }
+ },
+
+ getPublicInstance: function () {
+ if (!this._nodeWithLegacyProperties) {
+ var node = ReactMount.getNode(this._rootNodeID);
+
+ node._reactInternalComponent = this;
+ node.getDOMNode = legacyGetDOMNode;
+ node.isMounted = legacyIsMounted;
+ node.setState = legacySetStateEtc;
+ node.replaceState = legacySetStateEtc;
+ node.forceUpdate = legacySetStateEtc;
+ node.setProps = legacySetProps;
+ node.replaceProps = legacyReplaceProps;
+
+ if ("development" !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperties(node, legacyPropsDescriptor);
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+
+ this._nodeWithLegacyProperties = node;
+ }
+ return this._nodeWithLegacyProperties;
}
};
@@ -7939,21 +7181,10 @@
updateComponent: 'updateComponent'
});
-assign(
- ReactDOMComponent.prototype,
- ReactDOMComponent.Mixin,
- ReactMultiChild.Mixin
-);
-
-ReactDOMComponent.injection = {
- injectIDOperations: function(IDOperations) {
- ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
- }
-};
+assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
-
-},{"10":10,"11":11,"116":116,"135":135,"136":136,"141":141,"154":154,"27":27,"30":30,"35":35,"5":5,"70":70,"71":71,"75":75}],43:[function(_dereq_,module,exports){
+},{"10":10,"104":104,"107":107,"11":11,"119":119,"124":124,"125":125,"128":128,"144":144,"148":148,"15":15,"153":153,"155":155,"2":2,"23":23,"26":26,"31":31,"36":36,"41":41,"42":42,"43":43,"47":47,"5":5,"65":65,"66":66,"71":71,"82":82}],38:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7962,47 +7193,195 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactDOMForm
+ * @providesModule ReactDOMFactories
+ * @typechecks static-only
*/
'use strict';
-var EventConstants = _dereq_(15);
-var LocalEventTrapMixin = _dereq_(25);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
+var ReactElement = _dereq_(52);
+var ReactElementValidator = _dereq_(53);
+
+var mapObject = _dereq_(149);
-var form = ReactElement.createFactory('form');
+/**
+ * Create a factory that creates HTML tag elements.
+ *
+ * @param {string} tag Tag name (e.g. `div`).
+ * @private
+ */
+function createDOMFactory(tag) {
+ if ("development" !== 'production') {
+ return ReactElementValidator.createFactory(tag);
+ }
+ return ReactElement.createFactory(tag);
+}
/**
- * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
- * to capture it on the <form> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <form> a
- * composite component and use `componentDidMount` to attach the event handlers.
+ * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
+ * This is also accessible via `React.DOM`.
+ *
+ * @public
*/
-var ReactDOMForm = ReactClass.createClass({
- displayName: 'ReactDOMForm',
- tagName: 'FORM',
+var ReactDOMFactories = mapObject({
+ a: 'a',
+ abbr: 'abbr',
+ address: 'address',
+ area: 'area',
+ article: 'article',
+ aside: 'aside',
+ audio: 'audio',
+ b: 'b',
+ base: 'base',
+ bdi: 'bdi',
+ bdo: 'bdo',
+ big: 'big',
+ blockquote: 'blockquote',
+ body: 'body',
+ br: 'br',
+ button: 'button',
+ canvas: 'canvas',
+ caption: 'caption',
+ cite: 'cite',
+ code: 'code',
+ col: 'col',
+ colgroup: 'colgroup',
+ data: 'data',
+ datalist: 'datalist',
+ dd: 'dd',
+ del: 'del',
+ details: 'details',
+ dfn: 'dfn',
+ dialog: 'dialog',
+ div: 'div',
+ dl: 'dl',
+ dt: 'dt',
+ em: 'em',
+ embed: 'embed',
+ fieldset: 'fieldset',
+ figcaption: 'figcaption',
+ figure: 'figure',
+ footer: 'footer',
+ form: 'form',
+ h1: 'h1',
+ h2: 'h2',
+ h3: 'h3',
+ h4: 'h4',
+ h5: 'h5',
+ h6: 'h6',
+ head: 'head',
+ header: 'header',
+ hgroup: 'hgroup',
+ hr: 'hr',
+ html: 'html',
+ i: 'i',
+ iframe: 'iframe',
+ img: 'img',
+ input: 'input',
+ ins: 'ins',
+ kbd: 'kbd',
+ keygen: 'keygen',
+ label: 'label',
+ legend: 'legend',
+ li: 'li',
+ link: 'link',
+ main: 'main',
+ map: 'map',
+ mark: 'mark',
+ menu: 'menu',
+ menuitem: 'menuitem',
+ meta: 'meta',
+ meter: 'meter',
+ nav: 'nav',
+ noscript: 'noscript',
+ object: 'object',
+ ol: 'ol',
+ optgroup: 'optgroup',
+ option: 'option',
+ output: 'output',
+ p: 'p',
+ param: 'param',
+ picture: 'picture',
+ pre: 'pre',
+ progress: 'progress',
+ q: 'q',
+ rp: 'rp',
+ rt: 'rt',
+ ruby: 'ruby',
+ s: 's',
+ samp: 'samp',
+ script: 'script',
+ section: 'section',
+ select: 'select',
+ small: 'small',
+ source: 'source',
+ span: 'span',
+ strong: 'strong',
+ style: 'style',
+ sub: 'sub',
+ summary: 'summary',
+ sup: 'sup',
+ table: 'table',
+ tbody: 'tbody',
+ td: 'td',
+ textarea: 'textarea',
+ tfoot: 'tfoot',
+ th: 'th',
+ thead: 'thead',
+ time: 'time',
+ title: 'title',
+ tr: 'tr',
+ track: 'track',
+ u: 'u',
+ ul: 'ul',
+ 'var': 'var',
+ video: 'video',
+ wbr: 'wbr',
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
+ // SVG
+ circle: 'circle',
+ clipPath: 'clipPath',
+ defs: 'defs',
+ ellipse: 'ellipse',
+ g: 'g',
+ image: 'image',
+ line: 'line',
+ linearGradient: 'linearGradient',
+ mask: 'mask',
+ path: 'path',
+ pattern: 'pattern',
+ polygon: 'polygon',
+ polyline: 'polyline',
+ radialGradient: 'radialGradient',
+ rect: 'rect',
+ stop: 'stop',
+ svg: 'svg',
+ text: 'text',
+ tspan: 'tspan'
- render: function() {
- // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
- // `jshint` fails to parse JSX so in order for linting to work in the open
- // source repo, we need to just use `ReactDOM.form`.
- return form(this.props);
- },
+}, createDOMFactory);
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
- }
-});
+module.exports = ReactDOMFactories;
+},{"149":149,"52":52,"53":53}],39:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMFeatureFlags
+ */
+
+'use strict';
-module.exports = ReactDOMForm;
+var ReactDOMFeatureFlags = {
+ useCreateElement: false
+};
-},{"15":15,"25":25,"29":29,"33":33,"57":57}],44:[function(_dereq_,module,exports){
+module.exports = ReactDOMFeatureFlags;
+},{}],40:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8015,34 +7394,28 @@
* @typechecks static-only
*/
-/*jslint evil: true */
-
'use strict';
-var CSSPropertyOperations = _dereq_(5);
var DOMChildrenOperations = _dereq_(9);
var DOMPropertyOperations = _dereq_(11);
-var ReactMount = _dereq_(70);
-var ReactPerf = _dereq_(75);
+var ReactMount = _dereq_(65);
+var ReactPerf = _dereq_(71);
-var invariant = _dereq_(135);
-var setInnerHTML = _dereq_(148);
+var invariant = _dereq_(144);
/**
- * Errors for properties that should not be updated with `updatePropertyById()`.
+ * Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
- dangerouslySetInnerHTML:
- '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
+ dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
- * Operations used to process updates to DOM nodes. This is made injectable via
- * `ReactDOMComponent.BackendIDOperations`.
+ * Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
@@ -8055,13 +7428,9 @@
* @param {*} value New value of the property.
* @internal
*/
- updatePropertyByID: function(id, name, value) {
+ updatePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
- ("production" !== "development" ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
+ !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? "development" !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
@@ -8074,61 +7443,6 @@
},
/**
- * Updates a DOM node to remove a property. This should only be used to remove
- * DOM properties in `DOMProperty`.
- *
- * @param {string} id ID of the node to update.
- * @param {string} name A property name to remove, see `DOMProperty`.
- * @internal
- */
- deletePropertyByID: function(id, name, value) {
- var node = ReactMount.getNode(id);
- ("production" !== "development" ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
- DOMPropertyOperations.deleteValueForProperty(node, name, value);
- },
-
- /**
- * Updates a DOM node with new style values. If a value is specified as '',
- * the corresponding style property will be unset.
- *
- * @param {string} id ID of the node to update.
- * @param {object} styles Mapping from styles to values.
- * @internal
- */
- updateStylesByID: function(id, styles) {
- var node = ReactMount.getNode(id);
- CSSPropertyOperations.setValueForStyles(node, styles);
- },
-
- /**
- * Updates a DOM node's innerHTML.
- *
- * @param {string} id ID of the node to update.
- * @param {string} html An HTML string.
- * @internal
- */
- updateInnerHTMLByID: function(id, html) {
- var node = ReactMount.getNode(id);
- setInnerHTML(node, html);
- },
-
- /**
- * Updates a DOM node's text content set by `props.content`.
- *
- * @param {string} id ID of the node to update.
- * @param {string} content Text content.
- * @internal
- */
- updateTextContentByID: function(id, content) {
- var node = ReactMount.getNode(id);
- DOMChildrenOperations.updateTextContent(node, content);
- },
-
- /**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
@@ -8136,7 +7450,7 @@
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
- dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
+ dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
@@ -8148,7 +7462,7 @@
* @param {array<string>} markup List of markup strings.
* @internal
*/
- dangerouslyProcessChildrenUpdates: function(updates, markup) {
+ dangerouslyProcessChildrenUpdates: function (updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
@@ -8157,109 +7471,12 @@
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
- updatePropertyByID: 'updatePropertyByID',
- deletePropertyByID: 'deletePropertyByID',
- updateStylesByID: 'updateStylesByID',
- updateInnerHTMLByID: 'updateInnerHTMLByID',
- updateTextContentByID: 'updateTextContentByID',
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
-
-},{"11":11,"135":135,"148":148,"5":5,"70":70,"75":75,"9":9}],45:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMIframe
- */
-
-'use strict';
-
-var EventConstants = _dereq_(15);
-var LocalEventTrapMixin = _dereq_(25);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
-
-var iframe = ReactElement.createFactory('iframe');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <iframe> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <iframe> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMIframe = ReactClass.createClass({
- displayName: 'ReactDOMIframe',
- tagName: 'IFRAME',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return iframe(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- }
-});
-
-module.exports = ReactDOMIframe;
-
-},{"15":15,"25":25,"29":29,"33":33,"57":57}],46:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMImg
- */
-
-'use strict';
-
-var EventConstants = _dereq_(15);
-var LocalEventTrapMixin = _dereq_(25);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
-
-var img = ReactElement.createFactory('img');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <img> element itself. There are lots of hacks we could do
- * to accomplish this, but the most reliable is to make <img> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMImg = ReactClass.createClass({
- displayName: 'ReactDOMImg',
- tagName: 'IMG',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return img(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
- }
-});
-
-module.exports = ReactDOMImg;
-
-},{"15":15,"25":25,"29":29,"33":33,"57":57}],47:[function(_dereq_,module,exports){
+},{"11":11,"144":144,"65":65,"71":71,"9":9}],41:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8273,26 +7490,20 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var DOMPropertyOperations = _dereq_(11);
-var LinkedValueUtils = _dereq_(24);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
-var ReactMount = _dereq_(70);
-var ReactUpdates = _dereq_(87);
-
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
+var ReactDOMIDOperations = _dereq_(40);
+var LinkedValueUtils = _dereq_(22);
+var ReactMount = _dereq_(65);
+var ReactUpdates = _dereq_(83);
-var input = ReactElement.createFactory('input');
+var assign = _dereq_(23);
+var invariant = _dereq_(144);
var instancesByReactID = {};
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMInput.updateWrapper(this);
}
}
@@ -8312,81 +7523,75 @@
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
-var ReactDOMInput = ReactClass.createClass({
- displayName: 'ReactDOMInput',
- tagName: 'INPUT',
-
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+var ReactDOMInput = {
+ getNativeProps: function (inst, props, context) {
+ var value = LinkedValueUtils.getValue(props);
+ var checked = LinkedValueUtils.getChecked(props);
+
+ var nativeProps = assign({}, props, {
+ defaultChecked: undefined,
+ defaultValue: undefined,
+ value: value != null ? value : inst._wrapperState.initialValue,
+ checked: checked != null ? checked : inst._wrapperState.initialChecked,
+ onChange: inst._wrapperState.onChange
+ });
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
- return {
- initialChecked: this.props.defaultChecked || false,
- initialValue: defaultValue != null ? defaultValue : null
- };
+ return nativeProps;
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- props.defaultChecked = null;
- props.defaultValue = null;
-
- var value = LinkedValueUtils.getValue(this);
- props.value = value != null ? value : this.state.initialValue;
-
- var checked = LinkedValueUtils.getChecked(this);
- props.checked = checked != null ? checked : this.state.initialChecked;
-
- props.onChange = this._handleChange;
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
+ }
- return input(props, this.props.children);
+ var defaultValue = props.defaultValue;
+ inst._wrapperState = {
+ initialChecked: props.defaultChecked || false,
+ initialValue: defaultValue != null ? defaultValue : null,
+ onChange: _handleChange.bind(inst)
+ };
},
- componentDidMount: function() {
- var id = ReactMount.getID(this.getDOMNode());
- instancesByReactID[id] = this;
+ mountReadyWrapper: function (inst) {
+ // Can't be in mountWrapper or else server rendering leaks.
+ instancesByReactID[inst._rootNodeID] = inst;
},
- componentWillUnmount: function() {
- var rootNode = this.getDOMNode();
- var id = ReactMount.getID(rootNode);
- delete instancesByReactID[id];
+ unmountWrapper: function (inst) {
+ delete instancesByReactID[inst._rootNodeID];
},
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var rootNode = this.getDOMNode();
- if (this.props.checked != null) {
- DOMPropertyOperations.setValueForProperty(
- rootNode,
- 'checked',
- this.props.checked || false
- );
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // TODO: Shouldn't this be getChecked(props)?
+ var checked = props.checked;
+ if (checked != null) {
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
}
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
+
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
- var name = this.props.name;
- if (this.props.type === 'radio' && name != null) {
- var rootNode = this.getDOMNode();
+ var name = props.name;
+ if (props.type === 'radio' && name != null) {
+ var rootNode = ReactMount.getNode(this._rootNodeID);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
@@ -8399,27 +7604,21 @@
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
- var group = queryRoot.querySelectorAll(
- 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
+ var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
- for (var i = 0, groupLen = group.length; i < groupLen; i++) {
+ for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
- if (otherNode === rootNode ||
- otherNode.form !== rootNode.form) {
+ if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
+ // This will throw if radio buttons rendered by different copies of React
+ // and the same name are rendered into the same form (same as #1939).
+ // That's probably okay; we don't support it just as we don't support
+ // mixing React with non-React.
var otherID = ReactMount.getID(otherNode);
- ("production" !== "development" ? invariant(
- otherID,
- 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
- 'same `name` is not supported.'
- ) : invariant(otherID));
+ !otherID ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
var otherInstance = instancesByReactID[otherID];
- ("production" !== "development" ? invariant(
- otherInstance,
- 'ReactDOMInput: Unknown radio button ID %s.',
- otherID
- ) : invariant(otherInstance));
+ !otherInstance ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
@@ -8428,13 +7627,10 @@
}
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMInput;
-
-},{"11":11,"135":135,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"70":70,"87":87}],48:[function(_dereq_,module,exports){
+},{"144":144,"22":22,"23":23,"40":40,"65":65,"83":83}],42:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8448,43 +7644,83 @@
'use strict';
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
+var ReactChildren = _dereq_(28);
+var ReactDOMSelect = _dereq_(43);
-var warning = _dereq_(154);
+var assign = _dereq_(23);
+var warning = _dereq_(155);
-var option = ReactElement.createFactory('option');
+var valueContextKey = ReactDOMSelect.valueContextKey;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
-var ReactDOMOption = ReactClass.createClass({
- displayName: 'ReactDOMOption',
- tagName: 'OPTION',
+var ReactDOMOption = {
+ mountWrapper: function (inst, props, context) {
+ // TODO (yungsters): Remove support for `selected` in <option>.
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
+ }
- mixins: [ReactBrowserComponentMixin],
+ // Look up whether this option is 'selected' via context
+ var selectValue = context[valueContextKey];
- componentWillMount: function() {
- // TODO (yungsters): Remove support for `selected` in <option>.
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- this.props.selected == null,
- 'Use the `defaultValue` or `value` props on <select> instead of ' +
- 'setting `selected` on <option>.'
- ) : null);
+ // If context key is null (e.g., no specified value or after initial mount)
+ // or missing (e.g., for <datalist>), we don't change props.selected
+ var selected = null;
+ if (selectValue != null) {
+ selected = false;
+ if (Array.isArray(selectValue)) {
+ // multiple
+ for (var i = 0; i < selectValue.length; i++) {
+ if ('' + selectValue[i] === '' + props.value) {
+ selected = true;
+ break;
+ }
+ }
+ } else {
+ selected = '' + selectValue === '' + props.value;
+ }
}
+
+ inst._wrapperState = { selected: selected };
},
- render: function() {
- return option(this.props, this.props.children);
+ getNativeProps: function (inst, props, context) {
+ var nativeProps = assign({ selected: undefined, children: undefined }, props);
+
+ // Read state only from initial mount because <select> updates value
+ // manually; we need the initial state only for server rendering
+ if (inst._wrapperState.selected != null) {
+ nativeProps.selected = inst._wrapperState.selected;
}
-});
+ var content = '';
-module.exports = ReactDOMOption;
+ // Flatten children and warn if they aren't strings or numbers;
+ // invalid types are ignored.
+ ReactChildren.forEach(props.children, function (child) {
+ if (child == null) {
+ return;
+ }
+ if (typeof child === 'string' || typeof child === 'number') {
+ content += child;
+ } else {
+ "development" !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
+ }
+ });
-},{"154":154,"29":29,"33":33,"57":57}],49:[function(_dereq_,module,exports){
+ if (content) {
+ nativeProps.children = content;
+ }
+
+ return nativeProps;
+ }
+
+};
+
+module.exports = ReactDOMOption;
+},{"155":155,"23":23,"28":28,"43":43}],43:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8498,68 +7734,77 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var LinkedValueUtils = _dereq_(24);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
-var ReactUpdates = _dereq_(87);
+var LinkedValueUtils = _dereq_(22);
+var ReactMount = _dereq_(65);
+var ReactUpdates = _dereq_(83);
-var assign = _dereq_(27);
+var assign = _dereq_(23);
+var warning = _dereq_(155);
-var select = ReactElement.createFactory('select');
+var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
function updateOptionsIfPendingUpdateAndMounted() {
- /*jshint validthis:true */
- if (this._pendingUpdate) {
- this._pendingUpdate = false;
- var value = LinkedValueUtils.getValue(this);
- if (value != null && this.isMounted()) {
- updateOptions(this, value);
+ if (this._rootNodeID && this._wrapperState.pendingUpdate) {
+ this._wrapperState.pendingUpdate = false;
+
+ var props = this._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
+
+ if (value != null) {
+ updateOptions(this, Boolean(props.multiple), value);
+ }
+ }
+}
+
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
}
}
+ return '';
}
+var valuePropNames = ['value', 'defaultValue'];
+
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
-function selectValueType(props, propName, componentName) {
+function checkSelectPropTypes(inst, props) {
+ var owner = inst._currentElement._owner;
+ LinkedValueUtils.checkPropTypes('select', props, owner);
+
+ for (var i = 0; i < valuePropNames.length; i++) {
+ var propName = valuePropNames[i];
if (props[propName] == null) {
- return null;
+ continue;
}
if (props.multiple) {
- if (!Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be an array if ") +
- ("`multiple` is true.")
- );
- }
+ "development" !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
} else {
- if (Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
- ("value if `multiple` is false.")
- );
+ "development" !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
}
}
}
/**
- * @param {ReactComponent} component Instance of ReactDOMSelect
+ * @param {ReactDOMComponent} inst
+ * @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
-function updateOptions(component, propValue) {
- var selectedValue, i, l;
- var options = component.getDOMNode().options;
+function updateOptions(inst, multiple, propValue) {
+ var selectedValue, i;
+ var options = ReactMount.getNode(inst._rootNodeID).options;
- if (component.props.multiple) {
+ if (multiple) {
selectedValue = {};
- for (i = 0, l = propValue.length; i < l; i++) {
+ for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
@@ -8569,7 +7814,7 @@
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
@@ -8596,73 +7841,75 @@
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
-var ReactDOMSelect = ReactClass.createClass({
- displayName: 'ReactDOMSelect',
- tagName: 'SELECT',
+var ReactDOMSelect = {
+ valueContextKey: valueContextKey,
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
-
- propTypes: {
- defaultValue: selectValueType,
- value: selectValueType
+ getNativeProps: function (inst, props, context) {
+ return assign({}, props, {
+ onChange: inst._wrapperState.onChange,
+ value: undefined
+ });
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- props.onChange = this._handleChange;
- props.value = null;
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ checkSelectPropTypes(inst, props);
+ }
- return select(props, this.props.children);
+ var value = LinkedValueUtils.getValue(props);
+ inst._wrapperState = {
+ pendingUpdate: false,
+ initialValue: value != null ? value : props.defaultValue,
+ onChange: _handleChange.bind(inst),
+ wasMultiple: Boolean(props.multiple)
+ };
},
- componentWillMount: function() {
- this._pendingUpdate = false;
+ processChildContext: function (inst, props, context) {
+ // Pass down initial value so initial generated markup has correct
+ // `selected` attributes
+ var childContext = assign({}, context);
+ childContext[valueContextKey] = inst._wrapperState.initialValue;
+ return childContext;
},
- componentDidMount: function() {
- var value = LinkedValueUtils.getValue(this);
- if (value != null) {
- updateOptions(this, value);
- } else if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
- }
- },
+ postUpdateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // After the initial mount, we control selected-ness manually so don't pass
+ // the context value down
+ inst._wrapperState.initialValue = undefined;
+
+ var wasMultiple = inst._wrapperState.wasMultiple;
+ inst._wrapperState.wasMultiple = Boolean(props.multiple);
- componentDidUpdate: function(prevProps) {
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- this._pendingUpdate = false;
- updateOptions(this, value);
- } else if (!prevProps.multiple !== !this.props.multiple) {
+ inst._wrapperState.pendingUpdate = false;
+ updateOptions(inst, Boolean(props.multiple), value);
+ } else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
- if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
+ if (props.defaultValue != null) {
+ updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
- updateOptions(this, this.props.multiple ? [] : '');
+ updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
- this._pendingUpdate = true;
+ this._wrapperState.pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMSelect;
-
-},{"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],50:[function(_dereq_,module,exports){
+},{"155":155,"22":22,"23":23,"65":65,"83":83}],44:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8676,10 +7923,10 @@
'use strict';
-var ExecutionEnvironment = _dereq_(21);
+var ExecutionEnvironment = _dereq_(130);
-var getNodeForCharacterOffset = _dereq_(128);
-var getTextContentAccessor = _dereq_(130);
+var getNodeForCharacterOffset = _dereq_(116);
+var getTextContentAccessor = _dereq_(117);
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
@@ -8741,15 +7988,26 @@
var currentRange = selection.getRangeAt(0);
+ // In Firefox, range.startContainer and range.endContainer can be "anonymous
+ // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
+ // divs do not seem to expose properties, triggering a "Permission denied
+ // error" if any of its properties are accessed. The only seemingly possible
+ // way to avoid erroring is to access a property that typically works for
+ // non-anonymous divs and catch any error that may otherwise arise. See
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
+ try {
+ /* eslint-disable no-unused-expressions */
+ currentRange.startContainer.nodeType;
+ currentRange.endContainer.nodeType;
+ /* eslint-enable no-unused-expressions */
+ } catch (e) {
+ return null;
+ }
+
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
- var isSelectionCollapsed = isCollapsed(
- selection.anchorNode,
- selection.anchorOffset,
- selection.focusNode,
- selection.focusOffset
- );
+ var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
@@ -8757,12 +8015,7 @@
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
- var isTempRangeCollapsed = isCollapsed(
- tempRange.startContainer,
- tempRange.startOffset,
- tempRange.endContainer,
- tempRange.endOffset
- );
+ var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
@@ -8825,8 +8078,7 @@
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
- var end = typeof offsets.end === 'undefined' ?
- start : Math.min(offsets.end, length);
+ var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
@@ -8854,11 +8106,7 @@
}
}
-var useIEOffsets = (
- ExecutionEnvironment.canUseDOM &&
- 'selection' in document &&
- !('getSelection' in window)
-);
+var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**
@@ -8874,8 +8122,34 @@
};
module.exports = ReactDOMSelection;
+},{"116":116,"117":117,"130":130}],45:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMServer
+ */
+
+'use strict';
-},{"128":128,"130":130,"21":21}],51:[function(_dereq_,module,exports){
+var ReactDefaultInjection = _dereq_(49);
+var ReactServerRendering = _dereq_(80);
+var ReactVersion = _dereq_(84);
+
+ReactDefaultInjection.inject();
+
+var ReactDOMServer = {
+ renderToString: ReactServerRendering.renderToString,
+ renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
+ version: ReactVersion
+};
+
+module.exports = ReactDOMServer;
+},{"49":49,"80":80,"84":84}],46:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8890,13 +8164,15 @@
'use strict';
+var DOMChildrenOperations = _dereq_(9);
var DOMPropertyOperations = _dereq_(11);
-var ReactComponentBrowserEnvironment =
- _dereq_(35);
-var ReactDOMComponent = _dereq_(42);
+var ReactComponentBrowserEnvironment = _dereq_(31);
+var ReactMount = _dereq_(65);
-var assign = _dereq_(27);
-var escapeTextContentForBrowser = _dereq_(116);
+var assign = _dereq_(23);
+var escapeTextContentForBrowser = _dereq_(107);
+var setTextContent = _dereq_(125);
+var validateDOMNesting = _dereq_(128);
/**
* Text nodes violate a couple assumptions that React makes about components:
@@ -8913,7 +8189,7 @@
* @extends ReactComponent
* @internal
*/
-var ReactDOMTextComponent = function(props) {
+var ReactDOMTextComponent = function (props) {
// This constructor and its argument is currently used by mocks.
};
@@ -8923,7 +8199,7 @@
* @param {ReactText} text
* @internal
*/
- construct: function(text) {
+ construct: function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
@@ -8942,8 +8218,23 @@
* @return {string} Markup for this text node.
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
+ if ("development" !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
this._rootNodeID = rootID;
+ if (transaction.useCreateElement) {
+ var ownerDocument = context[ReactMount.ownerDocumentContextKey];
+ var el = ownerDocument.createElement('span');
+ DOMPropertyOperations.setAttributeForID(el, rootID);
+ // Populate node cache
+ ReactMount.getID(el);
+ setTextContent(el, this._stringText);
+ return el;
+ } else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
@@ -8953,11 +8244,8 @@
return escapedText;
}
- return (
- '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
- escapedText +
- '</span>'
- );
+ return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
+ }
},
/**
@@ -8967,7 +8255,7 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- receiveComponent: function(nextText, transaction) {
+ receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
@@ -8976,23 +8264,20 @@
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
- ReactDOMComponent.BackendIDOperations.updateTextContentByID(
- this._rootNodeID,
- nextStringText
- );
+ var node = ReactMount.getNode(this._rootNodeID);
+ DOMChildrenOperations.updateTextContent(node, nextStringText);
}
}
},
- unmountComponent: function() {
+ unmountComponent: function () {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
});
module.exports = ReactDOMTextComponent;
-
-},{"11":11,"116":116,"27":27,"35":35,"42":42}],52:[function(_dereq_,module,exports){
+},{"107":107,"11":11,"125":125,"128":128,"23":23,"31":31,"65":65,"9":9}],47:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9006,25 +8291,18 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var DOMPropertyOperations = _dereq_(11);
-var LinkedValueUtils = _dereq_(24);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
-var ReactUpdates = _dereq_(87);
-
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
-
-var warning = _dereq_(154);
-
-var textarea = ReactElement.createFactory('textarea');
+var LinkedValueUtils = _dereq_(22);
+var ReactDOMIDOperations = _dereq_(40);
+var ReactUpdates = _dereq_(83);
+
+var assign = _dereq_(23);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMTextarea.updateWrapper(this);
}
}
@@ -9043,33 +8321,37 @@
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
-var ReactDOMTextarea = ReactClass.createClass({
- displayName: 'ReactDOMTextarea',
- tagName: 'TEXTAREA',
+var ReactDOMTextarea = {
+ getNativeProps: function (inst, props, context) {
+ !(props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
+
+ // Always set children to the same thing. In IE9, the selection range will
+ // get reset if `textContent` is mutated.
+ var nativeProps = assign({}, props, {
+ defaultValue: undefined,
+ value: undefined,
+ children: inst._wrapperState.initialValue,
+ onChange: inst._wrapperState.onChange
+ });
+
+ return nativeProps;
+ },
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
+ }
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
+ var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
- var children = this.props.children;
+ var children = props.children;
if (children != null) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- false,
- 'Use the `defaultValue` or `value` props instead of setting ' +
- 'children on <textarea>.'
- ) : null);
- }
- ("production" !== "development" ? invariant(
- defaultValue == null,
- 'If you supply `defaultValue` on a <textarea>, do not pass children.'
- ) : invariant(defaultValue == null));
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
+ }
+ !(defaultValue == null) ? "development" !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
if (Array.isArray(children)) {
- ("production" !== "development" ? invariant(
- children.length <= 1,
- '<textarea> can only have at most one child.'
- ) : invariant(children.length <= 1));
+ !(children.length <= 1) ? "development" !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
children = children[0];
}
@@ -9078,59 +8360,38 @@
if (defaultValue == null) {
defaultValue = '';
}
- var value = LinkedValueUtils.getValue(this);
- return {
+ var value = LinkedValueUtils.getValue(props);
+
+ inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
- initialValue: '' + (value != null ? value : defaultValue)
+ initialValue: '' + (value != null ? value : defaultValue),
+ onChange: _handleChange.bind(inst)
};
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- ("production" !== "development" ? invariant(
- props.dangerouslySetInnerHTML == null,
- '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
- ) : invariant(props.dangerouslySetInnerHTML == null));
-
- props.defaultValue = null;
- props.value = null;
- props.onChange = this._handleChange;
-
- // Always set children to the same thing. In IE9, the selection range will
- // get reset if `textContent` is mutated.
- return textarea(props, this.state.initialValue);
- },
-
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var value = LinkedValueUtils.getValue(this);
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- var rootNode = this.getDOMNode();
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMTextarea;
-
-},{"11":11,"135":135,"154":154,"2":2,"24":24,"27":27,"29":29,"33":33,"57":57,"87":87}],53:[function(_dereq_,module,exports){
+},{"144":144,"155":155,"22":22,"23":23,"40":40,"83":83}],48:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9144,15 +8405,15 @@
'use strict';
-var ReactUpdates = _dereq_(87);
-var Transaction = _dereq_(103);
+var ReactUpdates = _dereq_(83);
+var Transaction = _dereq_(100);
-var assign = _dereq_(27);
-var emptyFunction = _dereq_(114);
+var assign = _dereq_(23);
+var emptyFunction = _dereq_(136);
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
- close: function() {
+ close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
@@ -9168,15 +8429,11 @@
this.reinitializeTransaction();
}
-assign(
- ReactDefaultBatchingStrategyTransaction.prototype,
- Transaction.Mixin,
- {
- getTransactionWrappers: function() {
+assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
- }
-);
+});
var transaction = new ReactDefaultBatchingStrategyTransaction();
@@ -9187,23 +8444,22 @@
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
- batchedUpdates: function(callback, a, b, c, d) {
+ batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
- callback(a, b, c, d);
+ callback(a, b, c, d, e);
} else {
- transaction.perform(callback, null, a, b, c, d);
+ transaction.perform(callback, null, a, b, c, d, e);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
-
-},{"103":103,"114":114,"27":27,"87":87}],54:[function(_dereq_,module,exports){
+},{"100":100,"136":136,"23":23,"83":83}],49:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9222,58 +8478,35 @@
var ClientReactRootIndex = _dereq_(8);
var DefaultEventPluginOrder = _dereq_(13);
var EnterLeaveEventPlugin = _dereq_(14);
-var ExecutionEnvironment = _dereq_(21);
-var HTMLDOMPropertyConfig = _dereq_(23);
-var MobileSafariClickEventPlugin = _dereq_(26);
-var ReactBrowserComponentMixin = _dereq_(29);
-var ReactClass = _dereq_(33);
-var ReactComponentBrowserEnvironment =
- _dereq_(35);
-var ReactDefaultBatchingStrategy = _dereq_(53);
-var ReactDOMComponent = _dereq_(42);
-var ReactDOMButton = _dereq_(41);
-var ReactDOMForm = _dereq_(43);
-var ReactDOMImg = _dereq_(46);
-var ReactDOMIDOperations = _dereq_(44);
-var ReactDOMIframe = _dereq_(45);
-var ReactDOMInput = _dereq_(47);
-var ReactDOMOption = _dereq_(48);
-var ReactDOMSelect = _dereq_(49);
-var ReactDOMTextarea = _dereq_(52);
-var ReactDOMTextComponent = _dereq_(51);
-var ReactElement = _dereq_(57);
-var ReactEventListener = _dereq_(62);
-var ReactInjection = _dereq_(64);
-var ReactInstanceHandles = _dereq_(66);
-var ReactMount = _dereq_(70);
-var ReactReconcileTransaction = _dereq_(80);
-var SelectEventPlugin = _dereq_(89);
-var ServerReactRootIndex = _dereq_(90);
-var SimpleEventPlugin = _dereq_(91);
-var SVGDOMPropertyConfig = _dereq_(88);
-
-var createFullPageComponent = _dereq_(111);
-
-function autoGenerateWrapperClass(type) {
- return ReactClass.createClass({
- tagName: type.toUpperCase(),
- render: function() {
- return new ReactElement(
- type,
- null,
- null,
- null,
- null,
- this.props
- );
- }
- });
-}
+var ExecutionEnvironment = _dereq_(130);
+var HTMLDOMPropertyConfig = _dereq_(21);
+var ReactBrowserComponentMixin = _dereq_(25);
+var ReactComponentBrowserEnvironment = _dereq_(31);
+var ReactDefaultBatchingStrategy = _dereq_(48);
+var ReactDOMComponent = _dereq_(37);
+var ReactDOMTextComponent = _dereq_(46);
+var ReactEventListener = _dereq_(58);
+var ReactInjection = _dereq_(59);
+var ReactInstanceHandles = _dereq_(61);
+var ReactMount = _dereq_(65);
+var ReactReconcileTransaction = _dereq_(75);
+var SelectEventPlugin = _dereq_(86);
+var ServerReactRootIndex = _dereq_(87);
+var SimpleEventPlugin = _dereq_(88);
+var SVGDOMPropertyConfig = _dereq_(85);
+
+var alreadyInjected = false;
function inject() {
- ReactInjection.EventEmitter.injectReactEventListener(
- ReactEventListener
- );
+ if (alreadyInjected) {
+ // TODO: This is currently true because these injections are shared between
+ // the client and the server package. They should be built independently
+ // and not share any injection state. Then this problem will be solved.
+ return;
+ }
+ alreadyInjected = true;
+
+ ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
@@ -9290,67 +8523,32 @@
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
- MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
- ReactInjection.NativeComponent.injectGenericComponentClass(
- ReactDOMComponent
- );
-
- ReactInjection.NativeComponent.injectTextComponentClass(
- ReactDOMTextComponent
- );
+ ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
- ReactInjection.NativeComponent.injectAutoWrapper(
- autoGenerateWrapperClass
- );
+ ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
- // This needs to happen before createFullPageComponent() otherwise the mixin
- // won't be included.
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
- ReactInjection.NativeComponent.injectComponentClasses({
- 'button': ReactDOMButton,
- 'form': ReactDOMForm,
- 'iframe': ReactDOMIframe,
- 'img': ReactDOMImg,
- 'input': ReactDOMInput,
- 'option': ReactDOMOption,
- 'select': ReactDOMSelect,
- 'textarea': ReactDOMTextarea,
-
- 'html': createFullPageComponent('html'),
- 'head': createFullPageComponent('head'),
- 'body': createFullPageComponent('body')
- });
-
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
- ReactInjection.Updates.injectReconcileTransaction(
- ReactReconcileTransaction
- );
- ReactInjection.Updates.injectBatchingStrategy(
- ReactDefaultBatchingStrategy
- );
+ ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
+ ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
- ReactInjection.RootIndex.injectCreateReactRootIndex(
- ExecutionEnvironment.canUseDOM ?
- ClientReactRootIndex.createReactRootIndex :
- ServerReactRootIndex.createReactRootIndex
- );
+ ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
- ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
- if ("production" !== "development") {
- var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
- if ((/[?&]react_perf\b/).test(url)) {
- var ReactDefaultPerf = _dereq_(55);
+ if ("development" !== 'production') {
+ var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
+ if (/[?&]react_perf\b/.test(url)) {
+ var ReactDefaultPerf = _dereq_(50);
ReactDefaultPerf.start();
}
}
@@ -9359,8 +8557,7 @@
module.exports = {
inject: inject
};
-
-},{"111":111,"13":13,"14":14,"21":21,"23":23,"26":26,"29":29,"3":3,"33":33,"35":35,"41":41,"42":42,"43":43,"44":44,"45":45,"46":46,"47":47,"48":48,"49":49,"51":51,"52":52,"53":53,"55":55,"57":57,"62":62,"64":64,"66":66,"7":7,"70":70,"8":8,"80":80,"88":88,"89":89,"90":90,"91":91}],55:[function(_dereq_,module,exports){
+},{"13":13,"130":130,"14":14,"21":21,"25":25,"3":3,"31":31,"37":37,"46":46,"48":48,"50":50,"58":58,"59":59,"61":61,"65":65,"7":7,"75":75,"8":8,"85":85,"86":86,"87":87,"88":88}],50:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9376,11 +8573,11 @@
'use strict';
var DOMProperty = _dereq_(10);
-var ReactDefaultPerfAnalysis = _dereq_(56);
-var ReactMount = _dereq_(70);
-var ReactPerf = _dereq_(75);
+var ReactDefaultPerfAnalysis = _dereq_(51);
+var ReactMount = _dereq_(65);
+var ReactPerf = _dereq_(71);
-var performanceNow = _dereq_(146);
+var performanceNow = _dereq_(152);
function roundFloat(val) {
return Math.floor(val * 100) / 100;
@@ -9395,7 +8592,7 @@
_mountStack: [0],
_injected: false,
- start: function() {
+ start: function () {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
@@ -9404,18 +8601,18 @@
ReactPerf.enableMeasure = true;
},
- stop: function() {
+ stop: function () {
ReactPerf.enableMeasure = false;
},
- getLastMeasurements: function() {
+ getLastMeasurements: function () {
return ReactDefaultPerf._allMeasurements;
},
- printExclusive: function(measurements) {
+ printExclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
@@ -9430,28 +8627,22 @@
// number.
},
- printInclusive: function(measurements) {
+ printInclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- getMeasurementsSummaryMap: function(measurements) {
- var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
- measurements,
- true
- );
- return summary.map(function(item) {
+ getMeasurementsSummaryMap: function (measurements) {
+ var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
+ return summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
@@ -9460,37 +8651,28 @@
});
},
- printWasted: function(measurements) {
+ printWasted: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- printDOM: function(measurements) {
+ printDOM: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
- result['type'] = item.type;
- result['args'] = JSON.stringify(item.args);
+ result.type = item.type;
+ result.args = JSON.stringify(item.args);
return result;
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- _recordWrite: function(id, fnName, totalTime, args) {
+ _recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
- var writes =
- ReactDefaultPerf
- ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
- .writes;
+ var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
@@ -9499,14 +8681,17 @@
});
},
- measure: function(moduleName, fnName, func) {
- return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ measure: function (moduleName, fnName, func) {
+ return function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
var totalTime;
var rv;
var start;
- if (fnName === '_renderNewRootComponent' ||
- fnName === 'flushBatchedUpdates') {
+ if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
@@ -9518,16 +8703,14 @@
counts: {},
writes: {},
displayNames: {},
- totalTime: 0
+ totalTime: 0,
+ created: {}
});
start = performanceNow();
rv = func.apply(this, args);
- ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ].totalTime = performanceNow() - start;
+ ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
return rv;
- } else if (fnName === '_mountImageIntoNode' ||
- moduleName === 'ReactDOMIDOperations') {
+ } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
@@ -9537,7 +8720,7 @@
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
- args[0].forEach(function(update) {
+ args[0].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
@@ -9551,46 +8734,35 @@
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
- ReactDefaultPerf._recordWrite(
- update.parentID,
- update.type,
- totalTime,
- writeArgs
- );
+ ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
});
} else {
// basic format
- ReactDefaultPerf._recordWrite(
- args[0],
- fnName,
- totalTime,
- Array.prototype.slice.call(args, 1)
- );
+ var id = args[0];
+ if (typeof id === 'object') {
+ id = ReactMount.getID(args[0]);
+ }
+ ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
return rv;
- } else if (moduleName === 'ReactCompositeComponent' && (
- (// TODO: receiveComponent()?
- (fnName === 'mountComponent' ||
- fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
+ } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
+ fnName === '_renderValidatedComponent')) {
- if (typeof this._currentElement.type === 'string') {
+ if (this._currentElement.type === ReactMount.TopLevelWrapper) {
return func.apply(this, args);
}
- var rootNodeID = fnName === 'mountComponent' ?
- args[0] :
- this._rootNodeID;
+ var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
- var entry = ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ];
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
+ entry.created[rootNodeID] = true;
mountStack.push(0);
}
@@ -9611,9 +8783,7 @@
entry.displayNames[rootNodeID] = {
current: this.getName(),
- owner: this._currentElement._owner ?
- this._currentElement._owner.getName() :
- '<root>'
+ owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
};
return rv;
@@ -9625,8 +8795,7 @@
};
module.exports = ReactDefaultPerf;
-
-},{"10":10,"146":146,"56":56,"70":70,"75":75}],56:[function(_dereq_,module,exports){
+},{"10":10,"152":152,"51":51,"65":65,"71":71}],51:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9638,7 +8807,9 @@
* @providesModule ReactDefaultPerfAnalysis
*/
-var assign = _dereq_(27);
+'use strict';
+
+var assign = _dereq_(23);
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
@@ -9647,12 +8818,14 @@
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
+ SET_MARKUP: 'set innerHTML',
TEXT_CONTENT: 'set textContent',
- 'updatePropertyByID': 'update attribute',
- 'deletePropertyByID': 'delete attribute',
- 'updateStylesByID': 'update styles',
- 'updateInnerHTMLByID': 'set innerHTML',
- 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
+ 'setValueForProperty': 'update attribute',
+ 'setValueForAttribute': 'update attribute',
+ 'deleteValueForProperty': 'remove attribute',
+ 'setValueForStyles': 'update styles',
+ 'replaceNodeWithMarkup': 'replace',
+ 'updateTextContent': 'set textContent'
};
function getTotalTime(measurements) {
@@ -9670,20 +8843,17 @@
function getDOMSummary(measurements) {
var items = [];
- for (var i = 0; i < measurements.length; i++) {
- var measurement = measurements[i];
- var id;
-
- for (id in measurement.writes) {
- measurement.writes[id].forEach(function(write) {
+ measurements.forEach(function (measurement) {
+ Object.keys(measurement.writes).forEach(function (id) {
+ measurement.writes[id].forEach(function (write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
- }
- }
+ });
+ });
return items;
}
@@ -9693,11 +8863,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
@@ -9732,7 +8898,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.exclusive - a.exclusive;
});
@@ -9745,11 +8911,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
@@ -9791,7 +8953,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.time - a.time;
});
@@ -9816,6 +8978,10 @@
break;
}
}
+ // check if component newly created
+ if (measurement.created[id]) {
+ isDirty = true;
+ }
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
@@ -9831,8 +8997,7 @@
};
module.exports = ReactDefaultPerfAnalysis;
-
-},{"27":27}],57:[function(_dereq_,module,exports){
+},{"23":23}],52:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -9846,142 +9011,101 @@
'use strict';
-var ReactContext = _dereq_(38);
-var ReactCurrentOwner = _dereq_(39);
+var ReactCurrentOwner = _dereq_(34);
+
+var assign = _dereq_(23);
+var canDefineProperty = _dereq_(104);
-var assign = _dereq_(27);
-var warning = _dereq_(154);
+// The Symbol used to tag the ReactElement type. If there is no native Symbol
+// nor polyfill, then a plain number is used for performance.
+var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
- ref: true
+ ref: true,
+ __self: true,
+ __source: true
};
/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} object
- * @param {string} key
- */
-function defineWarningProperty(object, key) {
- Object.defineProperty(object, key, {
-
- configurable: false,
- enumerable: true,
-
- get: function() {
- if (!this._store) {
- return null;
- }
- return this._store[key];
- },
-
- set: function(value) {
- ("production" !== "development" ? warning(
- false,
- 'Don\'t set the %s property of the React element. Instead, ' +
- 'specify the correct value when initially creating the element.',
- key
- ) : null);
- this._store[key] = value;
- }
-
- });
-}
-
-/**
- * This is updated to true if the membrane is successfully created.
- */
-var useMutationMembrane = false;
-
-/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} element
- */
-function defineMutationMembrane(prototype) {
- try {
- var pseudoFrozenProperties = {
- props: true
- };
- for (var key in pseudoFrozenProperties) {
- defineWarningProperty(prototype, key);
- }
- useMutationMembrane = true;
- } catch (x) {
- // IE will fail on defineProperty
- }
-}
-
-/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
- * @param {string|object} ref
* @param {*} key
+ * @param {string|object} ref
+ * @param {*} self A *temporary* helper to detect places where `this` is
+ * different from the `owner` when React.createElement is called, so that we
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
+ * functions, and as long as `this` and owner are the same, there will be no
+ * change in behavior.
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
+ * indicating filename, line number, and/or other information.
+ * @param {*} owner
* @param {*} props
* @internal
*/
-var ReactElement = function(type, key, ref, owner, context, props) {
+var ReactElement = function (type, key, ref, self, source, owner, props) {
+ var element = {
+ // This tag allow us to uniquely identify this as a React Element
+ $$typeof: REACT_ELEMENT_TYPE,
+
// Built-in properties that belong on the element
- this.type = type;
- this.key = key;
- this.ref = ref;
+ type: type,
+ key: key,
+ ref: ref,
+ props: props,
// Record the component responsible for creating this element.
- this._owner = owner;
-
- // TODO: Deprecate withContext, and then the context becomes accessible
- // through the owner.
- this._context = context;
+ _owner: owner
+ };
- if ("production" !== "development") {
- // The validation flag and props are currently mutative. We put them on
+ if ("development" !== 'production') {
+ // The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
- this._store = {props: props, originalProps: assign({}, props)};
+ element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
- try {
- Object.defineProperty(this._store, 'validated', {
+ if (canDefineProperty) {
+ Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
- writable: true
+ writable: true,
+ value: false
});
- } catch (x) {
- }
- this._store.validated = false;
-
- // We're not allowed to set props directly on the object so we early
- // return and rely on the prototype membrane to forward to the backing
- // store.
- if (useMutationMembrane) {
- Object.freeze(this);
- return;
+ // self and source are DEV only properties.
+ Object.defineProperty(element, '_self', {
+ configurable: false,
+ enumerable: false,
+ writable: false,
+ value: self
+ });
+ // Two elements created in two different places should be considered
+ // equal for testing purposes and therefore we hide it from enumeration.
+ Object.defineProperty(element, '_source', {
+ configurable: false,
+ enumerable: false,
+ writable: false,
+ value: source
+ });
+ } else {
+ element._store.validated = false;
+ element._self = self;
+ element._source = source;
}
+ Object.freeze(element.props);
+ Object.freeze(element);
}
- this.props = props;
-};
-
-// We intentionally don't expose the function on the constructor property.
-// ReactElement should be indistinguishable from a plain object.
-ReactElement.prototype = {
- _isReactElement: true
+ return element;
};
-if ("production" !== "development") {
- defineMutationMembrane(ReactElement.prototype);
-}
-
-ReactElement.createElement = function(type, config, children) {
+ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
@@ -9989,14 +9113,17 @@
var key = null;
var ref = null;
+ var self = null;
+ var source = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
+ self = config.__self === undefined ? null : config.__self;
+ source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -10025,20 +9152,13 @@
}
}
- return new ReactElement(
- type,
- key,
- ref,
- ReactCurrentOwner.current,
- ReactContext.current,
- props
- );
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
-ReactElement.createFactory = function(type) {
+ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
- // easily accessed on elements. E.g. <Foo />.type === Foo.type.
+ // easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
@@ -10046,17 +9166,16 @@
return factory;
};
-ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
- var newElement = new ReactElement(
- oldElement.type,
- oldElement.key,
- oldElement.ref,
- oldElement._owner,
- oldElement._context,
- newProps
- );
+ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
- if ("production" !== "development") {
+ return newElement;
+};
+
+ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
+ var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
+
+ if ("development" !== 'production') {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
@@ -10060,10 +9179,11 @@
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
+
return newElement;
};
-ReactElement.cloneElement = function(element, config, children) {
+ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
@@ -10072,6 +9192,12 @@
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
+ // Self is preserved since the owner is preserved.
+ var self = element._self;
+ // Source is preserved since cloneElement is unlikely to be targeted by a
+ // transpiler, and the original source is probably a better indicator of the
+ // true owner.
+ var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
@@ -10087,8 +9213,7 @@
}
// Remaining properties override existing props
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -10107,14 +9232,7 @@
props.children = childArray;
}
- return new ReactElement(
- element.type,
- key,
- ref,
- owner,
- element._context,
- props
- );
+ return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
@@ -10122,23 +9240,12 @@
* @return {boolean} True if `object` is a valid component.
* @final
*/
-ReactElement.isValidElement = function(object) {
- // ReactTestUtils is often used outside of beforeEach where as React is
- // within it. This leads to two different instances of React on the same
- // page. To identify a element from a different React instance we use
- // a flag instead of an instanceof check.
- var isElement = !!(object && object._isReactElement);
- // if (isElement && !(object instanceof ReactElement)) {
- // This is an indicator that you're using multiple versions of React at the
- // same time. This will screw with ownership and stuff. Fix it, please.
- // TODO: We could possibly warn here.
- // }
- return isElement;
+ReactElement.isValidElement = function (object) {
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;
-
-},{"154":154,"27":27,"38":38,"39":39}],58:[function(_dereq_,module,exports){
+},{"104":104,"23":23,"34":34}],53:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -10159,16 +9266,15 @@
'use strict';
-var ReactElement = _dereq_(57);
-var ReactFragment = _dereq_(63);
-var ReactPropTypeLocations = _dereq_(77);
-var ReactPropTypeLocationNames = _dereq_(76);
-var ReactCurrentOwner = _dereq_(39);
-var ReactNativeComponent = _dereq_(73);
-
-var getIteratorFn = _dereq_(126);
-var invariant = _dereq_(135);
-var warning = _dereq_(154);
+var ReactElement = _dereq_(52);
+var ReactPropTypeLocations = _dereq_(73);
+var ReactPropTypeLocationNames = _dereq_(72);
+var ReactCurrentOwner = _dereq_(34);
+
+var canDefineProperty = _dereq_(104);
+var getIteratorFn = _dereq_(115);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
@@ -10189,39 +9295,6 @@
var loggedTypeFailures = {};
-var NUMERIC_PROPERTY_REGEX = /^\d+$/;
-
-/**
- * Gets the instance's name for use in warnings.
- *
- * @internal
- * @return {?string} Display name or undefined
- */
-function getName(instance) {
- var publicInstance = instance && instance.getPublicInstance();
- if (!publicInstance) {
- return undefined;
- }
- var constructor = publicInstance.constructor;
- if (!constructor) {
- return undefined;
- }
- return constructor.displayName || constructor.name || undefined;
-}
-
-/**
- * Gets the current owner's displayName for use in warnings.
- *
- * @internal
- * @return {?string} Display name or undefined
- */
-function getCurrentOwnerDisplayName() {
- var current = ReactCurrentOwner.current;
- return (
- current && getName(current) || undefined
- );
-}
-
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
@@ -10233,84 +9306,59 @@
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
- if (element._store.validated || element.key != null) {
+ if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
- warnAndMonitorForKeyUse(
- 'Each child in an array or iterator should have a unique "key" prop.',
- element,
- parentType
- );
-}
-
-/**
- * Warn if the key is being defined as an object property but has an incorrect
- * value.
- *
- * @internal
- * @param {string} name Property name of the key.
- * @param {ReactElement} element Component that requires a key.
- * @param {*} parentType element's parent's type.
- */
-function validatePropertyKey(name, element, parentType) {
- if (!NUMERIC_PROPERTY_REGEX.test(name)) {
+ var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
+ if (addenda === null) {
+ // we already showed the warning
return;
}
- warnAndMonitorForKeyUse(
- 'Child objects should have non-numeric keys so ordering is preserved.',
- element,
- parentType
- );
+ "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
- * @param {string} message The base warning that gets output.
+ * @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
+ * @returns {?object} A set of addenda to use in the warning message, or null
+ * if the warning has already been shown before (and shouldn't be shown again).
*/
-function warnAndMonitorForKeyUse(message, element, parentType) {
- var ownerName = getCurrentOwnerDisplayName();
- var parentName = typeof parentType === 'string' ?
- parentType : parentType.displayName || parentType.name;
-
- var useName = ownerName || parentName;
- var memoizer = ownerHasKeyUseWarning[message] || (
- (ownerHasKeyUseWarning[message] = {})
- );
- if (memoizer.hasOwnProperty(useName)) {
- return;
+function getAddendaForKeyUse(messageType, element, parentType) {
+ var addendum = getDeclarationErrorAddendum();
+ if (!addendum) {
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
+ if (parentName) {
+ addendum = ' Check the top-level render call using <' + parentName + '>.';
+ }
}
- memoizer[useName] = true;
- var parentOrOwnerAddendum =
- ownerName ? (" Check the render method of " + ownerName + ".") :
- parentName ? (" Check the React.render call using <" + parentName + ">.") :
- '';
+ var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
+ if (memoizer[addendum]) {
+ return null;
+ }
+ memoizer[addendum] = true;
+
+ var addenda = {
+ parentOrOwner: addendum,
+ url: ' See https://fb.me/react-warning-keys for more information.',
+ childOwner: null
+ };
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
- var childOwnerAddendum = '';
- if (element &&
- element._owner &&
- element._owner !== ReactCurrentOwner.current) {
- // Name of the component that originally created this child.
- var childOwnerName = getName(element._owner);
-
- childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
- }
-
- ("production" !== "development" ? warning(
- false,
- message + '%s%s See https://fb.me/react-warning-keys for more information.',
- parentOrOwnerAddendum,
- childOwnerAddendum
- ) : null);
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
+ // Give the component that originally created this child.
+ addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
+ }
+
+ return addenda;
}
/**
@@ -10323,6 +9371,9 @@
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
+ if (typeof node !== 'object') {
+ return;
+ }
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
@@ -10332,7 +9383,9 @@
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
+ if (node._store) {
node._store.validated = true;
+ }
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
@@ -10346,13 +9399,6 @@
}
}
}
- } else if (typeof node === 'object') {
- var fragment = ReactFragment.extractIfFragment(node);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- validatePropertyKey(key, fragment[key], parentType);
- }
- }
}
}
}
@@ -10376,109 +9422,19 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== "development" ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
+ "development" !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
- var addendum = getDeclarationErrorAddendum(this);
- ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
- }
- }
- }
-}
-
-var warnedPropsMutations = {};
-
-/**
- * Warn about mutating props when setting `propName` on `element`.
- *
- * @param {string} propName The string key within props that was set
- * @param {ReactElement} element
- */
-function warnForPropsMutation(propName, element) {
- var type = element.type;
- var elementName = typeof type === 'string' ? type : type.displayName;
- var ownerName = element._owner ?
- element._owner.getPublicInstance().constructor.displayName : null;
-
- var warningKey = propName + '|' + elementName + '|' + ownerName;
- if (warnedPropsMutations.hasOwnProperty(warningKey)) {
- return;
- }
- warnedPropsMutations[warningKey] = true;
-
- var elementInfo = '';
- if (elementName) {
- elementInfo = ' <' + elementName + ' />';
- }
- var ownerInfo = '';
- if (ownerName) {
- ownerInfo = ' The element was created by ' + ownerName + '.';
- }
-
- ("production" !== "development" ? warning(
- false,
- 'Don\'t set .props.%s of the React component%s. Instead, specify the ' +
- 'correct value when initially creating the element or use ' +
- 'React.cloneElement to make a new element with updated props.%s',
- propName,
- elementInfo,
- ownerInfo
- ) : null);
-}
-
-// Inline Object.is polyfill
-function is(a, b) {
- if (a !== a) {
- // NaN
- return b !== b;
- }
- if (a === 0 && b === 0) {
- // +-0
- return 1 / a === 1 / b;
- }
- return a === b;
-}
-
-/**
- * Given an element, check if its props have been mutated since element
- * creation (or the last call to this function). In particular, check if any
- * new props have been added, which we can't directly catch by defining warning
- * properties on the props object.
- *
- * @param {ReactElement} element
- */
-function checkAndWarnForMutatedProps(element) {
- if (!element._store) {
- // Element was created using `new ReactElement` directly or with
- // `ReactElement.createElement`; skip mutation checking
- return;
- }
-
- var originalProps = element._store.originalProps;
- var props = element.props;
-
- for (var propName in props) {
- if (props.hasOwnProperty(propName)) {
- if (!originalProps.hasOwnProperty(propName) ||
- !is(originalProps[propName], props[propName])) {
- warnForPropsMutation(propName, element);
-
- // Copy over the new value so that the two props objects match again
- originalProps[propName] = props[propName];
+ var addendum = getDeclarationErrorAddendum();
+ "development" !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
}
}
}
@@ -10491,48 +9447,26 @@
* @param {ReactElement} element
*/
function validatePropTypes(element) {
- if (element.type == null) {
- // This has already warned. Don't throw.
+ var componentClass = element.type;
+ if (typeof componentClass !== 'function') {
return;
}
- // Extract the component class from the element. Converts string types
- // to a composite class which may have propTypes.
- // TODO: Validating a string's propTypes is not decoupled from the
- // rendering target which is problematic.
- var componentClass = ReactNativeComponent.getComponentClassForElement(
- element
- );
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
- checkPropTypes(
- name,
- componentClass.propTypes,
- element.props,
- ReactPropTypeLocations.prop
- );
+ checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
- ("production" !== "development" ? warning(
- componentClass.getDefaultProps.isReactClassApproved,
- 'getDefaultProps is only used on classic React.createClass ' +
- 'definitions. Use a static property named `defaultProps` instead.'
- ) : null);
+ "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
}
}
var ReactElementValidator = {
- checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
-
- createElement: function(type, props, children) {
+ createElement: function (type, props, children) {
+ var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
- ("production" !== "development" ? warning(
- type != null,
- 'React.createElement: type should not be null or undefined. It should ' +
- 'be a string (for DOM elements) or a ReactClass (for composite ' +
- 'components).'
- ) : null);
+ "development" !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
var element = ReactElement.createElement.apply(this, arguments);
@@ -10542,45 +9476,39 @@
return element;
}
+ // Skip key warning if the type isn't valid since our key validation logic
+ // doesn't expect a non-string/function type and can throw confusing errors.
+ // We don't want exception behavior to differ between dev and prod.
+ // (Rendering will throw with a helpful message and as soon as the type is
+ // fixed, the key warnings will appear.)
+ if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
+ }
validatePropTypes(element);
return element;
},
- createFactory: function(type) {
- var validatedFactory = ReactElementValidator.createElement.bind(
- null,
- type
- );
+ createFactory: function (type) {
+ var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
- if ("production" !== "development") {
- try {
- Object.defineProperty(
- validatedFactory,
- 'type',
- {
+ if ("development" !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
- get: function() {
- ("production" !== "development" ? warning(
- false,
- 'Factory.type is deprecated. Access the class directly ' +
- 'before passing it to createFactory.'
- ) : null);
+ get: function () {
+ "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
- }
- );
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
+ });
}
}
@@ -10584,11 +9512,10 @@
}
}
-
return validatedFactory;
},
- cloneElement: function(element, props, children) {
+ cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
@@ -10600,8 +9527,7 @@
};
module.exports = ReactElementValidator;
-
-},{"126":126,"135":135,"154":154,"39":39,"57":57,"63":63,"73":73,"76":76,"77":77}],59:[function(_dereq_,module,exports){
+},{"104":104,"115":115,"144":144,"155":155,"34":34,"52":52,"72":72,"73":73}],54:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -10615,52 +9541,73 @@
'use strict';
-var ReactElement = _dereq_(57);
-var ReactInstanceMap = _dereq_(67);
+var ReactElement = _dereq_(52);
+var ReactEmptyComponentRegistry = _dereq_(55);
+var ReactReconciler = _dereq_(76);
-var invariant = _dereq_(135);
+var assign = _dereq_(23);
-var component;
-// This registry keeps track of the React IDs of the components that rendered to
-// `null` (in reality a placeholder such as `noscript`)
-var nullComponentIDsRegistry = {};
+var placeholderElement;
var ReactEmptyComponentInjection = {
- injectEmptyComponent: function(emptyComponent) {
- component = ReactElement.createFactory(emptyComponent);
+ injectEmptyComponent: function (component) {
+ placeholderElement = ReactElement.createElement(component);
}
};
-var ReactEmptyComponentType = function() {};
-ReactEmptyComponentType.prototype.componentDidMount = function() {
- var internalInstance = ReactInstanceMap.get(this);
- // TODO: Make sure we run these methods in the correct order, we shouldn't
- // need this check. We're going to assume if we're here it means we ran
- // componentWillUnmount already so there is no internal instance (it gets
- // removed as part of the unmounting process).
- if (!internalInstance) {
- return;
- }
- registerNullComponentID(internalInstance._rootNodeID);
+function registerNullComponentID() {
+ ReactEmptyComponentRegistry.registerNullComponentID(this._rootNodeID);
+}
+
+var ReactEmptyComponent = function (instantiate) {
+ this._currentElement = null;
+ this._rootNodeID = null;
+ this._renderedComponent = instantiate(placeholderElement);
};
-ReactEmptyComponentType.prototype.componentWillUnmount = function() {
- var internalInstance = ReactInstanceMap.get(this);
- // TODO: Get rid of this check. See TODO in componentDidMount.
- if (!internalInstance) {
- return;
+assign(ReactEmptyComponent.prototype, {
+ construct: function (element) {},
+ mountComponent: function (rootID, transaction, context) {
+ transaction.getReactMountReady().enqueue(registerNullComponentID, this);
+ this._rootNodeID = rootID;
+ return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
+ },
+ receiveComponent: function () {},
+ unmountComponent: function (rootID, transaction, context) {
+ ReactReconciler.unmountComponent(this._renderedComponent);
+ ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
+ this._rootNodeID = null;
+ this._renderedComponent = null;
}
- deregisterNullComponentID(internalInstance._rootNodeID);
-};
-ReactEmptyComponentType.prototype.render = function() {
- ("production" !== "development" ? invariant(
- component,
- 'Trying to return null from a render, but no null placeholder component ' +
- 'was injected.'
- ) : invariant(component));
- return component();
-};
+});
+
+ReactEmptyComponent.injection = ReactEmptyComponentInjection;
+
+module.exports = ReactEmptyComponent;
+},{"23":23,"52":52,"55":55,"76":76}],55:[function(_dereq_,module,exports){
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactEmptyComponentRegistry
+ */
-var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
+'use strict';
+
+// This registry keeps track of the React IDs of the components that rendered to
+// `null` (in reality a placeholder such as `noscript`)
+var nullComponentIDsRegistry = {};
+
+/**
+ * @param {string} id Component's `_rootNodeID`.
+ * @return {boolean} True if the component is rendered to null.
+ */
+function isNullComponentID(id) {
+ return !!nullComponentIDsRegistry[id];
+}
/**
* Mark the component as having rendered to null.
@@ -10678,23 +9625,14 @@
delete nullComponentIDsRegistry[id];
}
-/**
- * @param {string} id Component's `_rootNodeID`.
- * @return {boolean} True if the component is rendered to null.
- */
-function isNullComponentID(id) {
- return !!nullComponentIDsRegistry[id];
-}
-
-var ReactEmptyComponent = {
- emptyElement: emptyElement,
- injection: ReactEmptyComponentInjection,
- isNullComponentID: isNullComponentID
+var ReactEmptyComponentRegistry = {
+ isNullComponentID: isNullComponentID,
+ registerNullComponentID: registerNullComponentID,
+ deregisterNullComponentID: deregisterNullComponentID
};
-module.exports = ReactEmptyComponent;
-
-},{"135":135,"57":57,"67":67}],60:[function(_dereq_,module,exports){
+module.exports = ReactEmptyComponentRegistry;
+},{}],56:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -10707,26 +9645,72 @@
* @typechecks
*/
-"use strict";
+'use strict';
+
+var caughtError = null;
+
+/**
+ * Call a function while guarding against errors that happens within it.
+ *
+ * @param {?String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} a First argument
+ * @param {*} b Second argument
+ */
+function invokeGuardedCallback(name, func, a, b) {
+ try {
+ return func(a, b);
+ } catch (x) {
+ if (caughtError === null) {
+ caughtError = x;
+ }
+ return undefined;
+ }
+}
var ReactErrorUtils = {
+ invokeGuardedCallback: invokeGuardedCallback,
+
/**
- * Creates a guarded version of a function. This is supposed to make debugging
- * of event handlers easier. To aid debugging with the browser's debugger,
- * this currently simply returns the original function.
- *
- * @param {function} func Function to be executed
- * @param {string} name The name of the guard
- * @return {function}
+ * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
+ * handler are sure to be rethrown by rethrowCaughtError.
*/
- guard: function(func, name) {
- return func;
+ invokeGuardedCallbackWithCatch: invokeGuardedCallback,
+
+ /**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+ rethrowCaughtError: function () {
+ if (caughtError) {
+ var error = caughtError;
+ caughtError = null;
+ throw error;
+ }
}
};
-module.exports = ReactErrorUtils;
+if ("development" !== 'production') {
+ /**
+ * To help development we can get better devtools integration by simulating a
+ * real browser event.
+ */
+ if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
+ var fakeNode = document.createElement('react');
+ ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
+ var boundFunc = func.bind(null, a, b);
+ var evtType = 'react-' + name;
+ fakeNode.addEventListener(evtType, boundFunc, false);
+ var evt = document.createEvent('Event');
+ evt.initEvent(evtType, false, false);
+ fakeNode.dispatchEvent(evt);
+ fakeNode.removeEventListener(evtType, boundFunc, false);
+ };
+ }
+}
-},{}],61:[function(_dereq_,module,exports){
+module.exports = ReactErrorUtils;
+},{}],57:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -10740,11 +9724,11 @@
'use strict';
-var EventPluginHub = _dereq_(17);
+var EventPluginHub = _dereq_(16);
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
@@ -10758,25 +9742,14 @@
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
- handleTopLevel: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- var events = EventPluginHub.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
-
+ handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
-
-},{"17":17}],62:[function(_dereq_,module,exports){
+},{"16":16}],58:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -10791,16 +9764,18 @@
'use strict';
-var EventListener = _dereq_(16);
-var ExecutionEnvironment = _dereq_(21);
-var PooledClass = _dereq_(28);
-var ReactInstanceHandles = _dereq_(66);
-var ReactMount = _dereq_(70);
-var ReactUpdates = _dereq_(87);
-
-var assign = _dereq_(27);
-var getEventTarget = _dereq_(125);
-var getUnboundedScrollPosition = _dereq_(131);
+var EventListener = _dereq_(129);
+var ExecutionEnvironment = _dereq_(130);
+var PooledClass = _dereq_(24);
+var ReactInstanceHandles = _dereq_(61);
+var ReactMount = _dereq_(65);
+var ReactUpdates = _dereq_(83);
+
+var assign = _dereq_(23);
+var getEventTarget = _dereq_(114);
+var getUnboundedScrollPosition = _dereq_(141);
+
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* Finds the parent React component of `node`.
@@ -10827,21 +9802,32 @@
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
- destructor: function() {
+ destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
-PooledClass.addPoolingTo(
- TopLevelCallbackBookKeeping,
- PooledClass.twoArgumentPooler
-);
+PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
- var topLevelTarget = ReactMount.getFirstReactDOM(
- getEventTarget(bookKeeping.nativeEvent)
- ) || window;
+ // TODO: Re-enable event.path handling
+ //
+ // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
+ // // New browsers have a path attribute on native events
+ // handleTopLevelWithPath(bookKeeping);
+ // } else {
+ // // Legacy browsers don't have a path attribute on native events
+ // handleTopLevelWithoutPath(bookKeeping);
+ // }
+
+ void handleTopLevelWithPath; // temporarily unused
+ handleTopLevelWithoutPath(bookKeeping);
+}
+
+// Legacy browsers don't have a path attribute on native events
+function handleTopLevelWithoutPath(bookKeeping) {
+ var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
@@ -10853,15 +9839,44 @@
ancestor = findParent(ancestor);
}
- for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
+ for (var i = 0; i < bookKeeping.ancestors.length; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
- ReactEventListener._handleTopLevel(
- bookKeeping.topLevelType,
- topLevelTarget,
- topLevelTargetID,
- bookKeeping.nativeEvent
- );
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
+ }
+}
+
+// New browsers have a path attribute on native events
+function handleTopLevelWithPath(bookKeeping) {
+ var path = bookKeeping.nativeEvent.path;
+ var currentNativeTarget = path[0];
+ var eventsFired = 0;
+ for (var i = 0; i < path.length; i++) {
+ var currentPathElement = path[i];
+ if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
+ currentNativeTarget = path[i + 1];
+ }
+ // TODO: slow
+ var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
+ if (reactParent === currentPathElement) {
+ var currentPathElementID = ReactMount.getID(currentPathElement);
+ var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
+ bookKeeping.ancestors.push(currentPathElement);
+
+ var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
+ eventsFired++;
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
+
+ // Jump to the root of this React render tree
+ while (currentPathElementID !== newRootID) {
+ i++;
+ currentPathElement = path[i];
+ currentPathElementID = ReactMount.getID(currentPathElement);
+ }
+ }
+ }
+ if (eventsFired === 0) {
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
@@ -10876,15 +9891,15 @@
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
- setHandleTopLevel: function(handleTopLevel) {
+ setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
- isEnabled: function() {
+ isEnabled: function () {
return ReactEventListener._enabled;
},
@@ -10888,27 +9903,22 @@
return ReactEventListener._enabled;
},
-
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.listen(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
@@ -10917,36 +9927,29 @@
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.capture(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
- monitorScrollValue: function(refresh) {
+ monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
- dispatchEvent: function(topLevelType, nativeEvent) {
+ dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
- var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
- topLevelType,
- nativeEvent
- );
+ var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
@@ -10958,191 +9961,7 @@
};
module.exports = ReactEventListener;
-
-},{"125":125,"131":131,"16":16,"21":21,"27":27,"28":28,"66":66,"70":70,"87":87}],63:[function(_dereq_,module,exports){
-/**
- * Copyright 2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
-* @providesModule ReactFragment
-*/
-
-'use strict';
-
-var ReactElement = _dereq_(57);
-
-var warning = _dereq_(154);
-
-/**
- * We used to allow keyed objects to serve as a collection of ReactElements,
- * or nested sets. This allowed us a way to explicitly key a set a fragment of
- * components. This is now being replaced with an opaque data structure.
- * The upgrade path is to call React.addons.createFragment({ key: value }) to
- * create a keyed fragment. The resulting data structure is opaque, for now.
- */
-
-if ("production" !== "development") {
- var fragmentKey = '_reactFragment';
- var didWarnKey = '_reactDidWarn';
- var canWarnForReactFragment = false;
-
- try {
- // Feature test. Don't even try to issue this warning if we can't use
- // enumerable: false.
-
- var dummy = function() {
- return 1;
- };
-
- Object.defineProperty(
- {},
- fragmentKey,
- {enumerable: false, value: true}
- );
-
- Object.defineProperty(
- {},
- 'key',
- {enumerable: true, get: dummy}
- );
-
- canWarnForReactFragment = true;
- } catch (x) { }
-
- var proxyPropertyAccessWithWarning = function(obj, key) {
- Object.defineProperty(obj, key, {
- enumerable: true,
- get: function() {
- ("production" !== "development" ? warning(
- this[didWarnKey],
- 'A ReactFragment is an opaque type. Accessing any of its ' +
- 'properties is deprecated. Pass it to one of the React.Children ' +
- 'helpers.'
- ) : null);
- this[didWarnKey] = true;
- return this[fragmentKey][key];
- },
- set: function(value) {
- ("production" !== "development" ? warning(
- this[didWarnKey],
- 'A ReactFragment is an immutable opaque type. Mutating its ' +
- 'properties is deprecated.'
- ) : null);
- this[didWarnKey] = true;
- this[fragmentKey][key] = value;
- }
- });
- };
-
- var issuedWarnings = {};
-
- var didWarnForFragment = function(fragment) {
- // We use the keys and the type of the value as a heuristic to dedupe the
- // warning to avoid spamming too much.
- var fragmentCacheKey = '';
- for (var key in fragment) {
- fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
- }
- var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
- issuedWarnings[fragmentCacheKey] = true;
- return alreadyWarnedOnce;
- };
-}
-
-var ReactFragment = {
- // Wrap a keyed object in an opaque proxy that warns you if you access any
- // of its properties.
- create: function(object) {
- if ("production" !== "development") {
- if (typeof object !== 'object' || !object || Array.isArray(object)) {
- ("production" !== "development" ? warning(
- false,
- 'React.addons.createFragment only accepts a single object.',
- object
- ) : null);
- return object;
- }
- if (ReactElement.isValidElement(object)) {
- ("production" !== "development" ? warning(
- false,
- 'React.addons.createFragment does not accept a ReactElement ' +
- 'without a wrapper object.'
- ) : null);
- return object;
- }
- if (canWarnForReactFragment) {
- var proxy = {};
- Object.defineProperty(proxy, fragmentKey, {
- enumerable: false,
- value: object
- });
- Object.defineProperty(proxy, didWarnKey, {
- writable: true,
- enumerable: false,
- value: false
- });
- for (var key in object) {
- proxyPropertyAccessWithWarning(proxy, key);
- }
- Object.preventExtensions(proxy);
- return proxy;
- }
- }
- return object;
- },
- // Extract the original keyed object from the fragment opaque type. Warn if
- // a plain object is passed here.
- extract: function(fragment) {
- if ("production" !== "development") {
- if (canWarnForReactFragment) {
- if (!fragment[fragmentKey]) {
- ("production" !== "development" ? warning(
- didWarnForFragment(fragment),
- 'Any use of a keyed object should be wrapped in ' +
- 'React.addons.createFragment(object) before being passed as a ' +
- 'child.'
- ) : null);
- return fragment;
- }
- return fragment[fragmentKey];
- }
- }
- return fragment;
- },
- // Check if this is a fragment and if so, extract the keyed object. If it
- // is a fragment-like object, warn that it should be wrapped. Ignore if we
- // can't determine what kind of object this is.
- extractIfFragment: function(fragment) {
- if ("production" !== "development") {
- if (canWarnForReactFragment) {
- // If it is the opaque type, return the keyed object.
- if (fragment[fragmentKey]) {
- return fragment[fragmentKey];
- }
- // Otherwise, check each property if it has an element, if it does
- // it is probably meant as a fragment, so we can warn early. Defer,
- // the warning to extract.
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key) &&
- ReactElement.isValidElement(fragment[key])) {
- // This looks like a fragment object, we should provide an
- // early warning.
- return ReactFragment.extract(fragment);
- }
- }
- }
- }
- return fragment;
- }
-};
-
-module.exports = ReactFragment;
-
-},{"154":154,"57":57}],64:[function(_dereq_,module,exports){
+},{"114":114,"129":129,"130":130,"141":141,"23":23,"24":24,"61":61,"65":65,"83":83}],59:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11157,21 +9976,19 @@
'use strict';
var DOMProperty = _dereq_(10);
-var EventPluginHub = _dereq_(17);
-var ReactComponentEnvironment = _dereq_(36);
-var ReactClass = _dereq_(33);
-var ReactEmptyComponent = _dereq_(59);
-var ReactBrowserEventEmitter = _dereq_(30);
-var ReactNativeComponent = _dereq_(73);
-var ReactDOMComponent = _dereq_(42);
-var ReactPerf = _dereq_(75);
-var ReactRootIndex = _dereq_(83);
-var ReactUpdates = _dereq_(87);
+var EventPluginHub = _dereq_(16);
+var ReactComponentEnvironment = _dereq_(32);
+var ReactClass = _dereq_(29);
+var ReactEmptyComponent = _dereq_(54);
+var ReactBrowserEventEmitter = _dereq_(26);
+var ReactNativeComponent = _dereq_(68);
+var ReactPerf = _dereq_(71);
+var ReactRootIndex = _dereq_(78);
+var ReactUpdates = _dereq_(83);
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
- DOMComponent: ReactDOMComponent.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
@@ -11183,8 +10000,7 @@
};
module.exports = ReactInjection;
-
-},{"10":10,"17":17,"30":30,"33":33,"36":36,"42":42,"59":59,"73":73,"75":75,"83":83,"87":87}],65:[function(_dereq_,module,exports){
+},{"10":10,"16":16,"26":26,"29":29,"32":32,"54":54,"68":68,"71":71,"78":78,"83":83}],60:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11198,11 +10014,11 @@
'use strict';
-var ReactDOMSelection = _dereq_(50);
+var ReactDOMSelection = _dereq_(44);
-var containsNode = _dereq_(109);
-var focusNode = _dereq_(119);
-var getActiveElement = _dereq_(121);
+var containsNode = _dereq_(133);
+var focusNode = _dereq_(138);
+var getActiveElement = _dereq_(139);
function isInDocument(node) {
return containsNode(document.documentElement, node);
@@ -11216,21 +10032,16 @@
*/
var ReactInputSelection = {
- hasSelectionCapabilities: function(elem) {
- return elem && (
- ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
- elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
- );
+ hasSelectionCapabilities: function (elem) {
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
- getSelectionInformation: function() {
+ getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
- selectionRange:
- ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
- ReactInputSelection.getSelection(focusedElem) :
- null
+ selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
@@ -11239,17 +10050,13 @@
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
- restoreSelection: function(priorSelectionInformation) {
+ restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
- if (curFocusedElem !== priorFocusedElem &&
- isInDocument(priorFocusedElem)) {
+ if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
- ReactInputSelection.setSelection(
- priorFocusedElem,
- priorSelectionRange
- );
+ ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
@@ -11261,7 +10068,7 @@
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
- getSelection: function(input) {
+ getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
@@ -11270,7 +10077,7 @@
start: input.selectionStart,
end: input.selectionEnd
};
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
@@ -11286,7 +10093,7 @@
selection = ReactDOMSelection.getOffsets(input);
}
- return selection || {start: 0, end: 0};
+ return selection || { start: 0, end: 0 };
},
/**
@@ -11295,7 +10102,7 @@
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
- setSelection: function(input, offsets) {
+ setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
@@ -11305,7 +10112,7 @@
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
@@ -11318,8 +10125,7 @@
};
module.exports = ReactInputSelection;
-
-},{"109":109,"119":119,"121":121,"50":50}],66:[function(_dereq_,module,exports){
+},{"133":133,"138":138,"139":139,"44":44}],61:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11334,9 +10140,9 @@
'use strict';
-var ReactRootIndex = _dereq_(83);
+var ReactRootIndex = _dereq_(78);
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
@@ -11344,7 +10150,7 @@
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
-var MAX_TREE_DEPTH = 100;
+var MAX_TREE_DEPTH = 10000;
/**
* Creates a DOM ID prefix to use when mounting React components.
@@ -11377,9 +10183,7 @@
* @private
*/
function isValidID(id) {
- return id === '' || (
- id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
- );
+ return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
}
/**
@@ -11391,10 +10195,7 @@
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
- return (
- descendantID.indexOf(ancestorID) === 0 &&
- isBoundary(descendantID, ancestorID.length)
- );
+ return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
}
/**
@@ -11418,19 +10219,8 @@
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
- ("production" !== "development" ? invariant(
- isValidID(ancestorID) && isValidID(destinationID),
- 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
- ancestorID,
- destinationID
- ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
- ("production" !== "development" ? invariant(
- isAncestorIDOf(ancestorID, destinationID),
- 'getNextDescendantID(...): React has made an invalid assumption about ' +
- 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
- ancestorID,
- destinationID
- ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
+ !(isValidID(ancestorID) && isValidID(destinationID)) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
+ !isAncestorIDOf(ancestorID, destinationID) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
if (ancestorID === destinationID) {
return ancestorID;
}
@@ -11472,13 +10262,7 @@
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
- ("production" !== "development" ? invariant(
- isValidID(longestCommonID),
- 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
- oneID,
- twoID,
- longestCommonID
- ) : invariant(isValidID(longestCommonID)));
+ !isValidID(longestCommonID) ? "development" !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
return longestCommonID;
}
@@ -11490,6 +10274,7 @@
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
+ * @param {*} arg Argument to invoke the callback with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
@@ -11497,23 +10282,13 @@
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
- ("production" !== "development" ? invariant(
- start !== stop,
- 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
- start
- ) : invariant(start !== stop));
+ !(start !== stop) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
var traverseUp = isAncestorIDOf(stop, start);
- ("production" !== "development" ? invariant(
- traverseUp || isAncestorIDOf(start, stop),
- 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
- 'not have a parent path.',
- start,
- stop
- ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
+ !(traverseUp || isAncestorIDOf(start, stop)) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
- for (var id = start; /* until break */; id = traverse(id, stop)) {
+ for (var id = start;; /* until break */id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
@@ -11522,12 +10297,7 @@
// Only break //after// visiting `stop`.
break;
}
- ("production" !== "development" ? invariant(
- depth++ < MAX_TREE_DEPTH,
- 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
- 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
- start, stop
- ) : invariant(depth++ < MAX_TREE_DEPTH));
+ !(depth++ < MAX_TREE_DEPTH) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
}
}
@@ -11544,7 +10314,7 @@
* Constructs a React root ID
* @return {string} A React root ID.
*/
- createReactRootID: function() {
+ createReactRootID: function () {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
@@ -11556,7 +10326,7 @@
* @return {string} A React ID.
* @internal
*/
- createReactID: function(rootID, name) {
+ createReactID: function (rootID, name) {
return rootID + name;
},
@@ -11568,7 +10338,7 @@
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
- getReactRootIDFromNodeID: function(id) {
+ getReactRootIDFromNodeID: function (id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
@@ -11590,7 +10360,7 @@
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
- traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
+ traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
@@ -11610,7 +10380,7 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseTwoPhase: function(targetID, cb, arg) {
+ traverseTwoPhase: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
@@ -11618,6 +10388,16 @@
},
/**
+ * Same as `traverseTwoPhase` but skips the `targetID`.
+ */
+ traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
+ if (targetID) {
+ traverseParentPath('', targetID, cb, arg, true, true);
+ traverseParentPath(targetID, '', cb, arg, true, true);
+ }
+ },
+
+ /**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
@@ -11629,15 +10409,11 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseAncestors: function(targetID, cb, arg) {
+ traverseAncestors: function (targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
- /**
- * Exposed for unit testing.
- * @private
- */
- _getFirstCommonAncestorID: getFirstCommonAncestorID,
+ getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
@@ -11652,8 +10428,7 @@
};
module.exports = ReactInstanceHandles;
-
-},{"135":135,"83":83}],67:[function(_dereq_,module,exports){
+},{"144":144,"78":78}],62:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11682,64 +10457,101 @@
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
- remove: function(key) {
+ remove: function (key) {
key._reactInternalInstance = undefined;
},
- get: function(key) {
+ get: function (key) {
return key._reactInternalInstance;
},
- has: function(key) {
+ has: function (key) {
return key._reactInternalInstance !== undefined;
},
- set: function(key, value) {
+ set: function (key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
-
-},{}],68:[function(_dereq_,module,exports){
+},{}],63:[function(_dereq_,module,exports){
/**
- * Copyright 2015, Facebook, Inc.
+ * Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactLifeCycle
+ * @providesModule ReactIsomorphic
*/
'use strict';
-/**
- * This module manages the bookkeeping when a component is in the process
- * of being mounted or being unmounted. This is used as a way to enforce
- * invariants (or warnings) when it is not recommended to call
- * setState/forceUpdate.
- *
- * currentlyMountingInstance: During the construction phase, it is not possible
- * to trigger an update since the instance is not fully mounted yet. However, we
- * currently allow this as a convenience for mutating the initial state.
- *
- * currentlyUnmountingInstance: During the unmounting phase, the instance is
- * still mounted and can therefore schedule an update. However, this is not
- * recommended and probably an error since it's about to be unmounted.
- * Therefore we still want to trigger in an error for that case.
- */
+var ReactChildren = _dereq_(28);
+var ReactComponent = _dereq_(30);
+var ReactClass = _dereq_(29);
+var ReactDOMFactories = _dereq_(38);
+var ReactElement = _dereq_(52);
+var ReactElementValidator = _dereq_(53);
+var ReactPropTypes = _dereq_(74);
+var ReactVersion = _dereq_(84);
-var ReactLifeCycle = {
- currentlyMountingInstance: null,
- currentlyUnmountingInstance: null
-};
+var assign = _dereq_(23);
+var onlyChild = _dereq_(121);
+
+var createElement = ReactElement.createElement;
+var createFactory = ReactElement.createFactory;
+var cloneElement = ReactElement.cloneElement;
+
+if ("development" !== 'production') {
+ createElement = ReactElementValidator.createElement;
+ createFactory = ReactElementValidator.createFactory;
+ cloneElement = ReactElementValidator.cloneElement;
+}
+
+var React = {
+
+ // Modern
+
+ Children: {
+ map: ReactChildren.map,
+ forEach: ReactChildren.forEach,
+ count: ReactChildren.count,
+ toArray: ReactChildren.toArray,
+ only: onlyChild
+ },
+
+ Component: ReactComponent,
+
+ createElement: createElement,
+ cloneElement: cloneElement,
+ isValidElement: ReactElement.isValidElement,
+
+ // Classic
+
+ PropTypes: ReactPropTypes,
+ createClass: ReactClass.createClass,
+ createFactory: createFactory,
+ createMixin: function (mixin) {
+ // Currently a noop. Will be used to validate and trace mixins.
+ return mixin;
+ },
-module.exports = ReactLifeCycle;
+ // This looks DOM specific but these are actually isomorphic helpers
+ // since they are just generating DOM strings.
+ DOM: ReactDOMFactories,
-},{}],69:[function(_dereq_,module,exports){
+ version: ReactVersion,
+
+ // Hook for JSX spread, don't use this for anything else.
+ __spread: assign
+};
+
+module.exports = React;
+},{"121":121,"23":23,"28":28,"29":29,"30":30,"38":38,"52":52,"53":53,"74":74,"84":84}],64:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11753,7 +10565,9 @@
'use strict';
-var adler32 = _dereq_(106);
+var adler32 = _dereq_(103);
+
+var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
@@ -11762,12 +10576,11 @@
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
- addChecksumToMarkup: function(markup) {
+ addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
- return markup.replace(
- '>',
- ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
- );
+
+ // Add checksum (handle both parent tags and self-closing tags)
+ return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
},
/**
@@ -11775,10 +10588,8 @@
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
- canReuseMarkup: function(markup, element) {
- var existingChecksum = element.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ canReuseMarkup: function (markup, element) {
+ var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
@@ -11786,8 +10597,7 @@
};
module.exports = ReactMarkupChecksum;
-
-},{"106":106}],70:[function(_dereq_,module,exports){
+},{"103":103}],65:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11802,35 +10612,37 @@
'use strict';
var DOMProperty = _dereq_(10);
-var ReactBrowserEventEmitter = _dereq_(30);
-var ReactCurrentOwner = _dereq_(39);
-var ReactElement = _dereq_(57);
-var ReactElementValidator = _dereq_(58);
-var ReactEmptyComponent = _dereq_(59);
-var ReactInstanceHandles = _dereq_(66);
-var ReactInstanceMap = _dereq_(67);
-var ReactMarkupChecksum = _dereq_(69);
-var ReactPerf = _dereq_(75);
-var ReactReconciler = _dereq_(81);
-var ReactUpdateQueue = _dereq_(86);
-var ReactUpdates = _dereq_(87);
-
-var emptyObject = _dereq_(115);
-var containsNode = _dereq_(109);
-var getReactRootElementInContainer = _dereq_(129);
-var instantiateReactComponent = _dereq_(134);
-var invariant = _dereq_(135);
-var setInnerHTML = _dereq_(148);
-var shouldUpdateReactComponent = _dereq_(151);
-var warning = _dereq_(154);
-
-var SEPARATOR = ReactInstanceHandles.SEPARATOR;
+var ReactBrowserEventEmitter = _dereq_(26);
+var ReactCurrentOwner = _dereq_(34);
+var ReactDOMFeatureFlags = _dereq_(39);
+var ReactElement = _dereq_(52);
+var ReactEmptyComponentRegistry = _dereq_(55);
+var ReactInstanceHandles = _dereq_(61);
+var ReactInstanceMap = _dereq_(62);
+var ReactMarkupChecksum = _dereq_(64);
+var ReactPerf = _dereq_(71);
+var ReactReconciler = _dereq_(76);
+var ReactUpdateQueue = _dereq_(82);
+var ReactUpdates = _dereq_(83);
+
+var assign = _dereq_(23);
+var emptyObject = _dereq_(137);
+var containsNode = _dereq_(133);
+var instantiateReactComponent = _dereq_(118);
+var invariant = _dereq_(144);
+var setInnerHTML = _dereq_(124);
+var shouldUpdateReactComponent = _dereq_(126);
+var validateDOMNesting = _dereq_(128);
+var warning = _dereq_(155);
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
+
+var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
@@ -11838,7 +10650,7 @@
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
-if ("production" !== "development") {
+if ("development" !== 'production') {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
@@ -11863,6 +10675,23 @@
}
/**
+ * @param {DOMElement|DOMDocument} container DOM element that may contain
+ * a React component
+ * @return {?*} DOM element that may have the reactRoot ID, or null.
+ */
+function getReactRootElementInContainer(container) {
+ if (!container) {
+ return null;
+ }
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ return container.documentElement;
+ } else {
+ return container.firstChild;
+ }
+}
+
+/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
@@ -11887,11 +10716,7 @@
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
- ("production" !== "development" ? invariant(
- !isValid(cached, id),
- 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
- ATTR_NAME, id
- ) : invariant(!isValid(cached, id)));
+ !!isValid(cached, id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
nodeCache[id] = node;
}
@@ -11948,7 +10773,7 @@
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
- if (ReactEmptyComponent.isNullComponentID(id)) {
+ if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
@@ -11969,11 +10794,7 @@
*/
function isValid(node, id) {
if (node) {
- ("production" !== "development" ? invariant(
- internalGetID(node) === id,
- 'ReactMount: Unexpected modification of `%s`',
- ATTR_NAME
- ) : invariant(internalGetID(node) === id));
+ !(internalGetID(node) === id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
@@ -12010,10 +10831,7 @@
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
- ReactInstanceHandles.traverseAncestors(
- targetID,
- findDeepestCachedAncestorImpl
- );
+ ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
@@ -12029,17 +10847,25 @@
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function mountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup) {
- var markup = ReactReconciler.mountComponent(
- componentInstance, rootID, transaction, emptyObject
- );
- componentInstance._isTopLevel = true;
- ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
+function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
+ if (ReactDOMFeatureFlags.useCreateElement) {
+ context = assign({}, context);
+ if (container.nodeType === DOC_NODE_TYPE) {
+ context[ownerDocumentContextKey] = container;
+ } else {
+ context[ownerDocumentContextKey] = container.ownerDocument;
+ }
+ }
+ if ("development" !== 'production') {
+ if (context === emptyObject) {
+ context = {};
+ }
+ var tag = container.nodeName.toLowerCase();
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
+ }
+ var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
+ componentInstance._renderedComponent._topLevelWrapper = componentInstance;
+ ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}
/**
@@ -12050,25 +10876,107 @@
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function batchedMountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- shouldReuseMarkup) {
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
- transaction.perform(
- mountComponentIntoNode,
- null,
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup
- );
+function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
+ /* forceHTML */shouldReuseMarkup);
+ transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
+ * Unmounts a component and removes it from the DOM.
+ *
+ * @param {ReactComponent} instance React component instance.
+ * @param {DOMElement} container DOM element to unmount from.
+ * @final
+ * @internal
+ * @see {ReactMount.unmountComponentAtNode}
+ */
+function unmountComponentFromNode(instance, container) {
+ ReactReconciler.unmountComponent(instance);
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ container = container.documentElement;
+ }
+
+ // http://jsperf.com/emptying-a-node
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+}
+
+/**
+ * True if the supplied DOM node has a direct React-rendered child that is
+ * not a React root element. Useful for warning in `render`,
+ * `unmountComponentAtNode`, etc.
+ *
+ * @param {?DOMElement} node The candidate DOM node.
+ * @return {boolean} True if the DOM element contains a direct child that was
+ * rendered by React but is not a root element.
+ * @internal
+ */
+function hasNonRootReactChild(node) {
+ var reactRootID = getReactRootID(node);
+ return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
+}
+
+/**
+ * Returns the first (deepest) ancestor of a node which is rendered by this copy
+ * of React.
+ */
+function findFirstReactDOMImpl(node) {
+ // This node might be from another React instance, so we make sure not to
+ // examine the node cache here
+ for (; node && node.parentNode !== node; node = node.parentNode) {
+ if (node.nodeType !== 1) {
+ // Not a DOMElement, therefore not a React component
+ continue;
+ }
+ var nodeID = internalGetID(node);
+ if (!nodeID) {
+ continue;
+ }
+ var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
+
+ // If containersByReactRootID contains the container we find by crawling up
+ // the tree, we know that this instance of React rendered the node.
+ // nb. isValid's strategy (with containsNode) does not work because render
+ // trees may be nested and we don't want a false positive in that case.
+ var current = node;
+ var lastID;
+ do {
+ lastID = internalGetID(current);
+ current = current.parentNode;
+ if (current == null) {
+ // The passed-in node has been detached from the container it was
+ // originally rendered into.
+ return null;
+ }
+ } while (lastID !== reactRootID);
+
+ if (current === containersByReactRootID[reactRootID]) {
+ return node;
+ }
+ }
+ return null;
+}
+
+/**
+ * Temporary (?) hack so that we can store all top-level pending updates on
+ * composites instead of having to worry about different types of components
+ * here.
+ */
+var TopLevelWrapper = function () {};
+TopLevelWrapper.prototype.isReactComponent = {};
+if ("development" !== 'production') {
+ TopLevelWrapper.displayName = 'TopLevelWrapper';
+}
+TopLevelWrapper.prototype.render = function () {
+ // this.props is actually a ReactElement
+ return this.props;
+};
+
+/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
@@ -12087,6 +10995,9 @@
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
+
+ TopLevelWrapper: TopLevelWrapper,
+
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
@@ -12098,7 +11009,7 @@
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
- scrollMonitor: function(container, renderCallback) {
+ scrollMonitor: function (container, renderCallback) {
renderCallback();
},
@@ -12109,26 +11020,17 @@
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
- _updateRootComponent: function(
- prevComponent,
- nextElement,
- container,
- callback) {
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
- }
-
- ReactMount.scrollMonitor(container, function() {
+ _updateRootComponent: function (prevComponent, nextElement, container, callback) {
+ ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[getReactRootID(container)] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
}
return prevComponent;
@@ -12141,15 +11043,8 @@
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
- _registerComponent: function(nextComponent, container) {
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- '_registerComponent(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ _registerComponent: function (nextComponent, container) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
@@ -12165,44 +11060,24 @@
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
- _renderNewRootComponent: function(
- nextElement,
- container,
- shouldReuseMarkup
- ) {
+ _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- '_renderNewRootComponent(): Render methods should be a pure function ' +
- 'of props and state; triggering nested component updates from ' +
- 'render is not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
var componentInstance = instantiateReactComponent(nextElement, null);
- var reactRootID = ReactMount._registerComponent(
- componentInstance,
- container
- );
+ var reactRootID = ReactMount._registerComponent(componentInstance, container);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
- ReactUpdates.batchedUpdates(
- batchedMountComponentIntoNode,
- componentInstance,
- reactRootID,
- container,
- shouldReuseMarkup
- );
+ ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[reactRootID] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
}
return componentInstance;
@@ -12215,76 +11090,64 @@
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
+ * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- render: function(nextElement, container, callback) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(nextElement),
- 'React.render(): Invalid component element.%s',
- (
- typeof nextElement === 'string' ?
- ' Instead of passing an element string, make sure to instantiate ' +
- 'it by passing it to React.createElement.' :
- typeof nextElement === 'function' ?
- ' Instead of passing a component class, make sure to instantiate ' +
- 'it by passing it to React.createElement.' :
+ renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !(parentComponent != null && parentComponent._reactInternalInstance != null) ? "development" !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
+ return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
+ },
+
+ _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !ReactElement.isValidElement(nextElement) ? "development" !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
// Check if it quacks like an element
- nextElement != null && nextElement.props !== undefined ?
- ' This may be caused by unintentionally loading two independent ' +
- 'copies of React.' :
- ''
- )
- ) : invariant(ReactElement.isValidElement(nextElement)));
+ nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
+
+ "development" !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
+
+ var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
- var prevElement = prevComponent._currentElement;
+ var prevWrappedElement = prevComponent._currentElement;
+ var prevElement = prevWrappedElement.props;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
- return ReactMount._updateRootComponent(
- prevComponent,
- nextElement,
- container,
- callback
- ).getPublicInstance();
+ var publicInst = prevComponent._renderedComponent.getPublicInstance();
+ var updatedCallback = callback && function () {
+ callback.call(publicInst);
+ };
+ ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
+ return publicInst;
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
- var containerHasReactMarkup =
- reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
+ var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
+ var containerHasNonRootReactChild = hasNonRootReactChild(container);
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
- if ("production" !== "development") {
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
- if (ReactMount.isRenderedByReact(rootElementSibling)) {
- ("production" !== "development" ? warning(
- false,
- 'render(): Target node has markup rendered by React, but there ' +
- 'are unrelated nodes as well. This is most commonly caused by ' +
- 'white-space inserted around server-rendered markup.'
- ) : null);
+ if (internalGetID(rootElementSibling)) {
+ "development" !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
break;
}
-
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
- var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
-
- var component = ReactMount._renderNewRootComponent(
- nextElement,
- container,
- shouldReuseMarkup
- ).getPublicInstance();
+ var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
+ var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
@@ -12292,36 +11155,19 @@
},
/**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into the supplied `container`.
+ * Renders a React component into the DOM in the supplied `container`.
*
- * @param {function} constructor React component constructor.
- * @param {?object} props Initial props of the component instance.
+ * If the React component was previously rendered into `container`, this will
+ * perform an update on it and only mutate the DOM as necessary to reflect the
+ * latest React component.
+ *
+ * @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
+ * @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- constructAndRenderComponent: function(constructor, props, container) {
- var element = ReactElement.createElement(constructor, props);
- return ReactMount.render(element, container);
- },
-
- /**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into a container node identified by supplied `id`.
- *
- * @param {function} componentConstructor React component constructor
- * @param {?object} props Initial props of the component instance.
- * @param {string} id ID of the DOM element to render into.
- * @return {ReactComponent} Component instance rendered in the container node.
- */
- constructAndRenderComponentByID: function(constructor, props, id) {
- var domNode = document.getElementById(id);
- ("production" !== "development" ? invariant(
- domNode,
- 'Tried to get element with id of "%s" but it is not present on the page.',
- id
- ) : invariant(domNode));
- return ReactMount.constructAndRenderComponent(constructor, props, domNode);
+ render: function (nextElement, container, callback) {
+ return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
@@ -12332,7 +11178,7 @@
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
- registerContainer: function(container) {
+ registerContainer: function (container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
@@ -12353,101 +11199,68 @@
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
- unmountComponentAtNode: function(container) {
+ unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- 'unmountComponentAtNode(): Render methods should be a pure function of ' +
- 'props and state; triggering nested component updates from render is ' +
- 'not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
-
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'unmountComponentAtNode(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
+
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
+ // Check if the node being unmounted was rendered by React, but isn't a
+ // root node.
+ var containerHasNonRootReactChild = hasNonRootReactChild(container);
+
+ // Check if the container itself is a React root node.
+ var containerID = internalGetID(container);
+ var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
+ }
+
return false;
}
- ReactMount.unmountComponentFromNode(component, container);
+ ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
- * Unmounts a component and removes it from the DOM.
- *
- * @param {ReactComponent} instance React component instance.
- * @param {DOMElement} container DOM element to unmount from.
- * @final
- * @internal
- * @see {ReactMount.unmountComponentAtNode}
- */
- unmountComponentFromNode: function(instance, container) {
- ReactReconciler.unmountComponent(instance);
-
- if (container.nodeType === DOC_NODE_TYPE) {
- container = container.documentElement;
- }
-
- // http://jsperf.com/emptying-a-node
- while (container.lastChild) {
- container.removeChild(container.lastChild);
- }
- },
-
- /**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
- findReactContainerForID: function(id) {
+ findReactContainerForID: function (id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
- ("production" !== "development" ? invariant(
+ "development" !== 'production' ? warning(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID,
- 'ReactMount: Root element ID differed from reactRootID.'
- ) : invariant(// Call internalGetID here because getID calls isValid which calls
- // findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID));
-
+ internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
var containerChild = container.firstChild;
- if (containerChild &&
- reactRootID === internalGetID(containerChild)) {
+ if (containerChild && reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
- ("production" !== "development" ? warning(
- false,
- 'ReactMount: Root element has been removed from its original ' +
- 'container. New container:', rootElement.parentNode
- ) : null);
+ "development" !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
}
}
}
@@ -12461,44 +11274,21 @@
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
- findReactNodeByID: function(id) {
+ findReactNodeByID: function (id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
- * True if the supplied `node` is rendered by React.
- *
- * @param {*} node DOM Element to check.
- * @return {boolean} True if the DOM Element appears to be rendered by React.
- * @internal
- */
- isRenderedByReact: function(node) {
- if (node.nodeType !== 1) {
- // Not a DOMElement, therefore not a React component
- return false;
- }
- var id = ReactMount.getID(node);
- return id ? id.charAt(0) === SEPARATOR : false;
- },
-
- /**
* Traverses up the ancestors of the supplied node to find a node that is a
- * DOM representation of a React component.
+ * DOM representation of a React component rendered by this copy of React.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
- getFirstReactDOM: function(node) {
- var current = node;
- while (current && current.parentNode !== current) {
- if (ReactMount.isRenderedByReact(current)) {
- return current;
- }
- current = current.parentNode;
- }
- return null;
+ getFirstReactDOM: function (node) {
+ return findFirstReactDOMImpl(node);
},
/**
@@ -12511,12 +11301,17 @@
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
- findComponentRoot: function(ancestorNode, targetID) {
+ findComponentRoot: function (ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
+ if ("development" !== 'production') {
+ // This will throw on the next line; give an early warning
+ "development" !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
+ }
+
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
@@ -12567,91 +11361,68 @@
firstChildren.length = 0;
- ("production" !== "development" ? invariant(
- false,
- 'findComponentRoot(..., %s): Unable to find element. This probably ' +
- 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
- 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
- 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
- 'parent. ' +
- 'Try inspecting the child nodes of the element with React ID `%s`.',
- targetID,
- ReactMount.getID(ancestorNode)
- ) : invariant(false));
- },
-
- _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'mountComponentIntoNode(...): Target container is not valid.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ !false ? "development" !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
+ },
+
+ _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
return;
} else {
- var checksum = rootElement.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
- rootElement.setAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
- checksum
- );
+ rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
+
+ var normalizedMarkup = markup;
+ if ("development" !== 'production') {
+ // because rootMarkup is retrieved from the DOM, various normalizations
+ // will have occurred which will not be present in `markup`. Here,
+ // insert markup into a <div> or <iframe> depending on the container
+ // type to perform the same normalizations before comparing.
+ var normalizer;
+ if (container.nodeType === ELEMENT_NODE_TYPE) {
+ normalizer = document.createElement('div');
+ normalizer.innerHTML = markup;
+ normalizedMarkup = normalizer.innerHTML;
+ } else {
+ normalizer = document.createElement('iframe');
+ document.body.appendChild(normalizer);
+ normalizer.contentDocument.write(markup);
+ normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
+ document.body.removeChild(normalizer);
+ }
+ }
- var diffIndex = firstDifferenceIndex(markup, rootMarkup);
- var difference = ' (client) ' +
- markup.substring(diffIndex - 20, diffIndex + 20) +
- '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
-
- ("production" !== "development" ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- 'You\'re trying to render a component to the document using ' +
- 'server rendering but the checksum was invalid. This usually ' +
- 'means you rendered a different component type or props on ' +
- 'the client from the one on the server, or your render() ' +
- 'methods are impure. React cannot handle this case due to ' +
- 'cross-browser quirks by rendering at the document root. You ' +
- 'should look for environment dependent code in your components ' +
- 'and ensure the props are the same client and server side:\n%s',
- difference
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- false,
- 'React attempted to reuse markup in a container but the ' +
- 'checksum was invalid. This generally means that you are ' +
- 'using server rendering and the markup generated on the ' +
- 'server was not what the client was expecting. React injected ' +
- 'new markup to compensate which works but you have lost many ' +
- 'of the benefits of server rendering. Instead, figure out ' +
- 'why the markup being generated is different on the client ' +
- 'or server:\n%s',
- difference
- ) : null);
+ var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
+ var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
+
+ !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
}
}
}
- ("production" !== "development" ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- 'You\'re trying to render a component to the document but ' +
- 'you didn\'t use server rendering. We can\'t do this ' +
- 'without using server rendering due to cross-browser quirks. ' +
- 'See React.renderToString() for server rendering.'
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
+ !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
+ if (transaction.useCreateElement) {
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+ container.appendChild(markup);
+ } else {
setInnerHTML(container, markup);
+ }
},
+ ownerDocumentContextKey: ownerDocumentContextKey,
+
/**
* React ID utilities.
*/
@@ -12666,6 +11437,8 @@
getNodeFromInstance: getNodeFromInstance,
+ isValid: isValid,
+
purgeID: purgeID
};
@@ -12675,8 +11448,7 @@
});
module.exports = ReactMount;
-
-},{"10":10,"109":109,"115":115,"129":129,"134":134,"135":135,"148":148,"151":151,"154":154,"30":30,"39":39,"57":57,"58":58,"59":59,"66":66,"67":67,"69":69,"75":75,"81":81,"86":86,"87":87}],71:[function(_dereq_,module,exports){
+},{"10":10,"118":118,"124":124,"126":126,"128":128,"133":133,"137":137,"144":144,"155":155,"23":23,"26":26,"34":34,"39":39,"52":52,"55":55,"61":61,"62":62,"64":64,"71":71,"76":76,"82":82,"83":83}],66:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12691,11 +11463,14 @@
'use strict';
-var ReactComponentEnvironment = _dereq_(36);
-var ReactMultiChildUpdateTypes = _dereq_(72);
+var ReactComponentEnvironment = _dereq_(32);
+var ReactMultiChildUpdateTypes = _dereq_(67);
-var ReactReconciler = _dereq_(81);
-var ReactChildReconciler = _dereq_(31);
+var ReactCurrentOwner = _dereq_(34);
+var ReactReconciler = _dereq_(76);
+var ReactChildReconciler = _dereq_(27);
+
+var flattenChildren = _dereq_(109);
/**
* Updating children of a component may trigger recursive updates. The depth is
@@ -12732,14 +11507,14 @@
* @param {number} toIndex Destination index.
* @private
*/
-function enqueueMarkup(parentID, markup, toIndex) {
+function enqueueInsertMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
- textContent: null,
+ content: null,
fromIndex: null,
toIndex: toIndex
});
@@ -12760,7 +11535,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: toIndex
});
@@ -12780,13 +11555,33 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
+ * Enqueues setting the markup of a node.
+ *
+ * @param {string} parentID ID of the parent component.
+ * @param {string} markup Markup that renders into an element.
+ * @private
+ */
+function enqueueSetMarkup(parentID, markup) {
+ // NOTE: Null values reduce hidden classes.
+ updateQueue.push({
+ parentID: parentID,
+ parentNode: null,
+ type: ReactMultiChildUpdateTypes.SET_MARKUP,
+ markupIndex: null,
+ content: markup,
+ fromIndex: null,
+ toIndex: null
+ });
+}
+
+/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
@@ -12800,7 +11595,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
- textContent: textContent,
+ content: textContent,
fromIndex: null,
toIndex: null
});
@@ -12813,10 +11608,7 @@
*/
function processQueue() {
if (updateQueue.length) {
- ReactComponentEnvironment.processChildrenUpdates(
- updateQueue,
- markupQueue
- );
+ ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
clearQueue();
}
}
@@ -12848,6 +11640,37 @@
*/
Mixin: {
+ _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
+ if ("development" !== 'production') {
+ if (this._currentElement) {
+ try {
+ ReactCurrentOwner.current = this._currentElement._owner;
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ }
+ }
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
+ },
+
+ _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
+ var nextChildren;
+ if ("development" !== 'production') {
+ if (this._currentElement) {
+ try {
+ ReactCurrentOwner.current = this._currentElement._owner;
+ nextChildren = flattenChildren(nextNestedChildrenElements);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ }
+ }
+ nextChildren = flattenChildren(nextNestedChildrenElements);
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ },
+
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
@@ -12856,10 +11679,8 @@
* @return {array} An array of mounted representations.
* @internal
*/
- mountChildren: function(nestedChildren, transaction, context) {
- var children = ReactChildReconciler.instantiateChildren(
- nestedChildren, transaction, context
- );
+ mountChildren: function (nestedChildren, transaction, context) {
+ var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
@@ -12868,15 +11689,9 @@
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
- child._mountIndex = index;
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
+ child._mountIndex = index++;
mountImages.push(mountImage);
- index++;
}
}
return mountImages;
@@ -12888,7 +11703,7 @@
* @param {string} nextContent String of content.
* @internal
*/
- updateTextContent: function(nextContent) {
+ updateTextContent: function (nextContent) {
updateDepth++;
var errorThrown = true;
try {
@@ -12898,7 +11713,7 @@
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
- this._unmountChildByName(prevChildren[name], name);
+ this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
@@ -12917,17 +11732,49 @@
},
/**
+ * Replaces any rendered children with a markup string.
+ *
+ * @param {string} nextMarkup String of markup.
+ * @internal
+ */
+ updateMarkup: function (nextMarkup) {
+ updateDepth++;
+ var errorThrown = true;
+ try {
+ var prevChildren = this._renderedChildren;
+ // Remove any rendered children.
+ ReactChildReconciler.unmountChildren(prevChildren);
+ for (var name in prevChildren) {
+ if (prevChildren.hasOwnProperty(name)) {
+ this._unmountChildByName(prevChildren[name], name);
+ }
+ }
+ this.setMarkup(nextMarkup);
+ errorThrown = false;
+ } finally {
+ updateDepth--;
+ if (!updateDepth) {
+ if (errorThrown) {
+ clearQueue();
+ } else {
+ processQueue();
+ }
+ }
+ }
+ },
+
+ /**
* Updates the rendered children with new children.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- updateChildren: function(nextNestedChildren, transaction, context) {
+ updateChildren: function (nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
- this._updateChildren(nextNestedChildren, transaction, context);
+ this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
@@ -12946,16 +11792,14 @@
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
- _updateChildren: function(nextNestedChildren, transaction, context) {
+ _updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
- var nextChildren = ReactChildReconciler.updateChildren(
- prevChildren, nextNestedChildren, transaction, context
- );
+ var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
@@ -12979,20 +11823,17 @@
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
- this._unmountChildByName(prevChild, name);
+ this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
- this._mountChildByNameAtIndex(
- nextChild, name, nextIndex, transaction, context
- );
+ this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
- this._unmountChildByName(prevChildren[name], name);
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ this._unmountChild(prevChildren[name]);
}
}
},
@@ -13003,7 +11844,7 @@
*
* @internal
*/
- unmountChildren: function() {
+ unmountChildren: function () {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
@@ -13017,7 +11858,7 @@
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
- moveChild: function(child, toIndex, lastIndex) {
+ moveChild: function (child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
@@ -13033,8 +11874,8 @@
* @param {string} mountImage Markup to insert.
* @protected
*/
- createChild: function(child, mountImage) {
- enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
+ createChild: function (child, mountImage) {
+ enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
@@ -13043,7 +11884,7 @@
* @param {ReactComponent} child Child to remove.
* @protected
*/
- removeChild: function(child) {
+ removeChild: function (child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
@@ -13053,11 +11894,21 @@
* @param {string} textContent Text content to set.
* @protected
*/
- setTextContent: function(textContent) {
+ setTextContent: function (textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
+ * Sets this markup string.
+ *
+ * @param {string} markup Markup to set.
+ * @protected
+ */
+ setMarkup: function (markup) {
+ enqueueSetMarkup(this._rootNodeID, markup);
+ },
+
+ /**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
@@ -13068,34 +11919,23 @@
* @param {ReactReconcileTransaction} transaction
* @private
*/
- _mountChildByNameAtIndex: function(
- child,
- name,
- index,
- transaction,
- context) {
+ _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
- * Unmounts a rendered child by name.
+ * Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
- * @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
- _unmountChildByName: function(child, name) {
+ _unmountChild: function (child) {
this.removeChild(child);
child._mountIndex = null;
}
@@ -13105,8 +11945,7 @@
};
module.exports = ReactMultiChild;
-
-},{"31":31,"36":36,"72":72,"81":81}],72:[function(_dereq_,module,exports){
+},{"109":109,"27":27,"32":32,"34":34,"67":67,"76":76}],67:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13120,7 +11959,7 @@
'use strict';
-var keyMirror = _dereq_(140);
+var keyMirror = _dereq_(147);
/**
* When a component's children are updated, a series of update configuration
@@ -13134,12 +11973,12 @@
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
+ SET_MARKUP: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
-
-},{"140":140}],73:[function(_dereq_,module,exports){
+},{"147":147}],68:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -13153,35 +11992,30 @@
'use strict';
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
+var assign = _dereq_(23);
+var invariant = _dereq_(144);
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
-// This registry keeps track of wrapper classes around native tags
+// This registry keeps track of wrapper classes around native tags.
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
- injectGenericComponentClass: function(componentClass) {
+ injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
- injectTextComponentClass: function(componentClass) {
+ injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
- injectComponentClasses: function(componentClasses) {
+ injectComponentClasses: function (componentClasses) {
assign(tagToComponentClass, componentClasses);
- },
- // Temporary hack since we expect DOM refs to behave like composites,
- // for this release.
- injectAutoWrapper: function(wrapperFactory) {
- autoGenerateWrapperClass = wrapperFactory;
}
};
@@ -13210,11 +12044,7 @@
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
- ("production" !== "development" ? invariant(
- genericComponentClass,
- 'There is no registered component for the tag %s',
- element.type
- ) : invariant(genericComponentClass));
+ !genericComponentClass ? "development" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
return new genericComponentClass(element.type, element.props);
}
@@ -13243,8 +12073,126 @@
};
module.exports = ReactNativeComponent;
+},{"144":144,"23":23}],69:[function(_dereq_,module,exports){
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactNoopUpdateQueue
+ */
+
+'use strict';
+
+var warning = _dereq_(155);
+
+function warnTDZ(publicInstance, callerName) {
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
+ }
+}
-},{"135":135,"27":27}],74:[function(_dereq_,module,exports){
+/**
+ * This is the abstract API for an update queue.
+ */
+var ReactNoopUpdateQueue = {
+
+ /**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ return false;
+ },
+
+ /**
+ * Enqueue a callback that will be executed after all the pending updates
+ * have processed.
+ *
+ * @param {ReactClass} publicInstance The instance to use as `this` context.
+ * @param {?function} callback Called after state is updated.
+ * @internal
+ */
+ enqueueCallback: function (publicInstance, callback) {},
+
+ /**
+ * Forces an update. This should only be invoked when it is known with
+ * certainty that we are **not** in a DOM transaction.
+ *
+ * You may want to call this when you know that some deeper aspect of the
+ * component's state has changed but `setState` was not called.
+ *
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
+ * `componentWillUpdate` and `componentDidUpdate`.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @internal
+ */
+ enqueueForceUpdate: function (publicInstance) {
+ warnTDZ(publicInstance, 'forceUpdate');
+ },
+
+ /**
+ * Replaces all of the state. Always use this or `setState` to mutate state.
+ * You should treat `this.state` as immutable.
+ *
+ * There is no guarantee that `this.state` will be immediately updated, so
+ * accessing `this.state` after calling this method may return the old value.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} completeState Next state.
+ * @internal
+ */
+ enqueueReplaceState: function (publicInstance, completeState) {
+ warnTDZ(publicInstance, 'replaceState');
+ },
+
+ /**
+ * Sets a subset of the state. This only exists because _pendingState is
+ * internal. This provides a merging strategy that is not available to deep
+ * properties which is confusing. TODO: Expose pendingState or don't use it
+ * during the merge.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialState Next partial state to be merged with state.
+ * @internal
+ */
+ enqueueSetState: function (publicInstance, partialState) {
+ warnTDZ(publicInstance, 'setState');
+ },
+
+ /**
+ * Sets a subset of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialProps Subset of the next props.
+ * @internal
+ */
+ enqueueSetProps: function (publicInstance, partialProps) {
+ warnTDZ(publicInstance, 'setProps');
+ },
+
+ /**
+ * Replaces all of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} props New props.
+ * @internal
+ */
+ enqueueReplaceProps: function (publicInstance, props) {
+ warnTDZ(publicInstance, 'replaceProps');
+ }
+
+};
+
+module.exports = ReactNoopUpdateQueue;
+},{"155":155}],70:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13258,7 +12206,7 @@
'use strict';
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
/**
* ReactOwners are capable of storing references to owned components.
@@ -13297,11 +12245,8 @@
* @return {boolean} True if `object` is a valid owner.
* @final
*/
- isValidOwner: function(object) {
- return !!(
- (object &&
- typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
- );
+ isValidOwner: function (object) {
+ return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
@@ -13313,15 +12258,8 @@
* @final
* @internal
*/
- addComponentAsRefTo: function(component, ref, owner) {
- ("production" !== "development" ? invariant(
- ReactOwner.isValidOwner(owner),
- 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
- 'usually means that you\'re trying to add a ref to a component that ' +
- 'doesn\'t have an owner (that is, was not created inside of another ' +
- 'component\'s `render` method). Try rendering this component inside of ' +
- 'a new top-level component which will hold the ref.'
- ) : invariant(ReactOwner.isValidOwner(owner)));
+ addComponentAsRefTo: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);
},
@@ -13334,15 +12272,8 @@
* @final
* @internal
*/
- removeComponentAsRefFrom: function(component, ref, owner) {
- ("production" !== "development" ? invariant(
- ReactOwner.isValidOwner(owner),
- 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
- 'usually means that you\'re trying to remove a ref to a component that ' +
- 'doesn\'t have an owner (that is, was not created inside of another ' +
- 'component\'s `render` method). Try rendering this component inside of ' +
- 'a new top-level component which will hold the ref.'
- ) : invariant(ReactOwner.isValidOwner(owner)));
+ removeComponentAsRefFrom: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
@@ -13353,8 +12284,7 @@
};
module.exports = ReactOwner;
-
-},{"135":135}],75:[function(_dereq_,module,exports){
+},{"144":144}],71:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13391,17 +12321,13 @@
* @param {string} objectName
* @param {object<string>} methodNames
*/
- measureMethods: function(object, objectName, methodNames) {
- if ("production" !== "development") {
+ measureMethods: function (object, objectName, methodNames) {
+ if ("development" !== 'production') {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
- object[key] = ReactPerf.measure(
- objectName,
- methodNames[key],
- object[key]
- );
+ object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
}
}
},
@@ -13414,10 +12340,10 @@
* @param {function} func
* @return {function}
*/
- measure: function(objName, fnName, func) {
- if ("production" !== "development") {
+ measure: function (objName, fnName, func) {
+ if ("development" !== 'production') {
var measuredFunc = null;
- var wrapper = function() {
+ var wrapper = function () {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
@@ -13436,7 +12362,7 @@
/**
* @param {function} measure
*/
- injectMeasure: function(measure) {
+ injectMeasure: function (measure) {
ReactPerf.storedMeasure = measure;
}
}
@@ -13455,8 +12381,7 @@
}
module.exports = ReactPerf;
-
-},{}],76:[function(_dereq_,module,exports){
+},{}],72:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13472,7 +12397,7 @@
var ReactPropTypeLocationNames = {};
-if ("production" !== "development") {
+if ("development" !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
@@ -13481,8 +12406,7 @@
}
module.exports = ReactPropTypeLocationNames;
-
-},{}],77:[function(_dereq_,module,exports){
+},{}],73:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13496,7 +12420,7 @@
'use strict';
-var keyMirror = _dereq_(140);
+var keyMirror = _dereq_(147);
var ReactPropTypeLocations = keyMirror({
prop: null,
@@ -13505,8 +12429,7 @@
});
module.exports = ReactPropTypeLocations;
-
-},{"140":140}],78:[function(_dereq_,module,exports){
+},{"147":147}],74:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13520,11 +12443,11 @@
'use strict';
-var ReactElement = _dereq_(57);
-var ReactFragment = _dereq_(63);
-var ReactPropTypeLocationNames = _dereq_(76);
+var ReactElement = _dereq_(52);
+var ReactPropTypeLocationNames = _dereq_(72);
-var emptyFunction = _dereq_(114);
+var emptyFunction = _dereq_(136);
+var getIteratorFn = _dereq_(115);
/**
* Collection of methods that allow declaration and validation of props that are
@@ -13575,9 +12498,6 @@
var ANONYMOUS = '<<anonymous>>';
-var elementTypeChecker = createElementTypeChecker();
-var nodeTypeChecker = createNodeChecker();
-
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
@@ -13588,9 +12508,9 @@
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
- element: elementTypeChecker,
+ element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
- node: nodeTypeChecker,
+ node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
@@ -13598,19 +12518,17 @@
};
function createChainableTypeChecker(validate) {
- function checkType(isRequired, props, propName, componentName, location) {
+ function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
+ propFullName = propFullName || propName;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
- return new Error(
- ("Required " + locationName + " `" + propName + "` was not specified in ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
}
return null;
} else {
- return validate(props, propName, componentName, location);
+ return validate(props, propName, componentName, location, propFullName);
}
}
@@ -13621,7 +12539,7 @@
}
function createPrimitiveTypeChecker(expectedType) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
@@ -13631,10 +12549,7 @@
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
- ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
@@ -13646,18 +12561,15 @@
}
function createArrayOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
- var error = typeChecker(propValue, i, componentName, location);
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -13668,13 +12580,10 @@
}
function createElementTypeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactElement.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
@@ -13682,14 +12591,12 @@
}
function createInstanceTypeChecker(expectedClass) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
- );
+ var actualClassName = getClassName(props[propName]);
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
@@ -13697,7 +12604,13 @@
}
function createEnumTypeChecker(expectedValues) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(expectedValues)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
@@ -13707,28 +12620,22 @@
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
- ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
- var error = typeChecker(propValue, key, componentName, location);
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -13740,31 +12647,31 @@
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(arrayOfTypeCheckers)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
- if (checker(props, propName, componentName, location) == null) {
+ if (checker(props, propName, componentName, location, propFullName, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED') == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactNode.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
@@ -13772,22 +12679,19 @@
}
function createShapeTypeChecker(shapeTypes) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
- ("supplied to `" + componentName + "`, expected `object`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
- var error = checker(propValue, key, componentName, location);
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error) {
return error;
}
@@ -13812,12 +12716,32 @@
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
- propValue = ReactFragment.extractIfFragment(propValue);
- for (var k in propValue) {
- if (!isNode(propValue[k])) {
+
+ var iteratorFn = getIteratorFn(propValue);
+ if (iteratorFn) {
+ var iterator = iteratorFn.call(propValue);
+ var step;
+ if (iteratorFn !== propValue.entries) {
+ while (!(step = iterator.next()).done) {
+ if (!isNode(step.value)) {
return false;
}
}
+ } else {
+ // Iterator will provide entry [k,v] tuples rather than values.
+ while (!(step = iterator.next()).done) {
+ var entry = step.value;
+ if (entry) {
+ if (!isNode(entry[1])) {
+ return false;
+ }
+ }
+ }
+ }
+ } else {
+ return false;
+ }
+
return true;
default:
return false;
@@ -13853,65 +12777,16 @@
return propType;
}
-module.exports = ReactPropTypes;
-
-},{"114":114,"57":57,"63":63,"76":76}],79:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactPutListenerQueue
- */
-
-'use strict';
-
-var PooledClass = _dereq_(28);
-var ReactBrowserEventEmitter = _dereq_(30);
-
-var assign = _dereq_(27);
-
-function ReactPutListenerQueue() {
- this.listenersToPut = [];
-}
-
-assign(ReactPutListenerQueue.prototype, {
- enqueuePutListener: function(rootNodeID, propKey, propValue) {
- this.listenersToPut.push({
- rootNodeID: rootNodeID,
- propKey: propKey,
- propValue: propValue
- });
- },
-
- putListeners: function() {
- for (var i = 0; i < this.listenersToPut.length; i++) {
- var listenerToPut = this.listenersToPut[i];
- ReactBrowserEventEmitter.putListener(
- listenerToPut.rootNodeID,
- listenerToPut.propKey,
- listenerToPut.propValue
- );
- }
- },
-
- reset: function() {
- this.listenersToPut.length = 0;
- },
-
- destructor: function() {
- this.reset();
+// Returns class name of the object, if any.
+function getClassName(propValue) {
+ if (!propValue.constructor || !propValue.constructor.name) {
+ return '<<anonymous>>';
}
-});
-
-PooledClass.addPoolingTo(ReactPutListenerQueue);
-
-module.exports = ReactPutListenerQueue;
+ return propValue.constructor.name;
+}
-},{"27":27,"28":28,"30":30}],80:[function(_dereq_,module,exports){
+module.exports = ReactPropTypes;
+},{"115":115,"136":136,"52":52,"72":72}],75:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13927,13 +12802,13 @@
'use strict';
var CallbackQueue = _dereq_(6);
-var PooledClass = _dereq_(28);
-var ReactBrowserEventEmitter = _dereq_(30);
-var ReactInputSelection = _dereq_(65);
-var ReactPutListenerQueue = _dereq_(79);
-var Transaction = _dereq_(103);
+var PooledClass = _dereq_(24);
+var ReactBrowserEventEmitter = _dereq_(26);
+var ReactDOMFeatureFlags = _dereq_(39);
+var ReactInputSelection = _dereq_(60);
+var Transaction = _dereq_(100);
-var assign = _dereq_(27);
+var assign = _dereq_(23);
/**
* Ensures that, when possible, the selection range (currently selected text
@@ -13960,7 +12835,7 @@
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
- initialize: function() {
+ initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
@@ -13968,10 +12843,10 @@
/**
* @param {boolean} previouslyEnabled Enabled status of
- * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
+ * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
- close: function(previouslyEnabled) {
+ close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
@@ -13984,39 +12859,24 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
- close: function() {
+ close: function () {
this.reactMountReady.notifyAll();
}
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: function() {
- this.putListenerQueue.putListeners();
- }
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- SELECTION_RESTORATION,
- EVENT_SUPPRESSION,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
/**
* Currently:
@@ -14032,7 +12892,7 @@
*
* @class ReactReconcileTransaction
*/
-function ReactReconcileTransaction() {
+function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
@@ -14041,7 +12901,7 @@
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}
var Mixin = {
@@ -14049,34 +12909,27 @@
* @see Transaction
* @abstract
* @final
- * @return {array<object>} List of operation wrap proceedures.
+ * @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};
@@ -14080,14 +12933,12 @@
}
};
-
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
-
-},{"103":103,"27":27,"28":28,"30":30,"6":6,"65":65,"79":79}],81:[function(_dereq_,module,exports){
+},{"100":100,"23":23,"24":24,"26":26,"39":39,"6":6,"60":60}],76:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14101,8 +12952,7 @@
'use strict';
-var ReactRef = _dereq_(82);
-var ReactElementValidator = _dereq_(58);
+var ReactRef = _dereq_(77);
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
@@ -14124,14 +12974,11 @@
* @final
* @internal
*/
- mountComponent: function(internalInstance, rootID, transaction, context) {
+ mountComponent: function (internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(
- internalInstance._currentElement
- );
- }
+ if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
+ }
return markup;
},
@@ -14141,7 +12988,7 @@
* @final
* @internal
*/
- unmountComponent: function(internalInstance) {
+ unmountComponent: function (internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
@@ -14155,12 +13002,10 @@
* @param {object} context
* @internal
*/
- receiveComponent: function(
- internalInstance, nextElement, transaction, context
- ) {
+ receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
- if (nextElement === prevElement && nextElement._owner != null) {
+ if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
@@ -14168,17 +13013,13 @@
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
+
+ // TODO: Bailing out early is just a perf optimization right?
+ // TODO: Removing the return statement should affect correctness?
return;
}
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
- }
-
- var refsChanged = ReactRef.shouldUpdateRefs(
- prevElement,
- nextElement
- );
+ var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
@@ -14186,7 +13027,7 @@
internalInstance.receiveComponent(nextElement, transaction, context);
- if (refsChanged) {
+ if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
@@ -14198,18 +13039,14 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(
- internalInstance,
- transaction
- ) {
+ performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
}
};
module.exports = ReactReconciler;
-
-},{"58":58,"82":82}],82:[function(_dereq_,module,exports){
+},{"77":77}],77:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14223,7 +13060,7 @@
'use strict';
-var ReactOwner = _dereq_(74);
+var ReactOwner = _dereq_(70);
var ReactRef = {};
@@ -14245,14 +13082,17 @@
}
}
-ReactRef.attachRefs = function(instance, element) {
+ReactRef.attachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
-ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
+ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
@@ -14265,13 +13105,19 @@
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
- return (
- nextElement._owner !== prevElement._owner ||
- nextElement.ref !== prevElement.ref
+ var prevEmpty = prevElement === null || prevElement === false;
+ var nextEmpty = nextElement === null || nextElement === false;
+
+ return(
+ // This has a few false positives w/r/t empty components.
+ prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
-ReactRef.detachRefs = function(instance, element) {
+ReactRef.detachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
@@ -14279,8 +13125,7 @@
};
module.exports = ReactRef;
-
-},{"74":74}],83:[function(_dereq_,module,exports){
+},{"70":70}],78:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14299,7 +13144,7 @@
/**
* @param {function} _createReactRootIndex
*/
- injectCreateReactRootIndex: function(_createReactRootIndex) {
+ injectCreateReactRootIndex: function (_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
@@ -14310,8 +13155,31 @@
};
module.exports = ReactRootIndex;
+},{}],79:[function(_dereq_,module,exports){
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactServerBatchingStrategy
+ * @typechecks
+ */
+
+'use strict';
-},{}],84:[function(_dereq_,module,exports){
+var ReactServerBatchingStrategy = {
+ isBatchingUpdates: false,
+ batchedUpdates: function (callback) {
+ // Don't do anything here. During the server rendering we don't want to
+ // schedule any updates. We will simply ignore them.
+ }
+};
+
+module.exports = ReactServerBatchingStrategy;
+},{}],80:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14325,39 +13193,42 @@
*/
'use strict';
-var ReactElement = _dereq_(57);
-var ReactInstanceHandles = _dereq_(66);
-var ReactMarkupChecksum = _dereq_(69);
-var ReactServerRenderingTransaction =
- _dereq_(85);
-
-var emptyObject = _dereq_(115);
-var instantiateReactComponent = _dereq_(134);
-var invariant = _dereq_(135);
+var ReactDefaultBatchingStrategy = _dereq_(48);
+var ReactElement = _dereq_(52);
+var ReactInstanceHandles = _dereq_(61);
+var ReactMarkupChecksum = _dereq_(64);
+var ReactServerBatchingStrategy = _dereq_(79);
+var ReactServerRenderingTransaction = _dereq_(81);
+var ReactUpdates = _dereq_(83);
+
+var emptyObject = _dereq_(137);
+var instantiateReactComponent = _dereq_(118);
+var invariant = _dereq_(144);
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(element),
- 'renderToString(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
- var markup =
- componentInstance.mountComponent(id, transaction, emptyObject);
+ var markup = componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
@@ -14367,22 +13238,24 @@
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(element),
- 'renderToStaticMarkup(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
@@ -14390,8 +13263,7 @@
renderToString: renderToString,
renderToStaticMarkup: renderToStaticMarkup
};
-
-},{"115":115,"134":134,"135":135,"57":57,"66":66,"69":69,"85":85}],85:[function(_dereq_,module,exports){
+},{"118":118,"137":137,"144":144,"48":48,"52":52,"61":61,"64":64,"79":79,"81":81,"83":83}],81:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -14406,13 +13278,12 @@
'use strict';
-var PooledClass = _dereq_(28);
+var PooledClass = _dereq_(24);
var CallbackQueue = _dereq_(6);
-var ReactPutListenerQueue = _dereq_(79);
-var Transaction = _dereq_(103);
+var Transaction = _dereq_(100);
-var assign = _dereq_(27);
-var emptyFunction = _dereq_(114);
+var assign = _dereq_(23);
+var emptyFunction = _dereq_(136);
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
@@ -14422,30 +13293,19 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
close: emptyFunction
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: emptyFunction
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
/**
* @class ReactServerRenderingTransaction
@@ -14455,7 +13315,7 @@
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = false;
}
var Mixin = {
@@ -14463,48 +13323,35 @@
* @see Transaction
* @abstract
* @final
- * @return {array} Empty list of operation wrap proceedures.
+ * @return {array} Empty list of operation wrap procedures.
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};
-
-assign(
- ReactServerRenderingTransaction.prototype,
- Transaction.Mixin,
- Mixin
-);
+assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
-
-},{"103":103,"114":114,"27":27,"28":28,"6":6,"79":79}],86:[function(_dereq_,module,exports){
+},{"100":100,"136":136,"23":23,"24":24,"6":6}],82:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
@@ -14518,55 +13365,33 @@
'use strict';
-var ReactLifeCycle = _dereq_(68);
-var ReactCurrentOwner = _dereq_(39);
-var ReactElement = _dereq_(57);
-var ReactInstanceMap = _dereq_(67);
-var ReactUpdates = _dereq_(87);
-
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
-var warning = _dereq_(154);
+var ReactCurrentOwner = _dereq_(34);
+var ReactElement = _dereq_(52);
+var ReactInstanceMap = _dereq_(62);
+var ReactUpdates = _dereq_(83);
+
+var assign = _dereq_(23);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
function enqueueUpdate(internalInstance) {
- if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
- // If we're in a componentWillMount handler, don't enqueue a rerender
- // because ReactUpdates assumes we're in a browser context (which is
- // wrong for server rendering) and we're about to do a render anyway.
- // See bug in #1740.
ReactUpdates.enqueueUpdate(internalInstance);
- }
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
- ("production" !== "development" ? invariant(
- ReactCurrentOwner.current == null,
- '%s(...): Cannot update during an existing state transition ' +
- '(such as within `render`). Render methods should be a pure function ' +
- 'of props and state.',
- callerName
- ) : invariant(ReactCurrentOwner.current == null));
-
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
- ("production" !== "development" ? warning(
- !callerName,
- '%s(...): Can only update a mounted or mounting component. ' +
- 'This usually means you called %s() on an unmounted ' +
- 'component. This is a no-op.',
- callerName,
- callerName
- ) : null);
+ "development" !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
}
return null;
}
- if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
- return null;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
return internalInstance;
@@ -14579,6 +13404,32 @@
var ReactUpdateQueue = {
/**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ if ("development" !== 'production') {
+ var owner = ReactCurrentOwner.current;
+ if (owner !== null) {
+ "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
+ owner._warnedAboutRefsInRender = true;
+ }
+ }
+ var internalInstance = ReactInstanceMap.get(publicInstance);
+ if (internalInstance) {
+ // During componentWillMount and render this will still be null but after
+ // that will always render to something. At least for now. So we can use
+ // this hack.
+ return !!internalInstance._renderedComponent;
+ } else {
+ return false;
+ }
+ },
+
+ /**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
@@ -14586,13 +13437,8 @@
* @param {?function} callback Called after state is updated.
* @internal
*/
- enqueueCallback: function(publicInstance, callback) {
- ("production" !== "development" ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallback: function (publicInstance, callback) {
+ !(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
@@ -14600,8 +13446,7 @@
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
- if (!internalInstance ||
- internalInstance === ReactLifeCycle.currentlyMountingInstance) {
+ if (!internalInstance) {
return null;
}
@@ -14617,13 +13462,8 @@
enqueueUpdate(internalInstance);
},
- enqueueCallbackInternal: function(internalInstance, callback) {
- ("production" !== "development" ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallbackInternal: function (internalInstance, callback) {
+ !(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
@@ -14639,17 +13479,14 @@
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
- * This will not invoke `shouldUpdateComponent`, but it will invoke
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
- enqueueForceUpdate: function(publicInstance) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'forceUpdate'
- );
+ enqueueForceUpdate: function (publicInstance) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
@@ -14671,11 +13508,8 @@
* @param {object} completeState Next state.
* @internal
*/
- enqueueReplaceState: function(publicInstance, completeState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceState'
- );
+ enqueueReplaceState: function (publicInstance, completeState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
@@ -14697,19 +13531,14 @@
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
- enqueueSetState: function(publicInstance, partialState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setState'
- );
+ enqueueSetState: function (publicInstance, partialState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
- var queue =
- internalInstance._pendingStateQueue ||
- (internalInstance._pendingStateQueue = []);
+ var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
@@ -14722,36 +13551,26 @@
* @param {object} partialProps Subset of the next props.
* @internal
*/
- enqueueSetProps: function(publicInstance, partialProps) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setProps'
- );
-
+ enqueueSetProps: function (publicInstance, partialProps) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
+ },
- ("production" !== "development" ? invariant(
- internalInstance._isTopLevel,
- 'setProps(...): You called `setProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueSetPropsInternal: function (internalInstance, partialProps) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? "development" !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
/**
@@ -14761,38 +13580,28 @@
* @param {object} props New props.
* @internal
*/
- enqueueReplaceProps: function(publicInstance, props) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceProps'
- );
-
+ enqueueReplaceProps: function (publicInstance, props) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
+ },
- ("production" !== "development" ? invariant(
- internalInstance._isTopLevel,
- 'replaceProps(...): You called `replaceProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueReplacePropsInternal: function (internalInstance, props) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? "development" !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
- enqueueElementInternal: function(internalInstance, newElement) {
+ enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}
@@ -14800,8 +13609,7 @@
};
module.exports = ReactUpdateQueue;
-
-},{"135":135,"154":154,"27":27,"39":39,"57":57,"67":67,"68":68,"87":87}],87:[function(_dereq_,module,exports){
+},{"144":144,"155":155,"23":23,"34":34,"52":52,"62":62,"83":83}],83:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14816,15 +13624,13 @@
'use strict';
var CallbackQueue = _dereq_(6);
-var PooledClass = _dereq_(28);
-var ReactCurrentOwner = _dereq_(39);
-var ReactPerf = _dereq_(75);
-var ReactReconciler = _dereq_(81);
-var Transaction = _dereq_(103);
-
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
-var warning = _dereq_(154);
+var PooledClass = _dereq_(24);
+var ReactPerf = _dereq_(71);
+var ReactReconciler = _dereq_(76);
+var Transaction = _dereq_(100);
+
+var assign = _dereq_(23);
+var invariant = _dereq_(144);
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
@@ -14833,18 +13639,14 @@
var batchingStrategy = null;
function ensureInjected() {
- ("production" !== "development" ? invariant(
- ReactUpdates.ReactReconcileTransaction && batchingStrategy,
- 'ReactUpdates: must inject a reconcile transaction class and batching ' +
- 'strategy'
- ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
+ !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
}
var NESTED_UPDATES = {
- initialize: function() {
+ initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
- close: function() {
+ close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
@@ -14860,10 +13662,10 @@
};
var UPDATE_QUEUEING = {
- initialize: function() {
+ initialize: function () {
this.callbackQueue.reset();
},
- close: function() {
+ close: function () {
this.callbackQueue.notifyAll();
}
};
@@ -14874,18 +13676,15 @@
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
- this.reconcileTransaction =
- ReactUpdates.ReactReconcileTransaction.getPooled();
+ this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}
-assign(
- ReactUpdatesFlushTransaction.prototype,
- Transaction.Mixin, {
- getTransactionWrappers: function() {
+assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
- destructor: function() {
+ destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
@@ -14893,25 +13692,18 @@
this.reconcileTransaction = null;
},
- perform: function(method, scope, a) {
+ perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
- return Transaction.Mixin.perform.call(
- this,
- this.reconcileTransaction.perform,
- this.reconcileTransaction,
- method,
- scope,
- a
- );
+ return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
-function batchedUpdates(callback, a, b, c, d) {
+function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
- batchingStrategy.batchedUpdates(callback, a, b, c, d);
+ batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
@@ -14927,13 +13719,7 @@
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
- ("production" !== "development" ? invariant(
- len === dirtyComponents.length,
- 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
- 'match dirty-components array length (%s).',
- len,
- dirtyComponents.length
- ) : invariant(len === dirtyComponents.length));
+ !(len === dirtyComponents.length) ? "development" !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
@@ -14952,23 +13738,17 @@
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
- ReactReconciler.performUpdateIfNecessary(
- component,
- transaction.reconcileTransaction
- );
+ ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
- transaction.callbackQueue.enqueue(
- callbacks[j],
- component.getPublicInstance()
- );
+ transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
-var flushBatchedUpdates = function() {
+var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
@@ -14989,11 +13769,7 @@
}
}
};
-flushBatchedUpdates = ReactPerf.measure(
- 'ReactUpdates',
- 'flushBatchedUpdates',
- flushBatchedUpdates
-);
+flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
/**
* Mark a component as needing a rerender, adding an optional callback to a
@@ -15007,13 +13783,6 @@
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- 'enqueueUpdate(): Render methods should be a pure function of props ' +
- 'and state; triggering nested component updates from render is not ' +
- 'allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
@@ -15028,37 +13797,21 @@
* if no updates are currently being performed.
*/
function asap(callback, context) {
- ("production" !== "development" ? invariant(
- batchingStrategy.isBatchingUpdates,
- 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
- 'updates are not being batched.'
- ) : invariant(batchingStrategy.isBatchingUpdates));
+ !batchingStrategy.isBatchingUpdates ? "development" !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
- injectReconcileTransaction: function(ReconcileTransaction) {
- ("production" !== "development" ? invariant(
- ReconcileTransaction,
- 'ReactUpdates: must provide a reconcile transaction class'
- ) : invariant(ReconcileTransaction));
+ injectReconcileTransaction: function (ReconcileTransaction) {
+ !ReconcileTransaction ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
- injectBatchingStrategy: function(_batchingStrategy) {
- ("production" !== "development" ? invariant(
- _batchingStrategy,
- 'ReactUpdates: must provide a batching strategy'
- ) : invariant(_batchingStrategy));
- ("production" !== "development" ? invariant(
- typeof _batchingStrategy.batchedUpdates === 'function',
- 'ReactUpdates: must provide a batchedUpdates() function'
- ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
- ("production" !== "development" ? invariant(
- typeof _batchingStrategy.isBatchingUpdates === 'boolean',
- 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
- ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
+ injectBatchingStrategy: function (_batchingStrategy) {
+ !_batchingStrategy ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.batchedUpdates === 'function') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
batchingStrategy = _batchingStrategy;
}
};
@@ -15080,8 +13833,22 @@
};
module.exports = ReactUpdates;
+},{"100":100,"144":144,"23":23,"24":24,"6":6,"71":71,"76":76}],84:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactVersion
+ */
-},{"103":103,"135":135,"154":154,"27":27,"28":28,"39":39,"6":6,"75":75,"81":81}],88:[function(_dereq_,module,exports){
+'use strict';
+
+module.exports = '0.14.9';
+},{}],85:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15093,14 +13860,17 @@
* @providesModule SVGDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
var DOMProperty = _dereq_(10);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
+var NS = {
+ xlink: 'http://www.w3.org/1999/xlink',
+ xml: 'http://www.w3.org/XML/1998/namespace'
+};
+
var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
@@ -15144,10 +13914,32 @@
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
+ xlinkActuate: MUST_USE_ATTRIBUTE,
+ xlinkArcrole: MUST_USE_ATTRIBUTE,
+ xlinkHref: MUST_USE_ATTRIBUTE,
+ xlinkRole: MUST_USE_ATTRIBUTE,
+ xlinkShow: MUST_USE_ATTRIBUTE,
+ xlinkTitle: MUST_USE_ATTRIBUTE,
+ xlinkType: MUST_USE_ATTRIBUTE,
+ xmlBase: MUST_USE_ATTRIBUTE,
+ xmlLang: MUST_USE_ATTRIBUTE,
+ xmlSpace: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
+ DOMAttributeNamespaces: {
+ xlinkActuate: NS.xlink,
+ xlinkArcrole: NS.xlink,
+ xlinkHref: NS.xlink,
+ xlinkRole: NS.xlink,
+ xlinkShow: NS.xlink,
+ xlinkTitle: NS.xlink,
+ xlinkType: NS.xlink,
+ xmlBase: NS.xml,
+ xmlLang: NS.xml,
+ xmlSpace: NS.xml
+ },
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
@@ -15169,13 +13961,22 @@
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
- viewBox: 'viewBox'
+ viewBox: 'viewBox',
+ xlinkActuate: 'xlink:actuate',
+ xlinkArcrole: 'xlink:arcrole',
+ xlinkHref: 'xlink:href',
+ xlinkRole: 'xlink:role',
+ xlinkShow: 'xlink:show',
+ xlinkTitle: 'xlink:title',
+ xlinkType: 'xlink:type',
+ xmlBase: 'xml:base',
+ xmlLang: 'xml:lang',
+ xmlSpace: 'xml:space'
}
};
module.exports = SVGDOMPropertyConfig;
-
-},{"10":10}],89:[function(_dereq_,module,exports){
+},{"10":10}],86:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15190,32 +13991,27 @@
'use strict';
var EventConstants = _dereq_(15);
-var EventPropagators = _dereq_(20);
-var ReactInputSelection = _dereq_(65);
-var SyntheticEvent = _dereq_(95);
-
-var getActiveElement = _dereq_(121);
-var isTextInputElement = _dereq_(138);
-var keyOf = _dereq_(141);
-var shallowEqual = _dereq_(150);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(130);
+var ReactInputSelection = _dereq_(60);
+var SyntheticEvent = _dereq_(92);
+
+var getActiveElement = _dereq_(139);
+var isTextInputElement = _dereq_(120);
+var keyOf = _dereq_(148);
+var shallowEqual = _dereq_(153);
var topLevelTypes = EventConstants.topLevelTypes;
+var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
+
var eventTypes = {
select: {
phasedRegistrationNames: {
- bubbled: keyOf({onSelect: null}),
- captured: keyOf({onSelectCapture: null})
+ bubbled: keyOf({ onSelect: null }),
+ captured: keyOf({ onSelectCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topContextMenu,
- topLevelTypes.topFocus,
- topLevelTypes.topKeyDown,
- topLevelTypes.topMouseDown,
- topLevelTypes.topMouseUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
}
};
@@ -15224,6 +14020,11 @@
var lastSelection = null;
var mouseDown = false;
+// Track whether a listener exists for this plugin. If none exist, we do
+// not extract events.
+var hasListener = false;
+var ON_SELECT_KEY = keyOf({ onSelect: null });
+
/**
* Get an object which is a unique representation of the current selection.
*
@@ -15231,11 +14032,10 @@
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
- * @param {object}
+ * @return {object}
*/
function getSelection(node) {
- if ('selectionStart' in node &&
- ReactInputSelection.hasSelectionCapabilities(node)) {
+ if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
@@ -15265,14 +14065,12 @@
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
-function constructSelectEvent(nativeEvent) {
+function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
- if (mouseDown ||
- activeElement == null ||
- activeElement !== getActiveElement()) {
+ if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
@@ -15281,11 +14079,7 @@
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
- var syntheticEvent = SyntheticEvent.getPooled(
- eventTypes.select,
- activeElementID,
- nativeEvent
- );
+ var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
@@ -15294,6 +14088,8 @@
return syntheticEvent;
}
+
+ return null;
}
/**
@@ -15322,17 +14118,15 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (!hasListener) {
+ return null;
+ }
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
- if (isTextInputElement(topLevelTarget) ||
- topLevelTarget.contentEditable === 'true') {
+ if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
@@ -15352,25 +14146,39 @@
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
- // sometimes when it hasn't).
+ // sometimes when it hasn't). IE's event fires out of order with respect
+ // to key and input events on deletion, so we discard it.
+ //
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
+ // This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
+ if (skipSelectionChangeEvent) {
+ break;
+ }
+ // falls through
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
+ }
+
+ return null;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ if (registrationName === ON_SELECT_KEY) {
+ hasListener = true;
}
}
};
module.exports = SelectEventPlugin;
-
-},{"121":121,"138":138,"141":141,"15":15,"150":150,"20":20,"65":65,"95":95}],90:[function(_dereq_,module,exports){
+},{"120":120,"130":130,"139":139,"148":148,"15":15,"153":153,"19":19,"60":60,"92":92}],87:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15394,14 +14202,13 @@
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
-
-},{}],91:[function(_dereq_,module,exports){
+},{}],88:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15416,243 +14223,378 @@
'use strict';
var EventConstants = _dereq_(15);
-var EventPluginUtils = _dereq_(19);
-var EventPropagators = _dereq_(20);
-var SyntheticClipboardEvent = _dereq_(92);
-var SyntheticEvent = _dereq_(95);
-var SyntheticFocusEvent = _dereq_(96);
-var SyntheticKeyboardEvent = _dereq_(98);
-var SyntheticMouseEvent = _dereq_(99);
-var SyntheticDragEvent = _dereq_(94);
-var SyntheticTouchEvent = _dereq_(100);
-var SyntheticUIEvent = _dereq_(101);
-var SyntheticWheelEvent = _dereq_(102);
-
-var getEventCharCode = _dereq_(122);
-
-var invariant = _dereq_(135);
-var keyOf = _dereq_(141);
-var warning = _dereq_(154);
+var EventListener = _dereq_(129);
+var EventPropagators = _dereq_(19);
+var ReactMount = _dereq_(65);
+var SyntheticClipboardEvent = _dereq_(89);
+var SyntheticEvent = _dereq_(92);
+var SyntheticFocusEvent = _dereq_(93);
+var SyntheticKeyboardEvent = _dereq_(95);
+var SyntheticMouseEvent = _dereq_(96);
+var SyntheticDragEvent = _dereq_(91);
+var SyntheticTouchEvent = _dereq_(97);
+var SyntheticUIEvent = _dereq_(98);
+var SyntheticWheelEvent = _dereq_(99);
+
+var emptyFunction = _dereq_(136);
+var getEventCharCode = _dereq_(111);
+var invariant = _dereq_(144);
+var keyOf = _dereq_(148);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
+ abort: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onAbort: true }),
+ captured: keyOf({ onAbortCapture: true })
+ }
+ },
blur: {
phasedRegistrationNames: {
- bubbled: keyOf({onBlur: true}),
- captured: keyOf({onBlurCapture: true})
+ bubbled: keyOf({ onBlur: true }),
+ captured: keyOf({ onBlurCapture: true })
+ }
+ },
+ canPlay: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlay: true }),
+ captured: keyOf({ onCanPlayCapture: true })
+ }
+ },
+ canPlayThrough: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlayThrough: true }),
+ captured: keyOf({ onCanPlayThroughCapture: true })
}
},
click: {
phasedRegistrationNames: {
- bubbled: keyOf({onClick: true}),
- captured: keyOf({onClickCapture: true})
+ bubbled: keyOf({ onClick: true }),
+ captured: keyOf({ onClickCapture: true })
}
},
contextMenu: {
phasedRegistrationNames: {
- bubbled: keyOf({onContextMenu: true}),
- captured: keyOf({onContextMenuCapture: true})
+ bubbled: keyOf({ onContextMenu: true }),
+ captured: keyOf({ onContextMenuCapture: true })
}
},
copy: {
phasedRegistrationNames: {
- bubbled: keyOf({onCopy: true}),
- captured: keyOf({onCopyCapture: true})
+ bubbled: keyOf({ onCopy: true }),
+ captured: keyOf({ onCopyCapture: true })
}
},
cut: {
phasedRegistrationNames: {
- bubbled: keyOf({onCut: true}),
- captured: keyOf({onCutCapture: true})
+ bubbled: keyOf({ onCut: true }),
+ captured: keyOf({ onCutCapture: true })
}
},
doubleClick: {
phasedRegistrationNames: {
- bubbled: keyOf({onDoubleClick: true}),
- captured: keyOf({onDoubleClickCapture: true})
+ bubbled: keyOf({ onDoubleClick: true }),
+ captured: keyOf({ onDoubleClickCapture: true })
}
},
drag: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrag: true}),
- captured: keyOf({onDragCapture: true})
+ bubbled: keyOf({ onDrag: true }),
+ captured: keyOf({ onDragCapture: true })
}
},
dragEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnd: true}),
- captured: keyOf({onDragEndCapture: true})
+ bubbled: keyOf({ onDragEnd: true }),
+ captured: keyOf({ onDragEndCapture: true })
}
},
dragEnter: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnter: true}),
- captured: keyOf({onDragEnterCapture: true})
+ bubbled: keyOf({ onDragEnter: true }),
+ captured: keyOf({ onDragEnterCapture: true })
}
},
dragExit: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragExit: true}),
- captured: keyOf({onDragExitCapture: true})
+ bubbled: keyOf({ onDragExit: true }),
+ captured: keyOf({ onDragExitCapture: true })
}
},
dragLeave: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragLeave: true}),
- captured: keyOf({onDragLeaveCapture: true})
+ bubbled: keyOf({ onDragLeave: true }),
+ captured: keyOf({ onDragLeaveCapture: true })
}
},
dragOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragOver: true}),
- captured: keyOf({onDragOverCapture: true})
+ bubbled: keyOf({ onDragOver: true }),
+ captured: keyOf({ onDragOverCapture: true })
}
},
dragStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragStart: true}),
- captured: keyOf({onDragStartCapture: true})
+ bubbled: keyOf({ onDragStart: true }),
+ captured: keyOf({ onDragStartCapture: true })
}
},
drop: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrop: true}),
- captured: keyOf({onDropCapture: true})
+ bubbled: keyOf({ onDrop: true }),
+ captured: keyOf({ onDropCapture: true })
+ }
+ },
+ durationChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onDurationChange: true }),
+ captured: keyOf({ onDurationChangeCapture: true })
+ }
+ },
+ emptied: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEmptied: true }),
+ captured: keyOf({ onEmptiedCapture: true })
+ }
+ },
+ encrypted: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEncrypted: true }),
+ captured: keyOf({ onEncryptedCapture: true })
+ }
+ },
+ ended: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEnded: true }),
+ captured: keyOf({ onEndedCapture: true })
+ }
+ },
+ error: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onError: true }),
+ captured: keyOf({ onErrorCapture: true })
}
},
focus: {
phasedRegistrationNames: {
- bubbled: keyOf({onFocus: true}),
- captured: keyOf({onFocusCapture: true})
+ bubbled: keyOf({ onFocus: true }),
+ captured: keyOf({ onFocusCapture: true })
}
},
input: {
phasedRegistrationNames: {
- bubbled: keyOf({onInput: true}),
- captured: keyOf({onInputCapture: true})
+ bubbled: keyOf({ onInput: true }),
+ captured: keyOf({ onInputCapture: true })
}
},
keyDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyDown: true}),
- captured: keyOf({onKeyDownCapture: true})
+ bubbled: keyOf({ onKeyDown: true }),
+ captured: keyOf({ onKeyDownCapture: true })
}
},
keyPress: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyPress: true}),
- captured: keyOf({onKeyPressCapture: true})
+ bubbled: keyOf({ onKeyPress: true }),
+ captured: keyOf({ onKeyPressCapture: true })
}
},
keyUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyUp: true}),
- captured: keyOf({onKeyUpCapture: true})
+ bubbled: keyOf({ onKeyUp: true }),
+ captured: keyOf({ onKeyUpCapture: true })
}
},
load: {
phasedRegistrationNames: {
- bubbled: keyOf({onLoad: true}),
- captured: keyOf({onLoadCapture: true})
+ bubbled: keyOf({ onLoad: true }),
+ captured: keyOf({ onLoadCapture: true })
}
},
- error: {
+ loadedData: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadedData: true }),
+ captured: keyOf({ onLoadedDataCapture: true })
+ }
+ },
+ loadedMetadata: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadedMetadata: true }),
+ captured: keyOf({ onLoadedMetadataCapture: true })
+ }
+ },
+ loadStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onError: true}),
- captured: keyOf({onErrorCapture: true})
+ bubbled: keyOf({ onLoadStart: true }),
+ captured: keyOf({ onLoadStartCapture: true })
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseDown: true}),
- captured: keyOf({onMouseDownCapture: true})
+ bubbled: keyOf({ onMouseDown: true }),
+ captured: keyOf({ onMouseDownCapture: true })
}
},
mouseMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseMove: true}),
- captured: keyOf({onMouseMoveCapture: true})
+ bubbled: keyOf({ onMouseMove: true }),
+ captured: keyOf({ onMouseMoveCapture: true })
}
},
mouseOut: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOut: true}),
- captured: keyOf({onMouseOutCapture: true})
+ bubbled: keyOf({ onMouseOut: true }),
+ captured: keyOf({ onMouseOutCapture: true })
}
},
mouseOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOver: true}),
- captured: keyOf({onMouseOverCapture: true})
+ bubbled: keyOf({ onMouseOver: true }),
+ captured: keyOf({ onMouseOverCapture: true })
}
},
mouseUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseUp: true}),
- captured: keyOf({onMouseUpCapture: true})
+ bubbled: keyOf({ onMouseUp: true }),
+ captured: keyOf({ onMouseUpCapture: true })
}
},
paste: {
phasedRegistrationNames: {
- bubbled: keyOf({onPaste: true}),
- captured: keyOf({onPasteCapture: true})
+ bubbled: keyOf({ onPaste: true }),
+ captured: keyOf({ onPasteCapture: true })
+ }
+ },
+ pause: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPause: true }),
+ captured: keyOf({ onPauseCapture: true })
+ }
+ },
+ play: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlay: true }),
+ captured: keyOf({ onPlayCapture: true })
+ }
+ },
+ playing: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlaying: true }),
+ captured: keyOf({ onPlayingCapture: true })
+ }
+ },
+ progress: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onProgress: true }),
+ captured: keyOf({ onProgressCapture: true })
+ }
+ },
+ rateChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onRateChange: true }),
+ captured: keyOf({ onRateChangeCapture: true })
}
},
reset: {
phasedRegistrationNames: {
- bubbled: keyOf({onReset: true}),
- captured: keyOf({onResetCapture: true})
+ bubbled: keyOf({ onReset: true }),
+ captured: keyOf({ onResetCapture: true })
}
},
scroll: {
phasedRegistrationNames: {
- bubbled: keyOf({onScroll: true}),
- captured: keyOf({onScrollCapture: true})
+ bubbled: keyOf({ onScroll: true }),
+ captured: keyOf({ onScrollCapture: true })
+ }
+ },
+ seeked: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeked: true }),
+ captured: keyOf({ onSeekedCapture: true })
+ }
+ },
+ seeking: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeking: true }),
+ captured: keyOf({ onSeekingCapture: true })
+ }
+ },
+ stalled: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onStalled: true }),
+ captured: keyOf({ onStalledCapture: true })
}
},
submit: {
phasedRegistrationNames: {
- bubbled: keyOf({onSubmit: true}),
- captured: keyOf({onSubmitCapture: true})
+ bubbled: keyOf({ onSubmit: true }),
+ captured: keyOf({ onSubmitCapture: true })
+ }
+ },
+ suspend: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSuspend: true }),
+ captured: keyOf({ onSuspendCapture: true })
+ }
+ },
+ timeUpdate: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onTimeUpdate: true }),
+ captured: keyOf({ onTimeUpdateCapture: true })
}
},
touchCancel: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchCancel: true}),
- captured: keyOf({onTouchCancelCapture: true})
+ bubbled: keyOf({ onTouchCancel: true }),
+ captured: keyOf({ onTouchCancelCapture: true })
}
},
touchEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchEnd: true}),
- captured: keyOf({onTouchEndCapture: true})
+ bubbled: keyOf({ onTouchEnd: true }),
+ captured: keyOf({ onTouchEndCapture: true })
}
},
touchMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchMove: true}),
- captured: keyOf({onTouchMoveCapture: true})
+ bubbled: keyOf({ onTouchMove: true }),
+ captured: keyOf({ onTouchMoveCapture: true })
}
},
touchStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchStart: true}),
- captured: keyOf({onTouchStartCapture: true})
+ bubbled: keyOf({ onTouchStart: true }),
+ captured: keyOf({ onTouchStartCapture: true })
+ }
+ },
+ volumeChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onVolumeChange: true }),
+ captured: keyOf({ onVolumeChangeCapture: true })
+ }
+ },
+ waiting: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onWaiting: true }),
+ captured: keyOf({ onWaitingCapture: true })
}
},
wheel: {
phasedRegistrationNames: {
- bubbled: keyOf({onWheel: true}),
- captured: keyOf({onWheelCapture: true})
+ bubbled: keyOf({ onWheel: true }),
+ captured: keyOf({ onWheelCapture: true })
}
}
};
var topLevelEventsToDispatchConfig = {
+ topAbort: eventTypes.abort,
topBlur: eventTypes.blur,
+ topCanPlay: eventTypes.canPlay,
+ topCanPlayThrough: eventTypes.canPlayThrough,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
@@ -15666,6 +14608,10 @@
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
+ topDurationChange: eventTypes.durationChange,
+ topEmptied: eventTypes.emptied,
+ topEncrypted: eventTypes.encrypted,
+ topEnded: eventTypes.ended,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
@@ -15673,19 +14619,34 @@
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
+ topLoadedData: eventTypes.loadedData,
+ topLoadedMetadata: eventTypes.loadedMetadata,
+ topLoadStart: eventTypes.loadStart,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
+ topPause: eventTypes.pause,
+ topPlay: eventTypes.play,
+ topPlaying: eventTypes.playing,
+ topProgress: eventTypes.progress,
+ topRateChange: eventTypes.rateChange,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
+ topSeeked: eventTypes.seeked,
+ topSeeking: eventTypes.seeking,
+ topStalled: eventTypes.stalled,
topSubmit: eventTypes.submit,
+ topSuspend: eventTypes.suspend,
+ topTimeUpdate: eventTypes.timeUpdate,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
+ topVolumeChange: eventTypes.volumeChange,
+ topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
};
@@ -15693,35 +14654,14 @@
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
+var ON_CLICK_KEY = keyOf({ onClick: null });
+var onClickListeners = {};
+
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
- * Same as the default implementation, except cancels the event when return
- * value is false. This behavior will be disabled in a future release.
- *
- * @param {object} Event to be dispatched.
- * @param {function} Application-level callback.
- * @param {string} domID DOM ID to pass to the callback.
- */
- executeDispatch: function(event, listener, domID) {
- var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
-
- ("production" !== "development" ? warning(
- typeof returnValue !== 'boolean',
- 'Returning `false` from an event handler is deprecated and will be ' +
- 'ignored in a future release. Instead, manually call ' +
- 'e.stopPropagation() or e.preventDefault(), as appropriate.'
- ) : null);
-
- if (returnValue === false) {
- event.stopPropagation();
- event.preventDefault();
- }
- },
-
- /**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
@@ -15729,22 +14669,40 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
+ case topLevelTypes.topAbort:
+ case topLevelTypes.topCanPlay:
+ case topLevelTypes.topCanPlayThrough:
+ case topLevelTypes.topDurationChange:
+ case topLevelTypes.topEmptied:
+ case topLevelTypes.topEncrypted:
+ case topLevelTypes.topEnded:
+ case topLevelTypes.topError:
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
- case topLevelTypes.topError:
+ case topLevelTypes.topLoadedData:
+ case topLevelTypes.topLoadedMetadata:
+ case topLevelTypes.topLoadStart:
+ case topLevelTypes.topPause:
+ case topLevelTypes.topPlay:
+ case topLevelTypes.topPlaying:
+ case topLevelTypes.topProgress:
+ case topLevelTypes.topRateChange:
case topLevelTypes.topReset:
+ case topLevelTypes.topSeeked:
+ case topLevelTypes.topSeeking:
+ case topLevelTypes.topStalled:
case topLevelTypes.topSubmit:
+ case topLevelTypes.topSuspend:
+ case topLevelTypes.topTimeUpdate:
+ case topLevelTypes.topVolumeChange:
+ case topLevelTypes.topWaiting:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
@@ -15809,25 +14767,36 @@
EventConstructor = SyntheticClipboardEvent;
break;
}
- ("production" !== "development" ? invariant(
- EventConstructor,
- 'SimpleEventPlugin: Unhandled event type, `%s`.',
- topLevelType
- ) : invariant(EventConstructor));
- var event = EventConstructor.getPooled(
- dispatchConfig,
- topLevelTargetID,
- nativeEvent
- );
+ !EventConstructor ? "development" !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
+ var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ // Mobile Safari does not fire properly bubble click events on
+ // non-interactive elements, which means delegated click listeners do not
+ // fire. The workaround for this bug involves attaching an empty click
+ // listener on the target node.
+ if (registrationName === ON_CLICK_KEY) {
+ var node = ReactMount.getNode(id);
+ if (!onClickListeners[id]) {
+ onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
+ }
+ }
+ },
+
+ willDeleteListener: function (id, registrationName) {
+ if (registrationName === ON_CLICK_KEY) {
+ onClickListeners[id].remove();
+ delete onClickListeners[id];
+ }
}
};
module.exports = SimpleEventPlugin;
-
-},{"100":100,"101":101,"102":102,"122":122,"135":135,"141":141,"15":15,"154":154,"19":19,"20":20,"92":92,"94":94,"95":95,"96":96,"98":98,"99":99}],92:[function(_dereq_,module,exports){
+},{"111":111,"129":129,"136":136,"144":144,"148":148,"15":15,"19":19,"65":65,"89":89,"91":91,"92":92,"93":93,"95":95,"96":96,"97":97,"98":98,"99":99}],89:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15842,19 +14811,15 @@
'use strict';
-var SyntheticEvent = _dereq_(95);
+var SyntheticEvent = _dereq_(92);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
- clipboardData: function(event) {
- return (
- 'clipboardData' in event ?
- event.clipboardData :
- window.clipboardData
- );
+ clipboardData: function (event) {
+ return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
@@ -15864,15 +14829,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
-
-},{"95":95}],93:[function(_dereq_,module,exports){
+},{"92":92}],90:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15887,7 +14851,7 @@
'use strict';
-var SyntheticEvent = _dereq_(95);
+var SyntheticEvent = _dereq_(92);
/**
* @interface Event
@@ -15903,21 +14867,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticCompositionEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticCompositionEvent,
- CompositionEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
-
-},{"95":95}],94:[function(_dereq_,module,exports){
+},{"92":92}],91:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15932,7 +14889,7 @@
'use strict';
-var SyntheticMouseEvent = _dereq_(99);
+var SyntheticMouseEvent = _dereq_(96);
/**
* @interface DragEvent
@@ -15948,15 +14905,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
-
-},{"99":99}],95:[function(_dereq_,module,exports){
+},{"96":96}],92:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15971,11 +14927,11 @@
'use strict';
-var PooledClass = _dereq_(28);
+var PooledClass = _dereq_(24);
-var assign = _dereq_(27);
-var emptyFunction = _dereq_(114);
-var getEventTarget = _dereq_(125);
+var assign = _dereq_(23);
+var emptyFunction = _dereq_(136);
+var warning = _dereq_(155);
/**
* @interface Event
@@ -15983,13 +14939,13 @@
*/
var EventInterface = {
type: null,
- target: getEventTarget,
+ target: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
- timeStamp: function(event) {
+ timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
@@ -16013,7 +14969,7 @@
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
-function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
+function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
@@ -16027,13 +14983,15 @@
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
+ if (propName === 'target') {
+ this.target = nativeEventTarget;
+ } else {
this[propName] = nativeEvent[propName];
}
}
+ }
- var defaultPrevented = nativeEvent.defaultPrevented != null ?
- nativeEvent.defaultPrevented :
- nativeEvent.returnValue === false;
+ var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
@@ -16044,9 +15002,16 @@
assign(SyntheticEvent.prototype, {
- preventDefault: function() {
+ preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
+ }
+ if (!event) {
+ return;
+ }
+
if (event.preventDefault) {
event.preventDefault();
} else {
@@ -16055,8 +15020,15 @@
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
- stopPropagation: function() {
+ stopPropagation: function () {
var event = this.nativeEvent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
+ }
+ if (!event) {
+ return;
+ }
+
if (event.stopPropagation) {
event.stopPropagation();
} else {
@@ -16070,7 +15042,7 @@
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
- persist: function() {
+ persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
@@ -16084,7 +15056,7 @@
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
- destructor: function() {
+ destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
@@ -16104,7 +15076,7 @@
* @param {function} Class
* @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function(Class, Interface) {
+SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
@@ -16115,14 +15087,13 @@
Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
- PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
+ PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
-PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
+PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
-
-},{"114":114,"125":125,"27":27,"28":28}],96:[function(_dereq_,module,exports){
+},{"136":136,"155":155,"23":23,"24":24}],93:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16137,7 +15108,7 @@
'use strict';
-var SyntheticUIEvent = _dereq_(101);
+var SyntheticUIEvent = _dereq_(98);
/**
* @interface FocusEvent
@@ -16153,15 +15124,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
-
-},{"101":101}],97:[function(_dereq_,module,exports){
+},{"98":98}],94:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16176,7 +15146,7 @@
'use strict';
-var SyntheticEvent = _dereq_(95);
+var SyntheticEvent = _dereq_(92);
/**
* @interface Event
@@ -16193,21 +15163,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticInputEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticInputEvent,
- InputEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
-
-},{"95":95}],98:[function(_dereq_,module,exports){
+},{"92":92}],95:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16222,11 +15185,11 @@
'use strict';
-var SyntheticUIEvent = _dereq_(101);
+var SyntheticUIEvent = _dereq_(98);
-var getEventCharCode = _dereq_(122);
-var getEventKey = _dereq_(123);
-var getEventModifierState = _dereq_(124);
+var getEventCharCode = _dereq_(111);
+var getEventKey = _dereq_(112);
+var getEventModifierState = _dereq_(113);
/**
* @interface KeyboardEvent
@@ -16243,7 +15206,7 @@
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
- charCode: function(event) {
+ charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
@@ -16254,7 +15217,7 @@
}
return 0;
},
- keyCode: function(event) {
+ keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
@@ -16267,7 +15230,7 @@
}
return 0;
},
- which: function(event) {
+ which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
@@ -16286,15 +15249,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
-
-},{"101":101,"122":122,"123":123,"124":124}],99:[function(_dereq_,module,exports){
+},{"111":111,"112":112,"113":113,"98":98}],96:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16309,10 +15271,10 @@
'use strict';
-var SyntheticUIEvent = _dereq_(101);
-var ViewportMetrics = _dereq_(104);
+var SyntheticUIEvent = _dereq_(98);
+var ViewportMetrics = _dereq_(101);
-var getEventModifierState = _dereq_(124);
+var getEventModifierState = _dereq_(113);
/**
* @interface MouseEvent
@@ -16328,7 +15290,7 @@
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
- button: function(event) {
+ button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
@@ -16343,21 +15305,15 @@
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
- relatedTarget: function(event) {
- return event.relatedTarget || (
- ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
- );
+ relatedTarget: function (event) {
+ return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
- pageX: function(event) {
- return 'pageX' in event ?
- event.pageX :
- event.clientX + ViewportMetrics.currentScrollLeft;
- },
- pageY: function(event) {
- return 'pageY' in event ?
- event.pageY :
- event.clientY + ViewportMetrics.currentScrollTop;
+ pageX: function (event) {
+ return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
+ },
+ pageY: function (event) {
+ return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
@@ -16367,15 +15323,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
-
-},{"101":101,"104":104,"124":124}],100:[function(_dereq_,module,exports){
+},{"101":101,"113":113,"98":98}],97:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16390,9 +15345,9 @@
'use strict';
-var SyntheticUIEvent = _dereq_(101);
+var SyntheticUIEvent = _dereq_(98);
-var getEventModifierState = _dereq_(124);
+var getEventModifierState = _dereq_(113);
/**
* @interface TouchEvent
@@ -16415,15 +15370,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
-
-},{"101":101,"124":124}],101:[function(_dereq_,module,exports){
+},{"113":113,"98":98}],98:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16438,16 +15392,16 @@
'use strict';
-var SyntheticEvent = _dereq_(95);
+var SyntheticEvent = _dereq_(92);
-var getEventTarget = _dereq_(125);
+var getEventTarget = _dereq_(114);
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
- view: function(event) {
+ view: function (event) {
if (event.view) {
return event.view;
}
@@ -16466,7 +15420,7 @@
return window;
}
},
- detail: function(event) {
+ detail: function (event) {
return event.detail || 0;
}
};
@@ -16477,15 +15431,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
-function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
-
-},{"125":125,"95":95}],102:[function(_dereq_,module,exports){
+},{"114":114,"92":92}],99:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16500,28 +15453,24 @@
'use strict';
-var SyntheticMouseEvent = _dereq_(99);
+var SyntheticMouseEvent = _dereq_(96);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
- deltaX: function(event) {
- return (
- 'deltaX' in event ? event.deltaX :
+ deltaX: function (event) {
+ return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
- 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
- );
+ 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
- deltaY: function(event) {
- return (
- 'deltaY' in event ? event.deltaY :
+ deltaY: function (event) {
+ return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
- 'wheelDelta' in event ? -event.wheelDelta : 0
- );
+ 'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
@@ -16538,15 +15487,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
-function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
-
-},{"99":99}],103:[function(_dereq_,module,exports){
+},{"96":96}],100:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16560,7 +15508,7 @@
'use strict';
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
/**
* `Transaction` creates a black box that is able to wrap any method such that
@@ -16631,12 +15579,12 @@
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
- reinitializeTransaction: function() {
+ reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
- if (!this.wrapperInitData) {
- this.wrapperInitData = [];
- } else {
+ if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
+ } else {
+ this.wrapperInitData = [];
}
this._isInTransaction = false;
},
@@ -16649,27 +15597,29 @@
*/
getTransactionWrappers: null,
- isInTransaction: function() {
+ isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
- * need to be safety checked.
+ * need to be safety checked. The optional arguments helps prevent the need
+ * to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
- * @param {Object?=} args... Arguments to pass to the method (optional).
- * Helps prevent need to bind in many cases.
- * @return Return value from `method`.
- */
- perform: function(method, scope, a, b, c, d, e, f) {
- ("production" !== "development" ? invariant(
- !this.isInTransaction(),
- 'Transaction.perform(...): Cannot initialize a transaction when there ' +
- 'is already an outstanding transaction.'
- ) : invariant(!this.isInTransaction()));
+ * @param {Object?=} a Argument to pass to the method.
+ * @param {Object?=} b Argument to pass to the method.
+ * @param {Object?=} c Argument to pass to the method.
+ * @param {Object?=} d Argument to pass to the method.
+ * @param {Object?=} e Argument to pass to the method.
+ * @param {Object?=} f Argument to pass to the method.
+ *
+ * @return {*} Return value from `method`.
+ */
+ perform: function (method, scope, a, b, c, d, e, f) {
+ !!this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
var errorThrown;
var ret;
try {
@@ -16689,8 +15639,7 @@
// by invoking `closeAll`.
try {
this.closeAll(0);
- } catch (err) {
- }
+ } catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
@@ -16703,7 +15652,7 @@
return ret;
},
- initializeAll: function(startIndex) {
+ initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -16713,9 +15662,7 @@
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
- this.wrapperInitData[i] = wrapper.initialize ?
- wrapper.initialize.call(this) :
- null;
+ this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
@@ -16723,8 +15670,7 @@
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
- } catch (err) {
- }
+ } catch (err) {}
}
}
}
@@ -16736,11 +15682,8 @@
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
- closeAll: function(startIndex) {
- ("production" !== "development" ? invariant(
- this.isInTransaction(),
- 'Transaction.closeAll(): Cannot close transaction when none are open.'
- ) : invariant(this.isInTransaction()));
+ closeAll: function (startIndex) {
+ !this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -16763,8 +15706,7 @@
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
- } catch (e) {
- }
+ } catch (e) {}
}
}
}
@@ -16777,15 +15719,14 @@
Mixin: Mixin,
/**
- * Token to look for to determine if an error occured.
+ * Token to look for to determine if an error occurred.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
-
-},{"135":135}],104:[function(_dereq_,module,exports){
+},{"144":144}],101:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16805,7 +15746,7 @@
currentScrollTop: 0,
- refreshScrollValues: function(scrollPosition) {
+ refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
@@ -16813,8 +15754,7 @@
};
module.exports = ViewportMetrics;
-
-},{}],105:[function(_dereq_,module,exports){
+},{}],102:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -16828,7 +15768,7 @@
'use strict';
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
/**
*
@@ -16845,10 +15785,7 @@
*/
function accumulateInto(current, next) {
- ("production" !== "development" ? invariant(
- next != null,
- 'accumulateInto(...): Accumulated items must not be null or undefined.'
- ) : invariant(next != null));
+ !(next != null) ? "development" !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
if (current == null) {
return next;
}
@@ -16877,8 +15814,7 @@
}
module.exports = accumulateInto;
-
-},{"135":135}],106:[function(_dereq_,module,exports){
+},{"144":144}],103:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16890,147 +15826,38 @@
* @providesModule adler32
*/
-/* jslint bitwise:true */
-
'use strict';
var MOD = 65521;
-// This is a clean-room implementation of adler32 designed for detecting
-// if markup is not what we expect it to be. It does not need to be
-// cryptographically strong, only reasonably good at detecting if markup
-// generated on the server is different than that on the client.
+// adler32 is not cryptographically strong, and is only used to sanity check that
+// markup generated on the server matches the markup generated on the client.
+// This implementation (a modified version of the SheetJS version) has been optimized
+// for our use case, at the expense of conforming to the adler32 specification
+// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
- for (var i = 0; i < data.length; i++) {
- a = (a + data.charCodeAt(i)) % MOD;
- b = (b + a) % MOD;
- }
- return a | (b << 16);
+ var i = 0;
+ var l = data.length;
+ var m = l & ~0x3;
+ while (i < m) {
+ for (; i < Math.min(i + 4096, m); i += 4) {
+ b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
+ }
+ a %= MOD;
+ b %= MOD;
+ }
+ for (; i < l; i++) {
+ b += a += data.charCodeAt(i);
+ }
+ a %= MOD;
+ b %= MOD;
+ return a | b << 16;
}
module.exports = adler32;
-
-},{}],107:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule camelize
- * @typechecks
- */
-
-var _hyphenPattern = /-(.)/g;
-
-/**
- * Camelcases a hyphenated string, for example:
- *
- * > camelize('background-color')
- * < "backgroundColor"
- *
- * @param {string} string
- * @return {string}
- */
-function camelize(string) {
- return string.replace(_hyphenPattern, function(_, character) {
- return character.toUpperCase();
- });
-}
-
-module.exports = camelize;
-
-},{}],108:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule camelizeStyleName
- * @typechecks
- */
-
-"use strict";
-
-var camelize = _dereq_(107);
-
-var msPattern = /^-ms-/;
-
-/**
- * Camelcases a hyphenated CSS property name, for example:
- *
- * > camelizeStyleName('background-color')
- * < "backgroundColor"
- * > camelizeStyleName('-moz-transition')
- * < "MozTransition"
- * > camelizeStyleName('-ms-transition')
- * < "msTransition"
- *
- * As Andi Smith suggests
- * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
- * is converted to lowercase `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function camelizeStyleName(string) {
- return camelize(string.replace(msPattern, 'ms-'));
-}
-
-module.exports = camelizeStyleName;
-
-},{"107":107}],109:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule containsNode
- * @typechecks
- */
-
-var isTextNode = _dereq_(139);
-
-/*jslint bitwise:true */
-
-/**
- * Checks if a given DOM node contains or is another DOM node.
- *
- * @param {?DOMNode} outerNode Outer DOM node.
- * @param {?DOMNode} innerNode Inner DOM node.
- * @return {boolean} True if `outerNode` contains or is `innerNode`.
- */
-function containsNode(outerNode, innerNode) {
- if (!outerNode || !innerNode) {
- return false;
- } else if (outerNode === innerNode) {
- return true;
- } else if (isTextNode(outerNode)) {
- return false;
- } else if (isTextNode(innerNode)) {
- return containsNode(outerNode, innerNode.parentNode);
- } else if (outerNode.contains) {
- return outerNode.contains(innerNode);
- } else if (outerNode.compareDocumentPosition) {
- return !!(outerNode.compareDocumentPosition(innerNode) & 16);
- } else {
- return false;
- }
-}
-
-module.exports = containsNode;
-
-},{"139":139}],110:[function(_dereq_,module,exports){
+},{}],104:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17039,232 +15866,23 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule createArrayFromMixed
- * @typechecks
- */
-
-var toArray = _dereq_(152);
-
-/**
- * Perform a heuristic test to determine if an object is "array-like".
- *
- * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
- * Joshu replied: "Mu."
- *
- * This function determines if its argument has "array nature": it returns
- * true if the argument is an actual array, an `arguments' object, or an
- * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
- *
- * It will return false for other array-like objects like Filelist.
- *
- * @param {*} obj
- * @return {boolean}
- */
-function hasArrayNature(obj) {
- return (
- // not null/false
- !!obj &&
- // arrays are objects, NodeLists are functions in Safari
- (typeof obj == 'object' || typeof obj == 'function') &&
- // quacks like an array
- ('length' in obj) &&
- // not window
- !('setInterval' in obj) &&
- // no DOM node should be considered an array-like
- // a 'select' element has 'length' and 'item' properties on IE8
- (typeof obj.nodeType != 'number') &&
- (
- // a real array
- (// HTMLCollection/NodeList
- (Array.isArray(obj) ||
- // arguments
- ('callee' in obj) || 'item' in obj))
- )
- );
-}
-
-/**
- * Ensure that the argument is an array by wrapping it in an array if it is not.
- * Creates a copy of the argument if it is already an array.
- *
- * This is mostly useful idiomatically:
- *
- * var createArrayFromMixed = require('createArrayFromMixed');
- *
- * function takesOneOrMoreThings(things) {
- * things = createArrayFromMixed(things);
- * ...
- * }
- *
- * This allows you to treat `things' as an array, but accept scalars in the API.
- *
- * If you need to convert an array-like object, like `arguments`, into an array
- * use toArray instead.
- *
- * @param {*} obj
- * @return {array}
- */
-function createArrayFromMixed(obj) {
- if (!hasArrayNature(obj)) {
- return [obj];
- } else if (Array.isArray(obj)) {
- return obj.slice();
- } else {
- return toArray(obj);
- }
-}
-
-module.exports = createArrayFromMixed;
-
-},{"152":152}],111:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createFullPageComponent
- * @typechecks
+ * @providesModule canDefineProperty
*/
'use strict';
-// Defeat circular references by requiring this directly.
-var ReactClass = _dereq_(33);
-var ReactElement = _dereq_(57);
-
-var invariant = _dereq_(135);
-
-/**
- * Create a component that will throw an exception when unmounted.
- *
- * Components like <html> <head> and <body> can't be removed or added
- * easily in a cross-browser way, however it's valuable to be able to
- * take advantage of React's reconciliation for styling and <title>
- * management. So we just document it and throw in dangerous cases.
- *
- * @param {string} tag The tag to wrap
- * @return {function} convenience constructor of new component
- */
-function createFullPageComponent(tag) {
- var elementFactory = ReactElement.createFactory(tag);
-
- var FullPageComponent = ReactClass.createClass({
- tagName: tag.toUpperCase(),
- displayName: 'ReactFullPageComponent' + tag,
-
- componentWillUnmount: function() {
- ("production" !== "development" ? invariant(
- false,
- '%s tried to unmount. Because of cross-browser quirks it is ' +
- 'impossible to unmount some top-level components (eg <html>, <head>, ' +
- 'and <body>) reliably and efficiently. To fix this, have a single ' +
- 'top-level component that never unmounts render these elements.',
- this.constructor.displayName
- ) : invariant(false));
- },
-
- render: function() {
- return elementFactory(this.props);
- }
- });
-
- return FullPageComponent;
-}
-
-module.exports = createFullPageComponent;
-
-},{"135":135,"33":33,"57":57}],112:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createNodesFromMarkup
- * @typechecks
- */
-
-/*jslint evil: true, sub: true */
-
-var ExecutionEnvironment = _dereq_(21);
-
-var createArrayFromMixed = _dereq_(110);
-var getMarkupWrap = _dereq_(127);
-var invariant = _dereq_(135);
-
-/**
- * Dummy container used to render all markup.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Pattern used by `getNodeName`.
- */
-var nodeNamePattern = /^\s*<(\w+)/;
-
-/**
- * Extracts the `nodeName` of the first element in a string of markup.
- *
- * @param {string} markup String of markup.
- * @return {?string} Node name of the supplied markup.
- */
-function getNodeName(markup) {
- var nodeNameMatch = markup.match(nodeNamePattern);
- return nodeNameMatch && nodeNameMatch[1].toLowerCase();
-}
-
-/**
- * Creates an array containing the nodes rendered from the supplied markup. The
- * optionally supplied `handleScript` function will be invoked once for each
- * <script> element that is rendered. If no `handleScript` function is supplied,
- * an exception is thrown if any <script> elements are rendered.
- *
- * @param {string} markup A string of valid HTML markup.
- * @param {?function} handleScript Invoked once for each rendered <script>.
- * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
- */
-function createNodesFromMarkup(markup, handleScript) {
- var node = dummyNode;
- ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
- var nodeName = getNodeName(markup);
-
- var wrap = nodeName && getMarkupWrap(nodeName);
- if (wrap) {
- node.innerHTML = wrap[1] + markup + wrap[2];
-
- var wrapDepth = wrap[0];
- while (wrapDepth--) {
- node = node.lastChild;
- }
- } else {
- node.innerHTML = markup;
- }
-
- var scripts = node.getElementsByTagName('script');
- if (scripts.length) {
- ("production" !== "development" ? invariant(
- handleScript,
- 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
- ) : invariant(handleScript));
- createArrayFromMixed(scripts).forEach(handleScript);
- }
-
- var nodes = createArrayFromMixed(node.childNodes);
- while (node.lastChild) {
- node.removeChild(node.lastChild);
+var canDefineProperty = false;
+if ("development" !== 'production') {
+ try {
+ Object.defineProperty({}, 'x', { get: function () {} });
+ canDefineProperty = true;
+ } catch (x) {
+ // IE will fail on defineProperty
}
- return nodes;
}
-module.exports = createNodesFromMarkup;
-
-},{"110":110,"127":127,"135":135,"21":21}],113:[function(_dereq_,module,exports){
+module.exports = canDefineProperty;
+},{}],105:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17309,8 +15927,7 @@
}
var isNonNumeric = isNaN(value);
- if (isNonNumeric || value === 0 ||
- isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
+ if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
@@ -17321,8 +15938,7 @@
}
module.exports = dangerousStyleValue;
-
-},{"4":4}],114:[function(_dereq_,module,exports){
+},{"4":4}],106:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17331,54 +15947,47 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule emptyFunction
- */
-
-function makeEmptyFunction(arg) {
- return function() {
- return arg;
- };
-}
-
-/**
- * This function accepts and discards inputs; it has no side effects. This is
- * primarily useful idiomatically for overridable function endpoints which
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
+ * @providesModule deprecated
*/
-function emptyFunction() {}
-emptyFunction.thatReturns = makeEmptyFunction;
-emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
-emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
-emptyFunction.thatReturnsNull = makeEmptyFunction(null);
-emptyFunction.thatReturnsThis = function() { return this; };
-emptyFunction.thatReturnsArgument = function(arg) { return arg; };
+'use strict';
-module.exports = emptyFunction;
+var assign = _dereq_(23);
+var warning = _dereq_(155);
-},{}],115:[function(_dereq_,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
+ * This will log a single deprecation notice per function and forward the call
+ * on to the new API.
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule emptyObject
+ * @param {string} fnName The name of the function
+ * @param {string} newModule The module that fn will exist in
+ * @param {string} newPackage The module that fn will exist in
+ * @param {*} ctx The context this forwarded call should run in
+ * @param {function} fn The function to forward on to
+ * @return {function} The function that will warn once and then call fn
*/
+function deprecated(fnName, newModule, newPackage, ctx, fn) {
+ var warned = false;
+ if ("development" !== 'production') {
+ var newFn = function () {
+ "development" !== 'production' ? warning(warned,
+ // Require examples in this string must be split to prevent React's
+ // build tools from mistaking them for real requires.
+ // Otherwise the build tools will attempt to build a '%s' module.
+ 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
+ warned = true;
+ return fn.apply(ctx, arguments);
+ };
+ // We need to make sure all properties of the original fn are copied over.
+ // In particular, this is needed to support PropTypes
+ return assign(newFn, fn);
+ }
-"use strict";
-
-var emptyObject = {};
-
-if ("production" !== "development") {
- Object.freeze(emptyObject);
+ return fn;
}
-module.exports = emptyObject;
-
-},{}],116:[function(_dereq_,module,exports){
+module.exports = deprecated;
+},{"155":155,"23":23}],107:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17417,8 +16026,7 @@
}
module.exports = escapeTextContentForBrowser;
-
-},{}],117:[function(_dereq_,module,exports){
+},{}],108:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17433,63 +16041,42 @@
'use strict';
-var ReactCurrentOwner = _dereq_(39);
-var ReactInstanceMap = _dereq_(67);
-var ReactMount = _dereq_(70);
-
-var invariant = _dereq_(135);
-var isNode = _dereq_(137);
-var warning = _dereq_(154);
+var ReactCurrentOwner = _dereq_(34);
+var ReactInstanceMap = _dereq_(62);
+var ReactMount = _dereq_(65);
+
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
- * @return {DOMElement} The root node of this element.
+ * @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
- ("production" !== "development" ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
+ "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
- if (isNode(componentOrElement)) {
+ if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
- ("production" !== "development" ? invariant(
- componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function',
- 'Component (with keys: %s) contains `render` method ' +
- 'but is not mounted in the DOM',
- Object.keys(componentOrElement)
- ) : invariant(componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function'));
- ("production" !== "development" ? invariant(
- false,
- 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
- Object.keys(componentOrElement)
- ) : invariant(false));
+ !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? "development" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
+ !false ? "development" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;
-
-},{"135":135,"137":137,"154":154,"39":39,"67":67,"70":70}],118:[function(_dereq_,module,exports){
+},{"144":144,"155":155,"34":34,"62":62,"65":65}],109:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17503,8 +16090,8 @@
'use strict';
-var traverseAllChildren = _dereq_(153);
-var warning = _dereq_(154);
+var traverseAllChildren = _dereq_(127);
+var warning = _dereq_(155);
/**
* @param {function} traverseContext Context passed through traversal.
@@ -17514,15 +16101,9 @@
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
- var keyUnique = !result.hasOwnProperty(name);
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- keyUnique,
- 'flattenChildren(...): Encountered two children with the same key, ' +
- '`%s`. Child keys must be unique; when two children share a key, only ' +
- 'the first child will be used.',
- name
- ) : null);
+ var keyUnique = result[name] === undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (keyUnique && child != null) {
result[name] = child;
@@ -17544,37 +16125,7 @@
}
module.exports = flattenChildren;
-
-},{"153":153,"154":154}],119:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule focusNode
- */
-
-"use strict";
-
-/**
- * @param {DOMElement} node input/textarea to focus
- */
-function focusNode(node) {
- // IE8 can throw "Can't move focus to the control because it is invisible,
- // not enabled, or of a type that does not accept the focus." for all kinds of
- // reasons that are too expensive and fragile to test.
- try {
- node.focus();
- } catch(e) {
- }
-}
-
-module.exports = focusNode;
-
-},{}],120:[function(_dereq_,module,exports){
+},{"127":127,"155":155}],110:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17589,13 +16140,13 @@
'use strict';
/**
- * @param {array} an "accumulation" of items which is either an Array or
+ * @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
-var forEachAccumulated = function(arr, cb, scope) {
+var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
@@ -17604,37 +16155,7 @@
};
module.exports = forEachAccumulated;
-
-},{}],121:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getActiveElement
- * @typechecks
- */
-
-/**
- * Same as document.activeElement but wraps in a try-catch block. In IE it is
- * not safe to call document.activeElement if there is nothing focused.
- *
- * The activeElement will be null only if the document body is not yet defined.
- */
-function getActiveElement() /*?DOMElement*/ {
- try {
- return document.activeElement || document.body;
- } catch (e) {
- return document.body;
- }
-}
-
-module.exports = getActiveElement;
-
-},{}],122:[function(_dereq_,module,exports){
+},{}],111:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17657,7 +16178,7 @@
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
- * @return {string} Normalized `charCode` property.
+ * @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
@@ -17685,8 +16206,7 @@
}
module.exports = getEventCharCode;
-
-},{}],123:[function(_dereq_,module,exports){
+},{}],112:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17701,7 +16221,7 @@
'use strict';
-var getEventCharCode = _dereq_(122);
+var getEventCharCode = _dereq_(111);
/**
* Normalization of deprecated HTML5 `key` values
@@ -17790,8 +16310,7 @@
}
module.exports = getEventKey;
-
-},{"122":122}],124:[function(_dereq_,module,exports){
+},{"111":111}],113:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17822,7 +16341,6 @@
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
- /*jshint validthis:true */
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
@@ -17837,8 +16355,7 @@
}
module.exports = getEventModifierState;
-
-},{}],125:[function(_dereq_,module,exports){
+},{}],114:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17868,8 +16385,7 @@
}
module.exports = getEventTarget;
-
-},{}],126:[function(_dereq_,module,exports){
+},{}],115:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17903,134 +16419,14 @@
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
- var iteratorFn = maybeIterable && (
- (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
- );
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
-
-},{}],127:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getMarkupWrap
- */
-
-var ExecutionEnvironment = _dereq_(21);
-
-var invariant = _dereq_(135);
-
-/**
- * Dummy container used to detect which wraps are necessary.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Some browsers cannot use `innerHTML` to render certain elements standalone,
- * so we wrap them, render the wrapped nodes, then extract the desired node.
- *
- * In IE8, certain elements cannot render alone, so wrap all elements ('*').
- */
-var shouldWrap = {
- // Force wrapping for SVG elements because if they get created inside a <div>,
- // they will be initialized in the wrong namespace (and will not display).
- 'circle': true,
- 'clipPath': true,
- 'defs': true,
- 'ellipse': true,
- 'g': true,
- 'line': true,
- 'linearGradient': true,
- 'path': true,
- 'polygon': true,
- 'polyline': true,
- 'radialGradient': true,
- 'rect': true,
- 'stop': true,
- 'text': true
-};
-
-var selectWrap = [1, '<select multiple="true">', '</select>'];
-var tableWrap = [1, '<table>', '</table>'];
-var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
-
-var svgWrap = [1, '<svg>', '</svg>'];
-
-var markupWrap = {
- '*': [1, '?<div>', '</div>'],
-
- 'area': [1, '<map>', '</map>'],
- 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
- 'legend': [1, '<fieldset>', '</fieldset>'],
- 'param': [1, '<object>', '</object>'],
- 'tr': [2, '<table><tbody>', '</tbody></table>'],
-
- 'optgroup': selectWrap,
- 'option': selectWrap,
-
- 'caption': tableWrap,
- 'colgroup': tableWrap,
- 'tbody': tableWrap,
- 'tfoot': tableWrap,
- 'thead': tableWrap,
-
- 'td': trWrap,
- 'th': trWrap,
-
- 'circle': svgWrap,
- 'clipPath': svgWrap,
- 'defs': svgWrap,
- 'ellipse': svgWrap,
- 'g': svgWrap,
- 'line': svgWrap,
- 'linearGradient': svgWrap,
- 'path': svgWrap,
- 'polygon': svgWrap,
- 'polyline': svgWrap,
- 'radialGradient': svgWrap,
- 'rect': svgWrap,
- 'stop': svgWrap,
- 'text': svgWrap
-};
-
-/**
- * Gets the markup wrap configuration for the supplied `nodeName`.
- *
- * NOTE: This lazily detects which wraps are necessary for the current browser.
- *
- * @param {string} nodeName Lowercase `nodeName`.
- * @return {?array} Markup wrap configuration, if applicable.
- */
-function getMarkupWrap(nodeName) {
- ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
- if (!markupWrap.hasOwnProperty(nodeName)) {
- nodeName = '*';
- }
- if (!shouldWrap.hasOwnProperty(nodeName)) {
- if (nodeName === '*') {
- dummyNode.innerHTML = '<link />';
- } else {
- dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
- }
- shouldWrap[nodeName] = !dummyNode.firstChild;
- }
- return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
-}
-
-
-module.exports = getMarkupWrap;
-
-},{"135":135,"21":21}],128:[function(_dereq_,module,exports){
+},{}],116:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18104,43 +16500,7 @@
}
module.exports = getNodeForCharacterOffset;
-
-},{}],129:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getReactRootElementInContainer
- */
-
-'use strict';
-
-var DOC_NODE_TYPE = 9;
-
-/**
- * @param {DOMElement|DOMDocument} container DOM element that may contain
- * a React component
- * @return {?*} DOM element that may have the reactRoot ID, or null.
- */
-function getReactRootElementInContainer(container) {
- if (!container) {
- return null;
- }
-
- if (container.nodeType === DOC_NODE_TYPE) {
- return container.documentElement;
- } else {
- return container.firstChild;
- }
-}
-
-module.exports = getReactRootElementInContainer;
-
-},{}],130:[function(_dereq_,module,exports){
+},{}],117:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18154,7 +16514,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(21);
+var ExecutionEnvironment = _dereq_(130);
var contentKey = null;
@@ -18168,130 +16528,13 @@
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
- contentKey = 'textContent' in document.documentElement ?
- 'textContent' :
- 'innerText';
+ contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
-
-},{"21":21}],131:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getUnboundedScrollPosition
- * @typechecks
- */
-
-"use strict";
-
-/**
- * Gets the scroll position of the supplied element or window.
- *
- * The return values are unbounded, unlike `getScrollPosition`. This means they
- * may be negative or exceed the element boundaries (which is possible using
- * inertial scrolling).
- *
- * @param {DOMWindow|DOMElement} scrollable
- * @return {object} Map with `x` and `y` keys.
- */
-function getUnboundedScrollPosition(scrollable) {
- if (scrollable === window) {
- return {
- x: window.pageXOffset || document.documentElement.scrollLeft,
- y: window.pageYOffset || document.documentElement.scrollTop
- };
- }
- return {
- x: scrollable.scrollLeft,
- y: scrollable.scrollTop
- };
-}
-
-module.exports = getUnboundedScrollPosition;
-
-},{}],132:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenate
- * @typechecks
- */
-
-var _uppercasePattern = /([A-Z])/g;
-
-/**
- * Hyphenates a camelcased string, for example:
- *
- * > hyphenate('backgroundColor')
- * < "background-color"
- *
- * For CSS style names, use `hyphenateStyleName` instead which works properly
- * with all vendor prefixes, including `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenate(string) {
- return string.replace(_uppercasePattern, '-$1').toLowerCase();
-}
-
-module.exports = hyphenate;
-
-},{}],133:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenateStyleName
- * @typechecks
- */
-
-"use strict";
-
-var hyphenate = _dereq_(132);
-
-var msPattern = /^ms-/;
-
-/**
- * Hyphenates a camelcased CSS property name, for example:
- *
- * > hyphenateStyleName('backgroundColor')
- * < "background-color"
- * > hyphenateStyleName('MozTransition')
- * < "-moz-transition"
- * > hyphenateStyleName('msTransition')
- * < "-ms-transition"
- *
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
- * is converted to `-ms-`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenateStyleName(string) {
- return hyphenate(string).replace(msPattern, '-ms-');
-}
-
-module.exports = hyphenateStyleName;
-
-},{"132":132}],134:[function(_dereq_,module,exports){
+},{"130":130}],118:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18306,23 +16549,29 @@
'use strict';
-var ReactCompositeComponent = _dereq_(37);
-var ReactEmptyComponent = _dereq_(59);
-var ReactNativeComponent = _dereq_(73);
-
-var assign = _dereq_(27);
-var invariant = _dereq_(135);
-var warning = _dereq_(154);
+var ReactCompositeComponent = _dereq_(33);
+var ReactEmptyComponent = _dereq_(54);
+var ReactNativeComponent = _dereq_(68);
+
+var assign = _dereq_(23);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
// To avoid a cyclic dependency, we create the final class in this module
-var ReactCompositeComponentWrapper = function() { };
-assign(
- ReactCompositeComponentWrapper.prototype,
- ReactCompositeComponent.Mixin,
- {
+var ReactCompositeComponentWrapper = function () {};
+assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
+});
+
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
}
-);
+ }
+ return '';
+}
/**
* Check if the type reference is a known internal type. I.e. not a user
@@ -18332,49 +16581,31 @@
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
- return (
- typeof type === 'function' &&
- typeof type.prototype !== 'undefined' &&
- typeof type.prototype.mountComponent === 'function' &&
- typeof type.prototype.receiveComponent === 'function'
- );
+ return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
- * @param {*} parentCompositeType The composite type that resolved this.
* @return {object} A new instance of the element's constructor.
* @protected
*/
-function instantiateReactComponent(node, parentCompositeType) {
+function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
- node = ReactEmptyComponent.emptyElement;
- }
-
- if (typeof node === 'object') {
+ instance = new ReactEmptyComponent(instantiateReactComponent);
+ } else if (typeof node === 'object') {
var element = node;
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- element && (typeof element.type === 'function' ||
- typeof element.type === 'string'),
- 'Only functions or strings can be mounted as React components.'
- ) : null);
- }
+ !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? "development" !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
// Special case string values
- if (parentCompositeType === element.type &&
- typeof element.type === 'string') {
- // Avoid recursion if the wrapper renders itself.
+ if (typeof element.type === 'string') {
instance = ReactNativeComponent.createInternalComponent(element);
- // All native components are currently wrapped in a composite so we're
- // safe to assume that this is what we should instantiate.
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
- // represenations. I.e. ART. Once those are updated to use the string
+ // representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
} else {
@@ -18383,21 +16614,11 @@
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
- ("production" !== "development" ? invariant(
- false,
- 'Encountered invalid React node of type %s',
- typeof node
- ) : invariant(false));
+ !false ? "development" !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
}
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- typeof instance.construct === 'function' &&
- typeof instance.mountComponent === 'function' &&
- typeof instance.receiveComponent === 'function' &&
- typeof instance.unmountComponent === 'function',
- 'Only React Components can be mounted.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
}
// Sets up the instance. This can probably just move into the constructor now.
@@ -18409,14 +16630,14 @@
instance._mountIndex = 0;
instance._mountImage = null;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
instance._isOwnerNecessary = false;
instance._warnedAboutRefsInRender = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
- if ("production" !== "development") {
+ if ("development" !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
@@ -18426,63 +16647,7 @@
}
module.exports = instantiateReactComponent;
-
-},{"135":135,"154":154,"27":27,"37":37,"59":59,"73":73}],135:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule invariant
- */
-
-"use strict";
-
-/**
- * Use invariant() to assert state which your program assumes to be true.
- *
- * Provide sprintf-style format (only %s is supported) and arguments
- * to provide information about what broke and what you were
- * expecting.
- *
- * The invariant message will be stripped in production, but the invariant
- * will remain to ensure logic does not differ in production.
- */
-
-var invariant = function(condition, format, a, b, c, d, e, f) {
- if ("production" !== "development") {
- if (format === undefined) {
- throw new Error('invariant requires an error message argument');
- }
- }
-
- if (!condition) {
- var error;
- if (format === undefined) {
- error = new Error(
- 'Minified exception occurred; use the non-minified dev environment ' +
- 'for the full error message and additional helpful warnings.'
- );
- } else {
- var args = [a, b, c, d, e, f];
- var argIndex = 0;
- error = new Error(
- 'Invariant Violation: ' +
- format.replace(/%s/g, function() { return args[argIndex++]; })
- );
- }
-
- error.framesToPop = 1; // we don't care about invariant's own frame
- throw error;
- }
-};
-
-module.exports = invariant;
-
-},{}],136:[function(_dereq_,module,exports){
+},{"144":144,"155":155,"23":23,"33":33,"54":54,"68":68}],119:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18496,13 +16661,11 @@
'use strict';
-var ExecutionEnvironment = _dereq_(21);
+var ExecutionEnvironment = _dereq_(130);
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
- useHasFeature =
- document.implementation &&
- document.implementation.hasFeature &&
+ useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
@@ -18523,13 +16686,12 @@
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
- if (!ExecutionEnvironment.canUseDOM ||
- capture && !('addEventListener' in document)) {
+ if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
- var isSupported = eventName in document;
+ var isSupported = (eventName in document);
if (!isSupported) {
var element = document.createElement('div');
@@ -18546,35 +16708,7 @@
}
module.exports = isEventSupported;
-
-},{"21":21}],137:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isNode
- * @typechecks
- */
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM node.
- */
-function isNode(object) {
- return !!(object && (
- ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
- typeof object.nodeType === 'number' &&
- typeof object.nodeName === 'string'))
- ));
-}
-
-module.exports = isNode;
-
-},{}],138:[function(_dereq_,module,exports){
+},{"130":130}],120:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18610,214 +16744,12 @@
};
function isTextInputElement(elem) {
- return elem && (
- (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
- );
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
}
module.exports = isTextInputElement;
-
-},{}],139:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isTextNode
- * @typechecks
- */
-
-var isNode = _dereq_(137);
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM text node.
- */
-function isTextNode(object) {
- return isNode(object) && object.nodeType == 3;
-}
-
-module.exports = isTextNode;
-
-},{"137":137}],140:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyMirror
- * @typechecks static-only
- */
-
-'use strict';
-
-var invariant = _dereq_(135);
-
-/**
- * Constructs an enumeration with keys equal to their value.
- *
- * For example:
- *
- * var COLORS = keyMirror({blue: null, red: null});
- * var myColor = COLORS.blue;
- * var isColorValid = !!COLORS[myColor];
- *
- * The last line could not be performed if the values of the generated enum were
- * not equal to their keys.
- *
- * Input: {key1: val1, key2: val2}
- * Output: {key1: key1, key2: key2}
- *
- * @param {object} obj
- * @return {object}
- */
-var keyMirror = function(obj) {
- var ret = {};
- var key;
- ("production" !== "development" ? invariant(
- obj instanceof Object && !Array.isArray(obj),
- 'keyMirror(...): Argument must be an object.'
- ) : invariant(obj instanceof Object && !Array.isArray(obj)));
- for (key in obj) {
- if (!obj.hasOwnProperty(key)) {
- continue;
- }
- ret[key] = key;
- }
- return ret;
-};
-
-module.exports = keyMirror;
-
-},{"135":135}],141:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyOf
- */
-
-/**
- * Allows extraction of a minified key. Let's the build system minify keys
- * without loosing the ability to dynamically use key strings as values
- * themselves. Pass in an object with a single key/val pair and it will return
- * you the string key of that single record. Suppose you want to grab the
- * value for a key 'className' inside of an object. Key/val minification may
- * have aliased that key to be 'xa12'. keyOf({className: null}) will return
- * 'xa12' in that case. Resolve keys you want to use once at startup time, then
- * reuse those resolutions.
- */
-var keyOf = function(oneKeyObj) {
- var key;
- for (key in oneKeyObj) {
- if (!oneKeyObj.hasOwnProperty(key)) {
- continue;
- }
- return key;
- }
- return null;
-};
-
-
-module.exports = keyOf;
-
-},{}],142:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule mapObject
- */
-
-'use strict';
-
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-/**
- * Executes the provided `callback` once for each enumerable own property in the
- * object and constructs a new object from the results. The `callback` is
- * invoked with three arguments:
- *
- * - the property value
- * - the property name
- * - the object being traversed
- *
- * Properties that are added after the call to `mapObject` will not be visited
- * by `callback`. If the values of existing properties are changed, the value
- * passed to `callback` will be the value at the time `mapObject` visits them.
- * Properties that are deleted before being visited are not visited.
- *
- * @grep function objectMap()
- * @grep function objMap()
- *
- * @param {?object} object
- * @param {function} callback
- * @param {*} context
- * @return {?object}
- */
-function mapObject(object, callback, context) {
- if (!object) {
- return null;
- }
- var result = {};
- for (var name in object) {
- if (hasOwnProperty.call(object, name)) {
- result[name] = callback.call(context, object[name], name, object);
- }
- }
- return result;
-}
-
-module.exports = mapObject;
-
-},{}],143:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule memoizeStringOnly
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Memoizes the return value of a function that accepts one string argument.
- *
- * @param {function} callback
- * @return {function}
- */
-function memoizeStringOnly(callback) {
- var cache = {};
- return function(string) {
- if (!cache.hasOwnProperty(string)) {
- cache[string] = callback.call(this, string);
- }
- return cache[string];
- };
-}
-
-module.exports = memoizeStringOnly;
-
-},{}],144:[function(_dereq_,module,exports){
+},{}],121:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18830,9 +16762,9 @@
*/
'use strict';
-var ReactElement = _dereq_(57);
+var ReactElement = _dereq_(52);
-var invariant = _dereq_(135);
+var invariant = _dereq_(144);
/**
* Returns the first child in a collection of children and verifies that there
@@ -18846,16 +16778,12 @@
* structure.
*/
function onlyChild(children) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(children),
- 'onlyChild must be passed a children with exactly one child.'
- ) : invariant(ReactElement.isValidElement(children)));
+ !ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
return children;
}
module.exports = onlyChild;
-
-},{"135":135,"57":57}],145:[function(_dereq_,module,exports){
+},{"144":144,"52":52}],122:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18864,54 +16792,25 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule performance
- * @typechecks
+ * @providesModule quoteAttributeValueForBrowser
*/
-"use strict";
-
-var ExecutionEnvironment = _dereq_(21);
-
-var performance;
-
-if (ExecutionEnvironment.canUseDOM) {
- performance =
- window.performance ||
- window.msPerformance ||
- window.webkitPerformance;
-}
+'use strict';
-module.exports = performance || {};
+var escapeTextContentForBrowser = _dereq_(107);
-},{"21":21}],146:[function(_dereq_,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
+ * Escapes attribute value to prevent scripting attacks.
*
- * @providesModule performanceNow
- * @typechecks
- */
-
-var performance = _dereq_(145);
-
-/**
- * Detect if we can use `window.performance.now()` and gracefully fallback to
- * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
- * because of Facebook's testing infrastructure.
+ * @param {*} value Value to escape.
+ * @return {string} An escaped string.
*/
-if (!performance || !performance.now) {
- performance = Date;
+function quoteAttributeValueForBrowser(value) {
+ return '"' + escapeTextContentForBrowser(value) + '"';
}
-var performanceNow = performance.now.bind(performance);
-
-module.exports = performanceNow;
-
-},{"145":145}],147:[function(_dereq_,module,exports){
+module.exports = quoteAttributeValueForBrowser;
+},{"107":107}],123:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18920,26 +16819,15 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule quoteAttributeValueForBrowser
- */
+* @providesModule renderSubtreeIntoContainer
+*/
'use strict';
-var escapeTextContentForBrowser = _dereq_(116);
+var ReactMount = _dereq_(65);
-/**
- * Escapes attribute value to prevent scripting attacks.
- *
- * @param {*} value Value to escape.
- * @return {string} An escaped string.
- */
-function quoteAttributeValueForBrowser(value) {
- return '"' + escapeTextContentForBrowser(value) + '"';
-}
-
-module.exports = quoteAttributeValueForBrowser;
-
-},{"116":116}],148:[function(_dereq_,module,exports){
+module.exports = ReactMount.renderSubtreeIntoContainer;
+},{"65":65}],124:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18955,7 +16843,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(21);
+var ExecutionEnvironment = _dereq_(130);
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
@@ -18968,14 +16856,14 @@
* @param {string} html
* @internal
*/
-var setInnerHTML = function(node, html) {
+var setInnerHTML = function (node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
- setInnerHTML = function(node, html) {
- MSApp.execUnsafeLocalFunction(function() {
+ setInnerHTML = function (node, html) {
+ MSApp.execUnsafeLocalFunction(function () {
node.innerHTML = html;
});
};
@@ -18991,7 +16879,7 @@
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
- setInnerHTML = function(node, html) {
+ setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
@@ -19005,11 +16893,14 @@
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
- if (WHITESPACE_TEST.test(html) ||
- html[0] === '<' && NONVISIBLE_TEST.test(html)) {
+ if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
- node.innerHTML = '\uFEFF' + html;
+ // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
+ // in hopes that this is preserved even if "\uFEFF" is transformed to
+ // the actual Unicode character (by Babel, for example).
+ // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
+ node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.
@@ -19027,8 +16918,7 @@
}
module.exports = setInnerHTML;
-
-},{"21":21}],149:[function(_dereq_,module,exports){
+},{"130":130}],125:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19042,9 +16932,9 @@
'use strict';
-var ExecutionEnvironment = _dereq_(21);
-var escapeTextContentForBrowser = _dereq_(116);
-var setInnerHTML = _dereq_(148);
+var ExecutionEnvironment = _dereq_(130);
+var escapeTextContentForBrowser = _dereq_(107);
+var setInnerHTML = _dereq_(124);
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
@@ -19056,65 +16946,20 @@
* @param {string} text
* @internal
*/
-var setTextContent = function(node, text) {
+var setTextContent = function (node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
- setTextContent = function(node, text) {
+ setTextContent = function (node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
-
-},{"116":116,"148":148,"21":21}],150:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule shallowEqual
- */
-
-'use strict';
-
-/**
- * Performs equality by iterating through keys on an object and returning
- * false when any key has values which are not strictly equal between
- * objA and objB. Returns true when the values of all keys are strictly equal.
- *
- * @return {boolean}
- */
-function shallowEqual(objA, objB) {
- if (objA === objB) {
- return true;
- }
- var key;
- // Test for A's keys different from B.
- for (key in objA) {
- if (objA.hasOwnProperty(key) &&
- (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
- return false;
- }
- }
- // Test for B's keys missing from A.
- for (key in objB) {
- if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
- return false;
- }
- }
- return true;
-}
-
-module.exports = shallowEqual;
-
-},{}],151:[function(_dereq_,module,exports){
+},{"107":107,"124":124,"130":130}],126:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19129,8 +16974,6 @@
'use strict';
-var warning = _dereq_(154);
-
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
@@ -19143,150 +16986,24 @@
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
- if (prevElement != null && nextElement != null) {
+ var prevEmpty = prevElement === null || prevElement === false;
+ var nextEmpty = nextElement === null || nextElement === false;
+ if (prevEmpty || nextEmpty) {
+ return prevEmpty === nextEmpty;
+ }
+
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
- return (nextType === 'string' || nextType === 'number');
+ return nextType === 'string' || nextType === 'number';
} else {
- if (nextType === 'object' &&
- prevElement.type === nextElement.type &&
- prevElement.key === nextElement.key) {
- var ownersMatch = prevElement._owner === nextElement._owner;
- var prevName = null;
- var nextName = null;
- var nextDisplayName = null;
- if ("production" !== "development") {
- if (!ownersMatch) {
- if (prevElement._owner != null &&
- prevElement._owner.getPublicInstance() != null &&
- prevElement._owner.getPublicInstance().constructor != null) {
- prevName =
- prevElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement._owner != null &&
- nextElement._owner.getPublicInstance() != null &&
- nextElement._owner.getPublicInstance().constructor != null) {
- nextName =
- nextElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement.type != null &&
- nextElement.type.displayName != null) {
- nextDisplayName = nextElement.type.displayName;
- }
- if (nextElement.type != null && typeof nextElement.type === 'string') {
- nextDisplayName = nextElement.type;
- }
- if (typeof nextElement.type !== 'string' ||
- nextElement.type === 'input' ||
- nextElement.type === 'textarea') {
- if ((prevElement._owner != null &&
- prevElement._owner._isOwnerNecessary === false) ||
- (nextElement._owner != null &&
- nextElement._owner._isOwnerNecessary === false)) {
- if (prevElement._owner != null) {
- prevElement._owner._isOwnerNecessary = true;
- }
- if (nextElement._owner != null) {
- nextElement._owner._isOwnerNecessary = true;
- }
- ("production" !== "development" ? warning(
- false,
- '<%s /> is being rendered by both %s and %s using the same ' +
- 'key (%s) in the same place. Currently, this means that ' +
- 'they don\'t preserve state. This behavior should be very ' +
- 'rare so we\'re considering deprecating it. Please contact ' +
- 'the React team and explain your use case so that we can ' +
- 'take that into consideration.',
- nextDisplayName || 'Unknown Component',
- prevName || '[Unknown]',
- nextName || '[Unknown]',
- prevElement.key
- ) : null);
- }
- }
- }
- }
- return ownersMatch;
- }
- }
+ return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;
}
module.exports = shouldUpdateReactComponent;
-
-},{"154":154}],152:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule toArray
- * @typechecks
- */
-
-var invariant = _dereq_(135);
-
-/**
- * Convert array-like objects to arrays.
- *
- * This API assumes the caller knows the contents of the data type. For less
- * well defined inputs use createArrayFromMixed.
- *
- * @param {object|function|filelist} obj
- * @return {array}
- */
-function toArray(obj) {
- var length = obj.length;
-
- // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
- // old versions of Safari).
- ("production" !== "development" ? invariant(
- !Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function'),
- 'toArray: Array-like object expected'
- ) : invariant(!Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function')));
-
- ("production" !== "development" ? invariant(
- typeof length === 'number',
- 'toArray: Object needs a length property'
- ) : invariant(typeof length === 'number'));
-
- ("production" !== "development" ? invariant(
- length === 0 ||
- (length - 1) in obj,
- 'toArray: Object should have keys for indices'
- ) : invariant(length === 0 ||
- (length - 1) in obj));
-
- // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
- // without method will throw during the slice call and skip straight to the
- // fallback.
- if (obj.hasOwnProperty) {
- try {
- return Array.prototype.slice.call(obj);
- } catch (e) {
- // IE < 9 does not support Array#slice on collections objects
- }
- }
-
- // Fall back to copying key by key. This assumes all keys have a value,
- // so will not preserve sparsely populated inputs.
- var ret = Array(length);
- for (var ii = 0; ii < length; ii++) {
- ret[ii] = obj[ii];
- }
- return ret;
-}
-
-module.exports = toArray;
-
-},{"135":135}],153:[function(_dereq_,module,exports){
+},{}],127:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19300,13 +17017,13 @@
'use strict';
-var ReactElement = _dereq_(57);
-var ReactFragment = _dereq_(63);
-var ReactInstanceHandles = _dereq_(66);
-
-var getIteratorFn = _dereq_(126);
-var invariant = _dereq_(135);
-var warning = _dereq_(154);
+var ReactCurrentOwner = _dereq_(34);
+var ReactElement = _dereq_(52);
+var ReactInstanceHandles = _dereq_(61);
+
+var getIteratorFn = _dereq_(115);
+var invariant = _dereq_(144);
+var warning = _dereq_(155);
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
@@ -19349,14 +17066,11 @@
/**
* Escape a component key so that it is safe to use in a reactid.
*
- * @param {*} key Component key to be escaped.
+ * @param {*} text Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
- return ('' + text).replace(
- userProvidedKeyEscapeRegex,
- userProvidedKeyEscaper
- );
+ return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
}
/**
@@ -19373,19 +17087,12 @@
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
- * @param {!number} indexSoFar Number of children encountered until this point.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
-function traverseAllChildrenImpl(
- children,
- nameSoFar,
- indexSoFar,
- callback,
- traverseContext
-) {
+function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
@@ -19393,39 +17100,24 @@
children = null;
}
- if (children === null ||
- type === 'string' ||
- type === 'number' ||
- ReactElement.isValidElement(children)) {
- callback(
- traverseContext,
- children,
+ if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
+ callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
- indexSoFar
- );
+ nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
- var child, nextName, nextIndex;
+ var child;
+ var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
+ var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, i)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, i);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
@@ -19436,27 +17128,12 @@
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, ii++)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, ii++);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- didWarnAboutMaps,
- 'Using Maps as children is not yet fully supported. It is an ' +
- 'experimental feature that might be removed. Convert it to a ' +
- 'sequence / iterable of keyed ReactElements instead.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
@@ -19464,47 +17141,27 @@
var entry = step.value;
if (entry) {
child = entry[1];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
- ("production" !== "development" ? invariant(
- children.nodeType !== 1,
- 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
- 'elements are not valid children of React components.'
- ) : invariant(children.nodeType !== 1));
- var fragment = ReactFragment.extract(children);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- child = fragment[key];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(key) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ var addendum = '';
+ if ("development" !== 'production') {
+ addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
+ if (children._isReactElement) {
+ addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
+ }
+ if (ReactCurrentOwner.current) {
+ var name = ReactCurrentOwner.current.getName();
+ if (name) {
+ addendum += ' Check the render method of `' + name + '`.';
+ }
}
}
+ var childrenString = String(children);
+ !false ? "development" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
}
}
@@ -19532,12 +17189,1568 @@
return 0;
}
- return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
+ return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
+},{"115":115,"144":144,"155":155,"34":34,"52":52,"61":61}],128:[function(_dereq_,module,exports){
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule validateDOMNesting
+ */
+
+'use strict';
+
+var assign = _dereq_(23);
+var emptyFunction = _dereq_(136);
+var warning = _dereq_(155);
+
+var validateDOMNesting = emptyFunction;
+
+if ("development" !== 'production') {
+ // This validation code was written based on the HTML5 parsing spec:
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ //
+ // Note: this does not catch all invalid nesting, nor does it try to (as it's
+ // not clear what practical benefit doing so provides); instead, we warn only
+ // for cases where the parser will give a parse tree differing from what React
+ // intended. For example, <b><div></div></b> is invalid but we don't warn
+ // because it still parses correctly; we do warn for other cases like nested
+ // <p> tags where the beginning of the second element implicitly closes the
+ // first, causing a confusing mess.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#special
+ var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
+ // TODO: Distinguish by namespace here -- for <title>, including it here
+ // errs on the side of fewer warnings
+ 'foreignObject', 'desc', 'title'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
+ var buttonScopeTags = inScopeTags.concat(['button']);
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
+ var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
+
+ var emptyAncestorInfo = {
+ parentTag: null,
+
+ formTag: null,
+ aTagInScope: null,
+ buttonTagInScope: null,
+ nobrTagInScope: null,
+ pTagInButtonScope: null,
+
+ listItemTagAutoclosing: null,
+ dlItemTagAutoclosing: null
+ };
+
+ var updatedAncestorInfo = function (oldInfo, tag, instance) {
+ var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
+ var info = { tag: tag, instance: instance };
+
+ if (inScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.aTagInScope = null;
+ ancestorInfo.buttonTagInScope = null;
+ ancestorInfo.nobrTagInScope = null;
+ }
+ if (buttonScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.pTagInButtonScope = null;
+ }
+
+ // See rules for 'li', 'dd', 'dt' start tags in
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
+ ancestorInfo.listItemTagAutoclosing = null;
+ ancestorInfo.dlItemTagAutoclosing = null;
+ }
+
+ ancestorInfo.parentTag = info;
+
+ if (tag === 'form') {
+ ancestorInfo.formTag = info;
+ }
+ if (tag === 'a') {
+ ancestorInfo.aTagInScope = info;
+ }
+ if (tag === 'button') {
+ ancestorInfo.buttonTagInScope = info;
+ }
+ if (tag === 'nobr') {
+ ancestorInfo.nobrTagInScope = info;
+ }
+ if (tag === 'p') {
+ ancestorInfo.pTagInButtonScope = info;
+ }
+ if (tag === 'li') {
+ ancestorInfo.listItemTagAutoclosing = info;
+ }
+ if (tag === 'dd' || tag === 'dt') {
+ ancestorInfo.dlItemTagAutoclosing = info;
+ }
+
+ return ancestorInfo;
+ };
+
+ /**
+ * Returns whether
+ */
+ var isTagValidWithParent = function (tag, parentTag) {
+ // First, let's check if we're in an unusual parsing mode...
+ switch (parentTag) {
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
+ case 'select':
+ return tag === 'option' || tag === 'optgroup' || tag === '#text';
+ case 'optgroup':
+ return tag === 'option' || tag === '#text';
+ // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
+ // but
+ case 'option':
+ return tag === '#text';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
+ // No special behavior since these rules fall back to "in body" mode for
+ // all except special table nodes which cause bad parsing behavior anyway.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
+ case 'tr':
+ return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
+ case 'tbody':
+ case 'thead':
+ case 'tfoot':
+ return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
+ case 'colgroup':
+ return tag === 'col' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
+ case 'table':
+ return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
+ case 'head':
+ return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
+ case 'html':
+ return tag === 'head' || tag === 'body';
+ }
+
+ // Probably in the "in body" parsing mode, so we outlaw only tag combos
+ // where the parsing rules cause implicit opens or closes to be added.
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ switch (tag) {
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
+
+ case 'rp':
+ case 'rt':
+ return impliedEndTags.indexOf(parentTag) === -1;
+
+ case 'caption':
+ case 'col':
+ case 'colgroup':
+ case 'frame':
+ case 'head':
+ case 'tbody':
+ case 'td':
+ case 'tfoot':
+ case 'th':
+ case 'thead':
+ case 'tr':
+ // These tags are only valid with a few parents that have special child
+ // parsing rules -- if we're down here, then none of those matched and
+ // so we allow it only if we don't know what the parent is, as all other
+ // cases are invalid.
+ return parentTag == null;
+ }
+
+ return true;
+ };
+
+ /**
+ * Returns whether
+ */
+ var findInvalidAncestorForTag = function (tag, ancestorInfo) {
+ switch (tag) {
+ case 'address':
+ case 'article':
+ case 'aside':
+ case 'blockquote':
+ case 'center':
+ case 'details':
+ case 'dialog':
+ case 'dir':
+ case 'div':
+ case 'dl':
+ case 'fieldset':
+ case 'figcaption':
+ case 'figure':
+ case 'footer':
+ case 'header':
+ case 'hgroup':
+ case 'main':
+ case 'menu':
+ case 'nav':
+ case 'ol':
+ case 'p':
+ case 'section':
+ case 'summary':
+ case 'ul':
+
+ case 'pre':
+ case 'listing':
+
+ case 'table':
+
+ case 'hr':
+
+ case 'xmp':
+
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return ancestorInfo.pTagInButtonScope;
+
+ case 'form':
+ return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
+
+ case 'li':
+ return ancestorInfo.listItemTagAutoclosing;
+
+ case 'dd':
+ case 'dt':
+ return ancestorInfo.dlItemTagAutoclosing;
+
+ case 'button':
+ return ancestorInfo.buttonTagInScope;
+
+ case 'a':
+ // Spec says something about storing a list of markers, but it sounds
+ // equivalent to this check.
+ return ancestorInfo.aTagInScope;
+
+ case 'nobr':
+ return ancestorInfo.nobrTagInScope;
+ }
+
+ return null;
+ };
+
+ /**
+ * Given a ReactCompositeComponent instance, return a list of its recursive
+ * owners, starting at the root and ending with the instance itself.
+ */
+ var findOwnerStack = function (instance) {
+ if (!instance) {
+ return [];
+ }
+
+ var stack = [];
+ /*eslint-disable space-after-keywords */
+ do {
+ /*eslint-enable space-after-keywords */
+ stack.push(instance);
+ } while (instance = instance._currentElement._owner);
+ stack.reverse();
+ return stack;
+ };
+
+ var didWarn = {};
+
+ validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+
+ var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
+ var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
+ var problematic = invalidParent || invalidAncestor;
+
+ if (problematic) {
+ var ancestorTag = problematic.tag;
+ var ancestorInstance = problematic.instance;
+
+ var childOwner = childInstance && childInstance._currentElement._owner;
+ var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
+
+ var childOwners = findOwnerStack(childOwner);
+ var ancestorOwners = findOwnerStack(ancestorOwner);
+
+ var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
+ var i;
+
+ var deepestCommon = -1;
+ for (i = 0; i < minStackLen; i++) {
+ if (childOwners[i] === ancestorOwners[i]) {
+ deepestCommon = i;
+ } else {
+ break;
+ }
+ }
+
+ var UNKNOWN = '(unknown)';
+ var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ownerInfo = [].concat(
+ // If the parent and child instances have a common owner ancestor, start
+ // with that -- otherwise we just start with the parent's owners.
+ deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
+ // If we're warning about an invalid (non-parent) ancestry, add '...'
+ invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
+
+ var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
+ if (didWarn[warnKey]) {
+ return;
+ }
+ didWarn[warnKey] = true;
+
+ if (invalidParent) {
+ var info = '';
+ if (ancestorTag === 'table' && childTag === 'tr') {
+ info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
+ }
+ "development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
+ } else {
+ "development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
+ }
+ }
+ };
+
+ validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
+
+ validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
+
+ // For testing
+ validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+ return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
+ };
+}
+
+module.exports = validateDOMNesting;
+},{"136":136,"155":155,"23":23}],129:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @providesModule EventListener
+ * @typechecks
+ */
+
+'use strict';
+
+var emptyFunction = _dereq_(136);
+
+/**
+ * Upstream version of event listener. Does not take into account specific
+ * nature of platform.
+ */
+var EventListener = {
+ /**
+ * Listen to DOM events during the bubble phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ listen: function (target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, false);
+ return {
+ remove: function () {
+ target.removeEventListener(eventType, callback, false);
+ }
+ };
+ } else if (target.attachEvent) {
+ target.attachEvent('on' + eventType, callback);
+ return {
+ remove: function () {
+ target.detachEvent('on' + eventType, callback);
+ }
+ };
+ }
+ },
+
+ /**
+ * Listen to DOM events during the capture phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ capture: function (target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, true);
+ return {
+ remove: function () {
+ target.removeEventListener(eventType, callback, true);
+ }
+ };
+ } else {
+ if ("development" !== 'production') {
+ console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
+ }
+ return {
+ remove: emptyFunction
+ };
+ }
+ },
+
+ registerDefault: function () {}
+};
+
+module.exports = EventListener;
+},{"136":136}],130:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ExecutionEnvironment
+ */
+
+'use strict';
+
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+
+/**
+ * Simple, lightweight module assisting with the detection and context of
+ * Worker. Helps avoid circular dependencies and allows code to reason about
+ * whether or not they are in a Worker, even if they never include the main
+ * `ReactWorker` dependency.
+ */
+var ExecutionEnvironment = {
+
+ canUseDOM: canUseDOM,
+
+ canUseWorkers: typeof Worker !== 'undefined',
+
+ canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
+
+ canUseViewport: canUseDOM && !!window.screen,
+
+ isInWorker: !canUseDOM // For now, this is true - might change in the future.
+
+};
+
+module.exports = ExecutionEnvironment;
+},{}],131:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule camelize
+ * @typechecks
+ */
+
+"use strict";
+
+var _hyphenPattern = /-(.)/g;
+
+/**
+ * Camelcases a hyphenated string, for example:
+ *
+ * > camelize('background-color')
+ * < "backgroundColor"
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function camelize(string) {
+ return string.replace(_hyphenPattern, function (_, character) {
+ return character.toUpperCase();
+ });
+}
+
+module.exports = camelize;
+},{}],132:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule camelizeStyleName
+ * @typechecks
+ */
+
+'use strict';
+
+var camelize = _dereq_(131);
+
+var msPattern = /^-ms-/;
+
+/**
+ * Camelcases a hyphenated CSS property name, for example:
+ *
+ * > camelizeStyleName('background-color')
+ * < "backgroundColor"
+ * > camelizeStyleName('-moz-transition')
+ * < "MozTransition"
+ * > camelizeStyleName('-ms-transition')
+ * < "msTransition"
+ *
+ * As Andi Smith suggests
+ * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
+ * is converted to lowercase `ms`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function camelizeStyleName(string) {
+ return camelize(string.replace(msPattern, 'ms-'));
+}
+
+module.exports = camelizeStyleName;
+},{"131":131}],133:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule containsNode
+ * @typechecks
+ */
+
+'use strict';
+
+var isTextNode = _dereq_(146);
+
+/*eslint-disable no-bitwise */
+
+/**
+ * Checks if a given DOM node contains or is another DOM node.
+ *
+ * @param {?DOMNode} outerNode Outer DOM node.
+ * @param {?DOMNode} innerNode Inner DOM node.
+ * @return {boolean} True if `outerNode` contains or is `innerNode`.
+ */
+function containsNode(_x, _x2) {
+ var _again = true;
+
+ _function: while (_again) {
+ var outerNode = _x,
+ innerNode = _x2;
+ _again = false;
+
+ if (!outerNode || !innerNode) {
+ return false;
+ } else if (outerNode === innerNode) {
+ return true;
+ } else if (isTextNode(outerNode)) {
+ return false;
+ } else if (isTextNode(innerNode)) {
+ _x = outerNode;
+ _x2 = innerNode.parentNode;
+ _again = true;
+ continue _function;
+ } else if (outerNode.contains) {
+ return outerNode.contains(innerNode);
+ } else if (outerNode.compareDocumentPosition) {
+ return !!(outerNode.compareDocumentPosition(innerNode) & 16);
+ } else {
+ return false;
+ }
+ }
+}
+
+module.exports = containsNode;
+},{"146":146}],134:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule createArrayFromMixed
+ * @typechecks
+ */
+
+'use strict';
+
+var toArray = _dereq_(154);
+
+/**
+ * Perform a heuristic test to determine if an object is "array-like".
+ *
+ * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
+ * Joshu replied: "Mu."
+ *
+ * This function determines if its argument has "array nature": it returns
+ * true if the argument is an actual array, an `arguments' object, or an
+ * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
+ *
+ * It will return false for other array-like objects like Filelist.
+ *
+ * @param {*} obj
+ * @return {boolean}
+ */
+function hasArrayNature(obj) {
+ return(
+ // not null/false
+ !!obj && (
+ // arrays are objects, NodeLists are functions in Safari
+ typeof obj == 'object' || typeof obj == 'function') &&
+ // quacks like an array
+ 'length' in obj &&
+ // not window
+ !('setInterval' in obj) &&
+ // no DOM node should be considered an array-like
+ // a 'select' element has 'length' and 'item' properties on IE8
+ typeof obj.nodeType != 'number' && (
+ // a real array
+ Array.isArray(obj) ||
+ // arguments
+ 'callee' in obj ||
+ // HTMLCollection/NodeList
+ 'item' in obj)
+ );
+}
+
+/**
+ * Ensure that the argument is an array by wrapping it in an array if it is not.
+ * Creates a copy of the argument if it is already an array.
+ *
+ * This is mostly useful idiomatically:
+ *
+ * var createArrayFromMixed = require('createArrayFromMixed');
+ *
+ * function takesOneOrMoreThings(things) {
+ * things = createArrayFromMixed(things);
+ * ...
+ * }
+ *
+ * This allows you to treat `things' as an array, but accept scalars in the API.
+ *
+ * If you need to convert an array-like object, like `arguments`, into an array
+ * use toArray instead.
+ *
+ * @param {*} obj
+ * @return {array}
+ */
+function createArrayFromMixed(obj) {
+ if (!hasArrayNature(obj)) {
+ return [obj];
+ } else if (Array.isArray(obj)) {
+ return obj.slice();
+ } else {
+ return toArray(obj);
+ }
+}
+
+module.exports = createArrayFromMixed;
+},{"154":154}],135:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule createNodesFromMarkup
+ * @typechecks
+ */
+
+/*eslint-disable fb-www/unsafe-html*/
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(130);
+
+var createArrayFromMixed = _dereq_(134);
+var getMarkupWrap = _dereq_(140);
+var invariant = _dereq_(144);
+
+/**
+ * Dummy container used to render all markup.
+ */
+var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
+
+/**
+ * Pattern used by `getNodeName`.
+ */
+var nodeNamePattern = /^\s*<(\w+)/;
+
+/**
+ * Extracts the `nodeName` of the first element in a string of markup.
+ *
+ * @param {string} markup String of markup.
+ * @return {?string} Node name of the supplied markup.
+ */
+function getNodeName(markup) {
+ var nodeNameMatch = markup.match(nodeNamePattern);
+ return nodeNameMatch && nodeNameMatch[1].toLowerCase();
+}
+
+/**
+ * Creates an array containing the nodes rendered from the supplied markup. The
+ * optionally supplied `handleScript` function will be invoked once for each
+ * <script> element that is rendered. If no `handleScript` function is supplied,
+ * an exception is thrown if any <script> elements are rendered.
+ *
+ * @param {string} markup A string of valid HTML markup.
+ * @param {?function} handleScript Invoked once for each rendered <script>.
+ * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
+ */
+function createNodesFromMarkup(markup, handleScript) {
+ var node = dummyNode;
+ !!!dummyNode ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
+ var nodeName = getNodeName(markup);
+
+ var wrap = nodeName && getMarkupWrap(nodeName);
+ if (wrap) {
+ node.innerHTML = wrap[1] + markup + wrap[2];
+
+ var wrapDepth = wrap[0];
+ while (wrapDepth--) {
+ node = node.lastChild;
+ }
+ } else {
+ node.innerHTML = markup;
+ }
+
+ var scripts = node.getElementsByTagName('script');
+ if (scripts.length) {
+ !handleScript ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
+ createArrayFromMixed(scripts).forEach(handleScript);
+ }
+
+ var nodes = createArrayFromMixed(node.childNodes);
+ while (node.lastChild) {
+ node.removeChild(node.lastChild);
+ }
+ return nodes;
+}
+
+module.exports = createNodesFromMarkup;
+},{"130":130,"134":134,"140":140,"144":144}],136:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule emptyFunction
+ */
+
+"use strict";
+
+function makeEmptyFunction(arg) {
+ return function () {
+ return arg;
+ };
+}
+
+/**
+ * This function accepts and discards inputs; it has no side effects. This is
+ * primarily useful idiomatically for overridable function endpoints which
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
+ */
+function emptyFunction() {}
+
+emptyFunction.thatReturns = makeEmptyFunction;
+emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
+emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
+emptyFunction.thatReturnsNull = makeEmptyFunction(null);
+emptyFunction.thatReturnsThis = function () {
+ return this;
+};
+emptyFunction.thatReturnsArgument = function (arg) {
+ return arg;
+};
+
+module.exports = emptyFunction;
+},{}],137:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule emptyObject
+ */
+
+'use strict';
+
+var emptyObject = {};
+
+if ("development" !== 'production') {
+ Object.freeze(emptyObject);
+}
+
+module.exports = emptyObject;
+},{}],138:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule focusNode
+ */
+
+'use strict';
+
+/**
+ * @param {DOMElement} node input/textarea to focus
+ */
+function focusNode(node) {
+ // IE8 can throw "Can't move focus to the control because it is invisible,
+ // not enabled, or of a type that does not accept the focus." for all kinds of
+ // reasons that are too expensive and fragile to test.
+ try {
+ node.focus();
+ } catch (e) {}
+}
+
+module.exports = focusNode;
+},{}],139:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getActiveElement
+ * @typechecks
+ */
+
+/* eslint-disable fb-www/typeof-undefined */
+
+/**
+ * Same as document.activeElement but wraps in a try-catch block. In IE it is
+ * not safe to call document.activeElement if there is nothing focused.
+ *
+ * The activeElement will be null only if the document or document body is not
+ * yet defined.
+ */
+'use strict';
+
+function getActiveElement() /*?DOMElement*/{
+ if (typeof document === 'undefined') {
+ return null;
+ }
+ try {
+ return document.activeElement || document.body;
+ } catch (e) {
+ return document.body;
+ }
+}
+
+module.exports = getActiveElement;
+},{}],140:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getMarkupWrap
+ */
+
+/*eslint-disable fb-www/unsafe-html */
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(130);
+
+var invariant = _dereq_(144);
+
+/**
+ * Dummy container used to detect which wraps are necessary.
+ */
+var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
+
+/**
+ * Some browsers cannot use `innerHTML` to render certain elements standalone,
+ * so we wrap them, render the wrapped nodes, then extract the desired node.
+ *
+ * In IE8, certain elements cannot render alone, so wrap all elements ('*').
+ */
+
+var shouldWrap = {};
+
+var selectWrap = [1, '<select multiple="true">', '</select>'];
+var tableWrap = [1, '<table>', '</table>'];
+var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
+
+var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
+
+var markupWrap = {
+ '*': [1, '?<div>', '</div>'],
+
+ 'area': [1, '<map>', '</map>'],
+ 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
+ 'legend': [1, '<fieldset>', '</fieldset>'],
+ 'param': [1, '<object>', '</object>'],
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
+
+ 'optgroup': selectWrap,
+ 'option': selectWrap,
+
+ 'caption': tableWrap,
+ 'colgroup': tableWrap,
+ 'tbody': tableWrap,
+ 'tfoot': tableWrap,
+ 'thead': tableWrap,
+
+ 'td': trWrap,
+ 'th': trWrap
+};
+
+// Initialize the SVG elements since we know they'll always need to be wrapped
+// consistently. If they are created inside a <div> they will be initialized in
+// the wrong namespace (and will not display).
+var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
+svgElements.forEach(function (nodeName) {
+ markupWrap[nodeName] = svgWrap;
+ shouldWrap[nodeName] = true;
+});
+
+/**
+ * Gets the markup wrap configuration for the supplied `nodeName`.
+ *
+ * NOTE: This lazily detects which wraps are necessary for the current browser.
+ *
+ * @param {string} nodeName Lowercase `nodeName`.
+ * @return {?array} Markup wrap configuration, if applicable.
+ */
+function getMarkupWrap(nodeName) {
+ !!!dummyNode ? "development" !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
+ if (!markupWrap.hasOwnProperty(nodeName)) {
+ nodeName = '*';
+ }
+ if (!shouldWrap.hasOwnProperty(nodeName)) {
+ if (nodeName === '*') {
+ dummyNode.innerHTML = '<link />';
+ } else {
+ dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
+ }
+ shouldWrap[nodeName] = !dummyNode.firstChild;
+ }
+ return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
+}
+
+module.exports = getMarkupWrap;
+},{"130":130,"144":144}],141:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getUnboundedScrollPosition
+ * @typechecks
+ */
+
+'use strict';
+
+/**
+ * Gets the scroll position of the supplied element or window.
+ *
+ * The return values are unbounded, unlike `getScrollPosition`. This means they
+ * may be negative or exceed the element boundaries (which is possible using
+ * inertial scrolling).
+ *
+ * @param {DOMWindow|DOMElement} scrollable
+ * @return {object} Map with `x` and `y` keys.
+ */
+function getUnboundedScrollPosition(scrollable) {
+ if (scrollable === window) {
+ return {
+ x: window.pageXOffset || document.documentElement.scrollLeft,
+ y: window.pageYOffset || document.documentElement.scrollTop
+ };
+ }
+ return {
+ x: scrollable.scrollLeft,
+ y: scrollable.scrollTop
+ };
+}
+
+module.exports = getUnboundedScrollPosition;
+},{}],142:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule hyphenate
+ * @typechecks
+ */
+
+'use strict';
+
+var _uppercasePattern = /([A-Z])/g;
+
+/**
+ * Hyphenates a camelcased string, for example:
+ *
+ * > hyphenate('backgroundColor')
+ * < "background-color"
+ *
+ * For CSS style names, use `hyphenateStyleName` instead which works properly
+ * with all vendor prefixes, including `ms`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function hyphenate(string) {
+ return string.replace(_uppercasePattern, '-$1').toLowerCase();
+}
+
+module.exports = hyphenate;
+},{}],143:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule hyphenateStyleName
+ * @typechecks
+ */
+
+'use strict';
+
+var hyphenate = _dereq_(142);
+
+var msPattern = /^ms-/;
+
+/**
+ * Hyphenates a camelcased CSS property name, for example:
+ *
+ * > hyphenateStyleName('backgroundColor')
+ * < "background-color"
+ * > hyphenateStyleName('MozTransition')
+ * < "-moz-transition"
+ * > hyphenateStyleName('msTransition')
+ * < "-ms-transition"
+ *
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
+ * is converted to `-ms-`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function hyphenateStyleName(string) {
+ return hyphenate(string).replace(msPattern, '-ms-');
+}
+
+module.exports = hyphenateStyleName;
+},{"142":142}],144:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule invariant
+ */
+
+'use strict';
+
+/**
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+function invariant(condition, format, a, b, c, d, e, f) {
+ if ("development" !== 'production') {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ }
+
+ if (!condition) {
+ var error;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+module.exports = invariant;
+},{}],145:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule isNode
+ * @typechecks
+ */
+
+/**
+ * @param {*} object The object to check.
+ * @return {boolean} Whether or not the object is a DOM node.
+ */
+'use strict';
+
+function isNode(object) {
+ return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
+}
+
+module.exports = isNode;
+},{}],146:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule isTextNode
+ * @typechecks
+ */
+
+'use strict';
+
+var isNode = _dereq_(145);
+
+/**
+ * @param {*} object The object to check.
+ * @return {boolean} Whether or not the object is a DOM text node.
+ */
+function isTextNode(object) {
+ return isNode(object) && object.nodeType == 3;
+}
+
+module.exports = isTextNode;
+},{"145":145}],147:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule keyMirror
+ * @typechecks static-only
+ */
+
+'use strict';
+
+var invariant = _dereq_(144);
+
+/**
+ * Constructs an enumeration with keys equal to their value.
+ *
+ * For example:
+ *
+ * var COLORS = keyMirror({blue: null, red: null});
+ * var myColor = COLORS.blue;
+ * var isColorValid = !!COLORS[myColor];
+ *
+ * The last line could not be performed if the values of the generated enum were
+ * not equal to their keys.
+ *
+ * Input: {key1: val1, key2: val2}
+ * Output: {key1: key1, key2: key2}
+ *
+ * @param {object} obj
+ * @return {object}
+ */
+var keyMirror = function (obj) {
+ var ret = {};
+ var key;
+ !(obj instanceof Object && !Array.isArray(obj)) ? "development" !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
+ for (key in obj) {
+ if (!obj.hasOwnProperty(key)) {
+ continue;
+ }
+ ret[key] = key;
+ }
+ return ret;
+};
+
+module.exports = keyMirror;
+},{"144":144}],148:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule keyOf
+ */
+
+/**
+ * Allows extraction of a minified key. Let's the build system minify keys
+ * without losing the ability to dynamically use key strings as values
+ * themselves. Pass in an object with a single key/val pair and it will return
+ * you the string key of that single record. Suppose you want to grab the
+ * value for a key 'className' inside of an object. Key/val minification may
+ * have aliased that key to be 'xa12'. keyOf({className: null}) will return
+ * 'xa12' in that case. Resolve keys you want to use once at startup time, then
+ * reuse those resolutions.
+ */
+"use strict";
+
+var keyOf = function (oneKeyObj) {
+ var key;
+ for (key in oneKeyObj) {
+ if (!oneKeyObj.hasOwnProperty(key)) {
+ continue;
+ }
+ return key;
+ }
+ return null;
+};
+
+module.exports = keyOf;
+},{}],149:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule mapObject
+ */
+
+'use strict';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Executes the provided `callback` once for each enumerable own property in the
+ * object and constructs a new object from the results. The `callback` is
+ * invoked with three arguments:
+ *
+ * - the property value
+ * - the property name
+ * - the object being traversed
+ *
+ * Properties that are added after the call to `mapObject` will not be visited
+ * by `callback`. If the values of existing properties are changed, the value
+ * passed to `callback` will be the value at the time `mapObject` visits them.
+ * Properties that are deleted before being visited are not visited.
+ *
+ * @grep function objectMap()
+ * @grep function objMap()
+ *
+ * @param {?object} object
+ * @param {function} callback
+ * @param {*} context
+ * @return {?object}
+ */
+function mapObject(object, callback, context) {
+ if (!object) {
+ return null;
+ }
+ var result = {};
+ for (var name in object) {
+ if (hasOwnProperty.call(object, name)) {
+ result[name] = callback.call(context, object[name], name, object);
+ }
+ }
+ return result;
+}
+
+module.exports = mapObject;
+},{}],150:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule memoizeStringOnly
+ * @typechecks static-only
+ */
+
+'use strict';
+
+/**
+ * Memoizes the return value of a function that accepts one string argument.
+ *
+ * @param {function} callback
+ * @return {function}
+ */
+function memoizeStringOnly(callback) {
+ var cache = {};
+ return function (string) {
+ if (!cache.hasOwnProperty(string)) {
+ cache[string] = callback.call(this, string);
+ }
+ return cache[string];
+ };
+}
+
+module.exports = memoizeStringOnly;
+},{}],151:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule performance
+ * @typechecks
+ */
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(130);
+
+var performance;
+
+if (ExecutionEnvironment.canUseDOM) {
+ performance = window.performance || window.msPerformance || window.webkitPerformance;
+}
+
+module.exports = performance || {};
+},{"130":130}],152:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule performanceNow
+ * @typechecks
+ */
-},{"126":126,"135":135,"154":154,"57":57,"63":63,"66":66}],154:[function(_dereq_,module,exports){
+'use strict';
+
+var performance = _dereq_(151);
+
+var performanceNow;
+
+/**
+ * Detect if we can use `window.performance.now()` and gracefully fallback to
+ * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
+ * because of Facebook's testing infrastructure.
+ */
+if (performance.now) {
+ performanceNow = function () {
+ return performance.now();
+ };
+} else {
+ performanceNow = function () {
+ return Date.now();
+ };
+}
+
+module.exports = performanceNow;
+},{"151":151}],153:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule shallowEqual
+ * @typechecks
+ *
+ */
+
+'use strict';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Performs equality by iterating through keys on an object and returning false
+ * when any key has values which are not strictly equal between the arguments.
+ * Returns true when the values of all keys are strictly equal.
+ */
+function shallowEqual(objA, objB) {
+ if (objA === objB) {
+ return true;
+ }
+
+ if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
+ return false;
+ }
+
+ var keysA = Object.keys(objA);
+ var keysB = Object.keys(objB);
+
+ if (keysA.length !== keysB.length) {
+ return false;
+ }
+
+ // Test for A's keys different from B.
+ var bHasOwnProperty = hasOwnProperty.bind(objB);
+ for (var i = 0; i < keysA.length; i++) {
+ if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+module.exports = shallowEqual;
+},{}],154:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule toArray
+ * @typechecks
+ */
+
+'use strict';
+
+var invariant = _dereq_(144);
+
+/**
+ * Convert array-like objects to arrays.
+ *
+ * This API assumes the caller knows the contents of the data type. For less
+ * well defined inputs use createArrayFromMixed.
+ *
+ * @param {object|function|filelist} obj
+ * @return {array}
+ */
+function toArray(obj) {
+ var length = obj.length;
+
+ // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
+ // old versions of Safari).
+ !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? "development" !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
+
+ !(typeof length === 'number') ? "development" !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
+
+ !(length === 0 || length - 1 in obj) ? "development" !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
+
+ // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
+ // without method will throw during the slice call and skip straight to the
+ // fallback.
+ if (obj.hasOwnProperty) {
+ try {
+ return Array.prototype.slice.call(obj);
+ } catch (e) {
+ // IE < 9 does not support Array#slice on collections objects
+ }
+ }
+
+ // Fall back to copying key by key. This assumes all keys have a value,
+ // so will not preserve sparsely populated inputs.
+ var ret = Array(length);
+ for (var ii = 0; ii < length; ii++) {
+ ret[ii] = obj[ii];
+ }
+ return ret;
+}
+
+module.exports = toArray;
+},{"144":144}],155:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -19549,9 +18762,9 @@
* @providesModule warning
*/
-"use strict";
+'use strict';
-var emptyFunction = _dereq_(114);
+var emptyFunction = _dereq_(136);
/**
* Similar to invariant but only logs a warning if the condition is not met.
@@ -19562,20 +18775,14 @@
var warning = emptyFunction;
-if ("production" !== "development") {
- warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
- if (format === undefined) {
- throw new Error(
- '`warning(condition, format, ...args)` requires a warning ' +
- 'message argument'
- );
+if ("development" !== 'production') {
+ warning = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
}
- if (format.length < 10 || /^[s\W]*$/.test(format)) {
- throw new Error(
- 'The warning format should be able to uniquely identify this ' +
- 'warning. Please, use a more descriptive format than: ' + format
- );
+ if (format === undefined) {
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
@@ -19584,19 +18791,22 @@
if (!condition) {
var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
- console.warn(message);
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.error(message);
+ }
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
- } catch(x) {}
+ } catch (x) {}
}
};
}
module.exports = warning;
-
-},{"114":114}]},{},[1])(1)
+},{"136":136}]},{},[1])(1)
});
\ No newline at end of file

dist/react.min.js

@@ -1,5 +1,5 @@
/**
- * React v0.13.3
+ * React v0.14.9
*
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9,8 +9,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){"use strict";var r=e(19),o=e(32),i=e(34),a=e(33),u=e(38),s=e(39),l=e(55),c=(e(56),e(40)),p=e(51),d=e(54),f=e(64),h=e(68),m=e(73),v=e(76),g=e(79),y=e(82),C=e(27),E=e(115),b=e(142);d.inject();var _=l.createElement,x=l.createFactory,D=l.cloneElement,M=m.measure("React","render",h.render),N={Children:{map:o.map,forEach:o.forEach,count:o.count,only:b},Component:i,DOM:c,PropTypes:v,initializeTouchEvents:function(e){r.useTouchEvents=e},createClass:a.createClass,createElement:_,cloneElement:D,createFactory:x,createMixin:function(e){return e},constructAndRenderComponent:h.constructAndRenderComponent,constructAndRenderComponentByID:h.constructAndRenderComponentByID,findDOMNode:E,render:M,renderToString:y.renderToString,renderToStaticMarkup:y.renderToStaticMarkup,unmountComponentAtNode:h.unmountComponentAtNode,isValidElement:l.isValidElement,withContext:u.withContext,__spread:C};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:s,InstanceHandles:f,Mount:h,Reconciler:g,TextComponent:p});N.version="0.13.3",t.exports=N},{115:115,142:142,19:19,27:27,32:32,33:33,34:34,38:38,39:39,40:40,51:51,54:54,55:55,56:56,64:64,68:68,73:73,76:76,79:79,82:82}],2:[function(e,t,n){"use strict";var r=e(117),o={componentDidMount:function(){this.props.autoFocus&&r(this.getDOMNode())}};t.exports=o},{117:117}],3:[function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function i(e){switch(e){case T.topCompositionStart:return P.compositionStart;case T.topCompositionEnd:return P.compositionEnd;case T.topCompositionUpdate:return P.compositionUpdate}}function a(e,t){return e===T.topKeyDown&&t.keyCode===b}function u(e,t){switch(e){case T.topKeyUp:return-1!==E.indexOf(t.keyCode);case T.topKeyDown:return t.keyCode!==b;case T.topKeyPress:case T.topMouseDown:case T.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function l(e,t,n,r){var o,l;if(_?o=i(e):w?u(e,r)&&(o=P.compositionEnd):a(e,r)&&(o=P.compositionStart),!o)return null;M&&(w||o!==P.compositionStart?o===P.compositionEnd&&w&&(l=w.getData()):w=v.getPooled(t));var c=g.getPooled(o,n,r);if(l)c.data=l;else{var p=s(r);null!==p&&(c.data=p)}return h.accumulateTwoPhaseDispatches(c),c}function c(e,t){switch(e){case T.topCompositionEnd:return s(t);case T.topKeyPress:var n=t.which;return n!==N?null:(R=!0,I);case T.topTextInput:var r=t.data;return r===I&&R?null:r;default:return null}}function p(e,t){if(w){if(e===T.topCompositionEnd||u(e,t)){var n=w.getData();return v.release(w),w=null,n}return null}switch(e){case T.topPaste:return null;case T.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case T.topCompositionEnd:return M?null:t.data;default:return null}}function d(e,t,n,r){var o;if(o=D?c(e,r):p(e,r),!o)return null;var i=y.getPooled(P.beforeInput,n,r);return i.data=o,h.accumulateTwoPhaseDispatches(i),i}var f=e(15),h=e(20),m=e(21),v=e(22),g=e(91),y=e(95),C=e(139),E=[9,13,27,32],b=229,_=m.canUseDOM&&"CompositionEvent"in window,x=null;m.canUseDOM&&"documentMode"in document&&(x=document.documentMode);var D=m.canUseDOM&&"TextEvent"in window&&!x&&!r(),M=m.canUseDOM&&(!_||x&&x>8&&11>=x),N=32,I=String.fromCharCode(N),T=f.topLevelTypes,P={beforeInput:{phasedRegistrationNames:{bubbled:C({onBeforeInput:null}),captured:C({onBeforeInputCapture:null})},dependencies:[T.topCompositionEnd,T.topKeyPress,T.topTextInput,T.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:C({onCompositionEnd:null}),captured:C({onCompositionEndCapture:null})},dependencies:[T.topBlur,T.topCompositionEnd,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:C({onCompositionStart:null}),captured:C({onCompositionStartCapture:null})},dependencies:[T.topBlur,T.topCompositionStart,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:C({onCompositionUpdate:null}),captured:C({onCompositionUpdateCapture:null})},dependencies:[T.topBlur,T.topCompositionUpdate,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]}},R=!1,w=null,O={eventTypes:P,extractEvents:function(e,t,n,r){return[l(e,t,n,r),d(e,t,n,r)]}};t.exports=O},{139:139,15:15,20:20,21:21,22:22,91:91,95:95}],4:[function(e,t,n){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var o={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},i=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){i.forEach(function(t){o[r(t,e)]=o[e]})});var a={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},u={isUnitlessNumber:o,shorthandPropertyExpansions:a};t.exports=u},{}],5:[function(e,t,n){"use strict";var r=e(4),o=e(21),i=(e(106),e(111)),a=e(131),u=e(141),s=(e(150),u(function(e){return a(e)})),l="cssFloat";o.canUseDOM&&void 0===document.documentElement.style.cssFloat&&(l="styleFloat");var c={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=s(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=i(o,t[o]);if("float"===o&&(o=l),a)n[o]=a;else{var u=r.shorthandPropertyExpansions[o];if(u)for(var s in u)n[s]="";else n[o]=""}}}};t.exports=c},{106:106,111:111,131:131,141:141,150:150,21:21,4:4}],6:[function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=e(28),i=e(27),a=e(133);i(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){a(e.length===t.length),this._callbacks=null,this._contexts=null;for(var n=0,r=e.length;r>n;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{133:133,27:27,28:28}],7:[function(e,t,n){"use strict";function r(e){return"SELECT"===e.nodeName||"INPUT"===e.nodeName&&"file"===e.type}function o(e){var t=x.getPooled(T.change,R,e);E.accumulateTwoPhaseDispatches(t),_.batchedUpdates(i,t)}function i(e){C.enqueueEvents(e),C.processEventQueue()}function a(e,t){P=e,R=t,P.attachEvent("onchange",o)}function u(){P&&(P.detachEvent("onchange",o),P=null,R=null)}function s(e,t,n){return e===I.topChange?n:void 0}function l(e,t,n){e===I.topFocus?(u(),a(t,n)):e===I.topBlur&&u()}function c(e,t){P=e,R=t,w=e.value,O=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(P,"value",k),P.attachEvent("onpropertychange",d)}function p(){P&&(delete P.value,P.detachEvent("onpropertychange",d),P=null,R=null,w=null,O=null)}function d(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==w&&(w=t,o(e))}}function f(e,t,n){return e===I.topInput?n:void 0}function h(e,t,n){e===I.topFocus?(p(),c(t,n)):e===I.topBlur&&p()}function m(e,t,n){return e!==I.topSelectionChange&&e!==I.topKeyUp&&e!==I.topKeyDown||!P||P.value===w?void 0:(w=P.value,R)}function v(e){return"INPUT"===e.nodeName&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,n){return e===I.topClick?n:void 0}var y=e(15),C=e(17),E=e(20),b=e(21),_=e(85),x=e(93),D=e(134),M=e(136),N=e(139),I=y.topLevelTypes,T={change:{phasedRegistrationNames:{bubbled:N({onChange:null}),captured:N({onChangeCapture:null})},dependencies:[I.topBlur,I.topChange,I.topClick,I.topFocus,I.topInput,I.topKeyDown,I.topKeyUp,I.topSelectionChange]}},P=null,R=null,w=null,O=null,S=!1;b.canUseDOM&&(S=D("change")&&(!("documentMode"in document)||document.documentMode>8));var A=!1;b.canUseDOM&&(A=D("input")&&(!("documentMode"in document)||document.documentMode>9));var k={get:function(){return O.get.call(this)},set:function(e){w=""+e,O.set.call(this,e)}},L={eventTypes:T,extractEvents:function(e,t,n,o){var i,a;if(r(t)?S?i=s:a=l:M(t)?A?i=f:(i=m,a=h):v(t)&&(i=g),i){var u=i(e,t,n);if(u){var c=x.getPooled(T.change,u,o);return E.accumulateTwoPhaseDispatches(c),c}}a&&a(e,t,n)}};t.exports=L},{134:134,136:136,139:139,15:15,17:17,20:20,21:21,85:85,93:93}],8:[function(e,t,n){"use strict";var r=0,o={createReactRootIndex:function(){return r++}};t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e,t,n){e.insertBefore(t,e.childNodes[n]||null)}var o=e(12),i=e(70),a=e(145),u=e(133),s={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:a,processUpdates:function(e,t){for(var n,s=null,l=null,c=0;c<e.length;c++)if(n=e[c],n.type===i.MOVE_EXISTING||n.type===i.REMOVE_NODE){var p=n.fromIndex,d=n.parentNode.childNodes[p],f=n.parentID;u(d),s=s||{},s[f]=s[f]||[],s[f][p]=d,l=l||[],l.push(d)}var h=o.dangerouslyRenderMarkup(t);if(l)for(var m=0;m<l.length;m++)l[m].parentNode.removeChild(l[m]);for(var v=0;v<e.length;v++)switch(n=e[v],n.type){case i.INSERT_MARKUP:r(n.parentNode,h[n.markupIndex],n.toIndex);break;case i.MOVE_EXISTING:r(n.parentNode,s[n.parentID][n.fromIndex],n.toIndex);break;case i.TEXT_CONTENT:a(n.parentNode,n.textContent);break;case i.REMOVE_NODE:}}};t.exports=s},{12:12,133:133,145:145,70:70}],10:[function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=e(133),i={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=e.Properties||{},n=e.DOMAttributeNames||{},a=e.DOMPropertyNames||{},s=e.DOMMutationMethods||{};e.isCustomAttribute&&u._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var l in t){o(!u.isStandardName.hasOwnProperty(l)),u.isStandardName[l]=!0;var c=l.toLowerCase();if(u.getPossibleStandardName[c]=l,n.hasOwnProperty(l)){var p=n[l];u.getPossibleStandardName[p]=l,u.getAttributeName[l]=p}else u.getAttributeName[l]=c;u.getPropertyName[l]=a.hasOwnProperty(l)?a[l]:l,s.hasOwnProperty(l)?u.getMutationMethod[l]=s[l]:u.getMutationMethod[l]=null;var d=t[l];u.mustUseAttribute[l]=r(d,i.MUST_USE_ATTRIBUTE),u.mustUseProperty[l]=r(d,i.MUST_USE_PROPERTY),u.hasSideEffects[l]=r(d,i.HAS_SIDE_EFFECTS),u.hasBooleanValue[l]=r(d,i.HAS_BOOLEAN_VALUE),u.hasNumericValue[l]=r(d,i.HAS_NUMERIC_VALUE),u.hasPositiveNumericValue[l]=r(d,i.HAS_POSITIVE_NUMERIC_VALUE),u.hasOverloadedBooleanValue[l]=r(d,i.HAS_OVERLOADED_BOOLEAN_VALUE),o(!u.mustUseAttribute[l]||!u.mustUseProperty[l]),o(u.mustUseProperty[l]||!u.hasSideEffects[l]),o(!!u.hasBooleanValue[l]+!!u.hasNumericValue[l]+!!u.hasOverloadedBooleanValue[l]<=1)}}},a={},u={ID_ATTRIBUTE_NAME:"data-reactid",isStandardName:{},getPossibleStandardName:{},getAttributeName:{},getPropertyName:{},getMutationMethod:{},mustUseAttribute:{},mustUseProperty:{},hasSideEffects:{},hasBooleanValue:{},hasNumericValue:{},hasPositiveNumericValue:{},hasOverloadedBooleanValue:{},_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<u._isCustomAttributeFunctions.length;t++){var n=u._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=a[e];return r||(a[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:i};t.exports=u},{133:133}],11:[function(e,t,n){"use strict";function r(e,t){return null==t||o.hasBooleanValue[e]&&!t||o.hasNumericValue[e]&&isNaN(t)||o.hasPositiveNumericValue[e]&&1>t||o.hasOverloadedBooleanValue[e]&&t===!1}var o=e(10),i=e(143),a=(e(150),{createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+i(e)},createMarkupForProperty:function(e,t){if(o.isStandardName.hasOwnProperty(e)&&o.isStandardName[e]){if(r(e,t))return"";var n=o.getAttributeName[e];return o.hasBooleanValue[e]||o.hasOverloadedBooleanValue[e]&&t===!0?n:n+"="+i(t)}return o.isCustomAttribute(e)?null==t?"":e+"="+i(t):null},setValueForProperty:function(e,t,n){if(o.isStandardName.hasOwnProperty(t)&&o.isStandardName[t]){var i=o.getMutationMethod[t];if(i)i(e,n);else if(r(t,n))this.deleteValueForProperty(e,t);else if(o.mustUseAttribute[t])e.setAttribute(o.getAttributeName[t],""+n);else{var a=o.getPropertyName[t];o.hasSideEffects[t]&&""+e[a]==""+n||(e[a]=n)}}else o.isCustomAttribute(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){if(o.isStandardName.hasOwnProperty(t)&&o.isStandardName[t]){var n=o.getMutationMethod[t];if(n)n(e,void 0);else if(o.mustUseAttribute[t])e.removeAttribute(o.getAttributeName[t]);else{var r=o.getPropertyName[t],i=o.getDefaultValueForProperty(e.nodeName,r);o.hasSideEffects[t]&&""+e[r]===i||(e[r]=i)}}else o.isCustomAttribute(t)&&e.removeAttribute(t)}});t.exports=a},{10:10,143:143,150:150}],12:[function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=e(21),i=e(110),a=e(112),u=e(125),s=e(133),l=/^(<[^ \/>]+)/,c="data-danger-index",p={dangerouslyRenderMarkup:function(e){s(o.canUseDOM);for(var t,n={},p=0;p<e.length;p++)s(e[p]),t=r(e[p]),t=u(t)?t:"*",n[t]=n[t]||[],n[t][p]=e[p];var d=[],f=0;for(t in n)if(n.hasOwnProperty(t)){var h,m=n[t];for(h in m)if(m.hasOwnProperty(h)){var v=m[h];m[h]=v.replace(l,"$1 "+c+'="'+h+'" ')}for(var g=i(m.join(""),a),y=0;y<g.length;++y){var C=g[y];C.hasAttribute&&C.hasAttribute(c)&&(h=+C.getAttribute(c),C.removeAttribute(c),s(!d.hasOwnProperty(h)),d[h]=C,f+=1)}}return s(f===d.length),s(d.length===e.length),d},dangerouslyReplaceNodeWithMarkup:function(e,t){s(o.canUseDOM),s(t),s("html"!==e.tagName.toLowerCase());var n=i(t,a)[0];e.parentNode.replaceChild(n,e)}};t.exports=p},{110:110,112:112,125:125,133:133,21:21}],13:[function(e,t,n){"use strict";var r=e(139),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null}),r({AnalyticsEventPlugin:null}),r({MobileSafariClickEventPlugin:null})];t.exports=o},{139:139}],14:[function(e,t,n){"use strict";var r=e(15),o=e(20),i=e(97),a=e(68),u=e(139),s=r.topLevelTypes,l=a.getFirstReactDOM,c={mouseEnter:{registrationName:u({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:u({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},p=[null,null],d={eventTypes:c,extractEvents:function(e,t,n,r){if(e===s.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var u;if(t.window===t)u=t;else{var d=t.ownerDocument;u=d?d.defaultView||d.parentWindow:window}var f,h;if(e===s.topMouseOut?(f=t,h=l(r.relatedTarget||r.toElement)||u):(f=u,h=t),f===h)return null;var m=f?a.getID(f):"",v=h?a.getID(h):"",g=i.getPooled(c.mouseLeave,m,r);g.type="mouseleave",g.target=f,g.relatedTarget=h;var y=i.getPooled(c.mouseEnter,v,r);return y.type="mouseenter",y.target=h,y.relatedTarget=f,o.accumulateEnterLeaveDispatches(g,y,m,v),p[0]=g,p[1]=y,p}};t.exports=d},{139:139,15:15,20:20,68:68,97:97}],15:[function(e,t,n){"use strict";var r=e(138),o=r({bubbled:null,captured:null}),i=r({topBlur:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topReset:null,topScroll:null,topSelectionChange:null,topSubmit:null,topTextInput:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topWheel:null}),a={topLevelTypes:i,PropagationPhases:o};t.exports=a},{138:138}],16:[function(e,t,n){var r=e(112),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},{112:112}],17:[function(e,t,n){"use strict";var r=e(18),o=e(19),i=e(103),a=e(118),u=e(133),s={},l=null,c=function(e){if(e){var t=o.executeDispatch,n=r.getPluginModuleForEvent(e);n&&n.executeDispatch&&(t=n.executeDispatch),o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e)}},p=null,d={injection:{injectMount:o.injection.injectMount,injectInstanceHandle:function(e){p=e},getInstanceHandle:function(){return p},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,n){u(!n||"function"==typeof n);var r=s[t]||(s[t]={});r[e]=n},getListener:function(e,t){var n=s[t];return n&&n[e]},deleteListener:function(e,t){var n=s[t];n&&delete n[e]},deleteAllListeners:function(e){for(var t in s)delete s[t][e]},extractEvents:function(e,t,n,o){for(var a,u=r.plugins,s=0,l=u.length;l>s;s++){var c=u[s];if(c){var p=c.extractEvents(e,t,n,o);p&&(a=i(a,p))}}return a},enqueueEvents:function(e){e&&(l=i(l,e))},processEventQueue:function(){var e=l;l=null,a(e,c),u(!l)},__purge:function(){s={}},__getListenerBank:function(){return s}};t.exports=d},{103:103,118:118,133:133,18:18,19:19}],18:[function(e,t,n){"use strict";function r(){if(u)for(var e in s){var t=s[e],n=u.indexOf(e);if(a(n>-1),!l.plugins[n]){a(t.extractEvents),l.plugins[n]=t;var r=t.eventTypes;for(var i in r)a(o(r[i],t,i))}}}function o(e,t,n){a(!l.eventNameDispatchConfigs.hasOwnProperty(n)),l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];i(u,t,n)}return!0}return e.registrationName?(i(e.registrationName,t,n),!0):!1}function i(e,t,n){a(!l.registrationNameModules[e]),l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var a=e(133),u=null,s={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){a(!u),u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(a(!s[n]),s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=l},{133:133}],19:[function(e,t,n){"use strict";function r(e){return e===v.topMouseUp||e===v.topTouchEnd||e===v.topTouchCancel}function o(e){return e===v.topMouseMove||e===v.topTouchMove}function i(e){return e===v.topMouseDown||e===v.topTouchStart}function a(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)t(e,n[o],r[o]);else n&&t(e,n,r)}function u(e,t,n){e.currentTarget=m.Mount.getNode(n);var r=t(e,n);return e.currentTarget=null,r}function s(e,t){a(e,t),e._dispatchListeners=null,e._dispatchIDs=null}function l(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function c(e){var t=l(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function p(e){var t=e._dispatchListeners,n=e._dispatchIDs;h(!Array.isArray(t));var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function d(e){return!!e._dispatchListeners}var f=e(15),h=e(133),m={Mount:null,injectMount:function(e){m.Mount=e}},v=f.topLevelTypes,g={isEndish:r,isMoveish:o,isStartish:i,executeDirectDispatch:p,executeDispatch:u,executeDispatchesInOrder:s,executeDispatchesInOrderStopAtTrue:c,hasDispatches:d,injection:m,useTouchEvents:!1};t.exports=g},{133:133,15:15}],20:[function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return v(e,r)}function o(e,t,n){var o=t?m.bubbled:m.captured,i=r(e,n,o);i&&(n._dispatchListeners=f(n._dispatchListeners,i),n._dispatchIDs=f(n._dispatchIDs,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&d.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,o,e)}function a(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=v(e,r);o&&(n._dispatchListeners=f(n._dispatchListeners,o),n._dispatchIDs=f(n._dispatchIDs,e))}}function u(e){e&&e.dispatchConfig.registrationName&&a(e.dispatchMarker,null,e)}function s(e){h(e,i)}function l(e,t,n,r){d.injection.getInstanceHandle().traverseEnterLeave(n,r,a,e,t)}function c(e){h(e,u)}var p=e(15),d=e(17),f=e(103),h=e(118),m=p.PropagationPhases,v=d.getListener,g={accumulateTwoPhaseDispatches:s,accumulateDirectDispatches:c,accumulateEnterLeaveDispatches:l};t.exports=g},{103:103,118:118,15:15,17:17}],21:[function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],22:[function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=e(28),i=e(27),a=e(128);i(r.prototype,{getText:function(){return"value"in this._root?this._root.value:this._root[a()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(e=0;r>e&&n[e]===o[e];e++);var a=r-e;for(t=1;a>=t&&n[r-t]===o[i-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),o.addPoolingTo(r),t.exports=r},{128:128,27:27,28:28}],23:[function(e,t,n){"use strict";var r,o=e(10),i=e(21),a=o.injection.MUST_USE_ATTRIBUTE,u=o.injection.MUST_USE_PROPERTY,s=o.injection.HAS_BOOLEAN_VALUE,l=o.injection.HAS_SIDE_EFFECTS,c=o.injection.HAS_NUMERIC_VALUE,p=o.injection.HAS_POSITIVE_NUMERIC_VALUE,d=o.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(i.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:a|s,allowTransparency:a,alt:null,async:s,autoComplete:null,autoPlay:s,cellPadding:null,cellSpacing:null,charSet:a,checked:u|s,classID:a,className:r?a:u,cols:a|p,colSpan:null,content:null,contentEditable:null,contextMenu:a,controls:u|s,coords:null,crossOrigin:null,data:null,dateTime:a,defer:s,dir:null,disabled:a|s,download:d,draggable:null,encType:null,form:a,formAction:a,formEncType:a,formMethod:a,formNoValidate:s,formTarget:a,frameBorder:a,headers:null,height:a,hidden:a|s,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:u,label:null,lang:null,list:a,loop:u|s,low:null,manifest:a,marginHeight:null,marginWidth:null,max:null,maxLength:a,media:a,mediaGroup:null,method:null,min:null,multiple:u|s,muted:u|s,name:null,noValidate:s,open:s,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:u|s,rel:null,required:s,role:a,rows:a|p,rowSpan:null,sandbox:null,scope:null,scoped:s,scrolling:null,seamless:a|s,selected:u|s,shape:null,size:a|p,sizes:a,span:p,spellCheck:null,src:null,srcDoc:u,srcSet:a,start:c,step:null,style:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:u|l,width:a,wmode:a,autoCapitalize:null,autoCorrect:null,itemProp:a,itemScope:a|s,itemType:a,itemID:a,itemRef:a,property:null,unselectable:a},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{10:10,21:21}],24:[function(e,t,n){"use strict";function r(e){l(null==e.props.checkedLink||null==e.props.valueLink)}function o(e){r(e),l(null==e.props.value&&null==e.props.onChange)}function i(e){r(e),l(null==e.props.checked&&null==e.props.onChange)}function a(e){this.props.valueLink.requestChange(e.target.value)}function u(e){this.props.checkedLink.requestChange(e.target.checked)}var s=e(76),l=e(133),c={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0},p={Mixin:{propTypes:{value:function(e,t,n){return!e[t]||c[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:s.func}},getValue:function(e){return e.props.valueLink?(o(e),e.props.valueLink.value):e.props.value},getChecked:function(e){return e.props.checkedLink?(i(e),e.props.checkedLink.value):e.props.checked},getOnChange:function(e){return e.props.valueLink?(o(e),a):e.props.checkedLink?(i(e),u):e.props.onChange}};t.exports=p},{133:133,76:76}],25:[function(e,t,n){"use strict";function r(e){e.remove()}var o=e(30),i=e(103),a=e(118),u=e(133),s={trapBubbledEvent:function(e,t){u(this.isMounted());var n=this.getDOMNode();u(n);var r=o.trapBubbledEvent(e,t,n);this._localEventListeners=i(this._localEventListeners,r)},componentWillUnmount:function(){this._localEventListeners&&a(this._localEventListeners,r)}};t.exports=s},{103:103,118:118,133:133,30:30}],26:[function(e,t,n){"use strict";var r=e(15),o=e(112),i=r.topLevelTypes,a={eventTypes:null,extractEvents:function(e,t,n,r){if(e===i.topTouchStart){var a=r.target;a&&!a.onclick&&(a.onclick=o)}}};t.exports=a},{112:112,15:15}],27:[function(e,t,n){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,o=1;o<arguments.length;o++){var i=arguments[o];if(null!=i){var a=Object(i);for(var u in a)r.call(a,u)&&(n[u]=a[u])}}return n}t.exports=r},{}],28:[function(e,t,n){"use strict";var r=e(133),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},i=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},u=function(e,t,n,r,o){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,n,r,o),a}return new i(e,t,n,r,o)},s=function(e){var t=this;r(e instanceof t),e.destructor&&e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=10,c=o,p=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||c,n.poolSize||(n.poolSize=l),n.release=s,n},d={addPoolingTo:p,oneArgumentPooler:o,twoArgumentPooler:i,threeArgumentPooler:a,fiveArgumentPooler:u};t.exports=d},{133:133}],29:[function(e,t,n){"use strict";var r=e(115),o={getDOMNode:function(){return r(this)}};t.exports=o},{115:115}],30:[function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=f++,p[e[m]]={}),p[e[m]]}var o=e(15),i=e(17),a=e(18),u=e(59),s=e(102),l=e(27),c=e(134),p={},d=!1,f=0,h={topBlur:"blur",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),v=l({},u,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,i=r(n),u=a.registrationNameDependencies[e],s=o.topLevelTypes,l=0,p=u.length;p>l;l++){var d=u[l];i.hasOwnProperty(d)&&i[d]||(d===s.topWheel?c("wheel")?v.ReactEventListener.trapBubbledEvent(s.topWheel,"wheel",n):c("mousewheel")?v.ReactEventListener.trapBubbledEvent(s.topWheel,"mousewheel",n):v.ReactEventListener.trapBubbledEvent(s.topWheel,"DOMMouseScroll",n):d===s.topScroll?c("scroll",!0)?v.ReactEventListener.trapCapturedEvent(s.topScroll,"scroll",n):v.ReactEventListener.trapBubbledEvent(s.topScroll,"scroll",v.ReactEventListener.WINDOW_HANDLE):d===s.topFocus||d===s.topBlur?(c("focus",!0)?(v.ReactEventListener.trapCapturedEvent(s.topFocus,"focus",n),v.ReactEventListener.trapCapturedEvent(s.topBlur,"blur",n)):c("focusin")&&(v.ReactEventListener.trapBubbledEvent(s.topFocus,"focusin",n),v.ReactEventListener.trapBubbledEvent(s.topBlur,"focusout",n)),i[s.topBlur]=!0,i[s.topFocus]=!0):h.hasOwnProperty(d)&&v.ReactEventListener.trapBubbledEvent(d,h[d],n),i[d]=!0)}},trapBubbledEvent:function(e,t,n){
-return v.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return v.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!d){var e=s.refreshScrollValues;v.ReactEventListener.monitorScrollValue(e),d=!0}},eventNameDispatchConfigs:i.eventNameDispatchConfigs,registrationNameModules:i.registrationNameModules,putListener:i.putListener,getListener:i.getListener,deleteListener:i.deleteListener,deleteAllListeners:i.deleteAllListeners});t.exports=v},{102:102,134:134,15:15,17:17,18:18,27:27,59:59}],31:[function(e,t,n){"use strict";var r=e(79),o=e(116),i=e(132),a=e(147),u={instantiateChildren:function(e,t,n){var r=o(e);for(var a in r)if(r.hasOwnProperty(a)){var u=r[a],s=i(u,null);r[a]=s}return r},updateChildren:function(e,t,n,u){var s=o(t);if(!s&&!e)return null;var l;for(l in s)if(s.hasOwnProperty(l)){var c=e&&e[l],p=c&&c._currentElement,d=s[l];if(a(p,d))r.receiveComponent(c,d,n,u),s[l]=c;else{c&&r.unmountComponent(c,l);var f=i(d,null);s[l]=f}}for(l in e)!e.hasOwnProperty(l)||s&&s.hasOwnProperty(l)||r.unmountComponent(e[l]);return s},unmountChildren:function(e){for(var t in e){var n=e[t];r.unmountComponent(n)}}};t.exports=u},{116:116,132:132,147:147,79:79}],32:[function(e,t,n){"use strict";function r(e,t){this.forEachFunction=e,this.forEachContext=t}function o(e,t,n,r){var o=e;o.forEachFunction.call(o.forEachContext,t,r)}function i(e,t,n){if(null==e)return e;var i=r.getPooled(t,n);f(e,o,i),r.release(i)}function a(e,t,n){this.mapResult=e,this.mapFunction=t,this.mapContext=n}function u(e,t,n,r){var o=e,i=o.mapResult,a=!i.hasOwnProperty(n);if(a){var u=o.mapFunction.call(o.mapContext,t,r);i[n]=u}}function s(e,t,n){if(null==e)return e;var r={},o=a.getPooled(r,t,n);return f(e,u,o),a.release(o),d.create(r)}function l(e,t,n,r){return null}function c(e,t){return f(e,l,null)}var p=e(28),d=e(61),f=e(149),h=(e(150),p.twoArgumentPooler),m=p.threeArgumentPooler;p.addPoolingTo(r,h),p.addPoolingTo(a,m);var v={forEach:i,map:s,count:c};t.exports=v},{149:149,150:150,28:28,61:61}],33:[function(e,t,n){"use strict";function r(e,t){var n=D.hasOwnProperty(t)?D[t]:null;N.hasOwnProperty(t)&&y(n===_.OVERRIDE_BASE),e.hasOwnProperty(t)&&y(n===_.DEFINE_MANY||n===_.DEFINE_MANY_MERGED)}function o(e,t){if(t){y("function"!=typeof t),y(!d.isValidElement(t));var n=e.prototype;t.hasOwnProperty(b)&&M.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==b){var i=t[o];if(r(n,o),M.hasOwnProperty(o))M[o](e,i);else{var a=D.hasOwnProperty(o),l=n.hasOwnProperty(o),c=i&&i.__reactDontBind,p="function"==typeof i,f=p&&!a&&!l&&!c;if(f)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[o]=i,n[o]=i;else if(l){var h=D[o];y(a&&(h===_.DEFINE_MANY_MERGED||h===_.DEFINE_MANY)),h===_.DEFINE_MANY_MERGED?n[o]=u(n[o],i):h===_.DEFINE_MANY&&(n[o]=s(n[o],i))}else n[o]=i}}}}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in M;y(!o);var i=n in e;y(!i),e[n]=r}}}function a(e,t){y(e&&t&&"object"==typeof e&&"object"==typeof t);for(var n in t)t.hasOwnProperty(n)&&(y(void 0===e[n]),e[n]=t[n]);return e}function u(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return a(o,n),a(o,r),o}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function c(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=l(e,f.guard(n,e.constructor.displayName+"."+t))}}var p=e(34),d=(e(39),e(55)),f=e(58),h=e(65),m=e(66),v=(e(75),e(74),e(84)),g=e(27),y=e(133),C=e(138),E=e(139),b=(e(150),E({mixins:null})),_=C({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),x=[],D={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},M={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=g({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=g({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=u(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=g({},e.propTypes,t)},statics:function(e,t){i(e,t)}},N={replaceState:function(e,t){v.enqueueReplaceState(this,e),t&&v.enqueueCallback(this,t)},isMounted:function(){var e=h.get(this);return e&&e!==m.currentlyMountingInstance},setProps:function(e,t){v.enqueueSetProps(this,e),t&&v.enqueueCallback(this,t)},replaceProps:function(e,t){v.enqueueReplaceProps(this,e),t&&v.enqueueCallback(this,t)}},I=function(){};g(I.prototype,p.prototype,N);var T={createClass:function(e){var t=function(e,t){this.__reactAutoBindMap&&c(this),this.props=e,this.context=t,this.state=null;var n=this.getInitialState?this.getInitialState():null;y("object"==typeof n&&!Array.isArray(n)),this.state=n};t.prototype=new I,t.prototype.constructor=t,x.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),y(t.prototype.render);for(var n in D)t.prototype[n]||(t.prototype[n]=null);return t.type=t,t},injection:{injectMixin:function(e){x.push(e)}}};t.exports=T},{133:133,138:138,139:139,150:150,27:27,34:34,39:39,55:55,58:58,65:65,66:66,74:74,75:75,84:84}],34:[function(e,t,n){"use strict";function r(e,t){this.props=e,this.context=t}{var o=e(84),i=e(133);e(150)}r.prototype.setState=function(e,t){i("object"==typeof e||"function"==typeof e||null==e),o.enqueueSetState(this,e),t&&o.enqueueCallback(this,t)},r.prototype.forceUpdate=function(e){o.enqueueForceUpdate(this),e&&o.enqueueCallback(this,e)};t.exports=r},{133:133,150:150,84:84}],35:[function(e,t,n){"use strict";var r=e(44),o=e(68),i={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:r.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){o.purgeID(e)}};t.exports=i},{44:44,68:68}],36:[function(e,t,n){"use strict";var r=e(133),o=!1,i={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){r(!o),i.unmountIDFromEnvironment=e.unmountIDFromEnvironment,i.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,i.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};t.exports=i},{133:133}],37:[function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}var o=e(36),i=e(38),a=e(39),u=e(55),s=(e(56),e(65)),l=e(66),c=e(71),p=e(73),d=e(75),f=(e(74),e(79)),h=e(85),m=e(27),v=e(113),g=e(133),y=e(147),C=(e(150),1),E={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._isTopLevel=!1,this._pendingCallbacks=null},mountComponent:function(e,t,n){this._context=n,this._mountOrder=C++,this._rootNodeID=e;var r=this._processProps(this._currentElement.props),o=this._processContext(this._currentElement._context),i=c.getComponentClassForElement(this._currentElement),a=new i(r,o);a.props=r,a.context=o,a.refs=v,this._instance=a,s.set(a,this);var u=a.state;void 0===u&&(a.state=u=null),g("object"==typeof u&&!Array.isArray(u)),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var p,d,h=l.currentlyMountingInstance;l.currentlyMountingInstance=this;try{a.componentWillMount&&(a.componentWillMount(),this._pendingStateQueue&&(a.state=this._processPendingState(a.props,a.context))),p=this._getValidatedChildContext(n),d=this._renderValidatedComponent(p)}finally{l.currentlyMountingInstance=h}this._renderedComponent=this._instantiateReactComponent(d,this._currentElement.type);var m=f.mountComponent(this._renderedComponent,e,t,this._mergeChildContext(n,p));return a.componentDidMount&&t.getReactMountReady().enqueue(a.componentDidMount,a),m},unmountComponent:function(){var e=this._instance;if(e.componentWillUnmount){var t=l.currentlyUnmountingInstance;l.currentlyUnmountingInstance=this;try{e.componentWillUnmount()}finally{l.currentlyUnmountingInstance=t}}f.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,s.remove(e)},_setPropsInternal:function(e,t){var n=this._pendingElement||this._currentElement;this._pendingElement=u.cloneAndReplaceProps(n,m({},n.props,e)),h.enqueueUpdate(this,t)},_maskContext:function(e){var t=null;if("string"==typeof this._currentElement.type)return v;var n=this._currentElement.type.contextTypes;if(!n)return v;t={};for(var r in n)t[r]=e[r];return t},_processContext:function(e){var t=this._maskContext(e);return t},_getValidatedChildContext:function(e){var t=this._instance,n=t.getChildContext&&t.getChildContext();if(n){g("object"==typeof t.constructor.childContextTypes);for(var r in n)g(r in t.constructor.childContextTypes);return n}return null},_mergeChildContext:function(e,t){return t?m({},e,t):e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var i in e)if(e.hasOwnProperty(i)){var a;try{g("function"==typeof e[i]),a=e[i](t,i,o,n)}catch(u){a=u}a instanceof Error&&(r(this),n===d.prop)}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&f.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},_warnIfContextsDiffer:function(e,t){e=this._maskContext(e),t=this._maskContext(t);for(var n=Object.keys(t).sort(),r=(this.getName()||"ReactCompositeComponent",0);r<n.length;r++)n[r]},updateComponent:function(e,t,n,r,o){var i=this._instance,a=i.context,u=i.props;t!==n&&(a=this._processContext(n._context),u=this._processProps(n.props),i.componentWillReceiveProps&&i.componentWillReceiveProps(u,a));var s=this._processPendingState(u,a),l=this._pendingForceUpdate||!i.shouldComponentUpdate||i.shouldComponentUpdate(u,s,a);l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,u,s,a,e,o)):(this._currentElement=n,this._context=o,i.props=u,i.state=s,i.context=a)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var i=m({},o?r[0]:n.state),a=o?1:0;a<r.length;a++){var u=r[a];m(i,"function"==typeof u?u.call(n,i,e,t):u)}return i},_performComponentUpdate:function(e,t,n,r,o,i){var a=this._instance,u=a.props,s=a.state,l=a.context;a.componentWillUpdate&&a.componentWillUpdate(t,n,r),this._currentElement=e,this._context=i,a.props=t,a.state=n,a.context=r,this._updateRenderedComponent(o,i),a.componentDidUpdate&&o.getReactMountReady().enqueue(a.componentDidUpdate.bind(a,u,s,l),a)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._getValidatedChildContext(),i=this._renderValidatedComponent(o);if(y(r,i))f.receiveComponent(n,i,e,this._mergeChildContext(t,o));else{var a=this._rootNodeID,u=n._rootNodeID;f.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(i,this._currentElement.type);var s=f.mountComponent(this._renderedComponent,a,e,this._mergeChildContext(t,o));this._replaceNodeWithMarkupByID(u,s)}},_replaceNodeWithMarkupByID:function(e,t){o.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(e){var t,n=i.current;i.current=this._mergeChildContext(this._currentElement._context,e),a.current=this;try{t=this._renderValidatedComponentWithoutOwnerOrContext()}finally{i.current=n,a.current=null}return g(null===t||t===!1||u.isValidElement(t)),t},attachRef:function(e,t){var n=this.getPublicInstance(),r=n.refs===v?n.refs={}:n.refs;r[e]=t.getPublicInstance()},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){return this._instance},_instantiateReactComponent:null};p.measureMethods(E,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var b={Mixin:E};t.exports=b},{113:113,133:133,147:147,150:150,27:27,36:36,38:38,39:39,55:55,56:56,65:65,66:66,71:71,73:73,74:74,75:75,79:79,85:85}],38:[function(e,t,n){"use strict";var r=e(27),o=e(113),i=(e(150),{current:o,withContext:function(e,t){var n,o=i.current;i.current=r({},o,e);try{n=t()}finally{i.current=o}return n}});t.exports=i},{113:113,150:150,27:27}],39:[function(e,t,n){"use strict";var r={current:null};t.exports=r},{}],40:[function(e,t,n){"use strict";function r(e){return o.createFactory(e)}var o=e(55),i=(e(56),e(140)),a=i({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);t.exports=a},{140:140,55:55,56:56}],41:[function(e,t,n){"use strict";var r=e(2),o=e(29),i=e(33),a=e(55),u=e(138),s=a.createFactory("button"),l=u({onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0}),c=i.createClass({displayName:"ReactDOMButton",tagName:"BUTTON",mixins:[r,o],render:function(){var e={};for(var t in this.props)!this.props.hasOwnProperty(t)||this.props.disabled&&l[t]||(e[t]=this.props[t]);return s(e,this.props.children)}});t.exports=c},{138:138,2:2,29:29,33:33,55:55}],42:[function(e,t,n){"use strict";function r(e){e&&(null!=e.dangerouslySetInnerHTML&&(g(null==e.children),g("object"==typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML)),g(null==e.style||"object"==typeof e.style))}function o(e,t,n,r){var o=d.findReactContainerForID(e);if(o){var i=o.nodeType===D?o.ownerDocument:o;E(t,i)}r.getPutListenerQueue().enqueuePutListener(e,t,n)}function i(e){P.call(T,e)||(g(I.test(e)),T[e]=!0)}function a(e){i(e),this._tag=e,this._renderedChildren=null,this._previousStyleCopy=null,this._rootNodeID=null}var u=e(5),s=e(10),l=e(11),c=e(30),p=e(35),d=e(68),f=e(69),h=e(73),m=e(27),v=e(114),g=e(133),y=(e(134),e(139)),C=(e(150),c.deleteListener),E=c.listenTo,b=c.registrationNameModules,_={string:!0,number:!0},x=y({style:null}),D=1,M=null,N={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},I=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,T={},P={}.hasOwnProperty;a.displayName="ReactDOMComponent",a.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e,r(this._currentElement.props);var o=N[this._tag]?"":"</"+this._tag+">";return this._createOpenTagMarkupAndPutListeners(t)+this._createContentMarkup(t,n)+o},_createOpenTagMarkupAndPutListeners:function(e){var t=this._currentElement.props,n="<"+this._tag;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(b.hasOwnProperty(r))o(this._rootNodeID,r,i,e);else{r===x&&(i&&(i=this._previousStyleCopy=m({},t.style)),i=u.createMarkupForStyles(i));var a=l.createMarkupForProperty(r,i);a&&(n+=" "+a)}}if(e.renderToStaticMarkup)return n+">";var s=l.createMarkupForID(this._rootNodeID);return n+" "+s+">"},_createContentMarkup:function(e,t){var n="";("listing"===this._tag||"pre"===this._tag||"textarea"===this._tag)&&(n="\n");var r=this._currentElement.props,o=r.dangerouslySetInnerHTML;if(null!=o){if(null!=o.__html)return n+o.__html}else{var i=_[typeof r.children]?r.children:null,a=null!=i?null:r.children;if(null!=i)return n+v(i);if(null!=a){var u=this.mountChildren(a,e,t);return n+u.join("")}}return n},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,o){r(this._currentElement.props),this._updateDOMProperties(t.props,e),this._updateDOMChildren(t.props,e,o)},_updateDOMProperties:function(e,t){var n,r,i,a=this._currentElement.props;for(n in e)if(!a.hasOwnProperty(n)&&e.hasOwnProperty(n))if(n===x){var u=this._previousStyleCopy;for(r in u)u.hasOwnProperty(r)&&(i=i||{},i[r]="");this._previousStyleCopy=null}else b.hasOwnProperty(n)?C(this._rootNodeID,n):(s.isStandardName[n]||s.isCustomAttribute(n))&&M.deletePropertyByID(this._rootNodeID,n);for(n in a){var l=a[n],c=n===x?this._previousStyleCopy:e[n];if(a.hasOwnProperty(n)&&l!==c)if(n===x)if(l?l=this._previousStyleCopy=m({},l):this._previousStyleCopy=null,c){for(r in c)!c.hasOwnProperty(r)||l&&l.hasOwnProperty(r)||(i=i||{},i[r]="");for(r in l)l.hasOwnProperty(r)&&c[r]!==l[r]&&(i=i||{},i[r]=l[r])}else i=l;else b.hasOwnProperty(n)?o(this._rootNodeID,n,l,t):(s.isStandardName[n]||s.isCustomAttribute(n))&&M.updatePropertyByID(this._rootNodeID,n,l)}i&&M.updateStylesByID(this._rootNodeID,i)},_updateDOMChildren:function(e,t,n){var r=this._currentElement.props,o=_[typeof e.children]?e.children:null,i=_[typeof r.children]?r.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=r.dangerouslySetInnerHTML&&r.dangerouslySetInnerHTML.__html,s=null!=o?null:e.children,l=null!=i?null:r.children,c=null!=o||null!=a,p=null!=i||null!=u;null!=s&&null==l?this.updateChildren(null,t,n):c&&!p&&this.updateTextContent(""),null!=i?o!==i&&this.updateTextContent(""+i):null!=u?a!==u&&M.updateInnerHTMLByID(this._rootNodeID,u):null!=l&&this.updateChildren(l,t,n)},unmountComponent:function(){this.unmountChildren(),c.deleteAllListeners(this._rootNodeID),p.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null}},h.measureMethods(a,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),m(a.prototype,a.Mixin,f.Mixin),a.injection={injectIDOperations:function(e){a.BackendIDOperations=M=e}},t.exports=a},{10:10,11:11,114:114,133:133,134:134,139:139,150:150,27:27,30:30,35:35,5:5,68:68,69:69,73:73}],43:[function(e,t,n){"use strict";var r=e(15),o=e(25),i=e(29),a=e(33),u=e(55),s=u.createFactory("form"),l=a.createClass({displayName:"ReactDOMForm",tagName:"FORM",mixins:[i,o],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topReset,"reset"),this.trapBubbledEvent(r.topLevelTypes.topSubmit,"submit")}});t.exports=l},{15:15,25:25,29:29,33:33,55:55}],44:[function(e,t,n){"use strict";var r=e(5),o=e(9),i=e(11),a=e(68),u=e(73),s=e(133),l=e(144),c={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},p={updatePropertyByID:function(e,t,n){var r=a.getNode(e);s(!c.hasOwnProperty(t)),null!=n?i.setValueForProperty(r,t,n):i.deleteValueForProperty(r,t)},deletePropertyByID:function(e,t,n){var r=a.getNode(e);s(!c.hasOwnProperty(t)),i.deleteValueForProperty(r,t,n)},updateStylesByID:function(e,t){var n=a.getNode(e);r.setValueForStyles(n,t)},updateInnerHTMLByID:function(e,t){var n=a.getNode(e);l(n,t)},updateTextContentByID:function(e,t){var n=a.getNode(e);o.updateTextContent(n,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=a.getNode(e);o.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=a.getNode(e[n].parentID);o.processUpdates(e,t)}};u.measureMethods(p,"ReactDOMIDOperations",{updatePropertyByID:"updatePropertyByID",deletePropertyByID:"deletePropertyByID",updateStylesByID:"updateStylesByID",updateInnerHTMLByID:"updateInnerHTMLByID",updateTextContentByID:"updateTextContentByID",dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=p},{11:11,133:133,144:144,5:5,68:68,73:73,9:9}],45:[function(e,t,n){"use strict";var r=e(15),o=e(25),i=e(29),a=e(33),u=e(55),s=u.createFactory("iframe"),l=a.createClass({displayName:"ReactDOMIframe",tagName:"IFRAME",mixins:[i,o],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topLoad,"load")}});t.exports=l},{15:15,25:25,29:29,33:33,55:55}],46:[function(e,t,n){"use strict";var r=e(15),o=e(25),i=e(29),a=e(33),u=e(55),s=u.createFactory("img"),l=a.createClass({displayName:"ReactDOMImg",tagName:"IMG",mixins:[i,o],render:function(){return s(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topLoad,"load"),this.trapBubbledEvent(r.topLevelTypes.topError,"error")}});t.exports=l},{15:15,25:25,29:29,33:33,55:55}],47:[function(e,t,n){"use strict";function r(){this.isMounted()&&this.forceUpdate()}var o=e(2),i=e(11),a=e(24),u=e(29),s=e(33),l=e(55),c=e(68),p=e(85),d=e(27),f=e(133),h=l.createFactory("input"),m={},v=s.createClass({displayName:"ReactDOMInput",tagName:"INPUT",mixins:[o,a.Mixin,u],getInitialState:function(){var e=this.props.defaultValue;return{initialChecked:this.props.defaultChecked||!1,initialValue:null!=e?e:null}},render:function(){var e=d({},this.props);e.defaultChecked=null,e.defaultValue=null;var t=a.getValue(this);e.value=null!=t?t:this.state.initialValue;var n=a.getChecked(this);return e.checked=null!=n?n:this.state.initialChecked,e.onChange=this._handleChange,h(e,this.props.children)},componentDidMount:function(){var e=c.getID(this.getDOMNode());m[e]=this},componentWillUnmount:function(){var e=this.getDOMNode(),t=c.getID(e);delete m[t]},componentDidUpdate:function(e,t,n){var r=this.getDOMNode();null!=this.props.checked&&i.setValueForProperty(r,"checked",this.props.checked||!1);var o=a.getValue(this);null!=o&&i.setValueForProperty(r,"value",""+o)},_handleChange:function(e){var t,n=a.getOnChange(this);n&&(t=n.call(this,e)),p.asap(r,this);var o=this.props.name;if("radio"===this.props.type&&null!=o){for(var i=this.getDOMNode(),u=i;u.parentNode;)u=u.parentNode;for(var s=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),l=0,d=s.length;d>l;l++){var h=s[l];if(h!==i&&h.form===i.form){var v=c.getID(h);f(v);var g=m[v];f(g),p.asap(r,g)}}}return t}});t.exports=v},{11:11,133:133,2:2,24:24,27:27,29:29,33:33,55:55,68:68,85:85}],48:[function(e,t,n){"use strict";var r=e(29),o=e(33),i=e(55),a=(e(150),i.createFactory("option")),u=o.createClass({displayName:"ReactDOMOption",tagName:"OPTION",mixins:[r],componentWillMount:function(){},render:function(){return a(this.props,this.props.children)}});t.exports=u},{150:150,29:29,33:33,55:55}],49:[function(e,t,n){"use strict";function r(){if(this._pendingUpdate){this._pendingUpdate=!1;var e=u.getValue(this);null!=e&&this.isMounted()&&i(this,e)}}function o(e,t,n){if(null==e[t])return null;if(e.multiple){if(!Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be an array if `multiple` is true.")}else if(Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be a scalar value if `multiple` is false.")}function i(e,t){var n,r,o,i=e.getDOMNode().options;if(e.props.multiple){for(n={},r=0,o=t.length;o>r;r++)n[""+t[r]]=!0;for(r=0,o=i.length;o>r;r++){var a=n.hasOwnProperty(i[r].value);i[r].selected!==a&&(i[r].selected=a)}}else{for(n=""+t,r=0,o=i.length;o>r;r++)if(i[r].value===n)return void(i[r].selected=!0);i.length&&(i[0].selected=!0)}}var a=e(2),u=e(24),s=e(29),l=e(33),c=e(55),p=e(85),d=e(27),f=c.createFactory("select"),h=l.createClass({displayName:"ReactDOMSelect",tagName:"SELECT",mixins:[a,u.Mixin,s],propTypes:{defaultValue:o,value:o},render:function(){var e=d({},this.props);return e.onChange=this._handleChange,e.value=null,f(e,this.props.children)},componentWillMount:function(){this._pendingUpdate=!1},componentDidMount:function(){var e=u.getValue(this);null!=e?i(this,e):null!=this.props.defaultValue&&i(this,this.props.defaultValue)},componentDidUpdate:function(e){var t=u.getValue(this);null!=t?(this._pendingUpdate=!1,i(this,t)):!e.multiple!=!this.props.multiple&&(null!=this.props.defaultValue?i(this,this.props.defaultValue):i(this,this.props.multiple?[]:""))},_handleChange:function(e){var t,n=u.getOnChange(this);return n&&(t=n.call(this,e)),this._pendingUpdate=!0,p.asap(r,this),t}});t.exports=h},{2:2,24:24,27:27,29:29,33:33,55:55,85:85}],50:[function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var i=o.text.length,a=i+r;return{start:i,end:a}}function i(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,i=t.focusNode,a=t.focusOffset,u=t.getRangeAt(0),s=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=s?0:u.toString().length,c=u.cloneRange();c.selectNodeContents(e),c.setEnd(u.startContainer,u.startOffset);var p=r(c.startContainer,c.startOffset,c.endContainer,c.endOffset),d=p?0:c.toString().length,f=d+l,h=document.createRange();h.setStart(n,o),h.setEnd(i,a);var m=h.collapsed;return{start:m?f:d,end:m?d:f}}function a(e,t){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function u(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,o=Math.min(t.start,r),i="undefined"==typeof t.end?o:Math.min(t.end,r);if(!n.extend&&o>i){var a=i;i=o,o=a}var u=l(e,o),s=l(e,i);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>i?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}var s=e(21),l=e(126),c=e(128),p=s.canUseDOM&&"selection"in document&&!("getSelection"in window),d={getOffsets:p?o:i,setOffsets:p?a:u};t.exports=d},{126:126,128:128,21:21}],51:[function(e,t,n){"use strict";var r=e(11),o=e(35),i=e(42),a=e(27),u=e(114),s=function(e){};a(s.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){this._rootNodeID=e;var o=u(this._stringText);return t.renderToStaticMarkup?o:"<span "+r.createMarkupForID(e)+">"+o+"</span>"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;n!==this._stringText&&(this._stringText=n,i.BackendIDOperations.updateTextContentByID(this._rootNodeID,n))}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=s},{11:11,114:114,27:27,35:35,42:42}],52:[function(e,t,n){"use strict";function r(){this.isMounted()&&this.forceUpdate()}var o=e(2),i=e(11),a=e(24),u=e(29),s=e(33),l=e(55),c=e(85),p=e(27),d=e(133),f=(e(150),l.createFactory("textarea")),h=s.createClass({displayName:"ReactDOMTextarea",tagName:"TEXTAREA",mixins:[o,a.Mixin,u],getInitialState:function(){var e=this.props.defaultValue,t=this.props.children;null!=t&&(d(null==e),Array.isArray(t)&&(d(t.length<=1),t=t[0]),e=""+t),null==e&&(e="");var n=a.getValue(this);return{initialValue:""+(null!=n?n:e)}},render:function(){var e=p({},this.props);return d(null==e.dangerouslySetInnerHTML),e.defaultValue=null,e.value=null,e.onChange=this._handleChange,f(e,this.state.initialValue)},componentDidUpdate:function(e,t,n){var r=a.getValue(this);if(null!=r){var o=this.getDOMNode();i.setValueForProperty(o,"value",""+r)}},_handleChange:function(e){var t,n=a.getOnChange(this);return n&&(t=n.call(this,e)),c.asap(r,this),t}});t.exports=h},{11:11,133:133,150:150,2:2,24:24,27:27,29:29,33:33,55:55,85:85}],53:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=e(85),i=e(101),a=e(27),u=e(112),s={initialize:u,close:function(){d.isBatchingUpdates=!1}},l={initialize:u,close:o.flushBatchedUpdates.bind(o)},c=[l,s];a(r.prototype,i.Mixin,{getTransactionWrappers:function(){return c}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o){var i=d.isBatchingUpdates;d.isBatchingUpdates=!0,i?e(t,n,r,o):p.perform(e,null,t,n,r,o)}};t.exports=d},{101:101,112:112,27:27,85:85}],54:[function(e,t,n){"use strict";function r(e){return h.createClass({tagName:e.toUpperCase(),render:function(){return new T(e,null,null,null,null,this.props)}})}function o(){R.EventEmitter.injectReactEventListener(P),R.EventPluginHub.injectEventPluginOrder(s),R.EventPluginHub.injectInstanceHandle(w),R.EventPluginHub.injectMount(O),R.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:L,EnterLeaveEventPlugin:l,ChangeEventPlugin:a,MobileSafariClickEventPlugin:d,SelectEventPlugin:A,BeforeInputEventPlugin:i}),R.NativeComponent.injectGenericComponentClass(g),R.NativeComponent.injectTextComponentClass(I),R.NativeComponent.injectAutoWrapper(r),R.Class.injectMixin(f),R.NativeComponent.injectComponentClasses({button:y,form:C,iframe:_,img:E,input:x,option:D,select:M,textarea:N,html:F("html"),head:F("head"),body:F("body")}),R.DOMProperty.injectDOMPropertyConfig(p),R.DOMProperty.injectDOMPropertyConfig(U),R.EmptyComponent.injectEmptyComponent("noscript"),R.Updates.injectReconcileTransaction(S),R.Updates.injectBatchingStrategy(v),R.RootIndex.injectCreateReactRootIndex(c.canUseDOM?u.createReactRootIndex:k.createReactRootIndex),R.Component.injectEnvironment(m),R.DOMComponent.injectIDOperations(b)}var i=e(3),a=e(7),u=e(8),s=e(13),l=e(14),c=e(21),p=e(23),d=e(26),f=e(29),h=e(33),m=e(35),v=e(53),g=e(42),y=e(41),C=e(43),E=e(46),b=e(44),_=e(45),x=e(47),D=e(48),M=e(49),N=e(52),I=e(51),T=e(55),P=e(60),R=e(62),w=e(64),O=e(68),S=e(78),A=e(87),k=e(88),L=e(89),U=e(86),F=e(109);
-
-t.exports={inject:o}},{109:109,13:13,14:14,21:21,23:23,26:26,29:29,3:3,33:33,35:35,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,51:51,52:52,53:53,55:55,60:60,62:62,64:64,68:68,7:7,78:78,8:8,86:86,87:87,88:88,89:89}],55:[function(e,t,n){"use strict";var r=e(38),o=e(39),i=e(27),a=(e(150),{key:!0,ref:!0}),u=function(e,t,n,r,o,i){this.type=e,this.key=t,this.ref=n,this._owner=r,this._context=o,this.props=i};u.prototype={_isReactElement:!0},u.createElement=function(e,t,n){var i,s={},l=null,c=null;if(null!=t){c=void 0===t.ref?null:t.ref,l=void 0===t.key?null:""+t.key;for(i in t)t.hasOwnProperty(i)&&!a.hasOwnProperty(i)&&(s[i]=t[i])}var p=arguments.length-2;if(1===p)s.children=n;else if(p>1){for(var d=Array(p),f=0;p>f;f++)d[f]=arguments[f+2];s.children=d}if(e&&e.defaultProps){var h=e.defaultProps;for(i in h)"undefined"==typeof s[i]&&(s[i]=h[i])}return new u(e,l,c,o.current,r.current,s)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceProps=function(e,t){var n=new u(e.type,e.key,e.ref,e._owner,e._context,t);return n},u.cloneElement=function(e,t,n){var r,s=i({},e.props),l=e.key,c=e.ref,p=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,p=o.current),void 0!==t.key&&(l=""+t.key);for(r in t)t.hasOwnProperty(r)&&!a.hasOwnProperty(r)&&(s[r]=t[r])}var d=arguments.length-2;if(1===d)s.children=n;else if(d>1){for(var f=Array(d),h=0;d>h;h++)f[h]=arguments[h+2];s.children=f}return new u(e.type,l,c,p,e._context,s)},u.isValidElement=function(e){var t=!(!e||!e._isReactElement);return t},t.exports=u},{150:150,27:27,38:38,39:39}],56:[function(e,t,n){"use strict";function r(){if(y.current){var e=y.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e){var t=e&&e.getPublicInstance();if(!t)return void 0;var n=t.constructor;return n?n.displayName||n.name||void 0:void 0}function i(){var e=y.current;return e&&o(e)||void 0}function a(e,t){e._store.validated||null!=e.key||(e._store.validated=!0,s('Each child in an array or iterator should have a unique "key" prop.',e,t))}function u(e,t,n){D.test(e)&&s("Child objects should have non-numeric keys so ordering is preserved.",t,n)}function s(e,t,n){var r=i(),a="string"==typeof n?n:n.displayName||n.name,u=r||a,s=_[e]||(_[e]={});if(!s.hasOwnProperty(u)){s[u]=!0;var l="";if(t&&t._owner&&t._owner!==y.current){var c=o(t._owner);l=" It was passed a child from "+c+"."}}}function l(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];m.isValidElement(r)&&a(r,t)}else if(m.isValidElement(e))e._store.validated=!0;else if(e){var o=E(e);if(o){if(o!==e.entries)for(var i,s=o.call(e);!(i=s.next()).done;)m.isValidElement(i.value)&&a(i.value,t)}else if("object"==typeof e){var l=v.extractIfFragment(e);for(var c in l)l.hasOwnProperty(c)&&u(c,l[c],t)}}}function c(e,t,n,o){for(var i in t)if(t.hasOwnProperty(i)){var a;try{b("function"==typeof t[i]),a=t[i](n,i,e,o)}catch(u){a=u}a instanceof Error&&!(a.message in x)&&(x[a.message]=!0,r(this))}}function p(e,t){var n=t.type,r="string"==typeof n?n:n.displayName,o=t._owner?t._owner.getPublicInstance().constructor.displayName:null,i=e+"|"+r+"|"+o;if(!M.hasOwnProperty(i)){M[i]=!0;var a="";r&&(a=" <"+r+" />");var u="";o&&(u=" The element was created by "+o+".")}}function d(e,t){return e!==e?t!==t:0===e&&0===t?1/e===1/t:e===t}function f(e){if(e._store){var t=e._store.originalProps,n=e.props;for(var r in n)n.hasOwnProperty(r)&&(t.hasOwnProperty(r)&&d(t[r],n[r])||(p(r,e),t[r]=n[r]))}}function h(e){if(null!=e.type){var t=C.getComponentClassForElement(e),n=t.displayName||t.name;t.propTypes&&c(n,t.propTypes,e.props,g.prop),"function"==typeof t.getDefaultProps}}var m=e(55),v=e(61),g=e(75),y=(e(74),e(39)),C=e(71),E=e(124),b=e(133),_=(e(150),{}),x={},D=/^\d+$/,M={},N={checkAndWarnForMutatedProps:f,createElement:function(e,t,n){var r=m.createElement.apply(this,arguments);if(null==r)return r;for(var o=2;o<arguments.length;o++)l(arguments[o],e);return h(r),r},createFactory:function(e){var t=N.createElement.bind(null,e);return t.type=e,t},cloneElement:function(e,t,n){for(var r=m.cloneElement.apply(this,arguments),o=2;o<arguments.length;o++)l(arguments[o],r.type);return h(r),r}};t.exports=N},{124:124,133:133,150:150,39:39,55:55,61:61,71:71,74:74,75:75}],57:[function(e,t,n){"use strict";function r(e){c[e]=!0}function o(e){delete c[e]}function i(e){return!!c[e]}var a,u=e(55),s=e(65),l=e(133),c={},p={injectEmptyComponent:function(e){a=u.createFactory(e)}},d=function(){};d.prototype.componentDidMount=function(){var e=s.get(this);e&&r(e._rootNodeID)},d.prototype.componentWillUnmount=function(){var e=s.get(this);e&&o(e._rootNodeID)},d.prototype.render=function(){return l(a),a()};var f=u.createElement(d),h={emptyElement:f,injection:p,isNullComponentID:i};t.exports=h},{133:133,55:55,65:65}],58:[function(e,t,n){"use strict";var r={guard:function(e,t){return e}};t.exports=r},{}],59:[function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue()}var o=e(17),i={handleTopLevel:function(e,t,n,i){var a=o.extractEvents(e,t,n,i);r(a)}};t.exports=i},{17:17}],60:[function(e,t,n){"use strict";function r(e){var t=p.getID(e),n=c.getReactRootIDFromNodeID(t),r=p.findReactContainerForID(n),o=p.getFirstReactDOM(r);return o}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function i(e){for(var t=p.getFirstReactDOM(h(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=r(n);for(var o=0,i=e.ancestors.length;i>o;o++){t=e.ancestors[o];var a=p.getID(t)||"";v._handleTopLevel(e.topLevelType,t,a,e.nativeEvent)}}function a(e){var t=m(window);e(t)}var u=e(16),s=e(21),l=e(28),c=e(64),p=e(68),d=e(85),f=e(27),h=e(123),m=e(129);f(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(o,l.twoArgumentPooler);var v={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:s.canUseDOM?window:null,setHandleTopLevel:function(e){v._handleTopLevel=e},setEnabled:function(e){v._enabled=!!e},isEnabled:function(){return v._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?u.listen(r,t,v.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?u.capture(r,t,v.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=a.bind(null,e);u.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(v._enabled){var n=o.getPooled(e,t);try{d.batchedUpdates(i,n)}finally{o.release(n)}}}};t.exports=v},{123:123,129:129,16:16,21:21,27:27,28:28,64:64,68:68,85:85}],61:[function(e,t,n){"use strict";var r=(e(55),e(150),{create:function(e){return e},extract:function(e){return e},extractIfFragment:function(e){return e}});t.exports=r},{150:150,55:55}],62:[function(e,t,n){"use strict";var r=e(10),o=e(17),i=e(36),a=e(33),u=e(57),s=e(30),l=e(71),c=e(42),p=e(73),d=e(81),f=e(85),h={Component:i.injection,Class:a.injection,DOMComponent:c.injection,DOMProperty:r.injection,EmptyComponent:u.injection,EventPluginHub:o.injection,EventEmitter:s.injection,NativeComponent:l.injection,Perf:p.injection,RootIndex:d.injection,Updates:f.injection};t.exports=h},{10:10,17:17,30:30,33:33,36:36,42:42,57:57,71:71,73:73,81:81,85:85}],63:[function(e,t,n){"use strict";function r(e){return i(document.documentElement,e)}var o=e(50),i=e(107),a=e(117),u=e(119),s={hasSelectionCapabilities:function(e){return e&&("INPUT"===e.nodeName&&"text"===e.type||"TEXTAREA"===e.nodeName||"true"===e.contentEditable)},getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(s.hasSelectionCapabilities(n)&&s.setSelection(n,o),a(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&"INPUT"===e.nodeName){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if("undefined"==typeof r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&"INPUT"===e.nodeName){var i=e.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",r-n),i.select()}else o.setOffsets(e,t)}};t.exports=s},{107:107,117:117,119:119,50:50}],64:[function(e,t,n){"use strict";function r(e){return f+e.toString(36)}function o(e,t){return e.charAt(t)===f||t===e.length}function i(e){return""===e||e.charAt(0)===f&&e.charAt(e.length-1)!==f}function a(e,t){return 0===t.indexOf(e)&&o(t,e.length)}function u(e){return e?e.substr(0,e.lastIndexOf(f)):""}function s(e,t){if(d(i(e)&&i(t)),d(a(e,t)),e===t)return e;var n,r=e.length+h;for(n=r;n<t.length&&!o(t,n);n++);return t.substr(0,n)}function l(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var r=0,a=0;n>=a;a++)if(o(e,a)&&o(t,a))r=a;else if(e.charAt(a)!==t.charAt(a))break;var u=e.substr(0,r);return d(i(u)),u}function c(e,t,n,r,o,i){e=e||"",t=t||"",d(e!==t);var l=a(t,e);d(l||a(e,t));for(var c=0,p=l?u:s,f=e;;f=p(f,t)){var h;if(o&&f===e||i&&f===t||(h=n(f,l,r)),h===!1||f===t)break;d(c++<m)}}var p=e(81),d=e(133),f=".",h=f.length,m=100,v={createReactRootID:function(){return r(p.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===f&&e.length>1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var i=l(e,t);i!==e&&c(e,i,n,r,!1,!0),i!==t&&c(i,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},_getFirstCommonAncestorID:l,_getNextDescendantID:s,isAncestorIDOf:a,SEPARATOR:f};t.exports=v},{133:133,81:81}],65:[function(e,t,n){"use strict";var r={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=r},{}],66:[function(e,t,n){"use strict";var r={currentlyMountingInstance:null,currentlyUnmountingInstance:null};t.exports=r},{}],67:[function(e,t,n){"use strict";var r=e(104),o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(">"," "+o.CHECKSUM_ATTR_NAME+'="'+t+'">')},canReuseMarkup:function(e,t){var n=t.getAttribute(o.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var i=r(e);return i===n}};t.exports=o},{104:104}],68:[function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){var t=P(e);return t&&K.getID(t)}function i(e){var t=a(e);if(t)if(L.hasOwnProperty(t)){var n=L[t];n!==e&&(w(!c(n,t)),L[t]=e)}else L[t]=e;return t}function a(e){return e&&e.getAttribute&&e.getAttribute(k)||""}function u(e,t){var n=a(e);n!==t&&delete L[n],e.setAttribute(k,t),L[t]=e}function s(e){return L.hasOwnProperty(e)&&c(L[e],e)||(L[e]=K.findReactNodeByID(e)),L[e]}function l(e){var t=b.get(e)._rootNodeID;return C.isNullComponentID(t)?null:(L.hasOwnProperty(t)&&c(L[t],t)||(L[t]=K.findReactNodeByID(t)),L[t])}function c(e,t){if(e){w(a(e)===t);var n=K.findReactContainerForID(t);if(n&&T(n,e))return!0}return!1}function p(e){delete L[e]}function d(e){var t=L[e];return t&&c(t,e)?void(W=t):!1}function f(e){W=null,E.traverseAncestors(e,d);var t=W;return W=null,t}function h(e,t,n,r,o){var i=D.mountComponent(e,t,r,I);e._isTopLevel=!0,K._mountImageIntoNode(i,n,o)}function m(e,t,n,r){var o=N.ReactReconcileTransaction.getPooled();o.perform(h,null,e,t,n,o,r),N.ReactReconcileTransaction.release(o)}var v=e(10),g=e(30),y=(e(39),e(55)),C=(e(56),e(57)),E=e(64),b=e(65),_=e(67),x=e(73),D=e(79),M=e(84),N=e(85),I=e(113),T=e(107),P=e(127),R=e(132),w=e(133),O=e(144),S=e(147),A=(e(150),E.SEPARATOR),k=v.ID_ATTRIBUTE_NAME,L={},U=1,F=9,B={},V={},j=[],W=null,K={_instancesByReactRootID:B,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return K.scrollMonitor(n,function(){M.enqueueElementInternal(e,t),r&&M.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){w(t&&(t.nodeType===U||t.nodeType===F)),g.ensureScrollValueMonitoring();var n=K.registerContainer(t);return B[n]=e,n},_renderNewRootComponent:function(e,t,n){var r=R(e,null),o=K._registerComponent(r,t);return N.batchedUpdates(m,r,o,t,n),r},render:function(e,t,n){w(y.isValidElement(e));var r=B[o(t)];if(r){var i=r._currentElement;if(S(i,e))return K._updateRootComponent(r,e,t,n).getPublicInstance();K.unmountComponentAtNode(t)}var a=P(t),u=a&&K.isRenderedByReact(a),s=u&&!r,l=K._renderNewRootComponent(e,t,s).getPublicInstance();return n&&n.call(l),l},constructAndRenderComponent:function(e,t,n){var r=y.createElement(e,t);return K.render(r,n)},constructAndRenderComponentByID:function(e,t,n){var r=document.getElementById(n);return w(r),K.constructAndRenderComponent(e,t,r)},registerContainer:function(e){var t=o(e);return t&&(t=E.getReactRootIDFromNodeID(t)),t||(t=E.createReactRootID()),V[t]=e,t},unmountComponentAtNode:function(e){w(e&&(e.nodeType===U||e.nodeType===F));var t=o(e),n=B[t];return n?(K.unmountComponentFromNode(n,e),delete B[t],delete V[t],!0):!1},unmountComponentFromNode:function(e,t){for(D.unmountComponent(e),t.nodeType===F&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)},findReactContainerForID:function(e){var t=E.getReactRootIDFromNodeID(e),n=V[t];return n},findReactNodeByID:function(e){var t=K.findReactContainerForID(e);return K.findComponentRoot(t,e)},isRenderedByReact:function(e){if(1!==e.nodeType)return!1;var t=K.getID(e);return t?t.charAt(0)===A:!1},getFirstReactDOM:function(e){for(var t=e;t&&t.parentNode!==t;){if(K.isRenderedByReact(t))return t;t=t.parentNode}return null},findComponentRoot:function(e,t){var n=j,r=0,o=f(t)||e;for(n[0]=o.firstChild,n.length=1;r<n.length;){for(var i,a=n[r++];a;){var u=K.getID(a);u?t===u?i=a:E.isAncestorIDOf(u,t)&&(n.length=r=0,n.push(a.firstChild)):n.push(a.firstChild),a=a.nextSibling}if(i)return n.length=0,i}n.length=0,w(!1)},_mountImageIntoNode:function(e,t,n){if(w(t&&(t.nodeType===U||t.nodeType===F)),n){var o=P(t);if(_.canReuseMarkup(e,o))return;var i=o.getAttribute(_.CHECKSUM_ATTR_NAME);o.removeAttribute(_.CHECKSUM_ATTR_NAME);var a=o.outerHTML;o.setAttribute(_.CHECKSUM_ATTR_NAME,i);var u=r(e,a);" (client) "+e.substring(u-20,u+20)+"\n (server) "+a.substring(u-20,u+20),w(t.nodeType!==F)}w(t.nodeType!==F),O(t,e)},getReactRootID:o,getID:i,setID:u,getNode:s,getNodeFromInstance:l,purgeID:p};x.measureMethods(K,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=K},{10:10,107:107,113:113,127:127,132:132,133:133,144:144,147:147,150:150,30:30,39:39,55:55,56:56,57:57,64:64,65:65,67:67,73:73,79:79,84:84,85:85}],69:[function(e,t,n){"use strict";function r(e,t,n){h.push({parentID:e,parentNode:null,type:c.INSERT_MARKUP,markupIndex:m.push(t)-1,textContent:null,fromIndex:null,toIndex:n})}function o(e,t,n){h.push({parentID:e,parentNode:null,type:c.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:t,toIndex:n})}function i(e,t){h.push({parentID:e,parentNode:null,type:c.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:t,toIndex:null})}function a(e,t){h.push({parentID:e,parentNode:null,type:c.TEXT_CONTENT,markupIndex:null,textContent:t,fromIndex:null,toIndex:null})}function u(){h.length&&(l.processChildrenUpdates(h,m),s())}function s(){h.length=0,m.length=0}var l=e(36),c=e(70),p=e(79),d=e(31),f=0,h=[],m=[],v={Mixin:{mountChildren:function(e,t,n){var r=d.instantiateChildren(e,t,n);this._renderedChildren=r;var o=[],i=0;for(var a in r)if(r.hasOwnProperty(a)){var u=r[a],s=this._rootNodeID+a,l=p.mountComponent(u,s,t,n);u._mountIndex=i,o.push(l),i++}return o},updateTextContent:function(e){f++;var t=!0;try{var n=this._renderedChildren;d.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setTextContent(e),t=!1}finally{f--,f||(t?s():u())}},updateChildren:function(e,t,n){f++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{f--,f||(r?s():u())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=d.updateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var i,a=0,u=0;for(i in o)if(o.hasOwnProperty(i)){var s=r&&r[i],l=o[i];s===l?(this.moveChild(s,u,a),a=Math.max(s._mountIndex,a),s._mountIndex=u):(s&&(a=Math.max(s._mountIndex,a),this._unmountChildByName(s,i)),this._mountChildByNameAtIndex(l,i,u,t,n)),u++}for(i in r)!r.hasOwnProperty(i)||o&&o.hasOwnProperty(i)||this._unmountChildByName(r[i],i)}},unmountChildren:function(){var e=this._renderedChildren;d.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&o(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){r(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){i(this._rootNodeID,e._mountIndex)},setTextContent:function(e){a(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,o){var i=this._rootNodeID+t,a=p.mountComponent(e,i,r,o);e._mountIndex=n,this.createChild(e,a)},_unmountChildByName:function(e,t){this.removeChild(e),e._mountIndex=null}}};t.exports=v},{31:31,36:36,70:70,79:79}],70:[function(e,t,n){"use strict";var r=e(138),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,TEXT_CONTENT:null});t.exports=o},{138:138}],71:[function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=l(t)),n}function o(e){return s(c),new c(e.type,e.props)}function i(e){return new d(e)}function a(e){return e instanceof d}var u=e(27),s=e(133),l=null,c=null,p={},d=null,f={injectGenericComponentClass:function(e){c=e},injectTextComponentClass:function(e){d=e},injectComponentClasses:function(e){u(p,e)},injectAutoWrapper:function(e){l=e}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:i,isTextComponent:a,injection:f};t.exports=h},{133:133,27:27}],72:[function(e,t,n){"use strict";var r=e(133),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){r(o.isValidOwner(n)),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){r(o.isValidOwner(n)),n.getPublicInstance().refs[t]===e.getPublicInstance()&&n.detachRef(t)}};t.exports=o},{133:133}],73:[function(e,t,n){"use strict";function r(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};t.exports=o},{}],74:[function(e,t,n){"use strict";var r={};t.exports=r},{}],75:[function(e,t,n){"use strict";var r=e(138),o=r({prop:null,context:null,childContext:null});t.exports=o},{138:138}],76:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,i){if(o=o||b,null==n[r]){var a=C[i];return t?new Error("Required "+a+" `"+r+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o){var i=t[n],a=m(i);if(a!==e){var u=C[o],s=v(i);return new Error("Invalid "+u+" `"+n+"` of type `"+s+"` "+("supplied to `"+r+"`, expected `"+e+"`."))}return null}return r(t)}function i(){return r(E.thatReturns(null))}function a(e){function t(t,n,r,o){var i=t[n];if(!Array.isArray(i)){var a=C[o],u=m(i);return new Error("Invalid "+a+" `"+n+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an array."))}for(var s=0;s<i.length;s++){var l=e(i,s,r,o);if(l instanceof Error)return l}return null}return r(t)}function u(){function e(e,t,n,r){if(!g.isValidElement(e[t])){var o=C[r];return new Error("Invalid "+o+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactElement."))}return null}return r(e)}function s(e){function t(t,n,r,o){if(!(t[n]instanceof e)){var i=C[o],a=e.name||b;return new Error("Invalid "+i+" `"+n+"` supplied to "+("`"+r+"`, expected instance of `"+a+"`."))}return null}return r(t)}function l(e){function t(t,n,r,o){for(var i=t[n],a=0;a<e.length;a++)if(i===e[a])return null;var u=C[o],s=JSON.stringify(e);return new Error("Invalid "+u+" `"+n+"` of value `"+i+"` "+("supplied to `"+r+"`, expected one of "+s+"."))}return r(t)}function c(e){function t(t,n,r,o){var i=t[n],a=m(i);if("object"!==a){var u=C[o];return new Error("Invalid "+u+" `"+n+"` of type "+("`"+a+"` supplied to `"+r+"`, expected an object."))}for(var s in i)if(i.hasOwnProperty(s)){var l=e(i,s,r,o);if(l instanceof Error)return l}return null}return r(t)}function p(e){function t(t,n,r,o){for(var i=0;i<e.length;i++){var a=e[i];if(null==a(t,n,r,o))return null}var u=C[o];return new Error("Invalid "+u+" `"+n+"` supplied to "+("`"+r+"`."))}return r(t)}function d(){function e(e,t,n,r){if(!h(e[t])){var o=C[r];return new Error("Invalid "+o+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function f(e){function t(t,n,r,o){var i=t[n],a=m(i);if("object"!==a){var u=C[o];return new Error("Invalid "+u+" `"+n+"` of type `"+a+"` "+("supplied to `"+r+"`, expected `object`."))}for(var s in e){var l=e[s];if(l){var c=l(i,s,r,o);if(c)return c}}return null}return r(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||g.isValidElement(e))return!0;e=y.extractIfFragment(e);for(var t in e)if(!h(e[t]))return!1;return!0;default:return!1}}function m(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function v(e){var t=m(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}var g=e(55),y=e(61),C=e(74),E=e(112),b="<<anonymous>>",_=u(),x=d(),D={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),any:i(),arrayOf:a,element:_,instanceOf:s,node:x,objectOf:c,oneOf:l,oneOfType:p,shape:f};t.exports=D},{112:112,55:55,61:61,74:74}],77:[function(e,t,n){"use strict";function r(){this.listenersToPut=[]}var o=e(28),i=e(30),a=e(27);a(r.prototype,{enqueuePutListener:function(e,t,n){this.listenersToPut.push({rootNodeID:e,propKey:t,propValue:n})},putListeners:function(){for(var e=0;e<this.listenersToPut.length;e++){var t=this.listenersToPut[e];i.putListener(t.rootNodeID,t.propKey,t.propValue)}},reset:function(){this.listenersToPut.length=0},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{27:27,28:28,30:30}],78:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=o.getPooled(null),this.putListenerQueue=s.getPooled()}var o=e(6),i=e(28),a=e(30),u=e(63),s=e(77),l=e(101),c=e(27),p={initialize:u.getSelectionInformation,close:u.restoreSelection},d={initialize:function(){var e=a.isEnabled();return a.setEnabled(!1),e},close:function(e){a.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h={initialize:function(){this.putListenerQueue.reset()},close:function(){this.putListenerQueue.putListeners()}},m=[h,p,d,f],v={getTransactionWrappers:function(){return m},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null,s.release(this.putListenerQueue),this.putListenerQueue=null}};c(r.prototype,l.Mixin,v),i.addPoolingTo(r),t.exports=r},{101:101,27:27,28:28,30:30,6:6,63:63,77:77}],79:[function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=e(80),i=(e(56),{mountComponent:function(e,t,n,o){var i=e.mountComponent(t,n,o);return n.getReactMountReady().enqueue(r,e),i},unmountComponent:function(e){o.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,n,i){var a=e._currentElement;if(t!==a||null==t._owner){var u=o.shouldUpdateRefs(a,t);u&&o.detachRefs(e,a),e.receiveComponent(t,n,i),u&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}});t.exports=i},{56:56,80:80}],80:[function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):i.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):i.removeComponentAsRefFrom(t,e,n)}var i=e(72),a={};a.attachRefs=function(e,t){var n=t.ref;null!=n&&r(n,e,t._owner)},a.shouldUpdateRefs=function(e,t){return t._owner!==e._owner||t.ref!==e.ref},a.detachRefs=function(e,t){var n=t.ref;null!=n&&o(n,e,t._owner)},t.exports=a},{72:72}],81:[function(e,t,n){"use strict";var r={injectCreateReactRootIndex:function(e){o.createReactRootIndex=e}},o={createReactRootIndex:null,injection:r};t.exports=o},{}],82:[function(e,t,n){"use strict";function r(e){p(i.isValidElement(e));var t;try{var n=a.createReactRootID();return t=s.getPooled(!1),t.perform(function(){var r=c(e,null),o=r.mountComponent(n,t,l);return u.addChecksumToMarkup(o)},null)}finally{s.release(t)}}function o(e){p(i.isValidElement(e));var t;try{var n=a.createReactRootID();return t=s.getPooled(!0),t.perform(function(){var r=c(e,null);return r.mountComponent(n,t,l)},null)}finally{s.release(t)}}var i=e(55),a=e(64),u=e(67),s=e(83),l=e(113),c=e(132),p=e(133);t.exports={renderToString:r,renderToStaticMarkup:o}},{113:113,132:132,133:133,55:55,64:64,67:67,83:83}],83:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=i.getPooled(null),this.putListenerQueue=a.getPooled()}var o=e(28),i=e(6),a=e(77),u=e(101),s=e(27),l=e(112),c={initialize:function(){this.reactMountReady.reset()},close:l},p={initialize:function(){this.putListenerQueue.reset()},close:l},d=[p,c],f={getTransactionWrappers:function(){return d},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null,a.release(this.putListenerQueue),this.putListenerQueue=null}};s(r.prototype,u.Mixin,f),o.addPoolingTo(r),t.exports=r},{101:101,112:112,27:27,28:28,6:6,77:77}],84:[function(e,t,n){"use strict";function r(e){e!==i.currentlyMountingInstance&&l.enqueueUpdate(e)}function o(e,t){p(null==a.current);var n=s.get(e);return n?n===i.currentlyUnmountingInstance?null:n:null}var i=e(66),a=e(39),u=e(55),s=e(65),l=e(85),c=e(27),p=e(133),d=(e(150),{enqueueCallback:function(e,t){p("function"==typeof t);var n=o(e);return n&&n!==i.currentlyMountingInstance?(n._pendingCallbacks?n._pendingCallbacks.push(t):n._pendingCallbacks=[t],void r(n)):null},enqueueCallbackInternal:function(e,t){p("function"==typeof t),e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var i=n._pendingStateQueue||(n._pendingStateQueue=[]);i.push(t),r(n)}},enqueueSetProps:function(e,t){var n=o(e,"setProps");if(n){p(n._isTopLevel);var i=n._pendingElement||n._currentElement,a=c({},i.props,t);n._pendingElement=u.cloneAndReplaceProps(i,a),r(n)}},enqueueReplaceProps:function(e,t){var n=o(e,"replaceProps");if(n){p(n._isTopLevel);var i=n._pendingElement||n._currentElement;n._pendingElement=u.cloneAndReplaceProps(i,t),r(n)}},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)}});t.exports=d},{133:133,150:150,27:27,39:39,55:55,65:65,66:66,85:85}],85:[function(e,t,n){"use strict";function r(){v(N.ReactReconcileTransaction&&E)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=N.ReactReconcileTransaction.getPooled()}function i(e,t,n,o,i){r(),E.batchedUpdates(e,t,n,o,i)}function a(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;v(t===g.length),g.sort(a);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,f.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var i=0;i<o.length;i++)e.callbackQueue.enqueue(o[i],r.getPublicInstance())}}function s(e){return r(),E.isBatchingUpdates?void g.push(e):void E.batchedUpdates(s,e)}function l(e,t){v(E.isBatchingUpdates),y.enqueue(e,t),C=!0}var c=e(6),p=e(28),d=(e(39),e(73)),f=e(79),h=e(101),m=e(27),v=e(133),g=(e(150),[]),y=c.getPooled(),C=!1,E=null,b={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),D()):g.length=0}},_={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},x=[b,_];m(o.prototype,h.Mixin,{getTransactionWrappers:function(){return x},destructor:function(){this.dirtyComponentsLength=null,c.release(this.callbackQueue),this.callbackQueue=null,N.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),p.addPoolingTo(o);var D=function(){for(;g.length||C;){if(g.length){var e=o.getPooled();e.perform(u,null,e),o.release(e)}if(C){C=!1;var t=y;y=c.getPooled(),t.notifyAll(),c.release(t)}}};D=d.measure("ReactUpdates","flushBatchedUpdates",D);var M={injectReconcileTransaction:function(e){v(e),N.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){v(e),v("function"==typeof e.batchedUpdates),v("boolean"==typeof e.isBatchingUpdates),E=e}},N={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:s,flushBatchedUpdates:D,injection:M,asap:l};t.exports=N},{101:101,133:133,150:150,27:27,28:28,39:39,6:6,73:73,79:79}],86:[function(e,t,n){"use strict";var r=e(10),o=r.injection.MUST_USE_ATTRIBUTE,i={Properties:{clipPath:o,cx:o,cy:o,d:o,dx:o,dy:o,fill:o,fillOpacity:o,fontFamily:o,fontSize:o,fx:o,fy:o,gradientTransform:o,gradientUnits:o,markerEnd:o,markerMid:o,markerStart:o,offset:o,opacity:o,patternContentUnits:o,patternUnits:o,points:o,preserveAspectRatio:o,r:o,rx:o,ry:o,spreadMethod:o,stopColor:o,stopOpacity:o,stroke:o,strokeDasharray:o,strokeLinecap:o,strokeOpacity:o,strokeWidth:o,textAnchor:o,transform:o,version:o,viewBox:o,x1:o,x2:o,x:o,y1:o,y2:o,y:o},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox"}};t.exports=i},{10:10}],87:[function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&u.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e){if(y||null==m||m!==l())return null;var t=r(m);if(!g||!d(g,t)){g=t;var n=s.getPooled(h.select,v,e);return n.type="select",n.target=m,a.accumulateTwoPhaseDispatches(n),n}}var i=e(15),a=e(20),u=e(63),s=e(93),l=e(119),c=e(136),p=e(139),d=e(146),f=i.topLevelTypes,h={select:{phasedRegistrationNames:{bubbled:p({onSelect:null}),captured:p({onSelectCapture:null})},dependencies:[f.topBlur,f.topContextMenu,f.topFocus,f.topKeyDown,f.topMouseDown,f.topMouseUp,f.topSelectionChange]
-}},m=null,v=null,g=null,y=!1,C={eventTypes:h,extractEvents:function(e,t,n,r){switch(e){case f.topFocus:(c(t)||"true"===t.contentEditable)&&(m=t,v=n,g=null);break;case f.topBlur:m=null,v=null,g=null;break;case f.topMouseDown:y=!0;break;case f.topContextMenu:case f.topMouseUp:return y=!1,o(r);case f.topSelectionChange:case f.topKeyDown:case f.topKeyUp:return o(r)}}};t.exports=C},{119:119,136:136,139:139,146:146,15:15,20:20,63:63,93:93}],88:[function(e,t,n){"use strict";var r=Math.pow(2,53),o={createReactRootIndex:function(){return Math.ceil(Math.random()*r)}};t.exports=o},{}],89:[function(e,t,n){"use strict";var r=e(15),o=e(19),i=e(20),a=e(90),u=e(93),s=e(94),l=e(96),c=e(97),p=e(92),d=e(98),f=e(99),h=e(100),m=e(120),v=e(133),g=e(139),y=(e(150),r.topLevelTypes),C={blur:{phasedRegistrationNames:{bubbled:g({onBlur:!0}),captured:g({onBlurCapture:!0})}},click:{phasedRegistrationNames:{bubbled:g({onClick:!0}),captured:g({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:g({onContextMenu:!0}),captured:g({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:g({onCopy:!0}),captured:g({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:g({onCut:!0}),captured:g({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:g({onDoubleClick:!0}),captured:g({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:g({onDrag:!0}),captured:g({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:g({onDragEnd:!0}),captured:g({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:g({onDragEnter:!0}),captured:g({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:g({onDragExit:!0}),captured:g({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:g({onDragLeave:!0}),captured:g({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:g({onDragOver:!0}),captured:g({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:g({onDragStart:!0}),captured:g({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:g({onDrop:!0}),captured:g({onDropCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:g({onFocus:!0}),captured:g({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:g({onInput:!0}),captured:g({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:g({onKeyDown:!0}),captured:g({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:g({onKeyPress:!0}),captured:g({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:g({onKeyUp:!0}),captured:g({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:g({onLoad:!0}),captured:g({onLoadCapture:!0})}},error:{phasedRegistrationNames:{bubbled:g({onError:!0}),captured:g({onErrorCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:g({onMouseDown:!0}),captured:g({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:g({onMouseMove:!0}),captured:g({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:g({onMouseOut:!0}),captured:g({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:g({onMouseOver:!0}),captured:g({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:g({onMouseUp:!0}),captured:g({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:g({onPaste:!0}),captured:g({onPasteCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:g({onReset:!0}),captured:g({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:g({onScroll:!0}),captured:g({onScrollCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:g({onSubmit:!0}),captured:g({onSubmitCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:g({onTouchCancel:!0}),captured:g({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:g({onTouchEnd:!0}),captured:g({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:g({onTouchMove:!0}),captured:g({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:g({onTouchStart:!0}),captured:g({onTouchStartCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:g({onWheel:!0}),captured:g({onWheelCapture:!0})}}},E={topBlur:C.blur,topClick:C.click,topContextMenu:C.contextMenu,topCopy:C.copy,topCut:C.cut,topDoubleClick:C.doubleClick,topDrag:C.drag,topDragEnd:C.dragEnd,topDragEnter:C.dragEnter,topDragExit:C.dragExit,topDragLeave:C.dragLeave,topDragOver:C.dragOver,topDragStart:C.dragStart,topDrop:C.drop,topError:C.error,topFocus:C.focus,topInput:C.input,topKeyDown:C.keyDown,topKeyPress:C.keyPress,topKeyUp:C.keyUp,topLoad:C.load,topMouseDown:C.mouseDown,topMouseMove:C.mouseMove,topMouseOut:C.mouseOut,topMouseOver:C.mouseOver,topMouseUp:C.mouseUp,topPaste:C.paste,topReset:C.reset,topScroll:C.scroll,topSubmit:C.submit,topTouchCancel:C.touchCancel,topTouchEnd:C.touchEnd,topTouchMove:C.touchMove,topTouchStart:C.touchStart,topWheel:C.wheel};for(var b in E)E[b].dependencies=[b];var _={eventTypes:C,executeDispatch:function(e,t,n){var r=o.executeDispatch(e,t,n);r===!1&&(e.stopPropagation(),e.preventDefault())},extractEvents:function(e,t,n,r){var o=E[e];if(!o)return null;var g;switch(e){case y.topInput:case y.topLoad:case y.topError:case y.topReset:case y.topSubmit:g=u;break;case y.topKeyPress:if(0===m(r))return null;case y.topKeyDown:case y.topKeyUp:g=l;break;case y.topBlur:case y.topFocus:g=s;break;case y.topClick:if(2===r.button)return null;case y.topContextMenu:case y.topDoubleClick:case y.topMouseDown:case y.topMouseMove:case y.topMouseOut:case y.topMouseOver:case y.topMouseUp:g=c;break;case y.topDrag:case y.topDragEnd:case y.topDragEnter:case y.topDragExit:case y.topDragLeave:case y.topDragOver:case y.topDragStart:case y.topDrop:g=p;break;case y.topTouchCancel:case y.topTouchEnd:case y.topTouchMove:case y.topTouchStart:g=d;break;case y.topScroll:g=f;break;case y.topWheel:g=h;break;case y.topCopy:case y.topCut:case y.topPaste:g=a}v(g);var C=g.getPooled(o,n,r);return i.accumulateTwoPhaseDispatches(C),C}};t.exports=_},{100:100,120:120,133:133,139:139,15:15,150:150,19:19,20:20,90:90,92:92,93:93,94:94,96:96,97:97,98:98,99:99}],90:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(93),i={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,i),t.exports=r},{93:93}],91:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(93),i={data:null};o.augmentClass(r,i),t.exports=r},{93:93}],92:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(97),i={dataTransfer:null};o.augmentClass(r,i),t.exports=r},{97:97}],93:[function(e,t,n){"use strict";function r(e,t,n){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var r=this.constructor.Interface;for(var o in r)if(r.hasOwnProperty(o)){var i=r[o];i?this[o]=i(n):this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;u?this.isDefaultPrevented=a.thatReturnsTrue:this.isDefaultPrevented=a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse}var o=e(28),i=e(27),a=e(112),u=e(123),s={type:null,target:u,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=a.thatReturnsTrue},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=a.thatReturnsTrue},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=s,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);i(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=i({},n.Interface,t),e.augmentClass=n.augmentClass,o.addPoolingTo(e,o.threeArgumentPooler)},o.addPoolingTo(r,o.threeArgumentPooler),t.exports=r},{112:112,123:123,27:27,28:28}],94:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(99),i={relatedTarget:null};o.augmentClass(r,i),t.exports=r},{99:99}],95:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(93),i={data:null};o.augmentClass(r,i),t.exports=r},{93:93}],96:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(99),i=e(120),a=e(121),u=e(122),s={key:a,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:u,charCode:function(e){return"keypress"===e.type?i(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?i(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,s),t.exports=r},{120:120,121:121,122:122,99:99}],97:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(99),i=e(102),a=e(122),u={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:a,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+i.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+i.currentScrollTop}};o.augmentClass(r,u),t.exports=r},{102:102,122:122,99:99}],98:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(99),i=e(122),a={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};o.augmentClass(r,a),t.exports=r},{122:122,99:99}],99:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(93),i=e(123),a={view:function(e){if(e.view)return e.view;var t=i(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,a),t.exports=r},{123:123,93:93}],100:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(97),i={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,i),t.exports=r},{97:97}],101:[function(e,t,n){"use strict";var r=e(133),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,i,a,u,s){r(!this.isInTransaction());var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,n,o,i,a,u,s),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=i.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===i.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){r(this.isInTransaction());for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,a=t[n],u=this.wrapperInitData[n];try{o=!0,u!==i.OBSERVED_ERROR&&a.close&&a.close.call(this,u),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(s){}}}this.wrapperInitData.length=0}},i={Mixin:o,OBSERVED_ERROR:{}};t.exports=i},{133:133}],102:[function(e,t,n){"use strict";var r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){r.currentScrollLeft=e.x,r.currentScrollTop=e.y}};t.exports=r},{}],103:[function(e,t,n){"use strict";function r(e,t){if(o(null!=t),null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=e(133);t.exports=r},{133:133}],104:[function(e,t,n){"use strict";function r(e){for(var t=1,n=0,r=0;r<e.length;r++)t=(t+e.charCodeAt(r))%o,n=(n+t)%o;return t|n<<16}var o=65521;t.exports=r},{}],105:[function(e,t,n){function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;t.exports=r},{}],106:[function(e,t,n){"use strict";function r(e){return o(e.replace(i,"ms-"))}var o=e(105),i=/^-ms-/;t.exports=r},{105:105}],107:[function(e,t,n){function r(e,t){return e&&t?e===t?!0:o(e)?!1:o(t)?r(e,t.parentNode):e.contains?e.contains(t):e.compareDocumentPosition?!!(16&e.compareDocumentPosition(t)):!1:!1}var o=e(137);t.exports=r},{137:137}],108:[function(e,t,n){function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function o(e){return r(e)?Array.isArray(e)?e.slice():i(e):[e]}var i=e(148);t.exports=o},{148:148}],109:[function(e,t,n){"use strict";function r(e){var t=i.createFactory(e),n=o.createClass({tagName:e.toUpperCase(),displayName:"ReactFullPageComponent"+e,componentWillUnmount:function(){a(!1)},render:function(){return t(this.props)}});return n}var o=e(33),i=e(55),a=e(133);t.exports=r},{133:133,33:33,55:55}],110:[function(e,t,n){function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function o(e,t){var n=l;s(!!l);var o=r(e),i=o&&u(o);if(i){n.innerHTML=i[1]+e+i[2];for(var c=i[0];c--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(s(t),a(p).forEach(t));for(var d=a(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}var i=e(21),a=e(108),u=e(125),s=e(133),l=i.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=o},{108:108,125:125,133:133,21:21}],111:[function(e,t,n){"use strict";function r(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||i.hasOwnProperty(e)&&i[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var o=e(4),i=o.isUnitlessNumber;t.exports=r},{4:4}],112:[function(e,t,n){function r(e){return function(){return e}}function o(){}o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],113:[function(e,t,n){"use strict";var r={};t.exports=r},{}],114:[function(e,t,n){"use strict";function r(e){return i[e]}function o(e){return(""+e).replace(a,r)}var i={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},a=/[&><"']/g;t.exports=o},{}],115:[function(e,t,n){"use strict";function r(e){return null==e?null:u(e)?e:o.has(e)?i.getNodeFromInstance(e):(a(null==e.render||"function"!=typeof e.render),void a(!1))}{var o=(e(39),e(65)),i=e(68),a=e(133),u=e(135);e(150)}t.exports=r},{133:133,135:135,150:150,39:39,65:65,68:68}],116:[function(e,t,n){"use strict";function r(e,t,n){var r=e,o=!r.hasOwnProperty(n);o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return i(e,r,t),t}{var i=e(149);e(150)}t.exports=o},{149:149,150:150}],117:[function(e,t,n){"use strict";function r(e){try{e.focus()}catch(t){}}t.exports=r},{}],118:[function(e,t,n){"use strict";var r=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=r},{}],119:[function(e,t,n){function r(){try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=r},{}],120:[function(e,t,n){"use strict";function r(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=r},{}],121:[function(e,t,n){"use strict";function r(e){if(e.key){var t=i[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?a[e.keyCode]||"Unidentified":""}var o=e(120),i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=r},{120:120}],122:[function(e,t,n){"use strict";function r(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=i[e];return r?!!n[r]:!1}function o(e){return r}var i={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=o},{}],123:[function(e,t,n){"use strict";function r(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=r},{}],124:[function(e,t,n){"use strict";function r(e){var t=e&&(o&&e[o]||e[i]);return"function"==typeof t?t:void 0}var o="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";t.exports=r},{}],125:[function(e,t,n){function r(e){return i(!!a),d.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||("*"===e?a.innerHTML="<link />":a.innerHTML="<"+e+"></"+e+">",u[e]=!a.firstChild),u[e]?d[e]:null}var o=e(21),i=e(133),a=o.canUseDOM?document.createElement("div"):null,u={circle:!0,clipPath:!0,defs:!0,ellipse:!0,g:!0,line:!0,linearGradient:!0,path:!0,polygon:!0,polyline:!0,radialGradient:!0,rect:!0,stop:!0,text:!0},s=[1,'<select multiple="true">',"</select>"],l=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,"<svg>","</svg>"],d={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c,circle:p,clipPath:p,defs:p,ellipse:p,g:p,line:p,linearGradient:p,path:p,polygon:p,polyline:p,radialGradient:p,rect:p,stop:p,text:p};t.exports=r},{133:133,21:21}],126:[function(e,t,n){"use strict";function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function i(e,t){for(var n=r(e),i=0,a=0;n;){if(3===n.nodeType){if(a=i+n.textContent.length,t>=i&&a>=t)return{node:n,offset:t-i};i=a}n=r(o(n))}}t.exports=i},{}],127:[function(e,t,n){"use strict";function r(e){return e?e.nodeType===o?e.documentElement:e.firstChild:null}var o=9;t.exports=r},{}],128:[function(e,t,n){"use strict";function r(){return!i&&o.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var o=e(21),i=null;t.exports=r},{21:21}],129:[function(e,t,n){"use strict";function r(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=r},{}],130:[function(e,t,n){function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;t.exports=r},{}],131:[function(e,t,n){"use strict";function r(e){return o(e).replace(i,"-ms-")}var o=e(130),i=/^ms-/;t.exports=r},{130:130}],132:[function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e,t){var n;if((null===e||e===!1)&&(e=a.emptyElement),"object"==typeof e){var o=e;n=t===o.type&&"string"==typeof o.type?u.createInternalComponent(o):r(o.type)?new o.type(o):new c}else"string"==typeof e||"number"==typeof e?n=u.createInstanceForText(e):l(!1);return n.construct(e),n._mountIndex=0,n._mountImage=null,n}var i=e(37),a=e(57),u=e(71),s=e(27),l=e(133),c=(e(150),function(){});s(c.prototype,i.Mixin,{_instantiateReactComponent:o}),t.exports=o},{133:133,150:150,27:27,37:37,57:57,71:71}],133:[function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,u],c=0;s=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return l[c++]}))}throw s.framesToPop=1,s}};t.exports=r},{}],134:[function(e,t,n){"use strict";function r(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,i=e(21);i.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=r},{21:21}],135:[function(e,t,n){function r(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=r},{}],136:[function(e,t,n){"use strict";function r(e){return e&&("INPUT"===e.nodeName&&o[e.type]||"TEXTAREA"===e.nodeName)}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=r},{}],137:[function(e,t,n){function r(e){return o(e)&&3==e.nodeType}var o=e(135);t.exports=r},{135:135}],138:[function(e,t,n){"use strict";var r=e(133),o=function(e){var t,n={};r(e instanceof Object&&!Array.isArray(e));for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};t.exports=o},{133:133}],139:[function(e,t,n){var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=r},{}],140:[function(e,t,n){"use strict";function r(e,t,n){if(!e)return null;var r={};for(var i in e)o.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],141:[function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=r},{}],142:[function(e,t,n){"use strict";function r(e){return i(o.isValidElement(e)),e}var o=e(55),i=e(133);t.exports=r},{133:133,55:55}],143:[function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=e(114);t.exports=r},{114:114}],144:[function(e,t,n){"use strict";var r=e(21),o=/^[ \r\n\t\f]/,i=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var u=document.createElement("div");u.innerHTML=" ",""===u.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&i.test(t)){e.innerHTML="\ufeff"+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=a},{21:21}],145:[function(e,t,n){"use strict";var r=e(21),o=e(114),i=e(144),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){i(e,o(t))})),t.exports=a},{114:114,144:144,21:21}],146:[function(e,t,n){"use strict";function r(e,t){if(e===t)return!0;var n;for(n in e)if(e.hasOwnProperty(n)&&(!t.hasOwnProperty(n)||e[n]!==t[n]))return!1;for(n in t)if(t.hasOwnProperty(n)&&!e.hasOwnProperty(n))return!1;return!0}t.exports=r},{}],147:[function(e,t,n){"use strict";function r(e,t){if(null!=e&&null!=t){var n=typeof e,r=typeof t;if("string"===n||"number"===n)return"string"===r||"number"===r;if("object"===r&&e.type===t.type&&e.key===t.key){var o=e._owner===t._owner;return o}}return!1}e(150);t.exports=r},{150:150}],148:[function(e,t,n){function r(e){var t=e.length;if(o(!Array.isArray(e)&&("object"==typeof e||"function"==typeof e)),o("number"==typeof t),o(0===t||t-1 in e),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),i=0;t>i;i++)r[i]=e[i];return r}var o=e(133);t.exports=r},{133:133}],149:[function(e,t,n){"use strict";function r(e){return v[e]}function o(e,t){return e&&null!=e.key?a(e.key):t.toString(36)}function i(e){return(""+e).replace(g,r)}function a(e){return"$"+i(e)}function u(e,t,n,r,i){var s=typeof e;if(("undefined"===s||"boolean"===s)&&(e=null),null===e||"string"===s||"number"===s||l.isValidElement(e))return r(i,e,""===t?h+o(e,0):t,n),1;var p,v,g,y=0;if(Array.isArray(e))for(var C=0;C<e.length;C++)p=e[C],v=(""!==t?t+m:h)+o(p,C),g=n+y,y+=u(p,v,g,r,i);else{var E=d(e);if(E){var b,_=E.call(e);if(E!==e.entries)for(var x=0;!(b=_.next()).done;)p=b.value,v=(""!==t?t+m:h)+o(p,x++),g=n+y,y+=u(p,v,g,r,i);else for(;!(b=_.next()).done;){var D=b.value;D&&(p=D[1],v=(""!==t?t+m:h)+a(D[0])+m+o(p,0),g=n+y,y+=u(p,v,g,r,i))}}else if("object"===s){f(1!==e.nodeType);var M=c.extract(e);for(var N in M)M.hasOwnProperty(N)&&(p=M[N],v=(""!==t?t+m:h)+a(N)+m+o(p,0),g=n+y,y+=u(p,v,g,r,i))}}return y}function s(e,t,n){return null==e?0:u(e,"",0,t,n)}var l=e(55),c=e(61),p=e(64),d=e(124),f=e(133),h=(e(150),p.SEPARATOR),m=":",v={"=":"=0",".":"=1",":":"=2"},g=/[=.:]/g;t.exports=s},{124:124,133:133,150:150,55:55,61:61,64:64}],150:[function(e,t,n){"use strict";var r=e(112),o=r;t.exports=o},{112:112}]},{},[1])(1)});
\ No newline at end of file
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){"use strict";var r=e(35),o=e(45),a=e(61),i=e(23),u=e(104),s={};i(s,a),i(s,{findDOMNode:u("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:u("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:u("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:u("renderToString","ReactDOMServer","react-dom/server",o,o.renderToString),renderToStaticMarkup:u("renderToStaticMarkup","ReactDOMServer","react-dom/server",o,o.renderToStaticMarkup)}),s.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,s.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=o,t.exports=s},{104:104,23:23,35:35,45:45,61:61}],2:[function(e,t,n){"use strict";var r=e(63),o=e(106),a=e(136),i={componentDidMount:function(){this.props.autoFocus&&a(o(this))}},u={Mixin:i,focusDOMComponent:function(){a(r.getNode(this._rootNodeID))}};t.exports=u},{106:106,136:136,63:63}],3:[function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function a(e){switch(e){case R.topCompositionStart:return S.compositionStart;case R.topCompositionEnd:return S.compositionEnd;case R.topCompositionUpdate:return S.compositionUpdate}}function i(e,t){return e===R.topKeyDown&&t.keyCode===b}function u(e,t){switch(e){case R.topKeyUp:return-1!==_.indexOf(t.keyCode);case R.topKeyDown:return t.keyCode!==b;case R.topKeyPress:case R.topMouseDown:case R.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function l(e,t,n,r,o){var l,c;if(E?l=a(e):w?u(e,r)&&(l=S.compositionEnd):i(e,r)&&(l=S.compositionStart),!l)return null;N&&(w||l!==S.compositionStart?l===S.compositionEnd&&w&&(c=w.getData()):w=m.getPooled(t));var p=g.getPooled(l,n,r,o);if(c)p.data=c;else{var d=s(r);null!==d&&(p.data=d)}return h.accumulateTwoPhaseDispatches(p),p}function c(e,t){switch(e){case R.topCompositionEnd:return s(t);case R.topKeyPress:var n=t.which;return n!==M?null:(I=!0,P);case R.topTextInput:var r=t.data;return r===P&&I?null:r;default:return null}}function p(e,t){if(w){if(e===R.topCompositionEnd||u(e,t)){var n=w.getData();return m.release(w),w=null,n}return null}switch(e){case R.topPaste:return null;case R.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case R.topCompositionEnd:return N?null:t.data;default:return null}}function d(e,t,n,r,o){var a;if(a=D?c(e,r):p(e,r),!a)return null;var i=y.getPooled(S.beforeInput,n,r,o);return i.data=a,h.accumulateTwoPhaseDispatches(i),i}var f=e(15),h=e(19),v=e(128),m=e(20),g=e(88),y=e(92),C=e(146),_=[9,13,27,32],b=229,E=v.canUseDOM&&"CompositionEvent"in window,x=null;v.canUseDOM&&"documentMode"in document&&(x=document.documentMode);var D=v.canUseDOM&&"TextEvent"in window&&!x&&!r(),N=v.canUseDOM&&(!E||x&&x>8&&11>=x),M=32,P=String.fromCharCode(M),R=f.topLevelTypes,S={beforeInput:{phasedRegistrationNames:{bubbled:C({onBeforeInput:null}),captured:C({onBeforeInputCapture:null})},dependencies:[R.topCompositionEnd,R.topKeyPress,R.topTextInput,R.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:C({onCompositionEnd:null}),captured:C({onCompositionEndCapture:null})},dependencies:[R.topBlur,R.topCompositionEnd,R.topKeyDown,R.topKeyPress,R.topKeyUp,R.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:C({onCompositionStart:null}),captured:C({onCompositionStartCapture:null})},dependencies:[R.topBlur,R.topCompositionStart,R.topKeyDown,R.topKeyPress,R.topKeyUp,R.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:C({onCompositionUpdate:null}),captured:C({onCompositionUpdateCapture:null})},dependencies:[R.topBlur,R.topCompositionUpdate,R.topKeyDown,R.topKeyPress,R.topKeyUp,R.topMouseDown]}},I=!1,w=null,T={eventTypes:S,extractEvents:function(e,t,n,r,o){return[l(e,t,n,r,o),d(e,t,n,r,o)]}};t.exports=T},{128:128,146:146,15:15,19:19,20:20,88:88,92:92}],4:[function(e,t,n){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var o={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},a=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){a.forEach(function(t){o[r(t,e)]=o[e]})});var i={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},u={isUnitlessNumber:o,shorthandPropertyExpansions:i};t.exports=u},{}],5:[function(e,t,n){"use strict";var r=e(4),o=e(128),a=e(69),i=(e(130),e(103)),u=e(141),s=e(148),l=(e(151),s(function(e){return u(e)})),c=!1,p="cssFloat";if(o.canUseDOM){var d=document.createElement("div").style;try{d.font=""}catch(f){c=!0}void 0===document.documentElement.style.cssFloat&&(p="styleFloat")}var h={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=l(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=i(o,t[o]);if("float"===o&&(o=p),a)n[o]=a;else{var u=c&&r.shorthandPropertyExpansions[o];if(u)for(var s in u)n[s]="";else n[o]=""}}}};a.measureMethods(h,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),t.exports=h},{103:103,128:128,130:130,141:141,148:148,151:151,4:4,69:69}],6:[function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=e(24),a=e(23),i=e(142);a(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?i(!1):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{142:142,23:23,24:24}],7:[function(e,t,n){"use strict";function r(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function o(e){var t=x.getPooled(S.change,w,e,D(e));_.accumulateTwoPhaseDispatches(t),E.batchedUpdates(a,t)}function a(e){C.enqueueEvents(e),C.processEventQueue(!1)}function i(e,t){I=e,w=t,I.attachEvent("onchange",o)}function u(){I&&(I.detachEvent("onchange",o),I=null,w=null)}function s(e,t,n){return e===R.topChange?n:void 0}function l(e,t,n){e===R.topFocus?(u(),i(t,n)):e===R.topBlur&&u()}function c(e,t){I=e,w=t,T=e.value,O=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(I,"value",L),I.attachEvent("onpropertychange",d)}function p(){I&&(delete I.value,I.detachEvent("onpropertychange",d),I=null,w=null,T=null,O=null)}function d(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==T&&(T=t,o(e))}}function f(e,t,n){return e===R.topInput?n:void 0}function h(e,t,n){e===R.topFocus?(p(),c(t,n)):e===R.topBlur&&p()}function v(e,t,n){return e!==R.topSelectionChange&&e!==R.topKeyUp&&e!==R.topKeyDown||!I||I.value===T?void 0:(T=I.value,w)}function m(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,n){return e===R.topClick?n:void 0}var y=e(15),C=e(16),_=e(19),b=e(128),E=e(81),x=e(90),D=e(112),N=e(117),M=e(118),P=e(146),R=y.topLevelTypes,S={change:{phasedRegistrationNames:{bubbled:P({onChange:null}),captured:P({onChangeCapture:null})},dependencies:[R.topBlur,R.topChange,R.topClick,R.topFocus,R.topInput,R.topKeyDown,R.topKeyUp,R.topSelectionChange]}},I=null,w=null,T=null,O=null,k=!1;b.canUseDOM&&(k=N("change")&&(!("documentMode"in document)||document.documentMode>8));var A=!1;b.canUseDOM&&(A=N("input")&&(!("documentMode"in document)||document.documentMode>9));var L={get:function(){return O.get.call(this)},set:function(e){T=""+e,O.set.call(this,e)}},U={eventTypes:S,extractEvents:function(e,t,n,o,a){var i,u;if(r(t)?k?i=s:u=l:M(t)?A?i=f:(i=v,u=h):m(t)&&(i=g),i){var c=i(e,t,n);if(c){var p=x.getPooled(S.change,c,o,a);return p.type="change",_.accumulateTwoPhaseDispatches(p),p}}u&&u(e,t,n)}};t.exports=U},{112:112,117:117,118:118,128:128,146:146,15:15,16:16,19:19,81:81,90:90}],8:[function(e,t,n){"use strict";var r=0,o={createReactRootIndex:function(){return r++}};t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var o=e(12),a=e(65),i=e(69),u=e(122),s=e(123),l=e(142),c={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:s,processUpdates:function(e,t){for(var n,i=null,c=null,p=0;p<e.length;p++)if(n=e[p],n.type===a.MOVE_EXISTING||n.type===a.REMOVE_NODE){var d=n.fromIndex,f=n.parentNode.childNodes[d],h=n.parentID;f?void 0:l(!1),i=i||{},i[h]=i[h]||[],i[h][d]=f,c=c||[],c.push(f)}var v;if(v=t.length&&"string"==typeof t[0]?o.dangerouslyRenderMarkup(t):t,c)for(var m=0;m<c.length;m++)c[m].parentNode.removeChild(c[m]);for(var g=0;g<e.length;g++)switch(n=e[g],n.type){case a.INSERT_MARKUP:r(n.parentNode,v[n.markupIndex],n.toIndex);break;case a.MOVE_EXISTING:r(n.parentNode,i[n.parentID][n.fromIndex],n.toIndex);break;case a.SET_MARKUP:u(n.parentNode,n.content);break;case a.TEXT_CONTENT:s(n.parentNode,n.content);break;case a.REMOVE_NODE:}}};i.measureMethods(c,"DOMChildrenOperations",{updateTextContent:"updateTextContent"}),t.exports=c},{12:12,122:122,123:123,142:142,65:65,69:69}],10:[function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=e(142),a={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=a,n=e.Properties||{},i=e.DOMAttributeNamespaces||{},s=e.DOMAttributeNames||{},l=e.DOMPropertyNames||{},c=e.DOMMutationMethods||{};e.isCustomAttribute&&u._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in n){u.properties.hasOwnProperty(p)?o(!1):void 0;var d=p.toLowerCase(),f=n[p],h={attributeName:d,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(f,t.MUST_USE_ATTRIBUTE),mustUseProperty:r(f,t.MUST_USE_PROPERTY),hasSideEffects:r(f,t.HAS_SIDE_EFFECTS),hasBooleanValue:r(f,t.HAS_BOOLEAN_VALUE),hasNumericValue:r(f,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(f,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(f,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(h.mustUseAttribute&&h.mustUseProperty?o(!1):void 0,!h.mustUseProperty&&h.hasSideEffects?o(!1):void 0,h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1?void 0:o(!1),s.hasOwnProperty(p)){var v=s[p];h.attributeName=v}i.hasOwnProperty(p)&&(h.attributeNamespace=i[p]),l.hasOwnProperty(p)&&(h.propertyName=l[p]),c.hasOwnProperty(p)&&(h.mutationMethod=c[p]),u.properties[p]=h}}},i={},u={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<u._isCustomAttributeFunctions.length;t++){var n=u._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=i[e];return r||(i[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:a};t.exports=u},{142:142}],11:[function(e,t,n){"use strict";function r(e){return c.hasOwnProperty(e)?!0:l.hasOwnProperty(e)?!1:s.test(e)?(c[e]=!0,!0):(l[e]=!0,!1)}function o(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&1>t||e.hasOverloadedBooleanValue&&t===!1}var a=e(10),i=e(69),u=e(120),s=(e(151),/^[a-zA-Z_][\w\.\-]*$/),l={},c={},p={createMarkupForID:function(e){return a.ID_ATTRIBUTE_NAME+"="+u(e)},setAttributeForID:function(e,t){e.setAttribute(a.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,t){var n=a.properties.hasOwnProperty(e)?a.properties[e]:null;if(n){if(o(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?r+'=""':r+"="+u(t)}return a.isCustomAttribute(e)?null==t?"":e+"="+u(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+u(t):""},setValueForProperty:function(e,t,n){var r=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(r){var i=r.mutationMethod;if(i)i(e,n);else if(o(r,n))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute){var u=r.attributeName,s=r.attributeNamespace;s?e.setAttributeNS(s,u,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?e.setAttribute(u,""):e.setAttribute(u,""+n)}else{var l=r.propertyName;r.hasSideEffects&&""+e[l]==""+n||(e[l]=n)}}else a.isCustomAttribute(t)&&p.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){var n=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseAttribute)e.removeAttribute(n.attributeName);else{var o=n.propertyName,i=a.getDefaultValueForProperty(e.nodeName,o);n.hasSideEffects&&""+e[o]===i||(e[o]=i)}}else a.isCustomAttribute(t)&&e.removeAttribute(t)}};i.measureMethods(p,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),t.exports=p},{10:10,120:120,151:151,69:69}],12:[function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=e(128),a=e(133),i=e(134),u=e(138),s=e(142),l=/^(<[^ \/>]+)/,c="data-danger-index",p={dangerouslyRenderMarkup:function(e){o.canUseDOM?void 0:s(!1);for(var t,n={},p=0;p<e.length;p++)e[p]?void 0:s(!1),t=r(e[p]),t=u(t)?t:"*",n[t]=n[t]||[],n[t][p]=e[p];var d=[],f=0;for(t in n)if(n.hasOwnProperty(t)){var h,v=n[t];for(h in v)if(v.hasOwnProperty(h)){var m=v[h];v[h]=m.replace(l,"$1 "+c+'="'+h+'" ')}for(var g=a(v.join(""),i),y=0;y<g.length;++y){var C=g[y];C.hasAttribute&&C.hasAttribute(c)&&(h=+C.getAttribute(c),C.removeAttribute(c),d.hasOwnProperty(h)?s(!1):void 0,d[h]=C,f+=1)}}return f!==d.length?s(!1):void 0,d.length!==e.length?s(!1):void 0,d},dangerouslyReplaceNodeWithMarkup:function(e,t){o.canUseDOM?void 0:s(!1),t?void 0:s(!1),"html"===e.tagName.toLowerCase()?s(!1):void 0;var n;n="string"==typeof t?a(t,i)[0]:t,e.parentNode.replaceChild(n,e)}};t.exports=p},{128:128,133:133,134:134,138:138,142:142}],13:[function(e,t,n){"use strict";var r=e(146),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null})];t.exports=o},{146:146}],14:[function(e,t,n){"use strict";var r=e(15),o=e(19),a=e(94),i=e(63),u=e(146),s=r.topLevelTypes,l=i.getFirstReactDOM,c={mouseEnter:{registrationName:u({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:u({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},p=[null,null],d={eventTypes:c,extractEvents:function(e,t,n,r,u){if(e===s.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var d;if(t.window===t)d=t;else{var f=t.ownerDocument;d=f?f.defaultView||f.parentWindow:window}var h,v,m="",g="";if(e===s.topMouseOut?(h=t,m=n,v=l(r.relatedTarget||r.toElement),v?g=i.getID(v):v=d,v=v||d):(h=d,v=t,g=n),h===v)return null;var y=a.getPooled(c.mouseLeave,m,r,u);y.type="mouseleave",y.target=h,y.relatedTarget=v;var C=a.getPooled(c.mouseEnter,g,r,u);return C.type="mouseenter",C.target=v,C.relatedTarget=h,o.accumulateEnterLeaveDispatches(y,C,m,g),p[0]=y,p[1]=C,p}};t.exports=d},{146:146,15:15,19:19,63:63,94:94}],15:[function(e,t,n){"use strict";var r=e(145),o=r({bubbled:null,captured:null}),a=r({topAbort:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topVolumeChange:null,topWaiting:null,topWheel:null}),i={topLevelTypes:a,PropagationPhases:o};t.exports=i},{145:145}],16:[function(e,t,n){"use strict";var r=e(17),o=e(18),a=e(54),i=e(100),u=e(108),s=e(142),l=(e(151),{}),c=null,p=function(e,t){e&&(o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},d=function(e){return p(e,!0)},f=function(e){return p(e,!1)},h=null,v={injection:{injectMount:o.injection.injectMount,injectInstanceHandle:function(e){h=e},getInstanceHandle:function(){return h},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,n){"function"!=typeof n?s(!1):void 0;var o=l[t]||(l[t]={});o[e]=n;var a=r.registrationNameModules[t];a&&a.didPutListener&&a.didPutListener(e,t,n)},getListener:function(e,t){var n=l[t];return n&&n[e]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var o=l[t];o&&delete o[e]},deleteAllListeners:function(e){for(var t in l)if(l[t][e]){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete l[t][e]}},extractEvents:function(e,t,n,o,a){for(var u,s=r.plugins,l=0;l<s.length;l++){var c=s[l];if(c){var p=c.extractEvents(e,t,n,o,a);p&&(u=i(u,p))}}return u},enqueueEvents:function(e){e&&(c=i(c,e))},processEventQueue:function(e){var t=c;c=null,e?u(t,d):u(t,f),c?s(!1):void 0,a.rethrowCaughtError()},__purge:function(){l={}},__getListenerBank:function(){return l}};t.exports=v},{100:100,108:108,142:142,151:151,17:17,18:18,54:54}],17:[function(e,t,n){"use strict";function r(){if(u)for(var e in s){var t=s[e],n=u.indexOf(e);if(n>-1?void 0:i(!1),!l.plugins[n]){t.extractEvents?void 0:i(!1),l.plugins[n]=t;var r=t.eventTypes;for(var a in r)o(r[a],t,a)?void 0:i(!1)}}}function o(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)?i(!1):void 0,l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];a(u,t,n)}return!0}return e.registrationName?(a(e.registrationName,t,n),!0):!1}function a(e,t,n){l.registrationNameModules[e]?i(!1):void 0,l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var i=e(142),u=null,s={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){u?i(!1):void 0,u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]?i(!1):void 0,s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=l},{142:142}],18:[function(e,t,n){"use strict";function r(e){return e===m.topMouseUp||e===m.topTouchEnd||e===m.topTouchCancel}function o(e){return e===m.topMouseMove||e===m.topTouchMove}function a(e){return e===m.topMouseDown||e===m.topTouchStart}function i(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?f.invokeGuardedCallbackWithCatch(o,n,e,r):f.invokeGuardedCallback(o,n,e,r),e.currentTarget=null}function u(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)i(e,t,n[o],r[o]);else n&&i(e,t,n,r);e._dispatchListeners=null,e._dispatchIDs=null}function s(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function l(e){var t=s(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function c(e){var t=e._dispatchListeners,n=e._dispatchIDs;Array.isArray(t)?h(!1):void 0;var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function p(e){return!!e._dispatchListeners}var d=e(15),f=e(54),h=e(142),v=(e(151),{Mount:null,injectMount:function(e){v.Mount=e}}),m=d.topLevelTypes,g={isEndish:r,isMoveish:o,isStartish:a,executeDirectDispatch:c,executeDispatchesInOrder:u,executeDispatchesInOrderStopAtTrue:l,hasDispatches:p,getNode:function(e){return v.Mount.getNode(e)},getID:function(e){return v.Mount.getID(e)},injection:v};t.exports=g},{142:142,15:15,151:151,54:54}],19:[function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return y(e,r)}function o(e,t,n){var o=t?g.bubbled:g.captured,a=r(e,n,o);a&&(n._dispatchListeners=v(n._dispatchListeners,a),n._dispatchIDs=v(n._dispatchIDs,e))}function a(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,o,e)}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(e.dispatchMarker,o,e)}function u(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=y(e,r);o&&(n._dispatchListeners=v(n._dispatchListeners,o),n._dispatchIDs=v(n._dispatchIDs,e))}}function s(e){e&&e.dispatchConfig.registrationName&&u(e.dispatchMarker,null,e)}function l(e){m(e,a)}function c(e){m(e,i)}function p(e,t,n,r){h.injection.getInstanceHandle().traverseEnterLeave(n,r,u,e,t)}function d(e){m(e,s)}var f=e(15),h=e(16),v=(e(151),e(100)),m=e(108),g=f.PropagationPhases,y=h.getListener,C={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:c,accumulateDirectDispatches:d,accumulateEnterLeaveDispatches:p};t.exports=C},{100:100,108:108,15:15,151:151,16:16}],20:[function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=e(24),a=e(23),i=e(115);a(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[i()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),a=o.length;for(e=0;r>e&&n[e]===o[e];e++);var i=r-e;for(t=1;i>=t&&n[r-t]===o[a-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),o.addPoolingTo(r),t.exports=r},{115:115,23:23,24:24}],21:[function(e,t,n){"use strict";var r,o=e(10),a=e(128),i=o.injection.MUST_USE_ATTRIBUTE,u=o.injection.MUST_USE_PROPERTY,s=o.injection.HAS_BOOLEAN_VALUE,l=o.injection.HAS_SIDE_EFFECTS,c=o.injection.HAS_NUMERIC_VALUE,p=o.injection.HAS_POSITIVE_NUMERIC_VALUE,d=o.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(a.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:i|s,allowTransparency:i,alt:null,async:s,autoComplete:null,autoPlay:s,capture:i|s,cellPadding:null,cellSpacing:null,charSet:i,challenge:i,checked:u|s,classID:i,className:r?i:u,cols:i|p,colSpan:null,content:null,contentEditable:null,contextMenu:i,controls:u|s,coords:null,crossOrigin:null,data:null,dateTime:i,"default":s,defer:s,dir:null,disabled:i|s,download:d,draggable:null,encType:null,form:i,formAction:i,formEncType:i,formMethod:i,formNoValidate:s,formTarget:i,frameBorder:i,headers:null,height:i,hidden:i|s,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:u,inputMode:i,integrity:null,is:i,keyParams:i,keyType:i,kind:null,label:null,lang:null,list:i,loop:u|s,low:null,manifest:i,marginHeight:null,marginWidth:null,max:null,maxLength:i,media:i,mediaGroup:null,method:null,min:null,minLength:i,multiple:u|s,muted:u|s,name:null,nonce:i,noValidate:s,open:s,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:u|s,rel:null,required:s,reversed:s,role:i,rows:i|p,rowSpan:null,sandbox:null,scope:null,scoped:s,scrolling:null,seamless:i|s,selected:u|s,shape:null,size:i|p,sizes:i,span:p,spellCheck:null,src:null,srcDoc:u,srcLang:null,srcSet:i,start:c,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:u|l,width:i,wmode:i,wrap:null,about:i,datatype:i,inlist:i,prefix:i,property:i,resource:i,"typeof":i,vocab:i,autoCapitalize:i,autoCorrect:i,autoSave:null,color:null,itemProp:i,itemScope:i|s,itemType:i,itemID:i,itemRef:i,results:null,security:i,unselectable:i},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{10:10,128:128}],22:[function(e,t,n){"use strict";function r(e){null!=e.checkedLink&&null!=e.valueLink?l(!1):void 0}function o(e){r(e),null!=e.value||null!=e.onChange?l(!1):void 0}function a(e){r(e),null!=e.checked||null!=e.onChange?l(!1):void 0}function i(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var u=e(72),s=e(71),l=e(142),c=(e(151),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),p={value:function(e,t,n){return!e[t]||c[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func},d={},f={checkPropTypes:function(e,t,n){for(var r in p){if(p.hasOwnProperty(r))var o=p[r](t,r,e,s.prop,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");o instanceof Error&&!(o.message in d)&&(d[o.message]=!0,i(n))}},getValue:function(e){return e.valueLink?(o(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(a(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(o(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(a(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};t.exports=f},{142:142,151:151,71:71,72:72}],23:[function(e,t,n){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,o=1;o<arguments.length;o++){var a=arguments[o];if(null!=a){var i=Object(a);for(var u in i)r.call(i,u)&&(n[u]=i[u])}}return n}t.exports=r},{}],24:[function(e,t,n){"use strict";var r=e(142),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},a=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},i=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},u=function(e,t,n,r){var o=this;if(o.instancePool.length){var a=o.instancePool.pop();return o.call(a,e,t,n,r),a}return new o(e,t,n,r)},s=function(e,t,n,r,o){var a=this;if(a.instancePool.length){var i=a.instancePool.pop();return a.call(i,e,t,n,r,o),i}return new a(e,t,n,r,o)},l=function(e){var t=this;e instanceof t?void 0:r(!1),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},c=10,p=o,d=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||p,n.poolSize||(n.poolSize=c),n.release=l,n},f={addPoolingTo:d,oneArgumentPooler:o,twoArgumentPooler:a,threeArgumentPooler:i,fourArgumentPooler:u,fiveArgumentPooler:s};t.exports=f},{142:142}],25:[function(e,t,n){"use strict";var r=(e(60),e(106)),o=(e(151),"_getDOMNodeDidWarn"),a={getDOMNode:function(){return this.constructor[o]=!0,r(this)}};t.exports=a},{106:106,151:151,60:60}],26:[function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=h++,d[e[m]]={}),d[e[m]]}var o=e(15),a=e(16),i=e(17),u=e(55),s=e(69),l=e(99),c=e(23),p=e(117),d={},f=!1,h=0,v={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",
+topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),g=c({},u,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(g.handleTopLevel),g.ReactEventListener=e}},setEnabled:function(e){g.ReactEventListener&&g.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!g.ReactEventListener||!g.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,a=r(n),u=i.registrationNameDependencies[e],s=o.topLevelTypes,l=0;l<u.length;l++){var c=u[l];a.hasOwnProperty(c)&&a[c]||(c===s.topWheel?p("wheel")?g.ReactEventListener.trapBubbledEvent(s.topWheel,"wheel",n):p("mousewheel")?g.ReactEventListener.trapBubbledEvent(s.topWheel,"mousewheel",n):g.ReactEventListener.trapBubbledEvent(s.topWheel,"DOMMouseScroll",n):c===s.topScroll?p("scroll",!0)?g.ReactEventListener.trapCapturedEvent(s.topScroll,"scroll",n):g.ReactEventListener.trapBubbledEvent(s.topScroll,"scroll",g.ReactEventListener.WINDOW_HANDLE):c===s.topFocus||c===s.topBlur?(p("focus",!0)?(g.ReactEventListener.trapCapturedEvent(s.topFocus,"focus",n),g.ReactEventListener.trapCapturedEvent(s.topBlur,"blur",n)):p("focusin")&&(g.ReactEventListener.trapBubbledEvent(s.topFocus,"focusin",n),g.ReactEventListener.trapBubbledEvent(s.topBlur,"focusout",n)),a[s.topBlur]=!0,a[s.topFocus]=!0):v.hasOwnProperty(c)&&g.ReactEventListener.trapBubbledEvent(c,v[c],n),a[c]=!0)}},trapBubbledEvent:function(e,t,n){return g.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return g.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!f){var e=l.refreshScrollValues;g.ReactEventListener.monitorScrollValue(e),f=!0}},eventNameDispatchConfigs:a.eventNameDispatchConfigs,registrationNameModules:a.registrationNameModules,putListener:a.putListener,getListener:a.getListener,deleteListener:a.deleteListener,deleteAllListeners:a.deleteAllListeners});s.measureMethods(g,"ReactBrowserEventEmitter",{putListener:"putListener",deleteListener:"deleteListener"}),t.exports=g},{117:117,15:15,16:16,17:17,23:23,55:55,69:69,99:99}],27:[function(e,t,n){"use strict";function r(e,t,n){var r=void 0===e[n];null!=t&&r&&(e[n]=a(t,null))}var o=e(74),a=e(116),i=e(124),u=e(125),s=(e(151),{instantiateChildren:function(e,t,n){if(null==e)return null;var o={};return u(e,r,o),o},updateChildren:function(e,t,n,r){if(!t&&!e)return null;var u;for(u in t)if(t.hasOwnProperty(u)){var s=e&&e[u],l=s&&s._currentElement,c=t[u];if(null!=s&&i(l,c))o.receiveComponent(s,c,n,r),t[u]=s;else{s&&o.unmountComponent(s,u);var p=a(c,null);t[u]=p}}for(u in e)!e.hasOwnProperty(u)||t&&t.hasOwnProperty(u)||o.unmountComponent(e[u]);return t},unmountChildren:function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];o.unmountComponent(n)}}});t.exports=s},{116:116,124:124,125:125,151:151,74:74}],28:[function(e,t,n){"use strict";function r(e){return(""+e).replace(_,"//")}function o(e,t){this.func=e,this.context=t,this.count=0}function a(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function i(e,t,n){if(null==e)return e;var r=o.getPooled(t,n);g(e,a,r),o.release(r)}function u(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function s(e,t,n){var o=e.result,a=e.keyPrefix,i=e.func,u=e.context,s=i.call(u,t,e.count++);Array.isArray(s)?l(s,o,n,m.thatReturnsArgument):null!=s&&(v.isValidElement(s)&&(s=v.cloneAndReplaceKey(s,a+(s!==t?r(s.key||"")+"/":"")+n)),o.push(s))}function l(e,t,n,o,a){var i="";null!=n&&(i=r(n)+"/");var l=u.getPooled(t,i,o,a);g(e,s,l),u.release(l)}function c(e,t,n){if(null==e)return e;var r=[];return l(e,r,null,t,n),r}function p(e,t,n){return null}function d(e,t){return g(e,p,null)}function f(e){var t=[];return l(e,t,null,m.thatReturnsArgument),t}var h=e(24),v=e(50),m=e(134),g=e(125),y=h.twoArgumentPooler,C=h.fourArgumentPooler,_=/\/(?!\/)/g;o.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},h.addPoolingTo(o,y),u.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h.addPoolingTo(u,C);var b={forEach:i,map:c,mapIntoWithKeyPrefixInternal:l,count:d,toArray:f};t.exports=b},{125:125,134:134,24:24,50:50}],29:[function(e,t,n){"use strict";function r(e,t){var n=E.hasOwnProperty(t)?E[t]:null;D.hasOwnProperty(t)&&(n!==_.OVERRIDE_BASE?m(!1):void 0),e.hasOwnProperty(t)&&(n!==_.DEFINE_MANY&&n!==_.DEFINE_MANY_MERGED?m(!1):void 0)}function o(e,t){if(t){"function"==typeof t?m(!1):void 0,d.isValidElement(t)?m(!1):void 0;var n=e.prototype;t.hasOwnProperty(C)&&x.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==C){var a=t[o];if(r(n,o),x.hasOwnProperty(o))x[o](e,a);else{var i=E.hasOwnProperty(o),l=n.hasOwnProperty(o),c="function"==typeof a,p=c&&!i&&!l&&t.autobind!==!1;if(p)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[o]=a,n[o]=a;else if(l){var f=E[o];!i||f!==_.DEFINE_MANY_MERGED&&f!==_.DEFINE_MANY?m(!1):void 0,f===_.DEFINE_MANY_MERGED?n[o]=u(n[o],a):f===_.DEFINE_MANY&&(n[o]=s(n[o],a))}else n[o]=a}}}}function a(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in x;o?m(!1):void 0;var a=n in e;a?m(!1):void 0,e[n]=r}}}function i(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:m(!1);for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?m(!1):void 0,e[n]=t[n]);return e}function u(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return i(o,n),i(o,r),o}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function c(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=l(e,n)}}var p=e(30),d=e(50),f=(e(71),e(70),e(67)),h=e(23),v=e(135),m=e(142),g=e(145),y=e(146),C=(e(151),y({mixins:null})),_=g({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),b=[],E={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},x={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=h({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=h({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=u(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=h({},e.propTypes,t)},statics:function(e,t){a(e,t)},autobind:function(){}},D={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t)},isMounted:function(){return this.updater.isMounted(this)},setProps:function(e,t){this.updater.enqueueSetProps(this,e),t&&this.updater.enqueueCallback(this,t)},replaceProps:function(e,t){this.updater.enqueueReplaceProps(this,e),t&&this.updater.enqueueCallback(this,t)}},N=function(){};h(N.prototype,p.prototype,D);var M={createClass:function(e){var t=function(e,t,n){this.__reactAutoBindMap&&c(this),this.props=e,this.context=t,this.refs=v,this.updater=n||f,this.state=null;var r=this.getInitialState?this.getInitialState():null;"object"!=typeof r||Array.isArray(r)?m(!1):void 0,this.state=r};t.prototype=new N,t.prototype.constructor=t,b.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:m(!1);for(var n in E)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){b.push(e)}}};t.exports=M},{135:135,142:142,145:145,146:146,151:151,23:23,30:30,50:50,67:67,70:70,71:71}],30:[function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=a,this.updater=n||o}var o=e(67),a=(e(102),e(135)),i=e(142);e(151);r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?i(!1):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t)},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e)};t.exports=r},{102:102,135:135,142:142,151:151,67:67}],31:[function(e,t,n){"use strict";var r=e(40),o=e(63),a={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:r.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){o.purgeID(e)}};t.exports=a},{40:40,63:63}],32:[function(e,t,n){"use strict";var r=e(142),o=!1,a={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){o?r(!1):void 0,a.unmountIDFromEnvironment=e.unmountIDFromEnvironment,a.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,a.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};t.exports=a},{142:142}],33:[function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}function o(e){}var a=e(32),i=e(34),u=e(50),s=e(60),l=e(69),c=e(71),p=(e(70),e(74)),d=e(80),f=e(23),h=e(135),v=e(142),m=e(124);e(151);o.prototype.render=function(){var e=s.get(this)._currentElement.type;return e(this.props,this.context,this.updater)};var g=1,y={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null},mountComponent:function(e,t,n){this._context=n,this._mountOrder=g++,this._rootNodeID=e;var r,a,i=this._processProps(this._currentElement.props),l=this._processContext(n),c=this._currentElement.type,f="prototype"in c;f&&(r=new c(i,l,d)),(!f||null===r||r===!1||u.isValidElement(r))&&(a=r,r=new o(c)),r.props=i,r.context=l,r.refs=h,r.updater=d,this._instance=r,s.set(r,this);var m=r.state;void 0===m&&(r.state=m=null),"object"!=typeof m||Array.isArray(m)?v(!1):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,r.componentWillMount&&(r.componentWillMount(),this._pendingStateQueue&&(r.state=this._processPendingState(r.props,r.context))),void 0===a&&(a=this._renderValidatedComponent()),this._renderedComponent=this._instantiateReactComponent(a);var y=p.mountComponent(this._renderedComponent,e,t,this._processChildContext(n));return r.componentDidMount&&t.getReactMountReady().enqueue(r.componentDidMount,r),y},unmountComponent:function(){var e=this._instance;e.componentWillUnmount&&e.componentWillUnmount(),p.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._instance=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,this._topLevelWrapper=null,s.remove(e)},_maskContext:function(e){var t=null,n=this._currentElement.type,r=n.contextTypes;if(!r)return h;t={};for(var o in r)t[o]=e[o];return t},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._currentElement.type,n=this._instance,r=n.getChildContext&&n.getChildContext();if(r){"object"!=typeof t.childContextTypes?v(!1):void 0;for(var o in r)o in t.childContextTypes?void 0:v(!1);return f({},e,r)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var a in e)if(e.hasOwnProperty(a)){var i;try{"function"!=typeof e[a]?v(!1):void 0,i=e[a](t,a,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){i=u}i instanceof Error&&(r(this),n===c.prop)}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&p.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},updateComponent:function(e,t,n,r,o){var a,i=this._instance,u=this._context===o?i.context:this._processContext(o);t===n?a=n.props:(a=this._processProps(n.props),i.componentWillReceiveProps&&i.componentWillReceiveProps(a,u));var s=this._processPendingState(a,u),l=this._pendingForceUpdate||!i.shouldComponentUpdate||i.shouldComponentUpdate(a,s,u);l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,a,s,u,e,o)):(this._currentElement=n,this._context=o,i.props=a,i.state=s,i.context=u)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var a=f({},o?r[0]:n.state),i=o?1:0;i<r.length;i++){var u=r[i];f(a,"function"==typeof u?u.call(n,a,e,t):u)}return a},_performComponentUpdate:function(e,t,n,r,o,a){var i,u,s,l=this._instance,c=Boolean(l.componentDidUpdate);c&&(i=l.props,u=l.state,s=l.context),l.componentWillUpdate&&l.componentWillUpdate(t,n,r),this._currentElement=e,this._context=a,l.props=t,l.state=n,l.context=r,this._updateRenderedComponent(o,a),c&&o.getReactMountReady().enqueue(l.componentDidUpdate.bind(l,i,u,s),l)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent();if(m(r,o))p.receiveComponent(n,o,e,this._processChildContext(t));else{var a=this._rootNodeID,i=n._rootNodeID;p.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(o);var u=p.mountComponent(this._renderedComponent,a,e,this._processChildContext(t));this._replaceNodeWithMarkupByID(i,u)}},_replaceNodeWithMarkupByID:function(e,t){a.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e;i.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{i.current=null}return null===e||e===!1||u.isValidElement(e)?void 0:v(!1),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?v(!1):void 0;var r=t.getPublicInstance(),o=n.refs===h?n.refs={}:n.refs;o[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return e instanceof o?null:e},_instantiateReactComponent:null};l.measureMethods(y,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var C={Mixin:y};t.exports=C},{124:124,135:135,142:142,151:151,23:23,32:32,34:34,50:50,60:60,69:69,70:70,71:71,74:74,80:80}],34:[function(e,t,n){"use strict";var r={current:null};t.exports=r},{}],35:[function(e,t,n){"use strict";var r=e(34),o=e(46),a=e(49),i=e(59),u=e(63),s=e(69),l=e(74),c=e(81),p=e(82),d=e(106),f=e(121);e(151);a.inject();var h=s.measure("React","render",u.render),v={findDOMNode:d,render:h,unmountComponentAtNode:u.unmountComponentAtNode,version:p,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:i,Mount:u,Reconciler:l,TextComponent:o});t.exports=v},{106:106,121:121,151:151,34:34,46:46,49:49,59:59,63:63,69:69,74:74,81:81,82:82}],36:[function(e,t,n){"use strict";var r={onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0},o={getNativeProps:function(e,t,n){if(!t.disabled)return t;var o={};for(var a in t)t.hasOwnProperty(a)&&!r[a]&&(o[a]=t[a]);return o}};t.exports=o},{}],37:[function(e,t,n){"use strict";function r(){return this}function o(){var e=this._reactInternalComponent;return!!e}function a(){}function i(e,t){var n=this._reactInternalComponent;n&&(T.enqueueSetPropsInternal(n,e),t&&T.enqueueCallbackInternal(n,t))}function u(e,t){var n=this._reactInternalComponent;n&&(T.enqueueReplacePropsInternal(n,e),t&&T.enqueueCallbackInternal(n,t))}function s(e,t){t&&(null!=t.dangerouslySetInnerHTML&&(null!=t.children?L(!1):void 0,"object"==typeof t.dangerouslySetInnerHTML&&Y in t.dangerouslySetInnerHTML?void 0:L(!1)),null!=t.style&&"object"!=typeof t.style?L(!1):void 0)}function l(e,t,n,r){var o=S.findReactContainerForID(e);if(o){var a=o.nodeType===z?o.ownerDocument:o;j(t,a)}r.getReactMountReady().enqueue(c,{id:e,registrationName:t,listener:n})}function c(){var e=this;E.putListener(e.id,e.registrationName,e.listener)}function p(){var e=this;e._rootNodeID?void 0:L(!1);var t=S.getNode(e._rootNodeID);switch(t?void 0:L(!1),e._tag){case"iframe":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in G)G.hasOwnProperty(n)&&e._wrapperState.listeners.push(E.trapBubbledEvent(b.topLevelTypes[n],G[n],t));break;case"img":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topError,"error",t),E.trapBubbledEvent(b.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[E.trapBubbledEvent(b.topLevelTypes.topReset,"reset",t),E.trapBubbledEvent(b.topLevelTypes.topSubmit,"submit",t)]}}function d(){N.mountReadyWrapper(this)}function f(){P.postUpdateWrapper(this)}function h(e){J.call(Z,e)||($.test(e)?void 0:L(!1),Z[e]=!0)}function v(e,t){return e.indexOf("-")>=0||null!=t.is}function m(e){h(e),this._tag=e.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var g=e(2),y=e(5),C=e(10),_=e(11),b=e(15),E=e(26),x=e(31),D=e(36),N=e(41),M=e(42),P=e(43),R=e(47),S=e(63),I=e(64),w=e(69),T=e(80),O=e(23),k=e(102),A=e(105),L=e(142),U=(e(117),e(146)),F=e(122),B=e(123),V=(e(149),e(126),e(151),E.deleteListener),j=E.listenTo,W=E.registrationNameModules,K={string:!0,number:!0},H=U({children:null}),q=U({style:null}),Y=U({__html:null}),z=1,G={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},X={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},Q={listing:!0,pre:!0,textarea:!0},$=(O({menuitem:!0},X),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),Z={},J={}.hasOwnProperty;m.displayName="ReactDOMComponent",m.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e;var r=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},t.getReactMountReady().enqueue(p,this);break;case"button":r=D.getNativeProps(this,r,n);break;case"input":N.mountWrapper(this,r,n),r=N.getNativeProps(this,r,n);break;case"option":M.mountWrapper(this,r,n),r=M.getNativeProps(this,r,n);break;case"select":P.mountWrapper(this,r,n),r=P.getNativeProps(this,r,n),n=P.processChildContext(this,r,n);break;case"textarea":R.mountWrapper(this,r,n),r=R.getNativeProps(this,r,n)}s(this,r);var o;if(t.useCreateElement){var a=n[S.ownerDocumentContextKey],i=a.createElement(this._currentElement.type);_.setAttributeForID(i,this._rootNodeID),S.getID(i),this._updateDOMProperties({},r,t,i),this._createInitialChildren(t,r,n,i),o=i}else{var u=this._createOpenTagMarkupAndPutListeners(t,r),l=this._createContentMarkup(t,r,n);o=!l&&X[this._tag]?u+"/>":u+">"+l+"</"+this._currentElement.type+">"}switch(this._tag){case"input":t.getReactMountReady().enqueue(d,this);case"button":case"select":case"textarea":r.autoFocus&&t.getReactMountReady().enqueue(g.focusDOMComponent,this)}return o},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if(null!=o)if(W.hasOwnProperty(r))o&&l(this._rootNodeID,r,o,e);else{r===q&&(o&&(o=this._previousStyleCopy=O({},t.style)),o=y.createMarkupForStyles(o));var a=null;null!=this._tag&&v(this._tag,t)?r!==H&&(a=_.createMarkupForCustomAttribute(r,o)):a=_.createMarkupForProperty(r,o),a&&(n+=" "+a)}}if(e.renderToStaticMarkup)return n;var i=_.createMarkupForID(this._rootNodeID);return n+" "+i},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var a=K[typeof t.children]?t.children:null,i=null!=a?null:t.children;if(null!=a)r=A(a);else if(null!=i){var u=this.mountChildren(i,e,n);r=u.join("")}}return Q[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&F(r,o.__html);else{var a=K[typeof t.children]?t.children:null,i=null!=a?null:t.children;if(null!=a)B(r,a);else if(null!=i)for(var u=this.mountChildren(i,e,n),s=0;s<u.length;s++)r.appendChild(u[s])}},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,r){var o=t.props,a=this._currentElement.props;switch(this._tag){case"button":o=D.getNativeProps(this,o),a=D.getNativeProps(this,a);break;case"input":N.updateWrapper(this),o=N.getNativeProps(this,o),a=N.getNativeProps(this,a);break;case"option":o=M.getNativeProps(this,o),a=M.getNativeProps(this,a);break;case"select":o=P.getNativeProps(this,o),a=P.getNativeProps(this,a);break;case"textarea":R.updateWrapper(this),o=R.getNativeProps(this,o),a=R.getNativeProps(this,a)}s(this,a),this._updateDOMProperties(o,a,e,null),this._updateDOMChildren(o,a,e,r),!k&&this._nodeWithLegacyProperties&&(this._nodeWithLegacyProperties.props=a),"select"===this._tag&&e.getReactMountReady().enqueue(f,this)},_updateDOMProperties:function(e,t,n,r){var o,a,i;for(o in e)if(!t.hasOwnProperty(o)&&e.hasOwnProperty(o))if(o===q){var u=this._previousStyleCopy;for(a in u)u.hasOwnProperty(a)&&(i=i||{},i[a]="");this._previousStyleCopy=null}else W.hasOwnProperty(o)?e[o]&&V(this._rootNodeID,o):(C.properties[o]||C.isCustomAttribute(o))&&(r||(r=S.getNode(this._rootNodeID)),_.deleteValueForProperty(r,o));for(o in t){var s=t[o],c=o===q?this._previousStyleCopy:e[o];if(t.hasOwnProperty(o)&&s!==c)if(o===q)if(s?s=this._previousStyleCopy=O({},s):this._previousStyleCopy=null,c){for(a in c)!c.hasOwnProperty(a)||s&&s.hasOwnProperty(a)||(i=i||{},i[a]="");for(a in s)s.hasOwnProperty(a)&&c[a]!==s[a]&&(i=i||{},i[a]=s[a])}else i=s;else W.hasOwnProperty(o)?s?l(this._rootNodeID,o,s,n):c&&V(this._rootNodeID,o):v(this._tag,t)?(r||(r=S.getNode(this._rootNodeID)),o===H&&(s=null),_.setValueForAttribute(r,o,s)):(C.properties[o]||C.isCustomAttribute(o))&&(r||(r=S.getNode(this._rootNodeID)),null!=s?_.setValueForProperty(r,o,s):_.deleteValueForProperty(r,o))}i&&(r||(r=S.getNode(this._rootNodeID)),y.setValueForStyles(r,i))},_updateDOMChildren:function(e,t,n,r){var o=K[typeof e.children]?e.children:null,a=K[typeof t.children]?t.children:null,i=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,s=null!=o?null:e.children,l=null!=a?null:t.children,c=null!=o||null!=i,p=null!=a||null!=u;null!=s&&null==l?this.updateChildren(null,n,r):c&&!p&&this.updateTextContent(""),null!=a?o!==a&&this.updateTextContent(""+a):null!=u?i!==u&&this.updateMarkup(""+u):null!=l&&this.updateChildren(l,n,r)},unmountComponent:function(){switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":var e=this._wrapperState.listeners;if(e)for(var t=0;t<e.length;t++)e[t].remove();break;case"input":N.unmountWrapper(this);break;case"html":case"head":case"body":L(!1)}if(this.unmountChildren(),E.deleteAllListeners(this._rootNodeID),x.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._wrapperState=null,this._nodeWithLegacyProperties){var n=this._nodeWithLegacyProperties;n._reactInternalComponent=null,this._nodeWithLegacyProperties=null}},getPublicInstance:function(){if(!this._nodeWithLegacyProperties){var e=S.getNode(this._rootNodeID);e._reactInternalComponent=this,e.getDOMNode=r,e.isMounted=o,e.setState=a,e.replaceState=a,e.forceUpdate=a,e.setProps=i,e.replaceProps=u,e.props=this._currentElement.props,this._nodeWithLegacyProperties=e}return this._nodeWithLegacyProperties}},w.measureMethods(m,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),O(m.prototype,m.Mixin,I.Mixin),t.exports=m},{10:10,102:102,105:105,11:11,117:117,122:122,123:123,126:126,142:142,146:146,149:149,15:15,151:151,2:2,23:23,26:26,31:31,36:36,41:41,42:42,43:43,47:47,5:5,63:63,64:64,69:69,80:80}],38:[function(e,t,n){"use strict";function r(e){return o.createFactory(e)}var o=e(50),a=(e(51),e(147)),i=a({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hgroup:"hgroup",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",image:"image",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);t.exports=i},{147:147,50:50,51:51}],39:[function(e,t,n){"use strict";var r={useCreateElement:!1};t.exports=r},{}],40:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(63),i=e(69),u=e(142),s={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},l={updatePropertyByID:function(e,t,n){var r=a.getNode(e);s.hasOwnProperty(t)?u(!1):void 0,null!=n?o.setValueForProperty(r,t,n):o.deleteValueForProperty(r,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=a.getNode(e);r.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=a.getNode(e[n].parentID);r.processUpdates(e,t)}};i.measureMethods(l,"ReactDOMIDOperations",{dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=l},{11:11,142:142,63:63,69:69,9:9}],41:[function(e,t,n){"use strict";function r(){this._rootNodeID&&d.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=i.executeOnChange(t,e);s.asap(r,this);var o=t.name;if("radio"===t.type&&null!=o){for(var a=u.getNode(this._rootNodeID),l=a;l.parentNode;)l=l.parentNode;for(var d=l.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),f=0;f<d.length;f++){var h=d[f];if(h!==a&&h.form===a.form){var v=u.getID(h);v?void 0:c(!1);var m=p[v];m?void 0:c(!1),s.asap(r,m)}}}return n}var a=e(40),i=e(22),u=e(63),s=e(81),l=e(23),c=e(142),p={},d={getNativeProps:function(e,t,n){var r=i.getValue(t),o=i.getChecked(t),a=l({},t,{defaultChecked:void 0,defaultValue:void 0,value:null!=r?r:e._wrapperState.initialValue,checked:null!=o?o:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange});return a},mountWrapper:function(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:t.defaultChecked||!1,initialValue:null!=n?n:null,onChange:o.bind(e)}},mountReadyWrapper:function(e){p[e._rootNodeID]=e},unmountWrapper:function(e){delete p[e._rootNodeID]},updateWrapper:function(e){var t=e._currentElement.props,n=t.checked;null!=n&&a.updatePropertyByID(e._rootNodeID,"checked",n||!1);var r=i.getValue(t);null!=r&&a.updatePropertyByID(e._rootNodeID,"value",""+r)}};t.exports=d},{142:142,22:22,23:23,40:40,63:63,81:81}],42:[function(e,t,n){"use strict";var r=e(28),o=e(43),a=e(23),i=(e(151),o.valueContextKey),u={mountWrapper:function(e,t,n){var r=n[i],o=null;if(null!=r)if(o=!1,Array.isArray(r)){for(var a=0;a<r.length;a++)if(""+r[a]==""+t.value){o=!0;break}}else o=""+r==""+t.value;e._wrapperState={selected:o}},getNativeProps:function(e,t,n){var o=a({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(o.selected=e._wrapperState.selected);var i="";return r.forEach(t.children,function(e){null!=e&&("string"==typeof e||"number"==typeof e)&&(i+=e)}),i&&(o.children=i),o}};t.exports=u},{151:151,23:23,28:28,43:43}],43:[function(e,t,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=i.getValue(e);null!=t&&o(this,Boolean(e.multiple),t)}}function o(e,t,n){var r,o,a=u.getNode(e._rootNodeID).options;if(t){for(r={},o=0;o<n.length;o++)r[""+n[o]]=!0;for(o=0;o<a.length;o++){var i=r.hasOwnProperty(a[o].value);a[o].selected!==i&&(a[o].selected=i)}}else{for(r=""+n,o=0;o<a.length;o++)if(a[o].value===r)return void(a[o].selected=!0);a.length&&(a[0].selected=!0)}}function a(e){var t=this._currentElement.props,n=i.executeOnChange(t,e);return this._wrapperState.pendingUpdate=!0,s.asap(r,this),n}var i=e(22),u=e(63),s=e(81),l=e(23),c=(e(151),"__ReactDOMSelect_value$"+Math.random().toString(36).slice(2)),p={valueContextKey:c,getNativeProps:function(e,t,n){return l({},t,{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=i.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,onChange:a.bind(e),wasMultiple:Boolean(t.multiple)}},processChildContext:function(e,t,n){
+var r=l({},n);return r[c]=e._wrapperState.initialValue,r},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var r=i.getValue(t);null!=r?(e._wrapperState.pendingUpdate=!1,o(e,Boolean(t.multiple),r)):n!==Boolean(t.multiple)&&(null!=t.defaultValue?o(e,Boolean(t.multiple),t.defaultValue):o(e,Boolean(t.multiple),t.multiple?[]:""))}};t.exports=p},{151:151,22:22,23:23,63:63,81:81}],44:[function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var a=o.text.length,i=a+r;return{start:a,end:i}}function a(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,a=t.focusNode,i=t.focusOffset,u=t.getRangeAt(0);try{u.startContainer.nodeType,u.endContainer.nodeType}catch(s){return null}var l=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),c=l?0:u.toString().length,p=u.cloneRange();p.selectNodeContents(e),p.setEnd(u.startContainer,u.startOffset);var d=r(p.startContainer,p.startOffset,p.endContainer,p.endOffset),f=d?0:p.toString().length,h=f+c,v=document.createRange();v.setStart(n,o),v.setEnd(a,i);var m=v.collapsed;return{start:m?h:f,end:m?f:h}}function i(e,t){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function u(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,o=Math.min(t.start,r),a="undefined"==typeof t.end?o:Math.min(t.end,r);if(!n.extend&&o>a){var i=a;a=o,o=i}var u=l(e,o),s=l(e,a);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>a?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}var s=e(128),l=e(114),c=e(115),p=s.canUseDOM&&"selection"in document&&!("getSelection"in window),d={getOffsets:p?o:a,setOffsets:p?i:u};t.exports=d},{114:114,115:115,128:128}],45:[function(e,t,n){"use strict";var r=e(49),o=e(78),a=e(82);r.inject();var i={renderToString:o.renderToString,renderToStaticMarkup:o.renderToStaticMarkup,version:a};t.exports=i},{49:49,78:78,82:82}],46:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(31),i=e(63),u=e(23),s=e(105),l=e(123),c=(e(126),function(e){});u(c.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){if(this._rootNodeID=e,t.useCreateElement){var r=n[i.ownerDocumentContextKey],a=r.createElement("span");return o.setAttributeForID(a,e),i.getID(a),l(a,this._stringText),a}var u=s(this._stringText);return t.renderToStaticMarkup?u:"<span "+o.createMarkupForID(e)+">"+u+"</span>"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var o=i.getNode(this._rootNodeID);r.updateTextContent(o,n)}}},unmountComponent:function(){a.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=c},{105:105,11:11,123:123,126:126,23:23,31:31,63:63,9:9}],47:[function(e,t,n){"use strict";function r(){this._rootNodeID&&c.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=a.executeOnChange(t,e);return u.asap(r,this),n}var a=e(22),i=e(40),u=e(81),s=e(23),l=e(142),c=(e(151),{getNativeProps:function(e,t,n){null!=t.dangerouslySetInnerHTML?l(!1):void 0;var r=s({},t,{defaultValue:void 0,value:void 0,children:e._wrapperState.initialValue,onChange:e._wrapperState.onChange});return r},mountWrapper:function(e,t){var n=t.defaultValue,r=t.children;null!=r&&(null!=n?l(!1):void 0,Array.isArray(r)&&(r.length<=1?void 0:l(!1),r=r[0]),n=""+r),null==n&&(n="");var i=a.getValue(t);e._wrapperState={initialValue:""+(null!=i?i:n),onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=a.getValue(t);null!=n&&i.updatePropertyByID(e._rootNodeID,"value",""+n)}});t.exports=c},{142:142,151:151,22:22,23:23,40:40,81:81}],48:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=e(81),a=e(98),i=e(23),u=e(134),s={initialize:u,close:function(){d.isBatchingUpdates=!1}},l={initialize:u,close:o.flushBatchedUpdates.bind(o)},c=[l,s];i(r.prototype,a.Mixin,{getTransactionWrappers:function(){return c}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,a){var i=d.isBatchingUpdates;d.isBatchingUpdates=!0,i?e(t,n,r,o,a):p.perform(e,null,t,n,r,o,a)}};t.exports=d},{134:134,23:23,81:81,98:98}],49:[function(e,t,n){"use strict";function r(){N||(N=!0,g.EventEmitter.injectReactEventListener(m),g.EventPluginHub.injectEventPluginOrder(u),g.EventPluginHub.injectInstanceHandle(y),g.EventPluginHub.injectMount(C),g.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:s,ChangeEventPlugin:a,SelectEventPlugin:b,BeforeInputEventPlugin:o}),g.NativeComponent.injectGenericComponentClass(h),g.NativeComponent.injectTextComponentClass(v),g.Class.injectMixin(p),g.DOMProperty.injectDOMPropertyConfig(c),g.DOMProperty.injectDOMPropertyConfig(D),g.EmptyComponent.injectEmptyComponent("noscript"),g.Updates.injectReconcileTransaction(_),g.Updates.injectBatchingStrategy(f),g.RootIndex.injectCreateReactRootIndex(l.canUseDOM?i.createReactRootIndex:E.createReactRootIndex),g.Component.injectEnvironment(d))}var o=e(3),a=e(7),i=e(8),u=e(13),s=e(14),l=e(128),c=e(21),p=e(25),d=e(31),f=e(48),h=e(37),v=e(46),m=e(56),g=e(57),y=e(59),C=e(63),_=e(73),b=e(84),E=e(85),x=e(86),D=e(83),N=!1;t.exports={inject:r}},{128:128,13:13,14:14,21:21,25:25,3:3,31:31,37:37,46:46,48:48,56:56,57:57,59:59,63:63,7:7,73:73,8:8,83:83,84:84,85:85,86:86}],50:[function(e,t,n){"use strict";var r=e(34),o=e(23),a=(e(102),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),i={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,t,n,r,o,i,u){var s={$$typeof:a,type:e,key:t,ref:n,props:u,_owner:i};return s};u.createElement=function(e,t,n){var o,a={},s=null,l=null,c=null,p=null;if(null!=t){l=void 0===t.ref?null:t.ref,s=void 0===t.key?null:""+t.key,c=void 0===t.__self?null:t.__self,p=void 0===t.__source?null:t.__source;for(o in t)t.hasOwnProperty(o)&&!i.hasOwnProperty(o)&&(a[o]=t[o])}var d=arguments.length-2;if(1===d)a.children=n;else if(d>1){for(var f=Array(d),h=0;d>h;h++)f[h]=arguments[h+2];a.children=f}if(e&&e.defaultProps){var v=e.defaultProps;for(o in v)"undefined"==typeof a[o]&&(a[o]=v[o])}return u(e,s,l,c,p,r.current,a)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){var n=u(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},u.cloneAndReplaceProps=function(e,t){var n=u(e.type,e.key,e.ref,e._self,e._source,e._owner,t);return n},u.cloneElement=function(e,t,n){var a,s=o({},e.props),l=e.key,c=e.ref,p=e._self,d=e._source,f=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,f=r.current),void 0!==t.key&&(l=""+t.key);for(a in t)t.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(s[a]=t[a])}var h=arguments.length-2;if(1===h)s.children=n;else if(h>1){for(var v=Array(h),m=0;h>m;m++)v[m]=arguments[m+2];s.children=v}return u(e.type,l,c,p,d,f,s)},u.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},t.exports=u},{102:102,23:23,34:34}],51:[function(e,t,n){"use strict";function r(){if(p.current){var e=p.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e,t){e._store&&!e._store.validated&&null==e.key&&(e._store.validated=!0,a("uniqueKey",e,t))}function a(e,t,n){var o=r();if(!o){var a="string"==typeof n?n:n.displayName||n.name;a&&(o=" Check the top-level render call using <"+a+">.")}var i=h[e]||(h[e]={});if(i[o])return null;i[o]=!0;var u={parentOrOwner:o,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return t&&t._owner&&t._owner!==p.current&&(u.childOwner=" It was passed a child from "+t._owner.getName()+"."),u}function i(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];l.isValidElement(r)&&o(r,t)}else if(l.isValidElement(e))e._store&&(e._store.validated=!0);else if(e){var a=d(e);if(a&&a!==e.entries)for(var i,u=a.call(e);!(i=u.next()).done;)l.isValidElement(i.value)&&o(i.value,t)}}function u(e,t,n,o){for(var a in t)if(t.hasOwnProperty(a)){var i;try{"function"!=typeof t[a]?f(!1):void 0,i=t[a](n,a,e,o,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){i=u}i instanceof Error&&!(i.message in v)&&(v[i.message]=!0,r())}}function s(e){var t=e.type;if("function"==typeof t){var n=t.displayName||t.name;t.propTypes&&u(n,t.propTypes,e.props,c.prop),"function"==typeof t.getDefaultProps}}var l=e(50),c=e(71),p=(e(70),e(34)),d=(e(102),e(113)),f=e(142),h=(e(151),{}),v={},m={createElement:function(e,t,n){var r="string"==typeof e||"function"==typeof e,o=l.createElement.apply(this,arguments);if(null==o)return o;if(r)for(var a=2;a<arguments.length;a++)i(arguments[a],e);return s(o),o},createFactory:function(e){var t=m.createElement.bind(null,e);return t.type=e,t},cloneElement:function(e,t,n){for(var r=l.cloneElement.apply(this,arguments),o=2;o<arguments.length;o++)i(arguments[o],r.type);return s(r),r}};t.exports=m},{102:102,113:113,142:142,151:151,34:34,50:50,70:70,71:71}],52:[function(e,t,n){"use strict";function r(){i.registerNullComponentID(this._rootNodeID)}var o,a=e(50),i=e(53),u=e(74),s=e(23),l={injectEmptyComponent:function(e){o=a.createElement(e)}},c=function(e){this._currentElement=null,this._rootNodeID=null,this._renderedComponent=e(o)};s(c.prototype,{construct:function(e){},mountComponent:function(e,t,n){return t.getReactMountReady().enqueue(r,this),this._rootNodeID=e,u.mountComponent(this._renderedComponent,e,t,n)},receiveComponent:function(){},unmountComponent:function(e,t,n){u.unmountComponent(this._renderedComponent),i.deregisterNullComponentID(this._rootNodeID),this._rootNodeID=null,this._renderedComponent=null}}),c.injection=l,t.exports=c},{23:23,50:50,53:53,74:74}],53:[function(e,t,n){"use strict";function r(e){return!!i[e]}function o(e){i[e]=!0}function a(e){delete i[e]}var i={},u={isNullComponentID:r,registerNullComponentID:o,deregisterNullComponentID:a};t.exports=u},{}],54:[function(e,t,n){"use strict";function r(e,t,n,r){try{return t(n,r)}catch(a){return void(null===o&&(o=a))}}var o=null,a={invokeGuardedCallback:r,invokeGuardedCallbackWithCatch:r,rethrowCaughtError:function(){if(o){var e=o;throw o=null,e}}};t.exports=a},{}],55:[function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue(!1)}var o=e(16),a={handleTopLevel:function(e,t,n,a,i){var u=o.extractEvents(e,t,n,a,i);r(u)}};t.exports=a},{16:16}],56:[function(e,t,n){"use strict";function r(e){var t=d.getID(e),n=p.getReactRootIDFromNodeID(t),r=d.findReactContainerForID(n),o=d.getFirstReactDOM(r);return o}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function a(e){i(e)}function i(e){for(var t=d.getFirstReactDOM(v(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=r(n);for(var o=0;o<e.ancestors.length;o++){t=e.ancestors[o];var a=d.getID(t)||"";g._handleTopLevel(e.topLevelType,t,a,e.nativeEvent,v(e.nativeEvent))}}function u(e){var t=m(window);e(t)}var s=e(127),l=e(128),c=e(24),p=e(59),d=e(63),f=e(81),h=e(23),v=e(112),m=e(139);h(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),c.addPoolingTo(o,c.twoArgumentPooler);var g={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:l.canUseDOM?window:null,setHandleTopLevel:function(e){g._handleTopLevel=e},setEnabled:function(e){g._enabled=!!e},isEnabled:function(){return g._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?s.listen(r,t,g.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?s.capture(r,t,g.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=u.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(g._enabled){var n=o.getPooled(e,t);try{f.batchedUpdates(a,n)}finally{o.release(n)}}}};t.exports=g},{112:112,127:127,128:128,139:139,23:23,24:24,59:59,63:63,81:81}],57:[function(e,t,n){"use strict";var r=e(10),o=e(16),a=e(32),i=e(29),u=e(52),s=e(26),l=e(66),c=e(69),p=e(76),d=e(81),f={Component:a.injection,Class:i.injection,DOMProperty:r.injection,EmptyComponent:u.injection,EventPluginHub:o.injection,EventEmitter:s.injection,NativeComponent:l.injection,Perf:c.injection,RootIndex:p.injection,Updates:d.injection};t.exports=f},{10:10,16:16,26:26,29:29,32:32,52:52,66:66,69:69,76:76,81:81}],58:[function(e,t,n){"use strict";function r(e){return a(document.documentElement,e)}var o=e(44),a=e(131),i=e(136),u=e(137),s={hasSelectionCapabilities:function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)},getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(s.hasSelectionCapabilities(n)&&s.setSelection(n,o),i(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if("undefined"==typeof r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var a=e.createTextRange();a.collapse(!0),a.moveStart("character",n),a.moveEnd("character",r-n),a.select()}else o.setOffsets(e,t)}};t.exports=s},{131:131,136:136,137:137,44:44}],59:[function(e,t,n){"use strict";function r(e){return f+e.toString(36)}function o(e,t){return e.charAt(t)===f||t===e.length}function a(e){return""===e||e.charAt(0)===f&&e.charAt(e.length-1)!==f}function i(e,t){return 0===t.indexOf(e)&&o(t,e.length)}function u(e){return e?e.substr(0,e.lastIndexOf(f)):""}function s(e,t){if(a(e)&&a(t)?void 0:d(!1),i(e,t)?void 0:d(!1),e===t)return e;var n,r=e.length+h;for(n=r;n<t.length&&!o(t,n);n++);return t.substr(0,n)}function l(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var r=0,i=0;n>=i;i++)if(o(e,i)&&o(t,i))r=i;else if(e.charAt(i)!==t.charAt(i))break;var u=e.substr(0,r);return a(u)?void 0:d(!1),u}function c(e,t,n,r,o,a){e=e||"",t=t||"",e===t?d(!1):void 0;var l=i(t,e);l||i(e,t)?void 0:d(!1);for(var c=0,p=l?u:s,f=e;;f=p(f,t)){var h;if(o&&f===e||a&&f===t||(h=n(f,l,r)),h===!1||f===t)break;c++<v?void 0:d(!1)}}var p=e(76),d=e(142),f=".",h=f.length,v=1e4,m={createReactRootID:function(){return r(p.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===f&&e.length>1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var a=l(e,t);a!==e&&c(e,a,n,r,!1,!0),a!==t&&c(a,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(c("",e,t,n,!0,!0),c(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},getFirstCommonAncestorID:l,_getNextDescendantID:s,isAncestorIDOf:i,SEPARATOR:f};t.exports=m},{142:142,76:76}],60:[function(e,t,n){"use strict";var r={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=r},{}],61:[function(e,t,n){"use strict";var r=e(28),o=e(30),a=e(29),i=e(38),u=e(50),s=(e(51),e(72)),l=e(82),c=e(23),p=e(119),d=u.createElement,f=u.createFactory,h=u.cloneElement,v={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:p},Component:o,createElement:d,cloneElement:h,isValidElement:u.isValidElement,PropTypes:s,createClass:a.createClass,createFactory:f,createMixin:function(e){return e},DOM:i,version:l,__spread:c};t.exports=v},{119:119,23:23,28:28,29:29,30:30,38:38,50:50,51:51,72:72,82:82}],62:[function(e,t,n){"use strict";var r=e(101),o=/\/?>/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(a.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var o=r(e);return o===n}};t.exports=a},{101:101}],63:[function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){return e?e.nodeType===W?e.documentElement:e.firstChild:null}function a(e){var t=o(e);return t&&Q.getID(t)}function i(e){var t=u(e);if(t)if(V.hasOwnProperty(t)){var n=V[t];n!==e&&(p(n,t)?L(!1):void 0,V[t]=e)}else V[t]=e;return t}function u(e){return e&&e.getAttribute&&e.getAttribute(B)||""}function s(e,t){var n=u(e);n!==t&&delete V[n],e.setAttribute(B,t),V[t]=e}function l(e){return V.hasOwnProperty(e)&&p(V[e],e)||(V[e]=Q.findReactNodeByID(e)),V[e]}function c(e){var t=M.get(e)._rootNodeID;return D.isNullComponentID(t)?null:(V.hasOwnProperty(t)&&p(V[t],t)||(V[t]=Q.findReactNodeByID(t)),V[t])}function p(e,t){if(e){u(e)!==t?L(!1):void 0;var n=Q.findReactContainerForID(t);if(n&&k(n,e))return!0}return!1}function d(e){delete V[e]}function f(e){var t=V[e];return t&&p(t,e)?void(G=t):!1}function h(e){G=null,N.traverseAncestors(e,f);var t=G;return G=null,t}function v(e,t,n,r,o,a){E.useCreateElement&&(a=T({},a),n.nodeType===W?a[H]=n:a[H]=n.ownerDocument);var i=S.mountComponent(e,t,r,a);e._renderedComponent._topLevelWrapper=e,Q._mountImageIntoNode(i,n,o,r)}function m(e,t,n,r,o){var a=w.ReactReconcileTransaction.getPooled(r);a.perform(v,null,e,t,n,a,r,o),w.ReactReconcileTransaction.release(a)}function g(e,t){for(S.unmountComponent(e),t.nodeType===W&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function y(e){var t=a(e);return t?t!==N.getReactRootIDFromNodeID(t):!1}function C(e){for(;e&&e.parentNode!==e;e=e.parentNode)if(1===e.nodeType){var t=u(e);if(t){var n,r=N.getReactRootIDFromNodeID(t),o=e;do if(n=u(o),o=o.parentNode,null==o)return null;while(n!==r);if(o===Y[r])return e}}return null}var _=e(10),b=e(26),E=(e(34),e(39)),x=e(50),D=e(53),N=e(59),M=e(60),P=e(62),R=e(69),S=e(74),I=e(80),w=e(81),T=e(23),O=e(135),k=e(131),A=e(116),L=e(142),U=e(122),F=e(124),B=(e(126),e(151),_.ID_ATTRIBUTE_NAME),V={},j=1,W=9,K=11,H="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),q={},Y={},z=[],G=null,X=function(){};X.prototype.isReactComponent={},X.prototype.render=function(){return this.props};var Q={TopLevelWrapper:X,_instancesByReactRootID:q,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return Q.scrollMonitor(n,function(){I.enqueueElementInternal(e,t),r&&I.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){!t||t.nodeType!==j&&t.nodeType!==W&&t.nodeType!==K?L(!1):void 0,b.ensureScrollValueMonitoring();var n=Q.registerContainer(t);return q[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var o=A(e,null),a=Q._registerComponent(o,t);return w.batchedUpdates(m,o,a,t,n,r),o},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?L(!1):void 0,Q._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){x.isValidElement(t)?void 0:L(!1);var i=new x(X,null,null,null,null,null,t),s=q[a(n)];if(s){var l=s._currentElement,c=l.props;if(F(c,t)){var p=s._renderedComponent.getPublicInstance(),d=r&&function(){r.call(p)};return Q._updateRootComponent(s,i,n,d),p}Q.unmountComponentAtNode(n)}var f=o(n),h=f&&!!u(f),v=y(n),m=h&&!s&&!v,g=Q._renderNewRootComponent(i,n,m,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):O)._renderedComponent.getPublicInstance();return r&&r.call(g),g},render:function(e,t,n){return Q._renderSubtreeIntoContainer(null,e,t,n)},registerContainer:function(e){var t=a(e);return t&&(t=N.getReactRootIDFromNodeID(t)),t||(t=N.createReactRootID()),Y[t]=e,t},unmountComponentAtNode:function(e){!e||e.nodeType!==j&&e.nodeType!==W&&e.nodeType!==K?L(!1):void 0;var t=a(e),n=q[t];if(!n){var r=(y(e),u(e));return r&&r===N.getReactRootIDFromNodeID(r),!1}return w.batchedUpdates(g,n,e),delete q[t],delete Y[t],!0},findReactContainerForID:function(e){var t=N.getReactRootIDFromNodeID(e),n=Y[t];return n},findReactNodeByID:function(e){var t=Q.findReactContainerForID(e);return Q.findComponentRoot(t,e)},getFirstReactDOM:function(e){return C(e)},findComponentRoot:function(e,t){var n=z,r=0,o=h(t)||e;for(n[0]=o.firstChild,n.length=1;r<n.length;){for(var a,i=n[r++];i;){var u=Q.getID(i);u?t===u?a=i:N.isAncestorIDOf(u,t)&&(n.length=r=0,n.push(i.firstChild)):n.push(i.firstChild),i=i.nextSibling}if(a)return n.length=0,a}n.length=0,L(!1)},_mountImageIntoNode:function(e,t,n,a){if(!t||t.nodeType!==j&&t.nodeType!==W&&t.nodeType!==K?L(!1):void 0,n){var i=o(t);if(P.canReuseMarkup(e,i))return;var u=i.getAttribute(P.CHECKSUM_ATTR_NAME);i.removeAttribute(P.CHECKSUM_ATTR_NAME);var s=i.outerHTML;i.setAttribute(P.CHECKSUM_ATTR_NAME,u);var l=e,c=r(l,s);" (client) "+l.substring(c-20,c+20)+"\n (server) "+s.substring(c-20,c+20),t.nodeType===W?L(!1):void 0}if(t.nodeType===W?L(!1):void 0,a.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(e)}else U(t,e)},ownerDocumentContextKey:H,getReactRootID:a,getID:i,setID:s,getNode:l,getNodeFromInstance:c,isValid:p,purgeID:d};R.measureMethods(Q,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=Q},{10:10,116:116,122:122,124:124,126:126,131:131,135:135,142:142,151:151,23:23,26:26,34:34,39:39,50:50,53:53,59:59,60:60,62:62,69:69,74:74,80:80,81:81}],64:[function(e,t,n){"use strict";function r(e,t,n){m.push({parentID:e,parentNode:null,type:p.INSERT_MARKUP,markupIndex:g.push(t)-1,content:null,fromIndex:null,toIndex:n})}function o(e,t,n){m.push({parentID:e,parentNode:null,type:p.MOVE_EXISTING,markupIndex:null,content:null,fromIndex:t,toIndex:n})}function a(e,t){m.push({parentID:e,parentNode:null,type:p.REMOVE_NODE,markupIndex:null,content:null,fromIndex:t,toIndex:null})}function i(e,t){m.push({parentID:e,parentNode:null,type:p.SET_MARKUP,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function u(e,t){m.push({parentID:e,parentNode:null,type:p.TEXT_CONTENT,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function s(){m.length&&(c.processChildrenUpdates(m,g),l())}function l(){m.length=0,g.length=0}var c=e(32),p=e(65),d=(e(34),e(74)),f=e(27),h=e(107),v=0,m=[],g=[],y={Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return f.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r){var o;return o=h(t),f.updateChildren(e,o,n,r)},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var o=[],a=0;for(var i in r)if(r.hasOwnProperty(i)){var u=r[i],s=this._rootNodeID+i,l=d.mountComponent(u,s,t,n);u._mountIndex=a++,o.push(l)}return o},updateTextContent:function(e){v++;var t=!0;try{var n=this._renderedChildren;f.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChild(n[r]);this.setTextContent(e),t=!1}finally{v--,v||(t?l():s())}},updateMarkup:function(e){v++;var t=!0;try{var n=this._renderedChildren;f.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setMarkup(e),t=!1}finally{v--,v||(t?l():s())}},updateChildren:function(e,t,n){v++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{v--,v||(r?l():s())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=this._reconcilerUpdateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var a,i=0,u=0;for(a in o)if(o.hasOwnProperty(a)){var s=r&&r[a],l=o[a];s===l?(this.moveChild(s,u,i),i=Math.max(s._mountIndex,i),s._mountIndex=u):(s&&(i=Math.max(s._mountIndex,i),this._unmountChild(s)),this._mountChildByNameAtIndex(l,a,u,t,n)),u++}for(a in r)!r.hasOwnProperty(a)||o&&o.hasOwnProperty(a)||this._unmountChild(r[a])}},unmountChildren:function(){var e=this._renderedChildren;f.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&o(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){r(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){a(this._rootNodeID,e._mountIndex)},setTextContent:function(e){u(this._rootNodeID,e)},setMarkup:function(e){i(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,o){var a=this._rootNodeID+t,i=d.mountComponent(e,a,r,o);e._mountIndex=n,this.createChild(e,i)},_unmountChild:function(e){this.removeChild(e),e._mountIndex=null}}};t.exports=y},{107:107,27:27,32:32,34:34,65:65,74:74}],65:[function(e,t,n){"use strict";var r=e(145),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});t.exports=o},{145:145}],66:[function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=l(t)),n}function o(e){return c?void 0:s(!1),new c(e.type,e.props)}function a(e){return new d(e)}function i(e){return e instanceof d}var u=e(23),s=e(142),l=null,c=null,p={},d=null,f={injectGenericComponentClass:function(e){c=e},injectTextComponentClass:function(e){d=e},injectComponentClasses:function(e){u(p,e)}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:a,isTextComponent:i,injection:f};t.exports=h},{142:142,23:23}],67:[function(e,t,n){"use strict";function r(e,t){}var o=(e(151),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e,t){r(e,"replaceState")},enqueueSetState:function(e,t){r(e,"setState")},enqueueSetProps:function(e,t){r(e,"setProps")},enqueueReplaceProps:function(e,t){r(e,"replaceProps")}});t.exports=o},{151:151}],68:[function(e,t,n){"use strict";var r=e(142),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.getPublicInstance().refs[t]===e.getPublicInstance()&&n.detachRef(t)}};t.exports=o},{142:142}],69:[function(e,t,n){"use strict";function r(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};t.exports=o},{}],70:[function(e,t,n){"use strict";var r={};t.exports=r},{}],71:[function(e,t,n){"use strict";var r=e(145),o=r({prop:null,context:null,childContext:null});t.exports=o},{145:145}],72:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,a,i){if(o=o||E,i=i||r,null==n[r]){var u=C[a];return t?new Error("Required "+u+" `"+i+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,a,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if(u!==e){var s=C[o],l=m(i);return new Error("Invalid "+s+" `"+a+"` of type "+("`"+l+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return r(t)}function a(){return r(_.thatReturns(null))}function i(e){function t(t,n,r,o,a){var i=t[n];if(!Array.isArray(i)){var u=C[o],s=v(i);return new Error("Invalid "+u+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<i.length;l++){var c=e(i,l,r,o,a+"["+l+"]","SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");if(c instanceof Error)return c}return null}return r(t)}function u(){function e(e,t,n,r,o){if(!y.isValidElement(e[t])){var a=C[r];return new Error("Invalid "+a+" `"+o+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return r(e)}function s(e){function t(t,n,r,o,a){if(!(t[n]instanceof e)){var i=C[o],u=e.name||E,s=g(t[n]);return new Error("Invalid "+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+u+"`."))}return null}return r(t)}function l(e){function t(t,n,r,o,a){for(var i=t[n],u=0;u<e.length;u++)if(i===e[u])return null;var s=C[o],l=JSON.stringify(e);return new Error("Invalid "+s+" `"+a+"` of value `"+i+"` "+("supplied to `"+r+"`, expected one of "+l+"."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function c(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+a+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."))}for(var l in i)if(i.hasOwnProperty(l)){var c=e(i,l,r,o,a+"."+l,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");if(c instanceof Error)return c}return null}return r(t)}function p(e){function t(t,n,r,o,a){for(var i=0;i<e.length;i++){var u=e[i];if(null==u(t,n,r,o,a,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"))return null}var s=C[o];return new Error("Invalid "+s+" `"+a+"` supplied to "+("`"+r+"`."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function d(){function e(e,t,n,r,o){if(!h(e[t])){var a=C[r];return new Error("Invalid "+a+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function f(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+a+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."))}for(var l in e){var c=e[l];if(c){var p=c(i,l,r,o,a+"."+l,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");if(p)return p}}return null}return r(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||y.isValidElement(e))return!0;var t=b(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!h(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!h(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function m(e){var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:"<<anonymous>>"}var y=e(50),C=e(70),_=e(134),b=e(113),E="<<anonymous>>",x={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),any:a(),arrayOf:i,element:u(),instanceOf:s,node:d(),objectOf:c,oneOf:l,oneOfType:p,shape:f};t.exports=x},{113:113,134:134,50:50,70:70}],73:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=o.getPooled(null),this.useCreateElement=!e&&u.useCreateElement}var o=e(6),a=e(24),i=e(26),u=e(39),s=e(58),l=e(98),c=e(23),p={initialize:s.getSelectionInformation,close:s.restoreSelection},d={initialize:function(){var e=i.isEnabled();return i.setEnabled(!1),e},close:function(e){i.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h=[p,d,f],v={getTransactionWrappers:function(){return h},getReactMountReady:function(){return this.reactMountReady},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null}};c(r.prototype,l.Mixin,v),a.addPoolingTo(r),t.exports=r},{23:23,24:24,26:26,39:39,58:58,6:6,98:98}],74:[function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=e(75),a={mountComponent:function(e,t,n,o){var a=e.mountComponent(t,n,o);
+return e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e),a},unmountComponent:function(e){o.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,n,a){var i=e._currentElement;if(t!==i||a!==e._context){var u=o.shouldUpdateRefs(i,t);u&&o.detachRefs(e,i),e.receiveComponent(t,n,a),u&&e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}};t.exports=a},{75:75}],75:[function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):a.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):a.removeComponentAsRefFrom(t,e,n)}var a=e(68),i={};i.attachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&r(n,e,t._owner)}},i.shouldUpdateRefs=function(e,t){var n=null===e||e===!1,r=null===t||t===!1;return n||r||t._owner!==e._owner||t.ref!==e.ref},i.detachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&o(n,e,t._owner)}},t.exports=i},{68:68}],76:[function(e,t,n){"use strict";var r={injectCreateReactRootIndex:function(e){o.createReactRootIndex=e}},o={createReactRootIndex:null,injection:r};t.exports=o},{}],77:[function(e,t,n){"use strict";var r={isBatchingUpdates:!1,batchedUpdates:function(e){}};t.exports=r},{}],78:[function(e,t,n){"use strict";function r(e){i.isValidElement(e)?void 0:h(!1);var t;try{p.injection.injectBatchingStrategy(l);var n=u.createReactRootID();return t=c.getPooled(!1),t.perform(function(){var r=f(e,null),o=r.mountComponent(n,t,d);return s.addChecksumToMarkup(o)},null)}finally{c.release(t),p.injection.injectBatchingStrategy(a)}}function o(e){i.isValidElement(e)?void 0:h(!1);var t;try{p.injection.injectBatchingStrategy(l);var n=u.createReactRootID();return t=c.getPooled(!0),t.perform(function(){var r=f(e,null);return r.mountComponent(n,t,d)},null)}finally{c.release(t),p.injection.injectBatchingStrategy(a)}}var a=e(48),i=e(50),u=e(59),s=e(62),l=e(77),c=e(79),p=e(81),d=e(135),f=e(116),h=e(142);t.exports={renderToString:r,renderToStaticMarkup:o}},{116:116,135:135,142:142,48:48,50:50,59:59,62:62,77:77,79:79,81:81}],79:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=a.getPooled(null),this.useCreateElement=!1}var o=e(24),a=e(6),i=e(98),u=e(23),s=e(134),l={initialize:function(){this.reactMountReady.reset()},close:s},c=[l],p={getTransactionWrappers:function(){return c},getReactMountReady:function(){return this.reactMountReady},destructor:function(){a.release(this.reactMountReady),this.reactMountReady=null}};u(r.prototype,i.Mixin,p),o.addPoolingTo(r),t.exports=r},{134:134,23:23,24:24,6:6,98:98}],80:[function(e,t,n){"use strict";function r(e){u.enqueueUpdate(e)}function o(e,t){var n=i.get(e);return n?n:null}var a=(e(34),e(50)),i=e(60),u=e(81),s=e(23),l=e(142),c=(e(151),{isMounted:function(e){var t=i.get(e);return t?!!t._renderedComponent:!1},enqueueCallback:function(e,t){"function"!=typeof t?l(!1):void 0;var n=o(e);return n?(n._pendingCallbacks?n._pendingCallbacks.push(t):n._pendingCallbacks=[t],void r(n)):null},enqueueCallbackInternal:function(e,t){"function"!=typeof t?l(!1):void 0,e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var a=n._pendingStateQueue||(n._pendingStateQueue=[]);a.push(t),r(n)}},enqueueSetProps:function(e,t){var n=o(e,"setProps");n&&c.enqueueSetPropsInternal(n,t)},enqueueSetPropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:l(!1);var o=n._pendingElement||n._currentElement,i=o.props,u=s({},i.props,t);n._pendingElement=a.cloneAndReplaceProps(o,a.cloneAndReplaceProps(i,u)),r(n)},enqueueReplaceProps:function(e,t){var n=o(e,"replaceProps");n&&c.enqueueReplacePropsInternal(n,t)},enqueueReplacePropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:l(!1);var o=n._pendingElement||n._currentElement,i=o.props;n._pendingElement=a.cloneAndReplaceProps(o,a.cloneAndReplaceProps(i,t)),r(n)},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)}});t.exports=c},{142:142,151:151,23:23,34:34,50:50,60:60,81:81}],81:[function(e,t,n){"use strict";function r(){M.ReactReconcileTransaction&&_?void 0:m(!1)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=M.ReactReconcileTransaction.getPooled(!1)}function a(e,t,n,o,a,i){r(),_.batchedUpdates(e,t,n,o,a,i)}function i(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;t!==g.length?m(!1):void 0,g.sort(i);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,f.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var a=0;a<o.length;a++)e.callbackQueue.enqueue(o[a],r.getPublicInstance())}}function s(e){return r(),_.isBatchingUpdates?void g.push(e):void _.batchedUpdates(s,e)}function l(e,t){_.isBatchingUpdates?void 0:m(!1),y.enqueue(e,t),C=!0}var c=e(6),p=e(24),d=e(69),f=e(74),h=e(98),v=e(23),m=e(142),g=[],y=c.getPooled(),C=!1,_=null,b={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),D()):g.length=0}},E={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},x=[b,E];v(o.prototype,h.Mixin,{getTransactionWrappers:function(){return x},destructor:function(){this.dirtyComponentsLength=null,c.release(this.callbackQueue),this.callbackQueue=null,M.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),p.addPoolingTo(o);var D=function(){for(;g.length||C;){if(g.length){var e=o.getPooled();e.perform(u,null,e),o.release(e)}if(C){C=!1;var t=y;y=c.getPooled(),t.notifyAll(),c.release(t)}}};D=d.measure("ReactUpdates","flushBatchedUpdates",D);var N={injectReconcileTransaction:function(e){e?void 0:m(!1),M.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:m(!1),"function"!=typeof e.batchedUpdates?m(!1):void 0,"boolean"!=typeof e.isBatchingUpdates?m(!1):void 0,_=e}},M={ReactReconcileTransaction:null,batchedUpdates:a,enqueueUpdate:s,flushBatchedUpdates:D,injection:N,asap:l};t.exports=M},{142:142,23:23,24:24,6:6,69:69,74:74,98:98}],82:[function(e,t,n){"use strict";t.exports="0.14.9"},{}],83:[function(e,t,n){"use strict";var r=e(10),o=r.injection.MUST_USE_ATTRIBUTE,a={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},i={Properties:{clipPath:o,cx:o,cy:o,d:o,dx:o,dy:o,fill:o,fillOpacity:o,fontFamily:o,fontSize:o,fx:o,fy:o,gradientTransform:o,gradientUnits:o,markerEnd:o,markerMid:o,markerStart:o,offset:o,opacity:o,patternContentUnits:o,patternUnits:o,points:o,preserveAspectRatio:o,r:o,rx:o,ry:o,spreadMethod:o,stopColor:o,stopOpacity:o,stroke:o,strokeDasharray:o,strokeLinecap:o,strokeOpacity:o,strokeWidth:o,textAnchor:o,transform:o,version:o,viewBox:o,x1:o,x2:o,x:o,xlinkActuate:o,xlinkArcrole:o,xlinkHref:o,xlinkRole:o,xlinkShow:o,xlinkTitle:o,xlinkType:o,xmlBase:o,xmlLang:o,xmlSpace:o,y1:o,y2:o,y:o},DOMAttributeNamespaces:{xlinkActuate:a.xlink,xlinkArcrole:a.xlink,xlinkHref:a.xlink,xlinkRole:a.xlink,xlinkShow:a.xlink,xlinkTitle:a.xlink,xlinkType:a.xlink,xmlBase:a.xml,xmlLang:a.xml,xmlSpace:a.xml},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space"}};t.exports=i},{10:10}],84:[function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&s.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e,t){if(_||null==g||g!==c())return null;var n=r(g);if(!C||!f(C,n)){C=n;var o=l.getPooled(m.select,y,e,t);return o.type="select",o.target=g,i.accumulateTwoPhaseDispatches(o),o}return null}var a=e(15),i=e(19),u=e(128),s=e(58),l=e(90),c=e(137),p=e(118),d=e(146),f=e(149),h=a.topLevelTypes,v=u.canUseDOM&&"documentMode"in document&&document.documentMode<=11,m={select:{phasedRegistrationNames:{bubbled:d({onSelect:null}),captured:d({onSelectCapture:null})},dependencies:[h.topBlur,h.topContextMenu,h.topFocus,h.topKeyDown,h.topMouseDown,h.topMouseUp,h.topSelectionChange]}},g=null,y=null,C=null,_=!1,b=!1,E=d({onSelect:null}),x={eventTypes:m,extractEvents:function(e,t,n,r,a){if(!b)return null;switch(e){case h.topFocus:(p(t)||"true"===t.contentEditable)&&(g=t,y=n,C=null);break;case h.topBlur:g=null,y=null,C=null;break;case h.topMouseDown:_=!0;break;case h.topContextMenu:case h.topMouseUp:return _=!1,o(r,a);case h.topSelectionChange:if(v)break;case h.topKeyDown:case h.topKeyUp:return o(r,a)}return null},didPutListener:function(e,t,n){t===E&&(b=!0)}};t.exports=x},{118:118,128:128,137:137,146:146,149:149,15:15,19:19,58:58,90:90}],85:[function(e,t,n){"use strict";var r=Math.pow(2,53),o={createReactRootIndex:function(){return Math.ceil(Math.random()*r)}};t.exports=o},{}],86:[function(e,t,n){"use strict";var r=e(15),o=e(127),a=e(19),i=e(63),u=e(87),s=e(90),l=e(91),c=e(93),p=e(94),d=e(89),f=e(95),h=e(96),v=e(97),m=e(134),g=e(109),y=e(142),C=e(146),_=r.topLevelTypes,b={abort:{phasedRegistrationNames:{bubbled:C({onAbort:!0}),captured:C({onAbortCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:C({onBlur:!0}),captured:C({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:C({onCanPlay:!0}),captured:C({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:C({onCanPlayThrough:!0}),captured:C({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:C({onClick:!0}),captured:C({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:C({onContextMenu:!0}),captured:C({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:C({onCopy:!0}),captured:C({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:C({onCut:!0}),captured:C({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:C({onDoubleClick:!0}),captured:C({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:C({onDrag:!0}),captured:C({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:C({onDragEnd:!0}),captured:C({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:C({onDragEnter:!0}),captured:C({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:C({onDragExit:!0}),captured:C({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:C({onDragLeave:!0}),captured:C({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:C({onDragOver:!0}),captured:C({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:C({onDragStart:!0}),captured:C({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:C({onDrop:!0}),captured:C({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:C({onDurationChange:!0}),captured:C({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:C({onEmptied:!0}),captured:C({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:C({onEncrypted:!0}),captured:C({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:C({onEnded:!0}),captured:C({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:C({onError:!0}),captured:C({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:C({onFocus:!0}),captured:C({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:C({onInput:!0}),captured:C({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:C({onKeyDown:!0}),captured:C({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:C({onKeyPress:!0}),captured:C({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:C({onKeyUp:!0}),captured:C({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:C({onLoad:!0}),captured:C({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:C({onLoadedData:!0}),captured:C({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:C({onLoadedMetadata:!0}),captured:C({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:C({onLoadStart:!0}),captured:C({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:C({onMouseDown:!0}),captured:C({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:C({onMouseMove:!0}),captured:C({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:C({onMouseOut:!0}),captured:C({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:C({onMouseOver:!0}),captured:C({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:C({onMouseUp:!0}),captured:C({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:C({onPaste:!0}),captured:C({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:C({onPause:!0}),captured:C({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:C({onPlay:!0}),captured:C({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:C({onPlaying:!0}),captured:C({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:C({onProgress:!0}),captured:C({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:C({onRateChange:!0}),captured:C({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:C({onReset:!0}),captured:C({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:C({onScroll:!0}),captured:C({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:C({onSeeked:!0}),captured:C({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:C({onSeeking:!0}),captured:C({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:C({onStalled:!0}),captured:C({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:C({onSubmit:!0}),captured:C({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:C({onSuspend:!0}),captured:C({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:C({onTimeUpdate:!0}),captured:C({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:C({onTouchCancel:!0}),captured:C({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:C({onTouchEnd:!0}),captured:C({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:C({onTouchMove:!0}),captured:C({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:C({onTouchStart:!0}),captured:C({onTouchStartCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:C({onVolumeChange:!0}),captured:C({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:C({onWaiting:!0}),captured:C({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:C({onWheel:!0}),captured:C({onWheelCapture:!0})}}},E={topAbort:b.abort,topBlur:b.blur,topCanPlay:b.canPlay,topCanPlayThrough:b.canPlayThrough,topClick:b.click,topContextMenu:b.contextMenu,topCopy:b.copy,topCut:b.cut,topDoubleClick:b.doubleClick,topDrag:b.drag,topDragEnd:b.dragEnd,topDragEnter:b.dragEnter,topDragExit:b.dragExit,topDragLeave:b.dragLeave,topDragOver:b.dragOver,topDragStart:b.dragStart,topDrop:b.drop,topDurationChange:b.durationChange,topEmptied:b.emptied,topEncrypted:b.encrypted,topEnded:b.ended,topError:b.error,topFocus:b.focus,topInput:b.input,topKeyDown:b.keyDown,topKeyPress:b.keyPress,topKeyUp:b.keyUp,topLoad:b.load,topLoadedData:b.loadedData,topLoadedMetadata:b.loadedMetadata,topLoadStart:b.loadStart,topMouseDown:b.mouseDown,topMouseMove:b.mouseMove,topMouseOut:b.mouseOut,topMouseOver:b.mouseOver,topMouseUp:b.mouseUp,topPaste:b.paste,topPause:b.pause,topPlay:b.play,topPlaying:b.playing,topProgress:b.progress,topRateChange:b.rateChange,topReset:b.reset,topScroll:b.scroll,topSeeked:b.seeked,topSeeking:b.seeking,topStalled:b.stalled,topSubmit:b.submit,topSuspend:b.suspend,topTimeUpdate:b.timeUpdate,topTouchCancel:b.touchCancel,topTouchEnd:b.touchEnd,topTouchMove:b.touchMove,topTouchStart:b.touchStart,topVolumeChange:b.volumeChange,topWaiting:b.waiting,topWheel:b.wheel};for(var x in E)E[x].dependencies=[x];var D=C({onClick:null}),N={},M={eventTypes:b,extractEvents:function(e,t,n,r,o){var i=E[e];if(!i)return null;var m;switch(e){case _.topAbort:case _.topCanPlay:case _.topCanPlayThrough:case _.topDurationChange:case _.topEmptied:case _.topEncrypted:case _.topEnded:case _.topError:case _.topInput:case _.topLoad:case _.topLoadedData:case _.topLoadedMetadata:case _.topLoadStart:case _.topPause:case _.topPlay:case _.topPlaying:case _.topProgress:case _.topRateChange:case _.topReset:case _.topSeeked:case _.topSeeking:case _.topStalled:case _.topSubmit:case _.topSuspend:case _.topTimeUpdate:case _.topVolumeChange:case _.topWaiting:m=s;break;case _.topKeyPress:if(0===g(r))return null;case _.topKeyDown:case _.topKeyUp:m=c;break;case _.topBlur:case _.topFocus:m=l;break;case _.topClick:if(2===r.button)return null;case _.topContextMenu:case _.topDoubleClick:case _.topMouseDown:case _.topMouseMove:case _.topMouseOut:case _.topMouseOver:case _.topMouseUp:m=p;break;case _.topDrag:case _.topDragEnd:case _.topDragEnter:case _.topDragExit:case _.topDragLeave:case _.topDragOver:case _.topDragStart:case _.topDrop:m=d;break;case _.topTouchCancel:case _.topTouchEnd:case _.topTouchMove:case _.topTouchStart:m=f;break;case _.topScroll:m=h;break;case _.topWheel:m=v;break;case _.topCopy:case _.topCut:case _.topPaste:m=u}m?void 0:y(!1);var C=m.getPooled(i,n,r,o);return a.accumulateTwoPhaseDispatches(C),C},didPutListener:function(e,t,n){if(t===D){var r=i.getNode(e);N[e]||(N[e]=o.listen(r,"click",m))}},willDeleteListener:function(e,t){t===D&&(N[e].remove(),delete N[e])}};t.exports=M},{109:109,127:127,134:134,142:142,146:146,15:15,19:19,63:63,87:87,89:89,90:90,91:91,93:93,94:94,95:95,96:96,97:97}],87:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,a),t.exports=r},{90:90}],88:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a={data:null};o.augmentClass(r,a),t.exports=r},{90:90}],89:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(94),a={dataTransfer:null};o.augmentClass(r,a),t.exports=r},{94:94}],90:[function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var u=o[a];u?this[a]=u(n):"target"===a?this.target=r:this[a]=n[a]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;s?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse}var o=e(24),a=e(23),i=e(134),u=(e(151),{type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null});a(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=u,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);a(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=a({},n.Interface,t),e.augmentClass=n.augmentClass,o.addPoolingTo(e,o.fourArgumentPooler)},o.addPoolingTo(r,o.fourArgumentPooler),t.exports=r},{134:134,151:151,23:23,24:24}],91:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a={relatedTarget:null};o.augmentClass(r,a),t.exports=r},{96:96}],92:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a={data:null};o.augmentClass(r,a),t.exports=r},{90:90}],93:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a=e(109),i=e(110),u=e(111),s={key:i,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:u,charCode:function(e){return"keypress"===e.type?a(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?a(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,s),t.exports=r},{109:109,110:110,111:111,96:96}],94:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a=e(99),i=e(111),u={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:i,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+a.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+a.currentScrollTop}};o.augmentClass(r,u),t.exports=r},{111:111,96:96,99:99}],95:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(96),a=e(111),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:a};o.augmentClass(r,i),t.exports=r},{111:111,96:96}],96:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(90),a=e(112),i={view:function(e){if(e.view)return e.view;var t=a(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,i),t.exports=r},{112:112,90:90}],97:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(94),a={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,a),t.exports=r},{94:94}],98:[function(e,t,n){"use strict";var r=e(142),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,a,i,u,s){this.isInTransaction()?r(!1):void 0;var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,n,o,a,i,u,s),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=a.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===a.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){this.isInTransaction()?void 0:r(!1);for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,i=t[n],u=this.wrapperInitData[n];try{o=!0,u!==a.OBSERVED_ERROR&&i.close&&i.close.call(this,u),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(s){}}}this.wrapperInitData.length=0}},a={Mixin:o,OBSERVED_ERROR:{}};t.exports=a},{142:142}],99:[function(e,t,n){"use strict";var r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){r.currentScrollLeft=e.x,r.currentScrollTop=e.y}};t.exports=r},{}],100:[function(e,t,n){"use strict";function r(e,t){if(null==t?o(!1):void 0,null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=e(142);t.exports=r},{142:142}],101:[function(e,t,n){"use strict";function r(e){for(var t=1,n=0,r=0,a=e.length,i=-4&a;i>r;){for(;r<Math.min(r+4096,i);r+=4)n+=(t+=e.charCodeAt(r))+(t+=e.charCodeAt(r+1))+(t+=e.charCodeAt(r+2))+(t+=e.charCodeAt(r+3));t%=o,n%=o}for(;a>r;r++)n+=t+=e.charCodeAt(r);return t%=o,n%=o,t|n<<16}var o=65521;t.exports=r},{}],102:[function(e,t,n){"use strict";var r=!1;t.exports=r},{}],103:[function(e,t,n){"use strict";function r(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||a.hasOwnProperty(e)&&a[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var o=e(4),a=o.isUnitlessNumber;t.exports=r},{4:4}],104:[function(e,t,n){"use strict";function r(e,t,n,r,o){return o}e(23),e(151);t.exports=r},{151:151,23:23}],105:[function(e,t,n){"use strict";function r(e){return a[e]}function o(e){return(""+e).replace(i,r)}var a={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},i=/[&><"']/g;t.exports=o},{}],106:[function(e,t,n){"use strict";function r(e){return null==e?null:1===e.nodeType?e:o.has(e)?a.getNodeFromInstance(e):(null!=e.render&&"function"==typeof e.render?i(!1):void 0,void i(!1))}var o=(e(34),e(60)),a=e(63),i=e(142);e(151);t.exports=r},{142:142,151:151,34:34,60:60,63:63}],107:[function(e,t,n){"use strict";function r(e,t,n){var r=e,o=void 0===r[n];o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return a(e,r,t),t}var a=e(125);e(151);t.exports=o},{125:125,151:151}],108:[function(e,t,n){"use strict";var r=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=r},{}],109:[function(e,t,n){"use strict";function r(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=r},{}],110:[function(e,t,n){"use strict";function r(e){if(e.key){var t=a[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}var o=e(109),a={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=r},{109:109}],111:[function(e,t,n){"use strict";function r(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=a[e];return r?!!n[r]:!1}function o(e){return r}var a={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=o},{}],112:[function(e,t,n){"use strict";function r(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=r},{}],113:[function(e,t,n){"use strict";function r(e){var t=e&&(o&&e[o]||e[a]);return"function"==typeof t?t:void 0}var o="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";t.exports=r},{}],114:[function(e,t,n){"use strict";function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function a(e,t){for(var n=r(e),a=0,i=0;n;){if(3===n.nodeType){if(i=a+n.textContent.length,t>=a&&i>=t)return{node:n,offset:t-a};a=i}n=r(o(n))}}t.exports=a},{}],115:[function(e,t,n){"use strict";function r(){return!a&&o.canUseDOM&&(a="textContent"in document.documentElement?"textContent":"innerText"),a}var o=e(128),a=null;t.exports=r},{128:128}],116:[function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e){var t;if(null===e||e===!1)t=new i(o);else if("object"==typeof e){var n=e;!n||"function"!=typeof n.type&&"string"!=typeof n.type?l(!1):void 0,t="string"==typeof n.type?u.createInternalComponent(n):r(n.type)?new n.type(n):new c}else"string"==typeof e||"number"==typeof e?t=u.createInstanceForText(e):l(!1);return t.construct(e),t._mountIndex=0,t._mountImage=null,t}var a=e(33),i=e(52),u=e(66),s=e(23),l=e(142),c=(e(151),function(){});s(c.prototype,a.Mixin,{_instantiateReactComponent:o}),t.exports=o},{142:142,151:151,23:23,33:33,52:52,66:66}],117:[function(e,t,n){"use strict";function r(e,t){if(!a.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var i=document.createElement("div");i.setAttribute(n,"return;"),r="function"==typeof i[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,a=e(128);a.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=r},{128:128}],118:[function(e,t,n){"use strict";function r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&o[e.type]||"textarea"===t)}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=r},{}],119:[function(e,t,n){"use strict";function r(e){return o.isValidElement(e)?void 0:a(!1),e}var o=e(50),a=e(142);t.exports=r},{142:142,50:50}],120:[function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=e(105);t.exports=r},{105:105}],121:[function(e,t,n){"use strict";var r=e(63);t.exports=r.renderSubtreeIntoContainer},{63:63}],122:[function(e,t,n){"use strict";var r=e(128),o=/^[ \r\n\t\f]/,a=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,i=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(i=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var u=document.createElement("div");u.innerHTML=" ",""===u.innerHTML&&(i=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&a.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=i},{128:128}],123:[function(e,t,n){"use strict";var r=e(128),o=e(105),a=e(122),i=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(i=function(e,t){a(e,o(t))})),t.exports=i},{105:105,122:122,128:128}],124:[function(e,t,n){"use strict";function r(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var o=typeof e,a=typeof t;return"string"===o||"number"===o?"string"===a||"number"===a:"object"===a&&e.type===t.type&&e.key===t.key;
+}t.exports=r},{}],125:[function(e,t,n){"use strict";function r(e){return v[e]}function o(e,t){return e&&null!=e.key?i(e.key):t.toString(36)}function a(e){return(""+e).replace(m,r)}function i(e){return"$"+a(e)}function u(e,t,n,r){var a=typeof e;if(("undefined"===a||"boolean"===a)&&(e=null),null===e||"string"===a||"number"===a||l.isValidElement(e))return n(r,e,""===t?f+o(e,0):t),1;var s,c,v=0,m=""===t?f:t+h;if(Array.isArray(e))for(var g=0;g<e.length;g++)s=e[g],c=m+o(s,g),v+=u(s,c,n,r);else{var y=p(e);if(y){var C,_=y.call(e);if(y!==e.entries)for(var b=0;!(C=_.next()).done;)s=C.value,c=m+o(s,b++),v+=u(s,c,n,r);else for(;!(C=_.next()).done;){var E=C.value;E&&(s=E[1],c=m+i(E[0])+h+o(s,0),v+=u(s,c,n,r))}}else"object"===a&&(String(e),d(!1))}return v}function s(e,t,n){return null==e?0:u(e,"",t,n)}var l=(e(34),e(50)),c=e(59),p=e(113),d=e(142),f=(e(151),c.SEPARATOR),h=":",v={"=":"=0",".":"=1",":":"=2"},m=/[=.:]/g;t.exports=s},{113:113,142:142,151:151,34:34,50:50,59:59}],126:[function(e,t,n){"use strict";var r=(e(23),e(134)),o=(e(151),r);t.exports=o},{134:134,151:151,23:23}],127:[function(e,t,n){"use strict";var r=e(134),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},{134:134}],128:[function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],129:[function(e,t,n){"use strict";function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;t.exports=r},{}],130:[function(e,t,n){"use strict";function r(e){return o(e.replace(a,"ms-"))}var o=e(129),a=/^-ms-/;t.exports=r},{129:129}],131:[function(e,t,n){"use strict";function r(e,t){var n=!0;e:for(;n;){var r=e,a=t;if(n=!1,r&&a){if(r===a)return!0;if(o(r))return!1;if(o(a)){e=r,t=a.parentNode,n=!0;continue e}return r.contains?r.contains(a):r.compareDocumentPosition?!!(16&r.compareDocumentPosition(a)):!1}return!1}}var o=e(144);t.exports=r},{144:144}],132:[function(e,t,n){"use strict";function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function o(e){return r(e)?Array.isArray(e)?e.slice():a(e):[e]}var a=e(150);t.exports=o},{150:150}],133:[function(e,t,n){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function o(e,t){var n=l;l?void 0:s(!1);var o=r(e),a=o&&u(o);if(a){n.innerHTML=a[1]+e+a[2];for(var c=a[0];c--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t?void 0:s(!1),i(p).forEach(t));for(var d=i(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}var a=e(128),i=e(132),u=e(138),s=e(142),l=a.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=o},{128:128,132:132,138:138,142:142}],134:[function(e,t,n){"use strict";function r(e){return function(){return e}}function o(){}o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],135:[function(e,t,n){"use strict";var r={};t.exports=r},{}],136:[function(e,t,n){"use strict";function r(e){try{e.focus()}catch(t){}}t.exports=r},{}],137:[function(e,t,n){"use strict";function r(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=r},{}],138:[function(e,t,n){"use strict";function r(e){return i?void 0:a(!1),d.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||("*"===e?i.innerHTML="<link />":i.innerHTML="<"+e+"></"+e+">",u[e]=!i.firstChild),u[e]?d[e]:null}var o=e(128),a=e(142),i=o.canUseDOM?document.createElement("div"):null,u={},s=[1,'<select multiple="true">',"</select>"],l=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],d={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){d[e]=p,u[e]=!0}),t.exports=r},{128:128,142:142}],139:[function(e,t,n){"use strict";function r(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=r},{}],140:[function(e,t,n){"use strict";function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;t.exports=r},{}],141:[function(e,t,n){"use strict";function r(e){return o(e).replace(a,"-ms-")}var o=e(140),a=/^ms-/;t.exports=r},{140:140}],142:[function(e,t,n){"use strict";function r(e,t,n,r,o,a,i,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,i,u],c=0;s=new Error(t.replace(/%s/g,function(){return l[c++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}t.exports=r},{}],143:[function(e,t,n){"use strict";function r(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=r},{}],144:[function(e,t,n){"use strict";function r(e){return o(e)&&3==e.nodeType}var o=e(143);t.exports=r},{143:143}],145:[function(e,t,n){"use strict";var r=e(142),o=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)?void 0:r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};t.exports=o},{142:142}],146:[function(e,t,n){"use strict";var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=r},{}],147:[function(e,t,n){"use strict";function r(e,t,n){if(!e)return null;var r={};for(var a in e)o.call(e,a)&&(r[a]=t.call(n,e[a],a,e));return r}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],148:[function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=r},{}],149:[function(e,t,n){"use strict";function r(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var a=o.bind(t),i=0;i<n.length;i++)if(!a(n[i])||e[n[i]]!==t[n[i]])return!1;return!0}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],150:[function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?o(!1):void 0,"number"!=typeof t?o(!1):void 0,0===t||t-1 in e?void 0:o(!1),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),a=0;t>a;a++)r[a]=e[a];return r}var o=e(142);t.exports=r},{142:142}],151:[function(e,t,n){"use strict";var r=e(134),o=r;t.exports=o},{134:134}]},{},[1])(1)});
\ No newline at end of file

dist/react-with-addons.js

@@ -1,5 +1,5 @@
-/**
- * React (with addons) v0.13.3
+ /**
+ * React (with addons) v0.14.9
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (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);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.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(_dereq_,module,exports){
/**
@@ -22,18 +22,20 @@
'use strict';
-var LinkedStateMixin = _dereq_(25);
-var React = _dereq_(31);
-var ReactComponentWithPureRenderMixin =
- _dereq_(42);
-var ReactCSSTransitionGroup = _dereq_(34);
-var ReactFragment = _dereq_(69);
-var ReactTransitionGroup = _dereq_(98);
-var ReactUpdates = _dereq_(100);
-
-var cx = _dereq_(127);
-var cloneWithProps = _dereq_(122);
-var update = _dereq_(170);
+var LinkedStateMixin = _dereq_(22);
+var React = _dereq_(26);
+var ReactComponentWithPureRenderMixin = _dereq_(37);
+var ReactCSSTransitionGroup = _dereq_(29);
+var ReactFragment = _dereq_(64);
+var ReactTransitionGroup = _dereq_(94);
+var ReactUpdates = _dereq_(96);
+
+var cloneWithProps = _dereq_(118);
+var shallowCompare = _dereq_(140);
+var update = _dereq_(143);
+var warning = _dereq_(173);
+
+var warnedAboutBatchedUpdates = false;
React.addons = {
CSSTransitionGroup: ReactCSSTransitionGroup,
@@ -41,21 +43,26 @@
PureRenderMixin: ReactComponentWithPureRenderMixin,
TransitionGroup: ReactTransitionGroup,
- batchedUpdates: ReactUpdates.batchedUpdates,
- classSet: cx,
+ batchedUpdates: function () {
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
+ warnedAboutBatchedUpdates = true;
+ }
+ return ReactUpdates.batchedUpdates.apply(this, arguments);
+ },
cloneWithProps: cloneWithProps,
createFragment: ReactFragment.create,
+ shallowCompare: shallowCompare,
update: update
};
-if ("production" !== "development") {
- React.addons.Perf = _dereq_(61);
- React.addons.TestUtils = _dereq_(95);
+if ("development" !== 'production') {
+ React.addons.Perf = _dereq_(55);
+ React.addons.TestUtils = _dereq_(91);
}
module.exports = React;
-
-},{"100":100,"122":122,"127":127,"170":170,"25":25,"31":31,"34":34,"42":42,"61":61,"69":69,"95":95,"98":98}],2:[function(_dereq_,module,exports){
+},{"118":118,"140":140,"143":143,"173":173,"22":22,"26":26,"29":29,"37":37,"55":55,"64":64,"91":91,"94":94,"96":96}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -64,25 +71,35 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule AutoFocusMixin
+ * @providesModule AutoFocusUtils
* @typechecks static-only
*/
'use strict';
-var focusNode = _dereq_(134);
+var ReactMount = _dereq_(72);
-var AutoFocusMixin = {
- componentDidMount: function() {
+var findDOMNode = _dereq_(122);
+var focusNode = _dereq_(155);
+
+var Mixin = {
+ componentDidMount: function () {
if (this.props.autoFocus) {
- focusNode(this.getDOMNode());
+ focusNode(findDOMNode(this));
}
}
};
-module.exports = AutoFocusMixin;
+var AutoFocusUtils = {
+ Mixin: Mixin,
-},{"134":134}],3:[function(_dereq_,module,exports){
+ focusDOMComponent: function () {
+ focusNode(ReactMount.getNode(this._rootNodeID));
+ }
+};
+
+module.exports = AutoFocusUtils;
+},{"122":122,"155":155,"72":72}],3:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015 Facebook, Inc.
* All rights reserved.
@@ -97,22 +114,19 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var ExecutionEnvironment = _dereq_(22);
-var FallbackCompositionState = _dereq_(23);
-var SyntheticCompositionEvent = _dereq_(106);
-var SyntheticInputEvent = _dereq_(110);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var FallbackCompositionState = _dereq_(20);
+var SyntheticCompositionEvent = _dereq_(103);
+var SyntheticInputEvent = _dereq_(107);
-var keyOf = _dereq_(157);
+var keyOf = _dereq_(166);
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
-var canUseCompositionEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'CompositionEvent' in window
-);
+var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
@@ -122,22 +136,12 @@
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
-var canUseTextInputEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'TextEvent' in window &&
- !documentMode &&
- !isPresto()
-);
+var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
-var useFallbackCompositionData = (
- ExecutionEnvironment.canUseDOM &&
- (
- (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
- )
-);
+var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
@@ -145,11 +149,7 @@
*/
function isPresto() {
var opera = window.opera;
- return (
- typeof opera === 'object' &&
- typeof opera.version === 'function' &&
- parseInt(opera.version(), 10) <= 12
- );
+ return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
@@ -161,57 +161,31 @@
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
- bubbled: keyOf({onBeforeInput: null}),
- captured: keyOf({onBeforeInputCapture: null})
+ bubbled: keyOf({ onBeforeInput: null }),
+ captured: keyOf({ onBeforeInputCapture: null })
},
- dependencies: [
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyPress,
- topLevelTypes.topTextInput,
- topLevelTypes.topPaste
- ]
+ dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionEnd: null}),
- captured: keyOf({onCompositionEndCapture: null})
+ bubbled: keyOf({ onCompositionEnd: null }),
+ captured: keyOf({ onCompositionEndCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionStart: null}),
- captured: keyOf({onCompositionStartCapture: null})
+ bubbled: keyOf({ onCompositionStart: null }),
+ captured: keyOf({ onCompositionStartCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionStart,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionUpdate: null}),
- captured: keyOf({onCompositionUpdateCapture: null})
+ bubbled: keyOf({ onCompositionUpdate: null }),
+ captured: keyOf({ onCompositionUpdateCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionUpdate,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
@@ -224,14 +198,11 @@
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
- return (
- (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
+ return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
- !(nativeEvent.ctrlKey && nativeEvent.altKey)
- );
+ !(nativeEvent.ctrlKey && nativeEvent.altKey);
}
-
/**
* Translate native top level events into event types.
*
@@ -258,10 +229,7 @@
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return (
- topLevelType === topLevelTypes.topKeyDown &&
- nativeEvent.keyCode === START_KEYCODE
- );
+ return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
@@ -275,11 +243,11 @@
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
- return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
+ return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
- return (nativeEvent.keyCode !== START_KEYCODE);
+ return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
@@ -317,12 +285,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
-function extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
@@ -352,11 +315,7 @@
}
}
- var event = SyntheticCompositionEvent.getPooled(
- eventType,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
@@ -436,10 +395,7 @@
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
- if (
- topLevelType === topLevelTypes.topCompositionEnd ||
- isFallbackCompositionEnd(topLevelType, nativeEvent)
- ) {
+ if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
@@ -491,12 +447,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
-function extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
@@ -511,11 +462,7 @@
return null;
}
- var event = SyntheticInputEvent.getPooled(
- eventTypes.beforeInput,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
@@ -552,142 +499,13 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ) {
- return [
- extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ),
- extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- )
- ];
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
-
-},{"106":106,"110":110,"157":157,"16":16,"21":21,"22":22,"23":23}],4:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSCore
- * @typechecks
- */
-
-var invariant = _dereq_(150);
-
-/**
- * The CSSCore module specifies the API (and implements most of the methods)
- * that should be used when dealing with the display of elements (via their
- * CSS classes and visibility on screen. It is an API focused on mutating the
- * display and not reading it as no logical state should be encoded in the
- * display of elements.
- */
-
-var CSSCore = {
-
- /**
- * Adds the class passed in to the element if it doesn't already have it.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- addClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSSCore.addClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.add(className);
- } else if (!CSSCore.hasClass(element, className)) {
- element.className = element.className + ' ' + className;
- }
- }
- return element;
- },
-
- /**
- * Removes the class passed in from the element
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- removeClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSSCore.removeClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.remove(className);
- } else if (CSSCore.hasClass(element, className)) {
- element.className = element.className
- .replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
- .replace(/\s+/g, ' ') // multiple spaces to one
- .replace(/^\s*|\s*$/g, ''); // trim the ends
- }
- }
- return element;
- },
-
- /**
- * Helper to add or remove a class from an element based on a condition.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @param {*} bool condition to whether to add or remove the class
- * @return {DOMElement} the element passed in
- */
- conditionClass: function(element, className, bool) {
- return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
- },
-
- /**
- * Tests whether the element has the class specified.
- *
- * @param {DOMNode|DOMWindow} element the element to set the class on
- * @param {string} className the CSS className
- * @return {boolean} true if the element has the class, false if not
- */
- hasClass: function(element, className) {
- ("production" !== "development" ? invariant(
- !/\s/.test(className),
- 'CSS.hasClass takes only a single class name.'
- ) : invariant(!/\s/.test(className)));
- if (element.classList) {
- return !!className && element.classList.contains(className);
- }
- return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
- }
-
-};
-
-module.exports = CSSCore;
-
-},{"150":150}],5:[function(_dereq_,module,exports){
+},{"103":103,"107":107,"147":147,"15":15,"166":166,"19":19,"20":20}],4:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -705,26 +523,31 @@
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
+ animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
+ boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
+ flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
+ tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
+ stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
@@ -748,8 +571,8 @@
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function(prop) {
- prefixes.forEach(function(prefix) {
+Object.keys(isUnitlessNumber).forEach(function (prop) {
+ prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
@@ -765,10 +588,16 @@
*/
var shorthandPropertyExpansions = {
background: {
+ backgroundAttachment: true,
+ backgroundColor: true,
backgroundImage: true,
- backgroundPosition: true,
- backgroundRepeat: true,
- backgroundColor: true
+ backgroundPositionX: true,
+ backgroundPositionY: true,
+ backgroundRepeat: true
+ },
+ backgroundPosition: {
+ backgroundPositionX: true,
+ backgroundPositionY: true
},
border: {
borderWidth: true,
@@ -802,6 +631,11 @@
fontSize: true,
lineHeight: true,
fontFamily: true
+ },
+ outline: {
+ outlineWidth: true,
+ outlineStyle: true,
+ outlineColor: true
}
};
@@ -811,8 +645,7 @@
};
module.exports = CSSProperty;
-
-},{}],6:[function(_dereq_,module,exports){
+},{}],5:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -827,28 +660,37 @@
'use strict';
-var CSSProperty = _dereq_(5);
-var ExecutionEnvironment = _dereq_(22);
+var CSSProperty = _dereq_(4);
+var ExecutionEnvironment = _dereq_(147);
+var ReactPerf = _dereq_(78);
+
+var camelizeStyleName = _dereq_(149);
+var dangerousStyleValue = _dereq_(119);
+var hyphenateStyleName = _dereq_(160);
+var memoizeStringOnly = _dereq_(168);
+var warning = _dereq_(173);
-var camelizeStyleName = _dereq_(121);
-var dangerousStyleValue = _dereq_(128);
-var hyphenateStyleName = _dereq_(148);
-var memoizeStringOnly = _dereq_(159);
-var warning = _dereq_(171);
-
-var processStyleName = memoizeStringOnly(function(styleName) {
+var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
+var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
+ var tempStyle = document.createElement('div').style;
+ try {
+ // IE8 throws "Invalid argument." if resetting shorthand style properties.
+ tempStyle.font = '';
+ } catch (e) {
+ hasShorthandPropertyBug = true;
+ }
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
@@ -858,54 +700,38 @@
var warnedStyleNames = {};
var warnedStyleValues = {};
- var warnHyphenatedStyleName = function(name) {
+ var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported style property %s. Did you mean %s?',
- name,
- camelizeStyleName(name)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
- var warnBadVendoredStyleName = function(name) {
+ var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== "development" ? warning(
- false,
- 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
- name,
- name.charAt(0).toUpperCase() + name.slice(1)
- ) : null);
+ "development" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
- var warnStyleValueWithSemicolon = function(name, value) {
+ var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- ("production" !== "development" ? warning(
- false,
- 'Style property values shouldn\'t contain a semicolon. ' +
- 'Try "%s: %s" instead.',
- name,
- value.replace(badStyleValueWithSemicolonPattern, '')
- ) : null);
+ "development" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
- var warnValidStyle = function(name, value) {
+ var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
@@ -933,14 +759,14 @@
* @param {object} styles
* @return {?string}
*/
- createMarkupForStyles: function(styles) {
+ createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
@@ -958,13 +784,13 @@
* @param {DOMElement} node
* @param {object} styles
*/
- setValueForStyles: function(node, styles) {
+ setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
- if ("production" !== "development") {
+ if ("development" !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
@@ -974,7 +800,7 @@
if (styleValue) {
style[styleName] = styleValue;
} else {
- var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
+ var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
@@ -990,9 +816,12 @@
};
-module.exports = CSSPropertyOperations;
+ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
+ setValueForStyles: 'setValueForStyles'
+});
-},{"121":121,"128":128,"148":148,"159":159,"171":171,"22":22,"5":5}],7:[function(_dereq_,module,exports){
+module.exports = CSSPropertyOperations;
+},{"119":119,"147":147,"149":149,"160":160,"168":168,"173":173,"4":4,"78":78}],6:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1006,10 +835,10 @@
'use strict';
-var PooledClass = _dereq_(30);
+var PooledClass = _dereq_(25);
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
/**
* A specialized pseudo-event module to help keep track of components waiting to
@@ -1036,7 +865,7 @@
* @param {?object} context Context to call `callback` with.
* @internal
*/
- enqueue: function(callback, context) {
+ enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
@@ -1049,17 +878,14 @@
*
* @internal
*/
- notifyAll: function() {
+ notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
- ("production" !== "development" ? invariant(
- callbacks.length === contexts.length,
- 'Mismatched list of contexts in callback queue'
- ) : invariant(callbacks.length === contexts.length));
+ !(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
- for (var i = 0, l = callbacks.length; i < l; i++) {
+ for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
@@ -1072,7 +898,7 @@
*
* @internal
*/
- reset: function() {
+ reset: function () {
this._callbacks = null;
this._contexts = null;
},
@@ -1080,7 +906,7 @@
/**
* `PooledClass` looks for this.
*/
- destructor: function() {
+ destructor: function () {
this.reset();
}
@@ -1089,8 +915,7 @@
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
-
-},{"150":150,"29":29,"30":30}],8:[function(_dereq_,module,exports){
+},{"161":161,"24":24,"25":25}],7:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1104,35 +929,27 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
-var EventPropagators = _dereq_(21);
-var ExecutionEnvironment = _dereq_(22);
-var ReactUpdates = _dereq_(100);
-var SyntheticEvent = _dereq_(108);
-
-var isEventSupported = _dereq_(151);
-var isTextInputElement = _dereq_(153);
-var keyOf = _dereq_(157);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var ReactUpdates = _dereq_(96);
+var SyntheticEvent = _dereq_(105);
+
+var getEventTarget = _dereq_(128);
+var isEventSupported = _dereq_(133);
+var isTextInputElement = _dereq_(134);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
- bubbled: keyOf({onChange: null}),
- captured: keyOf({onChangeCapture: null})
+ bubbled: keyOf({ onChange: null }),
+ captured: keyOf({ onChangeCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topChange,
- topLevelTypes.topClick,
- topLevelTypes.topFocus,
- topLevelTypes.topInput,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
@@ -1148,26 +965,18 @@
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
- return (
- elem.nodeName === 'SELECT' ||
- (elem.nodeName === 'INPUT' && elem.type === 'file')
- );
+ var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
- doesChangeEventBubble = isEventSupported('change') && (
- (!('documentMode' in document) || document.documentMode > 8)
- );
+ doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- activeElementID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
@@ -1186,7 +995,7 @@
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
@@ -1204,18 +1013,12 @@
activeElementID = null;
}
-function getTargetIDForChangeEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
-function handleEventsForChangeEventIE8(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
@@ -1234,9 +1036,7 @@
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (
- (!('documentMode' in document) || document.documentMode > 9)
- );
+ isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
@@ -1244,10 +1044,10 @@
* set on the active element.
*/
var newValueProp = {
- get: function() {
+ get: function () {
return activeElementValueProp.get.call(this);
},
- set: function(val) {
+ set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
@@ -1263,11 +1063,10 @@
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
- activeElementValueProp = Object.getOwnPropertyDescriptor(
- target.constructor.prototype,
- 'value'
- );
+ activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
+ // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
+ // on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
@@ -1311,10 +1110,7 @@
/**
* If a `change` event should be fired, returns the target's ID.
*/
-function getTargetIDForInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
@@ -1323,10 +1119,7 @@
}
// For IE8 and IE9.
-function handleEventsForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
@@ -1349,13 +1142,8 @@
}
// For IE8 and IE9.
-function getTargetIDForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
- if (topLevelType === topLevelTypes.topSelectionChange ||
- topLevelType === topLevelTypes.topKeyUp ||
- topLevelType === topLevelTypes.topKeyDown) {
+function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
+ if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
@@ -1381,16 +1168,10 @@
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
- return (
- elem.nodeName === 'INPUT' &&
- (elem.type === 'checkbox' || elem.type === 'radio')
- );
+ return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
-function getTargetIDForClickEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
@@ -1418,11 +1199,7 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
@@ -1443,36 +1220,24 @@
}
if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- targetID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
+ event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
- handleEventFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}
};
module.exports = ChangeEventPlugin;
-
-},{"100":100,"108":108,"151":151,"153":153,"157":157,"16":16,"18":18,"21":21,"22":22}],9:[function(_dereq_,module,exports){
+},{"105":105,"128":128,"133":133,"134":134,"147":147,"15":15,"16":16,"166":166,"19":19,"96":96}],8:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1490,14 +1255,13 @@
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
-
-},{}],10:[function(_dereq_,module,exports){
+},{}],9:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1512,11 +1276,13 @@
'use strict';
-var Danger = _dereq_(13);
-var ReactMultiChildUpdateTypes = _dereq_(79);
-
-var setTextContent = _dereq_(165);
-var invariant = _dereq_(150);
+var Danger = _dereq_(12);
+var ReactMultiChildUpdateTypes = _dereq_(74);
+var ReactPerf = _dereq_(78);
+
+var setInnerHTML = _dereq_(138);
+var setTextContent = _dereq_(139);
+var invariant = _dereq_(161);
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
@@ -1531,10 +1297,12 @@
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
- parentNode.insertBefore(
- childNode,
- parentNode.childNodes[index] || null
- );
+
+ // fix render order error in safari
+ // IE8 will throw error when index out of list size.
+ var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
+
+ parentNode.insertBefore(childNode, beforeChild);
}
/**
@@ -1554,7 +1322,7 @@
* @param {array<string>} markupList List of markup strings.
* @internal
*/
- processUpdates: function(updates, markupList) {
+ processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
@@ -1563,23 +1331,12 @@
for (var i = 0; i < updates.length; i++) {
update = updates[i];
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
- update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
+ if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
- ("production" !== "development" ? invariant(
- updatedChild,
- 'processUpdates(): Unable to find child %s of element. This ' +
- 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
- 'browser), usually due to forgetting a <tbody> when using tables, ' +
- 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
- 'in an <svg> parent. Try inspecting the child nodes of the element ' +
- 'with React ID `%s`.',
- updatedIndex,
- parentID
- ) : invariant(updatedChild));
+ !updatedChild ? "development" !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
@@ -1590,7 +1347,13 @@
}
}
- var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ var renderedMarkup;
+ // markupList is either a list of markup or just a list of elements
+ if (markupList.length && typeof markupList[0] === 'string') {
+ renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ } else {
+ renderedMarkup = markupList;
+ }
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
@@ -1603,24 +1366,16 @@
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
- insertChildAt(
- update.parentNode,
- renderedMarkup[update.markupIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
- insertChildAt(
- update.parentNode,
- initialChildren[update.parentID][update.fromIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
+ break;
+ case ReactMultiChildUpdateTypes.SET_MARKUP:
+ setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
- setTextContent(
- update.parentNode,
- update.textContent
- );
+ setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
@@ -1631,9 +1386,12 @@
};
-module.exports = DOMChildrenOperations;
+ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
+ updateTextContent: 'updateTextContent'
+});
-},{"13":13,"150":150,"165":165,"79":79}],11:[function(_dereq_,module,exports){
+module.exports = DOMChildrenOperations;
+},{"12":12,"138":138,"139":139,"161":161,"74":74,"78":78}],10:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1646,11 +1404,9 @@
* @typechecks static-only
*/
-/*jslint bitwise: true */
-
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
@@ -1686,6 +1442,9 @@
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
+ * DOMAttributeNamespaces: object mapping React attribute name to the DOM
+ * attribute namespace URL. (Attribute names not specified use no namespace.)
+ *
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
@@ -1694,92 +1453,68 @@
*
* @param {object} domPropertyConfig the config as described above.
*/
- injectDOMPropertyConfig: function(domPropertyConfig) {
+ injectDOMPropertyConfig: function (domPropertyConfig) {
+ var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
+ var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
- DOMProperty._isCustomAttributeFunctions.push(
- domPropertyConfig.isCustomAttribute
- );
+ DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
- ("production" !== "development" ? invariant(
- !DOMProperty.isStandardName.hasOwnProperty(propName),
- 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
- '\'%s\' which has already been injected. You may be accidentally ' +
- 'injecting the same DOM property config twice, or you may be ' +
- 'injecting two configs that have conflicting property names.',
- propName
- ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
-
- DOMProperty.isStandardName[propName] = true;
+ !!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
var lowerCased = propName.toLowerCase();
+ var propConfig = Properties[propName];
+
+ var propertyInfo = {
+ attributeName: lowerCased,
+ attributeNamespace: null,
+ propertyName: propName,
+ mutationMethod: null,
+
+ mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
+ mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
+ hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
+ hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
+ hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
+ hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
+ hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
+ };
+
+ !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
+ }
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
+ propertyInfo.attributeName = attributeName;
+ if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[attributeName] = propName;
- DOMProperty.getAttributeName[propName] = attributeName;
- } else {
- DOMProperty.getAttributeName[propName] = lowerCased;
+ }
}
- DOMProperty.getPropertyName[propName] =
- DOMPropertyNames.hasOwnProperty(propName) ?
- DOMPropertyNames[propName] :
- propName;
+ if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
+ propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
+ }
+
+ if (DOMPropertyNames.hasOwnProperty(propName)) {
+ propertyInfo.propertyName = DOMPropertyNames[propName];
+ }
if (DOMMutationMethods.hasOwnProperty(propName)) {
- DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
- } else {
- DOMProperty.getMutationMethod[propName] = null;
+ propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
- var propConfig = Properties[propName];
- DOMProperty.mustUseAttribute[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
- DOMProperty.mustUseProperty[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
- DOMProperty.hasSideEffects[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
- DOMProperty.hasBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
- DOMProperty.hasNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
- DOMProperty.hasPositiveNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
- DOMProperty.hasOverloadedBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
-
- ("production" !== "development" ? invariant(
- !DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName],
- 'DOMProperty: Cannot require using both attribute and property: %s',
- propName
- ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName]));
- ("production" !== "development" ? invariant(
- DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName],
- 'DOMProperty: Properties that have side effects must use property: %s',
- propName
- ) : invariant(DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName]));
- ("production" !== "development" ? invariant(
- !!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
- 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
- 'numeric value, but not a combination: %s',
- propName
- ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
+ DOMProperty.properties[propName] = propertyInfo;
}
}
};
@@ -1803,87 +1538,49 @@
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
- * Checks whether a property name is a standard property.
- * @type {Object}
- */
- isStandardName: {},
-
- /**
- * Mapping from lowercase property names to the properly cased version, used
- * to warn in the case of missing properties.
- * @type {Object}
- */
- getPossibleStandardName: {},
-
- /**
- * Mapping from normalized names to attribute names that differ. Attribute
- * names are used when rendering markup or with `*Attribute()`.
- * @type {Object}
- */
- getAttributeName: {},
-
- /**
- * Mapping from normalized names to properties on DOM node instances.
- * (This includes properties that mutate due to external factors.)
- * @type {Object}
- */
- getPropertyName: {},
-
- /**
- * Mapping from normalized names to mutation methods. This will only exist if
- * mutation cannot be set simply by the property or `setAttribute()`.
- * @type {Object}
- */
- getMutationMethod: {},
-
- /**
- * Whether the property must be accessed and mutated as an object property.
- * @type {Object}
- */
- mustUseAttribute: {},
-
- /**
+ * Map from property "standard name" to an object with info about how to set
+ * the property in the DOM. Each object contains:
+ *
+ * attributeName:
+ * Used when rendering markup or with `*Attribute()`.
+ * attributeNamespace
+ * propertyName:
+ * Used on DOM node instances. (This includes properties that mutate due to
+ * external factors.)
+ * mutationMethod:
+ * If non-null, used instead of the property or `setAttribute()` after
+ * initial render.
+ * mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
- * @type {Object}
- */
- mustUseProperty: {},
-
- /**
+ * mustUseProperty:
+ * Whether the property must be accessed and mutated as an object property.
+ * hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
- * resources to be loaded or text selection changes. We must ensure that
- * the value is only set if it has changed.
- * @type {Object}
- */
- hasSideEffects: {},
-
- /**
+ * resources to be loaded or text selection changes. If true, we read from
+ * the DOM before updating to ensure that the value is only set if it has
+ * changed.
+ * hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
- * @type {Object}
- */
- hasBooleanValue: {},
-
- /**
- * Whether the property must be numeric or parse as a
- * numeric and should be removed when set to a falsey value.
- * @type {Object}
- */
- hasNumericValue: {},
-
- /**
+ * hasNumericValue:
+ * Whether the property must be numeric or parse as a numeric and should be
+ * removed when set to a falsey value.
+ * hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
- * @type {Object}
+ * hasOverloadedBooleanValue:
+ * Whether the property can be used as a flag as well as with a value.
+ * Removed when strictly equal to false; present without a value when
+ * strictly equal to true; present with a value otherwise.
*/
- hasPositiveNumericValue: {},
+ properties: {},
/**
- * Whether the property can be used as a flag as well as with a value. Removed
- * when strictly equal to false; present without a value when strictly equal
- * to true; present with a value otherwise.
+ * Mapping from lowercase property names to the properly cased version, used
+ * to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
- hasOverloadedBooleanValue: {},
+ getPossibleStandardName: "development" !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
@@ -1894,7 +1591,7 @@
* Checks whether a property name is a custom attribute.
* @method
*/
- isCustomAttribute: function(attributeName) {
+ isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
@@ -1912,7 +1609,7 @@
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
- getDefaultValueForProperty: function(nodeName, prop) {
+ getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
@@ -1929,8 +1626,7 @@
};
module.exports = DOMProperty;
-
-},{"150":150}],12:[function(_dereq_,module,exports){
+},{"161":161}],11:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -1945,20 +1641,38 @@
'use strict';
-var DOMProperty = _dereq_(11);
+var DOMProperty = _dereq_(10);
+var ReactPerf = _dereq_(78);
+
+var quoteAttributeValueForBrowser = _dereq_(136);
+var warning = _dereq_(173);
-var quoteAttributeValueForBrowser = _dereq_(163);
-var warning = _dereq_(171);
+// Simplified subset
+var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
+
+function isAttributeNameSafe(attributeName) {
+ if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
+ return true;
+ }
+ if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
+ return false;
+ }
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ "development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
+ return false;
+}
-function shouldIgnoreValue(name, value) {
- return value == null ||
- (DOMProperty.hasBooleanValue[name] && !value) ||
- (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
- (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
+function shouldIgnoreValue(propertyInfo, value) {
+ return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
-if ("production" !== "development") {
+if ("development" !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
@@ -1967,9 +1681,8 @@
};
var warnedProperties = {};
- var warnUnknownProperty = function(name) {
- if (reactProps.hasOwnProperty(name) && reactProps[name] ||
- warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
+ var warnUnknownProperty = function (name) {
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
@@ -1977,23 +1690,11 @@
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
- var standardName = (
- DOMProperty.isCustomAttribute(lowerCasedName) ?
- lowerCasedName :
- DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
- DOMProperty.getPossibleStandardName[lowerCasedName] :
- null
- );
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
- ("production" !== "development" ? warning(
- standardName == null,
- 'Unknown DOM property %s. Did you mean %s?',
- name,
- standardName
- ) : null);
-
+ "development" !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
@@ -2008,9 +1709,12 @@
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
- createMarkupForID: function(id) {
- return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
- quoteAttributeValueForBrowser(id);
+ createMarkupForID: function (id) {
+ return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
+ },
+
+ setAttributeForID: function (node, id) {
+ node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
@@ -2020,16 +1724,15 @@
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
- createMarkupForProperty: function(name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- if (shouldIgnoreValue(name, value)) {
+ createMarkupForProperty: function (name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
- var attributeName = DOMProperty.getAttributeName[name];
- if (DOMProperty.hasBooleanValue[name] ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
- return attributeName;
+ var attributeName = propertyInfo.attributeName;
+ if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
@@ -2037,51 +1740,79 @@
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
+ * Creates markup for a custom property.
+ *
+ * @param {string} name
+ * @param {*} value
+ * @return {string} Markup string, or empty string if the property was invalid.
+ */
+ createMarkupForCustomAttribute: function (name, value) {
+ if (!isAttributeNameSafe(name) || value == null) {
+ return '';
+ }
+ return name + '=' + quoteAttributeValueForBrowser(value);
+ },
+
+ /**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
- setValueForProperty: function(node, name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ setValueForProperty: function (node, name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
- } else if (shouldIgnoreValue(name, value)) {
+ } else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
- } else if (DOMProperty.mustUseAttribute[name]) {
+ } else if (propertyInfo.mustUseAttribute) {
+ var attributeName = propertyInfo.attributeName;
+ var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
- node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
+ if (namespace) {
+ node.setAttributeNS(namespace, attributeName, '' + value);
+ } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ node.setAttribute(attributeName, '');
} else {
- var propName = DOMProperty.getPropertyName[name];
+ node.setAttribute(attributeName, '' + value);
+ }
+ } else {
+ var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== ('' + value)) {
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
+ DOMPropertyOperations.setValueForAttribute(node, name, value);
+ } else if ("development" !== 'production') {
+ warnUnknownProperty(name);
+ }
+ },
+
+ setValueForAttribute: function (node, name, value) {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
- } else if ("production" !== "development") {
- warnUnknownProperty(name);
- }
},
/**
@@ -2090,37 +1821,38 @@
* @param {DOMElement} node
* @param {string} name
*/
- deleteValueForProperty: function(node, name) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ deleteValueForProperty: function (node, name) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
- } else if (DOMProperty.mustUseAttribute[name]) {
- node.removeAttribute(DOMProperty.getAttributeName[name]);
+ } else if (propertyInfo.mustUseAttribute) {
+ node.removeAttribute(propertyInfo.attributeName);
} else {
- var propName = DOMProperty.getPropertyName[name];
- var defaultValue = DOMProperty.getDefaultValueForProperty(
- node.nodeName,
- propName
- );
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== defaultValue) {
+ var propName = propertyInfo.propertyName;
+ var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
- } else if ("production" !== "development") {
+ } else if ("development" !== 'production') {
warnUnknownProperty(name);
}
}
};
-module.exports = DOMPropertyOperations;
+ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
+ setValueForProperty: 'setValueForProperty',
+ setValueForAttribute: 'setValueForAttribute',
+ deleteValueForProperty: 'deleteValueForProperty'
+});
-},{"11":11,"163":163,"171":171}],13:[function(_dereq_,module,exports){
+module.exports = DOMPropertyOperations;
+},{"10":10,"136":136,"173":173,"78":78}],12:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2133,16 +1865,14 @@
* @typechecks static-only
*/
-/*jslint evil: true, sub: true */
-
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
-var createNodesFromMarkup = _dereq_(126);
-var emptyFunction = _dereq_(129);
-var getMarkupWrap = _dereq_(142);
-var invariant = _dereq_(150);
+var createNodesFromMarkup = _dereq_(152);
+var emptyFunction = _dereq_(153);
+var getMarkupWrap = _dereq_(157);
+var invariant = _dereq_(161);
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
@@ -2173,22 +1903,13 @@
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
- dangerouslyRenderMarkup: function(markupList) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
- 'thread. Make sure `window` and `document` are available globally ' +
- 'before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
+ dangerouslyRenderMarkup: function (markupList) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
- ("production" !== "development" ? invariant(
- markupList[i],
- 'dangerouslyRenderMarkup(...): Missing markup.'
- ) : invariant(markupList[i]));
+ !markupList[i] ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -2213,61 +1934,41 @@
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
- markupListByNodeName[resultIndex] = markup.replace(
- OPEN_TAG_NAME_EXP,
+ markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
- '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
- );
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
- var renderNodes = createNodesFromMarkup(
- markupListByNodeName.join(''),
- emptyFunction // Do nothing special with <script> tags.
+ var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
- if (renderNode.hasAttribute &&
- renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
+ if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
- ("production" !== "development" ? invariant(
- !resultList.hasOwnProperty(resultIndex),
- 'Danger: Assigning to an already-occupied result index.'
- ) : invariant(!resultList.hasOwnProperty(resultIndex)));
+ !!resultList.hasOwnProperty(resultIndex) ? "development" !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
-
- } else if ("production" !== "development") {
- console.error(
- 'Danger: Discarding unexpected node:',
- renderNode
- );
+ } else if ("development" !== 'production') {
+ console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
- ("production" !== "development" ? invariant(
- resultListAssignmentCount === resultList.length,
- 'Danger: Did not assign to every index of resultList.'
- ) : invariant(resultListAssignmentCount === resultList.length));
-
- ("production" !== "development" ? invariant(
- resultList.length === markupList.length,
- 'Danger: Expected markup to render %s nodes, but rendered %s.',
- markupList.length,
- resultList.length
- ) : invariant(resultList.length === markupList.length));
+ !(resultListAssignmentCount === resultList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
+
+ !(resultList.length === markupList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
@@ -2280,32 +1981,24 @@
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
- dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
- ("production" !== "development" ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
- 'worker thread. Make sure `window` and `document` are available ' +
- 'globally before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
- ("production" !== "development" ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
- ("production" !== "development" ? invariant(
- oldChild.tagName.toLowerCase() !== 'html',
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
- '<html> node. This is because browser quirks make this unreliable ' +
- 'and/or slow. If you want to render to the root you must use ' +
- 'server rendering. See React.renderToString().'
- ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
-
- var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
+ !ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
+ !markup ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
+ !(oldChild.tagName.toLowerCase() !== 'html') ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
+
+ var newChild;
+ if (typeof markup === 'string') {
+ newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ } else {
+ newChild = markup;
+ }
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
-
-},{"126":126,"129":129,"142":142,"150":150,"22":22}],14:[function(_dereq_,module,exports){
+},{"147":147,"152":152,"153":153,"157":157,"161":161}],13:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2319,7 +2012,7 @@
'use strict';
-var keyOf = _dereq_(157);
+var keyOf = _dereq_(166);
/**
* Module that is injectable into `EventPluginHub`, that specifies a
@@ -2330,21 +2023,10 @@
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
-var DefaultEventPluginOrder = [
- keyOf({ResponderEventPlugin: null}),
- keyOf({SimpleEventPlugin: null}),
- keyOf({TapEventPlugin: null}),
- keyOf({EnterLeaveEventPlugin: null}),
- keyOf({ChangeEventPlugin: null}),
- keyOf({SelectEventPlugin: null}),
- keyOf({BeforeInputEventPlugin: null}),
- keyOf({AnalyticsEventPlugin: null}),
- keyOf({MobileSafariClickEventPlugin: null})
-];
+var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
-
-},{"157":157}],15:[function(_dereq_,module,exports){
+},{"166":166}],14:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2359,30 +2041,24 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var SyntheticMouseEvent = _dereq_(112);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var SyntheticMouseEvent = _dereq_(109);
-var ReactMount = _dereq_(77);
-var keyOf = _dereq_(157);
+var ReactMount = _dereq_(72);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
- registrationName: keyOf({onMouseEnter: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseEnter: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
- registrationName: keyOf({onMouseLeave: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseLeave: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
@@ -2406,17 +2082,11 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topMouseOver &&
- (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
- if (topLevelType !== topLevelTypes.topMouseOut &&
- topLevelType !== topLevelTypes.topMouseOver) {
+ if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
@@ -2435,15 +2105,24 @@
}
}
- var from, to;
+ var from;
+ var to;
+ var fromID = '';
+ var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
- to =
- getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
- win;
+ fromID = topLevelTargetID;
+ to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
+ if (to) {
+ toID = ReactMount.getID(to);
+ } else {
+ to = win;
+ }
+ to = to || win;
} else {
from = win;
to = topLevelTarget;
+ toID = topLevelTargetID;
}
if (from === to) {
@@ -2451,23 +2130,12 @@
return null;
}
- var fromID = from ? ReactMount.getID(from) : '';
- var toID = to ? ReactMount.getID(to) : '';
-
- var leave = SyntheticMouseEvent.getPooled(
- eventTypes.mouseLeave,
- fromID,
- nativeEvent
- );
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
- var enter = SyntheticMouseEvent.getPooled(
- eventTypes.mouseEnter,
- toID,
- nativeEvent
- );
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
@@ -2483,8 +2151,7 @@
};
module.exports = EnterLeaveEventPlugin;
-
-},{"112":112,"157":157,"16":16,"21":21,"77":77}],16:[function(_dereq_,module,exports){
+},{"109":109,"15":15,"166":166,"19":19,"72":72}],15:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2498,15 +2165,18 @@
'use strict';
-var keyMirror = _dereq_(156);
+var keyMirror = _dereq_(165);
-var PropagationPhases = keyMirror({bubbled: null, captured: null});
+var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
+ topAbort: null,
topBlur: null,
+ topCanPlay: null,
+ topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
@@ -2524,6 +2194,10 @@
topDragOver: null,
topDragStart: null,
topDrop: null,
+ topDurationChange: null,
+ topEmptied: null,
+ topEncrypted: null,
+ topEnded: null,
topError: null,
topFocus: null,
topInput: null,
@@ -2531,21 +2205,36 @@
topKeyPress: null,
topKeyUp: null,
topLoad: null,
+ topLoadedData: null,
+ topLoadedMetadata: null,
+ topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
+ topPause: null,
+ topPlay: null,
+ topPlaying: null,
+ topProgress: null,
+ topRateChange: null,
topReset: null,
topScroll: null,
+ topSeeked: null,
+ topSeeking: null,
topSelectionChange: null,
+ topStalled: null,
topSubmit: null,
+ topSuspend: null,
topTextInput: null,
+ topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
+ topVolumeChange: null,
+ topWaiting: null,
topWheel: null
});
@@ -2555,96 +2244,7 @@
};
module.exports = EventConstants;
-
-},{"156":156}],17:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @providesModule EventListener
- * @typechecks
- */
-
-var emptyFunction = _dereq_(129);
-
-/**
- * Upstream version of event listener. Does not take into account specific
- * nature of platform.
- */
-var EventListener = {
- /**
- * Listen to DOM events during the bubble phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- listen: function(target, eventType, callback) {
- if (target.addEventListener) {
- target.addEventListener(eventType, callback, false);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, false);
- }
- };
- } else if (target.attachEvent) {
- target.attachEvent('on' + eventType, callback);
- return {
- remove: function() {
- target.detachEvent('on' + eventType, callback);
- }
- };
- }
- },
-
- /**
- * Listen to DOM events during the capture phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- capture: function(target, eventType, callback) {
- if (!target.addEventListener) {
- if ("production" !== "development") {
- console.error(
- 'Attempted to listen to events during the capture phase on a ' +
- 'browser that does not support the capture phase. Your application ' +
- 'will not receive some events.'
- );
- }
- return {
- remove: emptyFunction
- };
- } else {
- target.addEventListener(eventType, callback, true);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, true);
- }
- };
- }
- },
-
- registerDefault: function() {}
-};
-
-module.exports = EventListener;
-
-},{"129":129}],18:[function(_dereq_,module,exports){
+},{"165":165}],16:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2658,12 +2258,14 @@
'use strict';
-var EventPluginRegistry = _dereq_(19);
-var EventPluginUtils = _dereq_(20);
-
-var accumulateInto = _dereq_(118);
-var forEachAccumulated = _dereq_(135);
-var invariant = _dereq_(150);
+var EventPluginRegistry = _dereq_(17);
+var EventPluginUtils = _dereq_(18);
+var ReactErrorUtils = _dereq_(61);
+
+var accumulateInto = _dereq_(115);
+var forEachAccumulated = _dereq_(124);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Internal store for event listeners
@@ -2680,23 +2282,24 @@
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
-var executeDispatchesAndRelease = function(event) {
+var executeDispatchesAndRelease = function (event, simulated) {
if (event) {
- var executeDispatch = EventPluginUtils.executeDispatch;
- // Plugins can provide custom behavior when dispatching events.
- var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
- if (PluginModule && PluginModule.executeDispatch) {
- executeDispatch = PluginModule.executeDispatch;
- }
- EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
+ EventPluginUtils.executeDispatchesInOrder(event, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
+var executeDispatchesAndReleaseSimulated = function (e) {
+ return executeDispatchesAndRelease(e, true);
+};
+var executeDispatchesAndReleaseTopLevel = function (e) {
+ return executeDispatchesAndRelease(e, false);
+};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
@@ -2705,14 +2308,8 @@
var InstanceHandle = null;
function validateInstanceHandle() {
- var valid =
- InstanceHandle &&
- InstanceHandle.traverseTwoPhase &&
- InstanceHandle.traverseEnterLeave;
- ("production" !== "development" ? invariant(
- valid,
- 'InstanceHandle not injected before use!'
- ) : invariant(valid));
+ var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
+ "development" !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
}
/**
@@ -2754,15 +2351,15 @@
* @param {object} InjectedInstanceHandle
* @public
*/
- injectInstanceHandle: function(InjectedInstanceHandle) {
+ injectInstanceHandle: function (InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateInstanceHandle();
}
},
- getInstanceHandle: function() {
- if ("production" !== "development") {
+ getInstanceHandle: function () {
+ if ("development" !== 'production') {
validateInstanceHandle();
}
return InstanceHandle;
@@ -2792,16 +2389,16 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
- putListener: function(id, registrationName, listener) {
- ("production" !== "development" ? invariant(
- !listener || typeof listener === 'function',
- 'Expected %s listener to be a function, instead got type %s',
- registrationName, typeof listener
- ) : invariant(!listener || typeof listener === 'function'));
+ putListener: function (id, registrationName, listener) {
+ !(typeof listener === 'function') ? "development" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
- var bankForRegistrationName =
- listenerBank[registrationName] || (listenerBank[registrationName] = {});
+ var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.didPutListener) {
+ PluginModule.didPutListener(id, registrationName, listener);
+ }
},
/**
@@ -2809,7 +2406,7 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
- getListener: function(id, registrationName) {
+ getListener: function (id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
@@ -2820,8 +2417,14 @@
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
- deleteListener: function(id, registrationName) {
+ deleteListener: function (id, registrationName) {
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
var bankForRegistrationName = listenerBank[registrationName];
+ // TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
@@ -2832,8 +2435,17 @@
*
* @param {string} id ID of the DOM element.
*/
- deleteAllListeners: function(id) {
+ deleteAllListeners: function (id) {
for (var registrationName in listenerBank) {
+ if (!listenerBank[registrationName][id]) {
+ continue;
+ }
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
delete listenerBank[registrationName][id];
}
},
@@ -2849,23 +2461,14 @@
* @return {*} An accumulation of synthetic events.
* @internal
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
- for (var i = 0, l = plugins.length; i < l; i++) {
+ for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
- var extractedEvents = possiblePlugin.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
@@ -2881,7 +2484,7 @@
* @param {*} events An accumulation of synthetic events.
* @internal
*/
- enqueueEvents: function(events) {
+ enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
@@ -2892,35 +2495,36 @@
*
* @internal
*/
- processEventQueue: function() {
+ processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
- forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
- ("production" !== "development" ? invariant(
- !eventQueue,
- 'processEventQueue(): Additional events were enqueued while processing ' +
- 'an event queue. Support for this has not yet been implemented.'
- ) : invariant(!eventQueue));
+ if (simulated) {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
+ } else {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
+ }
+ !!eventQueue ? "development" !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
+ // This would be a good time to rethrow if any of the event handlers threw.
+ ReactErrorUtils.rethrowCaughtError();
},
/**
* These are needed for tests only. Do not use!
*/
- __purge: function() {
+ __purge: function () {
listenerBank = {};
},
- __getListenerBank: function() {
+ __getListenerBank: function () {
return listenerBank;
}
};
module.exports = EventPluginHub;
-
-},{"118":118,"135":135,"150":150,"19":19,"20":20}],19:[function(_dereq_,module,exports){
+},{"115":115,"124":124,"161":161,"17":17,"173":173,"18":18,"61":61}],17:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -2935,7 +2539,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* Injectable ordering of event plugins.
@@ -2960,38 +2564,15 @@
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
- ("production" !== "development" ? invariant(
- pluginIndex > -1,
- 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
- 'the plugin ordering, `%s`.',
- pluginName
- ) : invariant(pluginIndex > -1));
+ !(pluginIndex > -1) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
- ("production" !== "development" ? invariant(
- PluginModule.extractEvents,
- 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
- 'method, but `%s` does not.',
- pluginName
- ) : invariant(PluginModule.extractEvents));
+ !PluginModule.extractEvents ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
- ("production" !== "development" ? invariant(
- publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- ),
- 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
- eventName,
- pluginName
- ) : invariant(publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- )));
+ !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
}
}
}
@@ -3005,12 +2586,7 @@
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
- ("production" !== "development" ? invariant(
- !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'event name, `%s`.',
- eventName
- ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
@@ -3018,20 +2594,12 @@
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
- publishRegistrationName(
- phasedRegistrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
- publishRegistrationName(
- dispatchConfig.registrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
return true;
}
return false;
@@ -3046,15 +2614,9 @@
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
- ("production" !== "development" ? invariant(
- !EventPluginRegistry.registrationNameModules[registrationName],
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'registration name, `%s`.',
- registrationName
- ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
- EventPluginRegistry.registrationNameDependencies[registrationName] =
- PluginModule.eventTypes[eventName].dependencies;
+ EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
}
/**
@@ -3093,12 +2655,8 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
- injectEventPluginOrder: function(InjectedEventPluginOrder) {
- ("production" !== "development" ? invariant(
- !EventPluginOrder,
- 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
- 'once. You are likely trying to load more than one copy of React.'
- ) : invariant(!EventPluginOrder));
+ injectEventPluginOrder: function (InjectedEventPluginOrder) {
+ !!EventPluginOrder ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
@@ -3114,21 +2672,15 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
- injectEventPluginsByName: function(injectedNamesToPlugins) {
+ injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
- if (!namesToPlugins.hasOwnProperty(pluginName) ||
- namesToPlugins[pluginName] !== PluginModule) {
- ("production" !== "development" ? invariant(
- !namesToPlugins[pluginName],
- 'EventPluginRegistry: Cannot inject two different event plugins ' +
- 'using the same name, `%s`.',
- pluginName
- ) : invariant(!namesToPlugins[pluginName]));
+ if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
+ !!namesToPlugins[pluginName] ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
@@ -3145,20 +2697,16 @@
* @return {?object} The plugin that created the supplied event.
* @internal
*/
- getPluginModuleForEvent: function(event) {
+ getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
- return EventPluginRegistry.registrationNameModules[
- dispatchConfig.registrationName
- ] || null;
+ return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
- var PluginModule = EventPluginRegistry.registrationNameModules[
- dispatchConfig.phasedRegistrationNames[phase]
- ];
+ var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
if (PluginModule) {
return PluginModule;
}
@@ -3170,7 +2718,7 @@
* Exposed for unit testing.
* @private
*/
- _resetEventPlugins: function() {
+ _resetEventPlugins: function () {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
@@ -3197,8 +2745,7 @@
};
module.exports = EventPluginRegistry;
-
-},{"150":150}],20:[function(_dereq_,module,exports){
+},{"161":161}],18:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3212,9 +2759,11 @@
'use strict';
-var EventConstants = _dereq_(16);
+var EventConstants = _dereq_(15);
+var ReactErrorUtils = _dereq_(61);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Injected dependencies:
@@ -3226,14 +2775,10 @@
*/
var injection = {
Mount: null,
- injectMount: function(InjectedMount) {
+ injectMount: function (InjectedMount) {
injection.Mount = InjectedMount;
- if ("production" !== "development") {
- ("production" !== "development" ? invariant(
- InjectedMount && InjectedMount.getNode,
- 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
- 'is missing getNode.'
- ) : invariant(InjectedMount && InjectedMount.getNode));
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
}
}
};
@@ -3241,50 +2786,56 @@
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseUp ||
- topLevelType === topLevelTypes.topTouchEnd ||
- topLevelType === topLevelTypes.topTouchCancel;
+ return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseMove ||
- topLevelType === topLevelTypes.topTouchMove;
+ return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseDown ||
- topLevelType === topLevelTypes.topTouchStart;
+ return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
}
-
var validateEventDispatches;
-if ("production" !== "development") {
- validateEventDispatches = function(event) {
+if ("development" !== 'production') {
+ validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
- var listenersLen = listenersIsArr ?
- dispatchListeners.length :
- dispatchListeners ? 1 : 0;
-
- ("production" !== "development" ? invariant(
- idsIsArr === listenersIsArr && IDsLen === listenersLen,
- 'EventPluginUtils: Invalid `event`.'
- ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
+ var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
+
+ "development" !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
};
}
/**
- * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
- * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
- * kept separate to conserve memory.
+ * Dispatch the event to the listener.
+ * @param {SyntheticEvent} event SyntheticEvent to handle
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
+ * @param {function} listener Application-level callback
+ * @param {string} domID DOM id to pass to the callback.
*/
-function forEachEventDispatch(event, cb) {
+function executeDispatch(event, simulated, listener, domID) {
+ var type = event.type || 'unknown-event';
+ event.currentTarget = injection.Mount.getNode(domID);
+ if (simulated) {
+ ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
+ } else {
+ ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
+ }
+ event.currentTarget = null;
+}
+
+/**
+ * Standard/simple iteration through an event's collected dispatches.
+ */
+function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -3293,31 +2844,11 @@
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
- cb(event, dispatchListeners[i], dispatchIDs[i]);
+ executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
- cb(event, dispatchListeners, dispatchIDs);
+ executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
}
-}
-
-/**
- * Default implementation of PluginModule.executeDispatch().
- * @param {SyntheticEvent} SyntheticEvent to handle
- * @param {function} Application-level callback
- * @param {string} domID DOM id to pass to the callback.
- */
-function executeDispatch(event, listener, domID) {
- event.currentTarget = injection.Mount.getNode(domID);
- var returnValue = listener(event, domID);
- event.currentTarget = null;
- return returnValue;
-}
-
-/**
- * Standard/simple iteration through an event's collected dispatches.
- */
-function executeDispatchesInOrder(event, cb) {
- forEachEventDispatch(event, cb);
event._dispatchListeners = null;
event._dispatchIDs = null;
}
@@ -3326,13 +2857,13 @@
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
- * @return id of the first dispatch execution who's listener returns true, or
- * null if no listener returned true.
+ * @return {?string} id of the first dispatch execution who's listener returns
+ * true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -3370,21 +2901,16 @@
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
- * @return The return value of executing the single dispatch.
+ * @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
- ("production" !== "development" ? invariant(
- !Array.isArray(dispatchListener),
- 'executeDirectDispatch(...): Invalid `event`.'
- ) : invariant(!Array.isArray(dispatchListener)));
- var res = dispatchListener ?
- dispatchListener(event, dispatchID) :
- null;
+ !!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
+ var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
@@ -3392,7 +2918,7 @@
/**
* @param {SyntheticEvent} event
- * @return {bool} True iff number of dispatches accumulated is greater than 0.
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
@@ -3407,17 +2933,22 @@
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
- executeDispatch: executeDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
- injection: injection,
- useTouchEvents: false
+
+ getNode: function (id) {
+ return injection.Mount.getNode(id);
+ },
+ getID: function (node) {
+ return injection.Mount.getID(node);
+ },
+
+ injection: injection
};
module.exports = EventPluginUtils;
-
-},{"150":150,"16":16}],21:[function(_dereq_,module,exports){
+},{"15":15,"161":161,"173":173,"61":61}],19:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3431,11 +2962,13 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
-var accumulateInto = _dereq_(118);
-var forEachAccumulated = _dereq_(135);
+var warning = _dereq_(173);
+
+var accumulateInto = _dereq_(115);
+var forEachAccumulated = _dereq_(124);
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
@@ -3445,8 +2978,7 @@
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
- var registrationName =
- event.dispatchConfig.phasedRegistrationNames[propagationPhase];
+ var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
@@ -3457,16 +2989,13 @@
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
- if ("production" !== "development") {
- if (!domID) {
- throw new Error('Dispatching id must not be null');
- }
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
@@ -3474,20 +3003,24 @@
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
- * each event and perform the traversal for each one. We can not perform a
+ * each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
- event.dispatchMarker,
- accumulateDirectionalDispatches,
- event
- );
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
+/**
+ * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
+ */
+function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
+ if (event && event.dispatchConfig.phasedRegistrationNames) {
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
+ }
+}
/**
* Accumulates without regard to direction, does not look for phased
@@ -3499,8 +3032,7 @@
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
@@ -3521,16 +3053,13 @@
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
-function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
- EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
- fromID,
- toID,
- accumulateDispatches,
- leave,
- enter
- );
+function accumulateTwoPhaseDispatchesSkipTarget(events) {
+ forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
+function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
+ EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
+}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
@@ -3551,57 +3078,13 @@
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
+ accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
-
-},{"118":118,"135":135,"16":16,"18":18}],22:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ExecutionEnvironment
- */
-
-/*jslint evil: true */
-
-"use strict";
-
-var canUseDOM = !!(
- (typeof window !== 'undefined' &&
- window.document && window.document.createElement)
-);
-
-/**
- * Simple, lightweight module assisting with the detection and context of
- * Worker. Helps avoid circular dependencies and allows code to reason about
- * whether or not they are in a Worker, even if they never include the main
- * `ReactWorker` dependency.
- */
-var ExecutionEnvironment = {
-
- canUseDOM: canUseDOM,
-
- canUseWorkers: typeof Worker !== 'undefined',
-
- canUseEventListeners:
- canUseDOM && !!(window.addEventListener || window.attachEvent),
-
- canUseViewport: canUseDOM && !!window.screen,
-
- isInWorker: !canUseDOM // For now, this is true - might change in the future.
-
-};
-
-module.exports = ExecutionEnvironment;
-
-},{}],23:[function(_dereq_,module,exports){
+},{"115":115,"124":124,"15":15,"16":16,"173":173}],20:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3616,10 +3099,10 @@
'use strict';
-var PooledClass = _dereq_(30);
+var PooledClass = _dereq_(25);
-var assign = _dereq_(29);
-var getTextContentAccessor = _dereq_(145);
+var assign = _dereq_(24);
+var getTextContentAccessor = _dereq_(131);
/**
* This helper class stores information about text content of a target node,
@@ -3639,12 +3122,18 @@
}
assign(FallbackCompositionState.prototype, {
+ destructor: function () {
+ this._root = null;
+ this._startText = null;
+ this._fallbackText = null;
+ },
+
/**
* Get current text of input.
*
* @return {string}
*/
- getText: function() {
+ getText: function () {
if ('value' in this._root) {
return this._root.value;
}
@@ -3657,7 +3146,7 @@
*
* @return {string}
*/
- getData: function() {
+ getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}
@@ -3691,8 +3180,7 @@
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
-
-},{"145":145,"29":29,"30":30}],24:[function(_dereq_,module,exports){
+},{"131":131,"24":24,"25":25}],21:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3704,41 +3192,27 @@
* @providesModule HTMLDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
-var DOMProperty = _dereq_(11);
-var ExecutionEnvironment = _dereq_(22);
+var DOMProperty = _dereq_(10);
+var ExecutionEnvironment = _dereq_(147);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE =
- DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE =
- DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
+var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
+var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
- hasSVG = (
- implementation &&
- implementation.hasFeature &&
- implementation.hasFeature(
- 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
- '1.1'
- )
- );
+ hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
}
-
var HTMLDOMPropertyConfig = {
- isCustomAttribute: RegExp.prototype.test.bind(
- /^(data|aria)-[a-z_][a-z\d_.\-]*$/
- ),
+ isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
Properties: {
/**
* Standard Properties
@@ -3752,12 +3226,14 @@
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
- // autoFocus is polyfilled/normalized by AutoFocusMixin
+ // autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
+ capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
+ challenge: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
@@ -3776,6 +3252,7 @@
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
+ 'default': HAS_BOOLEAN_VALUE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
@@ -3799,6 +3276,12 @@
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
+ inputMode: MUST_USE_ATTRIBUTE,
+ integrity: null,
+ is: MUST_USE_ATTRIBUTE,
+ keyParams: MUST_USE_ATTRIBUTE,
+ keyType: MUST_USE_ATTRIBUTE,
+ kind: null,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
@@ -3813,9 +3296,11 @@
mediaGroup: null,
method: null,
min: null,
+ minLength: MUST_USE_ATTRIBUTE,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
+ nonce: MUST_USE_ATTRIBUTE,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
optimum: null,
@@ -3827,6 +3312,7 @@
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
+ reversed: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
@@ -3843,10 +3329,12 @@
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
+ srcLang: null,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
+ summary: null,
tabIndex: null,
target: null,
title: null,
@@ -3855,14 +3343,32 @@
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
+ wrap: null,
+
+ /**
+ * RDFa Properties
+ */
+ about: MUST_USE_ATTRIBUTE,
+ datatype: MUST_USE_ATTRIBUTE,
+ inlist: MUST_USE_ATTRIBUTE,
+ prefix: MUST_USE_ATTRIBUTE,
+ // property is also supported for OpenGraph in meta tags.
+ property: MUST_USE_ATTRIBUTE,
+ resource: MUST_USE_ATTRIBUTE,
+ 'typeof': MUST_USE_ATTRIBUTE,
+ vocab: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
- autoCapitalize: null,
- autoCorrect: null,
+ autoCapitalize: MUST_USE_ATTRIBUTE,
+ autoCorrect: MUST_USE_ATTRIBUTE,
+ // autoSave allows WebKit/Blink to persist values of input fields on page reloads
+ autoSave: null,
+ // color is for Safari mask-icon link
+ color: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
@@ -3873,8 +3379,12 @@
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
- // property is supported for OpenGraph in meta tags.
- property: null,
+ // results show looking glass icon and recent searches on input
+ // search fields in WebKit/Blink
+ results: null,
+ // IE-only attribute that specifies security restrictions on an iframe
+ // as an alternative to the sandbox attribute on IE<10
+ security: MUST_USE_ATTRIBUTE,
// IE-only attribute that controls focus behavior
unselectable: MUST_USE_ATTRIBUTE
},
@@ -3885,11 +3395,10 @@
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
- autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
- autoCorrect: 'autocorrect',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
+ autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',
@@ -3902,8 +3411,7 @@
};
module.exports = HTMLDOMPropertyConfig;
-
-},{"11":11,"22":22}],25:[function(_dereq_,module,exports){
+},{"10":10,"147":147}],22:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3918,8 +3426,8 @@
'use strict';
-var ReactLink = _dereq_(75);
-var ReactStateSetters = _dereq_(94);
+var ReactLink = _dereq_(70);
+var ReactStateSetters = _dereq_(90);
/**
* A simple mixin around ReactLink.forState().
@@ -3934,17 +3442,13 @@
* if you're using Google Closure Compiler advanced mode.
* @return {ReactLink} ReactLink instance linking to the state.
*/
- linkState: function(key) {
- return new ReactLink(
- this.state[key],
- ReactStateSetters.createStateKeySetter(this, key)
- );
+ linkState: function (key) {
+ return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
}
};
module.exports = LinkedStateMixin;
-
-},{"75":75,"94":94}],26:[function(_dereq_,module,exports){
+},{"70":70,"90":90}],23:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -3959,9 +3463,11 @@
'use strict';
-var ReactPropTypes = _dereq_(86);
+var ReactPropTypes = _dereq_(82);
+var ReactPropTypeLocations = _dereq_(81);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
var hasReadOnlyValue = {
'button': true,
@@ -3973,46 +3479,44 @@
'submit': true
};
-function _assertSingleLink(input) {
- ("production" !== "development" ? invariant(
- input.props.checkedLink == null || input.props.valueLink == null,
- 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
- 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
- ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
+function _assertSingleLink(inputProps) {
+ !(inputProps.checkedLink == null || inputProps.valueLink == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
}
-function _assertValueLink(input) {
- _assertSingleLink(input);
- ("production" !== "development" ? invariant(
- input.props.value == null && input.props.onChange == null,
- 'Cannot provide a valueLink and a value or onChange event. If you want ' +
- 'to use value or onChange, you probably don\'t want to use valueLink.'
- ) : invariant(input.props.value == null && input.props.onChange == null));
+function _assertValueLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.value == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
}
-function _assertCheckedLink(input) {
- _assertSingleLink(input);
- ("production" !== "development" ? invariant(
- input.props.checked == null && input.props.onChange == null,
- 'Cannot provide a checkedLink and a checked property or onChange event. ' +
- 'If you want to use checked or onChange, you probably don\'t want to ' +
- 'use checkedLink'
- ) : invariant(input.props.checked == null && input.props.onChange == null));
+function _assertCheckedLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.checked == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
}
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedValueChange(e) {
- /*jshint validthis:true */
- this.props.valueLink.requestChange(e.target.value);
-}
+var propTypes = {
+ value: function (props, propName, componentName) {
+ if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ checked: function (props, propName, componentName) {
+ if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ onChange: ReactPropTypes.func
+};
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedCheckChange(e) {
- /*jshint validthis:true */
- this.props.checkedLink.requestChange(e.target.checked);
+var loggedTypeFailures = {};
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
+ }
+ return '';
}
/**
@@ -4020,198 +3524,66 @@
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
- Mixin: {
- propTypes: {
- value: function(props, propName, componentName) {
- if (!props[propName] ||
- hasReadOnlyValue[props.type] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
+ checkPropTypes: function (tagName, props, owner) {
+ for (var propName in propTypes) {
+ if (propTypes.hasOwnProperty(propName)) {
+ var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
}
- return new Error(
- 'You provided a `value` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultValue`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- checked: function(props, propName, componentName) {
- if (!props[propName] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
+ // Only monitor this failure once because there tends to be a lot of the
+ // same error.
+ loggedTypeFailures[error.message] = true;
+
+ var addendum = getDeclarationErrorAddendum(owner);
+ "development" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
}
- return new Error(
- 'You provided a `checked` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultChecked`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- onChange: ReactPropTypes.func
}
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
- getValue: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return input.props.valueLink.value;
+ getValue: function (inputProps) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.value;
}
- return input.props.value;
+ return inputProps.value;
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
- getChecked: function(input) {
- if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return input.props.checkedLink.value;
- }
- return input.props.checked;
+ getChecked: function (inputProps) {
+ if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.value;
+ }
+ return inputProps.checked;
},
/**
- * @param {ReactComponent} input Form component
- * @return {function} change callback either from onChange prop or link.
- */
- getOnChange: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return _handleLinkedValueChange;
- } else if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return _handleLinkedCheckChange;
+ * @param {object} inputProps Props for form component
+ * @param {SyntheticEvent} event change event to handle
+ */
+ executeOnChange: function (inputProps, event) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.requestChange(event.target.value);
+ } else if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.requestChange(event.target.checked);
+ } else if (inputProps.onChange) {
+ return inputProps.onChange.call(undefined, event);
}
- return input.props.onChange;
}
};
module.exports = LinkedValueUtils;
-
-},{"150":150,"86":86}],27:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule LocalEventTrapMixin
- */
-
-'use strict';
-
-var ReactBrowserEventEmitter = _dereq_(33);
-
-var accumulateInto = _dereq_(118);
-var forEachAccumulated = _dereq_(135);
-var invariant = _dereq_(150);
-
-function remove(event) {
- event.remove();
-}
-
-var LocalEventTrapMixin = {
- trapBubbledEvent:function(topLevelType, handlerBaseName) {
- ("production" !== "development" ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
- // If a component renders to null or if another component fatals and causes
- // the state of the tree to be corrupted, `node` here can be null.
- var node = this.getDOMNode();
- ("production" !== "development" ? invariant(
- node,
- 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
- ) : invariant(node));
- var listener = ReactBrowserEventEmitter.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- node
- );
- this._localEventListeners =
- accumulateInto(this._localEventListeners, listener);
- },
-
- // trapCapturedEvent would look nearly identical. We don't implement that
- // method because it isn't currently needed.
-
- componentWillUnmount:function() {
- if (this._localEventListeners) {
- forEachAccumulated(this._localEventListeners, remove);
- }
- }
-};
-
-module.exports = LocalEventTrapMixin;
-
-},{"118":118,"135":135,"150":150,"33":33}],28:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule MobileSafariClickEventPlugin
- * @typechecks static-only
- */
-
-'use strict';
-
-var EventConstants = _dereq_(16);
-
-var emptyFunction = _dereq_(129);
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-/**
- * Mobile Safari does not fire properly bubble click events on non-interactive
- * elements, which means delegated click listeners do not fire. The workaround
- * for this bug involves attaching an empty click listener on the target node.
- *
- * This particular plugin works around the bug by attaching an empty click
- * listener on `touchstart` (which does fire on every element).
- */
-var MobileSafariClickEventPlugin = {
-
- eventTypes: null,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topTouchStart) {
- var target = nativeEvent.target;
- if (target && !target.onclick) {
- target.onclick = emptyFunction;
- }
- }
- }
-
-};
-
-module.exports = MobileSafariClickEventPlugin;
-
-},{"129":129,"16":16}],29:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"81":81,"82":82}],24:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -4259,8 +3631,7 @@
}
module.exports = assign;
-
-},{}],30:[function(_dereq_,module,exports){
+},{}],25:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4274,7 +3645,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* Static poolers. Several custom versions for each potential number of
@@ -4283,7 +3654,7 @@
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
-var oneArgumentPooler = function(copyFieldsFrom) {
+var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4294,7 +3665,7 @@
}
};
-var twoArgumentPooler = function(a1, a2) {
+var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4305,7 +3676,7 @@
}
};
-var threeArgumentPooler = function(a1, a2, a3) {
+var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4316,7 +3687,18 @@
}
};
-var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
+var fourArgumentPooler = function (a1, a2, a3, a4) {
+ var Klass = this;
+ if (Klass.instancePool.length) {
+ var instance = Klass.instancePool.pop();
+ Klass.call(instance, a1, a2, a3, a4);
+ return instance;
+ } else {
+ return new Klass(a1, a2, a3, a4);
+ }
+};
+
+var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -4327,15 +3709,10 @@
}
};
-var standardReleaser = function(instance) {
+var standardReleaser = function (instance) {
var Klass = this;
- ("production" !== "development" ? invariant(
- instance instanceof Klass,
- 'Trying to release an instance into a pool of a different type.'
- ) : invariant(instance instanceof Klass));
- if (instance.destructor) {
+ !(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
instance.destructor();
- }
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
@@ -4353,7 +3730,7 @@
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
-var addPoolingTo = function(CopyConstructor, pooler) {
+var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
@@ -4369,12 +3746,12 @@
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
+ fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
-
-},{"150":150}],31:[function(_dereq_,module,exports){
+},{"161":161}],26:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4386,145 +3763,36 @@
* @providesModule React
*/
-/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
-
'use strict';
-var EventPluginUtils = _dereq_(20);
-var ReactChildren = _dereq_(37);
-var ReactComponent = _dereq_(39);
-var ReactClass = _dereq_(38);
-var ReactContext = _dereq_(44);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
-var ReactDOM = _dereq_(46);
-var ReactDOMTextComponent = _dereq_(57);
-var ReactDefaultInjection = _dereq_(60);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMount = _dereq_(77);
-var ReactPerf = _dereq_(82);
-var ReactPropTypes = _dereq_(86);
-var ReactReconciler = _dereq_(89);
-var ReactServerRendering = _dereq_(92);
-
-var assign = _dereq_(29);
-var findDOMNode = _dereq_(132);
-var onlyChild = _dereq_(160);
-
-ReactDefaultInjection.inject();
-
-var createElement = ReactElement.createElement;
-var createFactory = ReactElement.createFactory;
-var cloneElement = ReactElement.cloneElement;
-
-if ("production" !== "development") {
- createElement = ReactElementValidator.createElement;
- createFactory = ReactElementValidator.createFactory;
- cloneElement = ReactElementValidator.cloneElement;
-}
-
-var render = ReactPerf.measure('React', 'render', ReactMount.render);
-
-var React = {
- Children: {
- map: ReactChildren.map,
- forEach: ReactChildren.forEach,
- count: ReactChildren.count,
- only: onlyChild
- },
- Component: ReactComponent,
- DOM: ReactDOM,
- PropTypes: ReactPropTypes,
- initializeTouchEvents: function(shouldUseTouch) {
- EventPluginUtils.useTouchEvents = shouldUseTouch;
- },
- createClass: ReactClass.createClass,
- createElement: createElement,
- cloneElement: cloneElement,
- createFactory: createFactory,
- createMixin: function(mixin) {
- // Currently a noop. Will be used to validate and trace mixins.
- return mixin;
- },
- constructAndRenderComponent: ReactMount.constructAndRenderComponent,
- constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
- findDOMNode: findDOMNode,
- render: render,
- renderToString: ReactServerRendering.renderToString,
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
- unmountComponentAtNode: ReactMount.unmountComponentAtNode,
- isValidElement: ReactElement.isValidElement,
- withContext: ReactContext.withContext,
-
- // Hook for JSX spread, don't use this for anything else.
- __spread: assign
-};
-
-// Inject the runtime into a devtools global hook regardless of browser.
-// Allows for debugging when the hook is injected on the page.
-if (
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
- __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
- CurrentOwner: ReactCurrentOwner,
- InstanceHandles: ReactInstanceHandles,
- Mount: ReactMount,
- Reconciler: ReactReconciler,
- TextComponent: ReactDOMTextComponent
- });
-}
-
-if ("production" !== "development") {
- var ExecutionEnvironment = _dereq_(22);
- if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
-
- // If we're in Chrome, look for the devtools marker and provide a download
- // link if not installed.
- if (navigator.userAgent.indexOf('Chrome') > -1) {
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
- console.debug(
- 'Download the React DevTools for a better development experience: ' +
- 'https://fb.me/react-devtools'
- );
- }
- }
-
- var expectedFeatures = [
- // shims
- Array.isArray,
- Array.prototype.every,
- Array.prototype.forEach,
- Array.prototype.indexOf,
- Array.prototype.map,
- Date.now,
- Function.prototype.bind,
- Object.keys,
- String.prototype.split,
- String.prototype.trim,
-
- // shams
- Object.create,
- Object.freeze
- ];
-
- for (var i = 0; i < expectedFeatures.length; i++) {
- if (!expectedFeatures[i]) {
- console.error(
- 'One or more ES5 shim/shams expected by React are not available: ' +
- 'https://fb.me/react-warning-polyfills'
- );
- break;
- }
- }
- }
-}
+var ReactDOM = _dereq_(40);
+var ReactDOMServer = _dereq_(50);
+var ReactIsomorphic = _dereq_(69);
+
+var assign = _dereq_(24);
+var deprecated = _dereq_(120);
+
+// `version` will be added here by ReactIsomorphic.
+var React = {};
+
+assign(React, ReactIsomorphic);
+
+assign(React, {
+ // ReactDOM
+ findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
+ render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
+ unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
+
+ // ReactDOMServer
+ renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
+ renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
+});
-React.version = '0.13.3';
+React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
+React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
module.exports = React;
-
-},{"132":132,"160":160,"20":20,"22":22,"29":29,"37":37,"38":38,"39":39,"44":44,"45":45,"46":46,"57":57,"60":60,"63":63,"64":64,"72":72,"77":77,"82":82,"86":86,"89":89,"92":92}],32:[function(_dereq_,module,exports){
+},{"120":120,"24":24,"40":40,"50":50,"69":69}],27:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4538,7 +3806,12 @@
'use strict';
-var findDOMNode = _dereq_(132);
+var ReactInstanceMap = _dereq_(68);
+
+var findDOMNode = _dereq_(122);
+var warning = _dereq_(173);
+
+var didWarnKey = '_getDOMNodeDidWarn';
var ReactBrowserComponentMixin = {
/**
@@ -4548,14 +3821,15 @@
* @final
* @protected
*/
- getDOMNode: function() {
+ getDOMNode: function () {
+ "development" !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
+ this.constructor[didWarnKey] = true;
return findDOMNode(this);
}
};
module.exports = ReactBrowserComponentMixin;
-
-},{"132":132}],33:[function(_dereq_,module,exports){
+},{"122":122,"173":173,"68":68}],28:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4570,14 +3844,15 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
-var EventPluginRegistry = _dereq_(19);
-var ReactEventEmitterMixin = _dereq_(67);
-var ViewportMetrics = _dereq_(117);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
+var EventPluginRegistry = _dereq_(17);
+var ReactEventEmitterMixin = _dereq_(62);
+var ReactPerf = _dereq_(78);
+var ViewportMetrics = _dereq_(114);
-var assign = _dereq_(29);
-var isEventSupported = _dereq_(151);
+var assign = _dereq_(24);
+var isEventSupported = _dereq_(133);
/**
* Summary of `ReactBrowserEventEmitter` event handling:
@@ -4642,7 +3917,10 @@
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
+ topAbort: 'abort',
topBlur: 'blur',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
@@ -4660,24 +3938,44 @@
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
topScroll: 'scroll',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
topTextInput: 'textInput',
+ topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting',
topWheel: 'wheel'
};
@@ -4717,10 +4015,8 @@
/**
* @param {object} ReactEventListener
*/
- injectReactEventListener: function(ReactEventListener) {
- ReactEventListener.setHandleTopLevel(
- ReactBrowserEventEmitter.handleTopLevel
- );
+ injectReactEventListener: function (ReactEventListener) {
+ ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
@@ -4730,7 +4026,7 @@
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
@@ -4739,10 +4035,8 @@
/**
* @return {boolean} True if callbacks are enabled.
*/
- isEnabled: function() {
- return !!(
- (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
- );
+ isEnabled: function () {
+ return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
@@ -4766,93 +4060,49 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
- listenTo: function(registrationName, contentDocumentHandle) {
+ listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
- var dependencies = EventPluginRegistry.
- registrationNameDependencies[registrationName];
+ var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
- for (var i = 0, l = dependencies.length; i < l; i++) {
+ for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
- if (!(
- (isListening.hasOwnProperty(dependency) && isListening[dependency])
- )) {
+ if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'wheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'mousewheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'DOMMouseScroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topScroll,
- 'scroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topScroll,
- 'scroll',
- ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
- } else if (dependency === topLevelTypes.topFocus ||
- dependency === topLevelTypes.topBlur) {
+ } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topFocus,
- 'focus',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topBlur,
- 'blur',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topFocus,
- 'focusin',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topBlur,
- 'focusout',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- dependency,
- topEventMapping[dependency],
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
@@ -4860,20 +4110,12 @@
}
},
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
@@ -4884,7 +4126,7 @@
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
- ensureScrollValueMonitoring: function() {
+ ensureScrollValueMonitoring: function () {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
@@ -4906,9 +4148,13 @@
});
-module.exports = ReactBrowserEventEmitter;
+ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
+ putListener: 'putListener',
+ deleteListener: 'deleteListener'
+});
-},{"117":117,"151":151,"16":16,"18":18,"19":19,"29":29,"67":67}],34:[function(_dereq_,module,exports){
+module.exports = ReactBrowserEventEmitter;
+},{"114":114,"133":133,"15":15,"16":16,"17":17,"24":24,"62":62,"78":78}],29:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4923,28 +4169,47 @@
'use strict';
-var React = _dereq_(31);
+var React = _dereq_(26);
-var assign = _dereq_(29);
+var assign = _dereq_(24);
-var ReactTransitionGroup = React.createFactory(
- _dereq_(98)
-);
-var ReactCSSTransitionGroupChild = React.createFactory(
- _dereq_(35)
-);
+var ReactTransitionGroup = _dereq_(94);
+var ReactCSSTransitionGroupChild = _dereq_(30);
+
+function createTransitionTimeoutPropValidator(transitionType) {
+ var timeoutPropName = 'transition' + transitionType + 'Timeout';
+ var enabledPropName = 'transition' + transitionType;
+
+ return function (props) {
+ // If the transition is enabled
+ if (props[enabledPropName]) {
+ // If no timeout duration is provided
+ if (props[timeoutPropName] == null) {
+ return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
+
+ // If the duration isn't a number
+ } else if (typeof props[timeoutPropName] !== 'number') {
+ return new Error(timeoutPropName + ' must be a number (in milliseconds)');
+ }
+ }
+ };
+}
var ReactCSSTransitionGroup = React.createClass({
displayName: 'ReactCSSTransitionGroup',
propTypes: {
- transitionName: React.PropTypes.string.isRequired,
+ transitionName: ReactCSSTransitionGroupChild.propTypes.name,
+
transitionAppear: React.PropTypes.bool,
transitionEnter: React.PropTypes.bool,
- transitionLeave: React.PropTypes.bool
+ transitionLeave: React.PropTypes.bool,
+ transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
+ transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
+ transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
},
- getDefaultProps: function() {
+ getDefaultProps: function () {
return {
transitionAppear: false,
transitionEnter: true,
@@ -4952,33 +4217,28 @@
};
},
- _wrapChild: function(child) {
+ _wrapChild: function (child) {
// We need to provide this childFactory so that
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
// leave while it is leaving.
- return ReactCSSTransitionGroupChild(
- {
+ return React.createElement(ReactCSSTransitionGroupChild, {
name: this.props.transitionName,
appear: this.props.transitionAppear,
enter: this.props.transitionEnter,
- leave: this.props.transitionLeave
- },
- child
- );
+ leave: this.props.transitionLeave,
+ appearTimeout: this.props.transitionAppearTimeout,
+ enterTimeout: this.props.transitionEnterTimeout,
+ leaveTimeout: this.props.transitionLeaveTimeout
+ }, child);
},
- render: function() {
- return (
- ReactTransitionGroup(
- assign({}, this.props, {childFactory: this._wrapChild})
- )
- );
+ render: function () {
+ return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
}
});
module.exports = ReactCSSTransitionGroup;
-
-},{"29":29,"31":31,"35":35,"98":98}],35:[function(_dereq_,module,exports){
+},{"24":24,"26":26,"30":30,"94":94}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -4993,53 +4253,68 @@
'use strict';
-var React = _dereq_(31);
+var React = _dereq_(26);
+var ReactDOM = _dereq_(40);
-var CSSCore = _dereq_(4);
-var ReactTransitionEvents = _dereq_(97);
+var CSSCore = _dereq_(145);
+var ReactTransitionEvents = _dereq_(93);
-var onlyChild = _dereq_(160);
-var warning = _dereq_(171);
+var onlyChild = _dereq_(135);
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
-var NO_EVENT_TIMEOUT = 5000;
-var noEventListener = null;
+var ReactCSSTransitionGroupChild = React.createClass({
+ displayName: 'ReactCSSTransitionGroupChild',
+ propTypes: {
+ name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
+ enter: React.PropTypes.string,
+ leave: React.PropTypes.string,
+ active: React.PropTypes.string
+ }), React.PropTypes.shape({
+ enter: React.PropTypes.string,
+ enterActive: React.PropTypes.string,
+ leave: React.PropTypes.string,
+ leaveActive: React.PropTypes.string,
+ appear: React.PropTypes.string,
+ appearActive: React.PropTypes.string
+ })]).isRequired,
+
+ // Once we require timeouts to be specified, we can remove the
+ // boolean flags (appear etc.) and just accept a number
+ // or a bool for the timeout flags (appearTimeout etc.)
+ appear: React.PropTypes.bool,
+ enter: React.PropTypes.bool,
+ leave: React.PropTypes.bool,
+ appearTimeout: React.PropTypes.number,
+ enterTimeout: React.PropTypes.number,
+ leaveTimeout: React.PropTypes.number
+ },
-if ("production" !== "development") {
- noEventListener = function() {
- ("production" !== "development" ? warning(
- false,
- 'transition(): tried to perform an animation without ' +
- 'an animationend or transitionend event after timeout (' +
- '%sms). You should either disable this ' +
- 'transition in JS or add a CSS animation/transition.',
- NO_EVENT_TIMEOUT
- ) : null);
- };
-}
+ transition: function (animationType, finishCallback, userSpecifiedDelay) {
+ var node = ReactDOM.findDOMNode(this);
-var ReactCSSTransitionGroupChild = React.createClass({
- displayName: 'ReactCSSTransitionGroupChild',
+ if (!node) {
+ if (finishCallback) {
+ finishCallback();
+ }
+ return;
+ }
- transition: function(animationType, finishCallback) {
- var node = this.getDOMNode();
- var className = this.props.name + '-' + animationType;
- var activeClassName = className + '-active';
- var noEventTimeout = null;
+ var className = this.props.name[animationType] || this.props.name + '-' + animationType;
+ var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
+ var timeout = null;
- var endListener = function(e) {
+ var endListener = function (e) {
if (e && e.target !== node) {
return;
}
- if ("production" !== "development") {
- clearTimeout(noEventTimeout);
- }
+
+ clearTimeout(timeout);
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
@@ -5053,19 +4328,23 @@
}
};
- ReactTransitionEvents.addEndEventListener(node, endListener);
-
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
- if ("production" !== "development") {
- noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
+ // If the user specified a timeout delay.
+ if (userSpecifiedDelay) {
+ // Clean-up the animation after the specified delay
+ timeout = setTimeout(endListener, userSpecifiedDelay);
+ this.transitionTimeouts.push(timeout);
+ } else {
+ // DEPRECATED: this listener will be removed in a future version of react
+ ReactTransitionEvents.addEndEventListener(node, endListener);
}
},
- queueClass: function(className) {
+ queueClass: function (className) {
this.classNameQueue.push(className);
if (!this.timeout) {
@@ -5073,58 +4352,59 @@
}
},
- flushClassNameQueue: function() {
+ flushClassNameQueue: function () {
if (this.isMounted()) {
- this.classNameQueue.forEach(
- CSSCore.addClass.bind(CSSCore, this.getDOMNode())
- );
+ this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
}
this.classNameQueue.length = 0;
this.timeout = null;
},
- componentWillMount: function() {
+ componentWillMount: function () {
this.classNameQueue = [];
+ this.transitionTimeouts = [];
},
- componentWillUnmount: function() {
+ componentWillUnmount: function () {
if (this.timeout) {
clearTimeout(this.timeout);
}
+ this.transitionTimeouts.forEach(function (timeout) {
+ clearTimeout(timeout);
+ });
},
- componentWillAppear: function(done) {
+ componentWillAppear: function (done) {
if (this.props.appear) {
- this.transition('appear', done);
+ this.transition('appear', done, this.props.appearTimeout);
} else {
done();
}
},
- componentWillEnter: function(done) {
+ componentWillEnter: function (done) {
if (this.props.enter) {
- this.transition('enter', done);
+ this.transition('enter', done, this.props.enterTimeout);
} else {
done();
}
},
- componentWillLeave: function(done) {
+ componentWillLeave: function (done) {
if (this.props.leave) {
- this.transition('leave', done);
+ this.transition('leave', done, this.props.leaveTimeout);
} else {
done();
}
},
- render: function() {
+ render: function () {
return onlyChild(this.props.children);
}
});
module.exports = ReactCSSTransitionGroupChild;
-
-},{"160":160,"171":171,"31":31,"4":4,"97":97}],36:[function(_dereq_,module,exports){
+},{"135":135,"145":145,"26":26,"40":40,"93":93}],31:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -5139,11 +4419,23 @@
'use strict';
-var ReactReconciler = _dereq_(89);
+var ReactReconciler = _dereq_(84);
-var flattenChildren = _dereq_(133);
-var instantiateReactComponent = _dereq_(149);
-var shouldUpdateReactComponent = _dereq_(167);
+var instantiateReactComponent = _dereq_(132);
+var shouldUpdateReactComponent = _dereq_(141);
+var traverseAllChildren = _dereq_(142);
+var warning = _dereq_(173);
+
+function instantiateChild(childInstances, child, name) {
+ // We found a component instance.
+ var keyUnique = childInstances[name] === undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
+ }
+ if (child != null && keyUnique) {
+ childInstances[name] = instantiateReactComponent(child, null);
+ }
+}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
@@ -5160,41 +4451,31 @@
* @return {?object} A set of child instances.
* @internal
*/
- instantiateChildren: function(nestedChildNodes, transaction, context) {
- var children = flattenChildren(nestedChildNodes);
- for (var name in children) {
- if (children.hasOwnProperty(name)) {
- var child = children[name];
- // The rendered children must be turned into instances as they're
- // mounted.
- var childInstance = instantiateReactComponent(child, null);
- children[name] = childInstance;
- }
+ instantiateChildren: function (nestedChildNodes, transaction, context) {
+ if (nestedChildNodes == null) {
+ return null;
}
- return children;
+ var childInstances = {};
+ traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
+ return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
- * @param {?object} nextNestedChildNodes Nested child maps.
+ * @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
- updateChildren: function(
- prevChildren,
- nextNestedChildNodes,
- transaction,
- context) {
+ updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
- var nextChildren = flattenChildren(nextNestedChildNodes);
if (!nextChildren && !prevChildren) {
return null;
}
@@ -5206,27 +4487,21 @@
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
- if (shouldUpdateReactComponent(prevElement, nextElement)) {
- ReactReconciler.receiveComponent(
- prevChild, nextElement, transaction, context
- );
+ if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
+ ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
- var nextChildInstance = instantiateReactComponent(
- nextElement,
- null
- );
+ var nextChildInstance = instantiateReactComponent(nextElement, null);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
@@ -5240,18 +4515,19 @@
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
- unmountChildren: function(renderedChildren) {
+ unmountChildren: function (renderedChildren) {
for (var name in renderedChildren) {
+ if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
+ }
};
module.exports = ReactChildReconciler;
-
-},{"133":133,"149":149,"167":167,"89":89}],37:[function(_dereq_,module,exports){
+},{"132":132,"141":141,"142":142,"173":173,"84":84}],32:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -5265,14 +4541,19 @@
'use strict';
-var PooledClass = _dereq_(30);
-var ReactFragment = _dereq_(69);
+var PooledClass = _dereq_(25);
+var ReactElement = _dereq_(57);
-var traverseAllChildren = _dereq_(169);
-var warning = _dereq_(171);
+var emptyFunction = _dereq_(153);
+var traverseAllChildren = _dereq_(142);
var twoArgumentPooler = PooledClass.twoArgumentPooler;
-var threeArgumentPooler = PooledClass.threeArgumentPooler;
+var fourArgumentPooler = PooledClass.fourArgumentPooler;
+
+var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
+function escapeUserProvidedKey(text) {
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
+}
/**
* PooledClass representing the bookkeeping associated with performing a child
@@ -5283,15 +4564,22 @@
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
- this.forEachFunction = forEachFunction;
- this.forEachContext = forEachContext;
-}
+ this.func = forEachFunction;
+ this.context = forEachContext;
+ this.count = 0;
+}
+ForEachBookKeeping.prototype.destructor = function () {
+ this.func = null;
+ this.context = null;
+ this.count = 0;
+};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
-function forEachSingleChild(traverseContext, child, name, i) {
- var forEachBookKeeping = traverseContext;
- forEachBookKeeping.forEachFunction.call(
- forEachBookKeeping.forEachContext, child, i);
+function forEachSingleChild(bookKeeping, child, name) {
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ func.call(context, child, bookKeeping.count++);
}
/**
@@ -5301,16 +4589,14 @@
* leaf child.
*
* @param {?*} children Children tree container.
- * @param {function(*, int)} forEachFunc.
+ * @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
-
- var traverseContext =
- ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
+ var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
@@ -5324,62 +4610,73 @@
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
-function MapBookKeeping(mapResult, mapFunction, mapContext) {
- this.mapResult = mapResult;
- this.mapFunction = mapFunction;
- this.mapContext = mapContext;
-}
-PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
-
-function mapSingleChildIntoContext(traverseContext, child, name, i) {
- var mapBookKeeping = traverseContext;
- var mapResult = mapBookKeeping.mapResult;
-
- var keyUnique = !mapResult.hasOwnProperty(name);
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- keyUnique,
- 'ReactChildren.map(...): Encountered two children with the same key, ' +
- '`%s`. Child keys must be unique; when two children share a key, only ' +
- 'the first child will be used.',
- name
- ) : null);
- }
-
- if (keyUnique) {
- var mappedChild =
- mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
- mapResult[name] = mappedChild;
+function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
+ this.result = mapResult;
+ this.keyPrefix = keyPrefix;
+ this.func = mapFunction;
+ this.context = mapContext;
+ this.count = 0;
+}
+MapBookKeeping.prototype.destructor = function () {
+ this.result = null;
+ this.keyPrefix = null;
+ this.func = null;
+ this.context = null;
+ this.count = 0;
+};
+PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
+
+function mapSingleChildIntoContext(bookKeeping, child, childKey) {
+ var result = bookKeeping.result;
+ var keyPrefix = bookKeeping.keyPrefix;
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ var mappedChild = func.call(context, child, bookKeeping.count++);
+ if (Array.isArray(mappedChild)) {
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
+ } else if (mappedChild != null) {
+ if (ReactElement.isValidElement(mappedChild)) {
+ mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
+ // Keep both the (mapped) and old keys if they differ, just as
+ // traverseAllChildren used to do for objects as children
+ keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
+ }
+ result.push(mappedChild);
}
}
+function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
+ var escapedPrefix = '';
+ if (prefix != null) {
+ escapedPrefix = escapeUserProvidedKey(prefix) + '/';
+ }
+ var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
+ traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
+ MapBookKeeping.release(traverseContext);
+}
+
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
- * TODO: This may likely break any calls to `ReactChildren.map` that were
- * previously relying on the fact that we guarded against null children.
- *
* @param {?*} children Children tree container.
- * @param {function(*, int)} mapFunction.
- * @param {*} mapContext Context for mapFunction.
+ * @param {function(*, int)} func The map function.
+ * @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
-
- var mapResult = {};
- var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
- MapBookKeeping.release(traverseContext);
- return ReactFragment.create(mapResult);
+ var result = [];
+ mapIntoWithKeyPrefixInternal(children, result, null, func, context);
+ return result;
}
-function forEachSingleChildDummy(traverseContext, child, name, i) {
+function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
@@ -5394,15 +4691,26 @@
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
+/**
+ * Flatten a children object (typically specified as `props.children`) and
+ * return an array with appropriately re-keyed children.
+ */
+function toArray(children) {
+ var result = [];
+ mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
+ return result;
+}
+
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
- count: countChildren
+ mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
+ count: countChildren,
+ toArray: toArray
};
module.exports = ReactChildren;
-
-},{"169":169,"171":171,"30":30,"69":69}],38:[function(_dereq_,module,exports){
+},{"142":142,"153":153,"25":25,"57":57}],33:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -5416,23 +4724,20 @@
'use strict';
-var ReactComponent = _dereq_(39);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactErrorUtils = _dereq_(66);
-var ReactInstanceMap = _dereq_(73);
-var ReactLifeCycle = _dereq_(74);
-var ReactPropTypeLocations = _dereq_(85);
-var ReactPropTypeLocationNames = _dereq_(84);
-var ReactUpdateQueue = _dereq_(99);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var keyMirror = _dereq_(156);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var ReactComponent = _dereq_(34);
+var ReactElement = _dereq_(57);
+var ReactPropTypeLocations = _dereq_(81);
+var ReactPropTypeLocationNames = _dereq_(80);
+var ReactNoopUpdateQueue = _dereq_(76);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var invariant = _dereq_(161);
+var keyMirror = _dereq_(165);
+var keyOf = _dereq_(166);
+var warning = _dereq_(173);
-var MIXINS_KEY = keyOf({mixins: null});
+var MIXINS_KEY = keyOf({ mixins: null });
/**
* Policies that describe methods in `ReactClassInterface`.
@@ -5459,9 +4764,16 @@
DEFINE_MANY_MERGED: null
});
-
var injectedMixins = [];
+var warnedSetProps = false;
+function warnSetProps() {
+ if (!warnedSetProps) {
+ warnedSetProps = true;
+ "development" !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
+ }
+}
+
/**
* Composite components are higher-level components that compose other composite
* or native components.
@@ -5479,7 +4791,7 @@
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
- * class specification will available on the prototype.
+ * class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
@@ -5721,121 +5029,72 @@
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
- displayName: function(Constructor, displayName) {
+ displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
- mixins: function(Constructor, mixins) {
+ mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
- childContextTypes: function(Constructor, childContextTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- childContextTypes,
- ReactPropTypeLocations.childContext
- );
+ childContextTypes: function (Constructor, childContextTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
}
- Constructor.childContextTypes = assign(
- {},
- Constructor.childContextTypes,
- childContextTypes
- );
+ Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
},
- contextTypes: function(Constructor, contextTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- contextTypes,
- ReactPropTypeLocations.context
- );
+ contextTypes: function (Constructor, contextTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
}
- Constructor.contextTypes = assign(
- {},
- Constructor.contextTypes,
- contextTypes
- );
+ Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
- getDefaultProps: function(Constructor, getDefaultProps) {
+ getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
- Constructor.getDefaultProps = createMergedResultFunction(
- Constructor.getDefaultProps,
- getDefaultProps
- );
+ Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
- propTypes: function(Constructor, propTypes) {
- if ("production" !== "development") {
- validateTypeDef(
- Constructor,
- propTypes,
- ReactPropTypeLocations.prop
- );
+ propTypes: function (Constructor, propTypes) {
+ if ("development" !== 'production') {
+ validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
}
- Constructor.propTypes = assign(
- {},
- Constructor.propTypes,
- propTypes
- );
+ Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
},
- statics: function(Constructor, statics) {
+ statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
- }
-};
+ },
+ autobind: function () {} };
+// noop
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but not in __DEV__
- ("production" !== "development" ? warning(
- typeof typeDef[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- Constructor.displayName || 'ReactClass',
- ReactPropTypeLocationNames[location],
- propName
- ) : null);
+ "development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
}
}
}
function validateMethodOverride(proto, name) {
- var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
- ReactClassInterface[name] :
- null;
+ var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
- ("production" !== "development" ? invariant(
- specPolicy === SpecPolicy.OVERRIDE_BASE,
- 'ReactClassInterface: You are attempting to override ' +
- '`%s` from your class specification. Ensure that your method names ' +
- 'do not overlap with React methods.',
- name
- ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
+ !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
- ("production" !== "development" ? invariant(
- specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
- 'ReactClassInterface: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be due ' +
- 'to a mixin.',
- name
- ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
+ !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
}
}
@@ -5848,16 +5107,8 @@
return;
}
- ("production" !== "development" ? invariant(
- typeof spec !== 'function',
- 'ReactClass: You\'re attempting to ' +
- 'use a component class as a mixin. Instead, just use a regular object.'
- ) : invariant(typeof spec !== 'function'));
- ("production" !== "development" ? invariant(
- !ReactElement.isValidElement(spec),
- 'ReactClass: You\'re attempting to ' +
- 'use a component as a mixin. Instead, just use a regular object.'
- ) : invariant(!ReactElement.isValidElement(spec)));
+ !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
+ !!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
var proto = Constructor.prototype;
@@ -5874,7 +5125,7 @@
}
if (name === MIXINS_KEY) {
- // We have already handled mixins in a special case above
+ // We have already handled mixins in a special case above.
continue;
}
@@ -5888,16 +5139,10 @@
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
- var isReactClassMethod =
- ReactClassInterface.hasOwnProperty(name);
+ var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
- var markedDontBind = property && property.__reactDontBind;
var isFunction = typeof property === 'function';
- var shouldAutoBind =
- isFunction &&
- !isReactClassMethod &&
- !isAlreadyDefined &&
- !markedDontBind;
+ var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
@@ -5909,18 +5154,8 @@
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
- // These cases should already be caught by validateMethodOverride
- ("production" !== "development" ? invariant(
- isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- ),
- 'ReactClass: Unexpected spec policy %s for key %s ' +
- 'when mixing in component specs.',
- specPolicy,
- name
- ) : invariant(isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- )));
+ // These cases should already be caught by validateMethodOverride.
+ !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
@@ -5931,7 +5166,7 @@
}
} else {
proto[name] = property;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
@@ -5954,24 +5189,11 @@
continue;
}
- var isReserved = name in RESERVED_SPEC_KEYS;
- ("production" !== "development" ? invariant(
- !isReserved,
- 'ReactClass: You are attempting to define a reserved ' +
- 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
- 'as an instance property instead; it will still be accessible on the ' +
- 'constructor.',
- name
- ) : invariant(!isReserved));
-
- var isInherited = name in Constructor;
- ("production" !== "development" ? invariant(
- !isInherited,
- 'ReactClass: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be ' +
- 'due to a mixin.',
- name
- ) : invariant(!isInherited));
+ var isReserved = (name in RESERVED_SPEC_KEYS);
+ !!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
+
+ var isInherited = (name in Constructor);
+ !!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
Constructor[name] = property;
}
}
@@ -5984,22 +5206,11 @@
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
- ("production" !== "development" ? invariant(
- one && two && typeof one === 'object' && typeof two === 'object',
- 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
- ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
for (var key in two) {
if (two.hasOwnProperty(key)) {
- ("production" !== "development" ? invariant(
- one[key] === undefined,
- 'mergeIntoWithNoDuplicateKeys(): ' +
- 'Tried to merge two objects with the same key: `%s`. This conflict ' +
- 'may be due to a mixin; in particular, this may be caused by two ' +
- 'getInitialState() or getDefaultProps() methods returning objects ' +
- 'with clashing keys.',
- key
- ) : invariant(one[key] === undefined));
+ !(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
one[key] = two[key];
}
}
@@ -6054,32 +5265,25 @@
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
- boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ boundMethod.bind = function (newThis) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
- ("production" !== "development" ? warning(
- false,
- 'bind(): React component methods may only be bound to the ' +
- 'component instance. See %s',
- componentName
- ) : null);
+ "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
} else if (!args.length) {
- ("production" !== "development" ? warning(
- false,
- 'bind(): You are binding a component method to the component. ' +
- 'React does this for you automatically in a high-performance ' +
- 'way, so you can safely remove this call. See %s',
- componentName
- ) : null);
+ "development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -6102,34 +5306,11 @@
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
- component[autoBindKey] = bindAutoBindMethod(
- component,
- ReactErrorUtils.guard(
- method,
- component.constructor.displayName + '.' + autoBindKey
- )
- );
+ component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
}
-var typeDeprecationDescriptor = {
- enumerable: false,
- get: function() {
- var displayName = this.displayName || this.name || 'Component';
- ("production" !== "development" ? warning(
- false,
- '%s.type is deprecated. Use %s directly to access the class.',
- displayName,
- displayName
- ) : null);
- Object.defineProperty(this, 'type', {
- value: this
- });
- return this;
- }
-};
-
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
@@ -6140,10 +5321,10 @@
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
- replaceState: function(newState, callback) {
- ReactUpdateQueue.enqueueReplaceState(this, newState);
+ replaceState: function (newState, callback) {
+ this.updater.enqueueReplaceState(this, newState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -6153,27 +5334,8 @@
* @protected
* @final
*/
- isMounted: function() {
- if ("production" !== "development") {
- var owner = ReactCurrentOwner.current;
- if (owner !== null) {
- ("production" !== "development" ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing isMounted inside its render() function. ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
- owner._warnedAboutRefsInRender = true;
- }
- }
- var internalInstance = ReactInstanceMap.get(this);
- return (
- internalInstance &&
- internalInstance !== ReactLifeCycle.currentlyMountingInstance
- );
+ isMounted: function () {
+ return this.updater.isMounted(this);
},
/**
@@ -6185,10 +5347,13 @@
* @public
* @deprecated
*/
- setProps: function(partialProps, callback) {
- ReactUpdateQueue.enqueueSetProps(this, partialProps);
+ setProps: function (partialProps, callback) {
+ if ("development" !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueSetProps(this, partialProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -6201,20 +5366,19 @@
* @public
* @deprecated
*/
- replaceProps: function(newProps, callback) {
- ReactUpdateQueue.enqueueReplaceProps(this, newProps);
+ replaceProps: function (newProps, callback) {
+ if ("development" !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueReplaceProps(this, newProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
}
};
-var ReactClassComponent = function() {};
-assign(
- ReactClassComponent.prototype,
- ReactComponent.prototype,
- ReactClassMixin
-);
+var ReactClassComponent = function () {};
+assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
@@ -6230,17 +5394,13 @@
* @return {function} Component constructor function.
* @public
*/
- createClass: function(spec) {
- var Constructor = function(props, context) {
+ createClass: function (spec) {
+ var Constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- this instanceof Constructor,
- 'Something is calling a React component directly. Use a factory or ' +
- 'JSX instead. See: https://fb.me/react-legacyfactory'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
@@ -6250,44 +5410,40 @@
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ this.updater = updater || ReactNoopUpdateQueue;
+
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof initialState === 'undefined' &&
- this.getInitialState._isMockFunction) {
+ if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
- ("production" !== "development" ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.getInitialState(): must return an object or null',
- Constructor.displayName || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
- injectedMixins.forEach(
- mixSpecIntoComponent.bind(null, Constructor)
- );
+ injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
- // Initialize the defaultProps property after all mixins have been merged
+ // Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
@@ -6300,20 +5456,11 @@
}
}
- ("production" !== "development" ? invariant(
- Constructor.prototype.render,
- 'createClass(...): Class specification must implement a `render` method.'
- ) : invariant(Constructor.prototype.render));
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- !Constructor.prototype.componentShouldUpdate,
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- spec.displayName || 'A component'
- ) : null);
+ !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
+ "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
}
// Reduce time spent doing lookups by setting these on the prototype.
@@ -6323,21 +5470,11 @@
}
}
- // Legacy hook
- Constructor.type = Constructor;
- if ("production" !== "development") {
- try {
- Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
- }
- }
-
return Constructor;
},
injection: {
- injectMixin: function(mixin) {
+ injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}
@@ -6345,8 +5482,7 @@
};
module.exports = ReactClass;
-
-},{"150":150,"156":156,"157":157,"171":171,"29":29,"39":39,"45":45,"63":63,"66":66,"73":73,"74":74,"84":84,"85":85,"99":99}],39:[function(_dereq_,module,exports){
+},{"154":154,"161":161,"165":165,"166":166,"173":173,"24":24,"34":34,"57":57,"76":76,"80":80,"81":81}],34:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6360,19 +5496,27 @@
'use strict';
-var ReactUpdateQueue = _dereq_(99);
+var ReactNoopUpdateQueue = _dereq_(76);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var canDefineProperty = _dereq_(117);
+var emptyObject = _dereq_(154);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Base class helpers for the updating state of a component.
*/
-function ReactComponent(props, context) {
+function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ // We initialize the default updater but the real one gets injected by the
+ // renderer.
+ this.updater = updater || ReactNoopUpdateQueue;
}
+ReactComponent.prototype.isReactComponent = {};
+
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
@@ -6398,26 +5542,14 @@
* @final
* @protected
*/
-ReactComponent.prototype.setState = function(partialState, callback) {
- ("production" !== "development" ? invariant(
- typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null,
- 'setState(...): takes an object of state variables to update or a ' +
- 'function which returns an object of state variables.'
- ) : invariant(typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null));
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- partialState != null,
- 'setState(...): You passed an undefined or null state object; ' +
- 'instead, use forceUpdate().'
- ) : null);
+ReactComponent.prototype.setState = function (partialState, callback) {
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
}
- ReactUpdateQueue.enqueueSetState(this, partialState);
+ this.updater.enqueueSetState(this, partialState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -6435,10 +5567,10 @@
* @final
* @protected
*/
-ReactComponent.prototype.forceUpdate = function(callback) {
- ReactUpdateQueue.enqueueForceUpdate(this);
+ReactComponent.prototype.forceUpdate = function (callback) {
+ this.updater.enqueueForceUpdate(this);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -6447,46 +5579,22 @@
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
-if ("production" !== "development") {
+if ("development" !== 'production') {
var deprecatedAPIs = {
- getDOMNode: [
- 'getDOMNode',
- 'Use React.findDOMNode(component) instead.'
- ],
- isMounted: [
- 'isMounted',
- 'Instead, make sure to clean up subscriptions and pending requests in ' +
- 'componentWillUnmount to prevent memory leaks.'
- ],
- replaceProps: [
- 'replaceProps',
- 'Instead call React.render again at the top level.'
- ],
- replaceState: [
- 'replaceState',
- 'Refactor your code to use setState instead (see ' +
- 'https://github.com/facebook/react/issues/3236).'
- ],
- setProps: [
- 'setProps',
- 'Instead call React.render again at the top level.'
- ]
+ getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
+ replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
+ setProps: ['setProps', 'Instead, call render again at the top level.']
};
- var defineDeprecationWarning = function(methodName, info) {
- try {
+ var defineDeprecationWarning = function (methodName, info) {
+ if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
- get: function() {
- ("production" !== "development" ? warning(
- false,
- '%s(...) is deprecated in plain JavaScript React classes. %s',
- info[0],
- info[1]
- ) : null);
+ get: function () {
+ "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
return undefined;
}
});
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
}
};
for (var fnName in deprecatedAPIs) {
@@ -6497,8 +5605,7 @@
}
module.exports = ReactComponent;
-
-},{"150":150,"171":171,"99":99}],40:[function(_dereq_,module,exports){
+},{"117":117,"154":154,"161":161,"173":173,"76":76}],35:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6510,12 +5617,10 @@
* @providesModule ReactComponentBrowserEnvironment
*/
-/*jslint evil: true */
-
'use strict';
-var ReactDOMIDOperations = _dereq_(50);
-var ReactMount = _dereq_(77);
+var ReactDOMIDOperations = _dereq_(45);
+var ReactMount = _dereq_(72);
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
@@ -6524,11 +5629,9 @@
*/
var ReactComponentBrowserEnvironment = {
- processChildrenUpdates:
- ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
+ processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
- replaceNodeWithMarkupByID:
- ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
+ replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
@@ -6537,15 +5640,14 @@
*
* @private
*/
- unmountIDFromEnvironment: function(rootNodeID) {
+ unmountIDFromEnvironment: function (rootNodeID) {
ReactMount.purgeID(rootNodeID);
}
};
module.exports = ReactComponentBrowserEnvironment;
-
-},{"50":50,"77":77}],41:[function(_dereq_,module,exports){
+},{"45":45,"72":72}],36:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -6559,7 +5661,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
var injected = false;
@@ -6585,17 +5687,11 @@
processChildrenUpdates: null,
injection: {
- injectEnvironment: function(environment) {
- ("production" !== "development" ? invariant(
- !injected,
- 'ReactCompositeComponent: injectEnvironment() can only be called once.'
- ) : invariant(!injected));
- ReactComponentEnvironment.unmountIDFromEnvironment =
- environment.unmountIDFromEnvironment;
- ReactComponentEnvironment.replaceNodeWithMarkupByID =
- environment.replaceNodeWithMarkupByID;
- ReactComponentEnvironment.processChildrenUpdates =
- environment.processChildrenUpdates;
+ injectEnvironment: function (environment) {
+ !!injected ? "development" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
+ ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
+ ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
+ ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}
@@ -6603,8 +5699,7 @@
};
module.exports = ReactComponentEnvironment;
-
-},{"150":150}],42:[function(_dereq_,module,exports){
+},{"161":161}],37:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6613,12 +5708,12 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
-* @providesModule ReactComponentWithPureRenderMixin
-*/
+ * @providesModule ReactComponentWithPureRenderMixin
+ */
'use strict';
-var shallowEqual = _dereq_(166);
+var shallowCompare = _dereq_(140);
/**
* If your React component's render function is "pure", e.g. it will render the
@@ -6645,15 +5740,13 @@
* use `forceUpdate()` when you know deep data structures have changed.
*/
var ReactComponentWithPureRenderMixin = {
- shouldComponentUpdate: function(nextProps, nextState) {
- return !shallowEqual(this.props, nextProps) ||
- !shallowEqual(this.state, nextState);
+ shouldComponentUpdate: function (nextProps, nextState) {
+ return shallowCompare(this, nextProps, nextState);
}
};
module.exports = ReactComponentWithPureRenderMixin;
-
-},{"166":166}],43:[function(_dereq_,module,exports){
+},{"140":140}],38:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -6667,25 +5760,21 @@
'use strict';
-var ReactComponentEnvironment = _dereq_(41);
-var ReactContext = _dereq_(44);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
-var ReactInstanceMap = _dereq_(73);
-var ReactLifeCycle = _dereq_(74);
-var ReactNativeComponent = _dereq_(80);
-var ReactPerf = _dereq_(82);
-var ReactPropTypeLocations = _dereq_(85);
-var ReactPropTypeLocationNames = _dereq_(84);
-var ReactReconciler = _dereq_(89);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var emptyObject = _dereq_(130);
-var invariant = _dereq_(150);
-var shouldUpdateReactComponent = _dereq_(167);
-var warning = _dereq_(171);
+var ReactComponentEnvironment = _dereq_(36);
+var ReactCurrentOwner = _dereq_(39);
+var ReactElement = _dereq_(57);
+var ReactInstanceMap = _dereq_(68);
+var ReactPerf = _dereq_(78);
+var ReactPropTypeLocations = _dereq_(81);
+var ReactPropTypeLocationNames = _dereq_(80);
+var ReactReconciler = _dereq_(84);
+var ReactUpdateQueue = _dereq_(95);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var invariant = _dereq_(161);
+var shouldUpdateReactComponent = _dereq_(141);
+var warning = _dereq_(173);
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
@@ -6698,6 +5787,12 @@
return '';
}
+function StatelessComponent(Component) {}
+StatelessComponent.prototype.render = function () {
+ var Component = ReactInstanceMap.get(this)._currentElement.type;
+ return Component(this.props, this.context, this.updater);
+};
+
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
@@ -6745,7 +5840,7 @@
* @final
* @internal
*/
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
@@ -6760,7 +5855,7 @@
this._context = null;
this._mountOrder = 0;
- this._isTopLevel = false;
+ this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
@@ -6775,32 +5870,54 @@
* @final
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
- var publicContext = this._processContext(this._currentElement._context);
+ var publicContext = this._processContext(context);
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ var Component = this._currentElement.type;
// Initialize the public class
- var inst = new Component(publicProps, publicContext);
+ var inst;
+ var renderedElement;
+
+ // This is a way to detect if Component is a stateless arrow function
+ // component, which is not newable. It might not be 100% reliable but is
+ // something we can do until we start detecting that Component extends
+ // React.Component. We already assume that typeof Component === 'function'.
+ var canInstantiate = ('prototype' in Component);
- if ("production" !== "development") {
+ if (canInstantiate) {
+ if ("development" !== 'production') {
+ ReactCurrentOwner.current = this;
+ try {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ } else {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ }
+ }
+
+ if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
+ renderedElement = inst;
+ inst = new StatelessComponent(Component);
+ }
+
+ if ("development" !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
- ("production" !== "development" ? warning(
- inst.render != null,
- '%s(...): No `render` method found on the returned component ' +
- 'instance: you may have forgotten to define `render` in your ' +
- 'component or you may have accidentally tried to render an element ' +
- 'whose type is a function that isn\'t a React component.',
- Component.displayName || Component.name || 'Component'
- ) : null);
+ if (inst.render == null) {
+ "development" !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
+ } else {
+ // We support ES6 inheriting from React.Component, the module pattern,
+ // and stateless components, but not ES6 classes that don't extend
+ "development" !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
+ }
}
// These should be set up in the constructor, but as a convenience for
@@ -6808,78 +5925,36 @@
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
+ inst.updater = ReactUpdateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
- if ("production" !== "development") {
- this._warnIfContextsDiffer(this._currentElement._context, context);
- }
-
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
- ("production" !== "development" ? warning(
- !inst.getInitialState ||
- inst.getInitialState.isReactClassApproved,
- 'getInitialState was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Did you mean to define a state property instead?',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.getDefaultProps ||
- inst.getDefaultProps.isReactClassApproved,
- 'getDefaultProps was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Use a static property to define defaultProps instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.propTypes,
- 'propTypes was defined as an instance property on %s. Use a static ' +
- 'property to define propTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- !inst.contextTypes,
- 'contextTypes was defined as an instance property on %s. Use a ' +
- 'static property to define contextTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== "development" ? warning(
- typeof inst.componentShouldUpdate !== 'function',
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- (this.getName() || 'A component')
- ) : null);
+ "development" !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
+ "development" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
- ("production" !== "development" ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.state: must be set to an object or null',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
- var childContext;
- var renderedElement;
-
- var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
- ReactLifeCycle.currentlyMountingInstance = this;
- try {
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
@@ -6889,23 +5964,14 @@
}
}
- childContext = this._getValidatedChildContext(context);
- renderedElement = this._renderValidatedComponent(childContext);
- } finally {
- ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
+ // If not a stateless component, we now render
+ if (renderedElement === undefined) {
+ renderedElement = this._renderValidatedComponent();
}
- this._renderedComponent = this._instantiateReactComponent(
- renderedElement,
- this._currentElement.type // The wrapping type
- );
+ this._renderedComponent = this._instantiateReactComponent(renderedElement);
- var markup = ReactReconciler.mountComponent(
- this._renderedComponent,
- rootID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
@@ -6919,23 +5985,20 @@
* @final
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
var inst = this._instance;
if (inst.componentWillUnmount) {
- var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
- ReactLifeCycle.currentlyUnmountingInstance = this;
- try {
inst.componentWillUnmount();
- } finally {
- ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
- }
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
+ this._instance = null;
// Reset pending fields
+ // Even if this component is scheduled for another update in ReactUpdates,
+ // it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
@@ -6946,6 +6009,7 @@
// longer accessible.
this._context = null;
this._rootNodeID = null;
+ this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
@@ -6960,25 +6024,6 @@
},
/**
- * Schedule a partial update to the props. Only used for internal testing.
- *
- * @param {object} partialProps Subset of the next props.
- * @param {?function} callback Called after props are updated.
- * @final
- * @internal
- */
- _setPropsInternal: function(partialProps, callback) {
- // This is a deoptimized path. We optimize for always having an element.
- // This creates an extra internal element.
- var element = this._pendingElement || this._currentElement;
- this._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- assign({}, element.props, partialProps)
- );
- ReactUpdates.enqueueUpdate(this, callback);
- },
-
- /**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
@@ -6986,14 +6031,10 @@
* @return {?object}
* @private
*/
- _maskContext: function(context) {
+ _maskContext: function (context) {
var maskedContext = null;
- // This really should be getting the component class for the element,
- // but we know that we're not going to need it for built-ins.
- if (typeof this._currentElement.type === 'string') {
- return emptyObject;
- }
- var contextTypes = this._currentElement.type.contextTypes;
+ var Component = this._currentElement.type;
+ var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
@@ -7012,18 +6053,12 @@
* @return {?object}
* @private
*/
- _processContext: function(context) {
+ _processContext: function (context) {
var maskedContext = this._maskContext(context);
- if ("production" !== "development") {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ if ("development" !== 'production') {
+ var Component = this._currentElement.type;
if (Component.contextTypes) {
- this._checkPropTypes(
- Component.contextTypes,
- maskedContext,
- ReactPropTypeLocations.context
- );
+ this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
}
}
return maskedContext;
@@ -7034,38 +6069,18 @@
* @return {object}
* @private
*/
- _getValidatedChildContext: function(currentContext) {
+ _processChildContext: function (currentContext) {
+ var Component = this._currentElement.type;
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
- ("production" !== "development" ? invariant(
- typeof inst.constructor.childContextTypes === 'object',
- '%s.getChildContext(): childContextTypes must be defined in order to ' +
- 'use getChildContext().',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
- if ("production" !== "development") {
- this._checkPropTypes(
- inst.constructor.childContextTypes,
- childContext,
- ReactPropTypeLocations.childContext
- );
+ !(typeof Component.childContextTypes === 'object') ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
+ if ("development" !== 'production') {
+ this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
- ("production" !== "development" ? invariant(
- name in inst.constructor.childContextTypes,
- '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
- this.getName() || 'ReactCompositeComponent',
- name
- ) : invariant(name in inst.constructor.childContextTypes));
- }
- return childContext;
+ !(name in Component.childContextTypes) ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
}
- return null;
- },
-
- _mergeChildContext: function(currentContext, childContext) {
- if (childContext) {
return assign({}, currentContext, childContext);
}
return currentContext;
@@ -7080,17 +6095,11 @@
* @return {object}
* @private
*/
- _processProps: function(newProps) {
- if ("production" !== "development") {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ _processProps: function (newProps) {
+ if ("development" !== 'production') {
+ var Component = this._currentElement.type;
if (Component.propTypes) {
- this._checkPropTypes(
- Component.propTypes,
- newProps,
- ReactPropTypeLocations.prop
- );
+ this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
}
}
return newProps;
@@ -7104,7 +6113,7 @@
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
- _checkPropTypes: function(propTypes, props, location) {
+ _checkPropTypes: function (propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
@@ -7114,58 +6123,35 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== "development" ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually ' +
- 'from React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
- // React.render calls, so I'm abstracting it away into
+ // top-level render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
- ("production" !== "development" ? warning(
- false,
- 'Failed Composite propType: %s%s',
- error.message,
- addendum
- ) : null);
+ "development" !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
} else {
- ("production" !== "development" ? warning(
- false,
- 'Failed Context Types: %s%s',
- error.message,
- addendum
- ) : null);
+ "development" !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
}
}
}
}
},
- receiveComponent: function(nextElement, transaction, nextContext) {
+ receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
- this.updateComponent(
- transaction,
- prevElement,
- nextElement,
- prevContext,
- nextContext
- );
+ this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
@@ -7175,54 +6161,13 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(transaction) {
+ performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
- ReactReconciler.receiveComponent(
- this,
- this._pendingElement || this._currentElement,
- transaction,
- this._context
- );
+ ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(
- this._currentElement
- );
- }
-
- this.updateComponent(
- transaction,
- this._currentElement,
- this._currentElement,
- this._context,
- this._context
- );
- }
- },
-
- /**
- * Compare two contexts, warning if they are different
- * TODO: Remove this check when owner-context is removed
- */
- _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
- ownerBasedContext = this._maskContext(ownerBasedContext);
- parentBasedContext = this._maskContext(parentBasedContext);
- var parentKeys = Object.keys(parentBasedContext).sort();
- var displayName = this.getName() || 'ReactCompositeComponent';
- for (var i = 0; i < parentKeys.length; i++) {
- var key = parentKeys[i];
- ("production" !== "development" ? warning(
- ownerBasedContext[key] === parentBasedContext[key],
- 'owner-based and parent-based contexts differ ' +
- '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
- '(see: http://fb.me/react-context-by-parent)',
- ownerBasedContext[key],
- parentBasedContext[key],
- key,
- displayName
- ) : null);
+ this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
}
},
@@ -7241,32 +6186,19 @@
* @internal
* @overridable
*/
- updateComponent: function(
- transaction,
- prevParentElement,
- nextParentElement,
- prevUnmaskedContext,
- nextUnmaskedContext
- ) {
+ updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
- var nextContext = inst.context;
- var nextProps = inst.props;
+ var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
+ var nextProps;
// Distinguish between a props update versus a simple state update
- if (prevParentElement !== nextParentElement) {
- nextContext = this._processContext(nextParentElement._context);
+ if (prevParentElement === nextParentElement) {
+ // Skip checking prop types again -- we don't read inst.props to avoid
+ // warning for DOM component props in this upgrade
+ nextProps = nextParentElement.props;
+ } else {
nextProps = this._processProps(nextParentElement.props);
-
- if ("production" !== "development") {
- if (nextUnmaskedContext != null) {
- this._warnIfContextsDiffer(
- nextParentElement._context,
- nextUnmaskedContext
- );
- }
- }
-
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
@@ -7278,31 +6210,16 @@
var nextState = this._processPendingState(nextProps, nextContext);
- var shouldUpdate =
- this._pendingForceUpdate ||
- !inst.shouldComponentUpdate ||
- inst.shouldComponentUpdate(nextProps, nextState, nextContext);
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- typeof shouldUpdate !== 'undefined',
- '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
- 'boolean value. Make sure to return true or false.',
- this.getName() || 'ReactCompositeComponent'
- ) : null);
+ var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
- this._performComponentUpdate(
- nextParentElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- nextUnmaskedContext
- );
+ this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
@@ -7314,7 +6231,7 @@
}
},
- _processPendingState: function(props, context) {
+ _processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
@@ -7332,12 +6249,7 @@
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
- assign(
- nextState,
- typeof partial === 'function' ?
- partial.call(inst, nextState, props, context) :
- partial
- );
+ assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
@@ -7355,19 +6267,18 @@
* @param {?object} unmaskedContext
* @private
*/
- _performComponentUpdate: function(
- nextElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- unmaskedContext
- ) {
+ _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var inst = this._instance;
- var prevProps = inst.props;
- var prevState = inst.state;
- var prevContext = inst.context;
+ var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
+ var prevProps;
+ var prevState;
+ var prevContext;
+ if (hasComponentDidUpdate) {
+ prevProps = inst.props;
+ prevState = inst.state;
+ prevContext = inst.context;
+ }
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
@@ -7381,11 +6292,8 @@
this._updateRenderedComponent(transaction, unmaskedContext);
- if (inst.componentDidUpdate) {
- transaction.getReactMountReady().enqueue(
- inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
- inst
- );
+ if (hasComponentDidUpdate) {
+ transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
},
@@ -7395,34 +6303,20 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- _updateRenderedComponent: function(transaction, context) {
+ _updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
- var childContext = this._getValidatedChildContext();
- var nextRenderedElement = this._renderValidatedComponent(childContext);
+ var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
- ReactReconciler.receiveComponent(
- prevComponentInstance,
- nextRenderedElement,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
- this._renderedComponent = this._instantiateReactComponent(
- nextRenderedElement,
- this._currentElement.type
- );
- var nextMarkup = ReactReconciler.mountComponent(
- this._renderedComponent,
- thisID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
+ var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
@@ -7430,23 +6324,19 @@
/**
* @protected
*/
- _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
- ReactComponentEnvironment.replaceNodeWithMarkupByID(
- prevComponentID,
- nextMarkup
- );
+ _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
+ ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
},
/**
* @protected
*/
- _renderValidatedComponentWithoutOwnerOrContext: function() {
+ _renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedComponent = inst.render();
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof renderedComponent === 'undefined' &&
- inst.render._isMockFunction) {
+ if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
@@ -7459,31 +6349,17 @@
/**
* @private
*/
- _renderValidatedComponent: function(childContext) {
+ _renderValidatedComponent: function () {
var renderedComponent;
- var previousContext = ReactContext.current;
- ReactContext.current = this._mergeChildContext(
- this._currentElement._context,
- childContext
- );
ReactCurrentOwner.current = this;
try {
- renderedComponent =
- this._renderValidatedComponentWithoutOwnerOrContext();
+ renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
- ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
- ("production" !== "development" ? invariant(
+ !(
// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent),
- '%s.render(): A valid ReactComponent must be returned. You may have ' +
- 'returned undefined, an array or some other invalid object.',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent)));
+ renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? "development" !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
return renderedComponent;
},
@@ -7495,10 +6371,16 @@
* @final
* @private
*/
- attachRef: function(ref, component) {
+ attachRef: function (ref, component) {
var inst = this.getPublicInstance();
- var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
- refs[ref] = component.getPublicInstance();
+ !(inst != null) ? "development" !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
+ var publicComponentInstance = component.getPublicInstance();
+ if ("development" !== 'production') {
+ var componentName = component && component.getName ? component.getName() : 'a component';
+ "development" !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
+ }
+ var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
+ refs[ref] = publicComponentInstance;
},
/**
@@ -7508,7 +6390,7 @@
* @final
* @private
*/
- detachRef: function(ref) {
+ detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
@@ -7519,26 +6401,26 @@
* @return {string} The name or null.
* @internal
*/
- getName: function() {
+ getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
- return (
- type.displayName || (constructor && constructor.displayName) ||
- type.name || (constructor && constructor.name) ||
- null
- );
+ return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
- * is exposed by refs and returned by React.render. Can be null for stateless
+ * is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
- getPublicInstance: function() {
- return this._instance;
+ getPublicInstance: function () {
+ var inst = this._instance;
+ if (inst instanceof StatelessComponent) {
+ return null;
+ }
+ return inst;
},
// Stub
@@ -7546,15 +6428,11 @@
};
-ReactPerf.measureMethods(
- ReactCompositeComponentMixin,
- 'ReactCompositeComponent',
- {
+ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
- }
-);
+});
var ReactCompositeComponent = {
@@ -7563,84 +6441,7 @@
};
module.exports = ReactCompositeComponent;
-
-},{"100":100,"130":130,"150":150,"167":167,"171":171,"29":29,"41":41,"44":44,"45":45,"63":63,"64":64,"73":73,"74":74,"80":80,"82":82,"84":84,"85":85,"89":89}],44:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactContext
- */
-
-'use strict';
-
-var assign = _dereq_(29);
-var emptyObject = _dereq_(130);
-var warning = _dereq_(171);
-
-var didWarn = false;
-
-/**
- * Keeps track of the current context.
- *
- * The context is automatically passed down the component ownership hierarchy
- * and is accessible via `this.context` on ReactCompositeComponents.
- */
-var ReactContext = {
-
- /**
- * @internal
- * @type {object}
- */
- current: emptyObject,
-
- /**
- * Temporarily extends the current context while executing scopedCallback.
- *
- * A typical use case might look like
- *
- * render: function() {
- * var children = ReactContext.withContext({foo: 'foo'}, () => (
- *
- * ));
- * return <div>{children}</div>;
- * }
- *
- * @param {object} newContext New context to merge into the existing context
- * @param {function} scopedCallback Callback to run with the new context
- * @return {ReactComponent|array<ReactComponent>}
- */
- withContext: function(newContext, scopedCallback) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- didWarn,
- 'withContext is deprecated and will be removed in a future version. ' +
- 'Use a wrapper component with getChildContext instead.'
- ) : null);
-
- didWarn = true;
- }
-
- var result;
- var previousContext = ReactContext.current;
- ReactContext.current = assign({}, previousContext, newContext);
- try {
- result = scopedCallback();
- } finally {
- ReactContext.current = previousContext;
- }
- return result;
- }
-
-};
-
-module.exports = ReactContext;
-
-},{"130":130,"171":171,"29":29}],45:[function(_dereq_,module,exports){
+},{"141":141,"154":154,"161":161,"173":173,"24":24,"36":36,"39":39,"57":57,"68":68,"78":78,"80":80,"81":81,"84":84,"95":95}],39:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7659,8 +6460,6 @@
*
* The current owner is the component who should own any components that are
* currently being constructed.
- *
- * The depth indicate how many composite components are above this render level.
*/
var ReactCurrentOwner = {
@@ -7673,8 +6472,7 @@
};
module.exports = ReactCurrentOwner;
-
-},{}],46:[function(_dereq_,module,exports){
+},{}],40:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7684,174 +6482,90 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOM
- * @typechecks static-only
*/
+/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
+
'use strict';
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
+var ReactCurrentOwner = _dereq_(39);
+var ReactDOMTextComponent = _dereq_(51);
+var ReactDefaultInjection = _dereq_(54);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMount = _dereq_(72);
+var ReactPerf = _dereq_(78);
+var ReactReconciler = _dereq_(84);
+var ReactUpdates = _dereq_(96);
+var ReactVersion = _dereq_(97);
+
+var findDOMNode = _dereq_(122);
+var renderSubtreeIntoContainer = _dereq_(137);
+var warning = _dereq_(173);
-var mapObject = _dereq_(158);
+ReactDefaultInjection.inject();
-/**
- * Create a factory that creates HTML tag elements.
- *
- * @param {string} tag Tag name (e.g. `div`).
- * @private
- */
-function createDOMFactory(tag) {
- if ("production" !== "development") {
- return ReactElementValidator.createFactory(tag);
- }
- return ReactElement.createFactory(tag);
+var render = ReactPerf.measure('React', 'render', ReactMount.render);
+
+var React = {
+ findDOMNode: findDOMNode,
+ render: render,
+ unmountComponentAtNode: ReactMount.unmountComponentAtNode,
+ version: ReactVersion,
+
+ /* eslint-disable camelcase */
+ unstable_batchedUpdates: ReactUpdates.batchedUpdates,
+ unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
+};
+
+// Inject the runtime into a devtools global hook regardless of browser.
+// Allows for debugging when the hook is injected on the page.
+/* eslint-enable camelcase */
+if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
+ CurrentOwner: ReactCurrentOwner,
+ InstanceHandles: ReactInstanceHandles,
+ Mount: ReactMount,
+ Reconciler: ReactReconciler,
+ TextComponent: ReactDOMTextComponent
+ });
}
-/**
- * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
- * This is also accessible via `React.DOM`.
- *
- * @public
- */
-var ReactDOM = mapObject({
- a: 'a',
- abbr: 'abbr',
- address: 'address',
- area: 'area',
- article: 'article',
- aside: 'aside',
- audio: 'audio',
- b: 'b',
- base: 'base',
- bdi: 'bdi',
- bdo: 'bdo',
- big: 'big',
- blockquote: 'blockquote',
- body: 'body',
- br: 'br',
- button: 'button',
- canvas: 'canvas',
- caption: 'caption',
- cite: 'cite',
- code: 'code',
- col: 'col',
- colgroup: 'colgroup',
- data: 'data',
- datalist: 'datalist',
- dd: 'dd',
- del: 'del',
- details: 'details',
- dfn: 'dfn',
- dialog: 'dialog',
- div: 'div',
- dl: 'dl',
- dt: 'dt',
- em: 'em',
- embed: 'embed',
- fieldset: 'fieldset',
- figcaption: 'figcaption',
- figure: 'figure',
- footer: 'footer',
- form: 'form',
- h1: 'h1',
- h2: 'h2',
- h3: 'h3',
- h4: 'h4',
- h5: 'h5',
- h6: 'h6',
- head: 'head',
- header: 'header',
- hr: 'hr',
- html: 'html',
- i: 'i',
- iframe: 'iframe',
- img: 'img',
- input: 'input',
- ins: 'ins',
- kbd: 'kbd',
- keygen: 'keygen',
- label: 'label',
- legend: 'legend',
- li: 'li',
- link: 'link',
- main: 'main',
- map: 'map',
- mark: 'mark',
- menu: 'menu',
- menuitem: 'menuitem',
- meta: 'meta',
- meter: 'meter',
- nav: 'nav',
- noscript: 'noscript',
- object: 'object',
- ol: 'ol',
- optgroup: 'optgroup',
- option: 'option',
- output: 'output',
- p: 'p',
- param: 'param',
- picture: 'picture',
- pre: 'pre',
- progress: 'progress',
- q: 'q',
- rp: 'rp',
- rt: 'rt',
- ruby: 'ruby',
- s: 's',
- samp: 'samp',
- script: 'script',
- section: 'section',
- select: 'select',
- small: 'small',
- source: 'source',
- span: 'span',
- strong: 'strong',
- style: 'style',
- sub: 'sub',
- summary: 'summary',
- sup: 'sup',
- table: 'table',
- tbody: 'tbody',
- td: 'td',
- textarea: 'textarea',
- tfoot: 'tfoot',
- th: 'th',
- thead: 'thead',
- time: 'time',
- title: 'title',
- tr: 'tr',
- track: 'track',
- u: 'u',
- ul: 'ul',
- 'var': 'var',
- video: 'video',
- wbr: 'wbr',
+if ("development" !== 'production') {
+ var ExecutionEnvironment = _dereq_(147);
+ if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
- // SVG
- circle: 'circle',
- clipPath: 'clipPath',
- defs: 'defs',
- ellipse: 'ellipse',
- g: 'g',
- line: 'line',
- linearGradient: 'linearGradient',
- mask: 'mask',
- path: 'path',
- pattern: 'pattern',
- polygon: 'polygon',
- polyline: 'polyline',
- radialGradient: 'radialGradient',
- rect: 'rect',
- stop: 'stop',
- svg: 'svg',
- text: 'text',
- tspan: 'tspan'
+ // First check if devtools is not installed
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
+ // If we're in Chrome or Firefox, provide a download link if not installed.
+ if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
+ console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
+ }
+ }
-}, createDOMFactory);
+ // If we're in IE8, check to see if we are in compatibility mode and provide
+ // information on preventing compatibility mode
+ var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
-module.exports = ReactDOM;
+ "development" !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
+
+ var expectedFeatures = [
+ // shims
+ Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
+
+ // shams
+ Object.create, Object.freeze];
-},{"158":158,"63":63,"64":64}],47:[function(_dereq_,module,exports){
+ for (var i = 0; i < expectedFeatures.length; i++) {
+ if (!expectedFeatures[i]) {
+ console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
+ break;
+ }
+ }
+ }
+}
+
+module.exports = React;
+},{"122":122,"137":137,"147":147,"173":173,"39":39,"51":51,"54":54,"67":67,"72":72,"78":78,"84":84,"96":96,"97":97}],41:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7865,16 +6579,7 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var keyMirror = _dereq_(156);
-
-var button = ReactElement.createFactory('button');
-
-var mouseListenerNames = keyMirror({
+var mouseListenerNames = {
onClick: true,
onDoubleClick: true,
onMouseDown: true,
@@ -7880,42 +6585,38 @@
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
+
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
-});
+};
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
-var ReactDOMButton = ReactClass.createClass({
- displayName: 'ReactDOMButton',
- tagName: 'BUTTON',
-
- mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
-
- render: function() {
- var props = {};
+var ReactDOMButton = {
+ getNativeProps: function (inst, props, context) {
+ if (!props.disabled) {
+ return props;
+ }
- // Copy the props; except the mouse listeners if we're disabled
- for (var key in this.props) {
- if (this.props.hasOwnProperty(key) &&
- (!this.props.disabled || !mouseListenerNames[key])) {
- props[key] = this.props[key];
+ // Copy the props, except the mouse listeners
+ var nativeProps = {};
+ for (var key in props) {
+ if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
+ nativeProps[key] = props[key];
}
}
- return button(props, this.props.children);
+ return nativeProps;
}
-
-});
+};
module.exports = ReactDOMButton;
-
-},{"156":156,"2":2,"32":32,"38":38,"63":63}],48:[function(_dereq_,module,exports){
+},{}],42:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -7932,104 +6633,293 @@
'use strict';
-var CSSPropertyOperations = _dereq_(6);
-var DOMProperty = _dereq_(11);
-var DOMPropertyOperations = _dereq_(12);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactComponentBrowserEnvironment =
- _dereq_(40);
-var ReactMount = _dereq_(77);
-var ReactMultiChild = _dereq_(78);
-var ReactPerf = _dereq_(82);
-
-var assign = _dereq_(29);
-var escapeTextContentForBrowser = _dereq_(131);
-var invariant = _dereq_(150);
-var isEventSupported = _dereq_(151);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var AutoFocusUtils = _dereq_(2);
+var CSSPropertyOperations = _dereq_(5);
+var DOMProperty = _dereq_(10);
+var DOMPropertyOperations = _dereq_(11);
+var EventConstants = _dereq_(15);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactComponentBrowserEnvironment = _dereq_(35);
+var ReactDOMButton = _dereq_(41);
+var ReactDOMInput = _dereq_(46);
+var ReactDOMOption = _dereq_(47);
+var ReactDOMSelect = _dereq_(48);
+var ReactDOMTextarea = _dereq_(52);
+var ReactMount = _dereq_(72);
+var ReactMultiChild = _dereq_(73);
+var ReactPerf = _dereq_(78);
+var ReactUpdateQueue = _dereq_(95);
+
+var assign = _dereq_(24);
+var canDefineProperty = _dereq_(117);
+var escapeTextContentForBrowser = _dereq_(121);
+var invariant = _dereq_(161);
+var isEventSupported = _dereq_(133);
+var keyOf = _dereq_(166);
+var setInnerHTML = _dereq_(138);
+var setTextContent = _dereq_(139);
+var shallowEqual = _dereq_(171);
+var validateDOMNesting = _dereq_(144);
+var warning = _dereq_(173);
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
-var CONTENT_TYPES = {'string': true, 'number': true};
+var CONTENT_TYPES = { 'string': true, 'number': true };
-var STYLE = keyOf({style: null});
+var CHILDREN = keyOf({ children: null });
+var STYLE = keyOf({ style: null });
+var HTML = keyOf({ __html: null });
var ELEMENT_NODE_TYPE = 1;
-/**
- * Optionally injectable operations for mutating the DOM
- */
-var BackendIDOperations = null;
+function getDeclarationErrorAddendum(internalInstance) {
+ if (internalInstance) {
+ var owner = internalInstance._currentElement._owner || null;
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' This DOM node was rendered by `' + name + '`.';
+ }
+ }
+ }
+ return '';
+}
+
+var legacyPropsDescriptor;
+if ("development" !== 'production') {
+ legacyPropsDescriptor = {
+ props: {
+ enumerable: false,
+ get: function () {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
+ return component._currentElement.props;
+ }
+ }
+ };
+}
+
+function legacyGetDOMNode() {
+ if ("development" !== 'production') {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return this;
+}
+
+function legacyIsMounted() {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return !!component;
+}
+
+function legacySetStateEtc() {
+ if ("development" !== 'production') {
+ var component = this._reactInternalComponent;
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+}
+
+function legacySetProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function legacyReplaceProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function friendlyStringify(obj) {
+ if (typeof obj === 'object') {
+ if (Array.isArray(obj)) {
+ return '[' + obj.map(friendlyStringify).join(', ') + ']';
+ } else {
+ var pairs = [];
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
+ pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
+ }
+ }
+ return '{' + pairs.join(', ') + '}';
+ }
+ } else if (typeof obj === 'string') {
+ return JSON.stringify(obj);
+ } else if (typeof obj === 'function') {
+ return '[function object]';
+ }
+ // Differs from JSON.stringify in that undefined becauses undefined and that
+ // inf and nan don't become null
+ return String(obj);
+}
+
+var styleMutationWarning = {};
+
+function checkAndWarnForMutatedStyle(style1, style2, component) {
+ if (style1 == null || style2 == null) {
+ return;
+ }
+ if (shallowEqual(style1, style2)) {
+ return;
+ }
+
+ var componentName = component._tag;
+ var owner = component._currentElement._owner;
+ var ownerName;
+ if (owner) {
+ ownerName = owner.getName();
+ }
+
+ var hash = ownerName + '|' + componentName;
+
+ if (styleMutationWarning.hasOwnProperty(hash)) {
+ return;
+ }
+
+ styleMutationWarning[hash] = true;
+
+ "development" !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
+}
/**
+ * @param {object} component
* @param {?object} props
*/
-function assertValidProps(props) {
+function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
+ if ("development" !== 'production') {
+ if (voidElementTags[component._tag]) {
+ "development" !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
+ }
+ }
if (props.dangerouslySetInnerHTML != null) {
- ("production" !== "development" ? invariant(
- props.children == null,
- 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
- ) : invariant(props.children == null));
- ("production" !== "development" ? invariant(
- typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML,
- '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
- 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
- 'for more information.'
- ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML));
- }
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- props.innerHTML == null,
- 'Directly setting property `innerHTML` is not permitted. ' +
- 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
- ) : null);
- ("production" !== "development" ? warning(
- !props.contentEditable || props.children == null,
- 'A component is `contentEditable` and contains `children` managed by ' +
- 'React. It is now your responsibility to guarantee that none of ' +
- 'those nodes are unexpectedly modified or duplicated. This is ' +
- 'probably not intentional.'
- ) : null);
- }
- ("production" !== "development" ? invariant(
- props.style == null || typeof props.style === 'object',
- 'The `style` prop expects a mapping from style properties to values, ' +
- 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
- 'using JSX.'
- ) : invariant(props.style == null || typeof props.style === 'object'));
+ !(props.children == null) ? "development" !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
+ !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? "development" !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
+ }
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
+ "development" !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
+ }
+ !(props.style == null || typeof props.style === 'object') ? "development" !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
}
-function putListener(id, registrationName, listener, transaction) {
- if ("production" !== "development") {
+function enqueuePutListener(id, registrationName, listener, transaction) {
+ if ("development" !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
- ("production" !== "development" ? warning(
- registrationName !== 'onScroll' || isEventSupported('scroll', true),
- 'This browser doesn\'t support the `onScroll` event'
- ) : null);
+ "development" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
- var doc = container.nodeType === ELEMENT_NODE_TYPE ?
- container.ownerDocument :
- container;
+ var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
listenTo(registrationName, doc);
}
- transaction.getPutListenerQueue().enqueuePutListener(
- id,
- registrationName,
- listener
- );
+ transaction.getReactMountReady().enqueue(putListener, {
+ id: id,
+ registrationName: registrationName,
+ listener: listener
+ });
+}
+
+function putListener() {
+ var listenerToPut = this;
+ ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
+}
+
+// There are so many media events, it makes sense to just
+// maintain a list rather than create a `trapBubbledEvent` for each
+var mediaEvents = {
+ topAbort: 'abort',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
+ topTimeUpdate: 'timeupdate',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting'
+};
+
+function trapBubbledEventsLocal() {
+ var inst = this;
+ // If a component renders to null or if another component fatals and causes
+ // the state of the tree to be corrupted, `node` here can be null.
+ !inst._rootNodeID ? "development" !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
+ var node = ReactMount.getNode(inst._rootNodeID);
+ !node ? "development" !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
+
+ switch (inst._tag) {
+ case 'iframe':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'video':
+ case 'audio':
+
+ inst._wrapperState.listeners = [];
+ // create listener for each media event
+ for (var event in mediaEvents) {
+ if (mediaEvents.hasOwnProperty(event)) {
+ inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
+ }
+ }
+
+ break;
+ case 'img':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'form':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
+ break;
+ }
+}
+
+function mountReadyInputWrapper() {
+ ReactDOMInput.mountReadyWrapper(this);
+}
+
+function postUpdateSelectWrapper() {
+ ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
@@ -8051,24 +6941,49 @@
'source': true,
'track': true,
'wbr': true
- // NOTE: menuitem's close tag should be omitted, but that causes problems.
};
-// We accept any tag to be rendered but since this gets injected into abitrary
+// NOTE: menuitem's close tag should be omitted, but that causes problems.
+var newlineEatingTags = {
+ 'listing': true,
+ 'pre': true,
+ 'textarea': true
+};
+
+// For HTML, certain tags cannot have children. This has the same purpose as
+// `omittedCloseTags` except that `menuitem` should still have its closing tag.
+
+var voidElementTags = assign({
+ 'menuitem': true
+}, omittedCloseTags);
+
+// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
-var hasOwnProperty = {}.hasOwnProperty;
+var hasOwnProperty = ({}).hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
- ("production" !== "development" ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
+ !VALID_TAG_REGEX.test(tag) ? "development" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
validatedTagCache[tag] = true;
}
}
+function processChildContextDev(context, inst) {
+ // Pass down our tag name to child components for validation purposes
+ context = assign({}, context);
+ var info = context[validateDOMNesting.ancestorInfoContextKey];
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
+ return context;
+}
+
+function isCustomComponent(tagName, props) {
+ return tagName.indexOf('-') >= 0 || props.is != null;
+}
+
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
@@ -8085,17 +7000,25 @@
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
- this._tag = tag;
+ this._tag = tag.toLowerCase();
this._renderedChildren = null;
+ this._previousStyle = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
+ this._wrapperState = null;
+ this._topLevelWrapper = null;
+ this._nodeWithLegacyProperties = null;
+ if ("development" !== 'production') {
+ this._unprocessedContextDev = null;
+ this._processedContextDev = null;
+ }
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
},
@@ -8106,17 +7029,94 @@
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
* @return {string} The computed markup.
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._rootNodeID = rootID;
- assertValidProps(this._currentElement.props);
- var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
- return (
- this._createOpenTagMarkupAndPutListeners(transaction) +
- this._createContentMarkup(transaction, context) +
- closeTag
- );
+
+ var props = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ this._wrapperState = {
+ listeners: null
+ };
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
+ break;
+ case 'button':
+ props = ReactDOMButton.getNativeProps(this, props, context);
+ break;
+ case 'input':
+ ReactDOMInput.mountWrapper(this, props, context);
+ props = ReactDOMInput.getNativeProps(this, props, context);
+ break;
+ case 'option':
+ ReactDOMOption.mountWrapper(this, props, context);
+ props = ReactDOMOption.getNativeProps(this, props, context);
+ break;
+ case 'select':
+ ReactDOMSelect.mountWrapper(this, props, context);
+ props = ReactDOMSelect.getNativeProps(this, props, context);
+ context = ReactDOMSelect.processChildContext(this, props, context);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.mountWrapper(this, props, context);
+ props = ReactDOMTextarea.getNativeProps(this, props, context);
+ break;
+ }
+
+ assertValidProps(this, props);
+ if ("development" !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
+ if ("development" !== 'production') {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ context = this._processedContextDev;
+ }
+
+ var mountImage;
+ if (transaction.useCreateElement) {
+ var ownerDocument = context[ReactMount.ownerDocumentContextKey];
+ var el = ownerDocument.createElement(this._currentElement.type);
+ DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
+ // Populate node cache
+ ReactMount.getID(el);
+ this._updateDOMProperties({}, props, transaction, el);
+ this._createInitialChildren(transaction, props, context, el);
+ mountImage = el;
+ } else {
+ var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
+ var tagContent = this._createContentMarkup(transaction, props, context);
+ if (!tagContent && omittedCloseTags[this._tag]) {
+ mountImage = tagOpen + '/>';
+ } else {
+ mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
+ }
+ }
+
+ switch (this._tag) {
+ case 'input':
+ transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
+ // falls through
+ case 'button':
+ case 'select':
+ case 'textarea':
+ if (props.autoFocus) {
+ transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
+ }
+ break;
+ }
+
+ return mountImage;
},
/**
@@ -8129,11 +7129,11 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @return {string} Markup of opening tag.
*/
- _createOpenTagMarkupAndPutListeners: function(transaction) {
- var props = this._currentElement.props;
- var ret = '<' + this._tag;
+ _createOpenTagMarkupAndPutListeners: function (transaction, props) {
+ var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
@@ -8144,16 +7144,28 @@
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, propValue, transaction);
+ if (propValue) {
+ enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
+ }
} else {
if (propKey === STYLE) {
if (propValue) {
+ if ("development" !== 'production') {
+ // See `_updateDOMProperties`. style block
+ this._previousStyle = propValue;
+ }
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
- var markup =
- DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ var markup = null;
+ if (this._tag != null && isCustomComponent(this._tag, props)) {
+ if (propKey !== CHILDREN) {
+ markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
+ }
+ } else {
+ markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ }
if (markup) {
ret += ' ' + markup;
}
@@ -8163,11 +7175,11 @@
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
- return ret + '>';
+ return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
- return ret + ' ' + markupForID + '>';
+ return ret + ' ' + markupForID;
},
/**
@@ -8175,47 +7187,78 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
- _createContentMarkup: function(transaction, context) {
- var prefix = '';
- if (this._tag === 'listing' ||
- this._tag === 'pre' ||
- this._tag === 'textarea') {
- // Add an initial newline because browsers ignore the first newline in
- // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
- prefix = '\n';
- }
+ _createContentMarkup: function (transaction, props, context) {
+ var ret = '';
- var props = this._currentElement.props;
+ // Intentional use of != to avoid catching zero/false.
+ var innerHTML = props.dangerouslySetInnerHTML;
+ if (innerHTML != null) {
+ if (innerHTML.__html != null) {
+ ret = innerHTML.__html;
+ }
+ } else {
+ var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
+ var childrenToUse = contentToUse != null ? null : props.children;
+ if (contentToUse != null) {
+ // TODO: Validate that text is allowed as a child of this node
+ ret = escapeTextContentForBrowser(contentToUse);
+ } else if (childrenToUse != null) {
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ ret = mountImages.join('');
+ }
+ }
+ if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
+ // text/html ignores the first character in these tags if it's a newline
+ // Prefer to break application/xml over text/html (for now) by adding
+ // a newline specifically to get eaten by the parser. (Alternately for
+ // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
+ // \r is normalized out by HTMLTextAreaElement#value.)
+ // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
+ // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
+ // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
+ // See: Parsing of "textarea" "listing" and "pre" elements
+ // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
+ return '\n' + ret;
+ } else {
+ return ret;
+ }
+ },
+ _createInitialChildren: function (transaction, props, context, el) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
- return prefix + innerHTML.__html;
+ setInnerHTML(el, innerHTML.__html);
}
} else {
- var contentToUse =
- CONTENT_TYPES[typeof props.children] ? props.children : null;
+ var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
- return prefix + escapeTextContentForBrowser(contentToUse);
+ // TODO: Validate that text is allowed as a child of this node
+ setTextContent(el, contentToUse);
} else if (childrenToUse != null) {
- var mountImages = this.mountChildren(
- childrenToUse,
- transaction,
- context
- );
- return prefix + mountImages.join('');
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ for (var i = 0; i < mountImages.length; i++) {
+ el.appendChild(mountImages[i]);
+ }
}
}
- return prefix;
},
- receiveComponent: function(nextElement, transaction, context) {
+ /**
+ * Receives a next element and updates the component.
+ *
+ * @internal
+ * @param {ReactElement} nextElement
+ * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
+ */
+ receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
@@ -8231,10 +7274,59 @@
* @internal
* @overridable
*/
- updateComponent: function(transaction, prevElement, nextElement, context) {
- assertValidProps(this._currentElement.props);
- this._updateDOMProperties(prevElement.props, transaction);
- this._updateDOMChildren(prevElement.props, transaction, context);
+ updateComponent: function (transaction, prevElement, nextElement, context) {
+ var lastProps = prevElement.props;
+ var nextProps = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'button':
+ lastProps = ReactDOMButton.getNativeProps(this, lastProps);
+ nextProps = ReactDOMButton.getNativeProps(this, nextProps);
+ break;
+ case 'input':
+ ReactDOMInput.updateWrapper(this);
+ lastProps = ReactDOMInput.getNativeProps(this, lastProps);
+ nextProps = ReactDOMInput.getNativeProps(this, nextProps);
+ break;
+ case 'option':
+ lastProps = ReactDOMOption.getNativeProps(this, lastProps);
+ nextProps = ReactDOMOption.getNativeProps(this, nextProps);
+ break;
+ case 'select':
+ lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
+ nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.updateWrapper(this);
+ lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
+ nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
+ break;
+ }
+
+ if ("development" !== 'production') {
+ // If the context is reference-equal to the old one, pass down the same
+ // processed object so the update bailout in ReactReconciler behaves
+ // correctly (and identically in dev and prod). See #5005.
+ if (this._unprocessedContextDev !== context) {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ }
+ context = this._processedContextDev;
+ }
+
+ assertValidProps(this, nextProps);
+ this._updateDOMProperties(lastProps, nextProps, transaction, null);
+ this._updateDOMChildren(lastProps, nextProps, transaction, context);
+
+ if (!canDefineProperty && this._nodeWithLegacyProperties) {
+ this._nodeWithLegacyProperties.props = nextProps;
+ }
+
+ if (this._tag === 'select') {
+ // <select> value update needs to occur after <option> children
+ // reconciliation
+ transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
+ }
},
/**
@@ -8250,16 +7342,16 @@
*
* @private
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {?DOMElement} node
*/
- _updateDOMProperties: function(lastProps, transaction) {
- var nextProps = this._currentElement.props;
+ _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
- if (nextProps.hasOwnProperty(propKey) ||
- !lastProps.hasOwnProperty(propKey)) {
+ if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
@@ -8272,26 +7364,31 @@
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
+ if (lastProps[propKey]) {
+ // Only call deleteListener if there was a listener previously or
+ // else willDeleteListener gets called when there wasn't actually a
+ // listener (e.g., onClick={null})
deleteListener(this._rootNodeID, propKey);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.deletePropertyByID(
- this._rootNodeID,
- propKey
- );
+ }
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
- var lastProp = propKey === STYLE ?
- this._previousStyleCopy :
- lastProps[propKey];
+ var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
+ if ("development" !== 'production') {
+ checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
+ this._previousStyle = nextProp;
+ }
nextProp = this._previousStyleCopy = assign({}, nextProp);
} else {
this._previousStyleCopy = null;
@@ -8299,16 +7396,14 @@
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
- if (lastProp.hasOwnProperty(styleName) &&
- (!nextProp || !nextProp.hasOwnProperty(styleName))) {
+ if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
- if (nextProp.hasOwnProperty(styleName) &&
- lastProp[styleName] !== nextProp[styleName]) {
+ if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
@@ -8318,22 +7413,38 @@
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, nextProp, transaction);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.updatePropertyByID(
- this._rootNodeID,
- propKey,
- nextProp
- );
+ if (nextProp) {
+ enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
+ } else if (lastProp) {
+ deleteListener(this._rootNodeID, propKey);
+ }
+ } else if (isCustomComponent(this._tag, nextProps)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ if (propKey === CHILDREN) {
+ nextProp = null;
+ }
+ DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ // If we're updating to null or undefined, we should remove the property
+ // from the DOM node instead of inadvertantly setting to a string. This
+ // brings us in line with the same behavior we have on initial render.
+ if (nextProp != null) {
+ DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
+ } else {
+ DOMPropertyOperations.deleteValueForProperty(node, propKey);
+ }
}
}
if (styleUpdates) {
- BackendIDOperations.updateStylesByID(
- this._rootNodeID,
- styleUpdates
- );
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ CSSPropertyOperations.setValueForStyles(node, styleUpdates);
}
},
@@ -8342,22 +7453,16 @@
* children content.
*
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {object} context
*/
- _updateDOMChildren: function(lastProps, transaction, context) {
- var nextProps = this._currentElement.props;
+ _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
+ var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
+ var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
- var lastContent =
- CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
- var nextContent =
- CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
-
- var lastHtml =
- lastProps.dangerouslySetInnerHTML &&
- lastProps.dangerouslySetInnerHTML.__html;
- var nextHtml =
- nextProps.dangerouslySetInnerHTML &&
- nextProps.dangerouslySetInnerHTML.__html;
+ var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
+ var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
@@ -8379,10 +7484,7 @@
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
- BackendIDOperations.updateInnerHTMLByID(
- this._rootNodeID,
- nextHtml
- );
+ this.updateMarkup('' + nextHtml);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
@@ -8395,11 +7497,76 @@
*
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ var listeners = this._wrapperState.listeners;
+ if (listeners) {
+ for (var i = 0; i < listeners.length; i++) {
+ listeners[i].remove();
+ }
+ }
+ break;
+ case 'input':
+ ReactDOMInput.unmountWrapper(this);
+ break;
+ case 'html':
+ case 'head':
+ case 'body':
+ /**
+ * Components like <html> <head> and <body> can't be removed or added
+ * easily in a cross-browser way, however it's valuable to be able to
+ * take advantage of React's reconciliation for styling and <title>
+ * management. So we just document it and throw in dangerous cases.
+ */
+ !false ? "development" !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
+ break;
+ }
+
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
+ this._wrapperState = null;
+ if (this._nodeWithLegacyProperties) {
+ var node = this._nodeWithLegacyProperties;
+ node._reactInternalComponent = null;
+ this._nodeWithLegacyProperties = null;
+ }
+ },
+
+ getPublicInstance: function () {
+ if (!this._nodeWithLegacyProperties) {
+ var node = ReactMount.getNode(this._rootNodeID);
+
+ node._reactInternalComponent = this;
+ node.getDOMNode = legacyGetDOMNode;
+ node.isMounted = legacyIsMounted;
+ node.setState = legacySetStateEtc;
+ node.replaceState = legacySetStateEtc;
+ node.forceUpdate = legacySetStateEtc;
+ node.setProps = legacySetProps;
+ node.replaceProps = legacyReplaceProps;
+
+ if ("development" !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperties(node, legacyPropsDescriptor);
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+
+ this._nodeWithLegacyProperties = node;
+ }
+ return this._nodeWithLegacyProperties;
}
};
@@ -8409,21 +7576,10 @@
updateComponent: 'updateComponent'
});
-assign(
- ReactDOMComponent.prototype,
- ReactDOMComponent.Mixin,
- ReactMultiChild.Mixin
-);
-
-ReactDOMComponent.injection = {
- injectIDOperations: function(IDOperations) {
- ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
- }
-};
+assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
-
-},{"11":11,"12":12,"131":131,"150":150,"151":151,"157":157,"171":171,"29":29,"33":33,"40":40,"6":6,"77":77,"78":78,"82":82}],49:[function(_dereq_,module,exports){
+},{"10":10,"11":11,"117":117,"121":121,"133":133,"138":138,"139":139,"144":144,"15":15,"161":161,"166":166,"171":171,"173":173,"2":2,"24":24,"28":28,"35":35,"41":41,"46":46,"47":47,"48":48,"5":5,"52":52,"72":72,"73":73,"78":78,"95":95}],43:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8432,47 +7588,195 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactDOMForm
+ * @providesModule ReactDOMFactories
+ * @typechecks static-only
*/
'use strict';
-var EventConstants = _dereq_(16);
-var LocalEventTrapMixin = _dereq_(27);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
+var ReactElement = _dereq_(57);
+var ReactElementValidator = _dereq_(58);
-var form = ReactElement.createFactory('form');
+var mapObject = _dereq_(167);
/**
- * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
- * to capture it on the <form> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <form> a
- * composite component and use `componentDidMount` to attach the event handlers.
+ * Create a factory that creates HTML tag elements.
+ *
+ * @param {string} tag Tag name (e.g. `div`).
+ * @private
*/
-var ReactDOMForm = ReactClass.createClass({
- displayName: 'ReactDOMForm',
- tagName: 'FORM',
+function createDOMFactory(tag) {
+ if ("development" !== 'production') {
+ return ReactElementValidator.createFactory(tag);
+ }
+ return ReactElement.createFactory(tag);
+}
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
+/**
+ * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
+ * This is also accessible via `React.DOM`.
+ *
+ * @public
+ */
+var ReactDOMFactories = mapObject({
+ a: 'a',
+ abbr: 'abbr',
+ address: 'address',
+ area: 'area',
+ article: 'article',
+ aside: 'aside',
+ audio: 'audio',
+ b: 'b',
+ base: 'base',
+ bdi: 'bdi',
+ bdo: 'bdo',
+ big: 'big',
+ blockquote: 'blockquote',
+ body: 'body',
+ br: 'br',
+ button: 'button',
+ canvas: 'canvas',
+ caption: 'caption',
+ cite: 'cite',
+ code: 'code',
+ col: 'col',
+ colgroup: 'colgroup',
+ data: 'data',
+ datalist: 'datalist',
+ dd: 'dd',
+ del: 'del',
+ details: 'details',
+ dfn: 'dfn',
+ dialog: 'dialog',
+ div: 'div',
+ dl: 'dl',
+ dt: 'dt',
+ em: 'em',
+ embed: 'embed',
+ fieldset: 'fieldset',
+ figcaption: 'figcaption',
+ figure: 'figure',
+ footer: 'footer',
+ form: 'form',
+ h1: 'h1',
+ h2: 'h2',
+ h3: 'h3',
+ h4: 'h4',
+ h5: 'h5',
+ h6: 'h6',
+ head: 'head',
+ header: 'header',
+ hgroup: 'hgroup',
+ hr: 'hr',
+ html: 'html',
+ i: 'i',
+ iframe: 'iframe',
+ img: 'img',
+ input: 'input',
+ ins: 'ins',
+ kbd: 'kbd',
+ keygen: 'keygen',
+ label: 'label',
+ legend: 'legend',
+ li: 'li',
+ link: 'link',
+ main: 'main',
+ map: 'map',
+ mark: 'mark',
+ menu: 'menu',
+ menuitem: 'menuitem',
+ meta: 'meta',
+ meter: 'meter',
+ nav: 'nav',
+ noscript: 'noscript',
+ object: 'object',
+ ol: 'ol',
+ optgroup: 'optgroup',
+ option: 'option',
+ output: 'output',
+ p: 'p',
+ param: 'param',
+ picture: 'picture',
+ pre: 'pre',
+ progress: 'progress',
+ q: 'q',
+ rp: 'rp',
+ rt: 'rt',
+ ruby: 'ruby',
+ s: 's',
+ samp: 'samp',
+ script: 'script',
+ section: 'section',
+ select: 'select',
+ small: 'small',
+ source: 'source',
+ span: 'span',
+ strong: 'strong',
+ style: 'style',
+ sub: 'sub',
+ summary: 'summary',
+ sup: 'sup',
+ table: 'table',
+ tbody: 'tbody',
+ td: 'td',
+ textarea: 'textarea',
+ tfoot: 'tfoot',
+ th: 'th',
+ thead: 'thead',
+ time: 'time',
+ title: 'title',
+ tr: 'tr',
+ track: 'track',
+ u: 'u',
+ ul: 'ul',
+ 'var': 'var',
+ video: 'video',
+ wbr: 'wbr',
- render: function() {
- // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
- // `jshint` fails to parse JSX so in order for linting to work in the open
- // source repo, we need to just use `ReactDOM.form`.
- return form(this.props);
- },
+ // SVG
+ circle: 'circle',
+ clipPath: 'clipPath',
+ defs: 'defs',
+ ellipse: 'ellipse',
+ g: 'g',
+ image: 'image',
+ line: 'line',
+ linearGradient: 'linearGradient',
+ mask: 'mask',
+ path: 'path',
+ pattern: 'pattern',
+ polygon: 'polygon',
+ polyline: 'polyline',
+ radialGradient: 'radialGradient',
+ rect: 'rect',
+ stop: 'stop',
+ svg: 'svg',
+ text: 'text',
+ tspan: 'tspan'
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
- }
-});
+}, createDOMFactory);
-module.exports = ReactDOMForm;
+module.exports = ReactDOMFactories;
+},{"167":167,"57":57,"58":58}],44:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMFeatureFlags
+ */
+
+'use strict';
+
+var ReactDOMFeatureFlags = {
+ useCreateElement: false
+};
-},{"16":16,"27":27,"32":32,"38":38,"63":63}],50:[function(_dereq_,module,exports){
+module.exports = ReactDOMFeatureFlags;
+},{}],45:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8485,34 +7789,28 @@
* @typechecks static-only
*/
-/*jslint evil: true */
-
'use strict';
-var CSSPropertyOperations = _dereq_(6);
-var DOMChildrenOperations = _dereq_(10);
-var DOMPropertyOperations = _dereq_(12);
-var ReactMount = _dereq_(77);
-var ReactPerf = _dereq_(82);
+var DOMChildrenOperations = _dereq_(9);
+var DOMPropertyOperations = _dereq_(11);
+var ReactMount = _dereq_(72);
+var ReactPerf = _dereq_(78);
-var invariant = _dereq_(150);
-var setInnerHTML = _dereq_(164);
+var invariant = _dereq_(161);
/**
- * Errors for properties that should not be updated with `updatePropertyById()`.
+ * Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
- dangerouslySetInnerHTML:
- '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
+ dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
- * Operations used to process updates to DOM nodes. This is made injectable via
- * `ReactDOMComponent.BackendIDOperations`.
+ * Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
@@ -8525,13 +7823,9 @@
* @param {*} value New value of the property.
* @internal
*/
- updatePropertyByID: function(id, name, value) {
+ updatePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
- ("production" !== "development" ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
+ !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? "development" !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
@@ -8544,61 +7838,6 @@
},
/**
- * Updates a DOM node to remove a property. This should only be used to remove
- * DOM properties in `DOMProperty`.
- *
- * @param {string} id ID of the node to update.
- * @param {string} name A property name to remove, see `DOMProperty`.
- * @internal
- */
- deletePropertyByID: function(id, name, value) {
- var node = ReactMount.getNode(id);
- ("production" !== "development" ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
- DOMPropertyOperations.deleteValueForProperty(node, name, value);
- },
-
- /**
- * Updates a DOM node with new style values. If a value is specified as '',
- * the corresponding style property will be unset.
- *
- * @param {string} id ID of the node to update.
- * @param {object} styles Mapping from styles to values.
- * @internal
- */
- updateStylesByID: function(id, styles) {
- var node = ReactMount.getNode(id);
- CSSPropertyOperations.setValueForStyles(node, styles);
- },
-
- /**
- * Updates a DOM node's innerHTML.
- *
- * @param {string} id ID of the node to update.
- * @param {string} html An HTML string.
- * @internal
- */
- updateInnerHTMLByID: function(id, html) {
- var node = ReactMount.getNode(id);
- setInnerHTML(node, html);
- },
-
- /**
- * Updates a DOM node's text content set by `props.content`.
- *
- * @param {string} id ID of the node to update.
- * @param {string} content Text content.
- * @internal
- */
- updateTextContentByID: function(id, content) {
- var node = ReactMount.getNode(id);
- DOMChildrenOperations.updateTextContent(node, content);
- },
-
- /**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
@@ -8606,7 +7845,7 @@
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
- dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
+ dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
@@ -8618,7 +7857,7 @@
* @param {array<string>} markup List of markup strings.
* @internal
*/
- dangerouslyProcessChildrenUpdates: function(updates, markup) {
+ dangerouslyProcessChildrenUpdates: function (updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
@@ -8627,109 +7866,12 @@
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
- updatePropertyByID: 'updatePropertyByID',
- deletePropertyByID: 'deletePropertyByID',
- updateStylesByID: 'updateStylesByID',
- updateInnerHTMLByID: 'updateInnerHTMLByID',
- updateTextContentByID: 'updateTextContentByID',
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
-
-},{"10":10,"12":12,"150":150,"164":164,"6":6,"77":77,"82":82}],51:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMIframe
- */
-
-'use strict';
-
-var EventConstants = _dereq_(16);
-var LocalEventTrapMixin = _dereq_(27);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var iframe = ReactElement.createFactory('iframe');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <iframe> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <iframe> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMIframe = ReactClass.createClass({
- displayName: 'ReactDOMIframe',
- tagName: 'IFRAME',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return iframe(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- }
-});
-
-module.exports = ReactDOMIframe;
-
-},{"16":16,"27":27,"32":32,"38":38,"63":63}],52:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMImg
- */
-
-'use strict';
-
-var EventConstants = _dereq_(16);
-var LocalEventTrapMixin = _dereq_(27);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var img = ReactElement.createFactory('img');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <img> element itself. There are lots of hacks we could do
- * to accomplish this, but the most reliable is to make <img> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMImg = ReactClass.createClass({
- displayName: 'ReactDOMImg',
- tagName: 'IMG',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return img(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
- }
-});
-
-module.exports = ReactDOMImg;
-
-},{"16":16,"27":27,"32":32,"38":38,"63":63}],53:[function(_dereq_,module,exports){
+},{"11":11,"161":161,"72":72,"78":78,"9":9}],46:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8743,26 +7885,20 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var DOMPropertyOperations = _dereq_(12);
-var LinkedValueUtils = _dereq_(26);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-var ReactMount = _dereq_(77);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
+var ReactDOMIDOperations = _dereq_(45);
+var LinkedValueUtils = _dereq_(23);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
-var input = ReactElement.createFactory('input');
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
var instancesByReactID = {};
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMInput.updateWrapper(this);
}
}
@@ -8782,81 +7918,75 @@
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
-var ReactDOMInput = ReactClass.createClass({
- displayName: 'ReactDOMInput',
- tagName: 'INPUT',
-
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+var ReactDOMInput = {
+ getNativeProps: function (inst, props, context) {
+ var value = LinkedValueUtils.getValue(props);
+ var checked = LinkedValueUtils.getChecked(props);
+
+ var nativeProps = assign({}, props, {
+ defaultChecked: undefined,
+ defaultValue: undefined,
+ value: value != null ? value : inst._wrapperState.initialValue,
+ checked: checked != null ? checked : inst._wrapperState.initialChecked,
+ onChange: inst._wrapperState.onChange
+ });
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
- return {
- initialChecked: this.props.defaultChecked || false,
- initialValue: defaultValue != null ? defaultValue : null
- };
+ return nativeProps;
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- props.defaultChecked = null;
- props.defaultValue = null;
-
- var value = LinkedValueUtils.getValue(this);
- props.value = value != null ? value : this.state.initialValue;
-
- var checked = LinkedValueUtils.getChecked(this);
- props.checked = checked != null ? checked : this.state.initialChecked;
-
- props.onChange = this._handleChange;
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
+ }
- return input(props, this.props.children);
+ var defaultValue = props.defaultValue;
+ inst._wrapperState = {
+ initialChecked: props.defaultChecked || false,
+ initialValue: defaultValue != null ? defaultValue : null,
+ onChange: _handleChange.bind(inst)
+ };
},
- componentDidMount: function() {
- var id = ReactMount.getID(this.getDOMNode());
- instancesByReactID[id] = this;
+ mountReadyWrapper: function (inst) {
+ // Can't be in mountWrapper or else server rendering leaks.
+ instancesByReactID[inst._rootNodeID] = inst;
},
- componentWillUnmount: function() {
- var rootNode = this.getDOMNode();
- var id = ReactMount.getID(rootNode);
- delete instancesByReactID[id];
+ unmountWrapper: function (inst) {
+ delete instancesByReactID[inst._rootNodeID];
},
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var rootNode = this.getDOMNode();
- if (this.props.checked != null) {
- DOMPropertyOperations.setValueForProperty(
- rootNode,
- 'checked',
- this.props.checked || false
- );
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // TODO: Shouldn't this be getChecked(props)?
+ var checked = props.checked;
+ if (checked != null) {
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
}
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
+
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
- var name = this.props.name;
- if (this.props.type === 'radio' && name != null) {
- var rootNode = this.getDOMNode();
+ var name = props.name;
+ if (props.type === 'radio' && name != null) {
+ var rootNode = ReactMount.getNode(this._rootNodeID);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
@@ -8869,27 +7999,21 @@
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
- var group = queryRoot.querySelectorAll(
- 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
+ var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
- for (var i = 0, groupLen = group.length; i < groupLen; i++) {
+ for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
- if (otherNode === rootNode ||
- otherNode.form !== rootNode.form) {
+ if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
+ // This will throw if radio buttons rendered by different copies of React
+ // and the same name are rendered into the same form (same as #1939).
+ // That's probably okay; we don't support it just as we don't support
+ // mixing React with non-React.
var otherID = ReactMount.getID(otherNode);
- ("production" !== "development" ? invariant(
- otherID,
- 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
- 'same `name` is not supported.'
- ) : invariant(otherID));
+ !otherID ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
var otherInstance = instancesByReactID[otherID];
- ("production" !== "development" ? invariant(
- otherInstance,
- 'ReactDOMInput: Unknown radio button ID %s.',
- otherID
- ) : invariant(otherInstance));
+ !otherInstance ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
@@ -8898,13 +8022,10 @@
}
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMInput;
-
-},{"100":100,"12":12,"150":150,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63,"77":77}],54:[function(_dereq_,module,exports){
+},{"161":161,"23":23,"24":24,"45":45,"72":72,"96":96}],47:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8918,43 +8039,83 @@
'use strict';
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
+var ReactChildren = _dereq_(32);
+var ReactDOMSelect = _dereq_(48);
-var warning = _dereq_(171);
+var assign = _dereq_(24);
+var warning = _dereq_(173);
-var option = ReactElement.createFactory('option');
+var valueContextKey = ReactDOMSelect.valueContextKey;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
-var ReactDOMOption = ReactClass.createClass({
- displayName: 'ReactDOMOption',
- tagName: 'OPTION',
+var ReactDOMOption = {
+ mountWrapper: function (inst, props, context) {
+ // TODO (yungsters): Remove support for `selected` in <option>.
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
+ }
- mixins: [ReactBrowserComponentMixin],
+ // Look up whether this option is 'selected' via context
+ var selectValue = context[valueContextKey];
- componentWillMount: function() {
- // TODO (yungsters): Remove support for `selected` in <option>.
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- this.props.selected == null,
- 'Use the `defaultValue` or `value` props on <select> instead of ' +
- 'setting `selected` on <option>.'
- ) : null);
+ // If context key is null (e.g., no specified value or after initial mount)
+ // or missing (e.g., for <datalist>), we don't change props.selected
+ var selected = null;
+ if (selectValue != null) {
+ selected = false;
+ if (Array.isArray(selectValue)) {
+ // multiple
+ for (var i = 0; i < selectValue.length; i++) {
+ if ('' + selectValue[i] === '' + props.value) {
+ selected = true;
+ break;
+ }
+ }
+ } else {
+ selected = '' + selectValue === '' + props.value;
}
+ }
+
+ inst._wrapperState = { selected: selected };
},
- render: function() {
- return option(this.props, this.props.children);
+ getNativeProps: function (inst, props, context) {
+ var nativeProps = assign({ selected: undefined, children: undefined }, props);
+
+ // Read state only from initial mount because <select> updates value
+ // manually; we need the initial state only for server rendering
+ if (inst._wrapperState.selected != null) {
+ nativeProps.selected = inst._wrapperState.selected;
}
-});
+ var content = '';
-module.exports = ReactDOMOption;
+ // Flatten children and warn if they aren't strings or numbers;
+ // invalid types are ignored.
+ ReactChildren.forEach(props.children, function (child) {
+ if (child == null) {
+ return;
+ }
+ if (typeof child === 'string' || typeof child === 'number') {
+ content += child;
+ } else {
+ "development" !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
+ }
+ });
+
+ if (content) {
+ nativeProps.children = content;
+ }
+
+ return nativeProps;
+ }
+
+};
-},{"171":171,"32":32,"38":38,"63":63}],55:[function(_dereq_,module,exports){
+module.exports = ReactDOMOption;
+},{"173":173,"24":24,"32":32,"48":48}],48:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -8968,68 +8129,77 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var LinkedValueUtils = _dereq_(26);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-var ReactUpdates = _dereq_(100);
+var LinkedValueUtils = _dereq_(23);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
-var assign = _dereq_(29);
+var assign = _dereq_(24);
+var warning = _dereq_(173);
-var select = ReactElement.createFactory('select');
+var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
function updateOptionsIfPendingUpdateAndMounted() {
- /*jshint validthis:true */
- if (this._pendingUpdate) {
- this._pendingUpdate = false;
- var value = LinkedValueUtils.getValue(this);
- if (value != null && this.isMounted()) {
- updateOptions(this, value);
+ if (this._rootNodeID && this._wrapperState.pendingUpdate) {
+ this._wrapperState.pendingUpdate = false;
+
+ var props = this._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
+
+ if (value != null) {
+ updateOptions(this, Boolean(props.multiple), value);
}
}
}
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
+ }
+ return '';
+}
+
+var valuePropNames = ['value', 'defaultValue'];
+
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
-function selectValueType(props, propName, componentName) {
+function checkSelectPropTypes(inst, props) {
+ var owner = inst._currentElement._owner;
+ LinkedValueUtils.checkPropTypes('select', props, owner);
+
+ for (var i = 0; i < valuePropNames.length; i++) {
+ var propName = valuePropNames[i];
if (props[propName] == null) {
- return null;
+ continue;
}
if (props.multiple) {
- if (!Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be an array if ") +
- ("`multiple` is true.")
- );
- }
+ "development" !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
} else {
- if (Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
- ("value if `multiple` is false.")
- );
+ "development" !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
}
}
}
/**
- * @param {ReactComponent} component Instance of ReactDOMSelect
+ * @param {ReactDOMComponent} inst
+ * @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
-function updateOptions(component, propValue) {
- var selectedValue, i, l;
- var options = component.getDOMNode().options;
+function updateOptions(inst, multiple, propValue) {
+ var selectedValue, i;
+ var options = ReactMount.getNode(inst._rootNodeID).options;
- if (component.props.multiple) {
+ if (multiple) {
selectedValue = {};
- for (i = 0, l = propValue.length; i < l; i++) {
+ for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
@@ -9039,7 +8209,7 @@
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
@@ -9066,73 +8236,75 @@
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
-var ReactDOMSelect = ReactClass.createClass({
- displayName: 'ReactDOMSelect',
- tagName: 'SELECT',
-
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+var ReactDOMSelect = {
+ valueContextKey: valueContextKey,
- propTypes: {
- defaultValue: selectValueType,
- value: selectValueType
+ getNativeProps: function (inst, props, context) {
+ return assign({}, props, {
+ onChange: inst._wrapperState.onChange,
+ value: undefined
+ });
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- props.onChange = this._handleChange;
- props.value = null;
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ checkSelectPropTypes(inst, props);
+ }
- return select(props, this.props.children);
+ var value = LinkedValueUtils.getValue(props);
+ inst._wrapperState = {
+ pendingUpdate: false,
+ initialValue: value != null ? value : props.defaultValue,
+ onChange: _handleChange.bind(inst),
+ wasMultiple: Boolean(props.multiple)
+ };
},
- componentWillMount: function() {
- this._pendingUpdate = false;
+ processChildContext: function (inst, props, context) {
+ // Pass down initial value so initial generated markup has correct
+ // `selected` attributes
+ var childContext = assign({}, context);
+ childContext[valueContextKey] = inst._wrapperState.initialValue;
+ return childContext;
},
- componentDidMount: function() {
- var value = LinkedValueUtils.getValue(this);
- if (value != null) {
- updateOptions(this, value);
- } else if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
- }
- },
+ postUpdateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // After the initial mount, we control selected-ness manually so don't pass
+ // the context value down
+ inst._wrapperState.initialValue = undefined;
+
+ var wasMultiple = inst._wrapperState.wasMultiple;
+ inst._wrapperState.wasMultiple = Boolean(props.multiple);
- componentDidUpdate: function(prevProps) {
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- this._pendingUpdate = false;
- updateOptions(this, value);
- } else if (!prevProps.multiple !== !this.props.multiple) {
+ inst._wrapperState.pendingUpdate = false;
+ updateOptions(inst, Boolean(props.multiple), value);
+ } else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
- if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
+ if (props.defaultValue != null) {
+ updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
- updateOptions(this, this.props.multiple ? [] : '');
+ updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
- this._pendingUpdate = true;
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
+
+ this._wrapperState.pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMSelect;
-
-},{"100":100,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63}],56:[function(_dereq_,module,exports){
+},{"173":173,"23":23,"24":24,"72":72,"96":96}],49:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9146,10 +8318,10 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
-var getNodeForCharacterOffset = _dereq_(143);
-var getTextContentAccessor = _dereq_(145);
+var getNodeForCharacterOffset = _dereq_(130);
+var getTextContentAccessor = _dereq_(131);
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
@@ -9211,15 +8383,26 @@
var currentRange = selection.getRangeAt(0);
+ // In Firefox, range.startContainer and range.endContainer can be "anonymous
+ // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
+ // divs do not seem to expose properties, triggering a "Permission denied
+ // error" if any of its properties are accessed. The only seemingly possible
+ // way to avoid erroring is to access a property that typically works for
+ // non-anonymous divs and catch any error that may otherwise arise. See
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
+ try {
+ /* eslint-disable no-unused-expressions */
+ currentRange.startContainer.nodeType;
+ currentRange.endContainer.nodeType;
+ /* eslint-enable no-unused-expressions */
+ } catch (e) {
+ return null;
+ }
+
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
- var isSelectionCollapsed = isCollapsed(
- selection.anchorNode,
- selection.anchorOffset,
- selection.focusNode,
- selection.focusOffset
- );
+ var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
@@ -9227,12 +8410,7 @@
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
- var isTempRangeCollapsed = isCollapsed(
- tempRange.startContainer,
- tempRange.startOffset,
- tempRange.endContainer,
- tempRange.endOffset
- );
+ var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
@@ -9295,8 +8473,7 @@
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
- var end = typeof offsets.end === 'undefined' ?
- start : Math.min(offsets.end, length);
+ var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
@@ -9324,11 +8501,7 @@
}
}
-var useIEOffsets = (
- ExecutionEnvironment.canUseDOM &&
- 'selection' in document &&
- !('getSelection' in window)
-);
+var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**
@@ -9344,8 +8517,34 @@
};
module.exports = ReactDOMSelection;
+},{"130":130,"131":131,"147":147}],50:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMServer
+ */
+
+'use strict';
+
+var ReactDefaultInjection = _dereq_(54);
+var ReactServerRendering = _dereq_(88);
+var ReactVersion = _dereq_(97);
-},{"143":143,"145":145,"22":22}],57:[function(_dereq_,module,exports){
+ReactDefaultInjection.inject();
+
+var ReactDOMServer = {
+ renderToString: ReactServerRendering.renderToString,
+ renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
+ version: ReactVersion
+};
+
+module.exports = ReactDOMServer;
+},{"54":54,"88":88,"97":97}],51:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9360,13 +8559,15 @@
'use strict';
-var DOMPropertyOperations = _dereq_(12);
-var ReactComponentBrowserEnvironment =
- _dereq_(40);
-var ReactDOMComponent = _dereq_(48);
-
-var assign = _dereq_(29);
-var escapeTextContentForBrowser = _dereq_(131);
+var DOMChildrenOperations = _dereq_(9);
+var DOMPropertyOperations = _dereq_(11);
+var ReactComponentBrowserEnvironment = _dereq_(35);
+var ReactMount = _dereq_(72);
+
+var assign = _dereq_(24);
+var escapeTextContentForBrowser = _dereq_(121);
+var setTextContent = _dereq_(139);
+var validateDOMNesting = _dereq_(144);
/**
* Text nodes violate a couple assumptions that React makes about components:
@@ -9383,7 +8584,7 @@
* @extends ReactComponent
* @internal
*/
-var ReactDOMTextComponent = function(props) {
+var ReactDOMTextComponent = function (props) {
// This constructor and its argument is currently used by mocks.
};
@@ -9393,7 +8594,7 @@
* @param {ReactText} text
* @internal
*/
- construct: function(text) {
+ construct: function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
@@ -9412,8 +8613,23 @@
* @return {string} Markup for this text node.
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
+ if ("development" !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
this._rootNodeID = rootID;
+ if (transaction.useCreateElement) {
+ var ownerDocument = context[ReactMount.ownerDocumentContextKey];
+ var el = ownerDocument.createElement('span');
+ DOMPropertyOperations.setAttributeForID(el, rootID);
+ // Populate node cache
+ ReactMount.getID(el);
+ setTextContent(el, this._stringText);
+ return el;
+ } else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
@@ -9423,11 +8639,8 @@
return escapedText;
}
- return (
- '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
- escapedText +
- '</span>'
- );
+ return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
+ }
},
/**
@@ -9437,7 +8650,7 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- receiveComponent: function(nextText, transaction) {
+ receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
@@ -9446,23 +8659,20 @@
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
- ReactDOMComponent.BackendIDOperations.updateTextContentByID(
- this._rootNodeID,
- nextStringText
- );
+ var node = ReactMount.getNode(this._rootNodeID);
+ DOMChildrenOperations.updateTextContent(node, nextStringText);
}
}
},
- unmountComponent: function() {
+ unmountComponent: function () {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
});
module.exports = ReactDOMTextComponent;
-
-},{"12":12,"131":131,"29":29,"40":40,"48":48}],58:[function(_dereq_,module,exports){
+},{"11":11,"121":121,"139":139,"144":144,"24":24,"35":35,"72":72,"9":9}],52:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9476,25 +8686,18 @@
'use strict';
-var AutoFocusMixin = _dereq_(2);
-var DOMPropertyOperations = _dereq_(12);
-var LinkedValueUtils = _dereq_(26);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-
-var warning = _dereq_(171);
-
-var textarea = ReactElement.createFactory('textarea');
+var LinkedValueUtils = _dereq_(23);
+var ReactDOMIDOperations = _dereq_(45);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMTextarea.updateWrapper(this);
}
}
@@ -9513,33 +8716,37 @@
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
-var ReactDOMTextarea = ReactClass.createClass({
- displayName: 'ReactDOMTextarea',
- tagName: 'TEXTAREA',
+var ReactDOMTextarea = {
+ getNativeProps: function (inst, props, context) {
+ !(props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+ // Always set children to the same thing. In IE9, the selection range will
+ // get reset if `textContent` is mutated.
+ var nativeProps = assign({}, props, {
+ defaultValue: undefined,
+ value: undefined,
+ children: inst._wrapperState.initialValue,
+ onChange: inst._wrapperState.onChange
+ });
+
+ return nativeProps;
+ },
+
+ mountWrapper: function (inst, props) {
+ if ("development" !== 'production') {
+ LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
+ }
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
+ var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
- var children = this.props.children;
+ var children = props.children;
if (children != null) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- false,
- 'Use the `defaultValue` or `value` props instead of setting ' +
- 'children on <textarea>.'
- ) : null);
- }
- ("production" !== "development" ? invariant(
- defaultValue == null,
- 'If you supply `defaultValue` on a <textarea>, do not pass children.'
- ) : invariant(defaultValue == null));
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
+ }
+ !(defaultValue == null) ? "development" !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
if (Array.isArray(children)) {
- ("production" !== "development" ? invariant(
- children.length <= 1,
- '<textarea> can only have at most one child.'
- ) : invariant(children.length <= 1));
+ !(children.length <= 1) ? "development" !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
children = children[0];
}
@@ -9548,59 +8755,38 @@
if (defaultValue == null) {
defaultValue = '';
}
- var value = LinkedValueUtils.getValue(this);
- return {
+ var value = LinkedValueUtils.getValue(props);
+
+ inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
- initialValue: '' + (value != null ? value : defaultValue)
+ initialValue: '' + (value != null ? value : defaultValue),
+ onChange: _handleChange.bind(inst)
};
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- ("production" !== "development" ? invariant(
- props.dangerouslySetInnerHTML == null,
- '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
- ) : invariant(props.dangerouslySetInnerHTML == null));
-
- props.defaultValue = null;
- props.value = null;
- props.onChange = this._handleChange;
-
- // Always set children to the same thing. In IE9, the selection range will
- // get reset if `textContent` is mutated.
- return textarea(props, this.state.initialValue);
- },
-
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var value = LinkedValueUtils.getValue(this);
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- var rootNode = this.getDOMNode();
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMTextarea;
-
-},{"100":100,"12":12,"150":150,"171":171,"2":2,"26":26,"29":29,"32":32,"38":38,"63":63}],59:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"23":23,"24":24,"45":45,"96":96}],53:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9614,15 +8800,15 @@
'use strict';
-var ReactUpdates = _dereq_(100);
-var Transaction = _dereq_(116);
+var ReactUpdates = _dereq_(96);
+var Transaction = _dereq_(113);
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
- close: function() {
+ close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
@@ -9638,15 +8824,11 @@
this.reinitializeTransaction();
}
-assign(
- ReactDefaultBatchingStrategyTransaction.prototype,
- Transaction.Mixin,
- {
- getTransactionWrappers: function() {
+assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
- }
-);
+});
var transaction = new ReactDefaultBatchingStrategyTransaction();
@@ -9657,23 +8839,22 @@
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
- batchedUpdates: function(callback, a, b, c, d) {
+ batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
- callback(a, b, c, d);
+ callback(a, b, c, d, e);
} else {
- transaction.perform(callback, null, a, b, c, d);
+ transaction.perform(callback, null, a, b, c, d, e);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
-
-},{"100":100,"116":116,"129":129,"29":29}],60:[function(_dereq_,module,exports){
+},{"113":113,"153":153,"24":24,"96":96}],54:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9688,62 +8869,39 @@
'use strict';
var BeforeInputEventPlugin = _dereq_(3);
-var ChangeEventPlugin = _dereq_(8);
-var ClientReactRootIndex = _dereq_(9);
-var DefaultEventPluginOrder = _dereq_(14);
-var EnterLeaveEventPlugin = _dereq_(15);
-var ExecutionEnvironment = _dereq_(22);
-var HTMLDOMPropertyConfig = _dereq_(24);
-var MobileSafariClickEventPlugin = _dereq_(28);
-var ReactBrowserComponentMixin = _dereq_(32);
-var ReactClass = _dereq_(38);
-var ReactComponentBrowserEnvironment =
- _dereq_(40);
-var ReactDefaultBatchingStrategy = _dereq_(59);
-var ReactDOMComponent = _dereq_(48);
-var ReactDOMButton = _dereq_(47);
-var ReactDOMForm = _dereq_(49);
-var ReactDOMImg = _dereq_(52);
-var ReactDOMIDOperations = _dereq_(50);
-var ReactDOMIframe = _dereq_(51);
-var ReactDOMInput = _dereq_(53);
-var ReactDOMOption = _dereq_(54);
-var ReactDOMSelect = _dereq_(55);
-var ReactDOMTextarea = _dereq_(58);
-var ReactDOMTextComponent = _dereq_(57);
-var ReactElement = _dereq_(63);
-var ReactEventListener = _dereq_(68);
-var ReactInjection = _dereq_(70);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMount = _dereq_(77);
-var ReactReconcileTransaction = _dereq_(88);
-var SelectEventPlugin = _dereq_(102);
-var ServerReactRootIndex = _dereq_(103);
-var SimpleEventPlugin = _dereq_(104);
-var SVGDOMPropertyConfig = _dereq_(101);
-
-var createFullPageComponent = _dereq_(125);
-
-function autoGenerateWrapperClass(type) {
- return ReactClass.createClass({
- tagName: type.toUpperCase(),
- render: function() {
- return new ReactElement(
- type,
- null,
- null,
- null,
- null,
- this.props
- );
- }
- });
-}
+var ChangeEventPlugin = _dereq_(7);
+var ClientReactRootIndex = _dereq_(8);
+var DefaultEventPluginOrder = _dereq_(13);
+var EnterLeaveEventPlugin = _dereq_(14);
+var ExecutionEnvironment = _dereq_(147);
+var HTMLDOMPropertyConfig = _dereq_(21);
+var ReactBrowserComponentMixin = _dereq_(27);
+var ReactComponentBrowserEnvironment = _dereq_(35);
+var ReactDefaultBatchingStrategy = _dereq_(53);
+var ReactDOMComponent = _dereq_(42);
+var ReactDOMTextComponent = _dereq_(51);
+var ReactEventListener = _dereq_(63);
+var ReactInjection = _dereq_(65);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMount = _dereq_(72);
+var ReactReconcileTransaction = _dereq_(83);
+var SelectEventPlugin = _dereq_(99);
+var ServerReactRootIndex = _dereq_(100);
+var SimpleEventPlugin = _dereq_(101);
+var SVGDOMPropertyConfig = _dereq_(98);
+
+var alreadyInjected = false;
function inject() {
- ReactInjection.EventEmitter.injectReactEventListener(
- ReactEventListener
- );
+ if (alreadyInjected) {
+ // TODO: This is currently true because these injections are shared between
+ // the client and the server package. They should be built independently
+ // and not share any injection state. Then this problem will be solved.
+ return;
+ }
+ alreadyInjected = true;
+
+ ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
@@ -9760,67 +8918,32 @@
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
- MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
- ReactInjection.NativeComponent.injectGenericComponentClass(
- ReactDOMComponent
- );
+ ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
- ReactInjection.NativeComponent.injectTextComponentClass(
- ReactDOMTextComponent
- );
+ ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
- ReactInjection.NativeComponent.injectAutoWrapper(
- autoGenerateWrapperClass
- );
-
- // This needs to happen before createFullPageComponent() otherwise the mixin
- // won't be included.
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
- ReactInjection.NativeComponent.injectComponentClasses({
- 'button': ReactDOMButton,
- 'form': ReactDOMForm,
- 'iframe': ReactDOMIframe,
- 'img': ReactDOMImg,
- 'input': ReactDOMInput,
- 'option': ReactDOMOption,
- 'select': ReactDOMSelect,
- 'textarea': ReactDOMTextarea,
-
- 'html': createFullPageComponent('html'),
- 'head': createFullPageComponent('head'),
- 'body': createFullPageComponent('body')
- });
-
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
- ReactInjection.Updates.injectReconcileTransaction(
- ReactReconcileTransaction
- );
- ReactInjection.Updates.injectBatchingStrategy(
- ReactDefaultBatchingStrategy
- );
+ ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
+ ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
- ReactInjection.RootIndex.injectCreateReactRootIndex(
- ExecutionEnvironment.canUseDOM ?
- ClientReactRootIndex.createReactRootIndex :
- ServerReactRootIndex.createReactRootIndex
- );
+ ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
- ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
- if ("production" !== "development") {
- var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
- if ((/[?&]react_perf\b/).test(url)) {
- var ReactDefaultPerf = _dereq_(61);
+ if ("development" !== 'production') {
+ var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
+ if (/[?&]react_perf\b/.test(url)) {
+ var ReactDefaultPerf = _dereq_(55);
ReactDefaultPerf.start();
}
}
@@ -9829,8 +8952,7 @@
module.exports = {
inject: inject
};
-
-},{"101":101,"102":102,"103":103,"104":104,"125":125,"14":14,"15":15,"22":22,"24":24,"28":28,"3":3,"32":32,"38":38,"40":40,"47":47,"48":48,"49":49,"50":50,"51":51,"52":52,"53":53,"54":54,"55":55,"57":57,"58":58,"59":59,"61":61,"63":63,"68":68,"70":70,"72":72,"77":77,"8":8,"88":88,"9":9}],61:[function(_dereq_,module,exports){
+},{"100":100,"101":101,"13":13,"14":14,"147":147,"21":21,"27":27,"3":3,"35":35,"42":42,"51":51,"53":53,"55":55,"63":63,"65":65,"67":67,"7":7,"72":72,"8":8,"83":83,"98":98,"99":99}],55:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9845,12 +8967,12 @@
'use strict';
-var DOMProperty = _dereq_(11);
-var ReactDefaultPerfAnalysis = _dereq_(62);
-var ReactMount = _dereq_(77);
-var ReactPerf = _dereq_(82);
+var DOMProperty = _dereq_(10);
+var ReactDefaultPerfAnalysis = _dereq_(56);
+var ReactMount = _dereq_(72);
+var ReactPerf = _dereq_(78);
-var performanceNow = _dereq_(162);
+var performanceNow = _dereq_(170);
function roundFloat(val) {
return Math.floor(val * 100) / 100;
@@ -9865,7 +8987,7 @@
_mountStack: [0],
_injected: false,
- start: function() {
+ start: function () {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
@@ -9874,18 +8996,18 @@
ReactPerf.enableMeasure = true;
},
- stop: function() {
+ stop: function () {
ReactPerf.enableMeasure = false;
},
- getLastMeasurements: function() {
+ getLastMeasurements: function () {
return ReactDefaultPerf._allMeasurements;
},
- printExclusive: function(measurements) {
+ printExclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
@@ -9900,28 +9022,22 @@
// number.
},
- printInclusive: function(measurements) {
+ printInclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- getMeasurementsSummaryMap: function(measurements) {
- var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
- measurements,
- true
- );
- return summary.map(function(item) {
+ getMeasurementsSummaryMap: function (measurements) {
+ var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
+ return summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
@@ -9930,37 +9046,28 @@
});
},
- printWasted: function(measurements) {
+ printWasted: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- printDOM: function(measurements) {
+ printDOM: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
- result['type'] = item.type;
- result['args'] = JSON.stringify(item.args);
+ result.type = item.type;
+ result.args = JSON.stringify(item.args);
return result;
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- _recordWrite: function(id, fnName, totalTime, args) {
+ _recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
- var writes =
- ReactDefaultPerf
- ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
- .writes;
+ var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
@@ -9969,14 +9076,17 @@
});
},
- measure: function(moduleName, fnName, func) {
- return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ measure: function (moduleName, fnName, func) {
+ return function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
var totalTime;
var rv;
var start;
- if (fnName === '_renderNewRootComponent' ||
- fnName === 'flushBatchedUpdates') {
+ if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
@@ -9988,16 +9098,14 @@
counts: {},
writes: {},
displayNames: {},
- totalTime: 0
+ totalTime: 0,
+ created: {}
});
start = performanceNow();
rv = func.apply(this, args);
- ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ].totalTime = performanceNow() - start;
+ ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
return rv;
- } else if (fnName === '_mountImageIntoNode' ||
- moduleName === 'ReactDOMIDOperations') {
+ } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
@@ -10007,7 +9115,7 @@
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
- args[0].forEach(function(update) {
+ args[0].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
@@ -10021,46 +9129,35 @@
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
- ReactDefaultPerf._recordWrite(
- update.parentID,
- update.type,
- totalTime,
- writeArgs
- );
+ ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
});
} else {
// basic format
- ReactDefaultPerf._recordWrite(
- args[0],
- fnName,
- totalTime,
- Array.prototype.slice.call(args, 1)
- );
+ var id = args[0];
+ if (typeof id === 'object') {
+ id = ReactMount.getID(args[0]);
+ }
+ ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
return rv;
- } else if (moduleName === 'ReactCompositeComponent' && (
- (// TODO: receiveComponent()?
- (fnName === 'mountComponent' ||
- fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
+ } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
+ fnName === '_renderValidatedComponent')) {
- if (typeof this._currentElement.type === 'string') {
+ if (this._currentElement.type === ReactMount.TopLevelWrapper) {
return func.apply(this, args);
}
- var rootNodeID = fnName === 'mountComponent' ?
- args[0] :
- this._rootNodeID;
+ var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
- var entry = ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ];
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
+ entry.created[rootNodeID] = true;
mountStack.push(0);
}
@@ -10081,9 +9178,7 @@
entry.displayNames[rootNodeID] = {
current: this.getName(),
- owner: this._currentElement._owner ?
- this._currentElement._owner.getName() :
- '<root>'
+ owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
};
return rv;
@@ -10095,8 +9190,7 @@
};
module.exports = ReactDefaultPerf;
-
-},{"11":11,"162":162,"62":62,"77":77,"82":82}],62:[function(_dereq_,module,exports){
+},{"10":10,"170":170,"56":56,"72":72,"78":78}],56:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -10108,7 +9202,9 @@
* @providesModule ReactDefaultPerfAnalysis
*/
-var assign = _dereq_(29);
+'use strict';
+
+var assign = _dereq_(24);
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
@@ -10117,12 +9213,14 @@
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
+ SET_MARKUP: 'set innerHTML',
TEXT_CONTENT: 'set textContent',
- 'updatePropertyByID': 'update attribute',
- 'deletePropertyByID': 'delete attribute',
- 'updateStylesByID': 'update styles',
- 'updateInnerHTMLByID': 'set innerHTML',
- 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
+ 'setValueForProperty': 'update attribute',
+ 'setValueForAttribute': 'update attribute',
+ 'deleteValueForProperty': 'remove attribute',
+ 'setValueForStyles': 'update styles',
+ 'replaceNodeWithMarkup': 'replace',
+ 'updateTextContent': 'set textContent'
};
function getTotalTime(measurements) {
@@ -10140,20 +9238,17 @@
function getDOMSummary(measurements) {
var items = [];
- for (var i = 0; i < measurements.length; i++) {
- var measurement = measurements[i];
- var id;
-
- for (id in measurement.writes) {
- measurement.writes[id].forEach(function(write) {
+ measurements.forEach(function (measurement) {
+ Object.keys(measurement.writes).forEach(function (id) {
+ measurement.writes[id].forEach(function (write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
- }
- }
+ });
+ });
return items;
}
@@ -10163,11 +9258,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
@@ -10202,7 +9293,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.exclusive - a.exclusive;
});
@@ -10215,11 +9306,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
@@ -10261,7 +9348,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.time - a.time;
});
@@ -10286,6 +9373,10 @@
break;
}
}
+ // check if component newly created
+ if (measurement.created[id]) {
+ isDirty = true;
+ }
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
@@ -10301,8 +9392,7 @@
};
module.exports = ReactDefaultPerfAnalysis;
-
-},{"29":29}],63:[function(_dereq_,module,exports){
+},{"24":24}],57:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -10316,142 +9406,101 @@
'use strict';
-var ReactContext = _dereq_(44);
-var ReactCurrentOwner = _dereq_(45);
+var ReactCurrentOwner = _dereq_(39);
-var assign = _dereq_(29);
-var warning = _dereq_(171);
+var assign = _dereq_(24);
+var canDefineProperty = _dereq_(117);
+
+// The Symbol used to tag the ReactElement type. If there is no native Symbol
+// nor polyfill, then a plain number is used for performance.
+var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
- ref: true
+ ref: true,
+ __self: true,
+ __source: true
};
/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} object
- * @param {string} key
- */
-function defineWarningProperty(object, key) {
- Object.defineProperty(object, key, {
-
- configurable: false,
- enumerable: true,
-
- get: function() {
- if (!this._store) {
- return null;
- }
- return this._store[key];
- },
-
- set: function(value) {
- ("production" !== "development" ? warning(
- false,
- 'Don\'t set the %s property of the React element. Instead, ' +
- 'specify the correct value when initially creating the element.',
- key
- ) : null);
- this._store[key] = value;
- }
-
- });
-}
-
-/**
- * This is updated to true if the membrane is successfully created.
- */
-var useMutationMembrane = false;
-
-/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} element
- */
-function defineMutationMembrane(prototype) {
- try {
- var pseudoFrozenProperties = {
- props: true
- };
- for (var key in pseudoFrozenProperties) {
- defineWarningProperty(prototype, key);
- }
- useMutationMembrane = true;
- } catch (x) {
- // IE will fail on defineProperty
- }
-}
-
-/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
- * @param {string|object} ref
* @param {*} key
+ * @param {string|object} ref
+ * @param {*} self A *temporary* helper to detect places where `this` is
+ * different from the `owner` when React.createElement is called, so that we
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
+ * functions, and as long as `this` and owner are the same, there will be no
+ * change in behavior.
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
+ * indicating filename, line number, and/or other information.
+ * @param {*} owner
* @param {*} props
* @internal
*/
-var ReactElement = function(type, key, ref, owner, context, props) {
+var ReactElement = function (type, key, ref, self, source, owner, props) {
+ var element = {
+ // This tag allow us to uniquely identify this as a React Element
+ $$typeof: REACT_ELEMENT_TYPE,
+
// Built-in properties that belong on the element
- this.type = type;
- this.key = key;
- this.ref = ref;
+ type: type,
+ key: key,
+ ref: ref,
+ props: props,
// Record the component responsible for creating this element.
- this._owner = owner;
-
- // TODO: Deprecate withContext, and then the context becomes accessible
- // through the owner.
- this._context = context;
+ _owner: owner
+ };
- if ("production" !== "development") {
- // The validation flag and props are currently mutative. We put them on
+ if ("development" !== 'production') {
+ // The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
- this._store = {props: props, originalProps: assign({}, props)};
+ element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
- try {
- Object.defineProperty(this._store, 'validated', {
+ if (canDefineProperty) {
+ Object.defineProperty(element._store, 'validated', {
+ configurable: false,
+ enumerable: false,
+ writable: true,
+ value: false
+ });
+ // self and source are DEV only properties.
+ Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
- writable: true
+ writable: false,
+ value: self
});
- } catch (x) {
- }
- this._store.validated = false;
-
- // We're not allowed to set props directly on the object so we early
- // return and rely on the prototype membrane to forward to the backing
- // store.
- if (useMutationMembrane) {
- Object.freeze(this);
- return;
+ // Two elements created in two different places should be considered
+ // equal for testing purposes and therefore we hide it from enumeration.
+ Object.defineProperty(element, '_source', {
+ configurable: false,
+ enumerable: false,
+ writable: false,
+ value: source
+ });
+ } else {
+ element._store.validated = false;
+ element._self = self;
+ element._source = source;
}
+ Object.freeze(element.props);
+ Object.freeze(element);
}
- this.props = props;
-};
-
-// We intentionally don't expose the function on the constructor property.
-// ReactElement should be indistinguishable from a plain object.
-ReactElement.prototype = {
- _isReactElement: true
+ return element;
};
-if ("production" !== "development") {
- defineMutationMembrane(ReactElement.prototype);
-}
-
-ReactElement.createElement = function(type, config, children) {
+ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
@@ -10459,14 +9508,17 @@
var key = null;
var ref = null;
+ var self = null;
+ var source = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
+ self = config.__self === undefined ? null : config.__self;
+ source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -10495,20 +9547,13 @@
}
}
- return new ReactElement(
- type,
- key,
- ref,
- ReactCurrentOwner.current,
- ReactContext.current,
- props
- );
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
-ReactElement.createFactory = function(type) {
+ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
- // easily accessed on elements. E.g. <Foo />.type === Foo.type.
+ // easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
@@ -10516,17 +9561,16 @@
return factory;
};
-ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
- var newElement = new ReactElement(
- oldElement.type,
- oldElement.key,
- oldElement.ref,
- oldElement._owner,
- oldElement._context,
- newProps
- );
+ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
+
+ return newElement;
+};
+
+ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
+ var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
@@ -10530,10 +9574,11 @@
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
+
return newElement;
};
-ReactElement.cloneElement = function(element, config, children) {
+ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
@@ -10542,6 +9587,12 @@
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
+ // Self is preserved since the owner is preserved.
+ var self = element._self;
+ // Source is preserved since cloneElement is unlikely to be targeted by a
+ // transpiler, and the original source is probably a better indicator of the
+ // true owner.
+ var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
@@ -10557,8 +9608,7 @@
}
// Remaining properties override existing props
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -10577,14 +9627,7 @@
props.children = childArray;
}
- return new ReactElement(
- element.type,
- key,
- ref,
- owner,
- element._context,
- props
- );
+ return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
@@ -10592,23 +9635,12 @@
* @return {boolean} True if `object` is a valid component.
* @final
*/
-ReactElement.isValidElement = function(object) {
- // ReactTestUtils is often used outside of beforeEach where as React is
- // within it. This leads to two different instances of React on the same
- // page. To identify a element from a different React instance we use
- // a flag instead of an instanceof check.
- var isElement = !!(object && object._isReactElement);
- // if (isElement && !(object instanceof ReactElement)) {
- // This is an indicator that you're using multiple versions of React at the
- // same time. This will screw with ownership and stuff. Fix it, please.
- // TODO: We could possibly warn here.
- // }
- return isElement;
+ReactElement.isValidElement = function (object) {
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;
-
-},{"171":171,"29":29,"44":44,"45":45}],64:[function(_dereq_,module,exports){
+},{"117":117,"24":24,"39":39}],58:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -10629,16 +9661,15 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactFragment = _dereq_(69);
-var ReactPropTypeLocations = _dereq_(85);
-var ReactPropTypeLocationNames = _dereq_(84);
-var ReactCurrentOwner = _dereq_(45);
-var ReactNativeComponent = _dereq_(80);
-
-var getIteratorFn = _dereq_(141);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactElement = _dereq_(57);
+var ReactPropTypeLocations = _dereq_(81);
+var ReactPropTypeLocationNames = _dereq_(80);
+var ReactCurrentOwner = _dereq_(39);
+
+var canDefineProperty = _dereq_(117);
+var getIteratorFn = _dereq_(129);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
@@ -10659,39 +9690,6 @@
var loggedTypeFailures = {};
-var NUMERIC_PROPERTY_REGEX = /^\d+$/;
-
-/**
- * Gets the instance's name for use in warnings.
- *
- * @internal
- * @return {?string} Display name or undefined
- */
-function getName(instance) {
- var publicInstance = instance && instance.getPublicInstance();
- if (!publicInstance) {
- return undefined;
- }
- var constructor = publicInstance.constructor;
- if (!constructor) {
- return undefined;
- }
- return constructor.displayName || constructor.name || undefined;
-}
-
-/**
- * Gets the current owner's displayName for use in warnings.
- *
- * @internal
- * @return {?string} Display name or undefined
- */
-function getCurrentOwnerDisplayName() {
- var current = ReactCurrentOwner.current;
- return (
- current && getName(current) || undefined
- );
-}
-
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
@@ -10703,84 +9701,59 @@
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
- if (element._store.validated || element.key != null) {
+ if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
- warnAndMonitorForKeyUse(
- 'Each child in an array or iterator should have a unique "key" prop.',
- element,
- parentType
- );
-}
-
-/**
- * Warn if the key is being defined as an object property but has an incorrect
- * value.
- *
- * @internal
- * @param {string} name Property name of the key.
- * @param {ReactElement} element Component that requires a key.
- * @param {*} parentType element's parent's type.
- */
-function validatePropertyKey(name, element, parentType) {
- if (!NUMERIC_PROPERTY_REGEX.test(name)) {
+ var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
+ if (addenda === null) {
+ // we already showed the warning
return;
}
- warnAndMonitorForKeyUse(
- 'Child objects should have non-numeric keys so ordering is preserved.',
- element,
- parentType
- );
+ "development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
- * @param {string} message The base warning that gets output.
+ * @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
+ * @returns {?object} A set of addenda to use in the warning message, or null
+ * if the warning has already been shown before (and shouldn't be shown again).
*/
-function warnAndMonitorForKeyUse(message, element, parentType) {
- var ownerName = getCurrentOwnerDisplayName();
- var parentName = typeof parentType === 'string' ?
- parentType : parentType.displayName || parentType.name;
-
- var useName = ownerName || parentName;
- var memoizer = ownerHasKeyUseWarning[message] || (
- (ownerHasKeyUseWarning[message] = {})
- );
- if (memoizer.hasOwnProperty(useName)) {
- return;
+function getAddendaForKeyUse(messageType, element, parentType) {
+ var addendum = getDeclarationErrorAddendum();
+ if (!addendum) {
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
+ if (parentName) {
+ addendum = ' Check the top-level render call using <' + parentName + '>.';
+ }
}
- memoizer[useName] = true;
- var parentOrOwnerAddendum =
- ownerName ? (" Check the render method of " + ownerName + ".") :
- parentName ? (" Check the React.render call using <" + parentName + ">.") :
- '';
+ var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
+ if (memoizer[addendum]) {
+ return null;
+ }
+ memoizer[addendum] = true;
+
+ var addenda = {
+ parentOrOwner: addendum,
+ url: ' See https://fb.me/react-warning-keys for more information.',
+ childOwner: null
+ };
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
- var childOwnerAddendum = '';
- if (element &&
- element._owner &&
- element._owner !== ReactCurrentOwner.current) {
- // Name of the component that originally created this child.
- var childOwnerName = getName(element._owner);
-
- childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
- }
-
- ("production" !== "development" ? warning(
- false,
- message + '%s%s See https://fb.me/react-warning-keys for more information.',
- parentOrOwnerAddendum,
- childOwnerAddendum
- ) : null);
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
+ // Give the component that originally created this child.
+ addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
+ }
+
+ return addenda;
}
/**
@@ -10793,6 +9766,9 @@
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
+ if (typeof node !== 'object') {
+ return;
+ }
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
@@ -10802,7 +9778,9 @@
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
+ if (node._store) {
node._store.validated = true;
+ }
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
@@ -10816,13 +9794,6 @@
}
}
}
- } else if (typeof node === 'object') {
- var fragment = ReactFragment.extractIfFragment(node);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- validatePropertyKey(key, fragment[key], parentType);
- }
- }
}
}
}
@@ -10846,109 +9817,19 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== "development" ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
+ "development" !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
- var addendum = getDeclarationErrorAddendum(this);
- ("production" !== "development" ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
- }
- }
- }
-}
-
-var warnedPropsMutations = {};
-
-/**
- * Warn about mutating props when setting `propName` on `element`.
- *
- * @param {string} propName The string key within props that was set
- * @param {ReactElement} element
- */
-function warnForPropsMutation(propName, element) {
- var type = element.type;
- var elementName = typeof type === 'string' ? type : type.displayName;
- var ownerName = element._owner ?
- element._owner.getPublicInstance().constructor.displayName : null;
-
- var warningKey = propName + '|' + elementName + '|' + ownerName;
- if (warnedPropsMutations.hasOwnProperty(warningKey)) {
- return;
- }
- warnedPropsMutations[warningKey] = true;
-
- var elementInfo = '';
- if (elementName) {
- elementInfo = ' <' + elementName + ' />';
- }
- var ownerInfo = '';
- if (ownerName) {
- ownerInfo = ' The element was created by ' + ownerName + '.';
- }
-
- ("production" !== "development" ? warning(
- false,
- 'Don\'t set .props.%s of the React component%s. Instead, specify the ' +
- 'correct value when initially creating the element or use ' +
- 'React.cloneElement to make a new element with updated props.%s',
- propName,
- elementInfo,
- ownerInfo
- ) : null);
-}
-
-// Inline Object.is polyfill
-function is(a, b) {
- if (a !== a) {
- // NaN
- return b !== b;
- }
- if (a === 0 && b === 0) {
- // +-0
- return 1 / a === 1 / b;
- }
- return a === b;
-}
-
-/**
- * Given an element, check if its props have been mutated since element
- * creation (or the last call to this function). In particular, check if any
- * new props have been added, which we can't directly catch by defining warning
- * properties on the props object.
- *
- * @param {ReactElement} element
- */
-function checkAndWarnForMutatedProps(element) {
- if (!element._store) {
- // Element was created using `new ReactElement` directly or with
- // `ReactElement.createElement`; skip mutation checking
- return;
- }
-
- var originalProps = element._store.originalProps;
- var props = element.props;
-
- for (var propName in props) {
- if (props.hasOwnProperty(propName)) {
- if (!originalProps.hasOwnProperty(propName) ||
- !is(originalProps[propName], props[propName])) {
- warnForPropsMutation(propName, element);
-
- // Copy over the new value so that the two props objects match again
- originalProps[propName] = props[propName];
+ var addendum = getDeclarationErrorAddendum();
+ "development" !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
}
}
}
@@ -10961,48 +9842,26 @@
* @param {ReactElement} element
*/
function validatePropTypes(element) {
- if (element.type == null) {
- // This has already warned. Don't throw.
+ var componentClass = element.type;
+ if (typeof componentClass !== 'function') {
return;
}
- // Extract the component class from the element. Converts string types
- // to a composite class which may have propTypes.
- // TODO: Validating a string's propTypes is not decoupled from the
- // rendering target which is problematic.
- var componentClass = ReactNativeComponent.getComponentClassForElement(
- element
- );
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
- checkPropTypes(
- name,
- componentClass.propTypes,
- element.props,
- ReactPropTypeLocations.prop
- );
+ checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
- ("production" !== "development" ? warning(
- componentClass.getDefaultProps.isReactClassApproved,
- 'getDefaultProps is only used on classic React.createClass ' +
- 'definitions. Use a static property named `defaultProps` instead.'
- ) : null);
+ "development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
}
}
var ReactElementValidator = {
- checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
-
- createElement: function(type, props, children) {
+ createElement: function (type, props, children) {
+ var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
- ("production" !== "development" ? warning(
- type != null,
- 'React.createElement: type should not be null or undefined. It should ' +
- 'be a string (for DOM elements) or a ReactClass (for composite ' +
- 'components).'
- ) : null);
+ "development" !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
var element = ReactElement.createElement.apply(this, arguments);
@@ -11012,45 +9871,39 @@
return element;
}
+ // Skip key warning if the type isn't valid since our key validation logic
+ // doesn't expect a non-string/function type and can throw confusing errors.
+ // We don't want exception behavior to differ between dev and prod.
+ // (Rendering will throw with a helpful message and as soon as the type is
+ // fixed, the key warnings will appear.)
+ if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
+ }
validatePropTypes(element);
return element;
},
- createFactory: function(type) {
- var validatedFactory = ReactElementValidator.createElement.bind(
- null,
- type
- );
+ createFactory: function (type) {
+ var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
- if ("production" !== "development") {
- try {
- Object.defineProperty(
- validatedFactory,
- 'type',
- {
+ if ("development" !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
- get: function() {
- ("production" !== "development" ? warning(
- false,
- 'Factory.type is deprecated. Access the class directly ' +
- 'before passing it to createFactory.'
- ) : null);
+ get: function () {
+ "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
- }
- );
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
+ });
}
}
@@ -11054,11 +9907,10 @@
}
}
-
return validatedFactory;
},
- cloneElement: function(element, props, children) {
+ cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
@@ -11070,8 +9922,7 @@
};
module.exports = ReactElementValidator;
-
-},{"141":141,"150":150,"171":171,"45":45,"63":63,"69":69,"80":80,"84":84,"85":85}],65:[function(_dereq_,module,exports){
+},{"117":117,"129":129,"161":161,"173":173,"39":39,"57":57,"80":80,"81":81}],59:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -11085,52 +9936,73 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactInstanceMap = _dereq_(73);
+var ReactElement = _dereq_(57);
+var ReactEmptyComponentRegistry = _dereq_(60);
+var ReactReconciler = _dereq_(84);
-var invariant = _dereq_(150);
+var assign = _dereq_(24);
-var component;
-// This registry keeps track of the React IDs of the components that rendered to
-// `null` (in reality a placeholder such as `noscript`)
-var nullComponentIDsRegistry = {};
+var placeholderElement;
var ReactEmptyComponentInjection = {
- injectEmptyComponent: function(emptyComponent) {
- component = ReactElement.createFactory(emptyComponent);
+ injectEmptyComponent: function (component) {
+ placeholderElement = ReactElement.createElement(component);
}
};
-var ReactEmptyComponentType = function() {};
-ReactEmptyComponentType.prototype.componentDidMount = function() {
- var internalInstance = ReactInstanceMap.get(this);
- // TODO: Make sure we run these methods in the correct order, we shouldn't
- // need this check. We're going to assume if we're here it means we ran
- // componentWillUnmount already so there is no internal instance (it gets
- // removed as part of the unmounting process).
- if (!internalInstance) {
- return;
- }
- registerNullComponentID(internalInstance._rootNodeID);
+function registerNullComponentID() {
+ ReactEmptyComponentRegistry.registerNullComponentID(this._rootNodeID);
+}
+
+var ReactEmptyComponent = function (instantiate) {
+ this._currentElement = null;
+ this._rootNodeID = null;
+ this._renderedComponent = instantiate(placeholderElement);
};
-ReactEmptyComponentType.prototype.componentWillUnmount = function() {
- var internalInstance = ReactInstanceMap.get(this);
- // TODO: Get rid of this check. See TODO in componentDidMount.
- if (!internalInstance) {
- return;
+assign(ReactEmptyComponent.prototype, {
+ construct: function (element) {},
+ mountComponent: function (rootID, transaction, context) {
+ transaction.getReactMountReady().enqueue(registerNullComponentID, this);
+ this._rootNodeID = rootID;
+ return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
+ },
+ receiveComponent: function () {},
+ unmountComponent: function (rootID, transaction, context) {
+ ReactReconciler.unmountComponent(this._renderedComponent);
+ ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
+ this._rootNodeID = null;
+ this._renderedComponent = null;
}
- deregisterNullComponentID(internalInstance._rootNodeID);
-};
-ReactEmptyComponentType.prototype.render = function() {
- ("production" !== "development" ? invariant(
- component,
- 'Trying to return null from a render, but no null placeholder component ' +
- 'was injected.'
- ) : invariant(component));
- return component();
-};
+});
-var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
+ReactEmptyComponent.injection = ReactEmptyComponentInjection;
+
+module.exports = ReactEmptyComponent;
+},{"24":24,"57":57,"60":60,"84":84}],60:[function(_dereq_,module,exports){
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactEmptyComponentRegistry
+ */
+
+'use strict';
+
+// This registry keeps track of the React IDs of the components that rendered to
+// `null` (in reality a placeholder such as `noscript`)
+var nullComponentIDsRegistry = {};
+
+/**
+ * @param {string} id Component's `_rootNodeID`.
+ * @return {boolean} True if the component is rendered to null.
+ */
+function isNullComponentID(id) {
+ return !!nullComponentIDsRegistry[id];
+}
/**
* Mark the component as having rendered to null.
@@ -11148,23 +10020,14 @@
delete nullComponentIDsRegistry[id];
}
-/**
- * @param {string} id Component's `_rootNodeID`.
- * @return {boolean} True if the component is rendered to null.
- */
-function isNullComponentID(id) {
- return !!nullComponentIDsRegistry[id];
-}
-
-var ReactEmptyComponent = {
- emptyElement: emptyElement,
- injection: ReactEmptyComponentInjection,
- isNullComponentID: isNullComponentID
+var ReactEmptyComponentRegistry = {
+ isNullComponentID: isNullComponentID,
+ registerNullComponentID: registerNullComponentID,
+ deregisterNullComponentID: deregisterNullComponentID
};
-module.exports = ReactEmptyComponent;
-
-},{"150":150,"63":63,"73":73}],66:[function(_dereq_,module,exports){
+module.exports = ReactEmptyComponentRegistry;
+},{}],61:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11177,26 +10040,72 @@
* @typechecks
*/
-"use strict";
+'use strict';
+
+var caughtError = null;
+
+/**
+ * Call a function while guarding against errors that happens within it.
+ *
+ * @param {?String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} a First argument
+ * @param {*} b Second argument
+ */
+function invokeGuardedCallback(name, func, a, b) {
+ try {
+ return func(a, b);
+ } catch (x) {
+ if (caughtError === null) {
+ caughtError = x;
+ }
+ return undefined;
+ }
+}
var ReactErrorUtils = {
+ invokeGuardedCallback: invokeGuardedCallback,
+
/**
- * Creates a guarded version of a function. This is supposed to make debugging
- * of event handlers easier. To aid debugging with the browser's debugger,
- * this currently simply returns the original function.
- *
- * @param {function} func Function to be executed
- * @param {string} name The name of the guard
- * @return {function}
+ * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
+ * handler are sure to be rethrown by rethrowCaughtError.
*/
- guard: function(func, name) {
- return func;
+ invokeGuardedCallbackWithCatch: invokeGuardedCallback,
+
+ /**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+ rethrowCaughtError: function () {
+ if (caughtError) {
+ var error = caughtError;
+ caughtError = null;
+ throw error;
+ }
}
};
-module.exports = ReactErrorUtils;
+if ("development" !== 'production') {
+ /**
+ * To help development we can get better devtools integration by simulating a
+ * real browser event.
+ */
+ if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
+ var fakeNode = document.createElement('react');
+ ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
+ var boundFunc = func.bind(null, a, b);
+ var evtType = 'react-' + name;
+ fakeNode.addEventListener(evtType, boundFunc, false);
+ var evt = document.createEvent('Event');
+ evt.initEvent(evtType, false, false);
+ fakeNode.dispatchEvent(evt);
+ fakeNode.removeEventListener(evtType, boundFunc, false);
+ };
+ }
+}
-},{}],67:[function(_dereq_,module,exports){
+module.exports = ReactErrorUtils;
+},{}],62:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11210,11 +10119,11 @@
'use strict';
-var EventPluginHub = _dereq_(18);
+var EventPluginHub = _dereq_(16);
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
@@ -11228,25 +10137,14 @@
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
- handleTopLevel: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- var events = EventPluginHub.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
-
+ handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
-
-},{"18":18}],68:[function(_dereq_,module,exports){
+},{"16":16}],63:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11261,16 +10159,18 @@
'use strict';
-var EventListener = _dereq_(17);
-var ExecutionEnvironment = _dereq_(22);
-var PooledClass = _dereq_(30);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMount = _dereq_(77);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var getEventTarget = _dereq_(140);
-var getUnboundedScrollPosition = _dereq_(146);
+var EventListener = _dereq_(146);
+var ExecutionEnvironment = _dereq_(147);
+var PooledClass = _dereq_(25);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var getEventTarget = _dereq_(128);
+var getUnboundedScrollPosition = _dereq_(158);
+
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* Finds the parent React component of `node`.
@@ -11297,21 +10197,32 @@
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
- destructor: function() {
+ destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
-PooledClass.addPoolingTo(
- TopLevelCallbackBookKeeping,
- PooledClass.twoArgumentPooler
-);
+PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
- var topLevelTarget = ReactMount.getFirstReactDOM(
- getEventTarget(bookKeeping.nativeEvent)
- ) || window;
+ // TODO: Re-enable event.path handling
+ //
+ // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
+ // // New browsers have a path attribute on native events
+ // handleTopLevelWithPath(bookKeeping);
+ // } else {
+ // // Legacy browsers don't have a path attribute on native events
+ // handleTopLevelWithoutPath(bookKeeping);
+ // }
+
+ void handleTopLevelWithPath; // temporarily unused
+ handleTopLevelWithoutPath(bookKeeping);
+}
+
+// Legacy browsers don't have a path attribute on native events
+function handleTopLevelWithoutPath(bookKeeping) {
+ var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
@@ -11323,15 +10234,44 @@
ancestor = findParent(ancestor);
}
- for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
+ for (var i = 0; i < bookKeeping.ancestors.length; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
- ReactEventListener._handleTopLevel(
- bookKeeping.topLevelType,
- topLevelTarget,
- topLevelTargetID,
- bookKeeping.nativeEvent
- );
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
+ }
+}
+
+// New browsers have a path attribute on native events
+function handleTopLevelWithPath(bookKeeping) {
+ var path = bookKeeping.nativeEvent.path;
+ var currentNativeTarget = path[0];
+ var eventsFired = 0;
+ for (var i = 0; i < path.length; i++) {
+ var currentPathElement = path[i];
+ if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
+ currentNativeTarget = path[i + 1];
+ }
+ // TODO: slow
+ var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
+ if (reactParent === currentPathElement) {
+ var currentPathElementID = ReactMount.getID(currentPathElement);
+ var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
+ bookKeeping.ancestors.push(currentPathElement);
+
+ var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
+ eventsFired++;
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
+
+ // Jump to the root of this React render tree
+ while (currentPathElementID !== newRootID) {
+ i++;
+ currentPathElement = path[i];
+ currentPathElementID = ReactMount.getID(currentPathElement);
+ }
+ }
+ }
+ if (eventsFired === 0) {
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
@@ -11346,15 +10286,15 @@
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
- setHandleTopLevel: function(handleTopLevel) {
+ setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
- isEnabled: function() {
+ isEnabled: function () {
return ReactEventListener._enabled;
},
@@ -11358,27 +10298,22 @@
return ReactEventListener._enabled;
},
-
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.listen(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
@@ -11387,36 +10322,29 @@
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.capture(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
- monitorScrollValue: function(refresh) {
+ monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
- dispatchEvent: function(topLevelType, nativeEvent) {
+ dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
- var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
- topLevelType,
- nativeEvent
- );
+ var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
@@ -11428,8 +10356,7 @@
};
module.exports = ReactEventListener;
-
-},{"100":100,"140":140,"146":146,"17":17,"22":22,"29":29,"30":30,"72":72,"77":77}],69:[function(_dereq_,module,exports){
+},{"128":128,"146":146,"147":147,"158":158,"24":24,"25":25,"67":67,"72":72,"96":96}],64:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
@@ -11438,181 +10365,63 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
-* @providesModule ReactFragment
-*/
+ * @providesModule ReactFragment
+ */
'use strict';
-var ReactElement = _dereq_(63);
+var ReactChildren = _dereq_(32);
+var ReactElement = _dereq_(57);
-var warning = _dereq_(171);
+var emptyFunction = _dereq_(153);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* We used to allow keyed objects to serve as a collection of ReactElements,
* or nested sets. This allowed us a way to explicitly key a set a fragment of
* components. This is now being replaced with an opaque data structure.
* The upgrade path is to call React.addons.createFragment({ key: value }) to
- * create a keyed fragment. The resulting data structure is opaque, for now.
+ * create a keyed fragment. The resulting data structure is an array.
*/
-if ("production" !== "development") {
- var fragmentKey = '_reactFragment';
- var didWarnKey = '_reactDidWarn';
- var canWarnForReactFragment = false;
-
- try {
- // Feature test. Don't even try to issue this warning if we can't use
- // enumerable: false.
-
- var dummy = function() {
- return 1;
- };
-
- Object.defineProperty(
- {},
- fragmentKey,
- {enumerable: false, value: true}
- );
-
- Object.defineProperty(
- {},
- 'key',
- {enumerable: true, get: dummy}
- );
+var numericPropertyRegex = /^\d+$/;
- canWarnForReactFragment = true;
- } catch (x) { }
-
- var proxyPropertyAccessWithWarning = function(obj, key) {
- Object.defineProperty(obj, key, {
- enumerable: true,
- get: function() {
- ("production" !== "development" ? warning(
- this[didWarnKey],
- 'A ReactFragment is an opaque type. Accessing any of its ' +
- 'properties is deprecated. Pass it to one of the React.Children ' +
- 'helpers.'
- ) : null);
- this[didWarnKey] = true;
- return this[fragmentKey][key];
- },
- set: function(value) {
- ("production" !== "development" ? warning(
- this[didWarnKey],
- 'A ReactFragment is an immutable opaque type. Mutating its ' +
- 'properties is deprecated.'
- ) : null);
- this[didWarnKey] = true;
- this[fragmentKey][key] = value;
- }
- });
- };
-
- var issuedWarnings = {};
-
- var didWarnForFragment = function(fragment) {
- // We use the keys and the type of the value as a heuristic to dedupe the
- // warning to avoid spamming too much.
- var fragmentCacheKey = '';
- for (var key in fragment) {
- fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
- }
- var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
- issuedWarnings[fragmentCacheKey] = true;
- return alreadyWarnedOnce;
- };
-}
+var warnedAboutNumeric = false;
var ReactFragment = {
// Wrap a keyed object in an opaque proxy that warns you if you access any
// of its properties.
- create: function(object) {
- if ("production" !== "development") {
+ create: function (object) {
if (typeof object !== 'object' || !object || Array.isArray(object)) {
- ("production" !== "development" ? warning(
- false,
- 'React.addons.createFragment only accepts a single object.',
- object
- ) : null);
+ "development" !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
return object;
}
if (ReactElement.isValidElement(object)) {
- ("production" !== "development" ? warning(
- false,
- 'React.addons.createFragment does not accept a ReactElement ' +
- 'without a wrapper object.'
- ) : null);
+ "development" !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
return object;
}
- if (canWarnForReactFragment) {
- var proxy = {};
- Object.defineProperty(proxy, fragmentKey, {
- enumerable: false,
- value: object
- });
- Object.defineProperty(proxy, didWarnKey, {
- writable: true,
- enumerable: false,
- value: false
- });
+
+ !(object.nodeType !== 1) ? "development" !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
+
+ var result = [];
+
for (var key in object) {
- proxyPropertyAccessWithWarning(proxy, key);
+ if ("development" !== 'production') {
+ if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
+ "development" !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
+ warnedAboutNumeric = true;
}
- Object.preventExtensions(proxy);
- return proxy;
}
+ ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
}
- return object;
- },
- // Extract the original keyed object from the fragment opaque type. Warn if
- // a plain object is passed here.
- extract: function(fragment) {
- if ("production" !== "development") {
- if (canWarnForReactFragment) {
- if (!fragment[fragmentKey]) {
- ("production" !== "development" ? warning(
- didWarnForFragment(fragment),
- 'Any use of a keyed object should be wrapped in ' +
- 'React.addons.createFragment(object) before being passed as a ' +
- 'child.'
- ) : null);
- return fragment;
- }
- return fragment[fragmentKey];
- }
- }
- return fragment;
- },
- // Check if this is a fragment and if so, extract the keyed object. If it
- // is a fragment-like object, warn that it should be wrapped. Ignore if we
- // can't determine what kind of object this is.
- extractIfFragment: function(fragment) {
- if ("production" !== "development") {
- if (canWarnForReactFragment) {
- // If it is the opaque type, return the keyed object.
- if (fragment[fragmentKey]) {
- return fragment[fragmentKey];
- }
- // Otherwise, check each property if it has an element, if it does
- // it is probably meant as a fragment, so we can warn early. Defer,
- // the warning to extract.
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key) &&
- ReactElement.isValidElement(fragment[key])) {
- // This looks like a fragment object, we should provide an
- // early warning.
- return ReactFragment.extract(fragment);
- }
- }
- }
- }
- return fragment;
+
+ return result;
}
};
module.exports = ReactFragment;
-
-},{"171":171,"63":63}],70:[function(_dereq_,module,exports){
+},{"153":153,"161":161,"173":173,"32":32,"57":57}],65:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11626,22 +10435,20 @@
'use strict';
-var DOMProperty = _dereq_(11);
-var EventPluginHub = _dereq_(18);
-var ReactComponentEnvironment = _dereq_(41);
-var ReactClass = _dereq_(38);
-var ReactEmptyComponent = _dereq_(65);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactNativeComponent = _dereq_(80);
-var ReactDOMComponent = _dereq_(48);
-var ReactPerf = _dereq_(82);
-var ReactRootIndex = _dereq_(91);
-var ReactUpdates = _dereq_(100);
+var DOMProperty = _dereq_(10);
+var EventPluginHub = _dereq_(16);
+var ReactComponentEnvironment = _dereq_(36);
+var ReactClass = _dereq_(33);
+var ReactEmptyComponent = _dereq_(59);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactNativeComponent = _dereq_(75);
+var ReactPerf = _dereq_(78);
+var ReactRootIndex = _dereq_(86);
+var ReactUpdates = _dereq_(96);
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
- DOMComponent: ReactDOMComponent.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
@@ -11653,8 +10460,7 @@
};
module.exports = ReactInjection;
-
-},{"100":100,"11":11,"18":18,"33":33,"38":38,"41":41,"48":48,"65":65,"80":80,"82":82,"91":91}],71:[function(_dereq_,module,exports){
+},{"10":10,"16":16,"28":28,"33":33,"36":36,"59":59,"75":75,"78":78,"86":86,"96":96}],66:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11668,11 +10474,11 @@
'use strict';
-var ReactDOMSelection = _dereq_(56);
+var ReactDOMSelection = _dereq_(49);
-var containsNode = _dereq_(123);
-var focusNode = _dereq_(134);
-var getActiveElement = _dereq_(136);
+var containsNode = _dereq_(150);
+var focusNode = _dereq_(155);
+var getActiveElement = _dereq_(156);
function isInDocument(node) {
return containsNode(document.documentElement, node);
@@ -11686,21 +10492,16 @@
*/
var ReactInputSelection = {
- hasSelectionCapabilities: function(elem) {
- return elem && (
- ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
- elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
- );
+ hasSelectionCapabilities: function (elem) {
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
- getSelectionInformation: function() {
+ getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
- selectionRange:
- ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
- ReactInputSelection.getSelection(focusedElem) :
- null
+ selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
@@ -11709,17 +10510,13 @@
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
- restoreSelection: function(priorSelectionInformation) {
+ restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
- if (curFocusedElem !== priorFocusedElem &&
- isInDocument(priorFocusedElem)) {
+ if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
- ReactInputSelection.setSelection(
- priorFocusedElem,
- priorSelectionRange
- );
+ ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
@@ -11731,7 +10528,7 @@
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
- getSelection: function(input) {
+ getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
@@ -11740,7 +10537,7 @@
start: input.selectionStart,
end: input.selectionEnd
};
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
@@ -11756,7 +10553,7 @@
selection = ReactDOMSelection.getOffsets(input);
}
- return selection || {start: 0, end: 0};
+ return selection || { start: 0, end: 0 };
},
/**
@@ -11765,7 +10562,7 @@
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
- setSelection: function(input, offsets) {
+ setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
@@ -11775,7 +10572,7 @@
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
@@ -11788,8 +10585,7 @@
};
module.exports = ReactInputSelection;
-
-},{"123":123,"134":134,"136":136,"56":56}],72:[function(_dereq_,module,exports){
+},{"150":150,"155":155,"156":156,"49":49}],67:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -11804,9 +10600,9 @@
'use strict';
-var ReactRootIndex = _dereq_(91);
+var ReactRootIndex = _dereq_(86);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
@@ -11814,7 +10610,7 @@
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
-var MAX_TREE_DEPTH = 100;
+var MAX_TREE_DEPTH = 10000;
/**
* Creates a DOM ID prefix to use when mounting React components.
@@ -11847,9 +10643,7 @@
* @private
*/
function isValidID(id) {
- return id === '' || (
- id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
- );
+ return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
}
/**
@@ -11861,10 +10655,7 @@
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
- return (
- descendantID.indexOf(ancestorID) === 0 &&
- isBoundary(descendantID, ancestorID.length)
- );
+ return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
}
/**
@@ -11888,19 +10679,8 @@
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
- ("production" !== "development" ? invariant(
- isValidID(ancestorID) && isValidID(destinationID),
- 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
- ancestorID,
- destinationID
- ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
- ("production" !== "development" ? invariant(
- isAncestorIDOf(ancestorID, destinationID),
- 'getNextDescendantID(...): React has made an invalid assumption about ' +
- 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
- ancestorID,
- destinationID
- ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
+ !(isValidID(ancestorID) && isValidID(destinationID)) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
+ !isAncestorIDOf(ancestorID, destinationID) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
if (ancestorID === destinationID) {
return ancestorID;
}
@@ -11942,13 +10722,7 @@
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
- ("production" !== "development" ? invariant(
- isValidID(longestCommonID),
- 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
- oneID,
- twoID,
- longestCommonID
- ) : invariant(isValidID(longestCommonID)));
+ !isValidID(longestCommonID) ? "development" !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
return longestCommonID;
}
@@ -11960,6 +10734,7 @@
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
+ * @param {*} arg Argument to invoke the callback with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
@@ -11967,23 +10742,13 @@
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
- ("production" !== "development" ? invariant(
- start !== stop,
- 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
- start
- ) : invariant(start !== stop));
+ !(start !== stop) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
var traverseUp = isAncestorIDOf(stop, start);
- ("production" !== "development" ? invariant(
- traverseUp || isAncestorIDOf(start, stop),
- 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
- 'not have a parent path.',
- start,
- stop
- ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
+ !(traverseUp || isAncestorIDOf(start, stop)) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
- for (var id = start; /* until break */; id = traverse(id, stop)) {
+ for (var id = start;; /* until break */id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
@@ -11992,12 +10757,7 @@
// Only break //after// visiting `stop`.
break;
}
- ("production" !== "development" ? invariant(
- depth++ < MAX_TREE_DEPTH,
- 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
- 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
- start, stop
- ) : invariant(depth++ < MAX_TREE_DEPTH));
+ !(depth++ < MAX_TREE_DEPTH) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
}
}
@@ -12014,7 +10774,7 @@
* Constructs a React root ID
* @return {string} A React root ID.
*/
- createReactRootID: function() {
+ createReactRootID: function () {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
@@ -12026,7 +10786,7 @@
* @return {string} A React ID.
* @internal
*/
- createReactID: function(rootID, name) {
+ createReactID: function (rootID, name) {
return rootID + name;
},
@@ -12038,7 +10798,7 @@
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
- getReactRootIDFromNodeID: function(id) {
+ getReactRootIDFromNodeID: function (id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
@@ -12060,7 +10820,7 @@
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
- traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
+ traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
@@ -12080,7 +10840,7 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseTwoPhase: function(targetID, cb, arg) {
+ traverseTwoPhase: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
@@ -12088,6 +10848,16 @@
},
/**
+ * Same as `traverseTwoPhase` but skips the `targetID`.
+ */
+ traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
+ if (targetID) {
+ traverseParentPath('', targetID, cb, arg, true, true);
+ traverseParentPath(targetID, '', cb, arg, true, true);
+ }
+ },
+
+ /**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
@@ -12099,15 +10869,11 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseAncestors: function(targetID, cb, arg) {
+ traverseAncestors: function (targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
- /**
- * Exposed for unit testing.
- * @private
- */
- _getFirstCommonAncestorID: getFirstCommonAncestorID,
+ getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
@@ -12122,8 +10888,7 @@
};
module.exports = ReactInstanceHandles;
-
-},{"150":150,"91":91}],73:[function(_dereq_,module,exports){
+},{"161":161,"86":86}],68:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12152,64 +10917,101 @@
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
- remove: function(key) {
+ remove: function (key) {
key._reactInternalInstance = undefined;
},
- get: function(key) {
+ get: function (key) {
return key._reactInternalInstance;
},
- has: function(key) {
+ has: function (key) {
return key._reactInternalInstance !== undefined;
},
- set: function(key, value) {
+ set: function (key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
-
-},{}],74:[function(_dereq_,module,exports){
+},{}],69:[function(_dereq_,module,exports){
/**
- * Copyright 2015, Facebook, Inc.
+ * Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule ReactLifeCycle
+ * @providesModule ReactIsomorphic
*/
'use strict';
-/**
- * This module manages the bookkeeping when a component is in the process
- * of being mounted or being unmounted. This is used as a way to enforce
- * invariants (or warnings) when it is not recommended to call
- * setState/forceUpdate.
- *
- * currentlyMountingInstance: During the construction phase, it is not possible
- * to trigger an update since the instance is not fully mounted yet. However, we
- * currently allow this as a convenience for mutating the initial state.
- *
- * currentlyUnmountingInstance: During the unmounting phase, the instance is
- * still mounted and can therefore schedule an update. However, this is not
- * recommended and probably an error since it's about to be unmounted.
- * Therefore we still want to trigger in an error for that case.
- */
+var ReactChildren = _dereq_(32);
+var ReactComponent = _dereq_(34);
+var ReactClass = _dereq_(33);
+var ReactDOMFactories = _dereq_(43);
+var ReactElement = _dereq_(57);
+var ReactElementValidator = _dereq_(58);
+var ReactPropTypes = _dereq_(82);
+var ReactVersion = _dereq_(97);
-var ReactLifeCycle = {
- currentlyMountingInstance: null,
- currentlyUnmountingInstance: null
-};
+var assign = _dereq_(24);
+var onlyChild = _dereq_(135);
+
+var createElement = ReactElement.createElement;
+var createFactory = ReactElement.createFactory;
+var cloneElement = ReactElement.cloneElement;
-module.exports = ReactLifeCycle;
+if ("development" !== 'production') {
+ createElement = ReactElementValidator.createElement;
+ createFactory = ReactElementValidator.createFactory;
+ cloneElement = ReactElementValidator.cloneElement;
+}
-},{}],75:[function(_dereq_,module,exports){
+var React = {
+
+ // Modern
+
+ Children: {
+ map: ReactChildren.map,
+ forEach: ReactChildren.forEach,
+ count: ReactChildren.count,
+ toArray: ReactChildren.toArray,
+ only: onlyChild
+ },
+
+ Component: ReactComponent,
+
+ createElement: createElement,
+ cloneElement: cloneElement,
+ isValidElement: ReactElement.isValidElement,
+
+ // Classic
+
+ PropTypes: ReactPropTypes,
+ createClass: ReactClass.createClass,
+ createFactory: createFactory,
+ createMixin: function (mixin) {
+ // Currently a noop. Will be used to validate and trace mixins.
+ return mixin;
+ },
+
+ // This looks DOM specific but these are actually isomorphic helpers
+ // since they are just generating DOM strings.
+ DOM: ReactDOMFactories,
+
+ version: ReactVersion,
+
+ // Hook for JSX spread, don't use this for anything else.
+ __spread: assign
+};
+
+module.exports = React;
+},{"135":135,"24":24,"32":32,"33":33,"34":34,"43":43,"57":57,"58":58,"82":82,"97":97}],70:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12238,7 +11040,7 @@
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
- * this._handleValueChange: function(newValue) {
+ * _handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
@@ -12247,7 +11049,7 @@
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
*/
-var React = _dereq_(31);
+var React = _dereq_(26);
/**
* @param {*} value current value of the link
@@ -12268,9 +11070,7 @@
*/
function createLinkTypeChecker(linkType) {
var shapes = {
- value: typeof linkType === 'undefined' ?
- React.PropTypes.any.isRequired :
- linkType.isRequired,
+ value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired,
requestChange: React.PropTypes.func.isRequired
};
return React.PropTypes.shape(shapes);
@@ -12281,8 +11081,7 @@
};
module.exports = ReactLink;
-
-},{"31":31}],76:[function(_dereq_,module,exports){
+},{"26":26}],71:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12296,7 +11095,9 @@
'use strict';
-var adler32 = _dereq_(119);
+var adler32 = _dereq_(116);
+
+var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
@@ -12305,12 +11106,11 @@
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
- addChecksumToMarkup: function(markup) {
+ addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
- return markup.replace(
- '>',
- ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
- );
+
+ // Add checksum (handle both parent tags and self-closing tags)
+ return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
},
/**
@@ -12318,10 +11118,8 @@
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
- canReuseMarkup: function(markup, element) {
- var existingChecksum = element.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ canReuseMarkup: function (markup, element) {
+ var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
@@ -12329,8 +11127,7 @@
};
module.exports = ReactMarkupChecksum;
-
-},{"119":119}],77:[function(_dereq_,module,exports){
+},{"116":116}],72:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -12344,36 +11141,38 @@
'use strict';
-var DOMProperty = _dereq_(11);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactElementValidator = _dereq_(64);
-var ReactEmptyComponent = _dereq_(65);
-var ReactInstanceHandles = _dereq_(72);
-var ReactInstanceMap = _dereq_(73);
-var ReactMarkupChecksum = _dereq_(76);
-var ReactPerf = _dereq_(82);
-var ReactReconciler = _dereq_(89);
-var ReactUpdateQueue = _dereq_(99);
-var ReactUpdates = _dereq_(100);
-
-var emptyObject = _dereq_(130);
-var containsNode = _dereq_(123);
-var getReactRootElementInContainer = _dereq_(144);
-var instantiateReactComponent = _dereq_(149);
-var invariant = _dereq_(150);
-var setInnerHTML = _dereq_(164);
-var shouldUpdateReactComponent = _dereq_(167);
-var warning = _dereq_(171);
-
-var SEPARATOR = ReactInstanceHandles.SEPARATOR;
+var DOMProperty = _dereq_(10);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactCurrentOwner = _dereq_(39);
+var ReactDOMFeatureFlags = _dereq_(44);
+var ReactElement = _dereq_(57);
+var ReactEmptyComponentRegistry = _dereq_(60);
+var ReactInstanceHandles = _dereq_(67);
+var ReactInstanceMap = _dereq_(68);
+var ReactMarkupChecksum = _dereq_(71);
+var ReactPerf = _dereq_(78);
+var ReactReconciler = _dereq_(84);
+var ReactUpdateQueue = _dereq_(95);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var containsNode = _dereq_(150);
+var instantiateReactComponent = _dereq_(132);
+var invariant = _dereq_(161);
+var setInnerHTML = _dereq_(138);
+var shouldUpdateReactComponent = _dereq_(141);
+var validateDOMNesting = _dereq_(144);
+var warning = _dereq_(173);
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
+
+var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
@@ -12381,7 +11180,7 @@
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
-if ("production" !== "development") {
+if ("development" !== 'production') {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
@@ -12406,6 +11205,23 @@
}
/**
+ * @param {DOMElement|DOMDocument} container DOM element that may contain
+ * a React component
+ * @return {?*} DOM element that may have the reactRoot ID, or null.
+ */
+function getReactRootElementInContainer(container) {
+ if (!container) {
+ return null;
+ }
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ return container.documentElement;
+ } else {
+ return container.firstChild;
+ }
+}
+
+/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
@@ -12430,11 +11246,7 @@
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
- ("production" !== "development" ? invariant(
- !isValid(cached, id),
- 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
- ATTR_NAME, id
- ) : invariant(!isValid(cached, id)));
+ !!isValid(cached, id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
nodeCache[id] = node;
}
@@ -12491,7 +11303,7 @@
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
- if (ReactEmptyComponent.isNullComponentID(id)) {
+ if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
@@ -12512,11 +11324,7 @@
*/
function isValid(node, id) {
if (node) {
- ("production" !== "development" ? invariant(
- internalGetID(node) === id,
- 'ReactMount: Unexpected modification of `%s`',
- ATTR_NAME
- ) : invariant(internalGetID(node) === id));
+ !(internalGetID(node) === id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
@@ -12553,10 +11361,7 @@
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
- ReactInstanceHandles.traverseAncestors(
- targetID,
- findDeepestCachedAncestorImpl
- );
+ ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
@@ -12572,17 +11377,25 @@
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function mountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup) {
- var markup = ReactReconciler.mountComponent(
- componentInstance, rootID, transaction, emptyObject
- );
- componentInstance._isTopLevel = true;
- ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
+function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
+ if (ReactDOMFeatureFlags.useCreateElement) {
+ context = assign({}, context);
+ if (container.nodeType === DOC_NODE_TYPE) {
+ context[ownerDocumentContextKey] = container;
+ } else {
+ context[ownerDocumentContextKey] = container.ownerDocument;
+ }
+ }
+ if ("development" !== 'production') {
+ if (context === emptyObject) {
+ context = {};
+ }
+ var tag = container.nodeName.toLowerCase();
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
+ }
+ var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
+ componentInstance._renderedComponent._topLevelWrapper = componentInstance;
+ ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}
/**
@@ -12593,25 +11406,107 @@
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function batchedMountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- shouldReuseMarkup) {
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
- transaction.perform(
- mountComponentIntoNode,
- null,
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup
- );
+function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
+ /* forceHTML */shouldReuseMarkup);
+ transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
+ * Unmounts a component and removes it from the DOM.
+ *
+ * @param {ReactComponent} instance React component instance.
+ * @param {DOMElement} container DOM element to unmount from.
+ * @final
+ * @internal
+ * @see {ReactMount.unmountComponentAtNode}
+ */
+function unmountComponentFromNode(instance, container) {
+ ReactReconciler.unmountComponent(instance);
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ container = container.documentElement;
+ }
+
+ // http://jsperf.com/emptying-a-node
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+}
+
+/**
+ * True if the supplied DOM node has a direct React-rendered child that is
+ * not a React root element. Useful for warning in `render`,
+ * `unmountComponentAtNode`, etc.
+ *
+ * @param {?DOMElement} node The candidate DOM node.
+ * @return {boolean} True if the DOM element contains a direct child that was
+ * rendered by React but is not a root element.
+ * @internal
+ */
+function hasNonRootReactChild(node) {
+ var reactRootID = getReactRootID(node);
+ return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
+}
+
+/**
+ * Returns the first (deepest) ancestor of a node which is rendered by this copy
+ * of React.
+ */
+function findFirstReactDOMImpl(node) {
+ // This node might be from another React instance, so we make sure not to
+ // examine the node cache here
+ for (; node && node.parentNode !== node; node = node.parentNode) {
+ if (node.nodeType !== 1) {
+ // Not a DOMElement, therefore not a React component
+ continue;
+ }
+ var nodeID = internalGetID(node);
+ if (!nodeID) {
+ continue;
+ }
+ var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
+
+ // If containersByReactRootID contains the container we find by crawling up
+ // the tree, we know that this instance of React rendered the node.
+ // nb. isValid's strategy (with containsNode) does not work because render
+ // trees may be nested and we don't want a false positive in that case.
+ var current = node;
+ var lastID;
+ do {
+ lastID = internalGetID(current);
+ current = current.parentNode;
+ if (current == null) {
+ // The passed-in node has been detached from the container it was
+ // originally rendered into.
+ return null;
+ }
+ } while (lastID !== reactRootID);
+
+ if (current === containersByReactRootID[reactRootID]) {
+ return node;
+ }
+ }
+ return null;
+}
+
+/**
+ * Temporary (?) hack so that we can store all top-level pending updates on
+ * composites instead of having to worry about different types of components
+ * here.
+ */
+var TopLevelWrapper = function () {};
+TopLevelWrapper.prototype.isReactComponent = {};
+if ("development" !== 'production') {
+ TopLevelWrapper.displayName = 'TopLevelWrapper';
+}
+TopLevelWrapper.prototype.render = function () {
+ // this.props is actually a ReactElement
+ return this.props;
+};
+
+/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
@@ -12630,6 +11525,9 @@
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
+
+ TopLevelWrapper: TopLevelWrapper,
+
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
@@ -12641,7 +11539,7 @@
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
- scrollMonitor: function(container, renderCallback) {
+ scrollMonitor: function (container, renderCallback) {
renderCallback();
},
@@ -12652,26 +11550,17 @@
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
- _updateRootComponent: function(
- prevComponent,
- nextElement,
- container,
- callback) {
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
- }
-
- ReactMount.scrollMonitor(container, function() {
+ _updateRootComponent: function (prevComponent, nextElement, container, callback) {
+ ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[getReactRootID(container)] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
}
return prevComponent;
@@ -12684,15 +11573,8 @@
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
- _registerComponent: function(nextComponent, container) {
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- '_registerComponent(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ _registerComponent: function (nextComponent, container) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
@@ -12708,44 +11590,24 @@
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
- _renderNewRootComponent: function(
- nextElement,
- container,
- shouldReuseMarkup
- ) {
+ _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- '_renderNewRootComponent(): Render methods should be a pure function ' +
- 'of props and state; triggering nested component updates from ' +
- 'render is not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
var componentInstance = instantiateReactComponent(nextElement, null);
- var reactRootID = ReactMount._registerComponent(
- componentInstance,
- container
- );
+ var reactRootID = ReactMount._registerComponent(componentInstance, container);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
- ReactUpdates.batchedUpdates(
- batchedMountComponentIntoNode,
- componentInstance,
- reactRootID,
- container,
- shouldReuseMarkup
- );
+ ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[reactRootID] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
}
return componentInstance;
@@ -12758,76 +11620,64 @@
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
+ * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- render: function(nextElement, container, callback) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(nextElement),
- 'React.render(): Invalid component element.%s',
- (
- typeof nextElement === 'string' ?
- ' Instead of passing an element string, make sure to instantiate ' +
- 'it by passing it to React.createElement.' :
- typeof nextElement === 'function' ?
- ' Instead of passing a component class, make sure to instantiate ' +
- 'it by passing it to React.createElement.' :
+ renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !(parentComponent != null && parentComponent._reactInternalInstance != null) ? "development" !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
+ return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
+ },
+
+ _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !ReactElement.isValidElement(nextElement) ? "development" !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
// Check if it quacks like an element
- nextElement != null && nextElement.props !== undefined ?
- ' This may be caused by unintentionally loading two independent ' +
- 'copies of React.' :
- ''
- )
- ) : invariant(ReactElement.isValidElement(nextElement)));
+ nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
+
+ "development" !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
+
+ var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
- var prevElement = prevComponent._currentElement;
+ var prevWrappedElement = prevComponent._currentElement;
+ var prevElement = prevWrappedElement.props;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
- return ReactMount._updateRootComponent(
- prevComponent,
- nextElement,
- container,
- callback
- ).getPublicInstance();
+ var publicInst = prevComponent._renderedComponent.getPublicInstance();
+ var updatedCallback = callback && function () {
+ callback.call(publicInst);
+ };
+ ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
+ return publicInst;
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
- var containerHasReactMarkup =
- reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
+ var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
+ var containerHasNonRootReactChild = hasNonRootReactChild(container);
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
- if ("production" !== "development") {
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
- if (ReactMount.isRenderedByReact(rootElementSibling)) {
- ("production" !== "development" ? warning(
- false,
- 'render(): Target node has markup rendered by React, but there ' +
- 'are unrelated nodes as well. This is most commonly caused by ' +
- 'white-space inserted around server-rendered markup.'
- ) : null);
+ if (internalGetID(rootElementSibling)) {
+ "development" !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
break;
}
-
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
- var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
-
- var component = ReactMount._renderNewRootComponent(
- nextElement,
- container,
- shouldReuseMarkup
- ).getPublicInstance();
+ var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
+ var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
@@ -12835,36 +11685,19 @@
},
/**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into the supplied `container`.
+ * Renders a React component into the DOM in the supplied `container`.
*
- * @param {function} constructor React component constructor.
- * @param {?object} props Initial props of the component instance.
+ * If the React component was previously rendered into `container`, this will
+ * perform an update on it and only mutate the DOM as necessary to reflect the
+ * latest React component.
+ *
+ * @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
+ * @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- constructAndRenderComponent: function(constructor, props, container) {
- var element = ReactElement.createElement(constructor, props);
- return ReactMount.render(element, container);
- },
-
- /**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into a container node identified by supplied `id`.
- *
- * @param {function} componentConstructor React component constructor
- * @param {?object} props Initial props of the component instance.
- * @param {string} id ID of the DOM element to render into.
- * @return {ReactComponent} Component instance rendered in the container node.
- */
- constructAndRenderComponentByID: function(constructor, props, id) {
- var domNode = document.getElementById(id);
- ("production" !== "development" ? invariant(
- domNode,
- 'Tried to get element with id of "%s" but it is not present on the page.',
- id
- ) : invariant(domNode));
- return ReactMount.constructAndRenderComponent(constructor, props, domNode);
+ render: function (nextElement, container, callback) {
+ return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
@@ -12875,7 +11708,7 @@
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
- registerContainer: function(container) {
+ registerContainer: function (container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
@@ -12896,101 +11729,68 @@
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
- unmountComponentAtNode: function(container) {
+ unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- 'unmountComponentAtNode(): Render methods should be a pure function of ' +
- 'props and state; triggering nested component updates from render is ' +
- 'not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
-
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'unmountComponentAtNode(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
+
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
+ // Check if the node being unmounted was rendered by React, but isn't a
+ // root node.
+ var containerHasNonRootReactChild = hasNonRootReactChild(container);
+
+ // Check if the container itself is a React root node.
+ var containerID = internalGetID(container);
+ var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
+
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
+ }
+
return false;
}
- ReactMount.unmountComponentFromNode(component, container);
+ ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
- * Unmounts a component and removes it from the DOM.
- *
- * @param {ReactComponent} instance React component instance.
- * @param {DOMElement} container DOM element to unmount from.
- * @final
- * @internal
- * @see {ReactMount.unmountComponentAtNode}
- */
- unmountComponentFromNode: function(instance, container) {
- ReactReconciler.unmountComponent(instance);
-
- if (container.nodeType === DOC_NODE_TYPE) {
- container = container.documentElement;
- }
-
- // http://jsperf.com/emptying-a-node
- while (container.lastChild) {
- container.removeChild(container.lastChild);
- }
- },
-
- /**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
- findReactContainerForID: function(id) {
+ findReactContainerForID: function (id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
- if ("production" !== "development") {
+ if ("development" !== 'production') {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
- ("production" !== "development" ? invariant(
+ "development" !== 'production' ? warning(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID,
- 'ReactMount: Root element ID differed from reactRootID.'
- ) : invariant(// Call internalGetID here because getID calls isValid which calls
- // findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID));
-
+ internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
var containerChild = container.firstChild;
- if (containerChild &&
- reactRootID === internalGetID(containerChild)) {
+ if (containerChild && reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
- ("production" !== "development" ? warning(
- false,
- 'ReactMount: Root element has been removed from its original ' +
- 'container. New container:', rootElement.parentNode
- ) : null);
+ "development" !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
}
}
}
@@ -13004,44 +11804,21 @@
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
- findReactNodeByID: function(id) {
+ findReactNodeByID: function (id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
- * True if the supplied `node` is rendered by React.
- *
- * @param {*} node DOM Element to check.
- * @return {boolean} True if the DOM Element appears to be rendered by React.
- * @internal
- */
- isRenderedByReact: function(node) {
- if (node.nodeType !== 1) {
- // Not a DOMElement, therefore not a React component
- return false;
- }
- var id = ReactMount.getID(node);
- return id ? id.charAt(0) === SEPARATOR : false;
- },
-
- /**
* Traverses up the ancestors of the supplied node to find a node that is a
- * DOM representation of a React component.
+ * DOM representation of a React component rendered by this copy of React.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
- getFirstReactDOM: function(node) {
- var current = node;
- while (current && current.parentNode !== current) {
- if (ReactMount.isRenderedByReact(current)) {
- return current;
- }
- current = current.parentNode;
- }
- return null;
+ getFirstReactDOM: function (node) {
+ return findFirstReactDOMImpl(node);
},
/**
@@ -13054,12 +11831,17 @@
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
- findComponentRoot: function(ancestorNode, targetID) {
+ findComponentRoot: function (ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
+ if ("development" !== 'production') {
+ // This will throw on the next line; give an early warning
+ "development" !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
+ }
+
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
@@ -13110,91 +11891,68 @@
firstChildren.length = 0;
- ("production" !== "development" ? invariant(
- false,
- 'findComponentRoot(..., %s): Unable to find element. This probably ' +
- 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
- 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
- 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
- 'parent. ' +
- 'Try inspecting the child nodes of the element with React ID `%s`.',
- targetID,
- ReactMount.getID(ancestorNode)
- ) : invariant(false));
- },
-
- _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
- ("production" !== "development" ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'mountComponentIntoNode(...): Target container is not valid.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ !false ? "development" !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
+ },
+
+ _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
return;
} else {
- var checksum = rootElement.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
- rootElement.setAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
- checksum
- );
+ rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
+
+ var normalizedMarkup = markup;
+ if ("development" !== 'production') {
+ // because rootMarkup is retrieved from the DOM, various normalizations
+ // will have occurred which will not be present in `markup`. Here,
+ // insert markup into a <div> or <iframe> depending on the container
+ // type to perform the same normalizations before comparing.
+ var normalizer;
+ if (container.nodeType === ELEMENT_NODE_TYPE) {
+ normalizer = document.createElement('div');
+ normalizer.innerHTML = markup;
+ normalizedMarkup = normalizer.innerHTML;
+ } else {
+ normalizer = document.createElement('iframe');
+ document.body.appendChild(normalizer);
+ normalizer.contentDocument.write(markup);
+ normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
+ document.body.removeChild(normalizer);
+ }
+ }
+
+ var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
+ var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
+
+ !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
- var diffIndex = firstDifferenceIndex(markup, rootMarkup);
- var difference = ' (client) ' +
- markup.substring(diffIndex - 20, diffIndex + 20) +
- '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
-
- ("production" !== "development" ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- 'You\'re trying to render a component to the document using ' +
- 'server rendering but the checksum was invalid. This usually ' +
- 'means you rendered a different component type or props on ' +
- 'the client from the one on the server, or your render() ' +
- 'methods are impure. React cannot handle this case due to ' +
- 'cross-browser quirks by rendering at the document root. You ' +
- 'should look for environment dependent code in your components ' +
- 'and ensure the props are the same client and server side:\n%s',
- difference
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
-
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- false,
- 'React attempted to reuse markup in a container but the ' +
- 'checksum was invalid. This generally means that you are ' +
- 'using server rendering and the markup generated on the ' +
- 'server was not what the client was expecting. React injected ' +
- 'new markup to compensate which works but you have lost many ' +
- 'of the benefits of server rendering. Instead, figure out ' +
- 'why the markup being generated is different on the client ' +
- 'or server:\n%s',
- difference
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
}
}
}
- ("production" !== "development" ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- 'You\'re trying to render a component to the document but ' +
- 'you didn\'t use server rendering. We can\'t do this ' +
- 'without using server rendering due to cross-browser quirks. ' +
- 'See React.renderToString() for server rendering.'
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
+ !(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
+ if (transaction.useCreateElement) {
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+ container.appendChild(markup);
+ } else {
setInnerHTML(container, markup);
+ }
},
+ ownerDocumentContextKey: ownerDocumentContextKey,
+
/**
* React ID utilities.
*/
@@ -13209,6 +11967,8 @@
getNodeFromInstance: getNodeFromInstance,
+ isValid: isValid,
+
purgeID: purgeID
};
@@ -13218,8 +11978,7 @@
});
module.exports = ReactMount;
-
-},{"100":100,"11":11,"123":123,"130":130,"144":144,"149":149,"150":150,"164":164,"167":167,"171":171,"33":33,"45":45,"63":63,"64":64,"65":65,"72":72,"73":73,"76":76,"82":82,"89":89,"99":99}],78:[function(_dereq_,module,exports){
+},{"10":10,"132":132,"138":138,"141":141,"144":144,"150":150,"154":154,"161":161,"173":173,"24":24,"28":28,"39":39,"44":44,"57":57,"60":60,"67":67,"68":68,"71":71,"78":78,"84":84,"95":95,"96":96}],73:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13234,11 +11993,14 @@
'use strict';
-var ReactComponentEnvironment = _dereq_(41);
-var ReactMultiChildUpdateTypes = _dereq_(79);
+var ReactComponentEnvironment = _dereq_(36);
+var ReactMultiChildUpdateTypes = _dereq_(74);
-var ReactReconciler = _dereq_(89);
-var ReactChildReconciler = _dereq_(36);
+var ReactCurrentOwner = _dereq_(39);
+var ReactReconciler = _dereq_(84);
+var ReactChildReconciler = _dereq_(31);
+
+var flattenChildren = _dereq_(123);
/**
* Updating children of a component may trigger recursive updates. The depth is
@@ -13275,14 +12037,14 @@
* @param {number} toIndex Destination index.
* @private
*/
-function enqueueMarkup(parentID, markup, toIndex) {
+function enqueueInsertMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
- textContent: null,
+ content: null,
fromIndex: null,
toIndex: toIndex
});
@@ -13303,7 +12065,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: toIndex
});
@@ -13323,13 +12085,33 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
+ * Enqueues setting the markup of a node.
+ *
+ * @param {string} parentID ID of the parent component.
+ * @param {string} markup Markup that renders into an element.
+ * @private
+ */
+function enqueueSetMarkup(parentID, markup) {
+ // NOTE: Null values reduce hidden classes.
+ updateQueue.push({
+ parentID: parentID,
+ parentNode: null,
+ type: ReactMultiChildUpdateTypes.SET_MARKUP,
+ markupIndex: null,
+ content: markup,
+ fromIndex: null,
+ toIndex: null
+ });
+}
+
+/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
@@ -13343,7 +12125,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
- textContent: textContent,
+ content: textContent,
fromIndex: null,
toIndex: null
});
@@ -13356,10 +12138,7 @@
*/
function processQueue() {
if (updateQueue.length) {
- ReactComponentEnvironment.processChildrenUpdates(
- updateQueue,
- markupQueue
- );
+ ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
clearQueue();
}
}
@@ -13391,6 +12170,37 @@
*/
Mixin: {
+ _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
+ if ("development" !== 'production') {
+ if (this._currentElement) {
+ try {
+ ReactCurrentOwner.current = this._currentElement._owner;
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ }
+ }
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
+ },
+
+ _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
+ var nextChildren;
+ if ("development" !== 'production') {
+ if (this._currentElement) {
+ try {
+ ReactCurrentOwner.current = this._currentElement._owner;
+ nextChildren = flattenChildren(nextNestedChildrenElements);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ }
+ }
+ nextChildren = flattenChildren(nextNestedChildrenElements);
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ },
+
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
@@ -13399,10 +12209,8 @@
* @return {array} An array of mounted representations.
* @internal
*/
- mountChildren: function(nestedChildren, transaction, context) {
- var children = ReactChildReconciler.instantiateChildren(
- nestedChildren, transaction, context
- );
+ mountChildren: function (nestedChildren, transaction, context) {
+ var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
@@ -13411,15 +12219,9 @@
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
- child._mountIndex = index;
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
+ child._mountIndex = index++;
mountImages.push(mountImage);
- index++;
}
}
return mountImages;
@@ -13431,7 +12233,7 @@
* @param {string} nextContent String of content.
* @internal
*/
- updateTextContent: function(nextContent) {
+ updateTextContent: function (nextContent) {
updateDepth++;
var errorThrown = true;
try {
@@ -13441,7 +12243,7 @@
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
- this._unmountChildByName(prevChildren[name], name);
+ this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
@@ -13460,17 +12262,49 @@
},
/**
+ * Replaces any rendered children with a markup string.
+ *
+ * @param {string} nextMarkup String of markup.
+ * @internal
+ */
+ updateMarkup: function (nextMarkup) {
+ updateDepth++;
+ var errorThrown = true;
+ try {
+ var prevChildren = this._renderedChildren;
+ // Remove any rendered children.
+ ReactChildReconciler.unmountChildren(prevChildren);
+ for (var name in prevChildren) {
+ if (prevChildren.hasOwnProperty(name)) {
+ this._unmountChildByName(prevChildren[name], name);
+ }
+ }
+ this.setMarkup(nextMarkup);
+ errorThrown = false;
+ } finally {
+ updateDepth--;
+ if (!updateDepth) {
+ if (errorThrown) {
+ clearQueue();
+ } else {
+ processQueue();
+ }
+ }
+ }
+ },
+
+ /**
* Updates the rendered children with new children.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- updateChildren: function(nextNestedChildren, transaction, context) {
+ updateChildren: function (nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
- this._updateChildren(nextNestedChildren, transaction, context);
+ this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
@@ -13489,16 +12322,14 @@
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
- _updateChildren: function(nextNestedChildren, transaction, context) {
+ _updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
- var nextChildren = ReactChildReconciler.updateChildren(
- prevChildren, nextNestedChildren, transaction, context
- );
+ var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
@@ -13522,20 +12353,17 @@
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
- this._unmountChildByName(prevChild, name);
+ this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
- this._mountChildByNameAtIndex(
- nextChild, name, nextIndex, transaction, context
- );
+ this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
- this._unmountChildByName(prevChildren[name], name);
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ this._unmountChild(prevChildren[name]);
}
}
},
@@ -13546,7 +12374,7 @@
*
* @internal
*/
- unmountChildren: function() {
+ unmountChildren: function () {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
@@ -13560,7 +12388,7 @@
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
- moveChild: function(child, toIndex, lastIndex) {
+ moveChild: function (child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
@@ -13576,8 +12404,8 @@
* @param {string} mountImage Markup to insert.
* @protected
*/
- createChild: function(child, mountImage) {
- enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
+ createChild: function (child, mountImage) {
+ enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
@@ -13586,7 +12414,7 @@
* @param {ReactComponent} child Child to remove.
* @protected
*/
- removeChild: function(child) {
+ removeChild: function (child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
@@ -13596,11 +12424,21 @@
* @param {string} textContent Text content to set.
* @protected
*/
- setTextContent: function(textContent) {
+ setTextContent: function (textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
+ * Sets this markup string.
+ *
+ * @param {string} markup Markup to set.
+ * @protected
+ */
+ setMarkup: function (markup) {
+ enqueueSetMarkup(this._rootNodeID, markup);
+ },
+
+ /**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
@@ -13611,34 +12449,23 @@
* @param {ReactReconcileTransaction} transaction
* @private
*/
- _mountChildByNameAtIndex: function(
- child,
- name,
- index,
- transaction,
- context) {
+ _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
- * Unmounts a rendered child by name.
+ * Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
- * @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
- _unmountChildByName: function(child, name) {
+ _unmountChild: function (child) {
this.removeChild(child);
child._mountIndex = null;
}
@@ -13648,8 +12475,7 @@
};
module.exports = ReactMultiChild;
-
-},{"36":36,"41":41,"79":79,"89":89}],79:[function(_dereq_,module,exports){
+},{"123":123,"31":31,"36":36,"39":39,"74":74,"84":84}],74:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13663,7 +12489,7 @@
'use strict';
-var keyMirror = _dereq_(156);
+var keyMirror = _dereq_(165);
/**
* When a component's children are updated, a series of update configuration
@@ -13677,12 +12503,12 @@
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
+ SET_MARKUP: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
-
-},{"156":156}],80:[function(_dereq_,module,exports){
+},{"165":165}],75:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -13696,35 +12522,30 @@
'use strict';
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
-// This registry keeps track of wrapper classes around native tags
+// This registry keeps track of wrapper classes around native tags.
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
- injectGenericComponentClass: function(componentClass) {
+ injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
- injectTextComponentClass: function(componentClass) {
+ injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
- injectComponentClasses: function(componentClasses) {
+ injectComponentClasses: function (componentClasses) {
assign(tagToComponentClass, componentClasses);
- },
- // Temporary hack since we expect DOM refs to behave like composites,
- // for this release.
- injectAutoWrapper: function(wrapperFactory) {
- autoGenerateWrapperClass = wrapperFactory;
}
};
@@ -13753,11 +12574,7 @@
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
- ("production" !== "development" ? invariant(
- genericComponentClass,
- 'There is no registered component for the tag %s',
- element.type
- ) : invariant(genericComponentClass));
+ !genericComponentClass ? "development" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
return new genericComponentClass(element.type, element.props);
}
@@ -13786,8 +12603,126 @@
};
module.exports = ReactNativeComponent;
+},{"161":161,"24":24}],76:[function(_dereq_,module,exports){
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactNoopUpdateQueue
+ */
+
+'use strict';
+
+var warning = _dereq_(173);
+
+function warnTDZ(publicInstance, callerName) {
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
+ }
+}
+
+/**
+ * This is the abstract API for an update queue.
+ */
+var ReactNoopUpdateQueue = {
+
+ /**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ return false;
+ },
+
+ /**
+ * Enqueue a callback that will be executed after all the pending updates
+ * have processed.
+ *
+ * @param {ReactClass} publicInstance The instance to use as `this` context.
+ * @param {?function} callback Called after state is updated.
+ * @internal
+ */
+ enqueueCallback: function (publicInstance, callback) {},
+
+ /**
+ * Forces an update. This should only be invoked when it is known with
+ * certainty that we are **not** in a DOM transaction.
+ *
+ * You may want to call this when you know that some deeper aspect of the
+ * component's state has changed but `setState` was not called.
+ *
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
+ * `componentWillUpdate` and `componentDidUpdate`.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @internal
+ */
+ enqueueForceUpdate: function (publicInstance) {
+ warnTDZ(publicInstance, 'forceUpdate');
+ },
+
+ /**
+ * Replaces all of the state. Always use this or `setState` to mutate state.
+ * You should treat `this.state` as immutable.
+ *
+ * There is no guarantee that `this.state` will be immediately updated, so
+ * accessing `this.state` after calling this method may return the old value.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} completeState Next state.
+ * @internal
+ */
+ enqueueReplaceState: function (publicInstance, completeState) {
+ warnTDZ(publicInstance, 'replaceState');
+ },
+
+ /**
+ * Sets a subset of the state. This only exists because _pendingState is
+ * internal. This provides a merging strategy that is not available to deep
+ * properties which is confusing. TODO: Expose pendingState or don't use it
+ * during the merge.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialState Next partial state to be merged with state.
+ * @internal
+ */
+ enqueueSetState: function (publicInstance, partialState) {
+ warnTDZ(publicInstance, 'setState');
+ },
+
+ /**
+ * Sets a subset of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialProps Subset of the next props.
+ * @internal
+ */
+ enqueueSetProps: function (publicInstance, partialProps) {
+ warnTDZ(publicInstance, 'setProps');
+ },
+
+ /**
+ * Replaces all of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} props New props.
+ * @internal
+ */
+ enqueueReplaceProps: function (publicInstance, props) {
+ warnTDZ(publicInstance, 'replaceProps');
+ }
-},{"150":150,"29":29}],81:[function(_dereq_,module,exports){
+};
+
+module.exports = ReactNoopUpdateQueue;
+},{"173":173}],77:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13801,7 +12736,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* ReactOwners are capable of storing references to owned components.
@@ -13840,11 +12775,8 @@
* @return {boolean} True if `object` is a valid owner.
* @final
*/
- isValidOwner: function(object) {
- return !!(
- (object &&
- typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
- );
+ isValidOwner: function (object) {
+ return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
@@ -13856,15 +12788,8 @@
* @final
* @internal
*/
- addComponentAsRefTo: function(component, ref, owner) {
- ("production" !== "development" ? invariant(
- ReactOwner.isValidOwner(owner),
- 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
- 'usually means that you\'re trying to add a ref to a component that ' +
- 'doesn\'t have an owner (that is, was not created inside of another ' +
- 'component\'s `render` method). Try rendering this component inside of ' +
- 'a new top-level component which will hold the ref.'
- ) : invariant(ReactOwner.isValidOwner(owner)));
+ addComponentAsRefTo: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);
},
@@ -13877,15 +12802,8 @@
* @final
* @internal
*/
- removeComponentAsRefFrom: function(component, ref, owner) {
- ("production" !== "development" ? invariant(
- ReactOwner.isValidOwner(owner),
- 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
- 'usually means that you\'re trying to remove a ref to a component that ' +
- 'doesn\'t have an owner (that is, was not created inside of another ' +
- 'component\'s `render` method). Try rendering this component inside of ' +
- 'a new top-level component which will hold the ref.'
- ) : invariant(ReactOwner.isValidOwner(owner)));
+ removeComponentAsRefFrom: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
@@ -13896,8 +12814,7 @@
};
module.exports = ReactOwner;
-
-},{"150":150}],82:[function(_dereq_,module,exports){
+},{"161":161}],78:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -13934,17 +12851,13 @@
* @param {string} objectName
* @param {object<string>} methodNames
*/
- measureMethods: function(object, objectName, methodNames) {
- if ("production" !== "development") {
+ measureMethods: function (object, objectName, methodNames) {
+ if ("development" !== 'production') {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
- object[key] = ReactPerf.measure(
- objectName,
- methodNames[key],
- object[key]
- );
+ object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
}
}
},
@@ -13957,10 +12870,10 @@
* @param {function} func
* @return {function}
*/
- measure: function(objName, fnName, func) {
- if ("production" !== "development") {
+ measure: function (objName, fnName, func) {
+ if ("development" !== 'production') {
var measuredFunc = null;
- var wrapper = function() {
+ var wrapper = function () {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
@@ -13979,7 +12892,7 @@
/**
* @param {function} measure
*/
- injectMeasure: function(measure) {
+ injectMeasure: function (measure) {
ReactPerf.storedMeasure = measure;
}
}
@@ -13998,8 +12911,7 @@
}
module.exports = ReactPerf;
-
-},{}],83:[function(_dereq_,module,exports){
+},{}],79:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14013,9 +12925,9 @@
'use strict';
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
-var joinClasses = _dereq_(155);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
+var joinClasses = _dereq_(164);
/**
* Creates a transfer strategy that will merge prop values using the supplied
@@ -14025,7 +12937,7 @@
* @return {function}
*/
function createTransferStrategy(mergeStrategy) {
- return function(props, key, value) {
+ return function (props, key, value) {
if (!props.hasOwnProperty(key)) {
props[key] = value;
} else {
@@ -14034,7 +12946,7 @@
};
}
-var transferStrategyMerge = createTransferStrategy(function(a, b) {
+var transferStrategyMerge = createTransferStrategy(function (a, b) {
// `merge` overrides the first object's (`props[key]` above) keys using the
// second object's (`value`) keys. An object's style's existing `propA` would
// get overridden. Flip the order here.
@@ -14101,15 +13013,14 @@
* @param {object} newProps new props to merge in
* @return {object} a new object containing both sets of props merged.
*/
- mergeProps: function(oldProps, newProps) {
+ mergeProps: function (oldProps, newProps) {
return transferInto(assign({}, oldProps), newProps);
}
};
module.exports = ReactPropTransferer;
-
-},{"129":129,"155":155,"29":29}],84:[function(_dereq_,module,exports){
+},{"153":153,"164":164,"24":24}],80:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14125,7 +13036,7 @@
var ReactPropTypeLocationNames = {};
-if ("production" !== "development") {
+if ("development" !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
@@ -14134,8 +13045,7 @@
}
module.exports = ReactPropTypeLocationNames;
-
-},{}],85:[function(_dereq_,module,exports){
+},{}],81:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14149,7 +13059,7 @@
'use strict';
-var keyMirror = _dereq_(156);
+var keyMirror = _dereq_(165);
var ReactPropTypeLocations = keyMirror({
prop: null,
@@ -14158,8 +13068,7 @@
});
module.exports = ReactPropTypeLocations;
-
-},{"156":156}],86:[function(_dereq_,module,exports){
+},{"165":165}],82:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14173,11 +13082,11 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactFragment = _dereq_(69);
-var ReactPropTypeLocationNames = _dereq_(84);
+var ReactElement = _dereq_(57);
+var ReactPropTypeLocationNames = _dereq_(80);
-var emptyFunction = _dereq_(129);
+var emptyFunction = _dereq_(153);
+var getIteratorFn = _dereq_(129);
/**
* Collection of methods that allow declaration and validation of props that are
@@ -14228,9 +13137,6 @@
var ANONYMOUS = '<<anonymous>>';
-var elementTypeChecker = createElementTypeChecker();
-var nodeTypeChecker = createNodeChecker();
-
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
@@ -14241,9 +13147,9 @@
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
- element: elementTypeChecker,
+ element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
- node: nodeTypeChecker,
+ node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
@@ -14251,19 +13157,17 @@
};
function createChainableTypeChecker(validate) {
- function checkType(isRequired, props, propName, componentName, location) {
+ function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
+ propFullName = propFullName || propName;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
- return new Error(
- ("Required " + locationName + " `" + propName + "` was not specified in ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
}
return null;
} else {
- return validate(props, propName, componentName, location);
+ return validate(props, propName, componentName, location, propFullName);
}
}
@@ -14274,7 +13178,7 @@
}
function createPrimitiveTypeChecker(expectedType) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
@@ -14284,10 +13188,7 @@
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
- ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
@@ -14299,18 +13200,15 @@
}
function createArrayOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
- var error = typeChecker(propValue, i, componentName, location);
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -14321,13 +13219,10 @@
}
function createElementTypeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactElement.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
@@ -14335,14 +13230,12 @@
}
function createInstanceTypeChecker(expectedClass) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
- );
+ var actualClassName = getClassName(props[propName]);
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
@@ -14350,7 +13243,13 @@
}
function createEnumTypeChecker(expectedValues) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(expectedValues)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
@@ -14360,28 +13259,22 @@
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
- ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
- var error = typeChecker(propValue, key, componentName, location);
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -14393,31 +13286,31 @@
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(arrayOfTypeCheckers)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
- if (checker(props, propName, componentName, location) == null) {
+ if (checker(props, propName, componentName, location, propFullName, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED') == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactNode.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
@@ -14425,22 +13318,19 @@
}
function createShapeTypeChecker(shapeTypes) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
- ("supplied to `" + componentName + "`, expected `object`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
- var error = checker(propValue, key, componentName, location);
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error) {
return error;
}
@@ -14465,12 +13355,32 @@
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
- propValue = ReactFragment.extractIfFragment(propValue);
- for (var k in propValue) {
- if (!isNode(propValue[k])) {
+
+ var iteratorFn = getIteratorFn(propValue);
+ if (iteratorFn) {
+ var iterator = iteratorFn.call(propValue);
+ var step;
+ if (iteratorFn !== propValue.entries) {
+ while (!(step = iterator.next()).done) {
+ if (!isNode(step.value)) {
+ return false;
+ }
+ }
+ } else {
+ // Iterator will provide entry [k,v] tuples rather than values.
+ while (!(step = iterator.next()).done) {
+ var entry = step.value;
+ if (entry) {
+ if (!isNode(entry[1])) {
return false;
}
}
+ }
+ }
+ } else {
+ return false;
+ }
+
return true;
default:
return false;
@@ -14506,65 +13416,16 @@
return propType;
}
-module.exports = ReactPropTypes;
-
-},{"129":129,"63":63,"69":69,"84":84}],87:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactPutListenerQueue
- */
-
-'use strict';
-
-var PooledClass = _dereq_(30);
-var ReactBrowserEventEmitter = _dereq_(33);
-
-var assign = _dereq_(29);
-
-function ReactPutListenerQueue() {
- this.listenersToPut = [];
-}
-
-assign(ReactPutListenerQueue.prototype, {
- enqueuePutListener: function(rootNodeID, propKey, propValue) {
- this.listenersToPut.push({
- rootNodeID: rootNodeID,
- propKey: propKey,
- propValue: propValue
- });
- },
-
- putListeners: function() {
- for (var i = 0; i < this.listenersToPut.length; i++) {
- var listenerToPut = this.listenersToPut[i];
- ReactBrowserEventEmitter.putListener(
- listenerToPut.rootNodeID,
- listenerToPut.propKey,
- listenerToPut.propValue
- );
+// Returns class name of the object, if any.
+function getClassName(propValue) {
+ if (!propValue.constructor || !propValue.constructor.name) {
+ return '<<anonymous>>';
}
- },
-
- reset: function() {
- this.listenersToPut.length = 0;
- },
-
- destructor: function() {
- this.reset();
- }
-});
-
-PooledClass.addPoolingTo(ReactPutListenerQueue);
-
-module.exports = ReactPutListenerQueue;
+ return propValue.constructor.name;
+}
-},{"29":29,"30":30,"33":33}],88:[function(_dereq_,module,exports){
+module.exports = ReactPropTypes;
+},{"129":129,"153":153,"57":57,"80":80}],83:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14579,14 +13440,14 @@
'use strict';
-var CallbackQueue = _dereq_(7);
-var PooledClass = _dereq_(30);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactInputSelection = _dereq_(71);
-var ReactPutListenerQueue = _dereq_(87);
-var Transaction = _dereq_(116);
+var CallbackQueue = _dereq_(6);
+var PooledClass = _dereq_(25);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactDOMFeatureFlags = _dereq_(44);
+var ReactInputSelection = _dereq_(66);
+var Transaction = _dereq_(113);
-var assign = _dereq_(29);
+var assign = _dereq_(24);
/**
* Ensures that, when possible, the selection range (currently selected text
@@ -14613,7 +13474,7 @@
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
- initialize: function() {
+ initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
@@ -14621,10 +13482,10 @@
/**
* @param {boolean} previouslyEnabled Enabled status of
- * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
+ * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
- close: function(previouslyEnabled) {
+ close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
@@ -14637,39 +13498,24 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
- close: function() {
+ close: function () {
this.reactMountReady.notifyAll();
}
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: function() {
- this.putListenerQueue.putListeners();
- }
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- SELECTION_RESTORATION,
- EVENT_SUPPRESSION,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
/**
* Currently:
@@ -14685,7 +13531,7 @@
*
* @class ReactReconcileTransaction
*/
-function ReactReconcileTransaction() {
+function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
@@ -14694,7 +13540,7 @@
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}
var Mixin = {
@@ -14702,34 +13548,27 @@
* @see Transaction
* @abstract
* @final
- * @return {array<object>} List of operation wrap proceedures.
+ * @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};
@@ -14733,14 +13572,12 @@
}
};
-
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
-
-},{"116":116,"29":29,"30":30,"33":33,"7":7,"71":71,"87":87}],89:[function(_dereq_,module,exports){
+},{"113":113,"24":24,"25":25,"28":28,"44":44,"6":6,"66":66}],84:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14754,8 +13591,7 @@
'use strict';
-var ReactRef = _dereq_(90);
-var ReactElementValidator = _dereq_(64);
+var ReactRef = _dereq_(85);
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
@@ -14777,14 +13613,11 @@
* @final
* @internal
*/
- mountComponent: function(internalInstance, rootID, transaction, context) {
+ mountComponent: function (internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(
- internalInstance._currentElement
- );
- }
+ if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
+ }
return markup;
},
@@ -14794,7 +13627,7 @@
* @final
* @internal
*/
- unmountComponent: function(internalInstance) {
+ unmountComponent: function (internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
@@ -14808,12 +13641,10 @@
* @param {object} context
* @internal
*/
- receiveComponent: function(
- internalInstance, nextElement, transaction, context
- ) {
+ receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
- if (nextElement === prevElement && nextElement._owner != null) {
+ if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
@@ -14821,17 +13652,13 @@
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
- return;
- }
- if ("production" !== "development") {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
+ // TODO: Bailing out early is just a perf optimization right?
+ // TODO: Removing the return statement should affect correctness?
+ return;
}
- var refsChanged = ReactRef.shouldUpdateRefs(
- prevElement,
- nextElement
- );
+ var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
@@ -14839,7 +13666,7 @@
internalInstance.receiveComponent(nextElement, transaction, context);
- if (refsChanged) {
+ if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
@@ -14851,18 +13678,14 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(
- internalInstance,
- transaction
- ) {
+ performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
}
};
module.exports = ReactReconciler;
-
-},{"64":64,"90":90}],90:[function(_dereq_,module,exports){
+},{"85":85}],85:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14876,7 +13699,7 @@
'use strict';
-var ReactOwner = _dereq_(81);
+var ReactOwner = _dereq_(77);
var ReactRef = {};
@@ -14898,14 +13721,17 @@
}
}
-ReactRef.attachRefs = function(instance, element) {
+ReactRef.attachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
-ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
+ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
@@ -14918,13 +13744,19 @@
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
- return (
- nextElement._owner !== prevElement._owner ||
- nextElement.ref !== prevElement.ref
+ var prevEmpty = prevElement === null || prevElement === false;
+ var nextEmpty = nextElement === null || nextElement === false;
+
+ return(
+ // This has a few false positives w/r/t empty components.
+ prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
-ReactRef.detachRefs = function(instance, element) {
+ReactRef.detachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
@@ -14932,8 +13764,7 @@
};
module.exports = ReactRef;
-
-},{"81":81}],91:[function(_dereq_,module,exports){
+},{"77":77}],86:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14952,7 +13783,7 @@
/**
* @param {function} _createReactRootIndex
*/
- injectCreateReactRootIndex: function(_createReactRootIndex) {
+ injectCreateReactRootIndex: function (_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
@@ -14963,8 +13794,31 @@
};
module.exports = ReactRootIndex;
+},{}],87:[function(_dereq_,module,exports){
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactServerBatchingStrategy
+ * @typechecks
+ */
+
+'use strict';
+
+var ReactServerBatchingStrategy = {
+ isBatchingUpdates: false,
+ batchedUpdates: function (callback) {
+ // Don't do anything here. During the server rendering we don't want to
+ // schedule any updates. We will simply ignore them.
+ }
+};
-},{}],92:[function(_dereq_,module,exports){
+module.exports = ReactServerBatchingStrategy;
+},{}],88:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -14978,39 +13832,42 @@
*/
'use strict';
-var ReactElement = _dereq_(63);
-var ReactInstanceHandles = _dereq_(72);
-var ReactMarkupChecksum = _dereq_(76);
-var ReactServerRenderingTransaction =
- _dereq_(93);
-
-var emptyObject = _dereq_(130);
-var instantiateReactComponent = _dereq_(149);
-var invariant = _dereq_(150);
+var ReactDefaultBatchingStrategy = _dereq_(53);
+var ReactElement = _dereq_(57);
+var ReactInstanceHandles = _dereq_(67);
+var ReactMarkupChecksum = _dereq_(71);
+var ReactServerBatchingStrategy = _dereq_(87);
+var ReactServerRenderingTransaction = _dereq_(89);
+var ReactUpdates = _dereq_(96);
+
+var emptyObject = _dereq_(154);
+var instantiateReactComponent = _dereq_(132);
+var invariant = _dereq_(161);
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(element),
- 'renderToString(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
- var markup =
- componentInstance.mountComponent(id, transaction, emptyObject);
+ var markup = componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
@@ -15020,22 +13877,24 @@
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(element),
- 'renderToStaticMarkup(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
@@ -15043,8 +13902,7 @@
renderToString: renderToString,
renderToStaticMarkup: renderToStaticMarkup
};
-
-},{"130":130,"149":149,"150":150,"63":63,"72":72,"76":76,"93":93}],93:[function(_dereq_,module,exports){
+},{"132":132,"154":154,"161":161,"53":53,"57":57,"67":67,"71":71,"87":87,"89":89,"96":96}],89:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -15059,13 +13917,12 @@
'use strict';
-var PooledClass = _dereq_(30);
-var CallbackQueue = _dereq_(7);
-var ReactPutListenerQueue = _dereq_(87);
-var Transaction = _dereq_(116);
+var PooledClass = _dereq_(25);
+var CallbackQueue = _dereq_(6);
+var Transaction = _dereq_(113);
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
@@ -15075,30 +13932,19 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
close: emptyFunction
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: emptyFunction
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
/**
* @class ReactServerRenderingTransaction
@@ -15108,7 +13954,7 @@
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = false;
}
var Mixin = {
@@ -15116,48 +13962,35 @@
* @see Transaction
* @abstract
* @final
- * @return {array} Empty list of operation wrap proceedures.
+ * @return {array} Empty list of operation wrap procedures.
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};
-
-assign(
- ReactServerRenderingTransaction.prototype,
- Transaction.Mixin,
- Mixin
-);
+assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
-
-},{"116":116,"129":129,"29":29,"30":30,"7":7,"87":87}],94:[function(_dereq_,module,exports){
+},{"113":113,"153":153,"24":24,"25":25,"6":6}],90:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15182,8 +14015,8 @@
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
- createStateSetter: function(component, funcReturningState) {
- return function(a, b, c, d, e, f) {
+ createStateSetter: function (component, funcReturningState) {
+ return function (a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
@@ -15202,7 +14035,7 @@
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
- createStateKeySetter: function(component, key) {
+ createStateKeySetter: function (component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
@@ -15237,7 +14070,7 @@
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
- createStateSetter: function(funcReturningState) {
+ createStateSetter: function (funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
@@ -15256,14 +14089,13 @@
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
- createStateKeySetter: function(key) {
+ createStateKeySetter: function (key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};
module.exports = ReactStateSetters;
-
-},{}],95:[function(_dereq_,module,exports){
+},{}],91:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15277,22 +14109,24 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginHub = _dereq_(18);
-var EventPropagators = _dereq_(21);
-var React = _dereq_(31);
-var ReactElement = _dereq_(63);
-var ReactEmptyComponent = _dereq_(65);
-var ReactBrowserEventEmitter = _dereq_(33);
-var ReactCompositeComponent = _dereq_(43);
-var ReactInstanceHandles = _dereq_(72);
-var ReactInstanceMap = _dereq_(73);
-var ReactMount = _dereq_(77);
-var ReactUpdates = _dereq_(100);
-var SyntheticEvent = _dereq_(108);
-
-var assign = _dereq_(29);
-var emptyObject = _dereq_(130);
+var EventConstants = _dereq_(15);
+var EventPluginHub = _dereq_(16);
+var EventPropagators = _dereq_(19);
+var React = _dereq_(26);
+var ReactDOM = _dereq_(40);
+var ReactElement = _dereq_(57);
+var ReactBrowserEventEmitter = _dereq_(28);
+var ReactCompositeComponent = _dereq_(38);
+var ReactInstanceHandles = _dereq_(67);
+var ReactInstanceMap = _dereq_(68);
+var ReactMount = _dereq_(72);
+var ReactUpdates = _dereq_(96);
+var SyntheticEvent = _dereq_(105);
+
+var assign = _dereq_(24);
+var emptyObject = _dereq_(154);
+var findDOMNode = _dereq_(122);
+var invariant = _dereq_(161);
var topLevelTypes = EventConstants.topLevelTypes;
@@ -15302,74 +14136,97 @@
* @class ReactTestUtils
*/
+function findAllInRenderedTreeInternal(inst, test) {
+ if (!inst || !inst.getPublicInstance) {
+ return [];
+ }
+ var publicInst = inst.getPublicInstance();
+ var ret = test(publicInst) ? [publicInst] : [];
+ var currentElement = inst._currentElement;
+ if (ReactTestUtils.isDOMComponent(publicInst)) {
+ var renderedChildren = inst._renderedChildren;
+ var key;
+ for (key in renderedChildren) {
+ if (!renderedChildren.hasOwnProperty(key)) {
+ continue;
+ }
+ ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
+ }
+ } else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
+ ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
+ }
+ return ret;
+}
+
/**
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
var ReactTestUtils = {
- renderIntoDocument: function(instance) {
+ renderIntoDocument: function (instance) {
var div = document.createElement('div');
// None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
- return React.render(instance, div);
+ return ReactDOM.render(instance, div);
},
- isElement: function(element) {
+ isElement: function (element) {
return ReactElement.isValidElement(element);
},
- isElementOfType: function(inst, convenienceConstructor) {
- return (
- ReactElement.isValidElement(inst) &&
- inst.type === convenienceConstructor
- );
+ isElementOfType: function (inst, convenienceConstructor) {
+ return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
},
- isDOMComponent: function(inst) {
- // TODO: Fix this heuristic. It's just here because composites can currently
- // pretend to be DOM components.
- return !!(inst && inst.tagName && inst.getDOMNode);
+ isDOMComponent: function (inst) {
+ return !!(inst && inst.nodeType === 1 && inst.tagName);
},
- isDOMComponentElement: function(inst) {
- return !!(inst &&
- ReactElement.isValidElement(inst) &&
- !!inst.tagName);
+ isDOMComponentElement: function (inst) {
+ return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
},
- isCompositeComponent: function(inst) {
- return typeof inst.render === 'function' &&
- typeof inst.setState === 'function';
+ isCompositeComponent: function (inst) {
+ if (ReactTestUtils.isDOMComponent(inst)) {
+ // Accessing inst.setState warns; just return false as that'll be what
+ // this returns when we have DOM nodes as refs directly
+ return false;
+ }
+ return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
},
- isCompositeComponentWithType: function(inst, type) {
- return !!(ReactTestUtils.isCompositeComponent(inst) &&
- (inst.constructor === type));
+ isCompositeComponentWithType: function (inst, type) {
+ if (!ReactTestUtils.isCompositeComponent(inst)) {
+ return false;
+ }
+ var internalInstance = ReactInstanceMap.get(inst);
+ var constructor = internalInstance._currentElement.type;
+
+ return constructor === type;
},
- isCompositeComponentElement: function(inst) {
+ isCompositeComponentElement: function (inst) {
if (!ReactElement.isValidElement(inst)) {
return false;
}
// We check the prototype of the type that will get mounted, not the
// instance itself. This is a future proof way of duck typing.
var prototype = inst.type.prototype;
- return (
- typeof prototype.render === 'function' &&
- typeof prototype.setState === 'function'
- );
+ return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
},
- isCompositeComponentElementWithType: function(inst, type) {
- return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
- (inst.constructor === type));
+ isCompositeComponentElementWithType: function (inst, type) {
+ var internalInstance = ReactInstanceMap.get(inst);
+ var constructor = internalInstance._currentElement.type;
+
+ return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
},
- getRenderedChildOfCompositeComponent: function(inst) {
+ getRenderedChildOfCompositeComponent: function (inst) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return null;
}
@@ -15377,53 +14234,36 @@
return internalInstance._renderedComponent.getPublicInstance();
},
- findAllInRenderedTree: function(inst, test) {
+ findAllInRenderedTree: function (inst, test) {
if (!inst) {
return [];
}
- var ret = test(inst) ? [inst] : [];
- if (ReactTestUtils.isDOMComponent(inst)) {
- var internalInstance = ReactInstanceMap.get(inst);
- var renderedChildren = internalInstance
- ._renderedComponent
- ._renderedChildren;
- var key;
- for (key in renderedChildren) {
- if (!renderedChildren.hasOwnProperty(key)) {
- continue;
- }
- if (!renderedChildren[key].getPublicInstance) {
- continue;
- }
- ret = ret.concat(
- ReactTestUtils.findAllInRenderedTree(
- renderedChildren[key].getPublicInstance(),
- test
- )
- );
- }
- } else if (ReactTestUtils.isCompositeComponent(inst)) {
- ret = ret.concat(
- ReactTestUtils.findAllInRenderedTree(
- ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
- test
- )
- );
- }
- return ret;
+ !ReactTestUtils.isCompositeComponent(inst) ? "development" !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
+ return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the class name matching `className`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedDOMComponentsWithClass: function(root, className) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- var instClassName = inst.props.className;
- return ReactTestUtils.isDOMComponent(inst) && (
- (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
- );
+ scryRenderedDOMComponentsWithClass: function (root, classNames) {
+ if (!Array.isArray(classNames)) {
+ classNames = classNames.split(/\s+/);
+ }
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ if (ReactTestUtils.isDOMComponent(inst)) {
+ var className = inst.className;
+ if (typeof className !== 'string') {
+ // SVG, probably.
+ className = inst.getAttribute('class') || '';
+ }
+ var classList = className.split(/\s+/);
+ return classNames.every(function (name) {
+ return classList.indexOf(name) !== -1;
+ });
+ }
+ return false;
});
},
@@ -15433,13 +14273,10 @@
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
- findRenderedDOMComponentWithClass: function(root, className) {
- var all =
- ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
+ findRenderedDOMComponentWithClass: function (root, className) {
+ var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
- throw new Error('Did not find exactly one match ' +
- '(found: ' + all.length + ') for class:' + className
- );
+ throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
}
return all[0];
},
@@ -15444,16 +14281,14 @@
return all[0];
},
-
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedDOMComponentsWithTag: function(root, tagName) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- return ReactTestUtils.isDOMComponent(inst) &&
- inst.tagName === tagName.toUpperCase();
+ scryRenderedDOMComponentsWithTag: function (root, tagName) {
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
},
@@ -15463,7 +14298,7 @@
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
- findRenderedDOMComponentWithTag: function(root, tagName) {
+ findRenderedDOMComponentWithTag: function (root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for tag:' + tagName);
@@ -15471,17 +14306,13 @@
return all[0];
},
-
/**
* Finds all instances of components with type equal to `componentType`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedComponentsWithType: function(root, componentType) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- return ReactTestUtils.isCompositeComponentWithType(
- inst,
- componentType
- );
+ scryRenderedComponentsWithType: function (root, componentType) {
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
},
@@ -15491,15 +14322,10 @@
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
- findRenderedComponentWithType: function(root, componentType) {
- var all = ReactTestUtils.scryRenderedComponentsWithType(
- root,
- componentType
- );
+ findRenderedComponentWithType: function (root, componentType) {
+ var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
- throw new Error(
- 'Did not find exactly one match for componentType:' + componentType
- );
+ throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
}
return all[0];
},
@@ -15517,62 +14343,46 @@
* module.mockTagName if provided)
* @return {object} the ReactTestUtils object (for chaining)
*/
- mockComponent: function(module, mockTagName) {
- mockTagName = mockTagName || module.mockTagName || "div";
+ mockComponent: function (module, mockTagName) {
+ mockTagName = mockTagName || module.mockTagName || 'div';
- module.prototype.render.mockImplementation(function() {
- return React.createElement(
- mockTagName,
- null,
- this.props.children
- );
+ module.prototype.render.mockImplementation(function () {
+ return React.createElement(mockTagName, null, this.props.children);
});
return this;
},
/**
- * Simulates a top level event being dispatched from a raw event that occured
+ * Simulates a top level event being dispatched from a raw event that occurred
* on an `Element` node.
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
* @param {!Element} node The dom to simulate an event occurring on.
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
- simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
+ simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
- ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
- topLevelType,
- fakeNativeEvent
- );
+ ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
},
/**
- * Simulates a top level event being dispatched from a raw event that occured
+ * Simulates a top level event being dispatched from a raw event that occurred
* on the `ReactDOMComponent` `comp`.
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
- * @param comp {!ReactDOMComponent}
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
+ * @param {!ReactDOMComponent} comp
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
- simulateNativeEventOnDOMComponent: function(
- topLevelType,
- comp,
- fakeNativeEvent) {
- ReactTestUtils.simulateNativeEventOnNode(
- topLevelType,
- comp.getDOMNode(),
- fakeNativeEvent
- );
+ simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
+ ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
},
- nativeTouchData: function(x, y) {
+ nativeTouchData: function (x, y) {
return {
- touches: [
- {pageX: x, pageY: y}
- ]
+ touches: [{ pageX: x, pageY: y }]
};
},
- createRenderer: function() {
+ createRenderer: function () {
return new ReactShallowRenderer();
},
@@ -15583,73 +14393,70 @@
/**
* @class ReactShallowRenderer
*/
-var ReactShallowRenderer = function() {
+var ReactShallowRenderer = function () {
this._instance = null;
};
-ReactShallowRenderer.prototype.getRenderOutput = function() {
- return (
- (this._instance && this._instance._renderedComponent &&
- this._instance._renderedComponent._renderedOutput)
- || null
- );
+ReactShallowRenderer.prototype.getRenderOutput = function () {
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
};
-var NoopInternalComponent = function(element) {
+var NoopInternalComponent = function (element) {
this._renderedOutput = element;
- this._currentElement = element === null || element === false ?
- ReactEmptyComponent.emptyElement :
- element;
+ this._currentElement = element;
};
NoopInternalComponent.prototype = {
- mountComponent: function() {
- },
+ mountComponent: function () {},
- receiveComponent: function(element) {
+ receiveComponent: function (element) {
this._renderedOutput = element;
- this._currentElement = element === null || element === false ?
- ReactEmptyComponent.emptyElement :
- element;
+ this._currentElement = element;
},
- unmountComponent: function() {
- }
+ unmountComponent: function () {},
+ getPublicInstance: function () {
+ return null;
+ }
};
-var ShallowComponentWrapper = function() { };
-assign(
- ShallowComponentWrapper.prototype,
- ReactCompositeComponent.Mixin, {
- _instantiateReactComponent: function(element) {
+var ShallowComponentWrapper = function () {};
+assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
+ _instantiateReactComponent: function (element) {
return new NoopInternalComponent(element);
},
- _replaceNodeWithMarkupByID: function() {},
- _renderValidatedComponent:
- ReactCompositeComponent.Mixin.
- _renderValidatedComponentWithoutOwnerOrContext
- }
-);
+ _replaceNodeWithMarkupByID: function () {},
+ _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
+});
+
+ReactShallowRenderer.prototype.render = function (element, context) {
+ !ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : undefined;
+ !(typeof element.type !== 'string') ? "development" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : undefined;
-ReactShallowRenderer.prototype.render = function(element, context) {
if (!context) {
context = emptyObject;
}
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
- this._render(element, transaction, context);
- ReactUpdates.ReactReconcileTransaction.release(transaction);
+ ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
};
-ReactShallowRenderer.prototype.unmount = function() {
+function _batchedRender(renderer, element, context) {
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
+ renderer._render(element, transaction, context);
+ ReactUpdates.ReactReconcileTransaction.release(transaction);
+}
+
+ReactShallowRenderer.prototype.unmount = function () {
if (this._instance) {
this._instance.unmountComponent();
}
};
-ReactShallowRenderer.prototype._render = function(element, transaction, context) {
- if (!this._instance) {
+ReactShallowRenderer.prototype._render = function (element, transaction, context) {
+ if (this._instance) {
+ this._instance.receiveComponent(element, transaction, context);
+ } else {
var rootID = ReactInstanceHandles.createReactRootID();
var instance = new ShallowComponentWrapper(element.type);
instance.construct(element);
@@ -15657,8 +14464,6 @@
instance.mountComponent(rootID, transaction, context);
this._instance = instance;
- } else {
- this._instance.receiveComponent(element, transaction, context);
}
};
@@ -15671,29 +14476,32 @@
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
- return function(domComponentOrNode, eventData) {
+ return function (domComponentOrNode, eventData) {
var node;
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- node = domComponentOrNode.getDOMNode();
+ node = findDOMNode(domComponentOrNode);
} else if (domComponentOrNode.tagName) {
node = domComponentOrNode;
}
+ var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
+
var fakeNativeEvent = new Event();
fakeNativeEvent.target = node;
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
- var event = new SyntheticEvent(
- ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
- ReactMount.getID(node),
- fakeNativeEvent
- );
+ var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
assign(event, eventData);
+
+ if (dispatchConfig.phasedRegistrationNames) {
EventPropagators.accumulateTwoPhaseDispatches(event);
+ } else {
+ EventPropagators.accumulateDirectDispatches(event);
+ }
- ReactUpdates.batchedUpdates(function() {
+ ReactUpdates.batchedUpdates(function () {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(true);
});
};
}
@@ -15704,7 +14512,7 @@
var eventType;
for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
/**
- * @param {!Element || ReactDOMComponent} domComponentOrNode
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
@@ -15713,12 +14521,12 @@
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
-EventPluginHub.injection.injectEventPluginOrder = function() {
+EventPluginHub.injection.injectEventPluginOrder = function () {
oldInjectEventPluginOrder.apply(this, arguments);
buildSimulators();
};
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
-EventPluginHub.injection.injectEventPluginsByName = function() {
+EventPluginHub.injection.injectEventPluginsByName = function () {
oldInjectEventPlugins.apply(this, arguments);
buildSimulators();
};
@@ -15742,42 +14550,30 @@
*/
function makeNativeSimulator(eventType) {
- return function(domComponentOrNode, nativeEventData) {
+ return function (domComponentOrNode, nativeEventData) {
var fakeNativeEvent = new Event(eventType);
assign(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- ReactTestUtils.simulateNativeEventOnDOMComponent(
- eventType,
- domComponentOrNode,
- fakeNativeEvent
- );
- } else if (!!domComponentOrNode.tagName) {
+ ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
+ } else if (domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
- ReactTestUtils.simulateNativeEventOnNode(
- eventType,
- domComponentOrNode,
- fakeNativeEvent
- );
+ ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
}
};
}
-var eventType;
-for (eventType in topLevelTypes) {
+Object.keys(topLevelTypes).forEach(function (eventType) {
// Event type is stored as 'topClick' - we transform that to 'click'
- var convenienceName = eventType.indexOf('top') === 0 ?
- eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
+ var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
/**
- * @param {!Element || ReactDOMComponent} domComponentOrNode
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
- ReactTestUtils.SimulateNative[convenienceName] =
- makeNativeSimulator(eventType);
-}
+ ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
+});
module.exports = ReactTestUtils;
-
-},{"100":100,"108":108,"130":130,"16":16,"18":18,"21":21,"29":29,"31":31,"33":33,"43":43,"63":63,"65":65,"72":72,"73":73,"77":77}],96:[function(_dereq_,module,exports){
+},{"105":105,"122":122,"15":15,"154":154,"16":16,"161":161,"19":19,"24":24,"26":26,"28":28,"38":38,"40":40,"57":57,"67":67,"68":68,"72":72,"96":96}],92:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15792,24 +14588,21 @@
'use strict';
-var ReactChildren = _dereq_(37);
-var ReactFragment = _dereq_(69);
+var flattenChildren = _dereq_(123);
var ReactTransitionChildMapping = {
/**
* Given `this.props.children`, return an object mapping key to child. Just
- * simple syntactic sugar around ReactChildren.map().
+ * simple syntactic sugar around flattenChildren().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
- getChildMapping: function(children) {
+ getChildMapping: function (children) {
if (!children) {
return children;
}
- return ReactFragment.extract(ReactChildren.map(children, function(child) {
- return child;
- }));
+ return flattenChildren(children);
},
/**
@@ -15829,7 +14622,7 @@
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
- mergeChildMappings: function(prev, next) {
+ mergeChildMappings: function (prev, next) {
prev = prev || {};
next = next || {};
@@ -15863,9 +14656,7 @@
if (nextKeysPending.hasOwnProperty(nextKey)) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
- childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
- pendingNextKey
- );
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
}
}
childMapping[nextKey] = getValueForKey(nextKey);
@@ -15881,8 +14672,7 @@
};
module.exports = ReactTransitionChildMapping;
-
-},{"37":37,"69":69}],97:[function(_dereq_,module,exports){
+},{"123":123}],93:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -15896,7 +14686,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
/**
* EVENT_NAME_MAP is used to determine which event fired when a
@@ -15969,31 +14759,30 @@
}
var ReactTransitionEvents = {
- addEndEventListener: function(node, eventListener) {
+ addEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
- endEvents.forEach(function(endEvent) {
+ endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
- removeEndEventListener: function(node, eventListener) {
+ removeEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
return;
}
- endEvents.forEach(function(endEvent) {
+ endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
-
-},{"22":22}],98:[function(_dereq_,module,exports){
+},{"147":147}],94:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16007,12 +14796,11 @@
'use strict';
-var React = _dereq_(31);
-var ReactTransitionChildMapping = _dereq_(96);
+var React = _dereq_(26);
+var ReactTransitionChildMapping = _dereq_(92);
-var assign = _dereq_(29);
-var cloneWithProps = _dereq_(122);
-var emptyFunction = _dereq_(129);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
@@ -16022,26 +14810,26 @@
childFactory: React.PropTypes.func
},
- getDefaultProps: function() {
+ getDefaultProps: function () {
return {
component: 'span',
childFactory: emptyFunction.thatReturnsArgument
};
},
- getInitialState: function() {
+ getInitialState: function () {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
- componentWillMount: function() {
+ componentWillMount: function () {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
- componentDidMount: function() {
+ componentDidMount: function () {
var initialChildMapping = this.state.children;
for (var key in initialChildMapping) {
if (initialChildMapping[key]) {
@@ -16050,33 +14838,26 @@
}
},
- componentWillReceiveProps: function(nextProps) {
- var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
- nextProps.children
- );
+ componentWillReceiveProps: function (nextProps) {
+ var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
var prevChildMapping = this.state.children;
this.setState({
- children: ReactTransitionChildMapping.mergeChildMappings(
- prevChildMapping,
- nextChildMapping
- )
+ children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
- if (nextChildMapping[key] && !hasPrev &&
- !this.currentlyTransitioningKeys[key]) {
+ if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
- if (prevChildMapping[key] && !hasNext &&
- !this.currentlyTransitioningKeys[key]) {
+ if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
@@ -16084,7 +14865,7 @@
// If we want to someday check for reordering, we could do it here.
},
- componentDidUpdate: function() {
+ componentDidUpdate: function () {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
@@ -16094,21 +14875,19 @@
keysToLeave.forEach(this.performLeave);
},
- performAppear: function(key) {
+ performAppear: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillAppear) {
- component.componentWillAppear(
- this._handleDoneAppearing.bind(this, key)
- );
+ component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
} else {
this._handleDoneAppearing(key);
}
},
- _handleDoneAppearing: function(key) {
+ _handleDoneAppearing: function (key) {
var component = this.refs[key];
if (component.componentDidAppear) {
component.componentDidAppear();
@@ -16116,9 +14895,7 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully appeared. Remove it.
@@ -16126,21 +14903,19 @@
}
},
- performEnter: function(key) {
+ performEnter: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
- component.componentWillEnter(
- this._handleDoneEntering.bind(this, key)
- );
+ component.componentWillEnter(this._handleDoneEntering.bind(this, key));
} else {
this._handleDoneEntering(key);
}
},
- _handleDoneEntering: function(key) {
+ _handleDoneEntering: function (key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
@@ -16148,9 +14923,7 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
@@ -16158,7 +14931,7 @@
}
},
- performLeave: function(key) {
+ performLeave: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
@@ -16172,7 +14945,7 @@
}
},
- _handleDoneLeaving: function(key) {
+ _handleDoneLeaving: function (key) {
var component = this.refs[key];
if (component.componentDidLeave) {
@@ -16181,21 +14954,21 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
- var newChildren = assign({}, this.state.children);
+ this.setState(function (state) {
+ var newChildren = assign({}, state.children);
delete newChildren[key];
- this.setState({children: newChildren});
+ return { children: newChildren };
+ });
}
},
- render: function() {
+ render: function () {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = [];
@@ -16207,23 +14980,15 @@
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
- childrenToRender.push(cloneWithProps(
- this.props.childFactory(child),
- {ref: key, key: key}
- ));
+ childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
}
}
- return React.createElement(
- this.props.component,
- this.props,
- childrenToRender
- );
+ return React.createElement(this.props.component, this.props, childrenToRender);
}
});
module.exports = ReactTransitionGroup;
-
-},{"122":122,"129":129,"29":29,"31":31,"96":96}],99:[function(_dereq_,module,exports){
+},{"153":153,"24":24,"26":26,"92":92}],95:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
@@ -16237,55 +15002,33 @@
'use strict';
-var ReactLifeCycle = _dereq_(74);
-var ReactCurrentOwner = _dereq_(45);
-var ReactElement = _dereq_(63);
-var ReactInstanceMap = _dereq_(73);
-var ReactUpdates = _dereq_(100);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactCurrentOwner = _dereq_(39);
+var ReactElement = _dereq_(57);
+var ReactInstanceMap = _dereq_(68);
+var ReactUpdates = _dereq_(96);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
function enqueueUpdate(internalInstance) {
- if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
- // If we're in a componentWillMount handler, don't enqueue a rerender
- // because ReactUpdates assumes we're in a browser context (which is
- // wrong for server rendering) and we're about to do a render anyway.
- // See bug in #1740.
ReactUpdates.enqueueUpdate(internalInstance);
- }
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
- ("production" !== "development" ? invariant(
- ReactCurrentOwner.current == null,
- '%s(...): Cannot update during an existing state transition ' +
- '(such as within `render`). Render methods should be a pure function ' +
- 'of props and state.',
- callerName
- ) : invariant(ReactCurrentOwner.current == null));
-
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
- ("production" !== "development" ? warning(
- !callerName,
- '%s(...): Can only update a mounted or mounting component. ' +
- 'This usually means you called %s() on an unmounted ' +
- 'component. This is a no-op.',
- callerName,
- callerName
- ) : null);
+ "development" !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
}
return null;
}
- if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
- return null;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
return internalInstance;
@@ -16298,6 +15041,32 @@
var ReactUpdateQueue = {
/**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ if ("development" !== 'production') {
+ var owner = ReactCurrentOwner.current;
+ if (owner !== null) {
+ "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
+ owner._warnedAboutRefsInRender = true;
+ }
+ }
+ var internalInstance = ReactInstanceMap.get(publicInstance);
+ if (internalInstance) {
+ // During componentWillMount and render this will still be null but after
+ // that will always render to something. At least for now. So we can use
+ // this hack.
+ return !!internalInstance._renderedComponent;
+ } else {
+ return false;
+ }
+ },
+
+ /**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
@@ -16305,13 +15074,8 @@
* @param {?function} callback Called after state is updated.
* @internal
*/
- enqueueCallback: function(publicInstance, callback) {
- ("production" !== "development" ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallback: function (publicInstance, callback) {
+ !(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
@@ -16319,8 +15083,7 @@
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
- if (!internalInstance ||
- internalInstance === ReactLifeCycle.currentlyMountingInstance) {
+ if (!internalInstance) {
return null;
}
@@ -16336,13 +15099,8 @@
enqueueUpdate(internalInstance);
},
- enqueueCallbackInternal: function(internalInstance, callback) {
- ("production" !== "development" ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallbackInternal: function (internalInstance, callback) {
+ !(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
@@ -16358,17 +15116,14 @@
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
- * This will not invoke `shouldUpdateComponent`, but it will invoke
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
- enqueueForceUpdate: function(publicInstance) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'forceUpdate'
- );
+ enqueueForceUpdate: function (publicInstance) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
@@ -16390,11 +15145,8 @@
* @param {object} completeState Next state.
* @internal
*/
- enqueueReplaceState: function(publicInstance, completeState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceState'
- );
+ enqueueReplaceState: function (publicInstance, completeState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
@@ -16416,19 +15168,14 @@
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
- enqueueSetState: function(publicInstance, partialState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setState'
- );
+ enqueueSetState: function (publicInstance, partialState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
- var queue =
- internalInstance._pendingStateQueue ||
- (internalInstance._pendingStateQueue = []);
+ var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
@@ -16441,36 +15188,26 @@
* @param {object} partialProps Subset of the next props.
* @internal
*/
- enqueueSetProps: function(publicInstance, partialProps) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setProps'
- );
-
+ enqueueSetProps: function (publicInstance, partialProps) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
+ },
- ("production" !== "development" ? invariant(
- internalInstance._isTopLevel,
- 'setProps(...): You called `setProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueSetPropsInternal: function (internalInstance, partialProps) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? "development" !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
/**
@@ -16480,38 +15217,28 @@
* @param {object} props New props.
* @internal
*/
- enqueueReplaceProps: function(publicInstance, props) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceProps'
- );
-
+ enqueueReplaceProps: function (publicInstance, props) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
+ },
- ("production" !== "development" ? invariant(
- internalInstance._isTopLevel,
- 'replaceProps(...): You called `replaceProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueReplacePropsInternal: function (internalInstance, props) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? "development" !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
- enqueueElementInternal: function(internalInstance, newElement) {
+ enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}
@@ -16519,8 +15246,7 @@
};
module.exports = ReactUpdateQueue;
-
-},{"100":100,"150":150,"171":171,"29":29,"45":45,"63":63,"73":73,"74":74}],100:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"24":24,"39":39,"57":57,"68":68,"96":96}],96:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16534,16 +15260,14 @@
'use strict';
-var CallbackQueue = _dereq_(7);
-var PooledClass = _dereq_(30);
-var ReactCurrentOwner = _dereq_(45);
-var ReactPerf = _dereq_(82);
-var ReactReconciler = _dereq_(89);
-var Transaction = _dereq_(116);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var CallbackQueue = _dereq_(6);
+var PooledClass = _dereq_(25);
+var ReactPerf = _dereq_(78);
+var ReactReconciler = _dereq_(84);
+var Transaction = _dereq_(113);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
@@ -16552,18 +15276,14 @@
var batchingStrategy = null;
function ensureInjected() {
- ("production" !== "development" ? invariant(
- ReactUpdates.ReactReconcileTransaction && batchingStrategy,
- 'ReactUpdates: must inject a reconcile transaction class and batching ' +
- 'strategy'
- ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
+ !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
}
var NESTED_UPDATES = {
- initialize: function() {
+ initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
- close: function() {
+ close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
@@ -16579,10 +15299,10 @@
};
var UPDATE_QUEUEING = {
- initialize: function() {
+ initialize: function () {
this.callbackQueue.reset();
},
- close: function() {
+ close: function () {
this.callbackQueue.notifyAll();
}
};
@@ -16593,18 +15313,15 @@
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
- this.reconcileTransaction =
- ReactUpdates.ReactReconcileTransaction.getPooled();
+ this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}
-assign(
- ReactUpdatesFlushTransaction.prototype,
- Transaction.Mixin, {
- getTransactionWrappers: function() {
+assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
- destructor: function() {
+ destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
@@ -16612,25 +15329,18 @@
this.reconcileTransaction = null;
},
- perform: function(method, scope, a) {
+ perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
- return Transaction.Mixin.perform.call(
- this,
- this.reconcileTransaction.perform,
- this.reconcileTransaction,
- method,
- scope,
- a
- );
+ return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
-function batchedUpdates(callback, a, b, c, d) {
+function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
- batchingStrategy.batchedUpdates(callback, a, b, c, d);
+ batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
@@ -16646,13 +15356,7 @@
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
- ("production" !== "development" ? invariant(
- len === dirtyComponents.length,
- 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
- 'match dirty-components array length (%s).',
- len,
- dirtyComponents.length
- ) : invariant(len === dirtyComponents.length));
+ !(len === dirtyComponents.length) ? "development" !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
@@ -16671,23 +15375,17 @@
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
- ReactReconciler.performUpdateIfNecessary(
- component,
- transaction.reconcileTransaction
- );
+ ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
- transaction.callbackQueue.enqueue(
- callbacks[j],
- component.getPublicInstance()
- );
+ transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
-var flushBatchedUpdates = function() {
+var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
@@ -16708,11 +15406,7 @@
}
}
};
-flushBatchedUpdates = ReactPerf.measure(
- 'ReactUpdates',
- 'flushBatchedUpdates',
- flushBatchedUpdates
-);
+flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
/**
* Mark a component as needing a rerender, adding an optional callback to a
@@ -16726,13 +15420,6 @@
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
- ("production" !== "development" ? warning(
- ReactCurrentOwner.current == null,
- 'enqueueUpdate(): Render methods should be a pure function of props ' +
- 'and state; triggering nested component updates from render is not ' +
- 'allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
@@ -16747,37 +15434,21 @@
* if no updates are currently being performed.
*/
function asap(callback, context) {
- ("production" !== "development" ? invariant(
- batchingStrategy.isBatchingUpdates,
- 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
- 'updates are not being batched.'
- ) : invariant(batchingStrategy.isBatchingUpdates));
+ !batchingStrategy.isBatchingUpdates ? "development" !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
- injectReconcileTransaction: function(ReconcileTransaction) {
- ("production" !== "development" ? invariant(
- ReconcileTransaction,
- 'ReactUpdates: must provide a reconcile transaction class'
- ) : invariant(ReconcileTransaction));
+ injectReconcileTransaction: function (ReconcileTransaction) {
+ !ReconcileTransaction ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
- injectBatchingStrategy: function(_batchingStrategy) {
- ("production" !== "development" ? invariant(
- _batchingStrategy,
- 'ReactUpdates: must provide a batching strategy'
- ) : invariant(_batchingStrategy));
- ("production" !== "development" ? invariant(
- typeof _batchingStrategy.batchedUpdates === 'function',
- 'ReactUpdates: must provide a batchedUpdates() function'
- ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
- ("production" !== "development" ? invariant(
- typeof _batchingStrategy.isBatchingUpdates === 'boolean',
- 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
- ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
+ injectBatchingStrategy: function (_batchingStrategy) {
+ !_batchingStrategy ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.batchedUpdates === 'function') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
batchingStrategy = _batchingStrategy;
}
};
@@ -16799,8 +15470,22 @@
};
module.exports = ReactUpdates;
+},{"113":113,"161":161,"24":24,"25":25,"6":6,"78":78,"84":84}],97:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactVersion
+ */
+
+'use strict';
-},{"116":116,"150":150,"171":171,"29":29,"30":30,"45":45,"7":7,"82":82,"89":89}],101:[function(_dereq_,module,exports){
+module.exports = '0.14.9';
+},{}],98:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16812,14 +15497,17 @@
* @providesModule SVGDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
-var DOMProperty = _dereq_(11);
+var DOMProperty = _dereq_(10);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
+var NS = {
+ xlink: 'http://www.w3.org/1999/xlink',
+ xml: 'http://www.w3.org/XML/1998/namespace'
+};
+
var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
@@ -16863,10 +15551,32 @@
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
+ xlinkActuate: MUST_USE_ATTRIBUTE,
+ xlinkArcrole: MUST_USE_ATTRIBUTE,
+ xlinkHref: MUST_USE_ATTRIBUTE,
+ xlinkRole: MUST_USE_ATTRIBUTE,
+ xlinkShow: MUST_USE_ATTRIBUTE,
+ xlinkTitle: MUST_USE_ATTRIBUTE,
+ xlinkType: MUST_USE_ATTRIBUTE,
+ xmlBase: MUST_USE_ATTRIBUTE,
+ xmlLang: MUST_USE_ATTRIBUTE,
+ xmlSpace: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
+ DOMAttributeNamespaces: {
+ xlinkActuate: NS.xlink,
+ xlinkArcrole: NS.xlink,
+ xlinkHref: NS.xlink,
+ xlinkRole: NS.xlink,
+ xlinkShow: NS.xlink,
+ xlinkTitle: NS.xlink,
+ xlinkType: NS.xlink,
+ xmlBase: NS.xml,
+ xmlLang: NS.xml,
+ xmlSpace: NS.xml
+ },
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
@@ -16888,13 +15598,22 @@
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
- viewBox: 'viewBox'
+ viewBox: 'viewBox',
+ xlinkActuate: 'xlink:actuate',
+ xlinkArcrole: 'xlink:arcrole',
+ xlinkHref: 'xlink:href',
+ xlinkRole: 'xlink:role',
+ xlinkShow: 'xlink:show',
+ xlinkTitle: 'xlink:title',
+ xlinkType: 'xlink:type',
+ xmlBase: 'xml:base',
+ xmlLang: 'xml:lang',
+ xmlSpace: 'xml:space'
}
};
module.exports = SVGDOMPropertyConfig;
-
-},{"11":11}],102:[function(_dereq_,module,exports){
+},{"10":10}],99:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -16908,33 +15627,28 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPropagators = _dereq_(21);
-var ReactInputSelection = _dereq_(71);
-var SyntheticEvent = _dereq_(108);
-
-var getActiveElement = _dereq_(136);
-var isTextInputElement = _dereq_(153);
-var keyOf = _dereq_(157);
-var shallowEqual = _dereq_(166);
+var EventConstants = _dereq_(15);
+var EventPropagators = _dereq_(19);
+var ExecutionEnvironment = _dereq_(147);
+var ReactInputSelection = _dereq_(66);
+var SyntheticEvent = _dereq_(105);
+
+var getActiveElement = _dereq_(156);
+var isTextInputElement = _dereq_(134);
+var keyOf = _dereq_(166);
+var shallowEqual = _dereq_(171);
var topLevelTypes = EventConstants.topLevelTypes;
+var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
+
var eventTypes = {
select: {
phasedRegistrationNames: {
- bubbled: keyOf({onSelect: null}),
- captured: keyOf({onSelectCapture: null})
+ bubbled: keyOf({ onSelect: null }),
+ captured: keyOf({ onSelectCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topContextMenu,
- topLevelTypes.topFocus,
- topLevelTypes.topKeyDown,
- topLevelTypes.topMouseDown,
- topLevelTypes.topMouseUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
}
};
@@ -16943,6 +15657,11 @@
var lastSelection = null;
var mouseDown = false;
+// Track whether a listener exists for this plugin. If none exist, we do
+// not extract events.
+var hasListener = false;
+var ON_SELECT_KEY = keyOf({ onSelect: null });
+
/**
* Get an object which is a unique representation of the current selection.
*
@@ -16950,11 +15669,10 @@
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
- * @param {object}
+ * @return {object}
*/
function getSelection(node) {
- if ('selectionStart' in node &&
- ReactInputSelection.hasSelectionCapabilities(node)) {
+ if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
@@ -16984,14 +15702,12 @@
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
-function constructSelectEvent(nativeEvent) {
+function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
- if (mouseDown ||
- activeElement == null ||
- activeElement !== getActiveElement()) {
+ if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
@@ -17000,11 +15716,7 @@
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
- var syntheticEvent = SyntheticEvent.getPooled(
- eventTypes.select,
- activeElementID,
- nativeEvent
- );
+ var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
@@ -17013,6 +15725,8 @@
return syntheticEvent;
}
+
+ return null;
}
/**
@@ -17041,17 +15755,15 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (!hasListener) {
+ return null;
+ }
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
- if (isTextInputElement(topLevelTarget) ||
- topLevelTarget.contentEditable === 'true') {
+ if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
@@ -17071,25 +15783,39 @@
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
- // sometimes when it hasn't).
+ // sometimes when it hasn't). IE's event fires out of order with respect
+ // to key and input events on deletion, so we discard it.
+ //
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
+ // This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
+ if (skipSelectionChangeEvent) {
+ break;
+ }
+ // falls through
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
+ }
+
+ return null;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ if (registrationName === ON_SELECT_KEY) {
+ hasListener = true;
}
}
};
module.exports = SelectEventPlugin;
-
-},{"108":108,"136":136,"153":153,"157":157,"16":16,"166":166,"21":21,"71":71}],103:[function(_dereq_,module,exports){
+},{"105":105,"134":134,"147":147,"15":15,"156":156,"166":166,"171":171,"19":19,"66":66}],100:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17113,14 +15839,13 @@
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
-
-},{}],104:[function(_dereq_,module,exports){
+},{}],101:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17134,244 +15859,379 @@
'use strict';
-var EventConstants = _dereq_(16);
-var EventPluginUtils = _dereq_(20);
-var EventPropagators = _dereq_(21);
-var SyntheticClipboardEvent = _dereq_(105);
-var SyntheticEvent = _dereq_(108);
-var SyntheticFocusEvent = _dereq_(109);
-var SyntheticKeyboardEvent = _dereq_(111);
-var SyntheticMouseEvent = _dereq_(112);
-var SyntheticDragEvent = _dereq_(107);
-var SyntheticTouchEvent = _dereq_(113);
-var SyntheticUIEvent = _dereq_(114);
-var SyntheticWheelEvent = _dereq_(115);
-
-var getEventCharCode = _dereq_(137);
-
-var invariant = _dereq_(150);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var EventConstants = _dereq_(15);
+var EventListener = _dereq_(146);
+var EventPropagators = _dereq_(19);
+var ReactMount = _dereq_(72);
+var SyntheticClipboardEvent = _dereq_(102);
+var SyntheticEvent = _dereq_(105);
+var SyntheticFocusEvent = _dereq_(106);
+var SyntheticKeyboardEvent = _dereq_(108);
+var SyntheticMouseEvent = _dereq_(109);
+var SyntheticDragEvent = _dereq_(104);
+var SyntheticTouchEvent = _dereq_(110);
+var SyntheticUIEvent = _dereq_(111);
+var SyntheticWheelEvent = _dereq_(112);
+
+var emptyFunction = _dereq_(153);
+var getEventCharCode = _dereq_(125);
+var invariant = _dereq_(161);
+var keyOf = _dereq_(166);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
+ abort: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onAbort: true }),
+ captured: keyOf({ onAbortCapture: true })
+ }
+ },
blur: {
phasedRegistrationNames: {
- bubbled: keyOf({onBlur: true}),
- captured: keyOf({onBlurCapture: true})
+ bubbled: keyOf({ onBlur: true }),
+ captured: keyOf({ onBlurCapture: true })
+ }
+ },
+ canPlay: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlay: true }),
+ captured: keyOf({ onCanPlayCapture: true })
+ }
+ },
+ canPlayThrough: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlayThrough: true }),
+ captured: keyOf({ onCanPlayThroughCapture: true })
}
},
click: {
phasedRegistrationNames: {
- bubbled: keyOf({onClick: true}),
- captured: keyOf({onClickCapture: true})
+ bubbled: keyOf({ onClick: true }),
+ captured: keyOf({ onClickCapture: true })
}
},
contextMenu: {
phasedRegistrationNames: {
- bubbled: keyOf({onContextMenu: true}),
- captured: keyOf({onContextMenuCapture: true})
+ bubbled: keyOf({ onContextMenu: true }),
+ captured: keyOf({ onContextMenuCapture: true })
}
},
copy: {
phasedRegistrationNames: {
- bubbled: keyOf({onCopy: true}),
- captured: keyOf({onCopyCapture: true})
+ bubbled: keyOf({ onCopy: true }),
+ captured: keyOf({ onCopyCapture: true })
}
},
cut: {
phasedRegistrationNames: {
- bubbled: keyOf({onCut: true}),
- captured: keyOf({onCutCapture: true})
+ bubbled: keyOf({ onCut: true }),
+ captured: keyOf({ onCutCapture: true })
}
},
doubleClick: {
phasedRegistrationNames: {
- bubbled: keyOf({onDoubleClick: true}),
- captured: keyOf({onDoubleClickCapture: true})
+ bubbled: keyOf({ onDoubleClick: true }),
+ captured: keyOf({ onDoubleClickCapture: true })
}
},
drag: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrag: true}),
- captured: keyOf({onDragCapture: true})
+ bubbled: keyOf({ onDrag: true }),
+ captured: keyOf({ onDragCapture: true })
}
},
dragEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnd: true}),
- captured: keyOf({onDragEndCapture: true})
+ bubbled: keyOf({ onDragEnd: true }),
+ captured: keyOf({ onDragEndCapture: true })
}
},
dragEnter: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnter: true}),
- captured: keyOf({onDragEnterCapture: true})
+ bubbled: keyOf({ onDragEnter: true }),
+ captured: keyOf({ onDragEnterCapture: true })
}
},
dragExit: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragExit: true}),
- captured: keyOf({onDragExitCapture: true})
+ bubbled: keyOf({ onDragExit: true }),
+ captured: keyOf({ onDragExitCapture: true })
}
},
dragLeave: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragLeave: true}),
- captured: keyOf({onDragLeaveCapture: true})
+ bubbled: keyOf({ onDragLeave: true }),
+ captured: keyOf({ onDragLeaveCapture: true })
}
},
dragOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragOver: true}),
- captured: keyOf({onDragOverCapture: true})
+ bubbled: keyOf({ onDragOver: true }),
+ captured: keyOf({ onDragOverCapture: true })
}
},
dragStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragStart: true}),
- captured: keyOf({onDragStartCapture: true})
+ bubbled: keyOf({ onDragStart: true }),
+ captured: keyOf({ onDragStartCapture: true })
}
},
drop: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrop: true}),
- captured: keyOf({onDropCapture: true})
+ bubbled: keyOf({ onDrop: true }),
+ captured: keyOf({ onDropCapture: true })
+ }
+ },
+ durationChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onDurationChange: true }),
+ captured: keyOf({ onDurationChangeCapture: true })
+ }
+ },
+ emptied: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEmptied: true }),
+ captured: keyOf({ onEmptiedCapture: true })
+ }
+ },
+ encrypted: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEncrypted: true }),
+ captured: keyOf({ onEncryptedCapture: true })
+ }
+ },
+ ended: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEnded: true }),
+ captured: keyOf({ onEndedCapture: true })
+ }
+ },
+ error: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onError: true }),
+ captured: keyOf({ onErrorCapture: true })
}
},
focus: {
phasedRegistrationNames: {
- bubbled: keyOf({onFocus: true}),
- captured: keyOf({onFocusCapture: true})
+ bubbled: keyOf({ onFocus: true }),
+ captured: keyOf({ onFocusCapture: true })
}
},
input: {
phasedRegistrationNames: {
- bubbled: keyOf({onInput: true}),
- captured: keyOf({onInputCapture: true})
+ bubbled: keyOf({ onInput: true }),
+ captured: keyOf({ onInputCapture: true })
}
},
keyDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyDown: true}),
- captured: keyOf({onKeyDownCapture: true})
+ bubbled: keyOf({ onKeyDown: true }),
+ captured: keyOf({ onKeyDownCapture: true })
}
},
keyPress: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyPress: true}),
- captured: keyOf({onKeyPressCapture: true})
+ bubbled: keyOf({ onKeyPress: true }),
+ captured: keyOf({ onKeyPressCapture: true })
}
},
keyUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyUp: true}),
- captured: keyOf({onKeyUpCapture: true})
+ bubbled: keyOf({ onKeyUp: true }),
+ captured: keyOf({ onKeyUpCapture: true })
}
},
load: {
phasedRegistrationNames: {
- bubbled: keyOf({onLoad: true}),
- captured: keyOf({onLoadCapture: true})
+ bubbled: keyOf({ onLoad: true }),
+ captured: keyOf({ onLoadCapture: true })
}
},
- error: {
+ loadedData: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadedData: true }),
+ captured: keyOf({ onLoadedDataCapture: true })
+ }
+ },
+ loadedMetadata: {
phasedRegistrationNames: {
- bubbled: keyOf({onError: true}),
- captured: keyOf({onErrorCapture: true})
+ bubbled: keyOf({ onLoadedMetadata: true }),
+ captured: keyOf({ onLoadedMetadataCapture: true })
+ }
+ },
+ loadStart: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadStart: true }),
+ captured: keyOf({ onLoadStartCapture: true })
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseDown: true}),
- captured: keyOf({onMouseDownCapture: true})
+ bubbled: keyOf({ onMouseDown: true }),
+ captured: keyOf({ onMouseDownCapture: true })
}
},
mouseMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseMove: true}),
- captured: keyOf({onMouseMoveCapture: true})
+ bubbled: keyOf({ onMouseMove: true }),
+ captured: keyOf({ onMouseMoveCapture: true })
}
},
mouseOut: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOut: true}),
- captured: keyOf({onMouseOutCapture: true})
+ bubbled: keyOf({ onMouseOut: true }),
+ captured: keyOf({ onMouseOutCapture: true })
}
},
mouseOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOver: true}),
- captured: keyOf({onMouseOverCapture: true})
+ bubbled: keyOf({ onMouseOver: true }),
+ captured: keyOf({ onMouseOverCapture: true })
}
},
mouseUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseUp: true}),
- captured: keyOf({onMouseUpCapture: true})
+ bubbled: keyOf({ onMouseUp: true }),
+ captured: keyOf({ onMouseUpCapture: true })
}
},
paste: {
phasedRegistrationNames: {
- bubbled: keyOf({onPaste: true}),
- captured: keyOf({onPasteCapture: true})
+ bubbled: keyOf({ onPaste: true }),
+ captured: keyOf({ onPasteCapture: true })
+ }
+ },
+ pause: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPause: true }),
+ captured: keyOf({ onPauseCapture: true })
+ }
+ },
+ play: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlay: true }),
+ captured: keyOf({ onPlayCapture: true })
+ }
+ },
+ playing: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlaying: true }),
+ captured: keyOf({ onPlayingCapture: true })
+ }
+ },
+ progress: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onProgress: true }),
+ captured: keyOf({ onProgressCapture: true })
+ }
+ },
+ rateChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onRateChange: true }),
+ captured: keyOf({ onRateChangeCapture: true })
}
},
reset: {
phasedRegistrationNames: {
- bubbled: keyOf({onReset: true}),
- captured: keyOf({onResetCapture: true})
+ bubbled: keyOf({ onReset: true }),
+ captured: keyOf({ onResetCapture: true })
}
},
scroll: {
phasedRegistrationNames: {
- bubbled: keyOf({onScroll: true}),
- captured: keyOf({onScrollCapture: true})
+ bubbled: keyOf({ onScroll: true }),
+ captured: keyOf({ onScrollCapture: true })
+ }
+ },
+ seeked: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeked: true }),
+ captured: keyOf({ onSeekedCapture: true })
+ }
+ },
+ seeking: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeking: true }),
+ captured: keyOf({ onSeekingCapture: true })
+ }
+ },
+ stalled: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onStalled: true }),
+ captured: keyOf({ onStalledCapture: true })
}
},
submit: {
phasedRegistrationNames: {
- bubbled: keyOf({onSubmit: true}),
- captured: keyOf({onSubmitCapture: true})
+ bubbled: keyOf({ onSubmit: true }),
+ captured: keyOf({ onSubmitCapture: true })
+ }
+ },
+ suspend: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSuspend: true }),
+ captured: keyOf({ onSuspendCapture: true })
+ }
+ },
+ timeUpdate: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onTimeUpdate: true }),
+ captured: keyOf({ onTimeUpdateCapture: true })
}
},
touchCancel: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchCancel: true}),
- captured: keyOf({onTouchCancelCapture: true})
+ bubbled: keyOf({ onTouchCancel: true }),
+ captured: keyOf({ onTouchCancelCapture: true })
}
},
touchEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchEnd: true}),
- captured: keyOf({onTouchEndCapture: true})
+ bubbled: keyOf({ onTouchEnd: true }),
+ captured: keyOf({ onTouchEndCapture: true })
}
},
touchMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchMove: true}),
- captured: keyOf({onTouchMoveCapture: true})
+ bubbled: keyOf({ onTouchMove: true }),
+ captured: keyOf({ onTouchMoveCapture: true })
}
},
touchStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchStart: true}),
- captured: keyOf({onTouchStartCapture: true})
+ bubbled: keyOf({ onTouchStart: true }),
+ captured: keyOf({ onTouchStartCapture: true })
+ }
+ },
+ volumeChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onVolumeChange: true }),
+ captured: keyOf({ onVolumeChangeCapture: true })
+ }
+ },
+ waiting: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onWaiting: true }),
+ captured: keyOf({ onWaitingCapture: true })
}
},
wheel: {
phasedRegistrationNames: {
- bubbled: keyOf({onWheel: true}),
- captured: keyOf({onWheelCapture: true})
+ bubbled: keyOf({ onWheel: true }),
+ captured: keyOf({ onWheelCapture: true })
}
}
};
var topLevelEventsToDispatchConfig = {
+ topAbort: eventTypes.abort,
topBlur: eventTypes.blur,
+ topCanPlay: eventTypes.canPlay,
+ topCanPlayThrough: eventTypes.canPlayThrough,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
@@ -17385,6 +16245,10 @@
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
+ topDurationChange: eventTypes.durationChange,
+ topEmptied: eventTypes.emptied,
+ topEncrypted: eventTypes.encrypted,
+ topEnded: eventTypes.ended,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
@@ -17392,19 +16256,34 @@
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
+ topLoadedData: eventTypes.loadedData,
+ topLoadedMetadata: eventTypes.loadedMetadata,
+ topLoadStart: eventTypes.loadStart,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
+ topPause: eventTypes.pause,
+ topPlay: eventTypes.play,
+ topPlaying: eventTypes.playing,
+ topProgress: eventTypes.progress,
+ topRateChange: eventTypes.rateChange,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
+ topSeeked: eventTypes.seeked,
+ topSeeking: eventTypes.seeking,
+ topStalled: eventTypes.stalled,
topSubmit: eventTypes.submit,
+ topSuspend: eventTypes.suspend,
+ topTimeUpdate: eventTypes.timeUpdate,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
+ topVolumeChange: eventTypes.volumeChange,
+ topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
};
@@ -17412,35 +16291,14 @@
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
+var ON_CLICK_KEY = keyOf({ onClick: null });
+var onClickListeners = {};
+
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
- * Same as the default implementation, except cancels the event when return
- * value is false. This behavior will be disabled in a future release.
- *
- * @param {object} Event to be dispatched.
- * @param {function} Application-level callback.
- * @param {string} domID DOM ID to pass to the callback.
- */
- executeDispatch: function(event, listener, domID) {
- var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
-
- ("production" !== "development" ? warning(
- typeof returnValue !== 'boolean',
- 'Returning `false` from an event handler is deprecated and will be ' +
- 'ignored in a future release. Instead, manually call ' +
- 'e.stopPropagation() or e.preventDefault(), as appropriate.'
- ) : null);
-
- if (returnValue === false) {
- event.stopPropagation();
- event.preventDefault();
- }
- },
-
- /**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
@@ -17448,22 +16306,40 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
+ case topLevelTypes.topAbort:
+ case topLevelTypes.topCanPlay:
+ case topLevelTypes.topCanPlayThrough:
+ case topLevelTypes.topDurationChange:
+ case topLevelTypes.topEmptied:
+ case topLevelTypes.topEncrypted:
+ case topLevelTypes.topEnded:
+ case topLevelTypes.topError:
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
- case topLevelTypes.topError:
+ case topLevelTypes.topLoadedData:
+ case topLevelTypes.topLoadedMetadata:
+ case topLevelTypes.topLoadStart:
+ case topLevelTypes.topPause:
+ case topLevelTypes.topPlay:
+ case topLevelTypes.topPlaying:
+ case topLevelTypes.topProgress:
+ case topLevelTypes.topRateChange:
case topLevelTypes.topReset:
+ case topLevelTypes.topSeeked:
+ case topLevelTypes.topSeeking:
+ case topLevelTypes.topStalled:
case topLevelTypes.topSubmit:
+ case topLevelTypes.topSuspend:
+ case topLevelTypes.topTimeUpdate:
+ case topLevelTypes.topVolumeChange:
+ case topLevelTypes.topWaiting:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
@@ -17528,25 +16404,36 @@
EventConstructor = SyntheticClipboardEvent;
break;
}
- ("production" !== "development" ? invariant(
- EventConstructor,
- 'SimpleEventPlugin: Unhandled event type, `%s`.',
- topLevelType
- ) : invariant(EventConstructor));
- var event = EventConstructor.getPooled(
- dispatchConfig,
- topLevelTargetID,
- nativeEvent
- );
+ !EventConstructor ? "development" !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
+ var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ // Mobile Safari does not fire properly bubble click events on
+ // non-interactive elements, which means delegated click listeners do not
+ // fire. The workaround for this bug involves attaching an empty click
+ // listener on the target node.
+ if (registrationName === ON_CLICK_KEY) {
+ var node = ReactMount.getNode(id);
+ if (!onClickListeners[id]) {
+ onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
+ }
+ }
+ },
+
+ willDeleteListener: function (id, registrationName) {
+ if (registrationName === ON_CLICK_KEY) {
+ onClickListeners[id].remove();
+ delete onClickListeners[id];
+ }
}
};
module.exports = SimpleEventPlugin;
-
-},{"105":105,"107":107,"108":108,"109":109,"111":111,"112":112,"113":113,"114":114,"115":115,"137":137,"150":150,"157":157,"16":16,"171":171,"20":20,"21":21}],105:[function(_dereq_,module,exports){
+},{"102":102,"104":104,"105":105,"106":106,"108":108,"109":109,"110":110,"111":111,"112":112,"125":125,"146":146,"15":15,"153":153,"161":161,"166":166,"19":19,"72":72}],102:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17561,19 +16448,15 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
- clipboardData: function(event) {
- return (
- 'clipboardData' in event ?
- event.clipboardData :
- window.clipboardData
- );
+ clipboardData: function (event) {
+ return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
@@ -17583,15 +16466,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
-
-},{"108":108}],106:[function(_dereq_,module,exports){
+},{"105":105}],103:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17606,7 +16488,7 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
/**
* @interface Event
@@ -17622,21 +16504,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticCompositionEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticCompositionEvent,
- CompositionEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
-
-},{"108":108}],107:[function(_dereq_,module,exports){
+},{"105":105}],104:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17651,7 +16526,7 @@
'use strict';
-var SyntheticMouseEvent = _dereq_(112);
+var SyntheticMouseEvent = _dereq_(109);
/**
* @interface DragEvent
@@ -17667,15 +16542,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
-
-},{"112":112}],108:[function(_dereq_,module,exports){
+},{"109":109}],105:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17690,11 +16564,11 @@
'use strict';
-var PooledClass = _dereq_(30);
+var PooledClass = _dereq_(25);
-var assign = _dereq_(29);
-var emptyFunction = _dereq_(129);
-var getEventTarget = _dereq_(140);
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
+var warning = _dereq_(173);
/**
* @interface Event
@@ -17702,13 +16576,13 @@
*/
var EventInterface = {
type: null,
- target: getEventTarget,
+ target: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
- timeStamp: function(event) {
+ timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
@@ -17732,7 +16606,7 @@
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
-function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
+function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
@@ -17746,13 +16620,15 @@
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
+ if (propName === 'target') {
+ this.target = nativeEventTarget;
+ } else {
this[propName] = nativeEvent[propName];
}
}
+ }
- var defaultPrevented = nativeEvent.defaultPrevented != null ?
- nativeEvent.defaultPrevented :
- nativeEvent.returnValue === false;
+ var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
@@ -17763,9 +16639,16 @@
assign(SyntheticEvent.prototype, {
- preventDefault: function() {
+ preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
+ }
+ if (!event) {
+ return;
+ }
+
if (event.preventDefault) {
event.preventDefault();
} else {
@@ -17774,8 +16657,15 @@
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
- stopPropagation: function() {
+ stopPropagation: function () {
var event = this.nativeEvent;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
+ }
+ if (!event) {
+ return;
+ }
+
if (event.stopPropagation) {
event.stopPropagation();
} else {
@@ -17789,7 +16679,7 @@
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
- persist: function() {
+ persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
@@ -17803,7 +16693,7 @@
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
- destructor: function() {
+ destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
@@ -17823,7 +16713,7 @@
* @param {function} Class
* @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function(Class, Interface) {
+SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
@@ -17834,14 +16724,13 @@
Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
- PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
+ PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
-PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
+PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
-
-},{"129":129,"140":140,"29":29,"30":30}],109:[function(_dereq_,module,exports){
+},{"153":153,"173":173,"24":24,"25":25}],106:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17856,7 +16745,7 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
+var SyntheticUIEvent = _dereq_(111);
/**
* @interface FocusEvent
@@ -17872,15 +16761,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
-
-},{"114":114}],110:[function(_dereq_,module,exports){
+},{"111":111}],107:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17895,7 +16783,7 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
/**
* @interface Event
@@ -17912,21 +16800,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticInputEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticInputEvent,
- InputEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
-
-},{"108":108}],111:[function(_dereq_,module,exports){
+},{"105":105}],108:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -17941,11 +16822,11 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
+var SyntheticUIEvent = _dereq_(111);
-var getEventCharCode = _dereq_(137);
-var getEventKey = _dereq_(138);
-var getEventModifierState = _dereq_(139);
+var getEventCharCode = _dereq_(125);
+var getEventKey = _dereq_(126);
+var getEventModifierState = _dereq_(127);
/**
* @interface KeyboardEvent
@@ -17962,7 +16843,7 @@
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
- charCode: function(event) {
+ charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
@@ -17973,7 +16854,7 @@
}
return 0;
},
- keyCode: function(event) {
+ keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
@@ -17986,7 +16867,7 @@
}
return 0;
},
- which: function(event) {
+ which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
@@ -18005,15 +16886,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
-
-},{"114":114,"137":137,"138":138,"139":139}],112:[function(_dereq_,module,exports){
+},{"111":111,"125":125,"126":126,"127":127}],109:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18028,10 +16908,10 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
-var ViewportMetrics = _dereq_(117);
+var SyntheticUIEvent = _dereq_(111);
+var ViewportMetrics = _dereq_(114);
-var getEventModifierState = _dereq_(139);
+var getEventModifierState = _dereq_(127);
/**
* @interface MouseEvent
@@ -18047,7 +16927,7 @@
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
- button: function(event) {
+ button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
@@ -18062,21 +16942,15 @@
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
- relatedTarget: function(event) {
- return event.relatedTarget || (
- ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
- );
+ relatedTarget: function (event) {
+ return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
- pageX: function(event) {
- return 'pageX' in event ?
- event.pageX :
- event.clientX + ViewportMetrics.currentScrollLeft;
- },
- pageY: function(event) {
- return 'pageY' in event ?
- event.pageY :
- event.clientY + ViewportMetrics.currentScrollTop;
+ pageX: function (event) {
+ return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
+ },
+ pageY: function (event) {
+ return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
@@ -18086,15 +16960,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
-
-},{"114":114,"117":117,"139":139}],113:[function(_dereq_,module,exports){
+},{"111":111,"114":114,"127":127}],110:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18109,9 +16982,9 @@
'use strict';
-var SyntheticUIEvent = _dereq_(114);
+var SyntheticUIEvent = _dereq_(111);
-var getEventModifierState = _dereq_(139);
+var getEventModifierState = _dereq_(127);
/**
* @interface TouchEvent
@@ -18134,15 +17007,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
-
-},{"114":114,"139":139}],114:[function(_dereq_,module,exports){
+},{"111":111,"127":127}],111:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18157,16 +17029,16 @@
'use strict';
-var SyntheticEvent = _dereq_(108);
+var SyntheticEvent = _dereq_(105);
-var getEventTarget = _dereq_(140);
+var getEventTarget = _dereq_(128);
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
- view: function(event) {
+ view: function (event) {
if (event.view) {
return event.view;
}
@@ -18185,7 +17057,7 @@
return window;
}
},
- detail: function(event) {
+ detail: function (event) {
return event.detail || 0;
}
};
@@ -18196,15 +17068,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
-function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
-
-},{"108":108,"140":140}],115:[function(_dereq_,module,exports){
+},{"105":105,"128":128}],112:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18219,28 +17090,24 @@
'use strict';
-var SyntheticMouseEvent = _dereq_(112);
+var SyntheticMouseEvent = _dereq_(109);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
- deltaX: function(event) {
- return (
- 'deltaX' in event ? event.deltaX :
+ deltaX: function (event) {
+ return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
- 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
- );
+ 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
- deltaY: function(event) {
- return (
- 'deltaY' in event ? event.deltaY :
+ deltaY: function (event) {
+ return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
- 'wheelDelta' in event ? -event.wheelDelta : 0
- );
+ 'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
@@ -18257,15 +17124,14 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
-function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
-
-},{"112":112}],116:[function(_dereq_,module,exports){
+},{"109":109}],113:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18279,7 +17145,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* `Transaction` creates a black box that is able to wrap any method such that
@@ -18350,12 +17216,12 @@
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
- reinitializeTransaction: function() {
+ reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
- if (!this.wrapperInitData) {
- this.wrapperInitData = [];
- } else {
+ if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
+ } else {
+ this.wrapperInitData = [];
}
this._isInTransaction = false;
},
@@ -18368,27 +17234,29 @@
*/
getTransactionWrappers: null,
- isInTransaction: function() {
+ isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
- * need to be safety checked.
+ * need to be safety checked. The optional arguments helps prevent the need
+ * to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
- * @param {Object?=} args... Arguments to pass to the method (optional).
- * Helps prevent need to bind in many cases.
- * @return Return value from `method`.
- */
- perform: function(method, scope, a, b, c, d, e, f) {
- ("production" !== "development" ? invariant(
- !this.isInTransaction(),
- 'Transaction.perform(...): Cannot initialize a transaction when there ' +
- 'is already an outstanding transaction.'
- ) : invariant(!this.isInTransaction()));
+ * @param {Object?=} a Argument to pass to the method.
+ * @param {Object?=} b Argument to pass to the method.
+ * @param {Object?=} c Argument to pass to the method.
+ * @param {Object?=} d Argument to pass to the method.
+ * @param {Object?=} e Argument to pass to the method.
+ * @param {Object?=} f Argument to pass to the method.
+ *
+ * @return {*} Return value from `method`.
+ */
+ perform: function (method, scope, a, b, c, d, e, f) {
+ !!this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
var errorThrown;
var ret;
try {
@@ -18408,8 +17276,7 @@
// by invoking `closeAll`.
try {
this.closeAll(0);
- } catch (err) {
- }
+ } catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
@@ -18422,7 +17289,7 @@
return ret;
},
- initializeAll: function(startIndex) {
+ initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -18432,9 +17299,7 @@
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
- this.wrapperInitData[i] = wrapper.initialize ?
- wrapper.initialize.call(this) :
- null;
+ this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
@@ -18442,8 +17307,7 @@
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
- } catch (err) {
- }
+ } catch (err) {}
}
}
}
@@ -18455,11 +17319,8 @@
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
- closeAll: function(startIndex) {
- ("production" !== "development" ? invariant(
- this.isInTransaction(),
- 'Transaction.closeAll(): Cannot close transaction when none are open.'
- ) : invariant(this.isInTransaction()));
+ closeAll: function (startIndex) {
+ !this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -18482,8 +17343,7 @@
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
- } catch (e) {
- }
+ } catch (e) {}
}
}
}
@@ -18496,15 +17356,14 @@
Mixin: Mixin,
/**
- * Token to look for to determine if an error occured.
+ * Token to look for to determine if an error occurred.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
-
-},{"150":150}],117:[function(_dereq_,module,exports){
+},{"161":161}],114:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18524,7 +17383,7 @@
currentScrollTop: 0,
- refreshScrollValues: function(scrollPosition) {
+ refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
@@ -18532,8 +17391,7 @@
};
module.exports = ViewportMetrics;
-
-},{}],118:[function(_dereq_,module,exports){
+},{}],115:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -18547,7 +17405,7 @@
'use strict';
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
*
@@ -18564,10 +17422,7 @@
*/
function accumulateInto(current, next) {
- ("production" !== "development" ? invariant(
- next != null,
- 'accumulateInto(...): Accumulated items must not be null or undefined.'
- ) : invariant(next != null));
+ !(next != null) ? "development" !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
if (current == null) {
return next;
}
@@ -18596,8 +17451,7 @@
}
module.exports = accumulateInto;
-
-},{"150":150}],119:[function(_dereq_,module,exports){
+},{"161":161}],116:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18609,29 +17463,38 @@
* @providesModule adler32
*/
-/* jslint bitwise:true */
-
'use strict';
var MOD = 65521;
-// This is a clean-room implementation of adler32 designed for detecting
-// if markup is not what we expect it to be. It does not need to be
-// cryptographically strong, only reasonably good at detecting if markup
-// generated on the server is different than that on the client.
+// adler32 is not cryptographically strong, and is only used to sanity check that
+// markup generated on the server matches the markup generated on the client.
+// This implementation (a modified version of the SheetJS version) has been optimized
+// for our use case, at the expense of conforming to the adler32 specification
+// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
- for (var i = 0; i < data.length; i++) {
- a = (a + data.charCodeAt(i)) % MOD;
- b = (b + a) % MOD;
- }
- return a | (b << 16);
+ var i = 0;
+ var l = data.length;
+ var m = l & ~0x3;
+ while (i < m) {
+ for (; i < Math.min(i + 4096, m); i += 4) {
+ b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
+ }
+ a %= MOD;
+ b %= MOD;
+ }
+ for (; i < l; i++) {
+ b += a += data.charCodeAt(i);
+ }
+ a %= MOD;
+ b %= MOD;
+ return a | b << 16;
}
module.exports = adler32;
-
-},{}],120:[function(_dereq_,module,exports){
+},{}],117:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18640,72 +17503,23 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule camelize
- * @typechecks
+ * @providesModule canDefineProperty
*/
-var _hyphenPattern = /-(.)/g;
-
-/**
- * Camelcases a hyphenated string, for example:
- *
- * > camelize('background-color')
- * < "backgroundColor"
- *
- * @param {string} string
- * @return {string}
- */
-function camelize(string) {
- return string.replace(_hyphenPattern, function(_, character) {
- return character.toUpperCase();
- });
-}
-
-module.exports = camelize;
-
-},{}],121:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule camelizeStyleName
- * @typechecks
- */
-
-"use strict";
-
-var camelize = _dereq_(120);
-
-var msPattern = /^-ms-/;
+'use strict';
-/**
- * Camelcases a hyphenated CSS property name, for example:
- *
- * > camelizeStyleName('background-color')
- * < "backgroundColor"
- * > camelizeStyleName('-moz-transition')
- * < "MozTransition"
- * > camelizeStyleName('-ms-transition')
- * < "msTransition"
- *
- * As Andi Smith suggests
- * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
- * is converted to lowercase `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function camelizeStyleName(string) {
- return camelize(string.replace(msPattern, 'ms-'));
+var canDefineProperty = false;
+if ("development" !== 'production') {
+ try {
+ Object.defineProperty({}, 'x', { get: function () {} });
+ canDefineProperty = true;
+ } catch (x) {
+ // IE will fail on defineProperty
+ }
}
-module.exports = camelizeStyleName;
-
-},{"120":120}],122:[function(_dereq_,module,exports){
+module.exports = canDefineProperty;
+},{}],118:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -18720,13 +17534,15 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactPropTransferer = _dereq_(83);
+var ReactElement = _dereq_(57);
+var ReactPropTransferer = _dereq_(79);
+
+var keyOf = _dereq_(166);
+var warning = _dereq_(173);
-var keyOf = _dereq_(157);
-var warning = _dereq_(171);
+var CHILDREN_PROP = keyOf({ children: null });
-var CHILDREN_PROP = keyOf({children: null});
+var didDeprecatedWarn = false;
/**
* Sometimes you want to change the props of a child passed to you. Usually
@@ -18736,365 +17552,29 @@
* @param {object} props props you'd like to modify. className and style will be
* merged automatically.
* @return {ReactElement} a clone of child with props merged in.
+ * @deprecated
*/
function cloneWithProps(child, props) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- !child.ref,
- 'You are calling cloneWithProps() on a child with a ref. This is ' +
- 'dangerous because you\'re creating a new child which will not be ' +
- 'added as a ref to its parent.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(didDeprecatedWarn, 'cloneWithProps(...) is deprecated. ' + 'Please use React.cloneElement instead.') : undefined;
+ didDeprecatedWarn = true;
+ "development" !== 'production' ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
}
var newProps = ReactPropTransferer.mergeProps(props, child.props);
// Use `child.props.children` if it is provided.
- if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
- child.props.hasOwnProperty(CHILDREN_PROP)) {
+ if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) {
newProps.children = child.props.children;
}
- // The current API doesn't retain _owner and _context, which is why this
+ // The current API doesn't retain _owner, which is why this
// doesn't use ReactElement.cloneAndReplaceProps.
return ReactElement.createElement(child.type, newProps);
}
module.exports = cloneWithProps;
-
-},{"157":157,"171":171,"63":63,"83":83}],123:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule containsNode
- * @typechecks
- */
-
-var isTextNode = _dereq_(154);
-
-/*jslint bitwise:true */
-
-/**
- * Checks if a given DOM node contains or is another DOM node.
- *
- * @param {?DOMNode} outerNode Outer DOM node.
- * @param {?DOMNode} innerNode Inner DOM node.
- * @return {boolean} True if `outerNode` contains or is `innerNode`.
- */
-function containsNode(outerNode, innerNode) {
- if (!outerNode || !innerNode) {
- return false;
- } else if (outerNode === innerNode) {
- return true;
- } else if (isTextNode(outerNode)) {
- return false;
- } else if (isTextNode(innerNode)) {
- return containsNode(outerNode, innerNode.parentNode);
- } else if (outerNode.contains) {
- return outerNode.contains(innerNode);
- } else if (outerNode.compareDocumentPosition) {
- return !!(outerNode.compareDocumentPosition(innerNode) & 16);
- } else {
- return false;
- }
-}
-
-module.exports = containsNode;
-
-},{"154":154}],124:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createArrayFromMixed
- * @typechecks
- */
-
-var toArray = _dereq_(168);
-
-/**
- * Perform a heuristic test to determine if an object is "array-like".
- *
- * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
- * Joshu replied: "Mu."
- *
- * This function determines if its argument has "array nature": it returns
- * true if the argument is an actual array, an `arguments' object, or an
- * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
- *
- * It will return false for other array-like objects like Filelist.
- *
- * @param {*} obj
- * @return {boolean}
- */
-function hasArrayNature(obj) {
- return (
- // not null/false
- !!obj &&
- // arrays are objects, NodeLists are functions in Safari
- (typeof obj == 'object' || typeof obj == 'function') &&
- // quacks like an array
- ('length' in obj) &&
- // not window
- !('setInterval' in obj) &&
- // no DOM node should be considered an array-like
- // a 'select' element has 'length' and 'item' properties on IE8
- (typeof obj.nodeType != 'number') &&
- (
- // a real array
- (// HTMLCollection/NodeList
- (Array.isArray(obj) ||
- // arguments
- ('callee' in obj) || 'item' in obj))
- )
- );
-}
-
-/**
- * Ensure that the argument is an array by wrapping it in an array if it is not.
- * Creates a copy of the argument if it is already an array.
- *
- * This is mostly useful idiomatically:
- *
- * var createArrayFromMixed = require('createArrayFromMixed');
- *
- * function takesOneOrMoreThings(things) {
- * things = createArrayFromMixed(things);
- * ...
- * }
- *
- * This allows you to treat `things' as an array, but accept scalars in the API.
- *
- * If you need to convert an array-like object, like `arguments`, into an array
- * use toArray instead.
- *
- * @param {*} obj
- * @return {array}
- */
-function createArrayFromMixed(obj) {
- if (!hasArrayNature(obj)) {
- return [obj];
- } else if (Array.isArray(obj)) {
- return obj.slice();
- } else {
- return toArray(obj);
- }
-}
-
-module.exports = createArrayFromMixed;
-
-},{"168":168}],125:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createFullPageComponent
- * @typechecks
- */
-
-'use strict';
-
-// Defeat circular references by requiring this directly.
-var ReactClass = _dereq_(38);
-var ReactElement = _dereq_(63);
-
-var invariant = _dereq_(150);
-
-/**
- * Create a component that will throw an exception when unmounted.
- *
- * Components like <html> <head> and <body> can't be removed or added
- * easily in a cross-browser way, however it's valuable to be able to
- * take advantage of React's reconciliation for styling and <title>
- * management. So we just document it and throw in dangerous cases.
- *
- * @param {string} tag The tag to wrap
- * @return {function} convenience constructor of new component
- */
-function createFullPageComponent(tag) {
- var elementFactory = ReactElement.createFactory(tag);
-
- var FullPageComponent = ReactClass.createClass({
- tagName: tag.toUpperCase(),
- displayName: 'ReactFullPageComponent' + tag,
-
- componentWillUnmount: function() {
- ("production" !== "development" ? invariant(
- false,
- '%s tried to unmount. Because of cross-browser quirks it is ' +
- 'impossible to unmount some top-level components (eg <html>, <head>, ' +
- 'and <body>) reliably and efficiently. To fix this, have a single ' +
- 'top-level component that never unmounts render these elements.',
- this.constructor.displayName
- ) : invariant(false));
- },
-
- render: function() {
- return elementFactory(this.props);
- }
- });
-
- return FullPageComponent;
-}
-
-module.exports = createFullPageComponent;
-
-},{"150":150,"38":38,"63":63}],126:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createNodesFromMarkup
- * @typechecks
- */
-
-/*jslint evil: true, sub: true */
-
-var ExecutionEnvironment = _dereq_(22);
-
-var createArrayFromMixed = _dereq_(124);
-var getMarkupWrap = _dereq_(142);
-var invariant = _dereq_(150);
-
-/**
- * Dummy container used to render all markup.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Pattern used by `getNodeName`.
- */
-var nodeNamePattern = /^\s*<(\w+)/;
-
-/**
- * Extracts the `nodeName` of the first element in a string of markup.
- *
- * @param {string} markup String of markup.
- * @return {?string} Node name of the supplied markup.
- */
-function getNodeName(markup) {
- var nodeNameMatch = markup.match(nodeNamePattern);
- return nodeNameMatch && nodeNameMatch[1].toLowerCase();
-}
-
-/**
- * Creates an array containing the nodes rendered from the supplied markup. The
- * optionally supplied `handleScript` function will be invoked once for each
- * <script> element that is rendered. If no `handleScript` function is supplied,
- * an exception is thrown if any <script> elements are rendered.
- *
- * @param {string} markup A string of valid HTML markup.
- * @param {?function} handleScript Invoked once for each rendered <script>.
- * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
- */
-function createNodesFromMarkup(markup, handleScript) {
- var node = dummyNode;
- ("production" !== "development" ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
- var nodeName = getNodeName(markup);
-
- var wrap = nodeName && getMarkupWrap(nodeName);
- if (wrap) {
- node.innerHTML = wrap[1] + markup + wrap[2];
-
- var wrapDepth = wrap[0];
- while (wrapDepth--) {
- node = node.lastChild;
- }
- } else {
- node.innerHTML = markup;
- }
-
- var scripts = node.getElementsByTagName('script');
- if (scripts.length) {
- ("production" !== "development" ? invariant(
- handleScript,
- 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
- ) : invariant(handleScript));
- createArrayFromMixed(scripts).forEach(handleScript);
- }
-
- var nodes = createArrayFromMixed(node.childNodes);
- while (node.lastChild) {
- node.removeChild(node.lastChild);
- }
- return nodes;
-}
-
-module.exports = createNodesFromMarkup;
-
-},{"124":124,"142":142,"150":150,"22":22}],127:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule cx
- */
-
-/**
- * This function is used to mark string literals representing CSS class names
- * so that they can be transformed statically. This allows for modularization
- * and minification of CSS class names.
- *
- * In static_upstream, this function is actually implemented, but it should
- * eventually be replaced with something more descriptive, and the transform
- * that is used in the main stack should be ported for use elsewhere.
- *
- * @param string|object className to modularize, or an object of key/values.
- * In the object case, the values are conditions that
- * determine if the className keys should be included.
- * @param [string ...] Variable list of classNames in the string case.
- * @return string Renderable space-separated CSS className.
- */
-
-'use strict';
-var warning = _dereq_(171);
-
-var warned = false;
-
-function cx(classNames) {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- warned,
- 'React.addons.classSet will be deprecated in a future version. See ' +
- 'http://fb.me/react-addons-classset'
- ) : null);
- warned = true;
- }
-
- if (typeof classNames == 'object') {
- return Object.keys(classNames).filter(function(className) {
- return classNames[className];
- }).join(' ');
- } else {
- return Array.prototype.join.call(arguments, ' ');
- }
-}
-
-module.exports = cx;
-
-},{"171":171}],128:[function(_dereq_,module,exports){
+},{"166":166,"173":173,"57":57,"79":79}],119:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19109,7 +17589,7 @@
'use strict';
-var CSSProperty = _dereq_(5);
+var CSSProperty = _dereq_(4);
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
@@ -19139,8 +17619,7 @@
}
var isNonNumeric = isNaN(value);
- if (isNonNumeric || value === 0 ||
- isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
+ if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
@@ -19151,8 +17630,7 @@
}
module.exports = dangerousStyleValue;
-
-},{"5":5}],129:[function(_dereq_,module,exports){
+},{"4":4}],120:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19161,54 +17639,47 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule emptyFunction
+ * @providesModule deprecated
*/
-function makeEmptyFunction(arg) {
- return function() {
- return arg;
- };
-}
-
-/**
- * This function accepts and discards inputs; it has no side effects. This is
- * primarily useful idiomatically for overridable function endpoints which
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
- */
-function emptyFunction() {}
-
-emptyFunction.thatReturns = makeEmptyFunction;
-emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
-emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
-emptyFunction.thatReturnsNull = makeEmptyFunction(null);
-emptyFunction.thatReturnsThis = function() { return this; };
-emptyFunction.thatReturnsArgument = function(arg) { return arg; };
+'use strict';
-module.exports = emptyFunction;
+var assign = _dereq_(24);
+var warning = _dereq_(173);
-},{}],130:[function(_dereq_,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
+ * This will log a single deprecation notice per function and forward the call
+ * on to the new API.
*
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule emptyObject
+ * @param {string} fnName The name of the function
+ * @param {string} newModule The module that fn will exist in
+ * @param {string} newPackage The module that fn will exist in
+ * @param {*} ctx The context this forwarded call should run in
+ * @param {function} fn The function to forward on to
+ * @return {function} The function that will warn once and then call fn
*/
+function deprecated(fnName, newModule, newPackage, ctx, fn) {
+ var warned = false;
+ if ("development" !== 'production') {
+ var newFn = function () {
+ "development" !== 'production' ? warning(warned,
+ // Require examples in this string must be split to prevent React's
+ // build tools from mistaking them for real requires.
+ // Otherwise the build tools will attempt to build a '%s' module.
+ 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
+ warned = true;
+ return fn.apply(ctx, arguments);
+ };
+ // We need to make sure all properties of the original fn are copied over.
+ // In particular, this is needed to support PropTypes
+ return assign(newFn, fn);
+ }
-"use strict";
-
-var emptyObject = {};
-
-if ("production" !== "development") {
- Object.freeze(emptyObject);
+ return fn;
}
-module.exports = emptyObject;
-
-},{}],131:[function(_dereq_,module,exports){
+module.exports = deprecated;
+},{"173":173,"24":24}],121:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19247,8 +17718,7 @@
}
module.exports = escapeTextContentForBrowser;
-
-},{}],132:[function(_dereq_,module,exports){
+},{}],122:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19263,63 +17733,42 @@
'use strict';
-var ReactCurrentOwner = _dereq_(45);
-var ReactInstanceMap = _dereq_(73);
-var ReactMount = _dereq_(77);
-
-var invariant = _dereq_(150);
-var isNode = _dereq_(152);
-var warning = _dereq_(171);
+var ReactCurrentOwner = _dereq_(39);
+var ReactInstanceMap = _dereq_(68);
+var ReactMount = _dereq_(72);
+
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
- * @return {DOMElement} The root node of this element.
+ * @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
- if ("production" !== "development") {
+ if ("development" !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
- ("production" !== "development" ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
+ "development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
- if (isNode(componentOrElement)) {
+ if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
- ("production" !== "development" ? invariant(
- componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function',
- 'Component (with keys: %s) contains `render` method ' +
- 'but is not mounted in the DOM',
- Object.keys(componentOrElement)
- ) : invariant(componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function'));
- ("production" !== "development" ? invariant(
- false,
- 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
- Object.keys(componentOrElement)
- ) : invariant(false));
+ !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? "development" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
+ !false ? "development" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;
-
-},{"150":150,"152":152,"171":171,"45":45,"73":73,"77":77}],133:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"39":39,"68":68,"72":72}],123:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19333,8 +17782,8 @@
'use strict';
-var traverseAllChildren = _dereq_(169);
-var warning = _dereq_(171);
+var traverseAllChildren = _dereq_(142);
+var warning = _dereq_(173);
/**
* @param {function} traverseContext Context passed through traversal.
@@ -19344,15 +17793,9 @@
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
- var keyUnique = !result.hasOwnProperty(name);
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- keyUnique,
- 'flattenChildren(...): Encountered two children with the same key, ' +
- '`%s`. Child keys must be unique; when two children share a key, only ' +
- 'the first child will be used.',
- name
- ) : null);
+ var keyUnique = result[name] === undefined;
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (keyUnique && child != null) {
result[name] = child;
@@ -19374,37 +17817,7 @@
}
module.exports = flattenChildren;
-
-},{"169":169,"171":171}],134:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule focusNode
- */
-
-"use strict";
-
-/**
- * @param {DOMElement} node input/textarea to focus
- */
-function focusNode(node) {
- // IE8 can throw "Can't move focus to the control because it is invisible,
- // not enabled, or of a type that does not accept the focus." for all kinds of
- // reasons that are too expensive and fragile to test.
- try {
- node.focus();
- } catch(e) {
- }
-}
-
-module.exports = focusNode;
-
-},{}],135:[function(_dereq_,module,exports){
+},{"142":142,"173":173}],124:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19419,13 +17832,13 @@
'use strict';
/**
- * @param {array} an "accumulation" of items which is either an Array or
+ * @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
-var forEachAccumulated = function(arr, cb, scope) {
+var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
@@ -19434,37 +17847,7 @@
};
module.exports = forEachAccumulated;
-
-},{}],136:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getActiveElement
- * @typechecks
- */
-
-/**
- * Same as document.activeElement but wraps in a try-catch block. In IE it is
- * not safe to call document.activeElement if there is nothing focused.
- *
- * The activeElement will be null only if the document body is not yet defined.
- */
-function getActiveElement() /*?DOMElement*/ {
- try {
- return document.activeElement || document.body;
- } catch (e) {
- return document.body;
- }
-}
-
-module.exports = getActiveElement;
-
-},{}],137:[function(_dereq_,module,exports){
+},{}],125:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19487,7 +17870,7 @@
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
- * @return {string} Normalized `charCode` property.
+ * @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
@@ -19515,8 +17898,7 @@
}
module.exports = getEventCharCode;
-
-},{}],138:[function(_dereq_,module,exports){
+},{}],126:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19531,7 +17913,7 @@
'use strict';
-var getEventCharCode = _dereq_(137);
+var getEventCharCode = _dereq_(125);
/**
* Normalization of deprecated HTML5 `key` values
@@ -19620,8 +18002,7 @@
}
module.exports = getEventKey;
-
-},{"137":137}],139:[function(_dereq_,module,exports){
+},{"125":125}],127:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19652,7 +18033,6 @@
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
- /*jshint validthis:true */
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
@@ -19667,8 +18047,7 @@
}
module.exports = getEventModifierState;
-
-},{}],140:[function(_dereq_,module,exports){
+},{}],128:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19698,8 +18077,7 @@
}
module.exports = getEventTarget;
-
-},{}],141:[function(_dereq_,module,exports){
+},{}],129:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19733,134 +18111,14 @@
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
- var iteratorFn = maybeIterable && (
- (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
- );
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
-
-},{}],142:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getMarkupWrap
- */
-
-var ExecutionEnvironment = _dereq_(22);
-
-var invariant = _dereq_(150);
-
-/**
- * Dummy container used to detect which wraps are necessary.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Some browsers cannot use `innerHTML` to render certain elements standalone,
- * so we wrap them, render the wrapped nodes, then extract the desired node.
- *
- * In IE8, certain elements cannot render alone, so wrap all elements ('*').
- */
-var shouldWrap = {
- // Force wrapping for SVG elements because if they get created inside a <div>,
- // they will be initialized in the wrong namespace (and will not display).
- 'circle': true,
- 'clipPath': true,
- 'defs': true,
- 'ellipse': true,
- 'g': true,
- 'line': true,
- 'linearGradient': true,
- 'path': true,
- 'polygon': true,
- 'polyline': true,
- 'radialGradient': true,
- 'rect': true,
- 'stop': true,
- 'text': true
-};
-
-var selectWrap = [1, '<select multiple="true">', '</select>'];
-var tableWrap = [1, '<table>', '</table>'];
-var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
-
-var svgWrap = [1, '<svg>', '</svg>'];
-
-var markupWrap = {
- '*': [1, '?<div>', '</div>'],
-
- 'area': [1, '<map>', '</map>'],
- 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
- 'legend': [1, '<fieldset>', '</fieldset>'],
- 'param': [1, '<object>', '</object>'],
- 'tr': [2, '<table><tbody>', '</tbody></table>'],
-
- 'optgroup': selectWrap,
- 'option': selectWrap,
-
- 'caption': tableWrap,
- 'colgroup': tableWrap,
- 'tbody': tableWrap,
- 'tfoot': tableWrap,
- 'thead': tableWrap,
-
- 'td': trWrap,
- 'th': trWrap,
-
- 'circle': svgWrap,
- 'clipPath': svgWrap,
- 'defs': svgWrap,
- 'ellipse': svgWrap,
- 'g': svgWrap,
- 'line': svgWrap,
- 'linearGradient': svgWrap,
- 'path': svgWrap,
- 'polygon': svgWrap,
- 'polyline': svgWrap,
- 'radialGradient': svgWrap,
- 'rect': svgWrap,
- 'stop': svgWrap,
- 'text': svgWrap
-};
-
-/**
- * Gets the markup wrap configuration for the supplied `nodeName`.
- *
- * NOTE: This lazily detects which wraps are necessary for the current browser.
- *
- * @param {string} nodeName Lowercase `nodeName`.
- * @return {?array} Markup wrap configuration, if applicable.
- */
-function getMarkupWrap(nodeName) {
- ("production" !== "development" ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
- if (!markupWrap.hasOwnProperty(nodeName)) {
- nodeName = '*';
- }
- if (!shouldWrap.hasOwnProperty(nodeName)) {
- if (nodeName === '*') {
- dummyNode.innerHTML = '<link />';
- } else {
- dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
- }
- shouldWrap[nodeName] = !dummyNode.firstChild;
- }
- return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
-}
-
-
-module.exports = getMarkupWrap;
-
-},{"150":150,"22":22}],143:[function(_dereq_,module,exports){
+},{}],130:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19934,43 +18192,7 @@
}
module.exports = getNodeForCharacterOffset;
-
-},{}],144:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getReactRootElementInContainer
- */
-
-'use strict';
-
-var DOC_NODE_TYPE = 9;
-
-/**
- * @param {DOMElement|DOMDocument} container DOM element that may contain
- * a React component
- * @return {?*} DOM element that may have the reactRoot ID, or null.
- */
-function getReactRootElementInContainer(container) {
- if (!container) {
- return null;
- }
-
- if (container.nodeType === DOC_NODE_TYPE) {
- return container.documentElement;
- } else {
- return container.firstChild;
- }
-}
-
-module.exports = getReactRootElementInContainer;
-
-},{}],145:[function(_dereq_,module,exports){
+},{}],131:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -19984,7 +18206,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
var contentKey = null;
@@ -19998,130 +18220,13 @@
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
- contentKey = 'textContent' in document.documentElement ?
- 'textContent' :
- 'innerText';
+ contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
-
-},{"22":22}],146:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getUnboundedScrollPosition
- * @typechecks
- */
-
-"use strict";
-
-/**
- * Gets the scroll position of the supplied element or window.
- *
- * The return values are unbounded, unlike `getScrollPosition`. This means they
- * may be negative or exceed the element boundaries (which is possible using
- * inertial scrolling).
- *
- * @param {DOMWindow|DOMElement} scrollable
- * @return {object} Map with `x` and `y` keys.
- */
-function getUnboundedScrollPosition(scrollable) {
- if (scrollable === window) {
- return {
- x: window.pageXOffset || document.documentElement.scrollLeft,
- y: window.pageYOffset || document.documentElement.scrollTop
- };
- }
- return {
- x: scrollable.scrollLeft,
- y: scrollable.scrollTop
- };
-}
-
-module.exports = getUnboundedScrollPosition;
-
-},{}],147:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenate
- * @typechecks
- */
-
-var _uppercasePattern = /([A-Z])/g;
-
-/**
- * Hyphenates a camelcased string, for example:
- *
- * > hyphenate('backgroundColor')
- * < "background-color"
- *
- * For CSS style names, use `hyphenateStyleName` instead which works properly
- * with all vendor prefixes, including `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenate(string) {
- return string.replace(_uppercasePattern, '-$1').toLowerCase();
-}
-
-module.exports = hyphenate;
-
-},{}],148:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenateStyleName
- * @typechecks
- */
-
-"use strict";
-
-var hyphenate = _dereq_(147);
-
-var msPattern = /^ms-/;
-
-/**
- * Hyphenates a camelcased CSS property name, for example:
- *
- * > hyphenateStyleName('backgroundColor')
- * < "background-color"
- * > hyphenateStyleName('MozTransition')
- * < "-moz-transition"
- * > hyphenateStyleName('msTransition')
- * < "-ms-transition"
- *
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
- * is converted to `-ms-`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenateStyleName(string) {
- return hyphenate(string).replace(msPattern, '-ms-');
-}
-
-module.exports = hyphenateStyleName;
-
-},{"147":147}],149:[function(_dereq_,module,exports){
+},{"147":147}],132:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20136,23 +18241,29 @@
'use strict';
-var ReactCompositeComponent = _dereq_(43);
-var ReactEmptyComponent = _dereq_(65);
-var ReactNativeComponent = _dereq_(80);
-
-var assign = _dereq_(29);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactCompositeComponent = _dereq_(38);
+var ReactEmptyComponent = _dereq_(59);
+var ReactNativeComponent = _dereq_(75);
+
+var assign = _dereq_(24);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
// To avoid a cyclic dependency, we create the final class in this module
-var ReactCompositeComponentWrapper = function() { };
-assign(
- ReactCompositeComponentWrapper.prototype,
- ReactCompositeComponent.Mixin,
- {
+var ReactCompositeComponentWrapper = function () {};
+assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
+});
+
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
}
-);
+ return '';
+}
/**
* Check if the type reference is a known internal type. I.e. not a user
@@ -20162,49 +18273,31 @@
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
- return (
- typeof type === 'function' &&
- typeof type.prototype !== 'undefined' &&
- typeof type.prototype.mountComponent === 'function' &&
- typeof type.prototype.receiveComponent === 'function'
- );
+ return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
- * @param {*} parentCompositeType The composite type that resolved this.
* @return {object} A new instance of the element's constructor.
* @protected
*/
-function instantiateReactComponent(node, parentCompositeType) {
+function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
- node = ReactEmptyComponent.emptyElement;
- }
-
- if (typeof node === 'object') {
+ instance = new ReactEmptyComponent(instantiateReactComponent);
+ } else if (typeof node === 'object') {
var element = node;
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- element && (typeof element.type === 'function' ||
- typeof element.type === 'string'),
- 'Only functions or strings can be mounted as React components.'
- ) : null);
- }
+ !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? "development" !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
// Special case string values
- if (parentCompositeType === element.type &&
- typeof element.type === 'string') {
- // Avoid recursion if the wrapper renders itself.
+ if (typeof element.type === 'string') {
instance = ReactNativeComponent.createInternalComponent(element);
- // All native components are currently wrapped in a composite so we're
- // safe to assume that this is what we should instantiate.
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
- // represenations. I.e. ART. Once those are updated to use the string
+ // representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
} else {
@@ -20213,21 +18306,11 @@
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
- ("production" !== "development" ? invariant(
- false,
- 'Encountered invalid React node of type %s',
- typeof node
- ) : invariant(false));
+ !false ? "development" !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
}
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- typeof instance.construct === 'function' &&
- typeof instance.mountComponent === 'function' &&
- typeof instance.receiveComponent === 'function' &&
- typeof instance.unmountComponent === 'function',
- 'Only React Components can be mounted.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
}
// Sets up the instance. This can probably just move into the constructor now.
@@ -20239,14 +18322,14 @@
instance._mountIndex = 0;
instance._mountImage = null;
- if ("production" !== "development") {
+ if ("development" !== 'production') {
instance._isOwnerNecessary = false;
instance._warnedAboutRefsInRender = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
- if ("production" !== "development") {
+ if ("development" !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
@@ -20256,63 +18339,7 @@
}
module.exports = instantiateReactComponent;
-
-},{"150":150,"171":171,"29":29,"43":43,"65":65,"80":80}],150:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule invariant
- */
-
-"use strict";
-
-/**
- * Use invariant() to assert state which your program assumes to be true.
- *
- * Provide sprintf-style format (only %s is supported) and arguments
- * to provide information about what broke and what you were
- * expecting.
- *
- * The invariant message will be stripped in production, but the invariant
- * will remain to ensure logic does not differ in production.
- */
-
-var invariant = function(condition, format, a, b, c, d, e, f) {
- if ("production" !== "development") {
- if (format === undefined) {
- throw new Error('invariant requires an error message argument');
- }
- }
-
- if (!condition) {
- var error;
- if (format === undefined) {
- error = new Error(
- 'Minified exception occurred; use the non-minified dev environment ' +
- 'for the full error message and additional helpful warnings.'
- );
- } else {
- var args = [a, b, c, d, e, f];
- var argIndex = 0;
- error = new Error(
- 'Invariant Violation: ' +
- format.replace(/%s/g, function() { return args[argIndex++]; })
- );
- }
-
- error.framesToPop = 1; // we don't care about invariant's own frame
- throw error;
- }
-};
-
-module.exports = invariant;
-
-},{}],151:[function(_dereq_,module,exports){
+},{"161":161,"173":173,"24":24,"38":38,"59":59,"75":75}],133:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20326,13 +18353,11 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
- useHasFeature =
- document.implementation &&
- document.implementation.hasFeature &&
+ useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
@@ -20353,13 +18378,12 @@
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
- if (!ExecutionEnvironment.canUseDOM ||
- capture && !('addEventListener' in document)) {
+ if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
- var isSupported = eventName in document;
+ var isSupported = (eventName in document);
if (!isSupported) {
var element = document.createElement('div');
@@ -20376,35 +18400,7 @@
}
module.exports = isEventSupported;
-
-},{"22":22}],152:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isNode
- * @typechecks
- */
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM node.
- */
-function isNode(object) {
- return !!(object && (
- ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
- typeof object.nodeType === 'number' &&
- typeof object.nodeName === 'string'))
- ));
-}
-
-module.exports = isNode;
-
-},{}],153:[function(_dereq_,module,exports){
+},{"147":147}],134:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20440,255 +18436,12 @@
};
function isTextInputElement(elem) {
- return elem && (
- (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
- );
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
}
module.exports = isTextInputElement;
-
-},{}],154:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isTextNode
- * @typechecks
- */
-
-var isNode = _dereq_(152);
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM text node.
- */
-function isTextNode(object) {
- return isNode(object) && object.nodeType == 3;
-}
-
-module.exports = isTextNode;
-
-},{"152":152}],155:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule joinClasses
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Combines multiple className strings into one.
- * http://jsperf.com/joinclasses-args-vs-array
- *
- * @param {...?string} classes
- * @return {string}
- */
-function joinClasses(className/*, ... */) {
- if (!className) {
- className = '';
- }
- var nextClass;
- var argLength = arguments.length;
- if (argLength > 1) {
- for (var ii = 1; ii < argLength; ii++) {
- nextClass = arguments[ii];
- if (nextClass) {
- className = (className ? className + ' ' : '') + nextClass;
- }
- }
- }
- return className;
-}
-
-module.exports = joinClasses;
-
-},{}],156:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyMirror
- * @typechecks static-only
- */
-
-'use strict';
-
-var invariant = _dereq_(150);
-
-/**
- * Constructs an enumeration with keys equal to their value.
- *
- * For example:
- *
- * var COLORS = keyMirror({blue: null, red: null});
- * var myColor = COLORS.blue;
- * var isColorValid = !!COLORS[myColor];
- *
- * The last line could not be performed if the values of the generated enum were
- * not equal to their keys.
- *
- * Input: {key1: val1, key2: val2}
- * Output: {key1: key1, key2: key2}
- *
- * @param {object} obj
- * @return {object}
- */
-var keyMirror = function(obj) {
- var ret = {};
- var key;
- ("production" !== "development" ? invariant(
- obj instanceof Object && !Array.isArray(obj),
- 'keyMirror(...): Argument must be an object.'
- ) : invariant(obj instanceof Object && !Array.isArray(obj)));
- for (key in obj) {
- if (!obj.hasOwnProperty(key)) {
- continue;
- }
- ret[key] = key;
- }
- return ret;
-};
-
-module.exports = keyMirror;
-
-},{"150":150}],157:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyOf
- */
-
-/**
- * Allows extraction of a minified key. Let's the build system minify keys
- * without loosing the ability to dynamically use key strings as values
- * themselves. Pass in an object with a single key/val pair and it will return
- * you the string key of that single record. Suppose you want to grab the
- * value for a key 'className' inside of an object. Key/val minification may
- * have aliased that key to be 'xa12'. keyOf({className: null}) will return
- * 'xa12' in that case. Resolve keys you want to use once at startup time, then
- * reuse those resolutions.
- */
-var keyOf = function(oneKeyObj) {
- var key;
- for (key in oneKeyObj) {
- if (!oneKeyObj.hasOwnProperty(key)) {
- continue;
- }
- return key;
- }
- return null;
-};
-
-
-module.exports = keyOf;
-
-},{}],158:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule mapObject
- */
-
-'use strict';
-
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-/**
- * Executes the provided `callback` once for each enumerable own property in the
- * object and constructs a new object from the results. The `callback` is
- * invoked with three arguments:
- *
- * - the property value
- * - the property name
- * - the object being traversed
- *
- * Properties that are added after the call to `mapObject` will not be visited
- * by `callback`. If the values of existing properties are changed, the value
- * passed to `callback` will be the value at the time `mapObject` visits them.
- * Properties that are deleted before being visited are not visited.
- *
- * @grep function objectMap()
- * @grep function objMap()
- *
- * @param {?object} object
- * @param {function} callback
- * @param {*} context
- * @return {?object}
- */
-function mapObject(object, callback, context) {
- if (!object) {
- return null;
- }
- var result = {};
- for (var name in object) {
- if (hasOwnProperty.call(object, name)) {
- result[name] = callback.call(context, object[name], name, object);
- }
- }
- return result;
-}
-
-module.exports = mapObject;
-
-},{}],159:[function(_dereq_,module,exports){
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule memoizeStringOnly
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Memoizes the return value of a function that accepts one string argument.
- *
- * @param {function} callback
- * @return {function}
- */
-function memoizeStringOnly(callback) {
- var cache = {};
- return function(string) {
- if (!cache.hasOwnProperty(string)) {
- cache[string] = callback.call(this, string);
- }
- return cache[string];
- };
-}
-
-module.exports = memoizeStringOnly;
-
-},{}],160:[function(_dereq_,module,exports){
+},{}],135:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20701,9 +18454,9 @@
*/
'use strict';
-var ReactElement = _dereq_(63);
+var ReactElement = _dereq_(57);
-var invariant = _dereq_(150);
+var invariant = _dereq_(161);
/**
* Returns the first child in a collection of children and verifies that there
@@ -20717,16 +18470,12 @@
* structure.
*/
function onlyChild(children) {
- ("production" !== "development" ? invariant(
- ReactElement.isValidElement(children),
- 'onlyChild must be passed a children with exactly one child.'
- ) : invariant(ReactElement.isValidElement(children)));
+ !ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
return children;
}
module.exports = onlyChild;
-
-},{"150":150,"63":63}],161:[function(_dereq_,module,exports){
+},{"161":161,"57":57}],136:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20735,54 +18484,25 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule performance
- * @typechecks
+ * @providesModule quoteAttributeValueForBrowser
*/
-"use strict";
-
-var ExecutionEnvironment = _dereq_(22);
-
-var performance;
+'use strict';
-if (ExecutionEnvironment.canUseDOM) {
- performance =
- window.performance ||
- window.msPerformance ||
- window.webkitPerformance;
-}
+var escapeTextContentForBrowser = _dereq_(121);
-module.exports = performance || {};
-
-},{"22":22}],162:[function(_dereq_,module,exports){
/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
+ * Escapes attribute value to prevent scripting attacks.
*
- * @providesModule performanceNow
- * @typechecks
- */
-
-var performance = _dereq_(161);
-
-/**
- * Detect if we can use `window.performance.now()` and gracefully fallback to
- * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
- * because of Facebook's testing infrastructure.
+ * @param {*} value Value to escape.
+ * @return {string} An escaped string.
*/
-if (!performance || !performance.now) {
- performance = Date;
+function quoteAttributeValueForBrowser(value) {
+ return '"' + escapeTextContentForBrowser(value) + '"';
}
-var performanceNow = performance.now.bind(performance);
-
-module.exports = performanceNow;
-
-},{"161":161}],163:[function(_dereq_,module,exports){
+module.exports = quoteAttributeValueForBrowser;
+},{"121":121}],137:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20791,26 +18511,15 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule quoteAttributeValueForBrowser
- */
+* @providesModule renderSubtreeIntoContainer
+*/
'use strict';
-var escapeTextContentForBrowser = _dereq_(131);
-
-/**
- * Escapes attribute value to prevent scripting attacks.
- *
- * @param {*} value Value to escape.
- * @return {string} An escaped string.
- */
-function quoteAttributeValueForBrowser(value) {
- return '"' + escapeTextContentForBrowser(value) + '"';
-}
-
-module.exports = quoteAttributeValueForBrowser;
+var ReactMount = _dereq_(72);
-},{"131":131}],164:[function(_dereq_,module,exports){
+module.exports = ReactMount.renderSubtreeIntoContainer;
+},{"72":72}],138:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20826,7 +18535,7 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
+var ExecutionEnvironment = _dereq_(147);
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
@@ -20839,14 +18548,14 @@
* @param {string} html
* @internal
*/
-var setInnerHTML = function(node, html) {
+var setInnerHTML = function (node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
- setInnerHTML = function(node, html) {
- MSApp.execUnsafeLocalFunction(function() {
+ setInnerHTML = function (node, html) {
+ MSApp.execUnsafeLocalFunction(function () {
node.innerHTML = html;
});
};
@@ -20862,7 +18571,7 @@
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
- setInnerHTML = function(node, html) {
+ setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
@@ -20876,11 +18585,14 @@
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
- if (WHITESPACE_TEST.test(html) ||
- html[0] === '<' && NONVISIBLE_TEST.test(html)) {
+ if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
- node.innerHTML = '\uFEFF' + html;
+ // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
+ // in hopes that this is preserved even if "\uFEFF" is transformed to
+ // the actual Unicode character (by Babel, for example).
+ // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
+ node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.
@@ -20898,8 +18610,7 @@
}
module.exports = setInnerHTML;
-
-},{"22":22}],165:[function(_dereq_,module,exports){
+},{"147":147}],139:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20913,9 +18624,9 @@
'use strict';
-var ExecutionEnvironment = _dereq_(22);
-var escapeTextContentForBrowser = _dereq_(131);
-var setInnerHTML = _dereq_(164);
+var ExecutionEnvironment = _dereq_(147);
+var escapeTextContentForBrowser = _dereq_(121);
+var setInnerHTML = _dereq_(138);
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
@@ -20927,21 +18638,20 @@
* @param {string} text
* @internal
*/
-var setTextContent = function(node, text) {
+var setTextContent = function (node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
- setTextContent = function(node, text) {
+ setTextContent = function (node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
-
-},{"131":131,"164":164,"22":22}],166:[function(_dereq_,module,exports){
+},{"121":121,"138":138,"147":147}],140:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -20950,42 +18660,23 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
- * @providesModule shallowEqual
- */
+* @providesModule shallowCompare
+*/
'use strict';
+var shallowEqual = _dereq_(171);
+
/**
- * Performs equality by iterating through keys on an object and returning
- * false when any key has values which are not strictly equal between
- * objA and objB. Returns true when the values of all keys are strictly equal.
- *
- * @return {boolean}
+ * Does a shallow comparison for props and state.
+ * See ReactComponentWithPureRenderMixin
*/
-function shallowEqual(objA, objB) {
- if (objA === objB) {
- return true;
- }
- var key;
- // Test for A's keys different from B.
- for (key in objA) {
- if (objA.hasOwnProperty(key) &&
- (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
- return false;
- }
- }
- // Test for B's keys missing from A.
- for (key in objB) {
- if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
- return false;
- }
- }
- return true;
+function shallowCompare(instance, nextProps, nextState) {
+ return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
}
-module.exports = shallowEqual;
-
-},{}],167:[function(_dereq_,module,exports){
+module.exports = shallowCompare;
+},{"171":171}],141:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -21000,8 +18691,6 @@
'use strict';
-var warning = _dereq_(171);
-
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
@@ -21014,150 +18703,24 @@
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
- if (prevElement != null && nextElement != null) {
+ var prevEmpty = prevElement === null || prevElement === false;
+ var nextEmpty = nextElement === null || nextElement === false;
+ if (prevEmpty || nextEmpty) {
+ return prevEmpty === nextEmpty;
+ }
+
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
- return (nextType === 'string' || nextType === 'number');
+ return nextType === 'string' || nextType === 'number';
} else {
- if (nextType === 'object' &&
- prevElement.type === nextElement.type &&
- prevElement.key === nextElement.key) {
- var ownersMatch = prevElement._owner === nextElement._owner;
- var prevName = null;
- var nextName = null;
- var nextDisplayName = null;
- if ("production" !== "development") {
- if (!ownersMatch) {
- if (prevElement._owner != null &&
- prevElement._owner.getPublicInstance() != null &&
- prevElement._owner.getPublicInstance().constructor != null) {
- prevName =
- prevElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement._owner != null &&
- nextElement._owner.getPublicInstance() != null &&
- nextElement._owner.getPublicInstance().constructor != null) {
- nextName =
- nextElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement.type != null &&
- nextElement.type.displayName != null) {
- nextDisplayName = nextElement.type.displayName;
- }
- if (nextElement.type != null && typeof nextElement.type === 'string') {
- nextDisplayName = nextElement.type;
- }
- if (typeof nextElement.type !== 'string' ||
- nextElement.type === 'input' ||
- nextElement.type === 'textarea') {
- if ((prevElement._owner != null &&
- prevElement._owner._isOwnerNecessary === false) ||
- (nextElement._owner != null &&
- nextElement._owner._isOwnerNecessary === false)) {
- if (prevElement._owner != null) {
- prevElement._owner._isOwnerNecessary = true;
- }
- if (nextElement._owner != null) {
- nextElement._owner._isOwnerNecessary = true;
- }
- ("production" !== "development" ? warning(
- false,
- '<%s /> is being rendered by both %s and %s using the same ' +
- 'key (%s) in the same place. Currently, this means that ' +
- 'they don\'t preserve state. This behavior should be very ' +
- 'rare so we\'re considering deprecating it. Please contact ' +
- 'the React team and explain your use case so that we can ' +
- 'take that into consideration.',
- nextDisplayName || 'Unknown Component',
- prevName || '[Unknown]',
- nextName || '[Unknown]',
- prevElement.key
- ) : null);
- }
- }
- }
- }
- return ownersMatch;
- }
- }
+ return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;
}
module.exports = shouldUpdateReactComponent;
-
-},{"171":171}],168:[function(_dereq_,module,exports){
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule toArray
- * @typechecks
- */
-
-var invariant = _dereq_(150);
-
-/**
- * Convert array-like objects to arrays.
- *
- * This API assumes the caller knows the contents of the data type. For less
- * well defined inputs use createArrayFromMixed.
- *
- * @param {object|function|filelist} obj
- * @return {array}
- */
-function toArray(obj) {
- var length = obj.length;
-
- // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
- // old versions of Safari).
- ("production" !== "development" ? invariant(
- !Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function'),
- 'toArray: Array-like object expected'
- ) : invariant(!Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function')));
-
- ("production" !== "development" ? invariant(
- typeof length === 'number',
- 'toArray: Object needs a length property'
- ) : invariant(typeof length === 'number'));
-
- ("production" !== "development" ? invariant(
- length === 0 ||
- (length - 1) in obj,
- 'toArray: Object should have keys for indices'
- ) : invariant(length === 0 ||
- (length - 1) in obj));
-
- // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
- // without method will throw during the slice call and skip straight to the
- // fallback.
- if (obj.hasOwnProperty) {
- try {
- return Array.prototype.slice.call(obj);
- } catch (e) {
- // IE < 9 does not support Array#slice on collections objects
- }
- }
-
- // Fall back to copying key by key. This assumes all keys have a value,
- // so will not preserve sparsely populated inputs.
- var ret = Array(length);
- for (var ii = 0; ii < length; ii++) {
- ret[ii] = obj[ii];
- }
- return ret;
-}
-
-module.exports = toArray;
-
-},{"150":150}],169:[function(_dereq_,module,exports){
+},{}],142:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -21171,13 +18734,13 @@
'use strict';
-var ReactElement = _dereq_(63);
-var ReactFragment = _dereq_(69);
-var ReactInstanceHandles = _dereq_(72);
-
-var getIteratorFn = _dereq_(141);
-var invariant = _dereq_(150);
-var warning = _dereq_(171);
+var ReactCurrentOwner = _dereq_(39);
+var ReactElement = _dereq_(57);
+var ReactInstanceHandles = _dereq_(67);
+
+var getIteratorFn = _dereq_(129);
+var invariant = _dereq_(161);
+var warning = _dereq_(173);
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
@@ -21220,14 +18783,11 @@
/**
* Escape a component key so that it is safe to use in a reactid.
*
- * @param {*} key Component key to be escaped.
+ * @param {*} text Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
- return ('' + text).replace(
- userProvidedKeyEscapeRegex,
- userProvidedKeyEscaper
- );
+ return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
}
/**
@@ -21244,19 +18804,12 @@
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
- * @param {!number} indexSoFar Number of children encountered until this point.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
-function traverseAllChildrenImpl(
- children,
- nameSoFar,
- indexSoFar,
- callback,
- traverseContext
-) {
+function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
@@ -21264,39 +18817,24 @@
children = null;
}
- if (children === null ||
- type === 'string' ||
- type === 'number' ||
- ReactElement.isValidElement(children)) {
- callback(
- traverseContext,
- children,
+ if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
+ callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
- indexSoFar
- );
+ nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
- var child, nextName, nextIndex;
+ var child;
+ var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
+ var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, i)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, i);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
@@ -21307,27 +18845,12 @@
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, ii++)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, ii++);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
- if ("production" !== "development") {
- ("production" !== "development" ? warning(
- didWarnAboutMaps,
- 'Using Maps as children is not yet fully supported. It is an ' +
- 'experimental feature that might be removed. Convert it to a ' +
- 'sequence / iterable of keyed ReactElements instead.'
- ) : null);
+ if ("development" !== 'production') {
+ "development" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
@@ -21335,49 +18858,29 @@
var entry = step.value;
if (entry) {
child = entry[1];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
- ("production" !== "development" ? invariant(
- children.nodeType !== 1,
- 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
- 'elements are not valid children of React components.'
- ) : invariant(children.nodeType !== 1));
- var fragment = ReactFragment.extract(children);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- child = fragment[key];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(key) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ var addendum = '';
+ if ("development" !== 'production') {
+ addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
+ if (children._isReactElement) {
+ addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
+ if (ReactCurrentOwner.current) {
+ var name = ReactCurrentOwner.current.getName();
+ if (name) {
+ addendum += ' Check the render method of `' + name + '`.';
}
}
}
+ var childrenString = String(children);
+ !false ? "development" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
+ }
+ }
return subtreeCount;
}
@@ -21403,12 +18906,11 @@
return 0;
}
- return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
+ return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
-
-},{"141":141,"150":150,"171":171,"63":63,"69":69,"72":72}],170:[function(_dereq_,module,exports){
+},{"129":129,"161":161,"173":173,"39":39,"57":57,"67":67}],143:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -21420,14 +18922,14 @@
* @providesModule update
*/
- /* global hasOwnProperty:true */
+/* global hasOwnProperty:true */
'use strict';
-var assign = _dereq_(29);
-var keyOf = _dereq_(157);
-var invariant = _dereq_(150);
-var hasOwnProperty = {}.hasOwnProperty;
+var assign = _dereq_(24);
+var keyOf = _dereq_(166);
+var invariant = _dereq_(161);
+var hasOwnProperty = ({}).hasOwnProperty;
function shallowCopy(x) {
if (Array.isArray(x)) {
@@ -21439,60 +18941,32 @@
}
}
-var COMMAND_PUSH = keyOf({$push: null});
-var COMMAND_UNSHIFT = keyOf({$unshift: null});
-var COMMAND_SPLICE = keyOf({$splice: null});
-var COMMAND_SET = keyOf({$set: null});
-var COMMAND_MERGE = keyOf({$merge: null});
-var COMMAND_APPLY = keyOf({$apply: null});
-
-var ALL_COMMANDS_LIST = [
- COMMAND_PUSH,
- COMMAND_UNSHIFT,
- COMMAND_SPLICE,
- COMMAND_SET,
- COMMAND_MERGE,
- COMMAND_APPLY
-];
+var COMMAND_PUSH = keyOf({ $push: null });
+var COMMAND_UNSHIFT = keyOf({ $unshift: null });
+var COMMAND_SPLICE = keyOf({ $splice: null });
+var COMMAND_SET = keyOf({ $set: null });
+var COMMAND_MERGE = keyOf({ $merge: null });
+var COMMAND_APPLY = keyOf({ $apply: null });
+
+var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
var ALL_COMMANDS_SET = {};
-ALL_COMMANDS_LIST.forEach(function(command) {
+ALL_COMMANDS_LIST.forEach(function (command) {
ALL_COMMANDS_SET[command] = true;
});
function invariantArrayCase(value, spec, command) {
- ("production" !== "development" ? invariant(
- Array.isArray(value),
- 'update(): expected target of %s to be an array; got %s.',
- command,
- value
- ) : invariant(Array.isArray(value)));
+ !Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
var specValue = spec[command];
- ("production" !== "development" ? invariant(
- Array.isArray(specValue),
- 'update(): expected spec of %s to be an array; got %s. ' +
- 'Did you forget to wrap your parameter in an array?',
- command,
- specValue
- ) : invariant(Array.isArray(specValue)));
+ !Array.isArray(specValue) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
}
function update(value, spec) {
- ("production" !== "development" ? invariant(
- typeof spec === 'object',
- 'update(): You provided a key path to update() that did not contain one ' +
- 'of %s. Did you forget to include {%s: ...}?',
- ALL_COMMANDS_LIST.join(', '),
- COMMAND_SET
- ) : invariant(typeof spec === 'object'));
+ !(typeof spec === 'object') ? "development" !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
if (hasOwnProperty.call(spec, COMMAND_SET)) {
- ("production" !== "development" ? invariant(
- Object.keys(spec).length === 1,
- 'Cannot have more than one key in an object with %s',
- COMMAND_SET
- ) : invariant(Object.keys(spec).length === 1));
+ !(Object.keys(spec).length === 1) ? "development" !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
return spec[COMMAND_SET];
}
@@ -21501,68 +18975,36 @@
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
var mergeObj = spec[COMMAND_MERGE];
- ("production" !== "development" ? invariant(
- mergeObj && typeof mergeObj === 'object',
- 'update(): %s expects a spec of type \'object\'; got %s',
- COMMAND_MERGE,
- mergeObj
- ) : invariant(mergeObj && typeof mergeObj === 'object'));
- ("production" !== "development" ? invariant(
- nextValue && typeof nextValue === 'object',
- 'update(): %s expects a target of type \'object\'; got %s',
- COMMAND_MERGE,
- nextValue
- ) : invariant(nextValue && typeof nextValue === 'object'));
+ !(mergeObj && typeof mergeObj === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
+ !(nextValue && typeof nextValue === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
assign(nextValue, spec[COMMAND_MERGE]);
}
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
invariantArrayCase(value, spec, COMMAND_PUSH);
- spec[COMMAND_PUSH].forEach(function(item) {
+ spec[COMMAND_PUSH].forEach(function (item) {
nextValue.push(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
- spec[COMMAND_UNSHIFT].forEach(function(item) {
+ spec[COMMAND_UNSHIFT].forEach(function (item) {
nextValue.unshift(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
- ("production" !== "development" ? invariant(
- Array.isArray(value),
- 'Expected %s target to be an array; got %s',
- COMMAND_SPLICE,
- value
- ) : invariant(Array.isArray(value)));
- ("production" !== "development" ? invariant(
- Array.isArray(spec[COMMAND_SPLICE]),
- 'update(): expected spec of %s to be an array of arrays; got %s. ' +
- 'Did you forget to wrap your parameters in an array?',
- COMMAND_SPLICE,
- spec[COMMAND_SPLICE]
- ) : invariant(Array.isArray(spec[COMMAND_SPLICE])));
- spec[COMMAND_SPLICE].forEach(function(args) {
- ("production" !== "development" ? invariant(
- Array.isArray(args),
- 'update(): expected spec of %s to be an array of arrays; got %s. ' +
- 'Did you forget to wrap your parameters in an array?',
- COMMAND_SPLICE,
- spec[COMMAND_SPLICE]
- ) : invariant(Array.isArray(args)));
+ !Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
+ !Array.isArray(spec[COMMAND_SPLICE]) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
+ spec[COMMAND_SPLICE].forEach(function (args) {
+ !Array.isArray(args) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
nextValue.splice.apply(nextValue, args);
});
}
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
- ("production" !== "development" ? invariant(
- typeof spec[COMMAND_APPLY] === 'function',
- 'update(): expected spec of %s to be a function; got %s.',
- COMMAND_APPLY,
- spec[COMMAND_APPLY]
- ) : invariant(typeof spec[COMMAND_APPLY] === 'function'));
+ !(typeof spec[COMMAND_APPLY] === 'function') ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
nextValue = spec[COMMAND_APPLY](nextValue);
}
@@ -21576,8 +19018,1702 @@
}
module.exports = update;
+},{"161":161,"166":166,"24":24}],144:[function(_dereq_,module,exports){
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule validateDOMNesting
+ */
+
+'use strict';
+
+var assign = _dereq_(24);
+var emptyFunction = _dereq_(153);
+var warning = _dereq_(173);
+
+var validateDOMNesting = emptyFunction;
+
+if ("development" !== 'production') {
+ // This validation code was written based on the HTML5 parsing spec:
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ //
+ // Note: this does not catch all invalid nesting, nor does it try to (as it's
+ // not clear what practical benefit doing so provides); instead, we warn only
+ // for cases where the parser will give a parse tree differing from what React
+ // intended. For example, <b><div></div></b> is invalid but we don't warn
+ // because it still parses correctly; we do warn for other cases like nested
+ // <p> tags where the beginning of the second element implicitly closes the
+ // first, causing a confusing mess.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#special
+ var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
+ // TODO: Distinguish by namespace here -- for <title>, including it here
+ // errs on the side of fewer warnings
+ 'foreignObject', 'desc', 'title'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
+ var buttonScopeTags = inScopeTags.concat(['button']);
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
+ var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
+
+ var emptyAncestorInfo = {
+ parentTag: null,
+
+ formTag: null,
+ aTagInScope: null,
+ buttonTagInScope: null,
+ nobrTagInScope: null,
+ pTagInButtonScope: null,
+
+ listItemTagAutoclosing: null,
+ dlItemTagAutoclosing: null
+ };
+
+ var updatedAncestorInfo = function (oldInfo, tag, instance) {
+ var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
+ var info = { tag: tag, instance: instance };
+
+ if (inScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.aTagInScope = null;
+ ancestorInfo.buttonTagInScope = null;
+ ancestorInfo.nobrTagInScope = null;
+ }
+ if (buttonScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.pTagInButtonScope = null;
+ }
+
+ // See rules for 'li', 'dd', 'dt' start tags in
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
+ ancestorInfo.listItemTagAutoclosing = null;
+ ancestorInfo.dlItemTagAutoclosing = null;
+ }
+
+ ancestorInfo.parentTag = info;
+
+ if (tag === 'form') {
+ ancestorInfo.formTag = info;
+ }
+ if (tag === 'a') {
+ ancestorInfo.aTagInScope = info;
+ }
+ if (tag === 'button') {
+ ancestorInfo.buttonTagInScope = info;
+ }
+ if (tag === 'nobr') {
+ ancestorInfo.nobrTagInScope = info;
+ }
+ if (tag === 'p') {
+ ancestorInfo.pTagInButtonScope = info;
+ }
+ if (tag === 'li') {
+ ancestorInfo.listItemTagAutoclosing = info;
+ }
+ if (tag === 'dd' || tag === 'dt') {
+ ancestorInfo.dlItemTagAutoclosing = info;
+ }
+
+ return ancestorInfo;
+ };
+
+ /**
+ * Returns whether
+ */
+ var isTagValidWithParent = function (tag, parentTag) {
+ // First, let's check if we're in an unusual parsing mode...
+ switch (parentTag) {
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
+ case 'select':
+ return tag === 'option' || tag === 'optgroup' || tag === '#text';
+ case 'optgroup':
+ return tag === 'option' || tag === '#text';
+ // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
+ // but
+ case 'option':
+ return tag === '#text';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
+ // No special behavior since these rules fall back to "in body" mode for
+ // all except special table nodes which cause bad parsing behavior anyway.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
+ case 'tr':
+ return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
+ case 'tbody':
+ case 'thead':
+ case 'tfoot':
+ return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
+ case 'colgroup':
+ return tag === 'col' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
+ case 'table':
+ return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
+ case 'head':
+ return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
+ case 'html':
+ return tag === 'head' || tag === 'body';
+ }
+
+ // Probably in the "in body" parsing mode, so we outlaw only tag combos
+ // where the parsing rules cause implicit opens or closes to be added.
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ switch (tag) {
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
+
+ case 'rp':
+ case 'rt':
+ return impliedEndTags.indexOf(parentTag) === -1;
+
+ case 'caption':
+ case 'col':
+ case 'colgroup':
+ case 'frame':
+ case 'head':
+ case 'tbody':
+ case 'td':
+ case 'tfoot':
+ case 'th':
+ case 'thead':
+ case 'tr':
+ // These tags are only valid with a few parents that have special child
+ // parsing rules -- if we're down here, then none of those matched and
+ // so we allow it only if we don't know what the parent is, as all other
+ // cases are invalid.
+ return parentTag == null;
+ }
+
+ return true;
+ };
+
+ /**
+ * Returns whether
+ */
+ var findInvalidAncestorForTag = function (tag, ancestorInfo) {
+ switch (tag) {
+ case 'address':
+ case 'article':
+ case 'aside':
+ case 'blockquote':
+ case 'center':
+ case 'details':
+ case 'dialog':
+ case 'dir':
+ case 'div':
+ case 'dl':
+ case 'fieldset':
+ case 'figcaption':
+ case 'figure':
+ case 'footer':
+ case 'header':
+ case 'hgroup':
+ case 'main':
+ case 'menu':
+ case 'nav':
+ case 'ol':
+ case 'p':
+ case 'section':
+ case 'summary':
+ case 'ul':
+
+ case 'pre':
+ case 'listing':
+
+ case 'table':
+
+ case 'hr':
+
+ case 'xmp':
+
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return ancestorInfo.pTagInButtonScope;
+
+ case 'form':
+ return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
+
+ case 'li':
+ return ancestorInfo.listItemTagAutoclosing;
+
+ case 'dd':
+ case 'dt':
+ return ancestorInfo.dlItemTagAutoclosing;
+
+ case 'button':
+ return ancestorInfo.buttonTagInScope;
+
+ case 'a':
+ // Spec says something about storing a list of markers, but it sounds
+ // equivalent to this check.
+ return ancestorInfo.aTagInScope;
+
+ case 'nobr':
+ return ancestorInfo.nobrTagInScope;
+ }
+
+ return null;
+ };
+
+ /**
+ * Given a ReactCompositeComponent instance, return a list of its recursive
+ * owners, starting at the root and ending with the instance itself.
+ */
+ var findOwnerStack = function (instance) {
+ if (!instance) {
+ return [];
+ }
+
+ var stack = [];
+ /*eslint-disable space-after-keywords */
+ do {
+ /*eslint-enable space-after-keywords */
+ stack.push(instance);
+ } while (instance = instance._currentElement._owner);
+ stack.reverse();
+ return stack;
+ };
+
+ var didWarn = {};
+
+ validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+
+ var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
+ var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
+ var problematic = invalidParent || invalidAncestor;
+
+ if (problematic) {
+ var ancestorTag = problematic.tag;
+ var ancestorInstance = problematic.instance;
+
+ var childOwner = childInstance && childInstance._currentElement._owner;
+ var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
+
+ var childOwners = findOwnerStack(childOwner);
+ var ancestorOwners = findOwnerStack(ancestorOwner);
+
+ var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
+ var i;
+
+ var deepestCommon = -1;
+ for (i = 0; i < minStackLen; i++) {
+ if (childOwners[i] === ancestorOwners[i]) {
+ deepestCommon = i;
+ } else {
+ break;
+ }
+ }
+
+ var UNKNOWN = '(unknown)';
+ var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ownerInfo = [].concat(
+ // If the parent and child instances have a common owner ancestor, start
+ // with that -- otherwise we just start with the parent's owners.
+ deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
+ // If we're warning about an invalid (non-parent) ancestry, add '...'
+ invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
+
+ var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
+ if (didWarn[warnKey]) {
+ return;
+ }
+ didWarn[warnKey] = true;
+
+ if (invalidParent) {
+ var info = '';
+ if (ancestorTag === 'table' && childTag === 'tr') {
+ info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
+ }
+ "development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
+ } else {
+ "development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
+ }
+ }
+ };
+
+ validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
+
+ validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
+
+ // For testing
+ validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+ return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
+ };
+}
+
+module.exports = validateDOMNesting;
+},{"153":153,"173":173,"24":24}],145:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule CSSCore
+ * @typechecks
+ */
+
+'use strict';
+
+var invariant = _dereq_(161);
+
+/**
+ * The CSSCore module specifies the API (and implements most of the methods)
+ * that should be used when dealing with the display of elements (via their
+ * CSS classes and visibility on screen. It is an API focused on mutating the
+ * display and not reading it as no logical state should be encoded in the
+ * display of elements.
+ */
+
+var CSSCore = {
+
+ /**
+ * Adds the class passed in to the element if it doesn't already have it.
+ *
+ * @param {DOMElement} element the element to set the class on
+ * @param {string} className the CSS className
+ * @return {DOMElement} the element passed in
+ */
+ addClass: function (element, className) {
+ !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
+
+ if (className) {
+ if (element.classList) {
+ element.classList.add(className);
+ } else if (!CSSCore.hasClass(element, className)) {
+ element.className = element.className + ' ' + className;
+ }
+ }
+ return element;
+ },
+
+ /**
+ * Removes the class passed in from the element
+ *
+ * @param {DOMElement} element the element to set the class on
+ * @param {string} className the CSS className
+ * @return {DOMElement} the element passed in
+ */
+ removeClass: function (element, className) {
+ !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
+
+ if (className) {
+ if (element.classList) {
+ element.classList.remove(className);
+ } else if (CSSCore.hasClass(element, className)) {
+ element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one
+ .replace(/^\s*|\s*$/g, ''); // trim the ends
+ }
+ }
+ return element;
+ },
+
+ /**
+ * Helper to add or remove a class from an element based on a condition.
+ *
+ * @param {DOMElement} element the element to set the class on
+ * @param {string} className the CSS className
+ * @param {*} bool condition to whether to add or remove the class
+ * @return {DOMElement} the element passed in
+ */
+ conditionClass: function (element, className, bool) {
+ return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
+ },
+
+ /**
+ * Tests whether the element has the class specified.
+ *
+ * @param {DOMNode|DOMWindow} element the element to set the class on
+ * @param {string} className the CSS className
+ * @return {boolean} true if the element has the class, false if not
+ */
+ hasClass: function (element, className) {
+ !!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : undefined;
+ if (element.classList) {
+ return !!className && element.classList.contains(className);
+ }
+ return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
+ }
+
+};
+
+module.exports = CSSCore;
+},{"161":161}],146:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * @providesModule EventListener
+ * @typechecks
+ */
+
+'use strict';
+
+var emptyFunction = _dereq_(153);
+
+/**
+ * Upstream version of event listener. Does not take into account specific
+ * nature of platform.
+ */
+var EventListener = {
+ /**
+ * Listen to DOM events during the bubble phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ listen: function (target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, false);
+ return {
+ remove: function () {
+ target.removeEventListener(eventType, callback, false);
+ }
+ };
+ } else if (target.attachEvent) {
+ target.attachEvent('on' + eventType, callback);
+ return {
+ remove: function () {
+ target.detachEvent('on' + eventType, callback);
+ }
+ };
+ }
+ },
+
+ /**
+ * Listen to DOM events during the capture phase.
+ *
+ * @param {DOMEventTarget} target DOM element to register listener on.
+ * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
+ * @param {function} callback Callback function.
+ * @return {object} Object with a `remove` method.
+ */
+ capture: function (target, eventType, callback) {
+ if (target.addEventListener) {
+ target.addEventListener(eventType, callback, true);
+ return {
+ remove: function () {
+ target.removeEventListener(eventType, callback, true);
+ }
+ };
+ } else {
+ if ("development" !== 'production') {
+ console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
+ }
+ return {
+ remove: emptyFunction
+ };
+ }
+ },
+
+ registerDefault: function () {}
+};
+
+module.exports = EventListener;
+},{"153":153}],147:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ExecutionEnvironment
+ */
+
+'use strict';
+
+var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
+
+/**
+ * Simple, lightweight module assisting with the detection and context of
+ * Worker. Helps avoid circular dependencies and allows code to reason about
+ * whether or not they are in a Worker, even if they never include the main
+ * `ReactWorker` dependency.
+ */
+var ExecutionEnvironment = {
+
+ canUseDOM: canUseDOM,
+
+ canUseWorkers: typeof Worker !== 'undefined',
+
+ canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
+
+ canUseViewport: canUseDOM && !!window.screen,
+
+ isInWorker: !canUseDOM // For now, this is true - might change in the future.
+
+};
+
+module.exports = ExecutionEnvironment;
+},{}],148:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule camelize
+ * @typechecks
+ */
+
+"use strict";
+
+var _hyphenPattern = /-(.)/g;
+
+/**
+ * Camelcases a hyphenated string, for example:
+ *
+ * > camelize('background-color')
+ * < "backgroundColor"
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function camelize(string) {
+ return string.replace(_hyphenPattern, function (_, character) {
+ return character.toUpperCase();
+ });
+}
+
+module.exports = camelize;
+},{}],149:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule camelizeStyleName
+ * @typechecks
+ */
+
+'use strict';
+
+var camelize = _dereq_(148);
+
+var msPattern = /^-ms-/;
+
+/**
+ * Camelcases a hyphenated CSS property name, for example:
+ *
+ * > camelizeStyleName('background-color')
+ * < "backgroundColor"
+ * > camelizeStyleName('-moz-transition')
+ * < "MozTransition"
+ * > camelizeStyleName('-ms-transition')
+ * < "msTransition"
+ *
+ * As Andi Smith suggests
+ * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
+ * is converted to lowercase `ms`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function camelizeStyleName(string) {
+ return camelize(string.replace(msPattern, 'ms-'));
+}
+
+module.exports = camelizeStyleName;
+},{"148":148}],150:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule containsNode
+ * @typechecks
+ */
+
+'use strict';
+
+var isTextNode = _dereq_(163);
+
+/*eslint-disable no-bitwise */
+
+/**
+ * Checks if a given DOM node contains or is another DOM node.
+ *
+ * @param {?DOMNode} outerNode Outer DOM node.
+ * @param {?DOMNode} innerNode Inner DOM node.
+ * @return {boolean} True if `outerNode` contains or is `innerNode`.
+ */
+function containsNode(_x, _x2) {
+ var _again = true;
+
+ _function: while (_again) {
+ var outerNode = _x,
+ innerNode = _x2;
+ _again = false;
+
+ if (!outerNode || !innerNode) {
+ return false;
+ } else if (outerNode === innerNode) {
+ return true;
+ } else if (isTextNode(outerNode)) {
+ return false;
+ } else if (isTextNode(innerNode)) {
+ _x = outerNode;
+ _x2 = innerNode.parentNode;
+ _again = true;
+ continue _function;
+ } else if (outerNode.contains) {
+ return outerNode.contains(innerNode);
+ } else if (outerNode.compareDocumentPosition) {
+ return !!(outerNode.compareDocumentPosition(innerNode) & 16);
+ } else {
+ return false;
+ }
+ }
+}
+
+module.exports = containsNode;
+},{"163":163}],151:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule createArrayFromMixed
+ * @typechecks
+ */
+
+'use strict';
+
+var toArray = _dereq_(172);
+
+/**
+ * Perform a heuristic test to determine if an object is "array-like".
+ *
+ * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
+ * Joshu replied: "Mu."
+ *
+ * This function determines if its argument has "array nature": it returns
+ * true if the argument is an actual array, an `arguments' object, or an
+ * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
+ *
+ * It will return false for other array-like objects like Filelist.
+ *
+ * @param {*} obj
+ * @return {boolean}
+ */
+function hasArrayNature(obj) {
+ return(
+ // not null/false
+ !!obj && (
+ // arrays are objects, NodeLists are functions in Safari
+ typeof obj == 'object' || typeof obj == 'function') &&
+ // quacks like an array
+ 'length' in obj &&
+ // not window
+ !('setInterval' in obj) &&
+ // no DOM node should be considered an array-like
+ // a 'select' element has 'length' and 'item' properties on IE8
+ typeof obj.nodeType != 'number' && (
+ // a real array
+ Array.isArray(obj) ||
+ // arguments
+ 'callee' in obj ||
+ // HTMLCollection/NodeList
+ 'item' in obj)
+ );
+}
+
+/**
+ * Ensure that the argument is an array by wrapping it in an array if it is not.
+ * Creates a copy of the argument if it is already an array.
+ *
+ * This is mostly useful idiomatically:
+ *
+ * var createArrayFromMixed = require('createArrayFromMixed');
+ *
+ * function takesOneOrMoreThings(things) {
+ * things = createArrayFromMixed(things);
+ * ...
+ * }
+ *
+ * This allows you to treat `things' as an array, but accept scalars in the API.
+ *
+ * If you need to convert an array-like object, like `arguments`, into an array
+ * use toArray instead.
+ *
+ * @param {*} obj
+ * @return {array}
+ */
+function createArrayFromMixed(obj) {
+ if (!hasArrayNature(obj)) {
+ return [obj];
+ } else if (Array.isArray(obj)) {
+ return obj.slice();
+ } else {
+ return toArray(obj);
+ }
+}
+
+module.exports = createArrayFromMixed;
+},{"172":172}],152:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule createNodesFromMarkup
+ * @typechecks
+ */
+
+/*eslint-disable fb-www/unsafe-html*/
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(147);
+
+var createArrayFromMixed = _dereq_(151);
+var getMarkupWrap = _dereq_(157);
+var invariant = _dereq_(161);
+
+/**
+ * Dummy container used to render all markup.
+ */
+var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
+
+/**
+ * Pattern used by `getNodeName`.
+ */
+var nodeNamePattern = /^\s*<(\w+)/;
+
+/**
+ * Extracts the `nodeName` of the first element in a string of markup.
+ *
+ * @param {string} markup String of markup.
+ * @return {?string} Node name of the supplied markup.
+ */
+function getNodeName(markup) {
+ var nodeNameMatch = markup.match(nodeNamePattern);
+ return nodeNameMatch && nodeNameMatch[1].toLowerCase();
+}
+
+/**
+ * Creates an array containing the nodes rendered from the supplied markup. The
+ * optionally supplied `handleScript` function will be invoked once for each
+ * <script> element that is rendered. If no `handleScript` function is supplied,
+ * an exception is thrown if any <script> elements are rendered.
+ *
+ * @param {string} markup A string of valid HTML markup.
+ * @param {?function} handleScript Invoked once for each rendered <script>.
+ * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
+ */
+function createNodesFromMarkup(markup, handleScript) {
+ var node = dummyNode;
+ !!!dummyNode ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
+ var nodeName = getNodeName(markup);
+
+ var wrap = nodeName && getMarkupWrap(nodeName);
+ if (wrap) {
+ node.innerHTML = wrap[1] + markup + wrap[2];
+
+ var wrapDepth = wrap[0];
+ while (wrapDepth--) {
+ node = node.lastChild;
+ }
+ } else {
+ node.innerHTML = markup;
+ }
+
+ var scripts = node.getElementsByTagName('script');
+ if (scripts.length) {
+ !handleScript ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
+ createArrayFromMixed(scripts).forEach(handleScript);
+ }
+
+ var nodes = createArrayFromMixed(node.childNodes);
+ while (node.lastChild) {
+ node.removeChild(node.lastChild);
+ }
+ return nodes;
+}
+
+module.exports = createNodesFromMarkup;
+},{"147":147,"151":151,"157":157,"161":161}],153:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule emptyFunction
+ */
+
+"use strict";
+
+function makeEmptyFunction(arg) {
+ return function () {
+ return arg;
+ };
+}
+
+/**
+ * This function accepts and discards inputs; it has no side effects. This is
+ * primarily useful idiomatically for overridable function endpoints which
+ * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
+ */
+function emptyFunction() {}
+
+emptyFunction.thatReturns = makeEmptyFunction;
+emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
+emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
+emptyFunction.thatReturnsNull = makeEmptyFunction(null);
+emptyFunction.thatReturnsThis = function () {
+ return this;
+};
+emptyFunction.thatReturnsArgument = function (arg) {
+ return arg;
+};
+
+module.exports = emptyFunction;
+},{}],154:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule emptyObject
+ */
+
+'use strict';
+
+var emptyObject = {};
+
+if ("development" !== 'production') {
+ Object.freeze(emptyObject);
+}
+
+module.exports = emptyObject;
+},{}],155:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule focusNode
+ */
+
+'use strict';
+
+/**
+ * @param {DOMElement} node input/textarea to focus
+ */
+function focusNode(node) {
+ // IE8 can throw "Can't move focus to the control because it is invisible,
+ // not enabled, or of a type that does not accept the focus." for all kinds of
+ // reasons that are too expensive and fragile to test.
+ try {
+ node.focus();
+ } catch (e) {}
+}
+
+module.exports = focusNode;
+},{}],156:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getActiveElement
+ * @typechecks
+ */
+
+/* eslint-disable fb-www/typeof-undefined */
+
+/**
+ * Same as document.activeElement but wraps in a try-catch block. In IE it is
+ * not safe to call document.activeElement if there is nothing focused.
+ *
+ * The activeElement will be null only if the document or document body is not
+ * yet defined.
+ */
+'use strict';
+
+function getActiveElement() /*?DOMElement*/{
+ if (typeof document === 'undefined') {
+ return null;
+ }
+ try {
+ return document.activeElement || document.body;
+ } catch (e) {
+ return document.body;
+ }
+}
+
+module.exports = getActiveElement;
+},{}],157:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getMarkupWrap
+ */
+
+/*eslint-disable fb-www/unsafe-html */
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(147);
+
+var invariant = _dereq_(161);
+
+/**
+ * Dummy container used to detect which wraps are necessary.
+ */
+var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
+
+/**
+ * Some browsers cannot use `innerHTML` to render certain elements standalone,
+ * so we wrap them, render the wrapped nodes, then extract the desired node.
+ *
+ * In IE8, certain elements cannot render alone, so wrap all elements ('*').
+ */
+
+var shouldWrap = {};
+
+var selectWrap = [1, '<select multiple="true">', '</select>'];
+var tableWrap = [1, '<table>', '</table>'];
+var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
+
+var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
+
+var markupWrap = {
+ '*': [1, '?<div>', '</div>'],
+
+ 'area': [1, '<map>', '</map>'],
+ 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
+ 'legend': [1, '<fieldset>', '</fieldset>'],
+ 'param': [1, '<object>', '</object>'],
+ 'tr': [2, '<table><tbody>', '</tbody></table>'],
+
+ 'optgroup': selectWrap,
+ 'option': selectWrap,
+
+ 'caption': tableWrap,
+ 'colgroup': tableWrap,
+ 'tbody': tableWrap,
+ 'tfoot': tableWrap,
+ 'thead': tableWrap,
+
+ 'td': trWrap,
+ 'th': trWrap
+};
+
+// Initialize the SVG elements since we know they'll always need to be wrapped
+// consistently. If they are created inside a <div> they will be initialized in
+// the wrong namespace (and will not display).
+var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
+svgElements.forEach(function (nodeName) {
+ markupWrap[nodeName] = svgWrap;
+ shouldWrap[nodeName] = true;
+});
+
+/**
+ * Gets the markup wrap configuration for the supplied `nodeName`.
+ *
+ * NOTE: This lazily detects which wraps are necessary for the current browser.
+ *
+ * @param {string} nodeName Lowercase `nodeName`.
+ * @return {?array} Markup wrap configuration, if applicable.
+ */
+function getMarkupWrap(nodeName) {
+ !!!dummyNode ? "development" !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
+ if (!markupWrap.hasOwnProperty(nodeName)) {
+ nodeName = '*';
+ }
+ if (!shouldWrap.hasOwnProperty(nodeName)) {
+ if (nodeName === '*') {
+ dummyNode.innerHTML = '<link />';
+ } else {
+ dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
+ }
+ shouldWrap[nodeName] = !dummyNode.firstChild;
+ }
+ return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
+}
+
+module.exports = getMarkupWrap;
+},{"147":147,"161":161}],158:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getUnboundedScrollPosition
+ * @typechecks
+ */
+
+'use strict';
+
+/**
+ * Gets the scroll position of the supplied element or window.
+ *
+ * The return values are unbounded, unlike `getScrollPosition`. This means they
+ * may be negative or exceed the element boundaries (which is possible using
+ * inertial scrolling).
+ *
+ * @param {DOMWindow|DOMElement} scrollable
+ * @return {object} Map with `x` and `y` keys.
+ */
+function getUnboundedScrollPosition(scrollable) {
+ if (scrollable === window) {
+ return {
+ x: window.pageXOffset || document.documentElement.scrollLeft,
+ y: window.pageYOffset || document.documentElement.scrollTop
+ };
+ }
+ return {
+ x: scrollable.scrollLeft,
+ y: scrollable.scrollTop
+ };
+}
+
+module.exports = getUnboundedScrollPosition;
+},{}],159:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule hyphenate
+ * @typechecks
+ */
+
+'use strict';
+
+var _uppercasePattern = /([A-Z])/g;
+
+/**
+ * Hyphenates a camelcased string, for example:
+ *
+ * > hyphenate('backgroundColor')
+ * < "background-color"
+ *
+ * For CSS style names, use `hyphenateStyleName` instead which works properly
+ * with all vendor prefixes, including `ms`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function hyphenate(string) {
+ return string.replace(_uppercasePattern, '-$1').toLowerCase();
+}
+
+module.exports = hyphenate;
+},{}],160:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule hyphenateStyleName
+ * @typechecks
+ */
+
+'use strict';
+
+var hyphenate = _dereq_(159);
+
+var msPattern = /^ms-/;
+
+/**
+ * Hyphenates a camelcased CSS property name, for example:
+ *
+ * > hyphenateStyleName('backgroundColor')
+ * < "background-color"
+ * > hyphenateStyleName('MozTransition')
+ * < "-moz-transition"
+ * > hyphenateStyleName('msTransition')
+ * < "-ms-transition"
+ *
+ * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
+ * is converted to `-ms-`.
+ *
+ * @param {string} string
+ * @return {string}
+ */
+function hyphenateStyleName(string) {
+ return hyphenate(string).replace(msPattern, '-ms-');
+}
+
+module.exports = hyphenateStyleName;
+},{"159":159}],161:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule invariant
+ */
+
+'use strict';
+
+/**
+ * Use invariant() to assert state which your program assumes to be true.
+ *
+ * Provide sprintf-style format (only %s is supported) and arguments
+ * to provide information about what broke and what you were
+ * expecting.
+ *
+ * The invariant message will be stripped in production, but the invariant
+ * will remain to ensure logic does not differ in production.
+ */
+
+function invariant(condition, format, a, b, c, d, e, f) {
+ if ("development" !== 'production') {
+ if (format === undefined) {
+ throw new Error('invariant requires an error message argument');
+ }
+ }
+
+ if (!condition) {
+ var error;
+ if (format === undefined) {
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
+ } else {
+ var args = [a, b, c, d, e, f];
+ var argIndex = 0;
+ error = new Error(format.replace(/%s/g, function () {
+ return args[argIndex++];
+ }));
+ error.name = 'Invariant Violation';
+ }
+
+ error.framesToPop = 1; // we don't care about invariant's own frame
+ throw error;
+ }
+}
+
+module.exports = invariant;
+},{}],162:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule isNode
+ * @typechecks
+ */
+
+/**
+ * @param {*} object The object to check.
+ * @return {boolean} Whether or not the object is a DOM node.
+ */
+'use strict';
+
+function isNode(object) {
+ return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
+}
+
+module.exports = isNode;
+},{}],163:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule isTextNode
+ * @typechecks
+ */
+
+'use strict';
+
+var isNode = _dereq_(162);
+
+/**
+ * @param {*} object The object to check.
+ * @return {boolean} Whether or not the object is a DOM text node.
+ */
+function isTextNode(object) {
+ return isNode(object) && object.nodeType == 3;
+}
+
+module.exports = isTextNode;
+},{"162":162}],164:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule joinClasses
+ * @typechecks static-only
+ */
-},{"150":150,"157":157,"29":29}],171:[function(_dereq_,module,exports){
+'use strict';
+
+/**
+ * Combines multiple className strings into one.
+ * http://jsperf.com/joinclasses-args-vs-array
+ *
+ * @param {...?string} className
+ * @return {string}
+ */
+function joinClasses(className /*, ... */) {
+ if (!className) {
+ className = '';
+ }
+ var nextClass;
+ var argLength = arguments.length;
+ if (argLength > 1) {
+ for (var ii = 1; ii < argLength; ii++) {
+ nextClass = arguments[ii];
+ if (nextClass) {
+ className = (className ? className + ' ' : '') + nextClass;
+ }
+ }
+ }
+ return className;
+}
+
+module.exports = joinClasses;
+},{}],165:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule keyMirror
+ * @typechecks static-only
+ */
+
+'use strict';
+
+var invariant = _dereq_(161);
+
+/**
+ * Constructs an enumeration with keys equal to their value.
+ *
+ * For example:
+ *
+ * var COLORS = keyMirror({blue: null, red: null});
+ * var myColor = COLORS.blue;
+ * var isColorValid = !!COLORS[myColor];
+ *
+ * The last line could not be performed if the values of the generated enum were
+ * not equal to their keys.
+ *
+ * Input: {key1: val1, key2: val2}
+ * Output: {key1: key1, key2: key2}
+ *
+ * @param {object} obj
+ * @return {object}
+ */
+var keyMirror = function (obj) {
+ var ret = {};
+ var key;
+ !(obj instanceof Object && !Array.isArray(obj)) ? "development" !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
+ for (key in obj) {
+ if (!obj.hasOwnProperty(key)) {
+ continue;
+ }
+ ret[key] = key;
+ }
+ return ret;
+};
+
+module.exports = keyMirror;
+},{"161":161}],166:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule keyOf
+ */
+
+/**
+ * Allows extraction of a minified key. Let's the build system minify keys
+ * without losing the ability to dynamically use key strings as values
+ * themselves. Pass in an object with a single key/val pair and it will return
+ * you the string key of that single record. Suppose you want to grab the
+ * value for a key 'className' inside of an object. Key/val minification may
+ * have aliased that key to be 'xa12'. keyOf({className: null}) will return
+ * 'xa12' in that case. Resolve keys you want to use once at startup time, then
+ * reuse those resolutions.
+ */
+"use strict";
+
+var keyOf = function (oneKeyObj) {
+ var key;
+ for (key in oneKeyObj) {
+ if (!oneKeyObj.hasOwnProperty(key)) {
+ continue;
+ }
+ return key;
+ }
+ return null;
+};
+
+module.exports = keyOf;
+},{}],167:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule mapObject
+ */
+
+'use strict';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Executes the provided `callback` once for each enumerable own property in the
+ * object and constructs a new object from the results. The `callback` is
+ * invoked with three arguments:
+ *
+ * - the property value
+ * - the property name
+ * - the object being traversed
+ *
+ * Properties that are added after the call to `mapObject` will not be visited
+ * by `callback`. If the values of existing properties are changed, the value
+ * passed to `callback` will be the value at the time `mapObject` visits them.
+ * Properties that are deleted before being visited are not visited.
+ *
+ * @grep function objectMap()
+ * @grep function objMap()
+ *
+ * @param {?object} object
+ * @param {function} callback
+ * @param {*} context
+ * @return {?object}
+ */
+function mapObject(object, callback, context) {
+ if (!object) {
+ return null;
+ }
+ var result = {};
+ for (var name in object) {
+ if (hasOwnProperty.call(object, name)) {
+ result[name] = callback.call(context, object[name], name, object);
+ }
+ }
+ return result;
+}
+
+module.exports = mapObject;
+},{}],168:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule memoizeStringOnly
+ * @typechecks static-only
+ */
+
+'use strict';
+
+/**
+ * Memoizes the return value of a function that accepts one string argument.
+ *
+ * @param {function} callback
+ * @return {function}
+ */
+function memoizeStringOnly(callback) {
+ var cache = {};
+ return function (string) {
+ if (!cache.hasOwnProperty(string)) {
+ cache[string] = callback.call(this, string);
+ }
+ return cache[string];
+ };
+}
+
+module.exports = memoizeStringOnly;
+},{}],169:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule performance
+ * @typechecks
+ */
+
+'use strict';
+
+var ExecutionEnvironment = _dereq_(147);
+
+var performance;
+
+if (ExecutionEnvironment.canUseDOM) {
+ performance = window.performance || window.msPerformance || window.webkitPerformance;
+}
+
+module.exports = performance || {};
+},{"147":147}],170:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule performanceNow
+ * @typechecks
+ */
+
+'use strict';
+
+var performance = _dereq_(169);
+
+var performanceNow;
+
+/**
+ * Detect if we can use `window.performance.now()` and gracefully fallback to
+ * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
+ * because of Facebook's testing infrastructure.
+ */
+if (performance.now) {
+ performanceNow = function () {
+ return performance.now();
+ };
+} else {
+ performanceNow = function () {
+ return Date.now();
+ };
+}
+
+module.exports = performanceNow;
+},{"169":169}],171:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule shallowEqual
+ * @typechecks
+ *
+ */
+
+'use strict';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+/**
+ * Performs equality by iterating through keys on an object and returning false
+ * when any key has values which are not strictly equal between the arguments.
+ * Returns true when the values of all keys are strictly equal.
+ */
+function shallowEqual(objA, objB) {
+ if (objA === objB) {
+ return true;
+ }
+
+ if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
+ return false;
+ }
+
+ var keysA = Object.keys(objA);
+ var keysB = Object.keys(objB);
+
+ if (keysA.length !== keysB.length) {
+ return false;
+ }
+
+ // Test for A's keys different from B.
+ var bHasOwnProperty = hasOwnProperty.bind(objB);
+ for (var i = 0; i < keysA.length; i++) {
+ if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+module.exports = shallowEqual;
+},{}],172:[function(_dereq_,module,exports){
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule toArray
+ * @typechecks
+ */
+
+'use strict';
+
+var invariant = _dereq_(161);
+
+/**
+ * Convert array-like objects to arrays.
+ *
+ * This API assumes the caller knows the contents of the data type. For less
+ * well defined inputs use createArrayFromMixed.
+ *
+ * @param {object|function|filelist} obj
+ * @return {array}
+ */
+function toArray(obj) {
+ var length = obj.length;
+
+ // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
+ // old versions of Safari).
+ !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? "development" !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
+
+ !(typeof length === 'number') ? "development" !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
+
+ !(length === 0 || length - 1 in obj) ? "development" !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
+
+ // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
+ // without method will throw during the slice call and skip straight to the
+ // fallback.
+ if (obj.hasOwnProperty) {
+ try {
+ return Array.prototype.slice.call(obj);
+ } catch (e) {
+ // IE < 9 does not support Array#slice on collections objects
+ }
+ }
+
+ // Fall back to copying key by key. This assumes all keys have a value,
+ // so will not preserve sparsely populated inputs.
+ var ret = Array(length);
+ for (var ii = 0; ii < length; ii++) {
+ ret[ii] = obj[ii];
+ }
+ return ret;
+}
+
+module.exports = toArray;
+},{"161":161}],173:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
@@ -21589,9 +20725,9 @@
* @providesModule warning
*/
-"use strict";
+'use strict';
-var emptyFunction = _dereq_(129);
+var emptyFunction = _dereq_(153);
/**
* Similar to invariant but only logs a warning if the condition is not met.
@@ -21602,20 +20738,14 @@
var warning = emptyFunction;
-if ("production" !== "development") {
- warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
- if (format === undefined) {
- throw new Error(
- '`warning(condition, format, ...args)` requires a warning ' +
- 'message argument'
- );
+if ("development" !== 'production') {
+ warning = function (condition, format) {
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
+ args[_key - 2] = arguments[_key];
}
- if (format.length < 10 || /^[s\W]*$/.test(format)) {
- throw new Error(
- 'The warning format should be able to uniquely identify this ' +
- 'warning. Please, use a more descriptive format than: ' + format
- );
+ if (format === undefined) {
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
@@ -21624,19 +20754,22 @@
if (!condition) {
var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
- console.warn(message);
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
+ return args[argIndex++];
+ });
+ if (typeof console !== 'undefined') {
+ console.error(message);
+ }
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
- } catch(x) {}
+ } catch (x) {}
}
};
}
module.exports = warning;
-
-},{"129":129}]},{},[1])(1)
+},{"153":153}]},{},[1])(1)
});
\ No newline at end of file

dist/react-with-addons.min.js

@@ -1,5 +1,5 @@
/**
- * React (with addons) v0.13.3
+ * React (with addons) v0.14.9
*
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
@@ -9,10 +9,8 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){"use strict";var r=e(25),o=e(31),i=e(42),a=e(34),s=e(67),u=e(95),l=e(97),c=e(124),p=e(119),d=e(165);o.addons={CSSTransitionGroup:a,LinkedStateMixin:r,PureRenderMixin:i,TransitionGroup:u,batchedUpdates:l.batchedUpdates,classSet:c,cloneWithProps:p,createFragment:s.create,update:d},t.exports=o},{119:119,124:124,165:165,25:25,31:31,34:34,42:42,67:67,95:95,97:97}],2:[function(e,t,n){"use strict";var r=e(131),o={componentDidMount:function(){this.props.autoFocus&&r(this.getDOMNode())}};t.exports=o},{131:131}],3:[function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function i(e){switch(e){case P.topCompositionStart:return I.compositionStart;case P.topCompositionEnd:return I.compositionEnd;case P.topCompositionUpdate:return I.compositionUpdate}}function a(e,t){return e===P.topKeyDown&&t.keyCode===b}function s(e,t){switch(e){case P.topKeyUp:return-1!==E.indexOf(t.keyCode);case P.topKeyDown:return t.keyCode!==b;case P.topKeyPress:case P.topMouseDown:case P.topBlur:return!0;default:return!1}}function u(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function l(e,t,n,r){var o,l;if(_?o=i(e):w?s(e,r)&&(o=I.compositionEnd):a(e,r)&&(o=I.compositionStart),!o)return null;M&&(w||o!==I.compositionStart?o===I.compositionEnd&&w&&(l=w.getData()):w=v.getPooled(t));var c=g.getPooled(o,n,r);if(l)c.data=l;else{var p=u(r);null!==p&&(c.data=p)}return h.accumulateTwoPhaseDispatches(c),c}function c(e,t){switch(e){case P.topCompositionEnd:return u(t);case P.topKeyPress:var n=t.which;return n!==T?null:(R=!0,N);case P.topTextInput:var r=t.data;return r===N&&R?null:r;default:return null}}function p(e,t){if(w){if(e===P.topCompositionEnd||s(e,t)){var n=w.getData();return v.release(w),w=null,n}return null}switch(e){case P.topPaste:return null;case P.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case P.topCompositionEnd:return M?null:t.data;default:return null}}function d(e,t,n,r){var o;if(o=D?c(e,r):p(e,r),!o)return null;var i=y.getPooled(I.beforeInput,n,r);return i.data=o,h.accumulateTwoPhaseDispatches(i),i}var f=e(16),h=e(21),m=e(22),v=e(23),g=e(103),y=e(107),C=e(154),E=[9,13,27,32],b=229,_=m.canUseDOM&&"CompositionEvent"in window,x=null;m.canUseDOM&&"documentMode"in document&&(x=document.documentMode);var D=m.canUseDOM&&"TextEvent"in window&&!x&&!r(),M=m.canUseDOM&&(!_||x&&x>8&&11>=x),T=32,N=String.fromCharCode(T),P=f.topLevelTypes,I={beforeInput:{phasedRegistrationNames:{bubbled:C({onBeforeInput:null}),captured:C({onBeforeInputCapture:null})},dependencies:[P.topCompositionEnd,P.topKeyPress,P.topTextInput,P.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:C({onCompositionEnd:null}),captured:C({onCompositionEndCapture:null})},dependencies:[P.topBlur,P.topCompositionEnd,P.topKeyDown,P.topKeyPress,P.topKeyUp,P.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:C({onCompositionStart:null}),captured:C({onCompositionStartCapture:null})},dependencies:[P.topBlur,P.topCompositionStart,P.topKeyDown,P.topKeyPress,P.topKeyUp,P.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:C({onCompositionUpdate:null}),captured:C({onCompositionUpdateCapture:null})},dependencies:[P.topBlur,P.topCompositionUpdate,P.topKeyDown,P.topKeyPress,P.topKeyUp,P.topMouseDown]}},R=!1,w=null,O={eventTypes:I,extractEvents:function(e,t,n,r){return[l(e,t,n,r),d(e,t,n,r)]}};t.exports=O},{103:103,107:107,154:154,16:16,21:21,22:22,23:23}],4:[function(e,t,n){var r=e(147),o={addClass:function(e,t){return r(!/\s/.test(t)),t&&(e.classList?e.classList.add(t):o.hasClass(e,t)||(e.className=e.className+" "+t)),e},removeClass:function(e,t){return r(!/\s/.test(t)),t&&(e.classList?e.classList.remove(t):o.hasClass(e,t)&&(e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),e},conditionClass:function(e,t,n){return(n?o.addClass:o.removeClass)(e,t)},hasClass:function(e,t){return r(!/\s/.test(t)),e.classList?!!t&&e.classList.contains(t):(" "+e.className+" ").indexOf(" "+t+" ")>-1}};t.exports=o},{147:147}],5:[function(e,t,n){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var o={boxFlex:!0,boxFlexGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},i=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){i.forEach(function(t){o[r(t,e)]=o[e]})});var a={background:{backgroundImage:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundColor:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0}},s={isUnitlessNumber:o,shorthandPropertyExpansions:a};t.exports=s},{}],6:[function(e,t,n){"use strict";var r=e(5),o=e(22),i=(e(118),e(125)),a=e(145),s=e(156),u=(e(166),s(function(e){return a(e)})),l="cssFloat";o.canUseDOM&&void 0===document.documentElement.style.cssFloat&&(l="styleFloat");var c={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=u(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=i(o,t[o]);if("float"===o&&(o=l),a)n[o]=a;else{var s=r.shorthandPropertyExpansions[o];if(s)for(var u in s)n[u]="";else n[o]=""}}}};t.exports=c},{118:118,125:125,145:145,156:156,166:166,22:22,5:5}],7:[function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=e(30),i=e(29),a=e(147);i(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){a(e.length===t.length),this._callbacks=null,this._contexts=null;for(var n=0,r=e.length;r>n;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{147:147,29:29,30:30}],8:[function(e,t,n){"use strict";function r(e){return"SELECT"===e.nodeName||"INPUT"===e.nodeName&&"file"===e.type}function o(e){var t=x.getPooled(P.change,R,e);E.accumulateTwoPhaseDispatches(t),_.batchedUpdates(i,t)}function i(e){C.enqueueEvents(e),C.processEventQueue()}function a(e,t){I=e,R=t,I.attachEvent("onchange",o)}function s(){I&&(I.detachEvent("onchange",o),I=null,R=null)}function u(e,t,n){return e===N.topChange?n:void 0}function l(e,t,n){e===N.topFocus?(s(),a(t,n)):e===N.topBlur&&s()}function c(e,t){I=e,R=t,w=e.value,O=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(I,"value",k),I.attachEvent("onpropertychange",d)}function p(){I&&(delete I.value,I.detachEvent("onpropertychange",d),I=null,R=null,w=null,O=null)}function d(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==w&&(w=t,o(e))}}function f(e,t,n){return e===N.topInput?n:void 0}function h(e,t,n){e===N.topFocus?(p(),c(t,n)):e===N.topBlur&&p()}function m(e,t,n){return e!==N.topSelectionChange&&e!==N.topKeyUp&&e!==N.topKeyDown||!I||I.value===w?void 0:(w=I.value,R)}function v(e){return"INPUT"===e.nodeName&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,n){return e===N.topClick?n:void 0}var y=e(16),C=e(18),E=e(21),b=e(22),_=e(97),x=e(105),D=e(148),M=e(150),T=e(154),N=y.topLevelTypes,P={change:{phasedRegistrationNames:{bubbled:T({onChange:null}),captured:T({onChangeCapture:null})},dependencies:[N.topBlur,N.topChange,N.topClick,N.topFocus,N.topInput,N.topKeyDown,N.topKeyUp,N.topSelectionChange]}},I=null,R=null,w=null,O=null,S=!1;b.canUseDOM&&(S=D("change")&&(!("documentMode"in document)||document.documentMode>8));var A=!1;b.canUseDOM&&(A=D("input")&&(!("documentMode"in document)||document.documentMode>9));var k={get:function(){return O.get.call(this)},set:function(e){w=""+e,O.set.call(this,e)}},L={eventTypes:P,extractEvents:function(e,t,n,o){var i,a;if(r(t)?S?i=u:a=l:M(t)?A?i=f:(i=m,a=h):v(t)&&(i=g),i){var s=i(e,t,n);if(s){var c=x.getPooled(P.change,s,o);return E.accumulateTwoPhaseDispatches(c),c}}a&&a(e,t,n)}};t.exports=L},{105:105,148:148,150:150,154:154,16:16,18:18,21:21,22:22,97:97}],9:[function(e,t,n){"use strict";var r=0,o={createReactRootIndex:function(){return r++}};t.exports=o},{}],10:[function(e,t,n){"use strict";function r(e,t,n){e.insertBefore(t,e.childNodes[n]||null)}var o=e(13),i=e(77),a=e(160),s=e(147),u={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:a,processUpdates:function(e,t){for(var n,u=null,l=null,c=0;c<e.length;c++)if(n=e[c],n.type===i.MOVE_EXISTING||n.type===i.REMOVE_NODE){var p=n.fromIndex,d=n.parentNode.childNodes[p],f=n.parentID;s(d),u=u||{},u[f]=u[f]||[],u[f][p]=d,l=l||[],l.push(d)}var h=o.dangerouslyRenderMarkup(t);if(l)for(var m=0;m<l.length;m++)l[m].parentNode.removeChild(l[m]);for(var v=0;v<e.length;v++)switch(n=e[v],n.type){case i.INSERT_MARKUP:r(n.parentNode,h[n.markupIndex],n.toIndex);break;case i.MOVE_EXISTING:r(n.parentNode,u[n.parentID][n.fromIndex],n.toIndex);break;case i.TEXT_CONTENT:a(n.parentNode,n.textContent);break;case i.REMOVE_NODE:}}};t.exports=u},{13:13,147:147,160:160,77:77}],11:[function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=e(147),i={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=e.Properties||{},n=e.DOMAttributeNames||{},a=e.DOMPropertyNames||{},u=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var l in t){o(!s.isStandardName.hasOwnProperty(l)),s.isStandardName[l]=!0;var c=l.toLowerCase();if(s.getPossibleStandardName[c]=l,n.hasOwnProperty(l)){var p=n[l];s.getPossibleStandardName[p]=l,s.getAttributeName[l]=p}else s.getAttributeName[l]=c;s.getPropertyName[l]=a.hasOwnProperty(l)?a[l]:l,u.hasOwnProperty(l)?s.getMutationMethod[l]=u[l]:s.getMutationMethod[l]=null;var d=t[l];s.mustUseAttribute[l]=r(d,i.MUST_USE_ATTRIBUTE),s.mustUseProperty[l]=r(d,i.MUST_USE_PROPERTY),s.hasSideEffects[l]=r(d,i.HAS_SIDE_EFFECTS),s.hasBooleanValue[l]=r(d,i.HAS_BOOLEAN_VALUE),s.hasNumericValue[l]=r(d,i.HAS_NUMERIC_VALUE),s.hasPositiveNumericValue[l]=r(d,i.HAS_POSITIVE_NUMERIC_VALUE),s.hasOverloadedBooleanValue[l]=r(d,i.HAS_OVERLOADED_BOOLEAN_VALUE),o(!s.mustUseAttribute[l]||!s.mustUseProperty[l]),o(s.mustUseProperty[l]||!s.hasSideEffects[l]),o(!!s.hasBooleanValue[l]+!!s.hasNumericValue[l]+!!s.hasOverloadedBooleanValue[l]<=1)}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",isStandardName:{},getPossibleStandardName:{},getAttributeName:{},getPropertyName:{},getMutationMethod:{},mustUseAttribute:{},mustUseProperty:{},hasSideEffects:{},hasBooleanValue:{},hasNumericValue:{},hasPositiveNumericValue:{},hasOverloadedBooleanValue:{},_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<s._isCustomAttributeFunctions.length;t++){var n=s._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=a[e];return r||(a[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:i};t.exports=s},{147:147}],12:[function(e,t,n){"use strict";function r(e,t){return null==t||o.hasBooleanValue[e]&&!t||o.hasNumericValue[e]&&isNaN(t)||o.hasPositiveNumericValue[e]&&1>t||o.hasOverloadedBooleanValue[e]&&t===!1}var o=e(11),i=e(158),a=(e(166),{createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+i(e)},createMarkupForProperty:function(e,t){if(o.isStandardName.hasOwnProperty(e)&&o.isStandardName[e]){if(r(e,t))return"";var n=o.getAttributeName[e];return o.hasBooleanValue[e]||o.hasOverloadedBooleanValue[e]&&t===!0?n:n+"="+i(t)}return o.isCustomAttribute(e)?null==t?"":e+"="+i(t):null},setValueForProperty:function(e,t,n){if(o.isStandardName.hasOwnProperty(t)&&o.isStandardName[t]){var i=o.getMutationMethod[t];if(i)i(e,n);else if(r(t,n))this.deleteValueForProperty(e,t);else if(o.mustUseAttribute[t])e.setAttribute(o.getAttributeName[t],""+n);else{var a=o.getPropertyName[t];o.hasSideEffects[t]&&""+e[a]==""+n||(e[a]=n)}}else o.isCustomAttribute(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){if(o.isStandardName.hasOwnProperty(t)&&o.isStandardName[t]){var n=o.getMutationMethod[t];if(n)n(e,void 0);else if(o.mustUseAttribute[t])e.removeAttribute(o.getAttributeName[t]);else{var r=o.getPropertyName[t],i=o.getDefaultValueForProperty(e.nodeName,r);o.hasSideEffects[t]&&""+e[r]===i||(e[r]=i)}}else o.isCustomAttribute(t)&&e.removeAttribute(t)}});t.exports=a},{11:11,158:158,166:166}],13:[function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=e(22),i=e(123),a=e(126),s=e(139),u=e(147),l=/^(<[^ \/>]+)/,c="data-danger-index",p={dangerouslyRenderMarkup:function(e){u(o.canUseDOM);for(var t,n={},p=0;p<e.length;p++)u(e[p]),t=r(e[p]),t=s(t)?t:"*",n[t]=n[t]||[],n[t][p]=e[p];var d=[],f=0;for(t in n)if(n.hasOwnProperty(t)){var h,m=n[t];for(h in m)if(m.hasOwnProperty(h)){var v=m[h];m[h]=v.replace(l,"$1 "+c+'="'+h+'" ')}for(var g=i(m.join(""),a),y=0;y<g.length;++y){var C=g[y];C.hasAttribute&&C.hasAttribute(c)&&(h=+C.getAttribute(c),C.removeAttribute(c),u(!d.hasOwnProperty(h)),d[h]=C,f+=1)}}return u(f===d.length),u(d.length===e.length),d},dangerouslyReplaceNodeWithMarkup:function(e,t){u(o.canUseDOM),u(t),u("html"!==e.tagName.toLowerCase());var n=i(t,a)[0];e.parentNode.replaceChild(n,e)}};t.exports=p},{123:123,126:126,139:139,147:147,22:22}],14:[function(e,t,n){"use strict";var r=e(154),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null}),r({AnalyticsEventPlugin:null}),r({MobileSafariClickEventPlugin:null})];t.exports=o},{154:154}],15:[function(e,t,n){"use strict";var r=e(16),o=e(21),i=e(109),a=e(75),s=e(154),u=r.topLevelTypes,l=a.getFirstReactDOM,c={mouseEnter:{registrationName:s({onMouseEnter:null}),dependencies:[u.topMouseOut,u.topMouseOver]},mouseLeave:{registrationName:s({onMouseLeave:null}),dependencies:[u.topMouseOut,u.topMouseOver]}},p=[null,null],d={eventTypes:c,extractEvents:function(e,t,n,r){if(e===u.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==u.topMouseOut&&e!==u.topMouseOver)return null;var s;if(t.window===t)s=t;else{var d=t.ownerDocument;s=d?d.defaultView||d.parentWindow:window}var f,h;if(e===u.topMouseOut?(f=t,h=l(r.relatedTarget||r.toElement)||s):(f=s,h=t),f===h)return null;var m=f?a.getID(f):"",v=h?a.getID(h):"",g=i.getPooled(c.mouseLeave,m,r);g.type="mouseleave",g.target=f,g.relatedTarget=h;var y=i.getPooled(c.mouseEnter,v,r);return y.type="mouseenter",y.target=h,y.relatedTarget=f,o.accumulateEnterLeaveDispatches(g,y,m,v),p[0]=g,p[1]=y,p}};t.exports=d},{109:109,154:154,16:16,21:21,75:75}],16:[function(e,t,n){"use strict";var r=e(153),o=r({bubbled:null,captured:null}),i=r({topBlur:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topReset:null,topScroll:null,topSelectionChange:null,topSubmit:null,topTextInput:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topWheel:null}),a={topLevelTypes:i,PropagationPhases:o};t.exports=a},{153:153}],17:[function(e,t,n){var r=e(126),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},{126:126}],18:[function(e,t,n){"use strict";var r=e(19),o=e(20),i=e(115),a=e(132),s=e(147),u={},l=null,c=function(e){if(e){var t=o.executeDispatch,n=r.getPluginModuleForEvent(e);n&&n.executeDispatch&&(t=n.executeDispatch),o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e)}},p=null,d={injection:{injectMount:o.injection.injectMount,injectInstanceHandle:function(e){p=e},getInstanceHandle:function(){return p},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,n){s(!n||"function"==typeof n);var r=u[t]||(u[t]={});r[e]=n},getListener:function(e,t){var n=u[t];return n&&n[e]},deleteListener:function(e,t){var n=u[t];n&&delete n[e]},deleteAllListeners:function(e){for(var t in u)delete u[t][e]},extractEvents:function(e,t,n,o){for(var a,s=r.plugins,u=0,l=s.length;l>u;u++){var c=s[u];if(c){var p=c.extractEvents(e,t,n,o);p&&(a=i(a,p))}}return a},enqueueEvents:function(e){e&&(l=i(l,e))},processEventQueue:function(){var e=l;l=null,a(e,c),s(!l)},__purge:function(){u={}},__getListenerBank:function(){return u}};t.exports=d},{115:115,132:132,147:147,19:19,20:20}],19:[function(e,t,n){"use strict";function r(){if(s)for(var e in u){var t=u[e],n=s.indexOf(e);if(a(n>-1),!l.plugins[n]){a(t.extractEvents),l.plugins[n]=t;var r=t.eventTypes;for(var i in r)a(o(r[i],t,i))}}}function o(e,t,n){a(!l.eventNameDispatchConfigs.hasOwnProperty(n)),l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var s=r[o];i(s,t,n)}return!0}return e.registrationName?(i(e.registrationName,t,n),!0):!1}function i(e,t,n){a(!l.registrationNameModules[e]),l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var a=e(147),s=null,u={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){a(!s),s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];u.hasOwnProperty(n)&&u[n]===o||(a(!u[n]),u[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in u)u.hasOwnProperty(e)&&delete u[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=l},{147:147}],20:[function(e,t,n){"use strict";function r(e){return e===v.topMouseUp||e===v.topTouchEnd||e===v.topTouchCancel}function o(e){return e===v.topMouseMove||e===v.topTouchMove}function i(e){return e===v.topMouseDown||e===v.topTouchStart}function a(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)t(e,n[o],r[o]);else n&&t(e,n,r)}function s(e,t,n){e.currentTarget=m.Mount.getNode(n);var r=t(e,n);return e.currentTarget=null,r}function u(e,t){a(e,t),e._dispatchListeners=null,e._dispatchIDs=null}function l(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function c(e){var t=l(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function p(e){var t=e._dispatchListeners,n=e._dispatchIDs;h(!Array.isArray(t));var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function d(e){return!!e._dispatchListeners}var f=e(16),h=e(147),m={Mount:null,injectMount:function(e){m.Mount=e}},v=f.topLevelTypes,g={isEndish:r,isMoveish:o,isStartish:i,executeDirectDispatch:p,executeDispatch:s,executeDispatchesInOrder:u,executeDispatchesInOrderStopAtTrue:c,hasDispatches:d,injection:m,useTouchEvents:!1};t.exports=g},{147:147,16:16}],21:[function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return v(e,r)}function o(e,t,n){var o=t?m.bubbled:m.captured,i=r(e,n,o);i&&(n._dispatchListeners=f(n._dispatchListeners,i),n._dispatchIDs=f(n._dispatchIDs,e))}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&d.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,o,e)}function a(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=v(e,r);o&&(n._dispatchListeners=f(n._dispatchListeners,o),n._dispatchIDs=f(n._dispatchIDs,e))}}function s(e){e&&e.dispatchConfig.registrationName&&a(e.dispatchMarker,null,e)}function u(e){h(e,i)}function l(e,t,n,r){d.injection.getInstanceHandle().traverseEnterLeave(n,r,a,e,t)}function c(e){h(e,s)}var p=e(16),d=e(18),f=e(115),h=e(132),m=p.PropagationPhases,v=d.getListener,g={accumulateTwoPhaseDispatches:u,accumulateDirectDispatches:c,accumulateEnterLeaveDispatches:l};t.exports=g},{115:115,132:132,16:16,18:18}],22:[function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],23:[function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=e(30),i=e(29),a=e(142);i(r.prototype,{getText:function(){return"value"in this._root?this._root.value:this._root[a()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),i=o.length;for(e=0;r>e&&n[e]===o[e];e++);var a=r-e;for(t=1;a>=t&&n[r-t]===o[i-t];t++);var s=t>1?1-t:void 0;return this._fallbackText=o.slice(e,s),this._fallbackText}}),o.addPoolingTo(r),t.exports=r},{142:142,29:29,30:30}],24:[function(e,t,n){"use strict";var r,o=e(11),i=e(22),a=o.injection.MUST_USE_ATTRIBUTE,s=o.injection.MUST_USE_PROPERTY,u=o.injection.HAS_BOOLEAN_VALUE,l=o.injection.HAS_SIDE_EFFECTS,c=o.injection.HAS_NUMERIC_VALUE,p=o.injection.HAS_POSITIVE_NUMERIC_VALUE,d=o.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(i.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:a|u,allowTransparency:a,alt:null,async:u,autoComplete:null,autoPlay:u,cellPadding:null,cellSpacing:null,charSet:a,checked:s|u,classID:a,className:r?a:s,cols:a|p,colSpan:null,content:null,contentEditable:null,contextMenu:a,controls:s|u,coords:null,crossOrigin:null,data:null,dateTime:a,defer:u,dir:null,disabled:a|u,download:d,draggable:null,encType:null,form:a,formAction:a,formEncType:a,formMethod:a,formNoValidate:u,formTarget:a,frameBorder:a,headers:null,height:a,hidden:a|u,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:s,label:null,lang:null,list:a,loop:s|u,low:null,manifest:a,marginHeight:null,marginWidth:null,max:null,maxLength:a,media:a,mediaGroup:null,method:null,min:null,multiple:s|u,muted:s|u,name:null,noValidate:u,open:u,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:s|u,rel:null,required:u,role:a,rows:a|p,rowSpan:null,sandbox:null,scope:null,scoped:u,scrolling:null,seamless:a|u,selected:s|u,shape:null,size:a|p,sizes:a,span:p,spellCheck:null,src:null,srcDoc:s,srcSet:a,start:c,step:null,style:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:s|l,width:a,wmode:a,autoCapitalize:null,autoCorrect:null,itemProp:a,itemScope:a|u,itemType:a,itemID:a,itemRef:a,property:null,unselectable:a},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoCapitalize:"autocapitalize",autoComplete:"autocomplete",autoCorrect:"autocorrect",autoFocus:"autofocus",autoPlay:"autoplay",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{11:11,22:22}],25:[function(e,t,n){"use strict";var r=e(73),o=e(92),i={linkState:function(e){return new r(this.state[e],o.createStateKeySetter(this,e))}};t.exports=i},{73:73,92:92}],26:[function(e,t,n){"use strict";function r(e){l(null==e.props.checkedLink||null==e.props.valueLink)}function o(e){r(e),l(null==e.props.value&&null==e.props.onChange)}function i(e){r(e),l(null==e.props.checked&&null==e.props.onChange)}function a(e){this.props.valueLink.requestChange(e.target.value)}function s(e){this.props.checkedLink.requestChange(e.target.checked)}var u=e(84),l=e(147),c={button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0},p={Mixin:{propTypes:{value:function(e,t,n){return!e[t]||c[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func}},getValue:function(e){return e.props.valueLink?(o(e),e.props.valueLink.value):e.props.value},getChecked:function(e){return e.props.checkedLink?(i(e),e.props.checkedLink.value):e.props.checked},getOnChange:function(e){return e.props.valueLink?(o(e),a):e.props.checkedLink?(i(e),s):e.props.onChange}};t.exports=p},{147:147,84:84}],27:[function(e,t,n){"use strict";function r(e){e.remove()}var o=e(33),i=e(115),a=e(132),s=e(147),u={trapBubbledEvent:function(e,t){s(this.isMounted());var n=this.getDOMNode();s(n);var r=o.trapBubbledEvent(e,t,n);this._localEventListeners=i(this._localEventListeners,r)},componentWillUnmount:function(){this._localEventListeners&&a(this._localEventListeners,r)}};t.exports=u},{115:115,132:132,147:147,33:33}],28:[function(e,t,n){"use strict";var r=e(16),o=e(126),i=r.topLevelTypes,a={eventTypes:null,extractEvents:function(e,t,n,r){if(e===i.topTouchStart){var a=r.target;a&&!a.onclick&&(a.onclick=o)}}};t.exports=a},{126:126,16:16}],29:[function(e,t,n){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,o=1;o<arguments.length;o++){var i=arguments[o];if(null!=i){var a=Object(i);for(var s in a)r.call(a,s)&&(n[s]=a[s])}}return n}t.exports=r},{}],30:[function(e,t,n){"use strict";var r=e(147),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},i=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},s=function(e,t,n,r,o){var i=this;if(i.instancePool.length){var a=i.instancePool.pop();return i.call(a,e,t,n,r,o),a}return new i(e,t,n,r,o)},u=function(e){var t=this;r(e instanceof t),e.destructor&&e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=10,c=o,p=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||c,n.poolSize||(n.poolSize=l),n.release=u,n},d={addPoolingTo:p,oneArgumentPooler:o,twoArgumentPooler:i,threeArgumentPooler:a,fiveArgumentPooler:s};t.exports=d},{147:147}],31:[function(e,t,n){"use strict";var r=e(20),o=e(37),i=e(39),a=e(38),s=e(44),u=e(45),l=e(61),c=(e(62),e(46)),p=e(57),d=e(60),f=e(70),h=e(75),m=e(80),v=e(84),g=e(87),y=e(90),C=e(29),E=e(129),b=e(157);d.inject();var _=l.createElement,x=l.createFactory,D=l.cloneElement,M=m.measure("React","render",h.render),T={Children:{map:o.map,forEach:o.forEach,count:o.count,only:b},Component:i,DOM:c,PropTypes:v,initializeTouchEvents:function(e){r.useTouchEvents=e},createClass:a.createClass,createElement:_,cloneElement:D,createFactory:x,createMixin:function(e){return e},constructAndRenderComponent:h.constructAndRenderComponent,constructAndRenderComponentByID:h.constructAndRenderComponentByID,findDOMNode:E,render:M,renderToString:y.renderToString,renderToStaticMarkup:y.renderToStaticMarkup,unmountComponentAtNode:h.unmountComponentAtNode,isValidElement:l.isValidElement,withContext:s.withContext,__spread:C};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:u,InstanceHandles:f,Mount:h,Reconciler:g,TextComponent:p});T.version="0.13.3",t.exports=T},{129:129,157:157,20:20,29:29,37:37,38:38,39:39,44:44,45:45,46:46,57:57,60:60,61:61,62:62,70:70,75:75,80:80,84:84,87:87,90:90}],32:[function(e,t,n){"use strict";var r=e(129),o={getDOMNode:function(){return r(this)}};t.exports=o},{129:129}],33:[function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=f++,p[e[m]]={}),p[e[m]]}var o=e(16),i=e(18),a=e(19),s=e(65),u=e(114),l=e(29),c=e(148),p={},d=!1,f=0,h={topBlur:"blur",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topScroll:"scroll",topSelectionChange:"selectionchange",topTextInput:"textInput",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),v=l({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e;
-
-}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,i=r(n),s=a.registrationNameDependencies[e],u=o.topLevelTypes,l=0,p=s.length;p>l;l++){var d=s[l];i.hasOwnProperty(d)&&i[d]||(d===u.topWheel?c("wheel")?v.ReactEventListener.trapBubbledEvent(u.topWheel,"wheel",n):c("mousewheel")?v.ReactEventListener.trapBubbledEvent(u.topWheel,"mousewheel",n):v.ReactEventListener.trapBubbledEvent(u.topWheel,"DOMMouseScroll",n):d===u.topScroll?c("scroll",!0)?v.ReactEventListener.trapCapturedEvent(u.topScroll,"scroll",n):v.ReactEventListener.trapBubbledEvent(u.topScroll,"scroll",v.ReactEventListener.WINDOW_HANDLE):d===u.topFocus||d===u.topBlur?(c("focus",!0)?(v.ReactEventListener.trapCapturedEvent(u.topFocus,"focus",n),v.ReactEventListener.trapCapturedEvent(u.topBlur,"blur",n)):c("focusin")&&(v.ReactEventListener.trapBubbledEvent(u.topFocus,"focusin",n),v.ReactEventListener.trapBubbledEvent(u.topBlur,"focusout",n)),i[u.topBlur]=!0,i[u.topFocus]=!0):h.hasOwnProperty(d)&&v.ReactEventListener.trapBubbledEvent(d,h[d],n),i[d]=!0)}},trapBubbledEvent:function(e,t,n){return v.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return v.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!d){var e=u.refreshScrollValues;v.ReactEventListener.monitorScrollValue(e),d=!0}},eventNameDispatchConfigs:i.eventNameDispatchConfigs,registrationNameModules:i.registrationNameModules,putListener:i.putListener,getListener:i.getListener,deleteListener:i.deleteListener,deleteAllListeners:i.deleteAllListeners});t.exports=v},{114:114,148:148,16:16,18:18,19:19,29:29,65:65}],34:[function(e,t,n){"use strict";var r=e(31),o=e(29),i=r.createFactory(e(95)),a=r.createFactory(e(35)),s=r.createClass({displayName:"ReactCSSTransitionGroup",propTypes:{transitionName:r.PropTypes.string.isRequired,transitionAppear:r.PropTypes.bool,transitionEnter:r.PropTypes.bool,transitionLeave:r.PropTypes.bool},getDefaultProps:function(){return{transitionAppear:!1,transitionEnter:!0,transitionLeave:!0}},_wrapChild:function(e){return a({name:this.props.transitionName,appear:this.props.transitionAppear,enter:this.props.transitionEnter,leave:this.props.transitionLeave},e)},render:function(){return i(o({},this.props,{childFactory:this._wrapChild}))}});t.exports=s},{29:29,31:31,35:35,95:95}],35:[function(e,t,n){"use strict";var r=e(31),o=e(4),i=e(94),a=e(157),s=(e(166),17),u=r.createClass({displayName:"ReactCSSTransitionGroupChild",transition:function(e,t){var n=this.getDOMNode(),r=this.props.name+"-"+e,a=r+"-active",s=function(e){e&&e.target!==n||(o.removeClass(n,r),o.removeClass(n,a),i.removeEndEventListener(n,s),t&&t())};i.addEndEventListener(n,s),o.addClass(n,r),this.queueClass(a)},queueClass:function(e){this.classNameQueue.push(e),this.timeout||(this.timeout=setTimeout(this.flushClassNameQueue,s))},flushClassNameQueue:function(){this.isMounted()&&this.classNameQueue.forEach(o.addClass.bind(o,this.getDOMNode())),this.classNameQueue.length=0,this.timeout=null},componentWillMount:function(){this.classNameQueue=[]},componentWillUnmount:function(){this.timeout&&clearTimeout(this.timeout)},componentWillAppear:function(e){this.props.appear?this.transition("appear",e):e()},componentWillEnter:function(e){this.props.enter?this.transition("enter",e):e()},componentWillLeave:function(e){this.props.leave?this.transition("leave",e):e()},render:function(){return a(this.props.children)}});t.exports=u},{157:157,166:166,31:31,4:4,94:94}],36:[function(e,t,n){"use strict";var r=e(87),o=e(130),i=e(146),a=e(162),s={instantiateChildren:function(e,t,n){var r=o(e);for(var a in r)if(r.hasOwnProperty(a)){var s=r[a],u=i(s,null);r[a]=u}return r},updateChildren:function(e,t,n,s){var u=o(t);if(!u&&!e)return null;var l;for(l in u)if(u.hasOwnProperty(l)){var c=e&&e[l],p=c&&c._currentElement,d=u[l];if(a(p,d))r.receiveComponent(c,d,n,s),u[l]=c;else{c&&r.unmountComponent(c,l);var f=i(d,null);u[l]=f}}for(l in e)!e.hasOwnProperty(l)||u&&u.hasOwnProperty(l)||r.unmountComponent(e[l]);return u},unmountChildren:function(e){for(var t in e){var n=e[t];r.unmountComponent(n)}}};t.exports=s},{130:130,146:146,162:162,87:87}],37:[function(e,t,n){"use strict";function r(e,t){this.forEachFunction=e,this.forEachContext=t}function o(e,t,n,r){var o=e;o.forEachFunction.call(o.forEachContext,t,r)}function i(e,t,n){if(null==e)return e;var i=r.getPooled(t,n);f(e,o,i),r.release(i)}function a(e,t,n){this.mapResult=e,this.mapFunction=t,this.mapContext=n}function s(e,t,n,r){var o=e,i=o.mapResult,a=!i.hasOwnProperty(n);if(a){var s=o.mapFunction.call(o.mapContext,t,r);i[n]=s}}function u(e,t,n){if(null==e)return e;var r={},o=a.getPooled(r,t,n);return f(e,s,o),a.release(o),d.create(r)}function l(e,t,n,r){return null}function c(e,t){return f(e,l,null)}var p=e(30),d=e(67),f=e(164),h=(e(166),p.twoArgumentPooler),m=p.threeArgumentPooler;p.addPoolingTo(r,h),p.addPoolingTo(a,m);var v={forEach:i,map:u,count:c};t.exports=v},{164:164,166:166,30:30,67:67}],38:[function(e,t,n){"use strict";function r(e,t){var n=D.hasOwnProperty(t)?D[t]:null;T.hasOwnProperty(t)&&y(n===_.OVERRIDE_BASE),e.hasOwnProperty(t)&&y(n===_.DEFINE_MANY||n===_.DEFINE_MANY_MERGED)}function o(e,t){if(t){y("function"!=typeof t),y(!d.isValidElement(t));var n=e.prototype;t.hasOwnProperty(b)&&M.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==b){var i=t[o];if(r(n,o),M.hasOwnProperty(o))M[o](e,i);else{var a=D.hasOwnProperty(o),l=n.hasOwnProperty(o),c=i&&i.__reactDontBind,p="function"==typeof i,f=p&&!a&&!l&&!c;if(f)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[o]=i,n[o]=i;else if(l){var h=D[o];y(a&&(h===_.DEFINE_MANY_MERGED||h===_.DEFINE_MANY)),h===_.DEFINE_MANY_MERGED?n[o]=s(n[o],i):h===_.DEFINE_MANY&&(n[o]=u(n[o],i))}else n[o]=i}}}}function i(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in M;y(!o);var i=n in e;y(!i),e[n]=r}}}function a(e,t){y(e&&t&&"object"==typeof e&&"object"==typeof t);for(var n in t)t.hasOwnProperty(n)&&(y(void 0===e[n]),e[n]=t[n]);return e}function s(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return a(o,n),a(o,r),o}}function u(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function c(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=l(e,f.guard(n,e.constructor.displayName+"."+t))}}var p=e(39),d=(e(45),e(61)),f=e(64),h=e(71),m=e(72),v=(e(83),e(82),e(96)),g=e(29),y=e(147),C=e(153),E=e(154),b=(e(166),E({mixins:null})),_=C({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),x=[],D={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},M={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=g({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=g({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=s(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=g({},e.propTypes,t)},statics:function(e,t){i(e,t)}},T={replaceState:function(e,t){v.enqueueReplaceState(this,e),t&&v.enqueueCallback(this,t)},isMounted:function(){var e=h.get(this);return e&&e!==m.currentlyMountingInstance},setProps:function(e,t){v.enqueueSetProps(this,e),t&&v.enqueueCallback(this,t)},replaceProps:function(e,t){v.enqueueReplaceProps(this,e),t&&v.enqueueCallback(this,t)}},N=function(){};g(N.prototype,p.prototype,T);var P={createClass:function(e){var t=function(e,t){this.__reactAutoBindMap&&c(this),this.props=e,this.context=t,this.state=null;var n=this.getInitialState?this.getInitialState():null;y("object"==typeof n&&!Array.isArray(n)),this.state=n};t.prototype=new N,t.prototype.constructor=t,x.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),y(t.prototype.render);for(var n in D)t.prototype[n]||(t.prototype[n]=null);return t.type=t,t},injection:{injectMixin:function(e){x.push(e)}}};t.exports=P},{147:147,153:153,154:154,166:166,29:29,39:39,45:45,61:61,64:64,71:71,72:72,82:82,83:83,96:96}],39:[function(e,t,n){"use strict";function r(e,t){this.props=e,this.context=t}{var o=e(96),i=e(147);e(166)}r.prototype.setState=function(e,t){i("object"==typeof e||"function"==typeof e||null==e),o.enqueueSetState(this,e),t&&o.enqueueCallback(this,t)},r.prototype.forceUpdate=function(e){o.enqueueForceUpdate(this),e&&o.enqueueCallback(this,e)};t.exports=r},{147:147,166:166,96:96}],40:[function(e,t,n){"use strict";var r=e(50),o=e(75),i={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:r.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){o.purgeID(e)}};t.exports=i},{50:50,75:75}],41:[function(e,t,n){"use strict";var r=e(147),o=!1,i={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){r(!o),i.unmountIDFromEnvironment=e.unmountIDFromEnvironment,i.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,i.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};t.exports=i},{147:147}],42:[function(e,t,n){"use strict";var r=e(161),o={shouldComponentUpdate:function(e,t){return!r(this.props,e)||!r(this.state,t)}};t.exports=o},{161:161}],43:[function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}var o=e(41),i=e(44),a=e(45),s=e(61),u=(e(62),e(71)),l=e(72),c=e(78),p=e(80),d=e(83),f=(e(82),e(87)),h=e(97),m=e(29),v=e(127),g=e(147),y=e(162),C=(e(166),1),E={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._isTopLevel=!1,this._pendingCallbacks=null},mountComponent:function(e,t,n){this._context=n,this._mountOrder=C++,this._rootNodeID=e;var r=this._processProps(this._currentElement.props),o=this._processContext(this._currentElement._context),i=c.getComponentClassForElement(this._currentElement),a=new i(r,o);a.props=r,a.context=o,a.refs=v,this._instance=a,u.set(a,this);var s=a.state;void 0===s&&(a.state=s=null),g("object"==typeof s&&!Array.isArray(s)),this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1;var p,d,h=l.currentlyMountingInstance;l.currentlyMountingInstance=this;try{a.componentWillMount&&(a.componentWillMount(),this._pendingStateQueue&&(a.state=this._processPendingState(a.props,a.context))),p=this._getValidatedChildContext(n),d=this._renderValidatedComponent(p)}finally{l.currentlyMountingInstance=h}this._renderedComponent=this._instantiateReactComponent(d,this._currentElement.type);var m=f.mountComponent(this._renderedComponent,e,t,this._mergeChildContext(n,p));return a.componentDidMount&&t.getReactMountReady().enqueue(a.componentDidMount,a),m},unmountComponent:function(){var e=this._instance;if(e.componentWillUnmount){var t=l.currentlyUnmountingInstance;l.currentlyUnmountingInstance=this;try{e.componentWillUnmount()}finally{l.currentlyUnmountingInstance=t}}f.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,u.remove(e)},_setPropsInternal:function(e,t){var n=this._pendingElement||this._currentElement;this._pendingElement=s.cloneAndReplaceProps(n,m({},n.props,e)),h.enqueueUpdate(this,t)},_maskContext:function(e){var t=null;if("string"==typeof this._currentElement.type)return v;var n=this._currentElement.type.contextTypes;if(!n)return v;t={};for(var r in n)t[r]=e[r];return t},_processContext:function(e){var t=this._maskContext(e);return t},_getValidatedChildContext:function(e){var t=this._instance,n=t.getChildContext&&t.getChildContext();if(n){g("object"==typeof t.constructor.childContextTypes);for(var r in n)g(r in t.constructor.childContextTypes);return n}return null},_mergeChildContext:function(e,t){return t?m({},e,t):e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var i in e)if(e.hasOwnProperty(i)){var a;try{g("function"==typeof e[i]),a=e[i](t,i,o,n)}catch(s){a=s}a instanceof Error&&(r(this),n===d.prop)}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&f.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},_warnIfContextsDiffer:function(e,t){e=this._maskContext(e),t=this._maskContext(t);for(var n=Object.keys(t).sort(),r=(this.getName()||"ReactCompositeComponent",0);r<n.length;r++)n[r]},updateComponent:function(e,t,n,r,o){var i=this._instance,a=i.context,s=i.props;t!==n&&(a=this._processContext(n._context),s=this._processProps(n.props),i.componentWillReceiveProps&&i.componentWillReceiveProps(s,a));var u=this._processPendingState(s,a),l=this._pendingForceUpdate||!i.shouldComponentUpdate||i.shouldComponentUpdate(s,u,a);l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,s,u,a,e,o)):(this._currentElement=n,this._context=o,i.props=s,i.state=u,i.context=a)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var i=m({},o?r[0]:n.state),a=o?1:0;a<r.length;a++){var s=r[a];m(i,"function"==typeof s?s.call(n,i,e,t):s)}return i},_performComponentUpdate:function(e,t,n,r,o,i){var a=this._instance,s=a.props,u=a.state,l=a.context;a.componentWillUpdate&&a.componentWillUpdate(t,n,r),this._currentElement=e,this._context=i,a.props=t,a.state=n,a.context=r,this._updateRenderedComponent(o,i),a.componentDidUpdate&&o.getReactMountReady().enqueue(a.componentDidUpdate.bind(a,s,u,l),a)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._getValidatedChildContext(),i=this._renderValidatedComponent(o);if(y(r,i))f.receiveComponent(n,i,e,this._mergeChildContext(t,o));else{var a=this._rootNodeID,s=n._rootNodeID;f.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(i,this._currentElement.type);var u=f.mountComponent(this._renderedComponent,a,e,this._mergeChildContext(t,o));this._replaceNodeWithMarkupByID(s,u)}},_replaceNodeWithMarkupByID:function(e,t){o.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(e){var t,n=i.current;i.current=this._mergeChildContext(this._currentElement._context,e),a.current=this;try{t=this._renderValidatedComponentWithoutOwnerOrContext()}finally{i.current=n,a.current=null}return g(null===t||t===!1||s.isValidElement(t)),t},attachRef:function(e,t){var n=this.getPublicInstance(),r=n.refs===v?n.refs={}:n.refs;r[e]=t.getPublicInstance()},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){return this._instance},_instantiateReactComponent:null};p.measureMethods(E,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var b={Mixin:E};t.exports=b},{127:127,147:147,162:162,166:166,29:29,41:41,44:44,45:45,61:61,62:62,71:71,72:72,78:78,80:80,82:82,83:83,87:87,97:97}],44:[function(e,t,n){"use strict";var r=e(29),o=e(127),i=(e(166),{current:o,withContext:function(e,t){var n,o=i.current;i.current=r({},o,e);try{n=t()}finally{i.current=o}return n}});t.exports=i},{127:127,166:166,29:29}],45:[function(e,t,n){"use strict";var r={current:null};t.exports=r},{}],46:[function(e,t,n){"use strict";function r(e){return o.createFactory(e)}var o=e(61),i=(e(62),e(155)),a=i({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);t.exports=a},{155:155,61:61,62:62}],47:[function(e,t,n){"use strict";var r=e(2),o=e(32),i=e(38),a=e(61),s=e(153),u=a.createFactory("button"),l=s({onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0}),c=i.createClass({displayName:"ReactDOMButton",tagName:"BUTTON",mixins:[r,o],render:function(){var e={};for(var t in this.props)!this.props.hasOwnProperty(t)||this.props.disabled&&l[t]||(e[t]=this.props[t]);return u(e,this.props.children)}});t.exports=c},{153:153,2:2,32:32,38:38,61:61}],48:[function(e,t,n){"use strict";function r(e){e&&(null!=e.dangerouslySetInnerHTML&&(g(null==e.children),g("object"==typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML)),g(null==e.style||"object"==typeof e.style))}function o(e,t,n,r){var o=d.findReactContainerForID(e);if(o){var i=o.nodeType===D?o.ownerDocument:o;E(t,i)}r.getPutListenerQueue().enqueuePutListener(e,t,n)}function i(e){I.call(P,e)||(g(N.test(e)),P[e]=!0)}function a(e){i(e),this._tag=e,this._renderedChildren=null,this._previousStyleCopy=null,this._rootNodeID=null}var s=e(6),u=e(11),l=e(12),c=e(33),p=e(40),d=e(75),f=e(76),h=e(80),m=e(29),v=e(128),g=e(147),y=(e(148),e(154)),C=(e(166),c.deleteListener),E=c.listenTo,b=c.registrationNameModules,_={string:!0,number:!0},x=y({style:null}),D=1,M=null,T={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},N=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,P={},I={}.hasOwnProperty;a.displayName="ReactDOMComponent",a.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e,r(this._currentElement.props);var o=T[this._tag]?"":"</"+this._tag+">";return this._createOpenTagMarkupAndPutListeners(t)+this._createContentMarkup(t,n)+o},_createOpenTagMarkupAndPutListeners:function(e){var t=this._currentElement.props,n="<"+this._tag;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(b.hasOwnProperty(r))o(this._rootNodeID,r,i,e);else{r===x&&(i&&(i=this._previousStyleCopy=m({},t.style)),i=s.createMarkupForStyles(i));var a=l.createMarkupForProperty(r,i);a&&(n+=" "+a)}}if(e.renderToStaticMarkup)return n+">";var u=l.createMarkupForID(this._rootNodeID);return n+" "+u+">"},_createContentMarkup:function(e,t){var n="";("listing"===this._tag||"pre"===this._tag||"textarea"===this._tag)&&(n="\n");var r=this._currentElement.props,o=r.dangerouslySetInnerHTML;if(null!=o){if(null!=o.__html)return n+o.__html}else{var i=_[typeof r.children]?r.children:null,a=null!=i?null:r.children;if(null!=i)return n+v(i);if(null!=a){var s=this.mountChildren(a,e,t);return n+s.join("")}}return n},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,o){r(this._currentElement.props),this._updateDOMProperties(t.props,e),this._updateDOMChildren(t.props,e,o)},_updateDOMProperties:function(e,t){var n,r,i,a=this._currentElement.props;for(n in e)if(!a.hasOwnProperty(n)&&e.hasOwnProperty(n))if(n===x){var s=this._previousStyleCopy;for(r in s)s.hasOwnProperty(r)&&(i=i||{},i[r]="");this._previousStyleCopy=null}else b.hasOwnProperty(n)?C(this._rootNodeID,n):(u.isStandardName[n]||u.isCustomAttribute(n))&&M.deletePropertyByID(this._rootNodeID,n);for(n in a){var l=a[n],c=n===x?this._previousStyleCopy:e[n];if(a.hasOwnProperty(n)&&l!==c)if(n===x)if(l?l=this._previousStyleCopy=m({},l):this._previousStyleCopy=null,c){for(r in c)!c.hasOwnProperty(r)||l&&l.hasOwnProperty(r)||(i=i||{},i[r]="");for(r in l)l.hasOwnProperty(r)&&c[r]!==l[r]&&(i=i||{},i[r]=l[r])}else i=l;else b.hasOwnProperty(n)?o(this._rootNodeID,n,l,t):(u.isStandardName[n]||u.isCustomAttribute(n))&&M.updatePropertyByID(this._rootNodeID,n,l)}i&&M.updateStylesByID(this._rootNodeID,i)},_updateDOMChildren:function(e,t,n){var r=this._currentElement.props,o=_[typeof e.children]?e.children:null,i=_[typeof r.children]?r.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,s=r.dangerouslySetInnerHTML&&r.dangerouslySetInnerHTML.__html,u=null!=o?null:e.children,l=null!=i?null:r.children,c=null!=o||null!=a,p=null!=i||null!=s;null!=u&&null==l?this.updateChildren(null,t,n):c&&!p&&this.updateTextContent(""),null!=i?o!==i&&this.updateTextContent(""+i):null!=s?a!==s&&M.updateInnerHTMLByID(this._rootNodeID,s):null!=l&&this.updateChildren(l,t,n)},unmountComponent:function(){this.unmountChildren(),c.deleteAllListeners(this._rootNodeID),p.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null}},h.measureMethods(a,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),m(a.prototype,a.Mixin,f.Mixin),a.injection={injectIDOperations:function(e){a.BackendIDOperations=M=e}},t.exports=a},{11:11,12:12,128:128,147:147,148:148,154:154,166:166,29:29,33:33,40:40,6:6,75:75,76:76,80:80}],49:[function(e,t,n){"use strict";var r=e(16),o=e(27),i=e(32),a=e(38),s=e(61),u=s.createFactory("form"),l=a.createClass({displayName:"ReactDOMForm",tagName:"FORM",mixins:[i,o],render:function(){return u(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topReset,"reset"),this.trapBubbledEvent(r.topLevelTypes.topSubmit,"submit")}});t.exports=l},{16:16,27:27,32:32,38:38,61:61}],50:[function(e,t,n){"use strict";var r=e(6),o=e(10),i=e(12),a=e(75),s=e(80),u=e(147),l=e(159),c={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},p={updatePropertyByID:function(e,t,n){var r=a.getNode(e);u(!c.hasOwnProperty(t)),null!=n?i.setValueForProperty(r,t,n):i.deleteValueForProperty(r,t)},deletePropertyByID:function(e,t,n){var r=a.getNode(e);u(!c.hasOwnProperty(t)),i.deleteValueForProperty(r,t,n)},updateStylesByID:function(e,t){var n=a.getNode(e);r.setValueForStyles(n,t)},updateInnerHTMLByID:function(e,t){var n=a.getNode(e);l(n,t)},updateTextContentByID:function(e,t){var n=a.getNode(e);o.updateTextContent(n,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=a.getNode(e);o.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=a.getNode(e[n].parentID);o.processUpdates(e,t)}};s.measureMethods(p,"ReactDOMIDOperations",{updatePropertyByID:"updatePropertyByID",deletePropertyByID:"deletePropertyByID",updateStylesByID:"updateStylesByID",updateInnerHTMLByID:"updateInnerHTMLByID",updateTextContentByID:"updateTextContentByID",dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=p},{10:10,12:12,147:147,159:159,6:6,75:75,80:80}],51:[function(e,t,n){"use strict";var r=e(16),o=e(27),i=e(32),a=e(38),s=e(61),u=s.createFactory("iframe"),l=a.createClass({displayName:"ReactDOMIframe",tagName:"IFRAME",mixins:[i,o],render:function(){return u(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topLoad,"load")}});t.exports=l},{16:16,27:27,32:32,38:38,61:61}],52:[function(e,t,n){"use strict";var r=e(16),o=e(27),i=e(32),a=e(38),s=e(61),u=s.createFactory("img"),l=a.createClass({displayName:"ReactDOMImg",tagName:"IMG",mixins:[i,o],render:function(){return u(this.props)},componentDidMount:function(){this.trapBubbledEvent(r.topLevelTypes.topLoad,"load"),this.trapBubbledEvent(r.topLevelTypes.topError,"error")}});t.exports=l},{16:16,27:27,32:32,38:38,61:61}],53:[function(e,t,n){"use strict";function r(){this.isMounted()&&this.forceUpdate()}var o=e(2),i=e(12),a=e(26),s=e(32),u=e(38),l=e(61),c=e(75),p=e(97),d=e(29),f=e(147),h=l.createFactory("input"),m={},v=u.createClass({displayName:"ReactDOMInput",tagName:"INPUT",mixins:[o,a.Mixin,s],getInitialState:function(){var e=this.props.defaultValue;return{initialChecked:this.props.defaultChecked||!1,initialValue:null!=e?e:null}},render:function(){var e=d({},this.props);e.defaultChecked=null,e.defaultValue=null;var t=a.getValue(this);e.value=null!=t?t:this.state.initialValue;var n=a.getChecked(this);return e.checked=null!=n?n:this.state.initialChecked,e.onChange=this._handleChange,h(e,this.props.children)},componentDidMount:function(){var e=c.getID(this.getDOMNode());m[e]=this},componentWillUnmount:function(){var e=this.getDOMNode(),t=c.getID(e);delete m[t]},componentDidUpdate:function(e,t,n){var r=this.getDOMNode();null!=this.props.checked&&i.setValueForProperty(r,"checked",this.props.checked||!1);var o=a.getValue(this);null!=o&&i.setValueForProperty(r,"value",""+o)},_handleChange:function(e){var t,n=a.getOnChange(this);n&&(t=n.call(this,e)),p.asap(r,this);var o=this.props.name;if("radio"===this.props.type&&null!=o){for(var i=this.getDOMNode(),s=i;s.parentNode;)s=s.parentNode;for(var u=s.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),l=0,d=u.length;d>l;l++){var h=u[l];if(h!==i&&h.form===i.form){var v=c.getID(h);f(v);var g=m[v];f(g),p.asap(r,g)}}}return t}});t.exports=v},{12:12,147:147,2:2,26:26,29:29,32:32,38:38,61:61,75:75,97:97}],54:[function(e,t,n){"use strict";var r=e(32),o=e(38),i=e(61),a=(e(166),i.createFactory("option")),s=o.createClass({displayName:"ReactDOMOption",tagName:"OPTION",mixins:[r],componentWillMount:function(){},render:function(){return a(this.props,this.props.children)}});t.exports=s},{166:166,32:32,38:38,61:61}],55:[function(e,t,n){"use strict";function r(){if(this._pendingUpdate){this._pendingUpdate=!1;var e=s.getValue(this);null!=e&&this.isMounted()&&i(this,e)}}function o(e,t,n){if(null==e[t])return null;if(e.multiple){if(!Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be an array if `multiple` is true.")}else if(Array.isArray(e[t]))return new Error("The `"+t+"` prop supplied to <select> must be a scalar value if `multiple` is false.")}function i(e,t){var n,r,o,i=e.getDOMNode().options;if(e.props.multiple){for(n={},r=0,o=t.length;o>r;r++)n[""+t[r]]=!0;for(r=0,o=i.length;o>r;r++){var a=n.hasOwnProperty(i[r].value);i[r].selected!==a&&(i[r].selected=a)}}else{for(n=""+t,r=0,o=i.length;o>r;r++)if(i[r].value===n)return void(i[r].selected=!0);i.length&&(i[0].selected=!0)}}var a=e(2),s=e(26),u=e(32),l=e(38),c=e(61),p=e(97),d=e(29),f=c.createFactory("select"),h=l.createClass({displayName:"ReactDOMSelect",tagName:"SELECT",mixins:[a,s.Mixin,u],propTypes:{defaultValue:o,value:o},render:function(){var e=d({},this.props);return e.onChange=this._handleChange,e.value=null,f(e,this.props.children)},componentWillMount:function(){this._pendingUpdate=!1},componentDidMount:function(){var e=s.getValue(this);null!=e?i(this,e):null!=this.props.defaultValue&&i(this,this.props.defaultValue)},componentDidUpdate:function(e){var t=s.getValue(this);null!=t?(this._pendingUpdate=!1,i(this,t)):!e.multiple!=!this.props.multiple&&(null!=this.props.defaultValue?i(this,this.props.defaultValue):i(this,this.props.multiple?[]:""))},_handleChange:function(e){var t,n=s.getOnChange(this);return n&&(t=n.call(this,e)),this._pendingUpdate=!0,p.asap(r,this),t}});t.exports=h},{2:2,26:26,29:29,32:32,38:38,61:61,97:97}],56:[function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var i=o.text.length,a=i+r;return{start:i,end:a}}function i(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,i=t.focusNode,a=t.focusOffset,s=t.getRangeAt(0),u=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=u?0:s.toString().length,c=s.cloneRange();c.selectNodeContents(e),c.setEnd(s.startContainer,s.startOffset);var p=r(c.startContainer,c.startOffset,c.endContainer,c.endOffset),d=p?0:c.toString().length,f=d+l,h=document.createRange();h.setStart(n,o),h.setEnd(i,a);var m=h.collapsed;return{start:m?f:d,end:m?d:f}}function a(e,t){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function s(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,o=Math.min(t.start,r),i="undefined"==typeof t.end?o:Math.min(t.end,r);if(!n.extend&&o>i){var a=i;i=o,o=a}var s=l(e,o),u=l(e,i);if(s&&u){var p=document.createRange();p.setStart(s.node,s.offset),n.removeAllRanges(),o>i?(n.addRange(p),n.extend(u.node,u.offset)):(p.setEnd(u.node,u.offset),n.addRange(p))}}}var u=e(22),l=e(140),c=e(142),p=u.canUseDOM&&"selection"in document&&!("getSelection"in window),d={getOffsets:p?o:i,setOffsets:p?a:s};t.exports=d},{140:140,142:142,22:22}],57:[function(e,t,n){"use strict";var r=e(12),o=e(40),i=e(48),a=e(29),s=e(128),u=function(e){};a(u.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){this._rootNodeID=e;var o=s(this._stringText);return t.renderToStaticMarkup?o:"<span "+r.createMarkupForID(e)+">"+o+"</span>"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;
-
-n!==this._stringText&&(this._stringText=n,i.BackendIDOperations.updateTextContentByID(this._rootNodeID,n))}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=u},{12:12,128:128,29:29,40:40,48:48}],58:[function(e,t,n){"use strict";function r(){this.isMounted()&&this.forceUpdate()}var o=e(2),i=e(12),a=e(26),s=e(32),u=e(38),l=e(61),c=e(97),p=e(29),d=e(147),f=(e(166),l.createFactory("textarea")),h=u.createClass({displayName:"ReactDOMTextarea",tagName:"TEXTAREA",mixins:[o,a.Mixin,s],getInitialState:function(){var e=this.props.defaultValue,t=this.props.children;null!=t&&(d(null==e),Array.isArray(t)&&(d(t.length<=1),t=t[0]),e=""+t),null==e&&(e="");var n=a.getValue(this);return{initialValue:""+(null!=n?n:e)}},render:function(){var e=p({},this.props);return d(null==e.dangerouslySetInnerHTML),e.defaultValue=null,e.value=null,e.onChange=this._handleChange,f(e,this.state.initialValue)},componentDidUpdate:function(e,t,n){var r=a.getValue(this);if(null!=r){var o=this.getDOMNode();i.setValueForProperty(o,"value",""+r)}},_handleChange:function(e){var t,n=a.getOnChange(this);return n&&(t=n.call(this,e)),c.asap(r,this),t}});t.exports=h},{12:12,147:147,166:166,2:2,26:26,29:29,32:32,38:38,61:61,97:97}],59:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=e(97),i=e(113),a=e(29),s=e(126),u={initialize:s,close:function(){d.isBatchingUpdates=!1}},l={initialize:s,close:o.flushBatchedUpdates.bind(o)},c=[l,u];a(r.prototype,i.Mixin,{getTransactionWrappers:function(){return c}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o){var i=d.isBatchingUpdates;d.isBatchingUpdates=!0,i?e(t,n,r,o):p.perform(e,null,t,n,r,o)}};t.exports=d},{113:113,126:126,29:29,97:97}],60:[function(e,t,n){"use strict";function r(e){return h.createClass({tagName:e.toUpperCase(),render:function(){return new P(e,null,null,null,null,this.props)}})}function o(){R.EventEmitter.injectReactEventListener(I),R.EventPluginHub.injectEventPluginOrder(u),R.EventPluginHub.injectInstanceHandle(w),R.EventPluginHub.injectMount(O),R.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:L,EnterLeaveEventPlugin:l,ChangeEventPlugin:a,MobileSafariClickEventPlugin:d,SelectEventPlugin:A,BeforeInputEventPlugin:i}),R.NativeComponent.injectGenericComponentClass(g),R.NativeComponent.injectTextComponentClass(N),R.NativeComponent.injectAutoWrapper(r),R.Class.injectMixin(f),R.NativeComponent.injectComponentClasses({button:y,form:C,iframe:_,img:E,input:x,option:D,select:M,textarea:T,html:F("html"),head:F("head"),body:F("body")}),R.DOMProperty.injectDOMPropertyConfig(p),R.DOMProperty.injectDOMPropertyConfig(U),R.EmptyComponent.injectEmptyComponent("noscript"),R.Updates.injectReconcileTransaction(S),R.Updates.injectBatchingStrategy(v),R.RootIndex.injectCreateReactRootIndex(c.canUseDOM?s.createReactRootIndex:k.createReactRootIndex),R.Component.injectEnvironment(m),R.DOMComponent.injectIDOperations(b)}var i=e(3),a=e(8),s=e(9),u=e(14),l=e(15),c=e(22),p=e(24),d=e(28),f=e(32),h=e(38),m=e(40),v=e(59),g=e(48),y=e(47),C=e(49),E=e(52),b=e(50),_=e(51),x=e(53),D=e(54),M=e(55),T=e(58),N=e(57),P=e(61),I=e(66),R=e(68),w=e(70),O=e(75),S=e(86),A=e(99),k=e(100),L=e(101),U=e(98),F=e(122);t.exports={inject:o}},{100:100,101:101,122:122,14:14,15:15,22:22,24:24,28:28,3:3,32:32,38:38,40:40,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,57:57,58:58,59:59,61:61,66:66,68:68,70:70,75:75,8:8,86:86,9:9,98:98,99:99}],61:[function(e,t,n){"use strict";var r=e(44),o=e(45),i=e(29),a=(e(166),{key:!0,ref:!0}),s=function(e,t,n,r,o,i){this.type=e,this.key=t,this.ref=n,this._owner=r,this._context=o,this.props=i};s.prototype={_isReactElement:!0},s.createElement=function(e,t,n){var i,u={},l=null,c=null;if(null!=t){c=void 0===t.ref?null:t.ref,l=void 0===t.key?null:""+t.key;for(i in t)t.hasOwnProperty(i)&&!a.hasOwnProperty(i)&&(u[i]=t[i])}var p=arguments.length-2;if(1===p)u.children=n;else if(p>1){for(var d=Array(p),f=0;p>f;f++)d[f]=arguments[f+2];u.children=d}if(e&&e.defaultProps){var h=e.defaultProps;for(i in h)"undefined"==typeof u[i]&&(u[i]=h[i])}return new s(e,l,c,o.current,r.current,u)},s.createFactory=function(e){var t=s.createElement.bind(null,e);return t.type=e,t},s.cloneAndReplaceProps=function(e,t){var n=new s(e.type,e.key,e.ref,e._owner,e._context,t);return n},s.cloneElement=function(e,t,n){var r,u=i({},e.props),l=e.key,c=e.ref,p=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,p=o.current),void 0!==t.key&&(l=""+t.key);for(r in t)t.hasOwnProperty(r)&&!a.hasOwnProperty(r)&&(u[r]=t[r])}var d=arguments.length-2;if(1===d)u.children=n;else if(d>1){for(var f=Array(d),h=0;d>h;h++)f[h]=arguments[h+2];u.children=f}return new s(e.type,l,c,p,e._context,u)},s.isValidElement=function(e){var t=!(!e||!e._isReactElement);return t},t.exports=s},{166:166,29:29,44:44,45:45}],62:[function(e,t,n){"use strict";function r(){if(y.current){var e=y.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e){var t=e&&e.getPublicInstance();if(!t)return void 0;var n=t.constructor;return n?n.displayName||n.name||void 0:void 0}function i(){var e=y.current;return e&&o(e)||void 0}function a(e,t){e._store.validated||null!=e.key||(e._store.validated=!0,u('Each child in an array or iterator should have a unique "key" prop.',e,t))}function s(e,t,n){D.test(e)&&u("Child objects should have non-numeric keys so ordering is preserved.",t,n)}function u(e,t,n){var r=i(),a="string"==typeof n?n:n.displayName||n.name,s=r||a,u=_[e]||(_[e]={});if(!u.hasOwnProperty(s)){u[s]=!0;var l="";if(t&&t._owner&&t._owner!==y.current){var c=o(t._owner);l=" It was passed a child from "+c+"."}}}function l(e,t){if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];m.isValidElement(r)&&a(r,t)}else if(m.isValidElement(e))e._store.validated=!0;else if(e){var o=E(e);if(o){if(o!==e.entries)for(var i,u=o.call(e);!(i=u.next()).done;)m.isValidElement(i.value)&&a(i.value,t)}else if("object"==typeof e){var l=v.extractIfFragment(e);for(var c in l)l.hasOwnProperty(c)&&s(c,l[c],t)}}}function c(e,t,n,o){for(var i in t)if(t.hasOwnProperty(i)){var a;try{b("function"==typeof t[i]),a=t[i](n,i,e,o)}catch(s){a=s}a instanceof Error&&!(a.message in x)&&(x[a.message]=!0,r(this))}}function p(e,t){var n=t.type,r="string"==typeof n?n:n.displayName,o=t._owner?t._owner.getPublicInstance().constructor.displayName:null,i=e+"|"+r+"|"+o;if(!M.hasOwnProperty(i)){M[i]=!0;var a="";r&&(a=" <"+r+" />");var s="";o&&(s=" The element was created by "+o+".")}}function d(e,t){return e!==e?t!==t:0===e&&0===t?1/e===1/t:e===t}function f(e){if(e._store){var t=e._store.originalProps,n=e.props;for(var r in n)n.hasOwnProperty(r)&&(t.hasOwnProperty(r)&&d(t[r],n[r])||(p(r,e),t[r]=n[r]))}}function h(e){if(null!=e.type){var t=C.getComponentClassForElement(e),n=t.displayName||t.name;t.propTypes&&c(n,t.propTypes,e.props,g.prop),"function"==typeof t.getDefaultProps}}var m=e(61),v=e(67),g=e(83),y=(e(82),e(45)),C=e(78),E=e(138),b=e(147),_=(e(166),{}),x={},D=/^\d+$/,M={},T={checkAndWarnForMutatedProps:f,createElement:function(e,t,n){var r=m.createElement.apply(this,arguments);if(null==r)return r;for(var o=2;o<arguments.length;o++)l(arguments[o],e);return h(r),r},createFactory:function(e){var t=T.createElement.bind(null,e);return t.type=e,t},cloneElement:function(e,t,n){for(var r=m.cloneElement.apply(this,arguments),o=2;o<arguments.length;o++)l(arguments[o],r.type);return h(r),r}};t.exports=T},{138:138,147:147,166:166,45:45,61:61,67:67,78:78,82:82,83:83}],63:[function(e,t,n){"use strict";function r(e){c[e]=!0}function o(e){delete c[e]}function i(e){return!!c[e]}var a,s=e(61),u=e(71),l=e(147),c={},p={injectEmptyComponent:function(e){a=s.createFactory(e)}},d=function(){};d.prototype.componentDidMount=function(){var e=u.get(this);e&&r(e._rootNodeID)},d.prototype.componentWillUnmount=function(){var e=u.get(this);e&&o(e._rootNodeID)},d.prototype.render=function(){return l(a),a()};var f=s.createElement(d),h={emptyElement:f,injection:p,isNullComponentID:i};t.exports=h},{147:147,61:61,71:71}],64:[function(e,t,n){"use strict";var r={guard:function(e,t){return e}};t.exports=r},{}],65:[function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue()}var o=e(18),i={handleTopLevel:function(e,t,n,i){var a=o.extractEvents(e,t,n,i);r(a)}};t.exports=i},{18:18}],66:[function(e,t,n){"use strict";function r(e){var t=p.getID(e),n=c.getReactRootIDFromNodeID(t),r=p.findReactContainerForID(n),o=p.getFirstReactDOM(r);return o}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function i(e){for(var t=p.getFirstReactDOM(h(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=r(n);for(var o=0,i=e.ancestors.length;i>o;o++){t=e.ancestors[o];var a=p.getID(t)||"";v._handleTopLevel(e.topLevelType,t,a,e.nativeEvent)}}function a(e){var t=m(window);e(t)}var s=e(17),u=e(22),l=e(30),c=e(70),p=e(75),d=e(97),f=e(29),h=e(137),m=e(143);f(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(o,l.twoArgumentPooler);var v={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:u.canUseDOM?window:null,setHandleTopLevel:function(e){v._handleTopLevel=e},setEnabled:function(e){v._enabled=!!e},isEnabled:function(){return v._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?s.listen(r,t,v.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?s.capture(r,t,v.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=a.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(v._enabled){var n=o.getPooled(e,t);try{d.batchedUpdates(i,n)}finally{o.release(n)}}}};t.exports=v},{137:137,143:143,17:17,22:22,29:29,30:30,70:70,75:75,97:97}],67:[function(e,t,n){"use strict";var r=(e(61),e(166),{create:function(e){return e},extract:function(e){return e},extractIfFragment:function(e){return e}});t.exports=r},{166:166,61:61}],68:[function(e,t,n){"use strict";var r=e(11),o=e(18),i=e(41),a=e(38),s=e(63),u=e(33),l=e(78),c=e(48),p=e(80),d=e(89),f=e(97),h={Component:i.injection,Class:a.injection,DOMComponent:c.injection,DOMProperty:r.injection,EmptyComponent:s.injection,EventPluginHub:o.injection,EventEmitter:u.injection,NativeComponent:l.injection,Perf:p.injection,RootIndex:d.injection,Updates:f.injection};t.exports=h},{11:11,18:18,33:33,38:38,41:41,48:48,63:63,78:78,80:80,89:89,97:97}],69:[function(e,t,n){"use strict";function r(e){return i(document.documentElement,e)}var o=e(56),i=e(120),a=e(131),s=e(133),u={hasSelectionCapabilities:function(e){return e&&("INPUT"===e.nodeName&&"text"===e.type||"TEXTAREA"===e.nodeName||"true"===e.contentEditable)},getSelectionInformation:function(){var e=s();return{focusedElem:e,selectionRange:u.hasSelectionCapabilities(e)?u.getSelection(e):null}},restoreSelection:function(e){var t=s(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(u.hasSelectionCapabilities(n)&&u.setSelection(n,o),a(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&"INPUT"===e.nodeName){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if("undefined"==typeof r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&"INPUT"===e.nodeName){var i=e.createTextRange();i.collapse(!0),i.moveStart("character",n),i.moveEnd("character",r-n),i.select()}else o.setOffsets(e,t)}};t.exports=u},{120:120,131:131,133:133,56:56}],70:[function(e,t,n){"use strict";function r(e){return f+e.toString(36)}function o(e,t){return e.charAt(t)===f||t===e.length}function i(e){return""===e||e.charAt(0)===f&&e.charAt(e.length-1)!==f}function a(e,t){return 0===t.indexOf(e)&&o(t,e.length)}function s(e){return e?e.substr(0,e.lastIndexOf(f)):""}function u(e,t){if(d(i(e)&&i(t)),d(a(e,t)),e===t)return e;var n,r=e.length+h;for(n=r;n<t.length&&!o(t,n);n++);return t.substr(0,n)}function l(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var r=0,a=0;n>=a;a++)if(o(e,a)&&o(t,a))r=a;else if(e.charAt(a)!==t.charAt(a))break;var s=e.substr(0,r);return d(i(s)),s}function c(e,t,n,r,o,i){e=e||"",t=t||"",d(e!==t);var l=a(t,e);d(l||a(e,t));for(var c=0,p=l?s:u,f=e;;f=p(f,t)){var h;if(o&&f===e||i&&f===t||(h=n(f,l,r)),h===!1||f===t)break;d(c++<m)}}var p=e(89),d=e(147),f=".",h=f.length,m=100,v={createReactRootID:function(){return r(p.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===f&&e.length>1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var i=l(e,t);i!==e&&c(e,i,n,r,!1,!0),i!==t&&c(i,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},_getFirstCommonAncestorID:l,_getNextDescendantID:u,isAncestorIDOf:a,SEPARATOR:f};t.exports=v},{147:147,89:89}],71:[function(e,t,n){"use strict";var r={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=r},{}],72:[function(e,t,n){"use strict";var r={currentlyMountingInstance:null,currentlyUnmountingInstance:null};t.exports=r},{}],73:[function(e,t,n){"use strict";function r(e,t){this.value=e,this.requestChange=t}function o(e){var t={value:"undefined"==typeof e?i.PropTypes.any.isRequired:e.isRequired,requestChange:i.PropTypes.func.isRequired};return i.PropTypes.shape(t)}var i=e(31);r.PropTypes={link:o},t.exports=r},{31:31}],74:[function(e,t,n){"use strict";var r=e(116),o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(">"," "+o.CHECKSUM_ATTR_NAME+'="'+t+'">')},canReuseMarkup:function(e,t){var n=t.getAttribute(o.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var i=r(e);return i===n}};t.exports=o},{116:116}],75:[function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){var t=I(e);return t&&K.getID(t)}function i(e){var t=a(e);if(t)if(L.hasOwnProperty(t)){var n=L[t];n!==e&&(w(!c(n,t)),L[t]=e)}else L[t]=e;return t}function a(e){return e&&e.getAttribute&&e.getAttribute(k)||""}function s(e,t){var n=a(e);n!==t&&delete L[n],e.setAttribute(k,t),L[t]=e}function u(e){return L.hasOwnProperty(e)&&c(L[e],e)||(L[e]=K.findReactNodeByID(e)),L[e]}function l(e){var t=b.get(e)._rootNodeID;return C.isNullComponentID(t)?null:(L.hasOwnProperty(t)&&c(L[t],t)||(L[t]=K.findReactNodeByID(t)),L[t])}function c(e,t){if(e){w(a(e)===t);var n=K.findReactContainerForID(t);if(n&&P(n,e))return!0}return!1}function p(e){delete L[e]}function d(e){var t=L[e];return t&&c(t,e)?void(W=t):!1}function f(e){W=null,E.traverseAncestors(e,d);var t=W;return W=null,t}function h(e,t,n,r,o){var i=D.mountComponent(e,t,r,N);e._isTopLevel=!0,K._mountImageIntoNode(i,n,o)}function m(e,t,n,r){var o=T.ReactReconcileTransaction.getPooled();o.perform(h,null,e,t,n,o,r),T.ReactReconcileTransaction.release(o)}var v=e(11),g=e(33),y=(e(45),e(61)),C=(e(62),e(63)),E=e(70),b=e(71),_=e(74),x=e(80),D=e(87),M=e(96),T=e(97),N=e(127),P=e(120),I=e(141),R=e(146),w=e(147),O=e(159),S=e(162),A=(e(166),E.SEPARATOR),k=v.ID_ATTRIBUTE_NAME,L={},U=1,F=9,B={},j={},V=[],W=null,K={_instancesByReactRootID:B,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return K.scrollMonitor(n,function(){M.enqueueElementInternal(e,t),r&&M.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){w(t&&(t.nodeType===U||t.nodeType===F)),g.ensureScrollValueMonitoring();var n=K.registerContainer(t);return B[n]=e,n},_renderNewRootComponent:function(e,t,n){var r=R(e,null),o=K._registerComponent(r,t);return T.batchedUpdates(m,r,o,t,n),r},render:function(e,t,n){w(y.isValidElement(e));var r=B[o(t)];if(r){var i=r._currentElement;if(S(i,e))return K._updateRootComponent(r,e,t,n).getPublicInstance();K.unmountComponentAtNode(t)}var a=I(t),s=a&&K.isRenderedByReact(a),u=s&&!r,l=K._renderNewRootComponent(e,t,u).getPublicInstance();return n&&n.call(l),l},constructAndRenderComponent:function(e,t,n){var r=y.createElement(e,t);return K.render(r,n)},constructAndRenderComponentByID:function(e,t,n){var r=document.getElementById(n);return w(r),K.constructAndRenderComponent(e,t,r)},registerContainer:function(e){var t=o(e);return t&&(t=E.getReactRootIDFromNodeID(t)),t||(t=E.createReactRootID()),j[t]=e,t},unmountComponentAtNode:function(e){w(e&&(e.nodeType===U||e.nodeType===F));var t=o(e),n=B[t];return n?(K.unmountComponentFromNode(n,e),delete B[t],delete j[t],!0):!1},unmountComponentFromNode:function(e,t){for(D.unmountComponent(e),t.nodeType===F&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)},findReactContainerForID:function(e){var t=E.getReactRootIDFromNodeID(e),n=j[t];return n},findReactNodeByID:function(e){var t=K.findReactContainerForID(e);return K.findComponentRoot(t,e)},isRenderedByReact:function(e){if(1!==e.nodeType)return!1;var t=K.getID(e);return t?t.charAt(0)===A:!1},getFirstReactDOM:function(e){for(var t=e;t&&t.parentNode!==t;){if(K.isRenderedByReact(t))return t;t=t.parentNode}return null},findComponentRoot:function(e,t){var n=V,r=0,o=f(t)||e;for(n[0]=o.firstChild,n.length=1;r<n.length;){for(var i,a=n[r++];a;){var s=K.getID(a);s?t===s?i=a:E.isAncestorIDOf(s,t)&&(n.length=r=0,n.push(a.firstChild)):n.push(a.firstChild),a=a.nextSibling}if(i)return n.length=0,i}n.length=0,w(!1)},_mountImageIntoNode:function(e,t,n){if(w(t&&(t.nodeType===U||t.nodeType===F)),n){var o=I(t);if(_.canReuseMarkup(e,o))return;var i=o.getAttribute(_.CHECKSUM_ATTR_NAME);o.removeAttribute(_.CHECKSUM_ATTR_NAME);var a=o.outerHTML;o.setAttribute(_.CHECKSUM_ATTR_NAME,i);var s=r(e,a);" (client) "+e.substring(s-20,s+20)+"\n (server) "+a.substring(s-20,s+20),w(t.nodeType!==F)}w(t.nodeType!==F),O(t,e)},getReactRootID:o,getID:i,setID:s,getNode:u,getNodeFromInstance:l,purgeID:p};x.measureMethods(K,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=K},{11:11,120:120,127:127,141:141,146:146,147:147,159:159,162:162,166:166,33:33,45:45,61:61,62:62,63:63,70:70,71:71,74:74,80:80,87:87,96:96,97:97}],76:[function(e,t,n){"use strict";function r(e,t,n){h.push({parentID:e,parentNode:null,type:c.INSERT_MARKUP,markupIndex:m.push(t)-1,textContent:null,fromIndex:null,toIndex:n})}function o(e,t,n){h.push({parentID:e,parentNode:null,type:c.MOVE_EXISTING,markupIndex:null,textContent:null,fromIndex:t,toIndex:n})}function i(e,t){h.push({parentID:e,parentNode:null,type:c.REMOVE_NODE,markupIndex:null,textContent:null,fromIndex:t,toIndex:null})}function a(e,t){h.push({parentID:e,parentNode:null,type:c.TEXT_CONTENT,markupIndex:null,textContent:t,fromIndex:null,toIndex:null})}function s(){h.length&&(l.processChildrenUpdates(h,m),u())}function u(){h.length=0,m.length=0}var l=e(41),c=e(77),p=e(87),d=e(36),f=0,h=[],m=[],v={Mixin:{mountChildren:function(e,t,n){var r=d.instantiateChildren(e,t,n);this._renderedChildren=r;var o=[],i=0;for(var a in r)if(r.hasOwnProperty(a)){var s=r[a],u=this._rootNodeID+a,l=p.mountComponent(s,u,t,n);s._mountIndex=i,o.push(l),i++}return o},updateTextContent:function(e){f++;var t=!0;try{var n=this._renderedChildren;d.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setTextContent(e),t=!1}finally{f--,f||(t?u():s())}},updateChildren:function(e,t,n){f++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{f--,f||(r?u():s())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=d.updateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var i,a=0,s=0;for(i in o)if(o.hasOwnProperty(i)){var u=r&&r[i],l=o[i];u===l?(this.moveChild(u,s,a),a=Math.max(u._mountIndex,a),u._mountIndex=s):(u&&(a=Math.max(u._mountIndex,a),this._unmountChildByName(u,i)),this._mountChildByNameAtIndex(l,i,s,t,n)),s++}for(i in r)!r.hasOwnProperty(i)||o&&o.hasOwnProperty(i)||this._unmountChildByName(r[i],i)}},unmountChildren:function(){var e=this._renderedChildren;d.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&o(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){r(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){i(this._rootNodeID,e._mountIndex)},setTextContent:function(e){a(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,o){var i=this._rootNodeID+t,a=p.mountComponent(e,i,r,o);e._mountIndex=n,this.createChild(e,a)},_unmountChildByName:function(e,t){this.removeChild(e),e._mountIndex=null}}};t.exports=v},{36:36,41:41,77:77,87:87}],77:[function(e,t,n){"use strict";var r=e(153),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,TEXT_CONTENT:null});t.exports=o},{153:153}],78:[function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=l(t)),n}function o(e){return u(c),new c(e.type,e.props)}function i(e){return new d(e)}function a(e){return e instanceof d}var s=e(29),u=e(147),l=null,c=null,p={},d=null,f={injectGenericComponentClass:function(e){c=e},injectTextComponentClass:function(e){d=e},injectComponentClasses:function(e){s(p,e)},injectAutoWrapper:function(e){l=e}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:i,isTextComponent:a,injection:f};t.exports=h},{147:147,29:29}],79:[function(e,t,n){"use strict";var r=e(147),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){r(o.isValidOwner(n)),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){r(o.isValidOwner(n)),n.getPublicInstance().refs[t]===e.getPublicInstance()&&n.detachRef(t)}};t.exports=o},{147:147}],80:[function(e,t,n){"use strict";function r(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};t.exports=o},{}],81:[function(e,t,n){"use strict";function r(e){return function(t,n,r){t.hasOwnProperty(n)?t[n]=e(t[n],r):t[n]=r}}function o(e,t){for(var n in t)if(t.hasOwnProperty(n)){var r=l[n];r&&l.hasOwnProperty(n)?r(e,n,t[n]):e.hasOwnProperty(n)||(e[n]=t[n])}return e}var i=e(29),a=e(126),s=e(152),u=r(function(e,t){return i({},t,e)}),l={children:a,className:r(s),style:u},c={mergeProps:function(e,t){return o(i({},e),t)}};t.exports=c},{126:126,152:152,29:29}],82:[function(e,t,n){"use strict";var r={};t.exports=r},{}],83:[function(e,t,n){"use strict";var r=e(153),o=r({prop:null,context:null,childContext:null});t.exports=o},{153:153}],84:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,i){if(o=o||b,null==n[r]){var a=C[i];return t?new Error("Required "+a+" `"+r+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o){var i=t[n],a=m(i);if(a!==e){var s=C[o],u=v(i);return new Error("Invalid "+s+" `"+n+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `"+e+"`."))}return null}return r(t)}function i(){return r(E.thatReturns(null))}function a(e){function t(t,n,r,o){var i=t[n];if(!Array.isArray(i)){var a=C[o],s=m(i);return new Error("Invalid "+a+" `"+n+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var u=0;u<i.length;u++){var l=e(i,u,r,o);if(l instanceof Error)return l}return null}return r(t)}function s(){function e(e,t,n,r){if(!g.isValidElement(e[t])){var o=C[r];return new Error("Invalid "+o+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactElement."))}return null}return r(e)}function u(e){function t(t,n,r,o){if(!(t[n]instanceof e)){var i=C[o],a=e.name||b;return new Error("Invalid "+i+" `"+n+"` supplied to "+("`"+r+"`, expected instance of `"+a+"`."))}return null}return r(t)}function l(e){function t(t,n,r,o){for(var i=t[n],a=0;a<e.length;a++)if(i===e[a])return null;var s=C[o],u=JSON.stringify(e);return new Error("Invalid "+s+" `"+n+"` of value `"+i+"` "+("supplied to `"+r+"`, expected one of "+u+"."))}return r(t)}function c(e){function t(t,n,r,o){var i=t[n],a=m(i);if("object"!==a){var s=C[o];return new Error("Invalid "+s+" `"+n+"` of type "+("`"+a+"` supplied to `"+r+"`, expected an object."))}for(var u in i)if(i.hasOwnProperty(u)){var l=e(i,u,r,o);if(l instanceof Error)return l}return null}return r(t)}function p(e){function t(t,n,r,o){for(var i=0;i<e.length;i++){var a=e[i];if(null==a(t,n,r,o))return null}var s=C[o];return new Error("Invalid "+s+" `"+n+"` supplied to "+("`"+r+"`."))}return r(t)}function d(){function e(e,t,n,r){if(!h(e[t])){var o=C[r];return new Error("Invalid "+o+" `"+t+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function f(e){function t(t,n,r,o){var i=t[n],a=m(i);if("object"!==a){var s=C[o];return new Error("Invalid "+s+" `"+n+"` of type `"+a+"` "+("supplied to `"+r+"`, expected `object`."))}for(var u in e){var l=e[u];if(l){var c=l(i,u,r,o);if(c)return c}}return null}return r(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||g.isValidElement(e))return!0;e=y.extractIfFragment(e);for(var t in e)if(!h(e[t]))return!1;return!0;default:return!1}}function m(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function v(e){var t=m(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}var g=e(61),y=e(67),C=e(82),E=e(126),b="<<anonymous>>",_=s(),x=d(),D={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),any:i(),arrayOf:a,element:_,instanceOf:u,node:x,objectOf:c,oneOf:l,oneOfType:p,shape:f};t.exports=D},{126:126,61:61,67:67,82:82}],85:[function(e,t,n){"use strict";function r(){this.listenersToPut=[]}var o=e(30),i=e(33),a=e(29);a(r.prototype,{enqueuePutListener:function(e,t,n){this.listenersToPut.push({rootNodeID:e,propKey:t,propValue:n})},putListeners:function(){for(var e=0;e<this.listenersToPut.length;e++){var t=this.listenersToPut[e];i.putListener(t.rootNodeID,t.propKey,t.propValue)}},reset:function(){this.listenersToPut.length=0},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{29:29,30:30,33:33}],86:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=o.getPooled(null),this.putListenerQueue=u.getPooled()}var o=e(7),i=e(30),a=e(33),s=e(69),u=e(85),l=e(113),c=e(29),p={initialize:s.getSelectionInformation,close:s.restoreSelection},d={initialize:function(){var e=a.isEnabled();return a.setEnabled(!1),e},close:function(e){a.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h={initialize:function(){this.putListenerQueue.reset()},close:function(){this.putListenerQueue.putListeners()}},m=[h,p,d,f],v={getTransactionWrappers:function(){return m},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null,u.release(this.putListenerQueue),this.putListenerQueue=null}};c(r.prototype,l.Mixin,v),i.addPoolingTo(r),t.exports=r},{113:113,29:29,30:30,33:33,69:69,7:7,85:85}],87:[function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=e(88),i=(e(62),{mountComponent:function(e,t,n,o){var i=e.mountComponent(t,n,o);return n.getReactMountReady().enqueue(r,e),i},unmountComponent:function(e){o.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,n,i){var a=e._currentElement;if(t!==a||null==t._owner){var s=o.shouldUpdateRefs(a,t);s&&o.detachRefs(e,a),e.receiveComponent(t,n,i),s&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}});t.exports=i},{62:62,88:88}],88:[function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):i.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):i.removeComponentAsRefFrom(t,e,n)}var i=e(79),a={};a.attachRefs=function(e,t){var n=t.ref;null!=n&&r(n,e,t._owner)},a.shouldUpdateRefs=function(e,t){return t._owner!==e._owner||t.ref!==e.ref},a.detachRefs=function(e,t){var n=t.ref;null!=n&&o(n,e,t._owner)},t.exports=a},{79:79}],89:[function(e,t,n){"use strict";var r={injectCreateReactRootIndex:function(e){o.createReactRootIndex=e}},o={createReactRootIndex:null,injection:r};t.exports=o},{}],90:[function(e,t,n){"use strict";function r(e){p(i.isValidElement(e));var t;try{var n=a.createReactRootID();return t=u.getPooled(!1),t.perform(function(){var r=c(e,null),o=r.mountComponent(n,t,l);return s.addChecksumToMarkup(o)},null)}finally{u.release(t)}}function o(e){p(i.isValidElement(e));var t;try{var n=a.createReactRootID();return t=u.getPooled(!0),t.perform(function(){var r=c(e,null);return r.mountComponent(n,t,l)},null)}finally{u.release(t)}}var i=e(61),a=e(70),s=e(74),u=e(91),l=e(127),c=e(146),p=e(147);t.exports={renderToString:r,renderToStaticMarkup:o}},{127:127,146:146,147:147,61:61,70:70,74:74,91:91}],91:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=i.getPooled(null),this.putListenerQueue=a.getPooled()}var o=e(30),i=e(7),a=e(85),s=e(113),u=e(29),l=e(126),c={initialize:function(){this.reactMountReady.reset()},close:l},p={initialize:function(){this.putListenerQueue.reset()},close:l},d=[p,c],f={getTransactionWrappers:function(){return d},getReactMountReady:function(){return this.reactMountReady},getPutListenerQueue:function(){return this.putListenerQueue},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null,a.release(this.putListenerQueue),this.putListenerQueue=null}};u(r.prototype,s.Mixin,f),o.addPoolingTo(r),t.exports=r},{113:113,126:126,29:29,30:30,7:7,85:85}],92:[function(e,t,n){"use strict";function r(e,t){var n={};return function(r){n[t]=r,e.setState(n)}}var o={createStateSetter:function(e,t){return function(n,r,o,i,a,s){var u=t.call(e,n,r,o,i,a,s);u&&e.setState(u)}},createStateKeySetter:function(e,t){var n=e.__keySetters||(e.__keySetters={});return n[t]||(n[t]=r(e,t))}};o.Mixin={createStateSetter:function(e){return o.createStateSetter(this,e)},createStateKeySetter:function(e){return o.createStateKeySetter(this,e)}},t.exports=o},{}],93:[function(e,t,n){"use strict";var r=e(37),o=e(67),i={getChildMapping:function(e){return e?o.extract(r.map(e,function(e){return e})):e},mergeChildMappings:function(e,t){function n(n){return t.hasOwnProperty(n)?t[n]:e[n]}e=e||{},t=t||{};var r={},o=[];for(var i in e)t.hasOwnProperty(i)?o.length&&(r[i]=o,o=[]):o.push(i);var a,s={};for(var u in t){if(r.hasOwnProperty(u))for(a=0;a<r[u].length;a++){var l=r[u][a];s[r[u][a]]=n(l)}s[u]=n(u)}for(a=0;a<o.length;a++)s[o[a]]=n(o[a]);return s}};t.exports=i},{37:37,67:67}],94:[function(e,t,n){"use strict";function r(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete s.animationend.animation,"TransitionEvent"in window||delete s.transitionend.transition;for(var n in s){var r=s[n];for(var o in r)if(o in t){u.push(r[o]);break}}}function o(e,t,n){e.addEventListener(t,n,!1)}function i(e,t,n){e.removeEventListener(t,n,!1)}var a=e(22),s={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},u=[];a.canUseDOM&&r();var l={addEndEventListener:function(e,t){
-return 0===u.length?void window.setTimeout(t,0):void u.forEach(function(n){o(e,n,t)})},removeEndEventListener:function(e,t){0!==u.length&&u.forEach(function(n){i(e,n,t)})}};t.exports=l},{22:22}],95:[function(e,t,n){"use strict";var r=e(31),o=e(93),i=e(29),a=e(119),s=e(126),u=r.createClass({displayName:"ReactTransitionGroup",propTypes:{component:r.PropTypes.any,childFactory:r.PropTypes.func},getDefaultProps:function(){return{component:"span",childFactory:s.thatReturnsArgument}},getInitialState:function(){return{children:o.getChildMapping(this.props.children)}},componentWillMount:function(){this.currentlyTransitioningKeys={},this.keysToEnter=[],this.keysToLeave=[]},componentDidMount:function(){var e=this.state.children;for(var t in e)e[t]&&this.performAppear(t)},componentWillReceiveProps:function(e){var t=o.getChildMapping(e.children),n=this.state.children;this.setState({children:o.mergeChildMappings(n,t)});var r;for(r in t){var i=n&&n.hasOwnProperty(r);!t[r]||i||this.currentlyTransitioningKeys[r]||this.keysToEnter.push(r)}for(r in n){var a=t&&t.hasOwnProperty(r);!n[r]||a||this.currentlyTransitioningKeys[r]||this.keysToLeave.push(r)}},componentDidUpdate:function(){var e=this.keysToEnter;this.keysToEnter=[],e.forEach(this.performEnter);var t=this.keysToLeave;this.keysToLeave=[],t.forEach(this.performLeave)},performAppear:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)},_handleDoneAppearing:function(e){var t=this.refs[e];t.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e];var n=o.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)||this.performLeave(e)},performEnter:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)},_handleDoneEntering:function(e){var t=this.refs[e];t.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e];var n=o.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)||this.performLeave(e)},performLeave:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillLeave?t.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)},_handleDoneLeaving:function(e){var t=this.refs[e];t.componentDidLeave&&t.componentDidLeave(),delete this.currentlyTransitioningKeys[e];var n=o.getChildMapping(this.props.children);if(n&&n.hasOwnProperty(e))this.performEnter(e);else{var r=i({},this.state.children);delete r[e],this.setState({children:r})}},render:function(){var e=[];for(var t in this.state.children){var n=this.state.children[t];n&&e.push(a(this.props.childFactory(n),{ref:t,key:t}))}return r.createElement(this.props.component,this.props,e)}});t.exports=u},{119:119,126:126,29:29,31:31,93:93}],96:[function(e,t,n){"use strict";function r(e){e!==i.currentlyMountingInstance&&l.enqueueUpdate(e)}function o(e,t){p(null==a.current);var n=u.get(e);return n?n===i.currentlyUnmountingInstance?null:n:null}var i=e(72),a=e(45),s=e(61),u=e(71),l=e(97),c=e(29),p=e(147),d=(e(166),{enqueueCallback:function(e,t){p("function"==typeof t);var n=o(e);return n&&n!==i.currentlyMountingInstance?(n._pendingCallbacks?n._pendingCallbacks.push(t):n._pendingCallbacks=[t],void r(n)):null},enqueueCallbackInternal:function(e,t){p("function"==typeof t),e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var i=n._pendingStateQueue||(n._pendingStateQueue=[]);i.push(t),r(n)}},enqueueSetProps:function(e,t){var n=o(e,"setProps");if(n){p(n._isTopLevel);var i=n._pendingElement||n._currentElement,a=c({},i.props,t);n._pendingElement=s.cloneAndReplaceProps(i,a),r(n)}},enqueueReplaceProps:function(e,t){var n=o(e,"replaceProps");if(n){p(n._isTopLevel);var i=n._pendingElement||n._currentElement;n._pendingElement=s.cloneAndReplaceProps(i,t),r(n)}},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)}});t.exports=d},{147:147,166:166,29:29,45:45,61:61,71:71,72:72,97:97}],97:[function(e,t,n){"use strict";function r(){v(T.ReactReconcileTransaction&&E)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=T.ReactReconcileTransaction.getPooled()}function i(e,t,n,o,i){r(),E.batchedUpdates(e,t,n,o,i)}function a(e,t){return e._mountOrder-t._mountOrder}function s(e){var t=e.dirtyComponentsLength;v(t===g.length),g.sort(a);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,f.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var i=0;i<o.length;i++)e.callbackQueue.enqueue(o[i],r.getPublicInstance())}}function u(e){return r(),E.isBatchingUpdates?void g.push(e):void E.batchedUpdates(u,e)}function l(e,t){v(E.isBatchingUpdates),y.enqueue(e,t),C=!0}var c=e(7),p=e(30),d=(e(45),e(80)),f=e(87),h=e(113),m=e(29),v=e(147),g=(e(166),[]),y=c.getPooled(),C=!1,E=null,b={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),D()):g.length=0}},_={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},x=[b,_];m(o.prototype,h.Mixin,{getTransactionWrappers:function(){return x},destructor:function(){this.dirtyComponentsLength=null,c.release(this.callbackQueue),this.callbackQueue=null,T.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),p.addPoolingTo(o);var D=function(){for(;g.length||C;){if(g.length){var e=o.getPooled();e.perform(s,null,e),o.release(e)}if(C){C=!1;var t=y;y=c.getPooled(),t.notifyAll(),c.release(t)}}};D=d.measure("ReactUpdates","flushBatchedUpdates",D);var M={injectReconcileTransaction:function(e){v(e),T.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){v(e),v("function"==typeof e.batchedUpdates),v("boolean"==typeof e.isBatchingUpdates),E=e}},T={ReactReconcileTransaction:null,batchedUpdates:i,enqueueUpdate:u,flushBatchedUpdates:D,injection:M,asap:l};t.exports=T},{113:113,147:147,166:166,29:29,30:30,45:45,7:7,80:80,87:87}],98:[function(e,t,n){"use strict";var r=e(11),o=r.injection.MUST_USE_ATTRIBUTE,i={Properties:{clipPath:o,cx:o,cy:o,d:o,dx:o,dy:o,fill:o,fillOpacity:o,fontFamily:o,fontSize:o,fx:o,fy:o,gradientTransform:o,gradientUnits:o,markerEnd:o,markerMid:o,markerStart:o,offset:o,opacity:o,patternContentUnits:o,patternUnits:o,points:o,preserveAspectRatio:o,r:o,rx:o,ry:o,spreadMethod:o,stopColor:o,stopOpacity:o,stroke:o,strokeDasharray:o,strokeLinecap:o,strokeOpacity:o,strokeWidth:o,textAnchor:o,transform:o,version:o,viewBox:o,x1:o,x2:o,x:o,y1:o,y2:o,y:o},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox"}};t.exports=i},{11:11}],99:[function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&s.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e){if(y||null==m||m!==l())return null;var t=r(m);if(!g||!d(g,t)){g=t;var n=u.getPooled(h.select,v,e);return n.type="select",n.target=m,a.accumulateTwoPhaseDispatches(n),n}}var i=e(16),a=e(21),s=e(69),u=e(105),l=e(133),c=e(150),p=e(154),d=e(161),f=i.topLevelTypes,h={select:{phasedRegistrationNames:{bubbled:p({onSelect:null}),captured:p({onSelectCapture:null})},dependencies:[f.topBlur,f.topContextMenu,f.topFocus,f.topKeyDown,f.topMouseDown,f.topMouseUp,f.topSelectionChange]}},m=null,v=null,g=null,y=!1,C={eventTypes:h,extractEvents:function(e,t,n,r){switch(e){case f.topFocus:(c(t)||"true"===t.contentEditable)&&(m=t,v=n,g=null);break;case f.topBlur:m=null,v=null,g=null;break;case f.topMouseDown:y=!0;break;case f.topContextMenu:case f.topMouseUp:return y=!1,o(r);case f.topSelectionChange:case f.topKeyDown:case f.topKeyUp:return o(r)}}};t.exports=C},{105:105,133:133,150:150,154:154,16:16,161:161,21:21,69:69}],100:[function(e,t,n){"use strict";var r=Math.pow(2,53),o={createReactRootIndex:function(){return Math.ceil(Math.random()*r)}};t.exports=o},{}],101:[function(e,t,n){"use strict";var r=e(16),o=e(20),i=e(21),a=e(102),s=e(105),u=e(106),l=e(108),c=e(109),p=e(104),d=e(110),f=e(111),h=e(112),m=e(134),v=e(147),g=e(154),y=(e(166),r.topLevelTypes),C={blur:{phasedRegistrationNames:{bubbled:g({onBlur:!0}),captured:g({onBlurCapture:!0})}},click:{phasedRegistrationNames:{bubbled:g({onClick:!0}),captured:g({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:g({onContextMenu:!0}),captured:g({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:g({onCopy:!0}),captured:g({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:g({onCut:!0}),captured:g({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:g({onDoubleClick:!0}),captured:g({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:g({onDrag:!0}),captured:g({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:g({onDragEnd:!0}),captured:g({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:g({onDragEnter:!0}),captured:g({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:g({onDragExit:!0}),captured:g({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:g({onDragLeave:!0}),captured:g({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:g({onDragOver:!0}),captured:g({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:g({onDragStart:!0}),captured:g({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:g({onDrop:!0}),captured:g({onDropCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:g({onFocus:!0}),captured:g({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:g({onInput:!0}),captured:g({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:g({onKeyDown:!0}),captured:g({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:g({onKeyPress:!0}),captured:g({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:g({onKeyUp:!0}),captured:g({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:g({onLoad:!0}),captured:g({onLoadCapture:!0})}},error:{phasedRegistrationNames:{bubbled:g({onError:!0}),captured:g({onErrorCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:g({onMouseDown:!0}),captured:g({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:g({onMouseMove:!0}),captured:g({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:g({onMouseOut:!0}),captured:g({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:g({onMouseOver:!0}),captured:g({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:g({onMouseUp:!0}),captured:g({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:g({onPaste:!0}),captured:g({onPasteCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:g({onReset:!0}),captured:g({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:g({onScroll:!0}),captured:g({onScrollCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:g({onSubmit:!0}),captured:g({onSubmitCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:g({onTouchCancel:!0}),captured:g({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:g({onTouchEnd:!0}),captured:g({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:g({onTouchMove:!0}),captured:g({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:g({onTouchStart:!0}),captured:g({onTouchStartCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:g({onWheel:!0}),captured:g({onWheelCapture:!0})}}},E={topBlur:C.blur,topClick:C.click,topContextMenu:C.contextMenu,topCopy:C.copy,topCut:C.cut,topDoubleClick:C.doubleClick,topDrag:C.drag,topDragEnd:C.dragEnd,topDragEnter:C.dragEnter,topDragExit:C.dragExit,topDragLeave:C.dragLeave,topDragOver:C.dragOver,topDragStart:C.dragStart,topDrop:C.drop,topError:C.error,topFocus:C.focus,topInput:C.input,topKeyDown:C.keyDown,topKeyPress:C.keyPress,topKeyUp:C.keyUp,topLoad:C.load,topMouseDown:C.mouseDown,topMouseMove:C.mouseMove,topMouseOut:C.mouseOut,topMouseOver:C.mouseOver,topMouseUp:C.mouseUp,topPaste:C.paste,topReset:C.reset,topScroll:C.scroll,topSubmit:C.submit,topTouchCancel:C.touchCancel,topTouchEnd:C.touchEnd,topTouchMove:C.touchMove,topTouchStart:C.touchStart,topWheel:C.wheel};for(var b in E)E[b].dependencies=[b];var _={eventTypes:C,executeDispatch:function(e,t,n){var r=o.executeDispatch(e,t,n);r===!1&&(e.stopPropagation(),e.preventDefault())},extractEvents:function(e,t,n,r){var o=E[e];if(!o)return null;var g;switch(e){case y.topInput:case y.topLoad:case y.topError:case y.topReset:case y.topSubmit:g=s;break;case y.topKeyPress:if(0===m(r))return null;case y.topKeyDown:case y.topKeyUp:g=l;break;case y.topBlur:case y.topFocus:g=u;break;case y.topClick:if(2===r.button)return null;case y.topContextMenu:case y.topDoubleClick:case y.topMouseDown:case y.topMouseMove:case y.topMouseOut:case y.topMouseOver:case y.topMouseUp:g=c;break;case y.topDrag:case y.topDragEnd:case y.topDragEnter:case y.topDragExit:case y.topDragLeave:case y.topDragOver:case y.topDragStart:case y.topDrop:g=p;break;case y.topTouchCancel:case y.topTouchEnd:case y.topTouchMove:case y.topTouchStart:g=d;break;case y.topScroll:g=f;break;case y.topWheel:g=h;break;case y.topCopy:case y.topCut:case y.topPaste:g=a}v(g);var C=g.getPooled(o,n,r);return i.accumulateTwoPhaseDispatches(C),C}};t.exports=_},{102:102,104:104,105:105,106:106,108:108,109:109,110:110,111:111,112:112,134:134,147:147,154:154,16:16,166:166,20:20,21:21}],102:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(105),i={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,i),t.exports=r},{105:105}],103:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(105),i={data:null};o.augmentClass(r,i),t.exports=r},{105:105}],104:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(109),i={dataTransfer:null};o.augmentClass(r,i),t.exports=r},{109:109}],105:[function(e,t,n){"use strict";function r(e,t,n){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var r=this.constructor.Interface;for(var o in r)if(r.hasOwnProperty(o)){var i=r[o];i?this[o]=i(n):this[o]=n[o]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;s?this.isDefaultPrevented=a.thatReturnsTrue:this.isDefaultPrevented=a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse}var o=e(30),i=e(29),a=e(126),s=e(137),u={type:null,target:s,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};i(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=a.thatReturnsTrue},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=a.thatReturnsTrue},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=u,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);i(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=i({},n.Interface,t),e.augmentClass=n.augmentClass,o.addPoolingTo(e,o.threeArgumentPooler)},o.addPoolingTo(r,o.threeArgumentPooler),t.exports=r},{126:126,137:137,29:29,30:30}],106:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(111),i={relatedTarget:null};o.augmentClass(r,i),t.exports=r},{111:111}],107:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(105),i={data:null};o.augmentClass(r,i),t.exports=r},{105:105}],108:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(111),i=e(134),a=e(135),s=e(136),u={key:a,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:s,charCode:function(e){return"keypress"===e.type?i(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?i(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,u),t.exports=r},{111:111,134:134,135:135,136:136}],109:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(111),i=e(114),a=e(136),s={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:a,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+i.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+i.currentScrollTop}};o.augmentClass(r,s),t.exports=r},{111:111,114:114,136:136}],110:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(111),i=e(136),a={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:i};o.augmentClass(r,a),t.exports=r},{111:111,136:136}],111:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(105),i=e(137),a={view:function(e){if(e.view)return e.view;var t=i(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,a),t.exports=r},{105:105,137:137}],112:[function(e,t,n){"use strict";function r(e,t,n){o.call(this,e,t,n)}var o=e(109),i={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,i),t.exports=r},{109:109}],113:[function(e,t,n){"use strict";var r=e(147),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,i,a,s,u){r(!this.isInTransaction());var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,n,o,i,a,s,u),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=i.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===i.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){r(this.isInTransaction());for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,a=t[n],s=this.wrapperInitData[n];try{o=!0,s!==i.OBSERVED_ERROR&&a.close&&a.close.call(this,s),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(u){}}}this.wrapperInitData.length=0}},i={Mixin:o,OBSERVED_ERROR:{}};t.exports=i},{147:147}],114:[function(e,t,n){"use strict";var r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){r.currentScrollLeft=e.x,r.currentScrollTop=e.y}};t.exports=r},{}],115:[function(e,t,n){"use strict";function r(e,t){if(o(null!=t),null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=e(147);t.exports=r},{147:147}],116:[function(e,t,n){"use strict";function r(e){for(var t=1,n=0,r=0;r<e.length;r++)t=(t+e.charCodeAt(r))%o,n=(n+t)%o;return t|n<<16}var o=65521;t.exports=r},{}],117:[function(e,t,n){function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;t.exports=r},{}],118:[function(e,t,n){"use strict";function r(e){return o(e.replace(i,"ms-"))}var o=e(117),i=/^-ms-/;t.exports=r},{117:117}],119:[function(e,t,n){"use strict";function r(e,t){var n=i.mergeProps(t,e.props);return!n.hasOwnProperty(s)&&e.props.hasOwnProperty(s)&&(n.children=e.props.children),o.createElement(e.type,n)}var o=e(61),i=e(81),a=e(154),s=(e(166),a({children:null}));t.exports=r},{154:154,166:166,61:61,81:81}],120:[function(e,t,n){function r(e,t){return e&&t?e===t?!0:o(e)?!1:o(t)?r(e,t.parentNode):e.contains?e.contains(t):e.compareDocumentPosition?!!(16&e.compareDocumentPosition(t)):!1:!1}var o=e(151);t.exports=r},{151:151}],121:[function(e,t,n){function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function o(e){return r(e)?Array.isArray(e)?e.slice():i(e):[e]}var i=e(163);t.exports=o},{163:163}],122:[function(e,t,n){"use strict";function r(e){var t=i.createFactory(e),n=o.createClass({tagName:e.toUpperCase(),displayName:"ReactFullPageComponent"+e,componentWillUnmount:function(){a(!1)},render:function(){return t(this.props)}});return n}var o=e(38),i=e(61),a=e(147);t.exports=r},{147:147,38:38,61:61}],123:[function(e,t,n){function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function o(e,t){var n=l;u(!!l);var o=r(e),i=o&&s(o);if(i){n.innerHTML=i[1]+e+i[2];for(var c=i[0];c--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(u(t),a(p).forEach(t));for(var d=a(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}var i=e(22),a=e(121),s=e(139),u=e(147),l=i.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=o},{121:121,139:139,147:147,22:22}],124:[function(e,t,n){"use strict";function r(e){return"object"==typeof e?Object.keys(e).filter(function(t){return e[t]}).join(" "):Array.prototype.join.call(arguments," ")}e(166);t.exports=r},{166:166}],125:[function(e,t,n){"use strict";function r(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||i.hasOwnProperty(e)&&i[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var o=e(5),i=o.isUnitlessNumber;t.exports=r},{5:5}],126:[function(e,t,n){function r(e){return function(){return e}}function o(){}o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],127:[function(e,t,n){"use strict";var r={};t.exports=r},{}],128:[function(e,t,n){"use strict";function r(e){return i[e]}function o(e){return(""+e).replace(a,r)}var i={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},a=/[&><"']/g;t.exports=o},{}],129:[function(e,t,n){"use strict";function r(e){return null==e?null:s(e)?e:o.has(e)?i.getNodeFromInstance(e):(a(null==e.render||"function"!=typeof e.render),void a(!1))}{var o=(e(45),e(71)),i=e(75),a=e(147),s=e(149);e(166)}t.exports=r},{147:147,149:149,166:166,45:45,71:71,75:75}],130:[function(e,t,n){"use strict";function r(e,t,n){var r=e,o=!r.hasOwnProperty(n);o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return i(e,r,t),t}{var i=e(164);e(166)}t.exports=o},{164:164,166:166}],131:[function(e,t,n){"use strict";function r(e){try{e.focus()}catch(t){}}t.exports=r},{}],132:[function(e,t,n){"use strict";var r=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=r},{}],133:[function(e,t,n){function r(){try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=r},{}],134:[function(e,t,n){"use strict";function r(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=r},{}],135:[function(e,t,n){"use strict";function r(e){if(e.key){var t=i[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?a[e.keyCode]||"Unidentified":""}var o=e(134),i={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=r},{134:134}],136:[function(e,t,n){"use strict";function r(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=i[e];return r?!!n[r]:!1}function o(e){return r}var i={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=o},{}],137:[function(e,t,n){"use strict";function r(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=r},{}],138:[function(e,t,n){"use strict";function r(e){var t=e&&(o&&e[o]||e[i]);return"function"==typeof t?t:void 0}var o="function"==typeof Symbol&&Symbol.iterator,i="@@iterator";t.exports=r},{}],139:[function(e,t,n){function r(e){return i(!!a),d.hasOwnProperty(e)||(e="*"),s.hasOwnProperty(e)||("*"===e?a.innerHTML="<link />":a.innerHTML="<"+e+"></"+e+">",s[e]=!a.firstChild),s[e]?d[e]:null}var o=e(22),i=e(147),a=o.canUseDOM?document.createElement("div"):null,s={circle:!0,clipPath:!0,defs:!0,ellipse:!0,g:!0,line:!0,linearGradient:!0,path:!0,polygon:!0,polyline:!0,radialGradient:!0,rect:!0,stop:!0,text:!0},u=[1,'<select multiple="true">',"</select>"],l=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,"<svg>","</svg>"],d={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:u,option:u,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c,circle:p,clipPath:p,defs:p,ellipse:p,g:p,line:p,linearGradient:p,path:p,polygon:p,polyline:p,radialGradient:p,rect:p,stop:p,text:p};t.exports=r},{147:147,22:22}],140:[function(e,t,n){"use strict";function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function i(e,t){for(var n=r(e),i=0,a=0;n;){if(3===n.nodeType){if(a=i+n.textContent.length,t>=i&&a>=t)return{node:n,offset:t-i};i=a}n=r(o(n))}}t.exports=i},{}],141:[function(e,t,n){"use strict";function r(e){return e?e.nodeType===o?e.documentElement:e.firstChild:null}var o=9;t.exports=r},{}],142:[function(e,t,n){"use strict";function r(){return!i&&o.canUseDOM&&(i="textContent"in document.documentElement?"textContent":"innerText"),i}var o=e(22),i=null;t.exports=r},{22:22}],143:[function(e,t,n){"use strict";function r(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=r},{}],144:[function(e,t,n){function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;t.exports=r},{}],145:[function(e,t,n){"use strict";function r(e){return o(e).replace(i,"-ms-")}var o=e(144),i=/^ms-/;t.exports=r},{144:144}],146:[function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e,t){var n;if((null===e||e===!1)&&(e=a.emptyElement),"object"==typeof e){var o=e;n=t===o.type&&"string"==typeof o.type?s.createInternalComponent(o):r(o.type)?new o.type(o):new c}else"string"==typeof e||"number"==typeof e?n=s.createInstanceForText(e):l(!1);return n.construct(e),n._mountIndex=0,n._mountImage=null,n}var i=e(43),a=e(63),s=e(78),u=e(29),l=e(147),c=(e(166),function(){});u(c.prototype,i.Mixin,{_instantiateReactComponent:o}),t.exports=o},{147:147,166:166,29:29,43:43,63:63,78:78}],147:[function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,s],c=0;u=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return l[c++]}))}throw u.framesToPop=1,u}};t.exports=r},{}],148:[function(e,t,n){"use strict";function r(e,t){if(!i.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,i=e(22);i.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=r},{22:22}],149:[function(e,t,n){function r(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=r},{}],150:[function(e,t,n){"use strict";function r(e){return e&&("INPUT"===e.nodeName&&o[e.type]||"TEXTAREA"===e.nodeName)}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=r},{}],151:[function(e,t,n){function r(e){return o(e)&&3==e.nodeType}var o=e(149);t.exports=r},{149:149}],152:[function(e,t,n){"use strict";function r(e){e||(e="");var t,n=arguments.length;if(n>1)for(var r=1;n>r;r++)t=arguments[r],t&&(e=(e?e+" ":"")+t);return e}t.exports=r},{}],153:[function(e,t,n){"use strict";var r=e(147),o=function(e){var t,n={};r(e instanceof Object&&!Array.isArray(e));for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};t.exports=o},{147:147}],154:[function(e,t,n){var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=r},{}],155:[function(e,t,n){"use strict";function r(e,t,n){if(!e)return null;var r={};for(var i in e)o.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],156:[function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=r},{}],157:[function(e,t,n){"use strict";function r(e){return i(o.isValidElement(e)),e}var o=e(61),i=e(147);t.exports=r},{147:147,61:61}],158:[function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=e(128);t.exports=r},{128:128}],159:[function(e,t,n){"use strict";var r=e(22),o=/^[ \r\n\t\f]/,i=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){
-e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&i.test(t)){e.innerHTML="\ufeff"+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=a},{22:22}],160:[function(e,t,n){"use strict";var r=e(22),o=e(128),i=e(159),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){i(e,o(t))})),t.exports=a},{128:128,159:159,22:22}],161:[function(e,t,n){"use strict";function r(e,t){if(e===t)return!0;var n;for(n in e)if(e.hasOwnProperty(n)&&(!t.hasOwnProperty(n)||e[n]!==t[n]))return!1;for(n in t)if(t.hasOwnProperty(n)&&!e.hasOwnProperty(n))return!1;return!0}t.exports=r},{}],162:[function(e,t,n){"use strict";function r(e,t){if(null!=e&&null!=t){var n=typeof e,r=typeof t;if("string"===n||"number"===n)return"string"===r||"number"===r;if("object"===r&&e.type===t.type&&e.key===t.key){var o=e._owner===t._owner;return o}}return!1}e(166);t.exports=r},{166:166}],163:[function(e,t,n){function r(e){var t=e.length;if(o(!Array.isArray(e)&&("object"==typeof e||"function"==typeof e)),o("number"==typeof t),o(0===t||t-1 in e),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),i=0;t>i;i++)r[i]=e[i];return r}var o=e(147);t.exports=r},{147:147}],164:[function(e,t,n){"use strict";function r(e){return v[e]}function o(e,t){return e&&null!=e.key?a(e.key):t.toString(36)}function i(e){return(""+e).replace(g,r)}function a(e){return"$"+i(e)}function s(e,t,n,r,i){var u=typeof e;if(("undefined"===u||"boolean"===u)&&(e=null),null===e||"string"===u||"number"===u||l.isValidElement(e))return r(i,e,""===t?h+o(e,0):t,n),1;var p,v,g,y=0;if(Array.isArray(e))for(var C=0;C<e.length;C++)p=e[C],v=(""!==t?t+m:h)+o(p,C),g=n+y,y+=s(p,v,g,r,i);else{var E=d(e);if(E){var b,_=E.call(e);if(E!==e.entries)for(var x=0;!(b=_.next()).done;)p=b.value,v=(""!==t?t+m:h)+o(p,x++),g=n+y,y+=s(p,v,g,r,i);else for(;!(b=_.next()).done;){var D=b.value;D&&(p=D[1],v=(""!==t?t+m:h)+a(D[0])+m+o(p,0),g=n+y,y+=s(p,v,g,r,i))}}else if("object"===u){f(1!==e.nodeType);var M=c.extract(e);for(var T in M)M.hasOwnProperty(T)&&(p=M[T],v=(""!==t?t+m:h)+a(T)+m+o(p,0),g=n+y,y+=s(p,v,g,r,i))}}return y}function u(e,t,n){return null==e?0:s(e,"",0,t,n)}var l=e(61),c=e(67),p=e(70),d=e(138),f=e(147),h=(e(166),p.SEPARATOR),m=":",v={"=":"=0",".":"=1",":":"=2"},g=/[=.:]/g;t.exports=u},{138:138,147:147,166:166,61:61,67:67,70:70}],165:[function(e,t,n){"use strict";function r(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?a(new e.constructor,e):e}function o(e,t,n){u(Array.isArray(e));var r=t[n];u(Array.isArray(r))}function i(e,t){if(u("object"==typeof t),l.call(t,f))return u(1===Object.keys(t).length),t[f];var n=r(e);if(l.call(t,h)){var s=t[h];u(s&&"object"==typeof s),u(n&&"object"==typeof n),a(n,t[h])}l.call(t,c)&&(o(e,t,c),t[c].forEach(function(e){n.push(e)})),l.call(t,p)&&(o(e,t,p),t[p].forEach(function(e){n.unshift(e)})),l.call(t,d)&&(u(Array.isArray(e)),u(Array.isArray(t[d])),t[d].forEach(function(e){u(Array.isArray(e)),n.splice.apply(n,e)})),l.call(t,m)&&(u("function"==typeof t[m]),n=t[m](n));for(var v in t)g.hasOwnProperty(v)&&g[v]||(n[v]=i(e[v],t[v]));return n}var a=e(29),s=e(154),u=e(147),l={}.hasOwnProperty,c=s({$push:null}),p=s({$unshift:null}),d=s({$splice:null}),f=s({$set:null}),h=s({$merge:null}),m=s({$apply:null}),v=[c,p,d,f,h,m],g={};v.forEach(function(e){g[e]=!0}),t.exports=i},{147:147,154:154,29:29}],166:[function(e,t,n){"use strict";var r=e(126),o=r;t.exports=o},{126:126}]},{},[1])(1)});
\ No newline at end of file
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.React=e()}}(function(){return function e(t,n,r){function o(i,u){if(!n[i]){if(!t[i]){var s="function"==typeof require&&require;if(!u&&s)return s(i,!0);if(a)return a(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){var n=t[i][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(e,t,n){"use strict";var r=e(22),o=e(26),a=e(37),i=e(29),u=e(62),s=e(91),l=e(93),c=e(115),p=e(137),d=e(140);e(168);o.addons={CSSTransitionGroup:i,LinkedStateMixin:r,PureRenderMixin:a,TransitionGroup:s,batchedUpdates:function(){return l.batchedUpdates.apply(this,arguments)},cloneWithProps:c,createFragment:u.create,shallowCompare:p,update:d},t.exports=o},{115:115,137:137,140:140,168:168,22:22,26:26,29:29,37:37,62:62,91:91,93:93}],2:[function(e,t,n){"use strict";var r=e(70),o=e(119),a=e(152),i={componentDidMount:function(){this.props.autoFocus&&a(o(this))}},u={Mixin:i,focusDOMComponent:function(){a(r.getNode(this._rootNodeID))}};t.exports=u},{119:119,152:152,70:70}],3:[function(e,t,n){"use strict";function r(){var e=window.opera;return"object"==typeof e&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function o(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function a(e){switch(e){case N.topCompositionStart:return S.compositionStart;case N.topCompositionEnd:return S.compositionEnd;case N.topCompositionUpdate:return S.compositionUpdate}}function i(e,t){return e===N.topKeyDown&&t.keyCode===E}function u(e,t){switch(e){case N.topKeyUp:return-1!==_.indexOf(t.keyCode);case N.topKeyDown:return t.keyCode!==E;case N.topKeyPress:case N.topMouseDown:case N.topBlur:return!0;default:return!1}}function s(e){var t=e.detail;return"object"==typeof t&&"data"in t?t.data:null}function l(e,t,n,r,o){var l,c;if(b?l=a(e):w?u(e,r)&&(l=S.compositionEnd):i(e,r)&&(l=S.compositionStart),!l)return null;T&&(w||l!==S.compositionStart?l===S.compositionEnd&&w&&(c=w.getData()):w=m.getPooled(t));var p=g.getPooled(l,n,r,o);if(c)p.data=c;else{var d=s(r);null!==d&&(p.data=d)}return h.accumulateTwoPhaseDispatches(p),p}function c(e,t){switch(e){case N.topCompositionEnd:return s(t);case N.topKeyPress:var n=t.which;return n!==P?null:(R=!0,M);case N.topTextInput:var r=t.data;return r===M&&R?null:r;default:return null}}function p(e,t){if(w){if(e===N.topCompositionEnd||u(e,t)){var n=w.getData();return m.release(w),w=null,n}return null}switch(e){case N.topPaste:return null;case N.topKeyPress:return t.which&&!o(t)?String.fromCharCode(t.which):null;case N.topCompositionEnd:return T?null:t.data;default:return null}}function d(e,t,n,r,o){var a;if(a=D?c(e,r):p(e,r),!a)return null;var i=y.getPooled(S.beforeInput,n,r,o);return i.data=a,h.accumulateTwoPhaseDispatches(i),i}var f=e(15),h=e(19),v=e(144),m=e(20),g=e(100),y=e(104),C=e(163),_=[9,13,27,32],E=229,b=v.canUseDOM&&"CompositionEvent"in window,x=null;v.canUseDOM&&"documentMode"in document&&(x=document.documentMode);var D=v.canUseDOM&&"TextEvent"in window&&!x&&!r(),T=v.canUseDOM&&(!b||x&&x>8&&11>=x),P=32,M=String.fromCharCode(P),N=f.topLevelTypes,S={beforeInput:{phasedRegistrationNames:{bubbled:C({onBeforeInput:null}),captured:C({onBeforeInputCapture:null})},dependencies:[N.topCompositionEnd,N.topKeyPress,N.topTextInput,N.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:C({onCompositionEnd:null}),captured:C({onCompositionEndCapture:null})},dependencies:[N.topBlur,N.topCompositionEnd,N.topKeyDown,N.topKeyPress,N.topKeyUp,N.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:C({onCompositionStart:null}),captured:C({onCompositionStartCapture:null})},dependencies:[N.topBlur,N.topCompositionStart,N.topKeyDown,N.topKeyPress,N.topKeyUp,N.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:C({onCompositionUpdate:null}),captured:C({onCompositionUpdateCapture:null})},dependencies:[N.topBlur,N.topCompositionUpdate,N.topKeyDown,N.topKeyPress,N.topKeyUp,N.topMouseDown]}},R=!1,w=null,I={eventTypes:S,extractEvents:function(e,t,n,r,o){return[l(e,t,n,r,o),d(e,t,n,r,o)]}};t.exports=I},{100:100,104:104,144:144,15:15,163:163,19:19,20:20}],4:[function(e,t,n){"use strict";function r(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var o={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},a=["Webkit","ms","Moz","O"];Object.keys(o).forEach(function(e){a.forEach(function(t){o[r(t,e)]=o[e]})});var i={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},u={isUnitlessNumber:o,shorthandPropertyExpansions:i};t.exports=u},{}],5:[function(e,t,n){"use strict";var r=e(4),o=e(144),a=e(76),i=(e(146),e(116)),u=e(157),s=e(165),l=(e(168),s(function(e){return u(e)})),c=!1,p="cssFloat";if(o.canUseDOM){var d=document.createElement("div").style;try{d.font=""}catch(f){c=!0}void 0===document.documentElement.style.cssFloat&&(p="styleFloat")}var h={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=l(n)+":",t+=i(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var o in t)if(t.hasOwnProperty(o)){var a=i(o,t[o]);if("float"===o&&(o=p),a)n[o]=a;else{var u=c&&r.shorthandPropertyExpansions[o];if(u)for(var s in u)n[s]="";else n[o]=""}}}};a.measureMethods(h,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),t.exports=h},{116:116,144:144,146:146,157:157,165:165,168:168,4:4,76:76}],6:[function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var o=e(25),a=e(24),i=e(158);a(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?i(!1):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),o.addPoolingTo(r),t.exports=r},{158:158,24:24,25:25}],7:[function(e,t,n){"use strict";function r(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function o(e){var t=x.getPooled(S.change,w,e,D(e));_.accumulateTwoPhaseDispatches(t),b.batchedUpdates(a,t)}function a(e){C.enqueueEvents(e),C.processEventQueue(!1)}function i(e,t){R=e,w=t,R.attachEvent("onchange",o)}function u(){R&&(R.detachEvent("onchange",o),R=null,w=null)}function s(e,t,n){return e===N.topChange?n:void 0}function l(e,t,n){e===N.topFocus?(u(),i(t,n)):e===N.topBlur&&u()}function c(e,t){R=e,w=t,I=e.value,O=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(R,"value",L),R.attachEvent("onpropertychange",d)}function p(){R&&(delete R.value,R.detachEvent("onpropertychange",d),R=null,w=null,I=null,O=null)}function d(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==I&&(I=t,o(e))}}function f(e,t,n){return e===N.topInput?n:void 0}function h(e,t,n){e===N.topFocus?(p(),c(t,n)):e===N.topBlur&&p()}function v(e,t,n){return e!==N.topSelectionChange&&e!==N.topKeyUp&&e!==N.topKeyDown||!R||R.value===I?void 0:(I=R.value,w)}function m(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,n){return e===N.topClick?n:void 0}var y=e(15),C=e(16),_=e(19),E=e(144),b=e(93),x=e(102),D=e(125),T=e(130),P=e(131),M=e(163),N=y.topLevelTypes,S={change:{phasedRegistrationNames:{bubbled:M({onChange:null}),captured:M({onChangeCapture:null})},dependencies:[N.topBlur,N.topChange,N.topClick,N.topFocus,N.topInput,N.topKeyDown,N.topKeyUp,N.topSelectionChange]}},R=null,w=null,I=null,O=null,k=!1;E.canUseDOM&&(k=T("change")&&(!("documentMode"in document)||document.documentMode>8));var A=!1;E.canUseDOM&&(A=T("input")&&(!("documentMode"in document)||document.documentMode>9));var L={get:function(){return O.get.call(this)},set:function(e){I=""+e,O.set.call(this,e)}},U={eventTypes:S,extractEvents:function(e,t,n,o,a){var i,u;if(r(t)?k?i=s:u=l:P(t)?A?i=f:(i=v,u=h):m(t)&&(i=g),i){var c=i(e,t,n);if(c){var p=x.getPooled(S.change,c,o,a);return p.type="change",_.accumulateTwoPhaseDispatches(p),p}}u&&u(e,t,n)}};t.exports=U},{102:102,125:125,130:130,131:131,144:144,15:15,16:16,163:163,19:19,93:93}],8:[function(e,t,n){"use strict";var r=0,o={createReactRootIndex:function(){return r++}};t.exports=o},{}],9:[function(e,t,n){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var o=e(12),a=e(72),i=e(76),u=e(135),s=e(136),l=e(158),c={dangerouslyReplaceNodeWithMarkup:o.dangerouslyReplaceNodeWithMarkup,updateTextContent:s,processUpdates:function(e,t){for(var n,i=null,c=null,p=0;p<e.length;p++)if(n=e[p],n.type===a.MOVE_EXISTING||n.type===a.REMOVE_NODE){var d=n.fromIndex,f=n.parentNode.childNodes[d],h=n.parentID;f?void 0:l(!1),i=i||{},i[h]=i[h]||[],i[h][d]=f,c=c||[],c.push(f)}var v;if(v=t.length&&"string"==typeof t[0]?o.dangerouslyRenderMarkup(t):t,c)for(var m=0;m<c.length;m++)c[m].parentNode.removeChild(c[m]);for(var g=0;g<e.length;g++)switch(n=e[g],n.type){case a.INSERT_MARKUP:r(n.parentNode,v[n.markupIndex],n.toIndex);break;case a.MOVE_EXISTING:r(n.parentNode,i[n.parentID][n.fromIndex],n.toIndex);break;case a.SET_MARKUP:u(n.parentNode,n.content);break;case a.TEXT_CONTENT:s(n.parentNode,n.content);break;case a.REMOVE_NODE:}}};i.measureMethods(c,"DOMChildrenOperations",{updateTextContent:"updateTextContent"}),t.exports=c},{12:12,135:135,136:136,158:158,72:72,76:76}],10:[function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var o=e(158),a={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=a,n=e.Properties||{},i=e.DOMAttributeNamespaces||{},s=e.DOMAttributeNames||{},l=e.DOMPropertyNames||{},c=e.DOMMutationMethods||{};e.isCustomAttribute&&u._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in n){u.properties.hasOwnProperty(p)?o(!1):void 0;var d=p.toLowerCase(),f=n[p],h={attributeName:d,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(f,t.MUST_USE_ATTRIBUTE),mustUseProperty:r(f,t.MUST_USE_PROPERTY),hasSideEffects:r(f,t.HAS_SIDE_EFFECTS),hasBooleanValue:r(f,t.HAS_BOOLEAN_VALUE),hasNumericValue:r(f,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(f,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(f,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(h.mustUseAttribute&&h.mustUseProperty?o(!1):void 0,!h.mustUseProperty&&h.hasSideEffects?o(!1):void 0,h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1?void 0:o(!1),s.hasOwnProperty(p)){var v=s[p];h.attributeName=v}i.hasOwnProperty(p)&&(h.attributeNamespace=i[p]),l.hasOwnProperty(p)&&(h.propertyName=l[p]),c.hasOwnProperty(p)&&(h.mutationMethod=c[p]),u.properties[p]=h}}},i={},u={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<u._isCustomAttributeFunctions.length;t++){var n=u._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=i[e];return r||(i[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:a};t.exports=u},{158:158}],11:[function(e,t,n){"use strict";function r(e){return c.hasOwnProperty(e)?!0:l.hasOwnProperty(e)?!1:s.test(e)?(c[e]=!0,!0):(l[e]=!0,!1)}function o(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&1>t||e.hasOverloadedBooleanValue&&t===!1}var a=e(10),i=e(76),u=e(133),s=(e(168),/^[a-zA-Z_][\w\.\-]*$/),l={},c={},p={createMarkupForID:function(e){return a.ID_ATTRIBUTE_NAME+"="+u(e)},setAttributeForID:function(e,t){e.setAttribute(a.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,t){var n=a.properties.hasOwnProperty(e)?a.properties[e]:null;if(n){if(o(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?r+'=""':r+"="+u(t)}return a.isCustomAttribute(e)?null==t?"":e+"="+u(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+u(t):""},setValueForProperty:function(e,t,n){var r=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(r){var i=r.mutationMethod;if(i)i(e,n);else if(o(r,n))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute){var u=r.attributeName,s=r.attributeNamespace;s?e.setAttributeNS(s,u,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?e.setAttribute(u,""):e.setAttribute(u,""+n)}else{var l=r.propertyName;r.hasSideEffects&&""+e[l]==""+n||(e[l]=n)}}else a.isCustomAttribute(t)&&p.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){var n=a.properties.hasOwnProperty(t)?a.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseAttribute)e.removeAttribute(n.attributeName);else{var o=n.propertyName,i=a.getDefaultValueForProperty(e.nodeName,o);n.hasSideEffects&&""+e[o]===i||(e[o]=i)}}else a.isCustomAttribute(t)&&e.removeAttribute(t)}};i.measureMethods(p,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),t.exports=p},{10:10,133:133,168:168,76:76}],12:[function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var o=e(144),a=e(149),i=e(150),u=e(154),s=e(158),l=/^(<[^ \/>]+)/,c="data-danger-index",p={dangerouslyRenderMarkup:function(e){o.canUseDOM?void 0:s(!1);for(var t,n={},p=0;p<e.length;p++)e[p]?void 0:s(!1),t=r(e[p]),t=u(t)?t:"*",n[t]=n[t]||[],n[t][p]=e[p];var d=[],f=0;for(t in n)if(n.hasOwnProperty(t)){var h,v=n[t];for(h in v)if(v.hasOwnProperty(h)){var m=v[h];v[h]=m.replace(l,"$1 "+c+'="'+h+'" ')}for(var g=a(v.join(""),i),y=0;y<g.length;++y){var C=g[y];C.hasAttribute&&C.hasAttribute(c)&&(h=+C.getAttribute(c),C.removeAttribute(c),d.hasOwnProperty(h)?s(!1):void 0,d[h]=C,f+=1)}}return f!==d.length?s(!1):void 0,d.length!==e.length?s(!1):void 0,d},dangerouslyReplaceNodeWithMarkup:function(e,t){o.canUseDOM?void 0:s(!1),t?void 0:s(!1),"html"===e.tagName.toLowerCase()?s(!1):void 0;var n;n="string"==typeof t?a(t,i)[0]:t,e.parentNode.replaceChild(n,e)}};t.exports=p},{144:144,149:149,150:150,154:154,158:158}],13:[function(e,t,n){"use strict";var r=e(163),o=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null})];t.exports=o},{163:163}],14:[function(e,t,n){"use strict";var r=e(15),o=e(19),a=e(106),i=e(70),u=e(163),s=r.topLevelTypes,l=i.getFirstReactDOM,c={mouseEnter:{registrationName:u({onMouseEnter:null}),dependencies:[s.topMouseOut,s.topMouseOver]},mouseLeave:{registrationName:u({onMouseLeave:null}),dependencies:[s.topMouseOut,s.topMouseOver]}},p=[null,null],d={eventTypes:c,extractEvents:function(e,t,n,r,u){if(e===s.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==s.topMouseOut&&e!==s.topMouseOver)return null;var d;if(t.window===t)d=t;else{var f=t.ownerDocument;d=f?f.defaultView||f.parentWindow:window}var h,v,m="",g="";if(e===s.topMouseOut?(h=t,m=n,v=l(r.relatedTarget||r.toElement),v?g=i.getID(v):v=d,v=v||d):(h=d,v=t,g=n),h===v)return null;var y=a.getPooled(c.mouseLeave,m,r,u);y.type="mouseleave",y.target=h,y.relatedTarget=v;var C=a.getPooled(c.mouseEnter,g,r,u);return C.type="mouseenter",C.target=v,C.relatedTarget=h,o.accumulateEnterLeaveDispatches(y,C,m,g),p[0]=y,p[1]=C,p}};t.exports=d},{106:106,15:15,163:163,19:19,70:70}],15:[function(e,t,n){"use strict";var r=e(162),o=r({bubbled:null,captured:null}),a=r({topAbort:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topVolumeChange:null,topWaiting:null,topWheel:null}),i={topLevelTypes:a,PropagationPhases:o};t.exports=i},{162:162}],16:[function(e,t,n){"use strict";var r=e(17),o=e(18),a=e(59),i=e(112),u=e(121),s=e(158),l=(e(168),{}),c=null,p=function(e,t){e&&(o.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},d=function(e){return p(e,!0)},f=function(e){return p(e,!1)},h=null,v={injection:{injectMount:o.injection.injectMount,injectInstanceHandle:function(e){h=e},getInstanceHandle:function(){return h},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,n){"function"!=typeof n?s(!1):void 0;var o=l[t]||(l[t]={});o[e]=n;var a=r.registrationNameModules[t];a&&a.didPutListener&&a.didPutListener(e,t,n)},getListener:function(e,t){var n=l[t];return n&&n[e]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var o=l[t];o&&delete o[e]},deleteAllListeners:function(e){for(var t in l)if(l[t][e]){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete l[t][e]}},extractEvents:function(e,t,n,o,a){for(var u,s=r.plugins,l=0;l<s.length;l++){var c=s[l];if(c){var p=c.extractEvents(e,t,n,o,a);p&&(u=i(u,p))}}return u},enqueueEvents:function(e){e&&(c=i(c,e))},processEventQueue:function(e){var t=c;c=null,e?u(t,d):u(t,f),c?s(!1):void 0,a.rethrowCaughtError()},__purge:function(){l={}},__getListenerBank:function(){return l}};t.exports=v},{112:112,121:121,158:158,168:168,17:17,18:18,59:59}],17:[function(e,t,n){"use strict";function r(){if(u)for(var e in s){var t=s[e],n=u.indexOf(e);if(n>-1?void 0:i(!1),!l.plugins[n]){t.extractEvents?void 0:i(!1),l.plugins[n]=t;var r=t.eventTypes;for(var a in r)o(r[a],t,a)?void 0:i(!1)}}}function o(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)?i(!1):void 0,l.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var o in r)if(r.hasOwnProperty(o)){var u=r[o];a(u,t,n)}return!0}return e.registrationName?(a(e.registrationName,t,n),!0):!1}function a(e,t,n){l.registrationNameModules[e]?i(!1):void 0,l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var i=e(158),u=null,s={},l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){u?i(!1):void 0,u=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];s.hasOwnProperty(n)&&s[n]===o||(s[n]?i(!1):void 0,s[n]=o,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=l.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){u=null;for(var e in s)s.hasOwnProperty(e)&&delete s[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var o in r)r.hasOwnProperty(o)&&delete r[o]}};t.exports=l},{158:158}],18:[function(e,t,n){"use strict";function r(e){return e===m.topMouseUp||e===m.topTouchEnd||e===m.topTouchCancel}function o(e){return e===m.topMouseMove||e===m.topTouchMove}function a(e){return e===m.topMouseDown||e===m.topTouchStart}function i(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?f.invokeGuardedCallbackWithCatch(o,n,e,r):f.invokeGuardedCallback(o,n,e,r),e.currentTarget=null}function u(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)i(e,t,n[o],r[o]);else n&&i(e,t,n,r);e._dispatchListeners=null,e._dispatchIDs=null}function s(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function l(e){var t=s(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function c(e){var t=e._dispatchListeners,n=e._dispatchIDs;Array.isArray(t)?h(!1):void 0;var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function p(e){return!!e._dispatchListeners}var d=e(15),f=e(59),h=e(158),v=(e(168),{Mount:null,injectMount:function(e){v.Mount=e}}),m=d.topLevelTypes,g={isEndish:r,isMoveish:o,isStartish:a,executeDirectDispatch:c,executeDispatchesInOrder:u,executeDispatchesInOrderStopAtTrue:l,hasDispatches:p,getNode:function(e){return v.Mount.getNode(e)},getID:function(e){return v.Mount.getID(e)},injection:v};t.exports=g},{15:15,158:158,168:168,59:59}],19:[function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return y(e,r)}function o(e,t,n){var o=t?g.bubbled:g.captured,a=r(e,n,o);a&&(n._dispatchListeners=v(n._dispatchListeners,a),n._dispatchIDs=v(n._dispatchIDs,e))}function a(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,o,e)}function i(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(e.dispatchMarker,o,e)}function u(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,o=y(e,r);o&&(n._dispatchListeners=v(n._dispatchListeners,o),n._dispatchIDs=v(n._dispatchIDs,e))}}function s(e){e&&e.dispatchConfig.registrationName&&u(e.dispatchMarker,null,e)}function l(e){m(e,a)}function c(e){m(e,i)}function p(e,t,n,r){h.injection.getInstanceHandle().traverseEnterLeave(n,r,u,e,t)}function d(e){m(e,s)}var f=e(15),h=e(16),v=(e(168),e(112)),m=e(121),g=f.PropagationPhases,y=h.getListener,C={accumulateTwoPhaseDispatches:l,accumulateTwoPhaseDispatchesSkipTarget:c,accumulateDirectDispatches:d,accumulateEnterLeaveDispatches:p};t.exports=C},{112:112,121:121,15:15,16:16,168:168}],20:[function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var o=e(25),a=e(24),i=e(128);a(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[i()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,o=this.getText(),a=o.length;for(e=0;r>e&&n[e]===o[e];e++);var i=r-e;for(t=1;i>=t&&n[r-t]===o[a-t];t++);var u=t>1?1-t:void 0;return this._fallbackText=o.slice(e,u),this._fallbackText}}),o.addPoolingTo(r),t.exports=r},{128:128,24:24,25:25}],21:[function(e,t,n){"use strict";var r,o=e(10),a=e(144),i=o.injection.MUST_USE_ATTRIBUTE,u=o.injection.MUST_USE_PROPERTY,s=o.injection.HAS_BOOLEAN_VALUE,l=o.injection.HAS_SIDE_EFFECTS,c=o.injection.HAS_NUMERIC_VALUE,p=o.injection.HAS_POSITIVE_NUMERIC_VALUE,d=o.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(a.canUseDOM){var f=document.implementation;r=f&&f.hasFeature&&f.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:i|s,allowTransparency:i,alt:null,async:s,autoComplete:null,autoPlay:s,capture:i|s,cellPadding:null,cellSpacing:null,charSet:i,challenge:i,checked:u|s,classID:i,className:r?i:u,cols:i|p,colSpan:null,content:null,contentEditable:null,contextMenu:i,controls:u|s,coords:null,crossOrigin:null,data:null,dateTime:i,"default":s,defer:s,dir:null,disabled:i|s,download:d,draggable:null,encType:null,form:i,formAction:i,formEncType:i,formMethod:i,formNoValidate:s,formTarget:i,frameBorder:i,headers:null,height:i,hidden:i|s,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:u,inputMode:i,integrity:null,is:i,keyParams:i,keyType:i,kind:null,label:null,lang:null,list:i,loop:u|s,low:null,manifest:i,marginHeight:null,marginWidth:null,max:null,maxLength:i,media:i,mediaGroup:null,method:null,min:null,minLength:i,multiple:u|s,muted:u|s,name:null,nonce:i,noValidate:s,open:s,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:u|s,rel:null,required:s,reversed:s,role:i,rows:i|p,rowSpan:null,sandbox:null,scope:null,scoped:s,scrolling:null,seamless:i|s,selected:u|s,shape:null,size:i|p,sizes:i,span:p,spellCheck:null,src:null,srcDoc:u,srcLang:null,srcSet:i,start:c,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:u|l,width:i,wmode:i,wrap:null,about:i,datatype:i,inlist:i,prefix:i,property:i,resource:i,"typeof":i,vocab:i,autoCapitalize:i,autoCorrect:i,autoSave:null,color:null,itemProp:i,itemScope:i|s,itemType:i,itemID:i,itemRef:i,results:null,security:i,unselectable:i},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};t.exports=h},{10:10,144:144}],22:[function(e,t,n){"use strict";var r=e(68),o=e(88),a={linkState:function(e){return new r(this.state[e],o.createStateKeySetter(this,e))}};t.exports=a},{68:68,88:88}],23:[function(e,t,n){"use strict";function r(e){null!=e.checkedLink&&null!=e.valueLink?l(!1):void 0}function o(e){r(e),null!=e.value||null!=e.onChange?l(!1):void 0}function a(e){r(e),null!=e.checked||null!=e.onChange?l(!1):void 0}function i(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var u=e(80),s=e(79),l=e(158),c=(e(168),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),p={value:function(e,t,n){return!e[t]||c[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t,n){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:u.func},d={},f={checkPropTypes:function(e,t,n){for(var r in p){if(p.hasOwnProperty(r))var o=p[r](t,r,e,s.prop,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");o instanceof Error&&!(o.message in d)&&(d[o.message]=!0,i(n))}},getValue:function(e){return e.valueLink?(o(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(a(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(o(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(a(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};t.exports=f},{158:158,168:168,79:79,80:80}],24:[function(e,t,n){"use strict";function r(e,t){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var n=Object(e),r=Object.prototype.hasOwnProperty,o=1;o<arguments.length;o++){var a=arguments[o];if(null!=a){var i=Object(a);for(var u in i)r.call(i,u)&&(n[u]=i[u])}}return n}t.exports=r},{}],25:[function(e,t,n){"use strict";var r=e(158),o=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},a=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},i=function(e,t,n){var r=this;if(r.instancePool.length){var o=r.instancePool.pop();return r.call(o,e,t,n),o}return new r(e,t,n)},u=function(e,t,n,r){var o=this;if(o.instancePool.length){var a=o.instancePool.pop();return o.call(a,e,t,n,r),a}return new o(e,t,n,r)},s=function(e,t,n,r,o){var a=this;if(a.instancePool.length){var i=a.instancePool.pop();return a.call(i,e,t,n,r,o),i}return new a(e,t,n,r,o)},l=function(e){var t=this;e instanceof t?void 0:r(!1),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},c=10,p=o,d=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||p,n.poolSize||(n.poolSize=c),n.release=l,n},f={addPoolingTo:d,oneArgumentPooler:o,twoArgumentPooler:a,threeArgumentPooler:i,fourArgumentPooler:u,fiveArgumentPooler:s};t.exports=f},{158:158}],26:[function(e,t,n){"use strict";var r=e(40),o=e(50),a=e(67),i=e(24),u=e(117),s={};i(s,a),i(s,{findDOMNode:u("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:u("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:u("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:u("renderToString","ReactDOMServer","react-dom/server",o,o.renderToString),renderToStaticMarkup:u("renderToStaticMarkup","ReactDOMServer","react-dom/server",o,o.renderToStaticMarkup)}),s.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,s.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=o,t.exports=s},{117:117,24:24,40:40,50:50,67:67}],27:[function(e,t,n){"use strict";var r=(e(66),e(119)),o=(e(168),"_getDOMNodeDidWarn"),a={getDOMNode:function(){return this.constructor[o]=!0,r(this)}};t.exports=a},{119:119,168:168,66:66}],28:[function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,m)||(e[m]=h++,d[e[m]]={}),d[e[m]]}var o=e(15),a=e(16),i=e(17),u=e(60),s=e(76),l=e(111),c=e(24),p=e(130),d={},f=!1,h=0,v={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",
+topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},m="_reactListenersID"+String(Math.random()).slice(2),g=c({},u,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(g.handleTopLevel),g.ReactEventListener=e}},setEnabled:function(e){g.ReactEventListener&&g.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!g.ReactEventListener||!g.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,a=r(n),u=i.registrationNameDependencies[e],s=o.topLevelTypes,l=0;l<u.length;l++){var c=u[l];a.hasOwnProperty(c)&&a[c]||(c===s.topWheel?p("wheel")?g.ReactEventListener.trapBubbledEvent(s.topWheel,"wheel",n):p("mousewheel")?g.ReactEventListener.trapBubbledEvent(s.topWheel,"mousewheel",n):g.ReactEventListener.trapBubbledEvent(s.topWheel,"DOMMouseScroll",n):c===s.topScroll?p("scroll",!0)?g.ReactEventListener.trapCapturedEvent(s.topScroll,"scroll",n):g.ReactEventListener.trapBubbledEvent(s.topScroll,"scroll",g.ReactEventListener.WINDOW_HANDLE):c===s.topFocus||c===s.topBlur?(p("focus",!0)?(g.ReactEventListener.trapCapturedEvent(s.topFocus,"focus",n),g.ReactEventListener.trapCapturedEvent(s.topBlur,"blur",n)):p("focusin")&&(g.ReactEventListener.trapBubbledEvent(s.topFocus,"focusin",n),g.ReactEventListener.trapBubbledEvent(s.topBlur,"focusout",n)),a[s.topBlur]=!0,a[s.topFocus]=!0):v.hasOwnProperty(c)&&g.ReactEventListener.trapBubbledEvent(c,v[c],n),a[c]=!0)}},trapBubbledEvent:function(e,t,n){return g.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return g.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!f){var e=l.refreshScrollValues;g.ReactEventListener.monitorScrollValue(e),f=!0}},eventNameDispatchConfigs:a.eventNameDispatchConfigs,registrationNameModules:a.registrationNameModules,putListener:a.putListener,getListener:a.getListener,deleteListener:a.deleteListener,deleteAllListeners:a.deleteAllListeners});s.measureMethods(g,"ReactBrowserEventEmitter",{putListener:"putListener",deleteListener:"deleteListener"}),t.exports=g},{111:111,130:130,15:15,16:16,17:17,24:24,60:60,76:76}],29:[function(e,t,n){"use strict";function r(e){var t="transition"+e+"Timeout",n="transition"+e;return function(e){if(e[n]){if(null==e[t])return new Error(t+" wasn't supplied to ReactCSSTransitionGroup: this can cause unreliable animations and won't be supported in a future version of React. See https://fb.me/react-animation-transition-group-timeout for more information.");if("number"!=typeof e[t])return new Error(t+" must be a number (in milliseconds)")}}}var o=e(26),a=e(24),i=e(91),u=e(30),s=o.createClass({displayName:"ReactCSSTransitionGroup",propTypes:{transitionName:u.propTypes.name,transitionAppear:o.PropTypes.bool,transitionEnter:o.PropTypes.bool,transitionLeave:o.PropTypes.bool,transitionAppearTimeout:r("Appear"),transitionEnterTimeout:r("Enter"),transitionLeaveTimeout:r("Leave")},getDefaultProps:function(){return{transitionAppear:!1,transitionEnter:!0,transitionLeave:!0}},_wrapChild:function(e){return o.createElement(u,{name:this.props.transitionName,appear:this.props.transitionAppear,enter:this.props.transitionEnter,leave:this.props.transitionLeave,appearTimeout:this.props.transitionAppearTimeout,enterTimeout:this.props.transitionEnterTimeout,leaveTimeout:this.props.transitionLeaveTimeout},e)},render:function(){return o.createElement(i,a({},this.props,{childFactory:this._wrapChild}))}});t.exports=s},{24:24,26:26,30:30,91:91}],30:[function(e,t,n){"use strict";var r=e(26),o=e(40),a=e(142),i=e(90),u=e(132),s=17,l=r.createClass({displayName:"ReactCSSTransitionGroupChild",propTypes:{name:r.PropTypes.oneOfType([r.PropTypes.string,r.PropTypes.shape({enter:r.PropTypes.string,leave:r.PropTypes.string,active:r.PropTypes.string}),r.PropTypes.shape({enter:r.PropTypes.string,enterActive:r.PropTypes.string,leave:r.PropTypes.string,leaveActive:r.PropTypes.string,appear:r.PropTypes.string,appearActive:r.PropTypes.string})]).isRequired,appear:r.PropTypes.bool,enter:r.PropTypes.bool,leave:r.PropTypes.bool,appearTimeout:r.PropTypes.number,enterTimeout:r.PropTypes.number,leaveTimeout:r.PropTypes.number},transition:function(e,t,n){var r=o.findDOMNode(this);if(!r)return void(t&&t());var u=this.props.name[e]||this.props.name+"-"+e,s=this.props.name[e+"Active"]||u+"-active",l=null,c=function(e){e&&e.target!==r||(clearTimeout(l),a.removeClass(r,u),a.removeClass(r,s),i.removeEndEventListener(r,c),t&&t())};a.addClass(r,u),this.queueClass(s),n?(l=setTimeout(c,n),this.transitionTimeouts.push(l)):i.addEndEventListener(r,c)},queueClass:function(e){this.classNameQueue.push(e),this.timeout||(this.timeout=setTimeout(this.flushClassNameQueue,s))},flushClassNameQueue:function(){this.isMounted()&&this.classNameQueue.forEach(a.addClass.bind(a,o.findDOMNode(this))),this.classNameQueue.length=0,this.timeout=null},componentWillMount:function(){this.classNameQueue=[],this.transitionTimeouts=[]},componentWillUnmount:function(){this.timeout&&clearTimeout(this.timeout),this.transitionTimeouts.forEach(function(e){clearTimeout(e)})},componentWillAppear:function(e){this.props.appear?this.transition("appear",e,this.props.appearTimeout):e()},componentWillEnter:function(e){this.props.enter?this.transition("enter",e,this.props.enterTimeout):e()},componentWillLeave:function(e){this.props.leave?this.transition("leave",e,this.props.leaveTimeout):e()},render:function(){return u(this.props.children)}});t.exports=l},{132:132,142:142,26:26,40:40,90:90}],31:[function(e,t,n){"use strict";function r(e,t,n){var r=void 0===e[n];null!=t&&r&&(e[n]=a(t,null))}var o=e(82),a=e(129),i=e(138),u=e(139),s=(e(168),{instantiateChildren:function(e,t,n){if(null==e)return null;var o={};return u(e,r,o),o},updateChildren:function(e,t,n,r){if(!t&&!e)return null;var u;for(u in t)if(t.hasOwnProperty(u)){var s=e&&e[u],l=s&&s._currentElement,c=t[u];if(null!=s&&i(l,c))o.receiveComponent(s,c,n,r),t[u]=s;else{s&&o.unmountComponent(s,u);var p=a(c,null);t[u]=p}}for(u in e)!e.hasOwnProperty(u)||t&&t.hasOwnProperty(u)||o.unmountComponent(e[u]);return t},unmountChildren:function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];o.unmountComponent(n)}}});t.exports=s},{129:129,138:138,139:139,168:168,82:82}],32:[function(e,t,n){"use strict";function r(e){return(""+e).replace(_,"//")}function o(e,t){this.func=e,this.context=t,this.count=0}function a(e,t,n){var r=e.func,o=e.context;r.call(o,t,e.count++)}function i(e,t,n){if(null==e)return e;var r=o.getPooled(t,n);g(e,a,r),o.release(r)}function u(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function s(e,t,n){var o=e.result,a=e.keyPrefix,i=e.func,u=e.context,s=i.call(u,t,e.count++);Array.isArray(s)?l(s,o,n,m.thatReturnsArgument):null!=s&&(v.isValidElement(s)&&(s=v.cloneAndReplaceKey(s,a+(s!==t?r(s.key||"")+"/":"")+n)),o.push(s))}function l(e,t,n,o,a){var i="";null!=n&&(i=r(n)+"/");var l=u.getPooled(t,i,o,a);g(e,s,l),u.release(l)}function c(e,t,n){if(null==e)return e;var r=[];return l(e,r,null,t,n),r}function p(e,t,n){return null}function d(e,t){return g(e,p,null)}function f(e){var t=[];return l(e,t,null,m.thatReturnsArgument),t}var h=e(25),v=e(55),m=e(150),g=e(139),y=h.twoArgumentPooler,C=h.fourArgumentPooler,_=/\/(?!\/)/g;o.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},h.addPoolingTo(o,y),u.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h.addPoolingTo(u,C);var E={forEach:i,map:c,mapIntoWithKeyPrefixInternal:l,count:d,toArray:f};t.exports=E},{139:139,150:150,25:25,55:55}],33:[function(e,t,n){"use strict";function r(e,t){var n=b.hasOwnProperty(t)?b[t]:null;D.hasOwnProperty(t)&&(n!==_.OVERRIDE_BASE?m(!1):void 0),e.hasOwnProperty(t)&&(n!==_.DEFINE_MANY&&n!==_.DEFINE_MANY_MERGED?m(!1):void 0)}function o(e,t){if(t){"function"==typeof t?m(!1):void 0,d.isValidElement(t)?m(!1):void 0;var n=e.prototype;t.hasOwnProperty(C)&&x.mixins(e,t.mixins);for(var o in t)if(t.hasOwnProperty(o)&&o!==C){var a=t[o];if(r(n,o),x.hasOwnProperty(o))x[o](e,a);else{var i=b.hasOwnProperty(o),l=n.hasOwnProperty(o),c="function"==typeof a,p=c&&!i&&!l&&t.autobind!==!1;if(p)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[o]=a,n[o]=a;else if(l){var f=b[o];!i||f!==_.DEFINE_MANY_MERGED&&f!==_.DEFINE_MANY?m(!1):void 0,f===_.DEFINE_MANY_MERGED?n[o]=u(n[o],a):f===_.DEFINE_MANY&&(n[o]=s(n[o],a))}else n[o]=a}}}}function a(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var o=n in x;o?m(!1):void 0;var a=n in e;a?m(!1):void 0,e[n]=r}}}function i(e,t){e&&t&&"object"==typeof e&&"object"==typeof t?void 0:m(!1);for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?m(!1):void 0,e[n]=t[n]);return e}function u(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var o={};return i(o,n),i(o,r),o}}function s(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function l(e,t){var n=t.bind(e);return n}function c(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=l(e,n)}}var p=e(34),d=e(55),f=(e(79),e(78),e(74)),h=e(24),v=e(151),m=e(158),g=e(162),y=e(163),C=(e(168),y({mixins:null})),_=g({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),E=[],b={mixins:_.DEFINE_MANY,statics:_.DEFINE_MANY,propTypes:_.DEFINE_MANY,contextTypes:_.DEFINE_MANY,childContextTypes:_.DEFINE_MANY,getDefaultProps:_.DEFINE_MANY_MERGED,getInitialState:_.DEFINE_MANY_MERGED,getChildContext:_.DEFINE_MANY_MERGED,render:_.DEFINE_ONCE,componentWillMount:_.DEFINE_MANY,componentDidMount:_.DEFINE_MANY,componentWillReceiveProps:_.DEFINE_MANY,shouldComponentUpdate:_.DEFINE_ONCE,componentWillUpdate:_.DEFINE_MANY,componentDidUpdate:_.DEFINE_MANY,componentWillUnmount:_.DEFINE_MANY,updateComponent:_.OVERRIDE_BASE},x={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)o(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=h({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=h({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps?e.getDefaultProps=u(e.getDefaultProps,t):e.getDefaultProps=t},propTypes:function(e,t){e.propTypes=h({},e.propTypes,t)},statics:function(e,t){a(e,t)},autobind:function(){}},D={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t)},isMounted:function(){return this.updater.isMounted(this)},setProps:function(e,t){this.updater.enqueueSetProps(this,e),t&&this.updater.enqueueCallback(this,t)},replaceProps:function(e,t){this.updater.enqueueReplaceProps(this,e),t&&this.updater.enqueueCallback(this,t)}},T=function(){};h(T.prototype,p.prototype,D);var P={createClass:function(e){var t=function(e,t,n){this.__reactAutoBindMap&&c(this),this.props=e,this.context=t,this.refs=v,this.updater=n||f,this.state=null;var r=this.getInitialState?this.getInitialState():null;"object"!=typeof r||Array.isArray(r)?m(!1):void 0,this.state=r};t.prototype=new T,t.prototype.constructor=t,E.forEach(o.bind(null,t)),o(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:m(!1);for(var n in b)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){E.push(e)}}};t.exports=P},{151:151,158:158,162:162,163:163,168:168,24:24,34:34,55:55,74:74,78:78,79:79}],34:[function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=a,this.updater=n||o}var o=e(74),a=(e(114),e(151)),i=e(158);e(168);r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e?i(!1):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t)},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e)};t.exports=r},{114:114,151:151,158:158,168:168,74:74}],35:[function(e,t,n){"use strict";var r=e(45),o=e(70),a={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:r.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){o.purgeID(e)}};t.exports=a},{45:45,70:70}],36:[function(e,t,n){"use strict";var r=e(158),o=!1,a={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){o?r(!1):void 0,a.unmountIDFromEnvironment=e.unmountIDFromEnvironment,a.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,a.processChildrenUpdates=e.processChildrenUpdates,o=!0}}};t.exports=a},{158:158}],37:[function(e,t,n){"use strict";var r=e(137),o={shouldComponentUpdate:function(e,t){return r(this,e,t)}};t.exports=o},{137:137}],38:[function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}function o(e){}var a=e(36),i=e(39),u=e(55),s=e(66),l=e(76),c=e(79),p=(e(78),e(82)),d=e(92),f=e(24),h=e(151),v=e(158),m=e(138);e(168);o.prototype.render=function(){var e=s.get(this)._currentElement.type;return e(this.props,this.context,this.updater)};var g=1,y={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null},mountComponent:function(e,t,n){this._context=n,this._mountOrder=g++,this._rootNodeID=e;var r,a,i=this._processProps(this._currentElement.props),l=this._processContext(n),c=this._currentElement.type,f="prototype"in c;f&&(r=new c(i,l,d)),(!f||null===r||r===!1||u.isValidElement(r))&&(a=r,r=new o(c)),r.props=i,r.context=l,r.refs=h,r.updater=d,this._instance=r,s.set(r,this);var m=r.state;void 0===m&&(r.state=m=null),"object"!=typeof m||Array.isArray(m)?v(!1):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,r.componentWillMount&&(r.componentWillMount(),this._pendingStateQueue&&(r.state=this._processPendingState(r.props,r.context))),void 0===a&&(a=this._renderValidatedComponent()),this._renderedComponent=this._instantiateReactComponent(a);var y=p.mountComponent(this._renderedComponent,e,t,this._processChildContext(n));return r.componentDidMount&&t.getReactMountReady().enqueue(r.componentDidMount,r),y},unmountComponent:function(){var e=this._instance;e.componentWillUnmount&&e.componentWillUnmount(),p.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._instance=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,this._topLevelWrapper=null,s.remove(e)},_maskContext:function(e){var t=null,n=this._currentElement.type,r=n.contextTypes;if(!r)return h;t={};for(var o in r)t[o]=e[o];return t},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._currentElement.type,n=this._instance,r=n.getChildContext&&n.getChildContext();if(r){"object"!=typeof t.childContextTypes?v(!1):void 0;for(var o in r)o in t.childContextTypes?void 0:v(!1);return f({},e,r)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var o=this.getName();for(var a in e)if(e.hasOwnProperty(a)){var i;try{"function"!=typeof e[a]?v(!1):void 0,i=e[a](t,a,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){i=u}i instanceof Error&&(r(this),n===c.prop)}},receiveComponent:function(e,t,n){var r=this._currentElement,o=this._context;this._pendingElement=null,this.updateComponent(t,r,e,o,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&p.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},updateComponent:function(e,t,n,r,o){var a,i=this._instance,u=this._context===o?i.context:this._processContext(o);t===n?a=n.props:(a=this._processProps(n.props),i.componentWillReceiveProps&&i.componentWillReceiveProps(a,u));var s=this._processPendingState(a,u),l=this._pendingForceUpdate||!i.shouldComponentUpdate||i.shouldComponentUpdate(a,s,u);l?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,a,s,u,e,o)):(this._currentElement=n,this._context=o,i.props=a,i.state=s,i.context=u)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,o=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(o&&1===r.length)return r[0];for(var a=f({},o?r[0]:n.state),i=o?1:0;i<r.length;i++){var u=r[i];f(a,"function"==typeof u?u.call(n,a,e,t):u)}return a},_performComponentUpdate:function(e,t,n,r,o,a){var i,u,s,l=this._instance,c=Boolean(l.componentDidUpdate);c&&(i=l.props,u=l.state,s=l.context),l.componentWillUpdate&&l.componentWillUpdate(t,n,r),this._currentElement=e,this._context=a,l.props=t,l.state=n,l.context=r,this._updateRenderedComponent(o,a),c&&o.getReactMountReady().enqueue(l.componentDidUpdate.bind(l,i,u,s),l)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,o=this._renderValidatedComponent();if(m(r,o))p.receiveComponent(n,o,e,this._processChildContext(t));else{var a=this._rootNodeID,i=n._rootNodeID;p.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(o);var u=p.mountComponent(this._renderedComponent,a,e,this._processChildContext(t));this._replaceNodeWithMarkupByID(i,u)}},_replaceNodeWithMarkupByID:function(e,t){a.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e;i.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{i.current=null}return null===e||e===!1||u.isValidElement(e)?void 0:v(!1),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?v(!1):void 0;var r=t.getPublicInstance(),o=n.refs===h?n.refs={}:n.refs;o[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return e instanceof o?null:e},_instantiateReactComponent:null};l.measureMethods(y,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var C={Mixin:y};t.exports=C},{138:138,151:151,158:158,168:168,24:24,36:36,39:39,55:55,66:66,76:76,78:78,79:79,82:82,92:92}],39:[function(e,t,n){"use strict";var r={current:null};t.exports=r},{}],40:[function(e,t,n){"use strict";var r=e(39),o=e(51),a=e(54),i=e(65),u=e(70),s=e(76),l=e(82),c=e(93),p=e(94),d=e(119),f=e(134);e(168);a.inject();var h=s.measure("React","render",u.render),v={findDOMNode:d,render:h,unmountComponentAtNode:u.unmountComponentAtNode,version:p,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:i,Mount:u,Reconciler:l,TextComponent:o});t.exports=v},{119:119,134:134,168:168,39:39,51:51,54:54,65:65,70:70,76:76,82:82,93:93,94:94}],41:[function(e,t,n){"use strict";var r={onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0},o={getNativeProps:function(e,t,n){if(!t.disabled)return t;var o={};for(var a in t)t.hasOwnProperty(a)&&!r[a]&&(o[a]=t[a]);return o}};t.exports=o},{}],42:[function(e,t,n){"use strict";function r(){return this}function o(){var e=this._reactInternalComponent;return!!e}function a(){}function i(e,t){var n=this._reactInternalComponent;n&&(I.enqueueSetPropsInternal(n,e),t&&I.enqueueCallbackInternal(n,t))}function u(e,t){var n=this._reactInternalComponent;n&&(I.enqueueReplacePropsInternal(n,e),t&&I.enqueueCallbackInternal(n,t))}function s(e,t){t&&(null!=t.dangerouslySetInnerHTML&&(null!=t.children?L(!1):void 0,"object"==typeof t.dangerouslySetInnerHTML&&Y in t.dangerouslySetInnerHTML?void 0:L(!1)),null!=t.style&&"object"!=typeof t.style?L(!1):void 0)}function l(e,t,n,r){var o=S.findReactContainerForID(e);if(o){var a=o.nodeType===z?o.ownerDocument:o;W(t,a)}r.getReactMountReady().enqueue(c,{id:e,registrationName:t,listener:n})}function c(){var e=this;b.putListener(e.id,e.registrationName,e.listener)}function p(){var e=this;e._rootNodeID?void 0:L(!1);var t=S.getNode(e._rootNodeID);switch(t?void 0:L(!1),e._tag){case"iframe":e._wrapperState.listeners=[b.trapBubbledEvent(E.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in G)G.hasOwnProperty(n)&&e._wrapperState.listeners.push(b.trapBubbledEvent(E.topLevelTypes[n],G[n],t));break;case"img":e._wrapperState.listeners=[b.trapBubbledEvent(E.topLevelTypes.topError,"error",t),b.trapBubbledEvent(E.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[b.trapBubbledEvent(E.topLevelTypes.topReset,"reset",t),b.trapBubbledEvent(E.topLevelTypes.topSubmit,"submit",t)]}}function d(){T.mountReadyWrapper(this)}function f(){M.postUpdateWrapper(this)}function h(e){J.call(Z,e)||($.test(e)?void 0:L(!1),Z[e]=!0)}function v(e,t){return e.indexOf("-")>=0||null!=t.is}function m(e){h(e),this._tag=e.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var g=e(2),y=e(5),C=e(10),_=e(11),E=e(15),b=e(28),x=e(35),D=e(41),T=e(46),P=e(47),M=e(48),N=e(52),S=e(70),R=e(71),w=e(76),I=e(92),O=e(24),k=e(114),A=e(118),L=e(158),U=(e(130),e(163)),F=e(135),B=e(136),V=(e(166),e(141),e(168),b.deleteListener),W=b.listenTo,j=b.registrationNameModules,K={string:!0,number:!0},q=U({children:null}),H=U({style:null}),Y=U({__html:null}),z=1,G={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},Q={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},X={listing:!0,pre:!0,textarea:!0},$=(O({menuitem:!0},Q),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),Z={},J={}.hasOwnProperty;m.displayName="ReactDOMComponent",m.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e;var r=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},t.getReactMountReady().enqueue(p,this);break;case"button":r=D.getNativeProps(this,r,n);break;case"input":T.mountWrapper(this,r,n),r=T.getNativeProps(this,r,n);break;case"option":P.mountWrapper(this,r,n),r=P.getNativeProps(this,r,n);break;case"select":M.mountWrapper(this,r,n),r=M.getNativeProps(this,r,n),n=M.processChildContext(this,r,n);break;case"textarea":N.mountWrapper(this,r,n),r=N.getNativeProps(this,r,n)}s(this,r);var o;if(t.useCreateElement){var a=n[S.ownerDocumentContextKey],i=a.createElement(this._currentElement.type);_.setAttributeForID(i,this._rootNodeID),S.getID(i),this._updateDOMProperties({},r,t,i),this._createInitialChildren(t,r,n,i),o=i}else{var u=this._createOpenTagMarkupAndPutListeners(t,r),l=this._createContentMarkup(t,r,n);o=!l&&Q[this._tag]?u+"/>":u+">"+l+"</"+this._currentElement.type+">"}switch(this._tag){case"input":t.getReactMountReady().enqueue(d,this);case"button":case"select":case"textarea":r.autoFocus&&t.getReactMountReady().enqueue(g.focusDOMComponent,this)}return o},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if(null!=o)if(j.hasOwnProperty(r))o&&l(this._rootNodeID,r,o,e);else{r===H&&(o&&(o=this._previousStyleCopy=O({},t.style)),o=y.createMarkupForStyles(o));var a=null;null!=this._tag&&v(this._tag,t)?r!==q&&(a=_.createMarkupForCustomAttribute(r,o)):a=_.createMarkupForProperty(r,o),a&&(n+=" "+a)}}if(e.renderToStaticMarkup)return n;var i=_.createMarkupForID(this._rootNodeID);return n+" "+i},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var a=K[typeof t.children]?t.children:null,i=null!=a?null:t.children;if(null!=a)r=A(a);else if(null!=i){var u=this.mountChildren(i,e,n);r=u.join("")}}return X[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&F(r,o.__html);else{var a=K[typeof t.children]?t.children:null,i=null!=a?null:t.children;if(null!=a)B(r,a);else if(null!=i)for(var u=this.mountChildren(i,e,n),s=0;s<u.length;s++)r.appendChild(u[s])}},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,r){var o=t.props,a=this._currentElement.props;switch(this._tag){case"button":o=D.getNativeProps(this,o),a=D.getNativeProps(this,a);break;case"input":T.updateWrapper(this),o=T.getNativeProps(this,o),a=T.getNativeProps(this,a);break;case"option":o=P.getNativeProps(this,o),a=P.getNativeProps(this,a);break;case"select":o=M.getNativeProps(this,o),a=M.getNativeProps(this,a);break;case"textarea":N.updateWrapper(this),o=N.getNativeProps(this,o),a=N.getNativeProps(this,a)}s(this,a),this._updateDOMProperties(o,a,e,null),this._updateDOMChildren(o,a,e,r),!k&&this._nodeWithLegacyProperties&&(this._nodeWithLegacyProperties.props=a),"select"===this._tag&&e.getReactMountReady().enqueue(f,this)},_updateDOMProperties:function(e,t,n,r){var o,a,i;for(o in e)if(!t.hasOwnProperty(o)&&e.hasOwnProperty(o))if(o===H){var u=this._previousStyleCopy;for(a in u)u.hasOwnProperty(a)&&(i=i||{},i[a]="");this._previousStyleCopy=null}else j.hasOwnProperty(o)?e[o]&&V(this._rootNodeID,o):(C.properties[o]||C.isCustomAttribute(o))&&(r||(r=S.getNode(this._rootNodeID)),_.deleteValueForProperty(r,o));for(o in t){var s=t[o],c=o===H?this._previousStyleCopy:e[o];if(t.hasOwnProperty(o)&&s!==c)if(o===H)if(s?s=this._previousStyleCopy=O({},s):this._previousStyleCopy=null,c){for(a in c)!c.hasOwnProperty(a)||s&&s.hasOwnProperty(a)||(i=i||{},i[a]="");for(a in s)s.hasOwnProperty(a)&&c[a]!==s[a]&&(i=i||{},i[a]=s[a])}else i=s;else j.hasOwnProperty(o)?s?l(this._rootNodeID,o,s,n):c&&V(this._rootNodeID,o):v(this._tag,t)?(r||(r=S.getNode(this._rootNodeID)),o===q&&(s=null),_.setValueForAttribute(r,o,s)):(C.properties[o]||C.isCustomAttribute(o))&&(r||(r=S.getNode(this._rootNodeID)),null!=s?_.setValueForProperty(r,o,s):_.deleteValueForProperty(r,o))}i&&(r||(r=S.getNode(this._rootNodeID)),y.setValueForStyles(r,i))},_updateDOMChildren:function(e,t,n,r){var o=K[typeof e.children]?e.children:null,a=K[typeof t.children]?t.children:null,i=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,u=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,s=null!=o?null:e.children,l=null!=a?null:t.children,c=null!=o||null!=i,p=null!=a||null!=u;null!=s&&null==l?this.updateChildren(null,n,r):c&&!p&&this.updateTextContent(""),null!=a?o!==a&&this.updateTextContent(""+a):null!=u?i!==u&&this.updateMarkup(""+u):null!=l&&this.updateChildren(l,n,r)},unmountComponent:function(){switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":var e=this._wrapperState.listeners;if(e)for(var t=0;t<e.length;t++)e[t].remove();break;case"input":T.unmountWrapper(this);break;case"html":case"head":case"body":L(!1)}if(this.unmountChildren(),b.deleteAllListeners(this._rootNodeID),x.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._wrapperState=null,this._nodeWithLegacyProperties){var n=this._nodeWithLegacyProperties;n._reactInternalComponent=null,this._nodeWithLegacyProperties=null}},getPublicInstance:function(){if(!this._nodeWithLegacyProperties){var e=S.getNode(this._rootNodeID);e._reactInternalComponent=this,e.getDOMNode=r,e.isMounted=o,e.setState=a,e.replaceState=a,e.forceUpdate=a,e.setProps=i,e.replaceProps=u,e.props=this._currentElement.props,this._nodeWithLegacyProperties=e}return this._nodeWithLegacyProperties}},w.measureMethods(m,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),O(m.prototype,m.Mixin,R.Mixin),t.exports=m},{10:10,11:11,114:114,118:118,130:130,135:135,136:136,141:141,15:15,158:158,163:163,166:166,168:168,2:2,24:24,28:28,35:35,41:41,46:46,47:47,48:48,5:5,52:52,70:70,71:71,76:76,92:92}],43:[function(e,t,n){"use strict";function r(e){return o.createFactory(e)}var o=e(55),a=(e(56),e(164)),i=a({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hgroup:"hgroup",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",image:"image",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",
+rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);t.exports=i},{164:164,55:55,56:56}],44:[function(e,t,n){"use strict";var r={useCreateElement:!1};t.exports=r},{}],45:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(70),i=e(76),u=e(158),s={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},l={updatePropertyByID:function(e,t,n){var r=a.getNode(e);s.hasOwnProperty(t)?u(!1):void 0,null!=n?o.setValueForProperty(r,t,n):o.deleteValueForProperty(r,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=a.getNode(e);r.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=a.getNode(e[n].parentID);r.processUpdates(e,t)}};i.measureMethods(l,"ReactDOMIDOperations",{dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),t.exports=l},{11:11,158:158,70:70,76:76,9:9}],46:[function(e,t,n){"use strict";function r(){this._rootNodeID&&d.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=i.executeOnChange(t,e);s.asap(r,this);var o=t.name;if("radio"===t.type&&null!=o){for(var a=u.getNode(this._rootNodeID),l=a;l.parentNode;)l=l.parentNode;for(var d=l.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),f=0;f<d.length;f++){var h=d[f];if(h!==a&&h.form===a.form){var v=u.getID(h);v?void 0:c(!1);var m=p[v];m?void 0:c(!1),s.asap(r,m)}}}return n}var a=e(45),i=e(23),u=e(70),s=e(93),l=e(24),c=e(158),p={},d={getNativeProps:function(e,t,n){var r=i.getValue(t),o=i.getChecked(t),a=l({},t,{defaultChecked:void 0,defaultValue:void 0,value:null!=r?r:e._wrapperState.initialValue,checked:null!=o?o:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange});return a},mountWrapper:function(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:t.defaultChecked||!1,initialValue:null!=n?n:null,onChange:o.bind(e)}},mountReadyWrapper:function(e){p[e._rootNodeID]=e},unmountWrapper:function(e){delete p[e._rootNodeID]},updateWrapper:function(e){var t=e._currentElement.props,n=t.checked;null!=n&&a.updatePropertyByID(e._rootNodeID,"checked",n||!1);var r=i.getValue(t);null!=r&&a.updatePropertyByID(e._rootNodeID,"value",""+r)}};t.exports=d},{158:158,23:23,24:24,45:45,70:70,93:93}],47:[function(e,t,n){"use strict";var r=e(32),o=e(48),a=e(24),i=(e(168),o.valueContextKey),u={mountWrapper:function(e,t,n){var r=n[i],o=null;if(null!=r)if(o=!1,Array.isArray(r)){for(var a=0;a<r.length;a++)if(""+r[a]==""+t.value){o=!0;break}}else o=""+r==""+t.value;e._wrapperState={selected:o}},getNativeProps:function(e,t,n){var o=a({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(o.selected=e._wrapperState.selected);var i="";return r.forEach(t.children,function(e){null!=e&&("string"==typeof e||"number"==typeof e)&&(i+=e)}),i&&(o.children=i),o}};t.exports=u},{168:168,24:24,32:32,48:48}],48:[function(e,t,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=i.getValue(e);null!=t&&o(this,Boolean(e.multiple),t)}}function o(e,t,n){var r,o,a=u.getNode(e._rootNodeID).options;if(t){for(r={},o=0;o<n.length;o++)r[""+n[o]]=!0;for(o=0;o<a.length;o++){var i=r.hasOwnProperty(a[o].value);a[o].selected!==i&&(a[o].selected=i)}}else{for(r=""+n,o=0;o<a.length;o++)if(a[o].value===r)return void(a[o].selected=!0);a.length&&(a[0].selected=!0)}}function a(e){var t=this._currentElement.props,n=i.executeOnChange(t,e);return this._wrapperState.pendingUpdate=!0,s.asap(r,this),n}var i=e(23),u=e(70),s=e(93),l=e(24),c=(e(168),"__ReactDOMSelect_value$"+Math.random().toString(36).slice(2)),p={valueContextKey:c,getNativeProps:function(e,t,n){return l({},t,{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=i.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,onChange:a.bind(e),wasMultiple:Boolean(t.multiple)}},processChildContext:function(e,t,n){var r=l({},n);return r[c]=e._wrapperState.initialValue,r},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var r=i.getValue(t);null!=r?(e._wrapperState.pendingUpdate=!1,o(e,Boolean(t.multiple),r)):n!==Boolean(t.multiple)&&(null!=t.defaultValue?o(e,Boolean(t.multiple),t.defaultValue):o(e,Boolean(t.multiple),t.multiple?[]:""))}};t.exports=p},{168:168,23:23,24:24,70:70,93:93}],49:[function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function o(e){var t=document.selection,n=t.createRange(),r=n.text.length,o=n.duplicate();o.moveToElementText(e),o.setEndPoint("EndToStart",n);var a=o.text.length,i=a+r;return{start:a,end:i}}function a(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,o=t.anchorOffset,a=t.focusNode,i=t.focusOffset,u=t.getRangeAt(0);try{u.startContainer.nodeType,u.endContainer.nodeType}catch(s){return null}var l=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),c=l?0:u.toString().length,p=u.cloneRange();p.selectNodeContents(e),p.setEnd(u.startContainer,u.startOffset);var d=r(p.startContainer,p.startOffset,p.endContainer,p.endOffset),f=d?0:p.toString().length,h=f+c,v=document.createRange();v.setStart(n,o),v.setEnd(a,i);var m=v.collapsed;return{start:m?h:f,end:m?f:h}}function i(e,t){var n,r,o=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),o.moveToElementText(e),o.moveStart("character",n),o.setEndPoint("EndToStart",o),o.moveEnd("character",r-n),o.select()}function u(e,t){if(window.getSelection){var n=window.getSelection(),r=e[c()].length,o=Math.min(t.start,r),a="undefined"==typeof t.end?o:Math.min(t.end,r);if(!n.extend&&o>a){var i=a;a=o,o=i}var u=l(e,o),s=l(e,a);if(u&&s){var p=document.createRange();p.setStart(u.node,u.offset),n.removeAllRanges(),o>a?(n.addRange(p),n.extend(s.node,s.offset)):(p.setEnd(s.node,s.offset),n.addRange(p))}}}var s=e(144),l=e(127),c=e(128),p=s.canUseDOM&&"selection"in document&&!("getSelection"in window),d={getOffsets:p?o:a,setOffsets:p?i:u};t.exports=d},{127:127,128:128,144:144}],50:[function(e,t,n){"use strict";var r=e(54),o=e(86),a=e(94);r.inject();var i={renderToString:o.renderToString,renderToStaticMarkup:o.renderToStaticMarkup,version:a};t.exports=i},{54:54,86:86,94:94}],51:[function(e,t,n){"use strict";var r=e(9),o=e(11),a=e(35),i=e(70),u=e(24),s=e(118),l=e(136),c=(e(141),function(e){});u(c.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){if(this._rootNodeID=e,t.useCreateElement){var r=n[i.ownerDocumentContextKey],a=r.createElement("span");return o.setAttributeForID(a,e),i.getID(a),l(a,this._stringText),a}var u=s(this._stringText);return t.renderToStaticMarkup?u:"<span "+o.createMarkupForID(e)+">"+u+"</span>"},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var o=i.getNode(this._rootNodeID);r.updateTextContent(o,n)}}},unmountComponent:function(){a.unmountIDFromEnvironment(this._rootNodeID)}}),t.exports=c},{11:11,118:118,136:136,141:141,24:24,35:35,70:70,9:9}],52:[function(e,t,n){"use strict";function r(){this._rootNodeID&&c.updateWrapper(this)}function o(e){var t=this._currentElement.props,n=a.executeOnChange(t,e);return u.asap(r,this),n}var a=e(23),i=e(45),u=e(93),s=e(24),l=e(158),c=(e(168),{getNativeProps:function(e,t,n){null!=t.dangerouslySetInnerHTML?l(!1):void 0;var r=s({},t,{defaultValue:void 0,value:void 0,children:e._wrapperState.initialValue,onChange:e._wrapperState.onChange});return r},mountWrapper:function(e,t){var n=t.defaultValue,r=t.children;null!=r&&(null!=n?l(!1):void 0,Array.isArray(r)&&(r.length<=1?void 0:l(!1),r=r[0]),n=""+r),null==n&&(n="");var i=a.getValue(t);e._wrapperState={initialValue:""+(null!=i?i:n),onChange:o.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=a.getValue(t);null!=n&&i.updatePropertyByID(e._rootNodeID,"value",""+n)}});t.exports=c},{158:158,168:168,23:23,24:24,45:45,93:93}],53:[function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var o=e(93),a=e(110),i=e(24),u=e(150),s={initialize:u,close:function(){d.isBatchingUpdates=!1}},l={initialize:u,close:o.flushBatchedUpdates.bind(o)},c=[l,s];i(r.prototype,a.Mixin,{getTransactionWrappers:function(){return c}});var p=new r,d={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,o,a){var i=d.isBatchingUpdates;d.isBatchingUpdates=!0,i?e(t,n,r,o,a):p.perform(e,null,t,n,r,o,a)}};t.exports=d},{110:110,150:150,24:24,93:93}],54:[function(e,t,n){"use strict";function r(){T||(T=!0,g.EventEmitter.injectReactEventListener(m),g.EventPluginHub.injectEventPluginOrder(u),g.EventPluginHub.injectInstanceHandle(y),g.EventPluginHub.injectMount(C),g.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:x,EnterLeaveEventPlugin:s,ChangeEventPlugin:a,SelectEventPlugin:E,BeforeInputEventPlugin:o}),g.NativeComponent.injectGenericComponentClass(h),g.NativeComponent.injectTextComponentClass(v),g.Class.injectMixin(p),g.DOMProperty.injectDOMPropertyConfig(c),g.DOMProperty.injectDOMPropertyConfig(D),g.EmptyComponent.injectEmptyComponent("noscript"),g.Updates.injectReconcileTransaction(_),g.Updates.injectBatchingStrategy(f),g.RootIndex.injectCreateReactRootIndex(l.canUseDOM?i.createReactRootIndex:b.createReactRootIndex),g.Component.injectEnvironment(d))}var o=e(3),a=e(7),i=e(8),u=e(13),s=e(14),l=e(144),c=e(21),p=e(27),d=e(35),f=e(53),h=e(42),v=e(51),m=e(61),g=e(63),y=e(65),C=e(70),_=e(81),E=e(96),b=e(97),x=e(98),D=e(95),T=!1;t.exports={inject:r}},{13:13,14:14,144:144,21:21,27:27,3:3,35:35,42:42,51:51,53:53,61:61,63:63,65:65,7:7,70:70,8:8,81:81,95:95,96:96,97:97,98:98}],55:[function(e,t,n){"use strict";var r=e(39),o=e(24),a=(e(114),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),i={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,t,n,r,o,i,u){var s={$$typeof:a,type:e,key:t,ref:n,props:u,_owner:i};return s};u.createElement=function(e,t,n){var o,a={},s=null,l=null,c=null,p=null;if(null!=t){l=void 0===t.ref?null:t.ref,s=void 0===t.key?null:""+t.key,c=void 0===t.__self?null:t.__self,p=void 0===t.__source?null:t.__source;for(o in t)t.hasOwnProperty(o)&&!i.hasOwnProperty(o)&&(a[o]=t[o])}var d=arguments.length-2;if(1===d)a.children=n;else if(d>1){for(var f=Array(d),h=0;d>h;h++)f[h]=arguments[h+2];a.children=f}if(e&&e.defaultProps){var v=e.defaultProps;for(o in v)"undefined"==typeof a[o]&&(a[o]=v[o])}return u(e,s,l,c,p,r.current,a)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){var n=u(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},u.cloneAndReplaceProps=function(e,t){var n=u(e.type,e.key,e.ref,e._self,e._source,e._owner,t);return n},u.cloneElement=function(e,t,n){var a,s=o({},e.props),l=e.key,c=e.ref,p=e._self,d=e._source,f=e._owner;if(null!=t){void 0!==t.ref&&(c=t.ref,f=r.current),void 0!==t.key&&(l=""+t.key);for(a in t)t.hasOwnProperty(a)&&!i.hasOwnProperty(a)&&(s[a]=t[a])}var h=arguments.length-2;if(1===h)s.children=n;else if(h>1){for(var v=Array(h),m=0;h>m;m++)v[m]=arguments[m+2];s.children=v}return u(e.type,l,c,p,d,f,s)},u.isValidElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},t.exports=u},{114:114,24:24,39:39}],56:[function(e,t,n){"use strict";function r(){if(p.current){var e=p.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function o(e,t){e._store&&!e._store.validated&&null==e.key&&(e._store.validated=!0,a("uniqueKey",e,t))}function a(e,t,n){var o=r();if(!o){var a="string"==typeof n?n:n.displayName||n.name;a&&(o=" Check the top-level render call using <"+a+">.")}var i=h[e]||(h[e]={});if(i[o])return null;i[o]=!0;var u={parentOrOwner:o,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return t&&t._owner&&t._owner!==p.current&&(u.childOwner=" It was passed a child from "+t._owner.getName()+"."),u}function i(e,t){if("object"==typeof e)if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];l.isValidElement(r)&&o(r,t)}else if(l.isValidElement(e))e._store&&(e._store.validated=!0);else if(e){var a=d(e);if(a&&a!==e.entries)for(var i,u=a.call(e);!(i=u.next()).done;)l.isValidElement(i.value)&&o(i.value,t)}}function u(e,t,n,o){for(var a in t)if(t.hasOwnProperty(a)){var i;try{"function"!=typeof t[a]?f(!1):void 0,i=t[a](n,a,e,o,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(u){i=u}i instanceof Error&&!(i.message in v)&&(v[i.message]=!0,r())}}function s(e){var t=e.type;if("function"==typeof t){var n=t.displayName||t.name;t.propTypes&&u(n,t.propTypes,e.props,c.prop),"function"==typeof t.getDefaultProps}}var l=e(55),c=e(79),p=(e(78),e(39)),d=(e(114),e(126)),f=e(158),h=(e(168),{}),v={},m={createElement:function(e,t,n){var r="string"==typeof e||"function"==typeof e,o=l.createElement.apply(this,arguments);if(null==o)return o;if(r)for(var a=2;a<arguments.length;a++)i(arguments[a],e);return s(o),o},createFactory:function(e){var t=m.createElement.bind(null,e);return t.type=e,t},cloneElement:function(e,t,n){for(var r=l.cloneElement.apply(this,arguments),o=2;o<arguments.length;o++)i(arguments[o],r.type);return s(r),r}};t.exports=m},{114:114,126:126,158:158,168:168,39:39,55:55,78:78,79:79}],57:[function(e,t,n){"use strict";function r(){i.registerNullComponentID(this._rootNodeID)}var o,a=e(55),i=e(58),u=e(82),s=e(24),l={injectEmptyComponent:function(e){o=a.createElement(e)}},c=function(e){this._currentElement=null,this._rootNodeID=null,this._renderedComponent=e(o)};s(c.prototype,{construct:function(e){},mountComponent:function(e,t,n){return t.getReactMountReady().enqueue(r,this),this._rootNodeID=e,u.mountComponent(this._renderedComponent,e,t,n)},receiveComponent:function(){},unmountComponent:function(e,t,n){u.unmountComponent(this._renderedComponent),i.deregisterNullComponentID(this._rootNodeID),this._rootNodeID=null,this._renderedComponent=null}}),c.injection=l,t.exports=c},{24:24,55:55,58:58,82:82}],58:[function(e,t,n){"use strict";function r(e){return!!i[e]}function o(e){i[e]=!0}function a(e){delete i[e]}var i={},u={isNullComponentID:r,registerNullComponentID:o,deregisterNullComponentID:a};t.exports=u},{}],59:[function(e,t,n){"use strict";function r(e,t,n,r){try{return t(n,r)}catch(a){return void(null===o&&(o=a))}}var o=null,a={invokeGuardedCallback:r,invokeGuardedCallbackWithCatch:r,rethrowCaughtError:function(){if(o){var e=o;throw o=null,e}}};t.exports=a},{}],60:[function(e,t,n){"use strict";function r(e){o.enqueueEvents(e),o.processEventQueue(!1)}var o=e(16),a={handleTopLevel:function(e,t,n,a,i){var u=o.extractEvents(e,t,n,a,i);r(u)}};t.exports=a},{16:16}],61:[function(e,t,n){"use strict";function r(e){var t=d.getID(e),n=p.getReactRootIDFromNodeID(t),r=d.findReactContainerForID(n),o=d.getFirstReactDOM(r);return o}function o(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function a(e){i(e)}function i(e){for(var t=d.getFirstReactDOM(v(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=r(n);for(var o=0;o<e.ancestors.length;o++){t=e.ancestors[o];var a=d.getID(t)||"";g._handleTopLevel(e.topLevelType,t,a,e.nativeEvent,v(e.nativeEvent))}}function u(e){var t=m(window);e(t)}var s=e(143),l=e(144),c=e(25),p=e(65),d=e(70),f=e(93),h=e(24),v=e(125),m=e(155);h(o.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),c.addPoolingTo(o,c.twoArgumentPooler);var g={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:l.canUseDOM?window:null,setHandleTopLevel:function(e){g._handleTopLevel=e},setEnabled:function(e){g._enabled=!!e},isEnabled:function(){return g._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?s.listen(r,t,g.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?s.capture(r,t,g.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=u.bind(null,e);s.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(g._enabled){var n=o.getPooled(e,t);try{f.batchedUpdates(a,n)}finally{o.release(n)}}}};t.exports=g},{125:125,143:143,144:144,155:155,24:24,25:25,65:65,70:70,93:93}],62:[function(e,t,n){"use strict";var r=e(32),o=e(55),a=e(150),i=e(158),u=(e(168),{create:function(e){if("object"!=typeof e||!e||Array.isArray(e))return e;if(o.isValidElement(e))return e;1===e.nodeType?i(!1):void 0;var t=[];for(var n in e)r.mapIntoWithKeyPrefixInternal(e[n],t,n,a.thatReturnsArgument);return t}});t.exports=u},{150:150,158:158,168:168,32:32,55:55}],63:[function(e,t,n){"use strict";var r=e(10),o=e(16),a=e(36),i=e(33),u=e(57),s=e(28),l=e(73),c=e(76),p=e(84),d=e(93),f={Component:a.injection,Class:i.injection,DOMProperty:r.injection,EmptyComponent:u.injection,EventPluginHub:o.injection,EventEmitter:s.injection,NativeComponent:l.injection,Perf:c.injection,RootIndex:p.injection,Updates:d.injection};t.exports=f},{10:10,16:16,28:28,33:33,36:36,57:57,73:73,76:76,84:84,93:93}],64:[function(e,t,n){"use strict";function r(e){return a(document.documentElement,e)}var o=e(49),a=e(147),i=e(152),u=e(153),s={hasSelectionCapabilities:function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)},getSelectionInformation:function(){var e=u();return{focusedElem:e,selectionRange:s.hasSelectionCapabilities(e)?s.getSelection(e):null}},restoreSelection:function(e){var t=u(),n=e.focusedElem,o=e.selectionRange;t!==n&&r(n)&&(s.hasSelectionCapabilities(n)&&s.setSelection(n,o),i(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=o.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if("undefined"==typeof r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var a=e.createTextRange();a.collapse(!0),a.moveStart("character",n),a.moveEnd("character",r-n),a.select()}else o.setOffsets(e,t)}};t.exports=s},{147:147,152:152,153:153,49:49}],65:[function(e,t,n){"use strict";function r(e){return f+e.toString(36)}function o(e,t){return e.charAt(t)===f||t===e.length}function a(e){return""===e||e.charAt(0)===f&&e.charAt(e.length-1)!==f}function i(e,t){return 0===t.indexOf(e)&&o(t,e.length)}function u(e){return e?e.substr(0,e.lastIndexOf(f)):""}function s(e,t){if(a(e)&&a(t)?void 0:d(!1),i(e,t)?void 0:d(!1),e===t)return e;var n,r=e.length+h;for(n=r;n<t.length&&!o(t,n);n++);return t.substr(0,n)}function l(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var r=0,i=0;n>=i;i++)if(o(e,i)&&o(t,i))r=i;else if(e.charAt(i)!==t.charAt(i))break;var u=e.substr(0,r);return a(u)?void 0:d(!1),u}function c(e,t,n,r,o,a){e=e||"",t=t||"",e===t?d(!1):void 0;var l=i(t,e);l||i(e,t)?void 0:d(!1);for(var c=0,p=l?u:s,f=e;;f=p(f,t)){var h;if(o&&f===e||a&&f===t||(h=n(f,l,r)),h===!1||f===t)break;c++<v?void 0:d(!1)}}var p=e(84),d=e(158),f=".",h=f.length,v=1e4,m={createReactRootID:function(){return r(p.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===f&&e.length>1){var t=e.indexOf(f,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,o){var a=l(e,t);a!==e&&c(e,a,n,r,!1,!0),a!==t&&c(a,t,n,o,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(c("",e,t,n,!0,!1),c(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(c("",e,t,n,!0,!0),c(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){c("",e,t,n,!0,!1)},getFirstCommonAncestorID:l,_getNextDescendantID:s,isAncestorIDOf:i,SEPARATOR:f};t.exports=m},{158:158,84:84}],66:[function(e,t,n){"use strict";var r={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};t.exports=r},{}],67:[function(e,t,n){"use strict";var r=e(32),o=e(34),a=e(33),i=e(43),u=e(55),s=(e(56),e(80)),l=e(94),c=e(24),p=e(132),d=u.createElement,f=u.createFactory,h=u.cloneElement,v={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:p},Component:o,createElement:d,cloneElement:h,isValidElement:u.isValidElement,PropTypes:s,createClass:a.createClass,createFactory:f,createMixin:function(e){return e},DOM:i,version:l,__spread:c};t.exports=v},{132:132,24:24,32:32,33:33,34:34,43:43,55:55,56:56,80:80,94:94}],68:[function(e,t,n){"use strict";function r(e,t){this.value=e,this.requestChange=t}function o(e){var t={value:"undefined"==typeof e?a.PropTypes.any.isRequired:e.isRequired,requestChange:a.PropTypes.func.isRequired};return a.PropTypes.shape(t)}var a=e(26);r.PropTypes={link:o},t.exports=r},{26:26}],69:[function(e,t,n){"use strict";var r=e(113),o=/\/?>/,a={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(o," "+a.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(a.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var o=r(e);return o===n}};t.exports=a},{113:113}],70:[function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function o(e){return e?e.nodeType===j?e.documentElement:e.firstChild:null}function a(e){var t=o(e);return t&&X.getID(t)}function i(e){var t=u(e);if(t)if(V.hasOwnProperty(t)){var n=V[t];n!==e&&(p(n,t)?L(!1):void 0,V[t]=e)}else V[t]=e;return t}function u(e){return e&&e.getAttribute&&e.getAttribute(B)||""}function s(e,t){var n=u(e);n!==t&&delete V[n],e.setAttribute(B,t),V[t]=e}function l(e){return V.hasOwnProperty(e)&&p(V[e],e)||(V[e]=X.findReactNodeByID(e)),V[e]}function c(e){var t=P.get(e)._rootNodeID;return D.isNullComponentID(t)?null:(V.hasOwnProperty(t)&&p(V[t],t)||(V[t]=X.findReactNodeByID(t)),V[t])}function p(e,t){if(e){u(e)!==t?L(!1):void 0;var n=X.findReactContainerForID(t);if(n&&k(n,e))return!0}return!1}function d(e){delete V[e]}function f(e){var t=V[e];return t&&p(t,e)?void(G=t):!1}function h(e){G=null,T.traverseAncestors(e,f);var t=G;return G=null,t}function v(e,t,n,r,o,a){b.useCreateElement&&(a=I({},a),n.nodeType===j?a[q]=n:a[q]=n.ownerDocument);var i=S.mountComponent(e,t,r,a);e._renderedComponent._topLevelWrapper=e,X._mountImageIntoNode(i,n,o,r)}function m(e,t,n,r,o){var a=w.ReactReconcileTransaction.getPooled(r);a.perform(v,null,e,t,n,a,r,o),w.ReactReconcileTransaction.release(a)}function g(e,t){for(S.unmountComponent(e),t.nodeType===j&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function y(e){var t=a(e);return t?t!==T.getReactRootIDFromNodeID(t):!1}function C(e){for(;e&&e.parentNode!==e;e=e.parentNode)if(1===e.nodeType){var t=u(e);if(t){var n,r=T.getReactRootIDFromNodeID(t),o=e;do if(n=u(o),o=o.parentNode,null==o)return null;while(n!==r);if(o===Y[r])return e}}return null}var _=e(10),E=e(28),b=(e(39),e(44)),x=e(55),D=e(58),T=e(65),P=e(66),M=e(69),N=e(76),S=e(82),R=e(92),w=e(93),I=e(24),O=e(151),k=e(147),A=e(129),L=e(158),U=e(135),F=e(138),B=(e(141),e(168),_.ID_ATTRIBUTE_NAME),V={},W=1,j=9,K=11,q="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),H={},Y={},z=[],G=null,Q=function(){};Q.prototype.isReactComponent={},Q.prototype.render=function(){return this.props};var X={TopLevelWrapper:Q,_instancesByReactRootID:H,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return X.scrollMonitor(n,function(){R.enqueueElementInternal(e,t),r&&R.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){!t||t.nodeType!==W&&t.nodeType!==j&&t.nodeType!==K?L(!1):void 0,E.ensureScrollValueMonitoring();var n=X.registerContainer(t);return H[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var o=A(e,null),a=X._registerComponent(o,t);return w.batchedUpdates(m,o,a,t,n,r),o},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?L(!1):void 0,X._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){x.isValidElement(t)?void 0:L(!1);var i=new x(Q,null,null,null,null,null,t),s=H[a(n)];if(s){var l=s._currentElement,c=l.props;if(F(c,t)){var p=s._renderedComponent.getPublicInstance(),d=r&&function(){r.call(p)};return X._updateRootComponent(s,i,n,d),p}X.unmountComponentAtNode(n)}var f=o(n),h=f&&!!u(f),v=y(n),m=h&&!s&&!v,g=X._renderNewRootComponent(i,n,m,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):O)._renderedComponent.getPublicInstance();return r&&r.call(g),g},render:function(e,t,n){return X._renderSubtreeIntoContainer(null,e,t,n)},registerContainer:function(e){var t=a(e);return t&&(t=T.getReactRootIDFromNodeID(t)),t||(t=T.createReactRootID()),Y[t]=e,t},unmountComponentAtNode:function(e){!e||e.nodeType!==W&&e.nodeType!==j&&e.nodeType!==K?L(!1):void 0;var t=a(e),n=H[t];if(!n){var r=(y(e),u(e));return r&&r===T.getReactRootIDFromNodeID(r),!1}return w.batchedUpdates(g,n,e),delete H[t],delete Y[t],!0},findReactContainerForID:function(e){var t=T.getReactRootIDFromNodeID(e),n=Y[t];return n},findReactNodeByID:function(e){var t=X.findReactContainerForID(e);return X.findComponentRoot(t,e)},getFirstReactDOM:function(e){return C(e)},findComponentRoot:function(e,t){var n=z,r=0,o=h(t)||e;for(n[0]=o.firstChild,n.length=1;r<n.length;){for(var a,i=n[r++];i;){var u=X.getID(i);u?t===u?a=i:T.isAncestorIDOf(u,t)&&(n.length=r=0,n.push(i.firstChild)):n.push(i.firstChild),i=i.nextSibling}if(a)return n.length=0,a}n.length=0,L(!1)},_mountImageIntoNode:function(e,t,n,a){if(!t||t.nodeType!==W&&t.nodeType!==j&&t.nodeType!==K?L(!1):void 0,n){var i=o(t);if(M.canReuseMarkup(e,i))return;var u=i.getAttribute(M.CHECKSUM_ATTR_NAME);i.removeAttribute(M.CHECKSUM_ATTR_NAME);var s=i.outerHTML;i.setAttribute(M.CHECKSUM_ATTR_NAME,u);var l=e,c=r(l,s);" (client) "+l.substring(c-20,c+20)+"\n (server) "+s.substring(c-20,c+20),t.nodeType===j?L(!1):void 0}if(t.nodeType===j?L(!1):void 0,a.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(e)}else U(t,e)},ownerDocumentContextKey:q,getReactRootID:a,getID:i,setID:s,getNode:l,getNodeFromInstance:c,isValid:p,purgeID:d};N.measureMethods(X,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),t.exports=X},{10:10,129:129,135:135,138:138,141:141,147:147,151:151,158:158,168:168,24:24,28:28,39:39,44:44,55:55,58:58,65:65,66:66,69:69,76:76,82:82,92:92,93:93}],71:[function(e,t,n){"use strict";function r(e,t,n){m.push({parentID:e,parentNode:null,type:p.INSERT_MARKUP,markupIndex:g.push(t)-1,content:null,fromIndex:null,toIndex:n})}function o(e,t,n){m.push({parentID:e,parentNode:null,type:p.MOVE_EXISTING,markupIndex:null,content:null,fromIndex:t,toIndex:n})}function a(e,t){m.push({parentID:e,parentNode:null,type:p.REMOVE_NODE,markupIndex:null,content:null,fromIndex:t,toIndex:null})}function i(e,t){m.push({parentID:e,parentNode:null,type:p.SET_MARKUP,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function u(e,t){m.push({parentID:e,parentNode:null,type:p.TEXT_CONTENT,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function s(){m.length&&(c.processChildrenUpdates(m,g),l())}function l(){m.length=0,g.length=0}var c=e(36),p=e(72),d=(e(39),e(82)),f=e(31),h=e(120),v=0,m=[],g=[],y={Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return f.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r){var o;return o=h(t),f.updateChildren(e,o,n,r)},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var o=[],a=0;for(var i in r)if(r.hasOwnProperty(i)){var u=r[i],s=this._rootNodeID+i,l=d.mountComponent(u,s,t,n);u._mountIndex=a++,o.push(l)}return o},updateTextContent:function(e){v++;var t=!0;try{var n=this._renderedChildren;f.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChild(n[r]);this.setTextContent(e),t=!1}finally{v--,v||(t?l():s())}},updateMarkup:function(e){v++;var t=!0;try{var n=this._renderedChildren;f.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setMarkup(e),t=!1}finally{v--,v||(t?l():s())}},updateChildren:function(e,t,n){v++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{v--,v||(r?l():s())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,o=this._reconcilerUpdateChildren(r,e,t,n);if(this._renderedChildren=o,o||r){var a,i=0,u=0;for(a in o)if(o.hasOwnProperty(a)){var s=r&&r[a],l=o[a];s===l?(this.moveChild(s,u,i),i=Math.max(s._mountIndex,i),s._mountIndex=u):(s&&(i=Math.max(s._mountIndex,i),this._unmountChild(s)),this._mountChildByNameAtIndex(l,a,u,t,n)),u++}for(a in r)!r.hasOwnProperty(a)||o&&o.hasOwnProperty(a)||this._unmountChild(r[a])}},unmountChildren:function(){var e=this._renderedChildren;f.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&o(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){r(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){a(this._rootNodeID,e._mountIndex)},setTextContent:function(e){u(this._rootNodeID,e)},setMarkup:function(e){i(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,o){var a=this._rootNodeID+t,i=d.mountComponent(e,a,r,o);e._mountIndex=n,this.createChild(e,i)},_unmountChild:function(e){this.removeChild(e),e._mountIndex=null}}};t.exports=y},{120:120,31:31,36:36,39:39,72:72,82:82}],72:[function(e,t,n){"use strict";var r=e(162),o=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});t.exports=o},{162:162}],73:[function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=p[t];return null==n&&(p[t]=n=l(t)),n}function o(e){return c?void 0:s(!1),new c(e.type,e.props)}function a(e){return new d(e)}function i(e){return e instanceof d}var u=e(24),s=e(158),l=null,c=null,p={},d=null,f={injectGenericComponentClass:function(e){c=e},injectTextComponentClass:function(e){d=e},injectComponentClasses:function(e){u(p,e)}},h={getComponentClassForElement:r,createInternalComponent:o,createInstanceForText:a,isTextComponent:i,injection:f};t.exports=h},{158:158,24:24}],74:[function(e,t,n){"use strict";function r(e,t){}var o=(e(168),{isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e,t){r(e,"replaceState")},enqueueSetState:function(e,t){r(e,"setState")},enqueueSetProps:function(e,t){r(e,"setProps")},enqueueReplaceProps:function(e,t){r(e,"replaceProps")}});t.exports=o},{168:168}],75:[function(e,t,n){"use strict";var r=e(158),o={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){o.isValidOwner(n)?void 0:r(!1),n.getPublicInstance().refs[t]===e.getPublicInstance()&&n.detachRef(t)}};t.exports=o},{158:158}],76:[function(e,t,n){"use strict";function r(e,t,n){return n}var o={enableMeasure:!1,storedMeasure:r,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){o.storedMeasure=e}}};t.exports=o},{}],77:[function(e,t,n){"use strict";function r(e){return function(t,n,r){t.hasOwnProperty(n)?t[n]=e(t[n],r):t[n]=r}}function o(e,t){for(var n in t)if(t.hasOwnProperty(n)){var r=l[n];r&&l.hasOwnProperty(n)?r(e,n,t[n]):e.hasOwnProperty(n)||(e[n]=t[n])}return e}var a=e(24),i=e(150),u=e(161),s=r(function(e,t){
+return a({},t,e)}),l={children:i,className:r(u),style:s},c={mergeProps:function(e,t){return o(a({},e),t)}};t.exports=c},{150:150,161:161,24:24}],78:[function(e,t,n){"use strict";var r={};t.exports=r},{}],79:[function(e,t,n){"use strict";var r=e(162),o=r({prop:null,context:null,childContext:null});t.exports=o},{162:162}],80:[function(e,t,n){"use strict";function r(e){function t(t,n,r,o,a,i){if(o=o||b,i=i||r,null==n[r]){var u=C[a];return t?new Error("Required "+u+" `"+i+"` was not specified in "+("`"+o+"`.")):null}return e(n,r,o,a,i)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function o(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if(u!==e){var s=C[o],l=m(i);return new Error("Invalid "+s+" `"+a+"` of type "+("`"+l+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return r(t)}function a(){return r(_.thatReturns(null))}function i(e){function t(t,n,r,o,a){var i=t[n];if(!Array.isArray(i)){var u=C[o],s=v(i);return new Error("Invalid "+u+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var l=0;l<i.length;l++){var c=e(i,l,r,o,a+"["+l+"]","SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");if(c instanceof Error)return c}return null}return r(t)}function u(){function e(e,t,n,r,o){if(!y.isValidElement(e[t])){var a=C[r];return new Error("Invalid "+a+" `"+o+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return r(e)}function s(e){function t(t,n,r,o,a){if(!(t[n]instanceof e)){var i=C[o],u=e.name||b,s=g(t[n]);return new Error("Invalid "+i+" `"+a+"` of type "+("`"+s+"` supplied to `"+r+"`, expected ")+("instance of `"+u+"`."))}return null}return r(t)}function l(e){function t(t,n,r,o,a){for(var i=t[n],u=0;u<e.length;u++)if(i===e[u])return null;var s=C[o],l=JSON.stringify(e);return new Error("Invalid "+s+" `"+a+"` of value `"+i+"` "+("supplied to `"+r+"`, expected one of "+l+"."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function c(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+a+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an object."))}for(var l in i)if(i.hasOwnProperty(l)){var c=e(i,l,r,o,a+"."+l,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");if(c instanceof Error)return c}return null}return r(t)}function p(e){function t(t,n,r,o,a){for(var i=0;i<e.length;i++){var u=e[i];if(null==u(t,n,r,o,a,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"))return null}var s=C[o];return new Error("Invalid "+s+" `"+a+"` supplied to "+("`"+r+"`."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function d(){function e(e,t,n,r,o){if(!h(e[t])){var a=C[r];return new Error("Invalid "+a+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function f(e){function t(t,n,r,o,a){var i=t[n],u=v(i);if("object"!==u){var s=C[o];return new Error("Invalid "+s+" `"+a+"` of type `"+u+"` "+("supplied to `"+r+"`, expected `object`."))}for(var l in e){var c=e[l];if(c){var p=c(i,l,r,o,a+"."+l,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");if(p)return p}}return null}return r(t)}function h(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||y.isValidElement(e))return!0;var t=E(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!h(n.value))return!1}else for(;!(n=r.next()).done;){var o=n.value;if(o&&!h(o[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function m(e){var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:"<<anonymous>>"}var y=e(55),C=e(78),_=e(150),E=e(126),b="<<anonymous>>",x={array:o("array"),bool:o("boolean"),func:o("function"),number:o("number"),object:o("object"),string:o("string"),any:a(),arrayOf:i,element:u(),instanceOf:s,node:d(),objectOf:c,oneOf:l,oneOfType:p,shape:f};t.exports=x},{126:126,150:150,55:55,78:78}],81:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=o.getPooled(null),this.useCreateElement=!e&&u.useCreateElement}var o=e(6),a=e(25),i=e(28),u=e(44),s=e(64),l=e(110),c=e(24),p={initialize:s.getSelectionInformation,close:s.restoreSelection},d={initialize:function(){var e=i.isEnabled();return i.setEnabled(!1),e},close:function(e){i.setEnabled(e)}},f={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h=[p,d,f],v={getTransactionWrappers:function(){return h},getReactMountReady:function(){return this.reactMountReady},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null}};c(r.prototype,l.Mixin,v),a.addPoolingTo(r),t.exports=r},{110:110,24:24,25:25,28:28,44:44,6:6,64:64}],82:[function(e,t,n){"use strict";function r(){o.attachRefs(this,this._currentElement)}var o=e(83),a={mountComponent:function(e,t,n,o){var a=e.mountComponent(t,n,o);return e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e),a},unmountComponent:function(e){o.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,n,a){var i=e._currentElement;if(t!==i||a!==e._context){var u=o.shouldUpdateRefs(i,t);u&&o.detachRefs(e,i),e.receiveComponent(t,n,a),u&&e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}};t.exports=a},{83:83}],83:[function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):a.addComponentAsRefTo(t,e,n)}function o(e,t,n){"function"==typeof e?e(null):a.removeComponentAsRefFrom(t,e,n)}var a=e(75),i={};i.attachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&r(n,e,t._owner)}},i.shouldUpdateRefs=function(e,t){var n=null===e||e===!1,r=null===t||t===!1;return n||r||t._owner!==e._owner||t.ref!==e.ref},i.detachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&o(n,e,t._owner)}},t.exports=i},{75:75}],84:[function(e,t,n){"use strict";var r={injectCreateReactRootIndex:function(e){o.createReactRootIndex=e}},o={createReactRootIndex:null,injection:r};t.exports=o},{}],85:[function(e,t,n){"use strict";var r={isBatchingUpdates:!1,batchedUpdates:function(e){}};t.exports=r},{}],86:[function(e,t,n){"use strict";function r(e){i.isValidElement(e)?void 0:h(!1);var t;try{p.injection.injectBatchingStrategy(l);var n=u.createReactRootID();return t=c.getPooled(!1),t.perform(function(){var r=f(e,null),o=r.mountComponent(n,t,d);return s.addChecksumToMarkup(o)},null)}finally{c.release(t),p.injection.injectBatchingStrategy(a)}}function o(e){i.isValidElement(e)?void 0:h(!1);var t;try{p.injection.injectBatchingStrategy(l);var n=u.createReactRootID();return t=c.getPooled(!0),t.perform(function(){var r=f(e,null);return r.mountComponent(n,t,d)},null)}finally{c.release(t),p.injection.injectBatchingStrategy(a)}}var a=e(53),i=e(55),u=e(65),s=e(69),l=e(85),c=e(87),p=e(93),d=e(151),f=e(129),h=e(158);t.exports={renderToString:r,renderToStaticMarkup:o}},{129:129,151:151,158:158,53:53,55:55,65:65,69:69,85:85,87:87,93:93}],87:[function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=a.getPooled(null),this.useCreateElement=!1}var o=e(25),a=e(6),i=e(110),u=e(24),s=e(150),l={initialize:function(){this.reactMountReady.reset()},close:s},c=[l],p={getTransactionWrappers:function(){return c},getReactMountReady:function(){return this.reactMountReady},destructor:function(){a.release(this.reactMountReady),this.reactMountReady=null}};u(r.prototype,i.Mixin,p),o.addPoolingTo(r),t.exports=r},{110:110,150:150,24:24,25:25,6:6}],88:[function(e,t,n){"use strict";function r(e,t){var n={};return function(r){n[t]=r,e.setState(n)}}var o={createStateSetter:function(e,t){return function(n,r,o,a,i,u){var s=t.call(e,n,r,o,a,i,u);s&&e.setState(s)}},createStateKeySetter:function(e,t){var n=e.__keySetters||(e.__keySetters={});return n[t]||(n[t]=r(e,t))}};o.Mixin={createStateSetter:function(e){return o.createStateSetter(this,e)},createStateKeySetter:function(e){return o.createStateKeySetter(this,e)}},t.exports=o},{}],89:[function(e,t,n){"use strict";var r=e(120),o={getChildMapping:function(e){return e?r(e):e},mergeChildMappings:function(e,t){function n(n){return t.hasOwnProperty(n)?t[n]:e[n]}e=e||{},t=t||{};var r={},o=[];for(var a in e)t.hasOwnProperty(a)?o.length&&(r[a]=o,o=[]):o.push(a);var i,u={};for(var s in t){if(r.hasOwnProperty(s))for(i=0;i<r[s].length;i++){var l=r[s][i];u[r[s][i]]=n(l)}u[s]=n(s)}for(i=0;i<o.length;i++)u[o[i]]=n(o[i]);return u}};t.exports=o},{120:120}],90:[function(e,t,n){"use strict";function r(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete u.animationend.animation,"TransitionEvent"in window||delete u.transitionend.transition;for(var n in u){var r=u[n];for(var o in r)if(o in t){s.push(r[o]);break}}}function o(e,t,n){e.addEventListener(t,n,!1)}function a(e,t,n){e.removeEventListener(t,n,!1)}var i=e(144),u={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},s=[];i.canUseDOM&&r();var l={addEndEventListener:function(e,t){return 0===s.length?void window.setTimeout(t,0):void s.forEach(function(n){o(e,n,t)})},removeEndEventListener:function(e,t){0!==s.length&&s.forEach(function(n){a(e,n,t)})}};t.exports=l},{144:144}],91:[function(e,t,n){"use strict";var r=e(26),o=e(89),a=e(24),i=e(150),u=r.createClass({displayName:"ReactTransitionGroup",propTypes:{component:r.PropTypes.any,childFactory:r.PropTypes.func},getDefaultProps:function(){return{component:"span",childFactory:i.thatReturnsArgument}},getInitialState:function(){return{children:o.getChildMapping(this.props.children)}},componentWillMount:function(){this.currentlyTransitioningKeys={},this.keysToEnter=[],this.keysToLeave=[]},componentDidMount:function(){var e=this.state.children;for(var t in e)e[t]&&this.performAppear(t)},componentWillReceiveProps:function(e){var t=o.getChildMapping(e.children),n=this.state.children;this.setState({children:o.mergeChildMappings(n,t)});var r;for(r in t){var a=n&&n.hasOwnProperty(r);!t[r]||a||this.currentlyTransitioningKeys[r]||this.keysToEnter.push(r)}for(r in n){var i=t&&t.hasOwnProperty(r);!n[r]||i||this.currentlyTransitioningKeys[r]||this.keysToLeave.push(r)}},componentDidUpdate:function(){var e=this.keysToEnter;this.keysToEnter=[],e.forEach(this.performEnter);var t=this.keysToLeave;this.keysToLeave=[],t.forEach(this.performLeave)},performAppear:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)},_handleDoneAppearing:function(e){var t=this.refs[e];t.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e];var n=o.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)||this.performLeave(e)},performEnter:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)},_handleDoneEntering:function(e){var t=this.refs[e];t.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e];var n=o.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)||this.performLeave(e)},performLeave:function(e){this.currentlyTransitioningKeys[e]=!0;var t=this.refs[e];t.componentWillLeave?t.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)},_handleDoneLeaving:function(e){var t=this.refs[e];t.componentDidLeave&&t.componentDidLeave(),delete this.currentlyTransitioningKeys[e];var n=o.getChildMapping(this.props.children);n&&n.hasOwnProperty(e)?this.performEnter(e):this.setState(function(t){var n=a({},t.children);return delete n[e],{children:n}})},render:function(){var e=[];for(var t in this.state.children){var n=this.state.children[t];n&&e.push(r.cloneElement(this.props.childFactory(n),{ref:t,key:t}))}return r.createElement(this.props.component,this.props,e)}});t.exports=u},{150:150,24:24,26:26,89:89}],92:[function(e,t,n){"use strict";function r(e){u.enqueueUpdate(e)}function o(e,t){var n=i.get(e);return n?n:null}var a=(e(39),e(55)),i=e(66),u=e(93),s=e(24),l=e(158),c=(e(168),{isMounted:function(e){var t=i.get(e);return t?!!t._renderedComponent:!1},enqueueCallback:function(e,t){"function"!=typeof t?l(!1):void 0;var n=o(e);return n?(n._pendingCallbacks?n._pendingCallbacks.push(t):n._pendingCallbacks=[t],void r(n)):null},enqueueCallbackInternal:function(e,t){"function"!=typeof t?l(!1):void 0,e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=o(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=o(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=o(e,"setState");if(n){var a=n._pendingStateQueue||(n._pendingStateQueue=[]);a.push(t),r(n)}},enqueueSetProps:function(e,t){var n=o(e,"setProps");n&&c.enqueueSetPropsInternal(n,t)},enqueueSetPropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:l(!1);var o=n._pendingElement||n._currentElement,i=o.props,u=s({},i.props,t);n._pendingElement=a.cloneAndReplaceProps(o,a.cloneAndReplaceProps(i,u)),r(n)},enqueueReplaceProps:function(e,t){var n=o(e,"replaceProps");n&&c.enqueueReplacePropsInternal(n,t)},enqueueReplacePropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:l(!1);var o=n._pendingElement||n._currentElement,i=o.props;n._pendingElement=a.cloneAndReplaceProps(o,a.cloneAndReplaceProps(i,t)),r(n)},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)}});t.exports=c},{158:158,168:168,24:24,39:39,55:55,66:66,93:93}],93:[function(e,t,n){"use strict";function r(){P.ReactReconcileTransaction&&_?void 0:m(!1)}function o(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=c.getPooled(),this.reconcileTransaction=P.ReactReconcileTransaction.getPooled(!1)}function a(e,t,n,o,a,i){r(),_.batchedUpdates(e,t,n,o,a,i)}function i(e,t){return e._mountOrder-t._mountOrder}function u(e){var t=e.dirtyComponentsLength;t!==g.length?m(!1):void 0,g.sort(i);for(var n=0;t>n;n++){var r=g[n],o=r._pendingCallbacks;if(r._pendingCallbacks=null,f.performUpdateIfNecessary(r,e.reconcileTransaction),o)for(var a=0;a<o.length;a++)e.callbackQueue.enqueue(o[a],r.getPublicInstance())}}function s(e){return r(),_.isBatchingUpdates?void g.push(e):void _.batchedUpdates(s,e)}function l(e,t){_.isBatchingUpdates?void 0:m(!1),y.enqueue(e,t),C=!0}var c=e(6),p=e(25),d=e(76),f=e(82),h=e(110),v=e(24),m=e(158),g=[],y=c.getPooled(),C=!1,_=null,E={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),D()):g.length=0}},b={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},x=[E,b];v(o.prototype,h.Mixin,{getTransactionWrappers:function(){return x},destructor:function(){this.dirtyComponentsLength=null,c.release(this.callbackQueue),this.callbackQueue=null,P.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),p.addPoolingTo(o);var D=function(){for(;g.length||C;){if(g.length){var e=o.getPooled();e.perform(u,null,e),o.release(e)}if(C){C=!1;var t=y;y=c.getPooled(),t.notifyAll(),c.release(t)}}};D=d.measure("ReactUpdates","flushBatchedUpdates",D);var T={injectReconcileTransaction:function(e){e?void 0:m(!1),P.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:m(!1),"function"!=typeof e.batchedUpdates?m(!1):void 0,"boolean"!=typeof e.isBatchingUpdates?m(!1):void 0,_=e}},P={ReactReconcileTransaction:null,batchedUpdates:a,enqueueUpdate:s,flushBatchedUpdates:D,injection:T,asap:l};t.exports=P},{110:110,158:158,24:24,25:25,6:6,76:76,82:82}],94:[function(e,t,n){"use strict";t.exports="0.14.9"},{}],95:[function(e,t,n){"use strict";var r=e(10),o=r.injection.MUST_USE_ATTRIBUTE,a={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},i={Properties:{clipPath:o,cx:o,cy:o,d:o,dx:o,dy:o,fill:o,fillOpacity:o,fontFamily:o,fontSize:o,fx:o,fy:o,gradientTransform:o,gradientUnits:o,markerEnd:o,markerMid:o,markerStart:o,offset:o,opacity:o,patternContentUnits:o,patternUnits:o,points:o,preserveAspectRatio:o,r:o,rx:o,ry:o,spreadMethod:o,stopColor:o,stopOpacity:o,stroke:o,strokeDasharray:o,strokeLinecap:o,strokeOpacity:o,strokeWidth:o,textAnchor:o,transform:o,version:o,viewBox:o,x1:o,x2:o,x:o,xlinkActuate:o,xlinkArcrole:o,xlinkHref:o,xlinkRole:o,xlinkShow:o,xlinkTitle:o,xlinkType:o,xmlBase:o,xmlLang:o,xmlSpace:o,y1:o,y2:o,y:o},DOMAttributeNamespaces:{xlinkActuate:a.xlink,xlinkArcrole:a.xlink,xlinkHref:a.xlink,xlinkRole:a.xlink,xlinkShow:a.xlink,xlinkTitle:a.xlink,xlinkType:a.xlink,xmlBase:a.xml,xmlLang:a.xml,xmlSpace:a.xml},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space"}};t.exports=i},{10:10}],96:[function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&s.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function o(e,t){if(_||null==g||g!==c())return null;var n=r(g);if(!C||!f(C,n)){C=n;var o=l.getPooled(m.select,y,e,t);return o.type="select",o.target=g,i.accumulateTwoPhaseDispatches(o),o}return null}var a=e(15),i=e(19),u=e(144),s=e(64),l=e(102),c=e(153),p=e(131),d=e(163),f=e(166),h=a.topLevelTypes,v=u.canUseDOM&&"documentMode"in document&&document.documentMode<=11,m={select:{phasedRegistrationNames:{bubbled:d({onSelect:null}),captured:d({onSelectCapture:null})},dependencies:[h.topBlur,h.topContextMenu,h.topFocus,h.topKeyDown,h.topMouseDown,h.topMouseUp,h.topSelectionChange]}},g=null,y=null,C=null,_=!1,E=!1,b=d({onSelect:null}),x={eventTypes:m,extractEvents:function(e,t,n,r,a){if(!E)return null;switch(e){case h.topFocus:(p(t)||"true"===t.contentEditable)&&(g=t,y=n,C=null);break;case h.topBlur:g=null,y=null,C=null;break;case h.topMouseDown:_=!0;break;case h.topContextMenu:case h.topMouseUp:return _=!1,o(r,a);case h.topSelectionChange:if(v)break;case h.topKeyDown:case h.topKeyUp:return o(r,a)}return null},didPutListener:function(e,t,n){t===b&&(E=!0)}};t.exports=x},{102:102,131:131,144:144,15:15,153:153,163:163,166:166,19:19,64:64}],97:[function(e,t,n){"use strict";var r=Math.pow(2,53),o={createReactRootIndex:function(){return Math.ceil(Math.random()*r)}};t.exports=o},{}],98:[function(e,t,n){"use strict";var r=e(15),o=e(143),a=e(19),i=e(70),u=e(99),s=e(102),l=e(103),c=e(105),p=e(106),d=e(101),f=e(107),h=e(108),v=e(109),m=e(150),g=e(122),y=e(158),C=e(163),_=r.topLevelTypes,E={abort:{phasedRegistrationNames:{bubbled:C({onAbort:!0}),captured:C({onAbortCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:C({onBlur:!0}),captured:C({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:C({onCanPlay:!0}),captured:C({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:C({onCanPlayThrough:!0}),captured:C({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:C({onClick:!0}),captured:C({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:C({onContextMenu:!0}),captured:C({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:C({onCopy:!0}),captured:C({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:C({onCut:!0}),captured:C({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:C({onDoubleClick:!0}),captured:C({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:C({onDrag:!0}),captured:C({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:C({onDragEnd:!0}),captured:C({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:C({onDragEnter:!0}),captured:C({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:C({onDragExit:!0}),captured:C({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:C({onDragLeave:!0}),captured:C({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:C({onDragOver:!0}),captured:C({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{bubbled:C({onDragStart:!0}),captured:C({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:C({onDrop:!0}),captured:C({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:C({onDurationChange:!0}),captured:C({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:C({onEmptied:!0}),captured:C({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:C({onEncrypted:!0}),captured:C({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:C({onEnded:!0}),captured:C({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:C({onError:!0}),captured:C({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:C({onFocus:!0}),captured:C({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:C({onInput:!0}),captured:C({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:C({onKeyDown:!0}),captured:C({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:C({onKeyPress:!0}),captured:C({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:C({onKeyUp:!0}),captured:C({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:C({onLoad:!0}),captured:C({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:C({onLoadedData:!0}),captured:C({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:C({onLoadedMetadata:!0}),captured:C({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:C({onLoadStart:!0}),captured:C({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:C({onMouseDown:!0}),captured:C({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:C({onMouseMove:!0}),captured:C({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:C({onMouseOut:!0}),captured:C({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:C({onMouseOver:!0}),captured:C({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:C({onMouseUp:!0}),captured:C({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:C({onPaste:!0}),captured:C({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:C({onPause:!0}),captured:C({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:C({onPlay:!0}),captured:C({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:C({onPlaying:!0}),captured:C({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:C({onProgress:!0}),captured:C({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:C({onRateChange:!0}),captured:C({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:C({onReset:!0}),captured:C({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:C({onScroll:!0}),captured:C({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:C({onSeeked:!0}),captured:C({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:C({onSeeking:!0}),captured:C({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:C({onStalled:!0}),captured:C({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:C({onSubmit:!0}),captured:C({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:C({onSuspend:!0}),captured:C({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:C({onTimeUpdate:!0}),captured:C({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:C({onTouchCancel:!0}),captured:C({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:C({onTouchEnd:!0}),captured:C({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:C({onTouchMove:!0}),captured:C({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:C({onTouchStart:!0}),captured:C({onTouchStartCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:C({onVolumeChange:!0}),captured:C({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:C({onWaiting:!0}),captured:C({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:C({onWheel:!0}),captured:C({onWheelCapture:!0})}}},b={topAbort:E.abort,topBlur:E.blur,topCanPlay:E.canPlay,topCanPlayThrough:E.canPlayThrough,topClick:E.click,topContextMenu:E.contextMenu,topCopy:E.copy,topCut:E.cut,topDoubleClick:E.doubleClick,topDrag:E.drag,topDragEnd:E.dragEnd,topDragEnter:E.dragEnter,topDragExit:E.dragExit,topDragLeave:E.dragLeave,topDragOver:E.dragOver,topDragStart:E.dragStart,topDrop:E.drop,topDurationChange:E.durationChange,topEmptied:E.emptied,topEncrypted:E.encrypted,topEnded:E.ended,topError:E.error,topFocus:E.focus,topInput:E.input,topKeyDown:E.keyDown,topKeyPress:E.keyPress,topKeyUp:E.keyUp,topLoad:E.load,topLoadedData:E.loadedData,topLoadedMetadata:E.loadedMetadata,topLoadStart:E.loadStart,topMouseDown:E.mouseDown,topMouseMove:E.mouseMove,topMouseOut:E.mouseOut,topMouseOver:E.mouseOver,topMouseUp:E.mouseUp,topPaste:E.paste,topPause:E.pause,topPlay:E.play,topPlaying:E.playing,topProgress:E.progress,topRateChange:E.rateChange,topReset:E.reset,topScroll:E.scroll,topSeeked:E.seeked,topSeeking:E.seeking,topStalled:E.stalled,topSubmit:E.submit,topSuspend:E.suspend,topTimeUpdate:E.timeUpdate,topTouchCancel:E.touchCancel,topTouchEnd:E.touchEnd,topTouchMove:E.touchMove,topTouchStart:E.touchStart,topVolumeChange:E.volumeChange,topWaiting:E.waiting,topWheel:E.wheel};for(var x in b)b[x].dependencies=[x];var D=C({onClick:null}),T={},P={eventTypes:E,extractEvents:function(e,t,n,r,o){var i=b[e];if(!i)return null;var m;switch(e){case _.topAbort:case _.topCanPlay:case _.topCanPlayThrough:case _.topDurationChange:case _.topEmptied:case _.topEncrypted:case _.topEnded:case _.topError:case _.topInput:case _.topLoad:case _.topLoadedData:case _.topLoadedMetadata:case _.topLoadStart:case _.topPause:case _.topPlay:case _.topPlaying:case _.topProgress:case _.topRateChange:case _.topReset:case _.topSeeked:case _.topSeeking:case _.topStalled:case _.topSubmit:case _.topSuspend:case _.topTimeUpdate:case _.topVolumeChange:case _.topWaiting:m=s;break;case _.topKeyPress:if(0===g(r))return null;case _.topKeyDown:case _.topKeyUp:m=c;break;case _.topBlur:case _.topFocus:m=l;break;case _.topClick:if(2===r.button)return null;case _.topContextMenu:case _.topDoubleClick:case _.topMouseDown:case _.topMouseMove:case _.topMouseOut:case _.topMouseOver:case _.topMouseUp:m=p;break;case _.topDrag:case _.topDragEnd:case _.topDragEnter:case _.topDragExit:case _.topDragLeave:case _.topDragOver:case _.topDragStart:case _.topDrop:m=d;break;case _.topTouchCancel:case _.topTouchEnd:case _.topTouchMove:case _.topTouchStart:m=f;break;case _.topScroll:m=h;break;case _.topWheel:m=v;break;case _.topCopy:case _.topCut:case _.topPaste:m=u}m?void 0:y(!1);var C=m.getPooled(i,n,r,o);return a.accumulateTwoPhaseDispatches(C),C},didPutListener:function(e,t,n){if(t===D){var r=i.getNode(e);T[e]||(T[e]=o.listen(r,"click",m))}},willDeleteListener:function(e,t){t===D&&(T[e].remove(),delete T[e])}};t.exports=P},{101:101,102:102,103:103,105:105,106:106,107:107,108:108,109:109,122:122,143:143,15:15,150:150,158:158,163:163,19:19,70:70,99:99}],99:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(102),a={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};o.augmentClass(r,a),t.exports=r},{102:102}],100:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(102),a={data:null};o.augmentClass(r,a),t.exports=r},{102:102}],101:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(106),a={dataTransfer:null};o.augmentClass(r,a),t.exports=r},{106:106}],102:[function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var u=o[a];u?this[a]=u(n):"target"===a?this.target=r:this[a]=n[a]}var s=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;s?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse}var o=e(25),a=e(24),i=e(150),u=(e(168),{type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null});a(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=u,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);a(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=a({},n.Interface,t),e.augmentClass=n.augmentClass,o.addPoolingTo(e,o.fourArgumentPooler)},o.addPoolingTo(r,o.fourArgumentPooler),t.exports=r},{150:150,168:168,24:24,25:25}],103:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(108),a={relatedTarget:null};o.augmentClass(r,a),t.exports=r},{108:108}],104:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(102),a={data:null};o.augmentClass(r,a),t.exports=r},{102:102}],105:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(108),a=e(122),i=e(123),u=e(124),s={key:i,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:u,charCode:function(e){return"keypress"===e.type?a(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?a(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};o.augmentClass(r,s),t.exports=r},{108:108,122:122,123:123,124:124}],106:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r);
+}var o=e(108),a=e(111),i=e(124),u={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:i,button:function(e){var t=e.button;return"which"in e?t:2===t?2:4===t?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+a.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+a.currentScrollTop}};o.augmentClass(r,u),t.exports=r},{108:108,111:111,124:124}],107:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(108),a=e(124),i={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:a};o.augmentClass(r,i),t.exports=r},{108:108,124:124}],108:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(102),a=e(125),i={view:function(e){if(e.view)return e.view;var t=a(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};o.augmentClass(r,i),t.exports=r},{102:102,125:125}],109:[function(e,t,n){"use strict";function r(e,t,n,r){o.call(this,e,t,n,r)}var o=e(106),a={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};o.augmentClass(r,a),t.exports=r},{106:106}],110:[function(e,t,n){"use strict";var r=e(158),o={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,a,i,u,s){this.isInTransaction()?r(!1):void 0;var l,c;try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,n,o,a,i,u,s),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(p){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=a.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===a.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(o){}}}},closeAll:function(e){this.isInTransaction()?void 0:r(!1);for(var t=this.transactionWrappers,n=e;n<t.length;n++){var o,i=t[n],u=this.wrapperInitData[n];try{o=!0,u!==a.OBSERVED_ERROR&&i.close&&i.close.call(this,u),o=!1}finally{if(o)try{this.closeAll(n+1)}catch(s){}}}this.wrapperInitData.length=0}},a={Mixin:o,OBSERVED_ERROR:{}};t.exports=a},{158:158}],111:[function(e,t,n){"use strict";var r={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){r.currentScrollLeft=e.x,r.currentScrollTop=e.y}};t.exports=r},{}],112:[function(e,t,n){"use strict";function r(e,t){if(null==t?o(!1):void 0,null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var o=e(158);t.exports=r},{158:158}],113:[function(e,t,n){"use strict";function r(e){for(var t=1,n=0,r=0,a=e.length,i=-4&a;i>r;){for(;r<Math.min(r+4096,i);r+=4)n+=(t+=e.charCodeAt(r))+(t+=e.charCodeAt(r+1))+(t+=e.charCodeAt(r+2))+(t+=e.charCodeAt(r+3));t%=o,n%=o}for(;a>r;r++)n+=t+=e.charCodeAt(r);return t%=o,n%=o,t|n<<16}var o=65521;t.exports=r},{}],114:[function(e,t,n){"use strict";var r=!1;t.exports=r},{}],115:[function(e,t,n){"use strict";function r(e,t){var n=a.mergeProps(t,e.props);return!n.hasOwnProperty(u)&&e.props.hasOwnProperty(u)&&(n.children=e.props.children),o.createElement(e.type,n)}var o=e(55),a=e(77),i=e(163),u=(e(168),i({children:null}));t.exports=r},{163:163,168:168,55:55,77:77}],116:[function(e,t,n){"use strict";function r(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||a.hasOwnProperty(e)&&a[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var o=e(4),a=o.isUnitlessNumber;t.exports=r},{4:4}],117:[function(e,t,n){"use strict";function r(e,t,n,r,o){return o}e(24),e(168);t.exports=r},{168:168,24:24}],118:[function(e,t,n){"use strict";function r(e){return a[e]}function o(e){return(""+e).replace(i,r)}var a={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},i=/[&><"']/g;t.exports=o},{}],119:[function(e,t,n){"use strict";function r(e){return null==e?null:1===e.nodeType?e:o.has(e)?a.getNodeFromInstance(e):(null!=e.render&&"function"==typeof e.render?i(!1):void 0,void i(!1))}var o=(e(39),e(66)),a=e(70),i=e(158);e(168);t.exports=r},{158:158,168:168,39:39,66:66,70:70}],120:[function(e,t,n){"use strict";function r(e,t,n){var r=e,o=void 0===r[n];o&&null!=t&&(r[n]=t)}function o(e){if(null==e)return e;var t={};return a(e,r,t),t}var a=e(139);e(168);t.exports=o},{139:139,168:168}],121:[function(e,t,n){"use strict";var r=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};t.exports=r},{}],122:[function(e,t,n){"use strict";function r(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}t.exports=r},{}],123:[function(e,t,n){"use strict";function r(e){if(e.key){var t=a[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=o(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?i[e.keyCode]||"Unidentified":""}var o=e(122),a={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};t.exports=r},{122:122}],124:[function(e,t,n){"use strict";function r(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var r=a[e];return r?!!n[r]:!1}function o(e){return r}var a={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};t.exports=o},{}],125:[function(e,t,n){"use strict";function r(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}t.exports=r},{}],126:[function(e,t,n){"use strict";function r(e){var t=e&&(o&&e[o]||e[a]);return"function"==typeof t?t:void 0}var o="function"==typeof Symbol&&Symbol.iterator,a="@@iterator";t.exports=r},{}],127:[function(e,t,n){"use strict";function r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function o(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function a(e,t){for(var n=r(e),a=0,i=0;n;){if(3===n.nodeType){if(i=a+n.textContent.length,t>=a&&i>=t)return{node:n,offset:t-a};a=i}n=r(o(n))}}t.exports=a},{}],128:[function(e,t,n){"use strict";function r(){return!a&&o.canUseDOM&&(a="textContent"in document.documentElement?"textContent":"innerText"),a}var o=e(144),a=null;t.exports=r},{144:144}],129:[function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function o(e){var t;if(null===e||e===!1)t=new i(o);else if("object"==typeof e){var n=e;!n||"function"!=typeof n.type&&"string"!=typeof n.type?l(!1):void 0,t="string"==typeof n.type?u.createInternalComponent(n):r(n.type)?new n.type(n):new c}else"string"==typeof e||"number"==typeof e?t=u.createInstanceForText(e):l(!1);return t.construct(e),t._mountIndex=0,t._mountImage=null,t}var a=e(38),i=e(57),u=e(73),s=e(24),l=e(158),c=(e(168),function(){});s(c.prototype,a.Mixin,{_instantiateReactComponent:o}),t.exports=o},{158:158,168:168,24:24,38:38,57:57,73:73}],130:[function(e,t,n){"use strict";function r(e,t){if(!a.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var i=document.createElement("div");i.setAttribute(n,"return;"),r="function"==typeof i[n]}return!r&&o&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var o,a=e(144);a.canUseDOM&&(o=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),t.exports=r},{144:144}],131:[function(e,t,n){"use strict";function r(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&o[e.type]||"textarea"===t)}var o={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};t.exports=r},{}],132:[function(e,t,n){"use strict";function r(e){return o.isValidElement(e)?void 0:a(!1),e}var o=e(55),a=e(158);t.exports=r},{158:158,55:55}],133:[function(e,t,n){"use strict";function r(e){return'"'+o(e)+'"'}var o=e(118);t.exports=r},{118:118}],134:[function(e,t,n){"use strict";var r=e(70);t.exports=r.renderSubtreeIntoContainer},{70:70}],135:[function(e,t,n){"use strict";var r=e(144),o=/^[ \r\n\t\f]/,a=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,i=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(i=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var u=document.createElement("div");u.innerHTML=" ",""===u.innerHTML&&(i=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),o.test(t)||"<"===t[0]&&a.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}t.exports=i},{144:144}],136:[function(e,t,n){"use strict";var r=e(144),o=e(118),a=e(135),i=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(i=function(e,t){a(e,o(t))})),t.exports=i},{118:118,135:135,144:144}],137:[function(e,t,n){"use strict";function r(e,t,n){return!o(e.props,t)||!o(e.state,n)}var o=e(166);t.exports=r},{166:166}],138:[function(e,t,n){"use strict";function r(e,t){var n=null===e||e===!1,r=null===t||t===!1;if(n||r)return n===r;var o=typeof e,a=typeof t;return"string"===o||"number"===o?"string"===a||"number"===a:"object"===a&&e.type===t.type&&e.key===t.key}t.exports=r},{}],139:[function(e,t,n){"use strict";function r(e){return v[e]}function o(e,t){return e&&null!=e.key?i(e.key):t.toString(36)}function a(e){return(""+e).replace(m,r)}function i(e){return"$"+a(e)}function u(e,t,n,r){var a=typeof e;if(("undefined"===a||"boolean"===a)&&(e=null),null===e||"string"===a||"number"===a||l.isValidElement(e))return n(r,e,""===t?f+o(e,0):t),1;var s,c,v=0,m=""===t?f:t+h;if(Array.isArray(e))for(var g=0;g<e.length;g++)s=e[g],c=m+o(s,g),v+=u(s,c,n,r);else{var y=p(e);if(y){var C,_=y.call(e);if(y!==e.entries)for(var E=0;!(C=_.next()).done;)s=C.value,c=m+o(s,E++),v+=u(s,c,n,r);else for(;!(C=_.next()).done;){var b=C.value;b&&(s=b[1],c=m+i(b[0])+h+o(s,0),v+=u(s,c,n,r))}}else"object"===a&&(String(e),d(!1))}return v}function s(e,t,n){return null==e?0:u(e,"",t,n)}var l=(e(39),e(55)),c=e(65),p=e(126),d=e(158),f=(e(168),c.SEPARATOR),h=":",v={"=":"=0",".":"=1",":":"=2"},m=/[=.:]/g;t.exports=s},{126:126,158:158,168:168,39:39,55:55,65:65}],140:[function(e,t,n){"use strict";function r(e){return Array.isArray(e)?e.concat():e&&"object"==typeof e?i(new e.constructor,e):e}function o(e,t,n){Array.isArray(e)?void 0:s(!1);var r=t[n];Array.isArray(r)?void 0:s(!1)}function a(e,t){if("object"!=typeof t?s(!1):void 0,l.call(t,f))return 1!==Object.keys(t).length?s(!1):void 0,t[f];var n=r(e);if(l.call(t,h)){var u=t[h];u&&"object"==typeof u?void 0:s(!1),n&&"object"==typeof n?void 0:s(!1),i(n,t[h])}l.call(t,c)&&(o(e,t,c),t[c].forEach(function(e){n.push(e)})),l.call(t,p)&&(o(e,t,p),t[p].forEach(function(e){n.unshift(e)})),l.call(t,d)&&(Array.isArray(e)?void 0:s(!1),Array.isArray(t[d])?void 0:s(!1),t[d].forEach(function(e){Array.isArray(e)?void 0:s(!1),n.splice.apply(n,e)})),l.call(t,v)&&("function"!=typeof t[v]?s(!1):void 0,n=t[v](n));for(var m in t)g.hasOwnProperty(m)&&g[m]||(n[m]=a(e[m],t[m]));return n}var i=e(24),u=e(163),s=e(158),l={}.hasOwnProperty,c=u({$push:null}),p=u({$unshift:null}),d=u({$splice:null}),f=u({$set:null}),h=u({$merge:null}),v=u({$apply:null}),m=[c,p,d,f,h,v],g={};m.forEach(function(e){g[e]=!0}),t.exports=a},{158:158,163:163,24:24}],141:[function(e,t,n){"use strict";var r=(e(24),e(150)),o=(e(168),r);t.exports=o},{150:150,168:168,24:24}],142:[function(e,t,n){"use strict";var r=e(158),o={addClass:function(e,t){return/\s/.test(t)?r(!1):void 0,t&&(e.classList?e.classList.add(t):o.hasClass(e,t)||(e.className=e.className+" "+t)),e},removeClass:function(e,t){return/\s/.test(t)?r(!1):void 0,t&&(e.classList?e.classList.remove(t):o.hasClass(e,t)&&(e.className=e.className.replace(new RegExp("(^|\\s)"+t+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,""))),e},conditionClass:function(e,t,n){return(n?o.addClass:o.removeClass)(e,t)},hasClass:function(e,t){return/\s/.test(t)?r(!1):void 0,e.classList?!!t&&e.classList.contains(t):(" "+e.className+" ").indexOf(" "+t+" ")>-1}};t.exports=o},{158:158}],143:[function(e,t,n){"use strict";var r=e(150),o={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};t.exports=o},{150:150}],144:[function(e,t,n){"use strict";var r=!("undefined"==typeof window||!window.document||!window.document.createElement),o={canUseDOM:r,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=o},{}],145:[function(e,t,n){"use strict";function r(e){return e.replace(o,function(e,t){return t.toUpperCase()})}var o=/-(.)/g;t.exports=r},{}],146:[function(e,t,n){"use strict";function r(e){return o(e.replace(a,"ms-"))}var o=e(145),a=/^-ms-/;t.exports=r},{145:145}],147:[function(e,t,n){"use strict";function r(e,t){var n=!0;e:for(;n;){var r=e,a=t;if(n=!1,r&&a){if(r===a)return!0;if(o(r))return!1;if(o(a)){e=r,t=a.parentNode,n=!0;continue e}return r.contains?r.contains(a):r.compareDocumentPosition?!!(16&r.compareDocumentPosition(a)):!1}return!1}}var o=e(160);t.exports=r},{160:160}],148:[function(e,t,n){"use strict";function r(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function o(e){return r(e)?Array.isArray(e)?e.slice():a(e):[e]}var a=e(167);t.exports=o},{167:167}],149:[function(e,t,n){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function o(e,t){var n=l;l?void 0:s(!1);var o=r(e),a=o&&u(o);if(a){n.innerHTML=a[1]+e+a[2];for(var c=a[0];c--;)n=n.lastChild}else n.innerHTML=e;var p=n.getElementsByTagName("script");p.length&&(t?void 0:s(!1),i(p).forEach(t));for(var d=i(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return d}var a=e(144),i=e(148),u=e(154),s=e(158),l=a.canUseDOM?document.createElement("div"):null,c=/^\s*<(\w+)/;t.exports=o},{144:144,148:148,154:154,158:158}],150:[function(e,t,n){"use strict";function r(e){return function(){return e}}function o(){}o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},t.exports=o},{}],151:[function(e,t,n){"use strict";var r={};t.exports=r},{}],152:[function(e,t,n){"use strict";function r(e){try{e.focus()}catch(t){}}t.exports=r},{}],153:[function(e,t,n){"use strict";function r(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}t.exports=r},{}],154:[function(e,t,n){"use strict";function r(e){return i?void 0:a(!1),d.hasOwnProperty(e)||(e="*"),u.hasOwnProperty(e)||("*"===e?i.innerHTML="<link />":i.innerHTML="<"+e+"></"+e+">",u[e]=!i.firstChild),u[e]?d[e]:null}var o=e(144),a=e(158),i=o.canUseDOM?document.createElement("div"):null,u={},s=[1,'<select multiple="true">',"</select>"],l=[1,"<table>","</table>"],c=[3,"<table><tbody><tr>","</tr></tbody></table>"],p=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],d={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:s,option:s,caption:l,colgroup:l,tbody:l,tfoot:l,thead:l,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){d[e]=p,u[e]=!0}),t.exports=r},{144:144,158:158}],155:[function(e,t,n){"use strict";function r(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}t.exports=r},{}],156:[function(e,t,n){"use strict";function r(e){return e.replace(o,"-$1").toLowerCase()}var o=/([A-Z])/g;t.exports=r},{}],157:[function(e,t,n){"use strict";function r(e){return o(e).replace(a,"-ms-")}var o=e(156),a=/^ms-/;t.exports=r},{156:156}],158:[function(e,t,n){"use strict";function r(e,t,n,r,o,a,i,u){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,i,u],c=0;s=new Error(t.replace(/%s/g,function(){return l[c++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}}t.exports=r},{}],159:[function(e,t,n){"use strict";function r(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}t.exports=r},{}],160:[function(e,t,n){"use strict";function r(e){return o(e)&&3==e.nodeType}var o=e(159);t.exports=r},{159:159}],161:[function(e,t,n){"use strict";function r(e){e||(e="");var t,n=arguments.length;if(n>1)for(var r=1;n>r;r++)t=arguments[r],t&&(e=(e?e+" ":"")+t);return e}t.exports=r},{}],162:[function(e,t,n){"use strict";var r=e(158),o=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)?void 0:r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};t.exports=o},{158:158}],163:[function(e,t,n){"use strict";var r=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};t.exports=r},{}],164:[function(e,t,n){"use strict";function r(e,t,n){if(!e)return null;var r={};for(var a in e)o.call(e,a)&&(r[a]=t.call(n,e[a],a,e));return r}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],165:[function(e,t,n){"use strict";function r(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}t.exports=r},{}],166:[function(e,t,n){"use strict";function r(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var a=o.bind(t),i=0;i<n.length;i++)if(!a(n[i])||e[n[i]]!==t[n[i]])return!1;return!0}var o=Object.prototype.hasOwnProperty;t.exports=r},{}],167:[function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!=typeof e&&"function"!=typeof e?o(!1):void 0,"number"!=typeof t?o(!1):void 0,0===t||t-1 in e?void 0:o(!1),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),a=0;t>a;a++)r[a]=e[a];return r}var o=e(158);t.exports=r},{158:158}],168:[function(e,t,n){"use strict";var r=e(150),o=r;t.exports=o},{150:150}]},{},[1])(1)});
\ No newline at end of file

lib/accumulateInto.js

@@ -11,7 +11,7 @@
'use strict';
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
/**
*
@@ -28,10 +28,7 @@
*/
function accumulateInto(current, next) {
- ("production" !== process.env.NODE_ENV ? invariant(
- next != null,
- 'accumulateInto(...): Accumulated items must not be null or undefined.'
- ) : invariant(next != null));
+ !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
if (current == null) {
return next;
}

lib/accumulate.js

@@ -0,0 +1,44 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule accumulate
+ */
+
+'use strict';
+
+var invariant = require('fbjs/lib/invariant');
+
+/**
+ * Accumulates items that must not be null or undefined.
+ *
+ * This is used to conserve memory by avoiding array allocations.
+ *
+ * @return {*|array<*>} An accumulation of items.
+ */
+function accumulate(current, next) {
+ !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : invariant(false) : undefined;
+ if (current == null) {
+ return next;
+ } else {
+ // Both are not empty. Warning: Never call x.concat(y) when you are not
+ // certain that x is an Array (x could be a string with concat method).
+ var currentIsArray = Array.isArray(current);
+ var nextIsArray = Array.isArray(next);
+ if (currentIsArray) {
+ return current.concat(next);
+ } else {
+ if (nextIsArray) {
+ return [current].concat(next);
+ } else {
+ return [current, next];
+ }
+ }
+ }
+}
+
+module.exports = accumulate;
\ No newline at end of file

lib/adler32.js

@@ -9,24 +9,34 @@
* @providesModule adler32
*/
-/* jslint bitwise:true */
-
'use strict';
var MOD = 65521;
-// This is a clean-room implementation of adler32 designed for detecting
-// if markup is not what we expect it to be. It does not need to be
-// cryptographically strong, only reasonably good at detecting if markup
-// generated on the server is different than that on the client.
+// adler32 is not cryptographically strong, and is only used to sanity check that
+// markup generated on the server matches the markup generated on the client.
+// This implementation (a modified version of the SheetJS version) has been optimized
+// for our use case, at the expense of conforming to the adler32 specification
+// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
- for (var i = 0; i < data.length; i++) {
- a = (a + data.charCodeAt(i)) % MOD;
- b = (b + a) % MOD;
+ var i = 0;
+ var l = data.length;
+ var m = l & ~0x3;
+ while (i < m) {
+ for (; i < Math.min(i + 4096, m); i += 4) {
+ b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
+ }
+ a %= MOD;
+ b %= MOD;
+ }
+ for (; i < l; i++) {
+ b += a += data.charCodeAt(i);
}
- return a | (b << 16);
+ a %= MOD;
+ b %= MOD;
+ return a | b << 16;
}
module.exports = adler32;

lib/AutoFocusMixin.js

@@ -1,25 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule AutoFocusMixin
- * @typechecks static-only
- */
-
-'use strict';
-
-var focusNode = require("./focusNode");
-
-var AutoFocusMixin = {
- componentDidMount: function() {
- if (this.props.autoFocus) {
- focusNode(this.getDOMNode());
- }
- }
-};
-
-module.exports = AutoFocusMixin;

lib/AutoFocusUtils.js

@@ -0,0 +1,36 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule AutoFocusUtils
+ * @typechecks static-only
+ */
+
+'use strict';
+
+var ReactMount = require('./ReactMount');
+
+var findDOMNode = require('./findDOMNode');
+var focusNode = require('fbjs/lib/focusNode');
+
+var Mixin = {
+ componentDidMount: function () {
+ if (this.props.autoFocus) {
+ focusNode(findDOMNode(this));
+ }
+ }
+};
+
+var AutoFocusUtils = {
+ Mixin: Mixin,
+
+ focusDOMComponent: function () {
+ focusNode(ReactMount.getNode(this._rootNodeID));
+ }
+};
+
+module.exports = AutoFocusUtils;
\ No newline at end of file

lib/BeforeInputEventPlugin.js

@@ -12,22 +12,19 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPropagators = require("./EventPropagators");
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-var FallbackCompositionState = require("./FallbackCompositionState");
-var SyntheticCompositionEvent = require("./SyntheticCompositionEvent");
-var SyntheticInputEvent = require("./SyntheticInputEvent");
+var EventConstants = require('./EventConstants');
+var EventPropagators = require('./EventPropagators');
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var FallbackCompositionState = require('./FallbackCompositionState');
+var SyntheticCompositionEvent = require('./SyntheticCompositionEvent');
+var SyntheticInputEvent = require('./SyntheticInputEvent');
-var keyOf = require("./keyOf");
+var keyOf = require('fbjs/lib/keyOf');
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
-var canUseCompositionEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'CompositionEvent' in window
-);
+var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
@@ -37,22 +34,12 @@
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
-var canUseTextInputEvent = (
- ExecutionEnvironment.canUseDOM &&
- 'TextEvent' in window &&
- !documentMode &&
- !isPresto()
-);
+var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
-var useFallbackCompositionData = (
- ExecutionEnvironment.canUseDOM &&
- (
- (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11)
- )
-);
+var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
@@ -60,11 +47,7 @@
*/
function isPresto() {
var opera = window.opera;
- return (
- typeof opera === 'object' &&
- typeof opera.version === 'function' &&
- parseInt(opera.version(), 10) <= 12
- );
+ return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
@@ -76,57 +59,31 @@
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
- bubbled: keyOf({onBeforeInput: null}),
- captured: keyOf({onBeforeInputCapture: null})
+ bubbled: keyOf({ onBeforeInput: null }),
+ captured: keyOf({ onBeforeInputCapture: null })
},
- dependencies: [
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyPress,
- topLevelTypes.topTextInput,
- topLevelTypes.topPaste
- ]
+ dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionEnd: null}),
- captured: keyOf({onCompositionEndCapture: null})
+ bubbled: keyOf({ onCompositionEnd: null }),
+ captured: keyOf({ onCompositionEndCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionEnd,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionStart: null}),
- captured: keyOf({onCompositionStartCapture: null})
+ bubbled: keyOf({ onCompositionStart: null }),
+ captured: keyOf({ onCompositionStartCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionStart,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
- bubbled: keyOf({onCompositionUpdate: null}),
- captured: keyOf({onCompositionUpdateCapture: null})
+ bubbled: keyOf({ onCompositionUpdate: null }),
+ captured: keyOf({ onCompositionUpdateCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topCompositionUpdate,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyPress,
- topLevelTypes.topKeyUp,
- topLevelTypes.topMouseDown
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
@@ -139,14 +96,11 @@
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
- return (
- (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
+ return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
- !(nativeEvent.ctrlKey && nativeEvent.altKey)
- );
+ !(nativeEvent.ctrlKey && nativeEvent.altKey);
}
-
/**
* Translate native top level events into event types.
*
@@ -173,10 +127,7 @@
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
- return (
- topLevelType === topLevelTypes.topKeyDown &&
- nativeEvent.keyCode === START_KEYCODE
- );
+ return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
@@ -190,11 +141,11 @@
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
- return (END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1);
+ return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
- return (nativeEvent.keyCode !== START_KEYCODE);
+ return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
@@ -232,12 +183,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
-function extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
@@ -267,11 +213,7 @@
}
}
- var event = SyntheticCompositionEvent.getPooled(
- eventType,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
@@ -351,10 +293,7 @@
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
- if (
- topLevelType === topLevelTypes.topCompositionEnd ||
- isFallbackCompositionEnd(topLevelType, nativeEvent)
- ) {
+ if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
@@ -406,12 +345,7 @@
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
-function extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
-) {
+function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
@@ -426,11 +360,7 @@
return null;
}
- var event = SyntheticInputEvent.getPooled(
- eventTypes.beforeInput,
- topLevelTargetID,
- nativeEvent
- );
+ var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
@@ -467,26 +397,8 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ) {
- return [
- extractCompositionEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- ),
- extractBeforeInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- )
- ];
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};

lib/CallbackQueue.js

@@ -11,10 +11,10 @@
'use strict';
-var PooledClass = require("./PooledClass");
+var PooledClass = require('./PooledClass');
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
/**
* A specialized pseudo-event module to help keep track of components waiting to
@@ -41,7 +41,7 @@
* @param {?object} context Context to call `callback` with.
* @internal
*/
- enqueue: function(callback, context) {
+ enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
@@ -54,17 +54,14 @@
*
* @internal
*/
- notifyAll: function() {
+ notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
- ("production" !== process.env.NODE_ENV ? invariant(
- callbacks.length === contexts.length,
- 'Mismatched list of contexts in callback queue'
- ) : invariant(callbacks.length === contexts.length));
+ !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
- for (var i = 0, l = callbacks.length; i < l; i++) {
+ for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
@@ -77,7 +74,7 @@
*
* @internal
*/
- reset: function() {
+ reset: function () {
this._callbacks = null;
this._contexts = null;
},
@@ -85,7 +82,7 @@
/**
* `PooledClass` looks for this.
*/
- destructor: function() {
+ destructor: function () {
this.reset();
}

lib/camelize.js

@@ -1,30 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule camelize
- * @typechecks
- */
-
-var _hyphenPattern = /-(.)/g;
-
-/**
- * Camelcases a hyphenated string, for example:
- *
- * > camelize('background-color')
- * < "backgroundColor"
- *
- * @param {string} string
- * @return {string}
- */
-function camelize(string) {
- return string.replace(_hyphenPattern, function(_, character) {
- return character.toUpperCase();
- });
-}
-
-module.exports = camelize;

lib/camelizeStyleName.js

@@ -1,40 +0,0 @@
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule camelizeStyleName
- * @typechecks
- */
-
-"use strict";
-
-var camelize = require("./camelize");
-
-var msPattern = /^-ms-/;
-
-/**
- * Camelcases a hyphenated CSS property name, for example:
- *
- * > camelizeStyleName('background-color')
- * < "backgroundColor"
- * > camelizeStyleName('-moz-transition')
- * < "MozTransition"
- * > camelizeStyleName('-ms-transition')
- * < "msTransition"
- *
- * As Andi Smith suggests
- * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
- * is converted to lowercase `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function camelizeStyleName(string) {
- return camelize(string.replace(msPattern, 'ms-'));
-}
-
-module.exports = camelizeStyleName;

lib/canDefineProperty.js

@@ -0,0 +1,24 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule canDefineProperty
+ */
+
+'use strict';
+
+var canDefineProperty = false;
+if (process.env.NODE_ENV !== 'production') {
+ try {
+ Object.defineProperty({}, 'x', { get: function () {} });
+ canDefineProperty = true;
+ } catch (x) {
+ // IE will fail on defineProperty
+ }
+}
+
+module.exports = canDefineProperty;
\ No newline at end of file

lib/ChangeEventPlugin.js

@@ -11,35 +11,27 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPluginHub = require("./EventPluginHub");
-var EventPropagators = require("./EventPropagators");
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-var ReactUpdates = require("./ReactUpdates");
-var SyntheticEvent = require("./SyntheticEvent");
-
-var isEventSupported = require("./isEventSupported");
-var isTextInputElement = require("./isTextInputElement");
-var keyOf = require("./keyOf");
+var EventConstants = require('./EventConstants');
+var EventPluginHub = require('./EventPluginHub');
+var EventPropagators = require('./EventPropagators');
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var ReactUpdates = require('./ReactUpdates');
+var SyntheticEvent = require('./SyntheticEvent');
+
+var getEventTarget = require('./getEventTarget');
+var isEventSupported = require('./isEventSupported');
+var isTextInputElement = require('./isTextInputElement');
+var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
- bubbled: keyOf({onChange: null}),
- captured: keyOf({onChangeCapture: null})
+ bubbled: keyOf({ onChange: null }),
+ captured: keyOf({ onChangeCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topChange,
- topLevelTypes.topClick,
- topLevelTypes.topFocus,
- topLevelTypes.topInput,
- topLevelTypes.topKeyDown,
- topLevelTypes.topKeyUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
@@ -55,26 +47,18 @@
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
- return (
- elem.nodeName === 'SELECT' ||
- (elem.nodeName === 'INPUT' && elem.type === 'file')
- );
+ var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
- doesChangeEventBubble = isEventSupported('change') && (
- (!('documentMode' in document) || document.documentMode > 8)
- );
+ doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- activeElementID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
@@ -93,7 +77,7 @@
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
@@ -111,18 +95,12 @@
activeElementID = null;
}
-function getTargetIDForChangeEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
-function handleEventsForChangeEventIE8(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
@@ -141,9 +118,7 @@
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
- isInputEventSupported = isEventSupported('input') && (
- (!('documentMode' in document) || document.documentMode > 9)
- );
+ isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
@@ -151,10 +126,10 @@
* set on the active element.
*/
var newValueProp = {
- get: function() {
+ get: function () {
return activeElementValueProp.get.call(this);
},
- set: function(val) {
+ set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
@@ -170,11 +145,10 @@
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
- activeElementValueProp = Object.getOwnPropertyDescriptor(
- target.constructor.prototype,
- 'value'
- );
+ activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
+ // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
+ // on DOM elements
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
@@ -218,10 +192,7 @@
/**
* If a `change` event should be fired, returns the target's ID.
*/
-function getTargetIDForInputEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
@@ -230,10 +201,7 @@
}
// For IE8 and IE9.
-function handleEventsForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
@@ -256,13 +224,8 @@
}
// For IE8 and IE9.
-function getTargetIDForInputEventIE(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
- if (topLevelType === topLevelTypes.topSelectionChange ||
- topLevelType === topLevelTypes.topKeyUp ||
- topLevelType === topLevelTypes.topKeyDown) {
+function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
+ if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
@@ -288,16 +250,10 @@
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
- return (
- elem.nodeName === 'INPUT' &&
- (elem.type === 'checkbox' || elem.type === 'radio')
- );
+ return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
-function getTargetIDForClickEvent(
- topLevelType,
- topLevelTarget,
- topLevelTargetID) {
+function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
@@ -325,11 +281,7 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
@@ -350,28 +302,17 @@
}
if (getTargetIDFunc) {
- var targetID = getTargetIDFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
- var event = SyntheticEvent.getPooled(
- eventTypes.change,
- targetID,
- nativeEvent
- );
+ var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
+ event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
- handleEventFunc(
- topLevelType,
- topLevelTarget,
- topLevelTargetID
- );
+ handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}

lib/ClientReactRootIndex.js

@@ -15,7 +15,7 @@
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return nextReactRootIndex++;
}
};

lib/cloneWithProps.js

@@ -12,13 +12,15 @@
'use strict';
-var ReactElement = require("./ReactElement");
-var ReactPropTransferer = require("./ReactPropTransferer");
+var ReactElement = require('./ReactElement');
+var ReactPropTransferer = require('./ReactPropTransferer');
-var keyOf = require("./keyOf");
-var warning = require("./warning");
+var keyOf = require('fbjs/lib/keyOf');
+var warning = require('fbjs/lib/warning');
-var CHILDREN_PROP = keyOf({children: null});
+var CHILDREN_PROP = keyOf({ children: null });
+
+var didDeprecatedWarn = false;
/**
* Sometimes you want to change the props of a child passed to you. Usually
@@ -28,26 +30,23 @@
* @param {object} props props you'd like to modify. className and style will be
* merged automatically.
* @return {ReactElement} a clone of child with props merged in.
+ * @deprecated
*/
function cloneWithProps(child, props) {
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- !child.ref,
- 'You are calling cloneWithProps() on a child with a ref. This is ' +
- 'dangerous because you\'re creating a new child which will not be ' +
- 'added as a ref to its parent.'
- ) : null);
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(didDeprecatedWarn, 'cloneWithProps(...) is deprecated. ' + 'Please use React.cloneElement instead.') : undefined;
+ didDeprecatedWarn = true;
+ process.env.NODE_ENV !== 'production' ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
}
var newProps = ReactPropTransferer.mergeProps(props, child.props);
// Use `child.props.children` if it is provided.
- if (!newProps.hasOwnProperty(CHILDREN_PROP) &&
- child.props.hasOwnProperty(CHILDREN_PROP)) {
+ if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) {
newProps.children = child.props.children;
}
- // The current API doesn't retain _owner and _context, which is why this
+ // The current API doesn't retain _owner, which is why this
// doesn't use ReactElement.cloneAndReplaceProps.
return ReactElement.createElement(child.type, newProps);
}

lib/containsNode.js

@@ -1,42 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule containsNode
- * @typechecks
- */
-
-var isTextNode = require("./isTextNode");
-
-/*jslint bitwise:true */
-
-/**
- * Checks if a given DOM node contains or is another DOM node.
- *
- * @param {?DOMNode} outerNode Outer DOM node.
- * @param {?DOMNode} innerNode Inner DOM node.
- * @return {boolean} True if `outerNode` contains or is `innerNode`.
- */
-function containsNode(outerNode, innerNode) {
- if (!outerNode || !innerNode) {
- return false;
- } else if (outerNode === innerNode) {
- return true;
- } else if (isTextNode(outerNode)) {
- return false;
- } else if (isTextNode(innerNode)) {
- return containsNode(outerNode, innerNode.parentNode);
- } else if (outerNode.contains) {
- return outerNode.contains(innerNode);
- } else if (outerNode.compareDocumentPosition) {
- return !!(outerNode.compareDocumentPosition(innerNode) & 16);
- } else {
- return false;
- }
-}
-
-module.exports = containsNode;

lib/createArrayFromMixed.js

@@ -1,84 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createArrayFromMixed
- * @typechecks
- */
-
-var toArray = require("./toArray");
-
-/**
- * Perform a heuristic test to determine if an object is "array-like".
- *
- * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
- * Joshu replied: "Mu."
- *
- * This function determines if its argument has "array nature": it returns
- * true if the argument is an actual array, an `arguments' object, or an
- * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
- *
- * It will return false for other array-like objects like Filelist.
- *
- * @param {*} obj
- * @return {boolean}
- */
-function hasArrayNature(obj) {
- return (
- // not null/false
- !!obj &&
- // arrays are objects, NodeLists are functions in Safari
- (typeof obj == 'object' || typeof obj == 'function') &&
- // quacks like an array
- ('length' in obj) &&
- // not window
- !('setInterval' in obj) &&
- // no DOM node should be considered an array-like
- // a 'select' element has 'length' and 'item' properties on IE8
- (typeof obj.nodeType != 'number') &&
- (
- // a real array
- (// HTMLCollection/NodeList
- (Array.isArray(obj) ||
- // arguments
- ('callee' in obj) || 'item' in obj))
- )
- );
-}
-
-/**
- * Ensure that the argument is an array by wrapping it in an array if it is not.
- * Creates a copy of the argument if it is already an array.
- *
- * This is mostly useful idiomatically:
- *
- * var createArrayFromMixed = require('createArrayFromMixed');
- *
- * function takesOneOrMoreThings(things) {
- * things = createArrayFromMixed(things);
- * ...
- * }
- *
- * This allows you to treat `things' as an array, but accept scalars in the API.
- *
- * If you need to convert an array-like object, like `arguments`, into an array
- * use toArray instead.
- *
- * @param {*} obj
- * @return {array}
- */
-function createArrayFromMixed(obj) {
- if (!hasArrayNature(obj)) {
- return [obj];
- } else if (Array.isArray(obj)) {
- return obj.slice();
- } else {
- return toArray(obj);
- }
-}
-
-module.exports = createArrayFromMixed;

lib/createFullPageComponent.js

@@ -1,58 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createFullPageComponent
- * @typechecks
- */
-
-'use strict';
-
-// Defeat circular references by requiring this directly.
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-
-var invariant = require("./invariant");
-
-/**
- * Create a component that will throw an exception when unmounted.
- *
- * Components like <html> <head> and <body> can't be removed or added
- * easily in a cross-browser way, however it's valuable to be able to
- * take advantage of React's reconciliation for styling and <title>
- * management. So we just document it and throw in dangerous cases.
- *
- * @param {string} tag The tag to wrap
- * @return {function} convenience constructor of new component
- */
-function createFullPageComponent(tag) {
- var elementFactory = ReactElement.createFactory(tag);
-
- var FullPageComponent = ReactClass.createClass({
- tagName: tag.toUpperCase(),
- displayName: 'ReactFullPageComponent' + tag,
-
- componentWillUnmount: function() {
- ("production" !== process.env.NODE_ENV ? invariant(
- false,
- '%s tried to unmount. Because of cross-browser quirks it is ' +
- 'impossible to unmount some top-level components (eg <html>, <head>, ' +
- 'and <body>) reliably and efficiently. To fix this, have a single ' +
- 'top-level component that never unmounts render these elements.',
- this.constructor.displayName
- ) : invariant(false));
- },
-
- render: function() {
- return elementFactory(this.props);
- }
- });
-
- return FullPageComponent;
-}
-
-module.exports = createFullPageComponent;

lib/createHierarchyRenderer.js

@@ -0,0 +1,85 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule createHierarchyRenderer
+ */
+
+'use strict';
+
+var React = require('./React');
+
+/**
+ * Creates a render method that makes it easier to create, render, and inspect a
+ * hierarchy of mock React component classes.
+ *
+ * A component class is created for each of the supplied render methods. Each
+ * render method is invoked with the classes created using the render methods
+ * that come after it in the supplied list of render methods.
+ *
+ * var renderHierarchy = createHierarchyRenderer(
+ * function ComponentA(ComponentB, ComponentC) {...},
+ * function ComponentB(ComponentC) {...},
+ * function ComponentC() {...}
+ * );
+ *
+ * When the hierarchy is invoked, a two-dimensional array is returned. Each
+ * array corresponds to a supplied render method and contains the instances
+ * returned by that render method in the order it was invoked.
+ *
+ * var instances = renderHierarchy(
+ * function(ComponentA[, ComponentB, ComponentC]) {
+ * ReactDOM.render(<ComponentA />, ...);
+ * })
+ * );
+ * instances[0][0]; // First return value of first render method.
+ * instances[1][0]; // First return value of second render method.
+ * instances[1][1]; // Second return value of second render method.
+ *
+ * Refs should be used to reference components that are not the return value of
+ * render methods.
+ *
+ * expect(instances[0][0].refs.X).toBe(...);
+ *
+ * NOTE: The component classes created for each render method are re-used for
+ * each invocation of the hierarchy renderer. If new classes are needed, you
+ * should re-execute `createHierarchyRenderer` with the same arguments.
+ *
+ * @param {array<function>} ...renderMethods
+ * @return {function}
+ */
+function createHierarchyRenderer() {
+ for (var _len = arguments.length, renderMethods = Array(_len), _key = 0; _key < _len; _key++) {
+ renderMethods[_key] = arguments[_key];
+ }
+
+ var instances;
+ var Components = renderMethods.reduceRight(function (ComponentsAccumulator, renderMethod, depth) {
+ var Component = React.createClass({
+ displayName: renderMethod.name,
+ render: function () {
+ instances[depth].push(this);
+ return renderMethod.apply(this, ComponentsAccumulator);
+ }
+ });
+ return [Component].concat(ComponentsAccumulator);
+ }, []);
+ /**
+ * @param {function} renderComponent
+ * @return {array<array<*>>}
+ */
+ function renderHierarchy(renderComponent) {
+ instances = renderMethods.map(function () {
+ return [];
+ });
+ renderComponent.apply(null, Components);
+ return instances;
+ }
+ return renderHierarchy;
+}
+
+module.exports = createHierarchyRenderer;
\ No newline at end of file

lib/createNodesFromMarkup.js

@@ -1,86 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule createNodesFromMarkup
- * @typechecks
- */
-
-/*jslint evil: true, sub: true */
-
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-
-var createArrayFromMixed = require("./createArrayFromMixed");
-var getMarkupWrap = require("./getMarkupWrap");
-var invariant = require("./invariant");
-
-/**
- * Dummy container used to render all markup.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Pattern used by `getNodeName`.
- */
-var nodeNamePattern = /^\s*<(\w+)/;
-
-/**
- * Extracts the `nodeName` of the first element in a string of markup.
- *
- * @param {string} markup String of markup.
- * @return {?string} Node name of the supplied markup.
- */
-function getNodeName(markup) {
- var nodeNameMatch = markup.match(nodeNamePattern);
- return nodeNameMatch && nodeNameMatch[1].toLowerCase();
-}
-
-/**
- * Creates an array containing the nodes rendered from the supplied markup. The
- * optionally supplied `handleScript` function will be invoked once for each
- * <script> element that is rendered. If no `handleScript` function is supplied,
- * an exception is thrown if any <script> elements are rendered.
- *
- * @param {string} markup A string of valid HTML markup.
- * @param {?function} handleScript Invoked once for each rendered <script>.
- * @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
- */
-function createNodesFromMarkup(markup, handleScript) {
- var node = dummyNode;
- ("production" !== process.env.NODE_ENV ? invariant(!!dummyNode, 'createNodesFromMarkup dummy not initialized') : invariant(!!dummyNode));
- var nodeName = getNodeName(markup);
-
- var wrap = nodeName && getMarkupWrap(nodeName);
- if (wrap) {
- node.innerHTML = wrap[1] + markup + wrap[2];
-
- var wrapDepth = wrap[0];
- while (wrapDepth--) {
- node = node.lastChild;
- }
- } else {
- node.innerHTML = markup;
- }
-
- var scripts = node.getElementsByTagName('script');
- if (scripts.length) {
- ("production" !== process.env.NODE_ENV ? invariant(
- handleScript,
- 'createNodesFromMarkup(...): Unexpected <script> element rendered.'
- ) : invariant(handleScript));
- createArrayFromMixed(scripts).forEach(handleScript);
- }
-
- var nodes = createArrayFromMixed(node.childNodes);
- while (node.lastChild) {
- node.removeChild(node.lastChild);
- }
- return nodes;
-}
-
-module.exports = createNodesFromMarkup;

lib/CSSCore.js

@@ -1,108 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule CSSCore
- * @typechecks
- */
-
-var invariant = require("./invariant");
-
-/**
- * The CSSCore module specifies the API (and implements most of the methods)
- * that should be used when dealing with the display of elements (via their
- * CSS classes and visibility on screen. It is an API focused on mutating the
- * display and not reading it as no logical state should be encoded in the
- * display of elements.
- */
-
-var CSSCore = {
-
- /**
- * Adds the class passed in to the element if it doesn't already have it.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- addClass: function(element, className) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !/\s/.test(className),
- 'CSSCore.addClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.add(className);
- } else if (!CSSCore.hasClass(element, className)) {
- element.className = element.className + ' ' + className;
- }
- }
- return element;
- },
-
- /**
- * Removes the class passed in from the element
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @return {DOMElement} the element passed in
- */
- removeClass: function(element, className) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !/\s/.test(className),
- 'CSSCore.removeClass takes only a single class name. "%s" contains ' +
- 'multiple classes.', className
- ) : invariant(!/\s/.test(className)));
-
- if (className) {
- if (element.classList) {
- element.classList.remove(className);
- } else if (CSSCore.hasClass(element, className)) {
- element.className = element.className
- .replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1')
- .replace(/\s+/g, ' ') // multiple spaces to one
- .replace(/^\s*|\s*$/g, ''); // trim the ends
- }
- }
- return element;
- },
-
- /**
- * Helper to add or remove a class from an element based on a condition.
- *
- * @param {DOMElement} element the element to set the class on
- * @param {string} className the CSS className
- * @param {*} bool condition to whether to add or remove the class
- * @return {DOMElement} the element passed in
- */
- conditionClass: function(element, className, bool) {
- return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
- },
-
- /**
- * Tests whether the element has the class specified.
- *
- * @param {DOMNode|DOMWindow} element the element to set the class on
- * @param {string} className the CSS className
- * @return {boolean} true if the element has the class, false if not
- */
- hasClass: function(element, className) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !/\s/.test(className),
- 'CSS.hasClass takes only a single class name.'
- ) : invariant(!/\s/.test(className)));
- if (element.classList) {
- return !!className && element.classList.contains(className);
- }
- return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
- }
-
-};
-
-module.exports = CSSCore;

lib/CSSProperty.js

@@ -15,26 +15,31 @@
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
+ animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
+ boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
+ flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
+ tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
+ stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
@@ -58,8 +63,8 @@
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
-Object.keys(isUnitlessNumber).forEach(function(prop) {
- prefixes.forEach(function(prefix) {
+Object.keys(isUnitlessNumber).forEach(function (prop) {
+ prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
@@ -75,10 +80,16 @@
*/
var shorthandPropertyExpansions = {
background: {
+ backgroundAttachment: true,
+ backgroundColor: true,
backgroundImage: true,
- backgroundPosition: true,
- backgroundRepeat: true,
- backgroundColor: true
+ backgroundPositionX: true,
+ backgroundPositionY: true,
+ backgroundRepeat: true
+ },
+ backgroundPosition: {
+ backgroundPositionX: true,
+ backgroundPositionY: true
},
border: {
borderWidth: true,
@@ -112,6 +123,11 @@
fontSize: true,
lineHeight: true,
fontFamily: true
+ },
+ outline: {
+ outlineWidth: true,
+ outlineStyle: true,
+ outlineColor: true
}
};

lib/CSSPropertyOperations.js

@@ -12,28 +12,37 @@
'use strict';
-var CSSProperty = require("./CSSProperty");
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var CSSProperty = require('./CSSProperty');
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var ReactPerf = require('./ReactPerf');
+
+var camelizeStyleName = require('fbjs/lib/camelizeStyleName');
+var dangerousStyleValue = require('./dangerousStyleValue');
+var hyphenateStyleName = require('fbjs/lib/hyphenateStyleName');
+var memoizeStringOnly = require('fbjs/lib/memoizeStringOnly');
+var warning = require('fbjs/lib/warning');
-var camelizeStyleName = require("./camelizeStyleName");
-var dangerousStyleValue = require("./dangerousStyleValue");
-var hyphenateStyleName = require("./hyphenateStyleName");
-var memoizeStringOnly = require("./memoizeStringOnly");
-var warning = require("./warning");
-
-var processStyleName = memoizeStringOnly(function(styleName) {
+var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
+var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
+ var tempStyle = document.createElement('div').style;
+ try {
+ // IE8 throws "Invalid argument." if resetting shorthand style properties.
+ tempStyle.font = '';
+ } catch (e) {
+ hasShorthandPropertyBug = true;
+ }
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
-if ("production" !== process.env.NODE_ENV) {
+if (process.env.NODE_ENV !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
@@ -43,54 +52,38 @@
var warnedStyleNames = {};
var warnedStyleValues = {};
- var warnHyphenatedStyleName = function(name) {
+ var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Unsupported style property %s. Did you mean %s?',
- name,
- camelizeStyleName(name)
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
- var warnBadVendoredStyleName = function(name) {
+ var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Unsupported vendor-prefixed style property %s. Did you mean %s?',
- name,
- name.charAt(0).toUpperCase() + name.slice(1)
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
- var warnStyleValueWithSemicolon = function(name, value) {
+ var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Style property values shouldn\'t contain a semicolon. ' +
- 'Try "%s: %s" instead.',
- name,
- value.replace(badStyleValueWithSemicolonPattern, '')
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
- var warnValidStyle = function(name, value) {
+ var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
@@ -118,14 +111,14 @@
* @param {object} styles
* @return {?string}
*/
- createMarkupForStyles: function(styles) {
+ createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
@@ -143,13 +136,13 @@
* @param {DOMElement} node
* @param {object} styles
*/
- setValueForStyles: function(node, styles) {
+ setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
@@ -159,7 +152,7 @@
if (styleValue) {
style[styleName] = styleValue;
} else {
- var expansion = CSSProperty.shorthandPropertyExpansions[styleName];
+ var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
@@ -175,4 +168,8 @@
};
+ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
+ setValueForStyles: 'setValueForStyles'
+});
+
module.exports = CSSPropertyOperations;

lib/cx.js

@@ -1,52 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule cx
- */
-
-/**
- * This function is used to mark string literals representing CSS class names
- * so that they can be transformed statically. This allows for modularization
- * and minification of CSS class names.
- *
- * In static_upstream, this function is actually implemented, but it should
- * eventually be replaced with something more descriptive, and the transform
- * that is used in the main stack should be ported for use elsewhere.
- *
- * @param string|object className to modularize, or an object of key/values.
- * In the object case, the values are conditions that
- * determine if the className keys should be included.
- * @param [string ...] Variable list of classNames in the string case.
- * @return string Renderable space-separated CSS className.
- */
-
-'use strict';
-var warning = require("./warning");
-
-var warned = false;
-
-function cx(classNames) {
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- warned,
- 'React.addons.classSet will be deprecated in a future version. See ' +
- 'http://fb.me/react-addons-classset'
- ) : null);
- warned = true;
- }
-
- if (typeof classNames == 'object') {
- return Object.keys(classNames).filter(function(className) {
- return classNames[className];
- }).join(' ');
- } else {
- return Array.prototype.join.call(arguments, ' ');
- }
-}
-
-module.exports = cx;

lib/Danger.js

@@ -10,16 +10,14 @@
* @typechecks static-only
*/
-/*jslint evil: true, sub: true */
-
'use strict';
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-var createNodesFromMarkup = require("./createNodesFromMarkup");
-var emptyFunction = require("./emptyFunction");
-var getMarkupWrap = require("./getMarkupWrap");
-var invariant = require("./invariant");
+var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var getMarkupWrap = require('fbjs/lib/getMarkupWrap');
+var invariant = require('fbjs/lib/invariant');
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
@@ -50,22 +48,13 @@
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
- dangerouslyRenderMarkup: function(markupList) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' +
- 'thread. Make sure `window` and `document` are available globally ' +
- 'before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
+ dangerouslyRenderMarkup: function (markupList) {
+ !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
- ("production" !== process.env.NODE_ENV ? invariant(
- markupList[i],
- 'dangerouslyRenderMarkup(...): Missing markup.'
- ) : invariant(markupList[i]));
+ !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
@@ -90,61 +79,41 @@
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
- markupListByNodeName[resultIndex] = markup.replace(
- OPEN_TAG_NAME_EXP,
+ markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
- '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '
- );
+ '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
- var renderNodes = createNodesFromMarkup(
- markupListByNodeName.join(''),
- emptyFunction // Do nothing special with <script> tags.
+ var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
- if (renderNode.hasAttribute &&
- renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
+ if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
- ("production" !== process.env.NODE_ENV ? invariant(
- !resultList.hasOwnProperty(resultIndex),
- 'Danger: Assigning to an already-occupied result index.'
- ) : invariant(!resultList.hasOwnProperty(resultIndex)));
+ !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
-
- } else if ("production" !== process.env.NODE_ENV) {
- console.error(
- 'Danger: Discarding unexpected node:',
- renderNode
- );
+ } else if (process.env.NODE_ENV !== 'production') {
+ console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
- ("production" !== process.env.NODE_ENV ? invariant(
- resultListAssignmentCount === resultList.length,
- 'Danger: Did not assign to every index of resultList.'
- ) : invariant(resultListAssignmentCount === resultList.length));
-
- ("production" !== process.env.NODE_ENV ? invariant(
- resultList.length === markupList.length,
- 'Danger: Expected markup to render %s nodes, but rendered %s.',
- markupList.length,
- resultList.length
- ) : invariant(resultList.length === markupList.length));
+ !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
+
+ !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
@@ -157,24 +126,17 @@
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
- dangerouslyReplaceNodeWithMarkup: function(oldChild, markup) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ExecutionEnvironment.canUseDOM,
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' +
- 'worker thread. Make sure `window` and `document` are available ' +
- 'globally before requiring React when unit testing or use ' +
- 'React.renderToString for server rendering.'
- ) : invariant(ExecutionEnvironment.canUseDOM));
- ("production" !== process.env.NODE_ENV ? invariant(markup, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(markup));
- ("production" !== process.env.NODE_ENV ? invariant(
- oldChild.tagName.toLowerCase() !== 'html',
- 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' +
- '<html> node. This is because browser quirks make this unreliable ' +
- 'and/or slow. If you want to render to the root you must use ' +
- 'server rendering. See React.renderToString().'
- ) : invariant(oldChild.tagName.toLowerCase() !== 'html'));
-
- var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
+ !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
+ !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
+ !(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
+
+ var newChild;
+ if (typeof markup === 'string') {
+ newChild = createNodesFromMarkup(markup, emptyFunction)[0];
+ } else {
+ newChild = markup;
+ }
oldChild.parentNode.replaceChild(newChild, oldChild);
}

lib/dangerousStyleValue.js

@@ -12,7 +12,7 @@
'use strict';
-var CSSProperty = require("./CSSProperty");
+var CSSProperty = require('./CSSProperty');
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
@@ -42,8 +42,7 @@
}
var isNonNumeric = isNaN(value);
- if (isNonNumeric || value === 0 ||
- isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
+ if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}

lib/DefaultEventPluginOrder.js

@@ -11,7 +11,7 @@
'use strict';
-var keyOf = require("./keyOf");
+var keyOf = require('fbjs/lib/keyOf');
/**
* Module that is injectable into `EventPluginHub`, that specifies a
@@ -22,16 +22,6 @@
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
-var DefaultEventPluginOrder = [
- keyOf({ResponderEventPlugin: null}),
- keyOf({SimpleEventPlugin: null}),
- keyOf({TapEventPlugin: null}),
- keyOf({EnterLeaveEventPlugin: null}),
- keyOf({ChangeEventPlugin: null}),
- keyOf({SelectEventPlugin: null}),
- keyOf({BeforeInputEventPlugin: null}),
- keyOf({AnalyticsEventPlugin: null}),
- keyOf({MobileSafariClickEventPlugin: null})
-];
+var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;

lib/deprecated.js

@@ -0,0 +1,48 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule deprecated
+ */
+
+'use strict';
+
+var assign = require('./Object.assign');
+var warning = require('fbjs/lib/warning');
+
+/**
+ * This will log a single deprecation notice per function and forward the call
+ * on to the new API.
+ *
+ * @param {string} fnName The name of the function
+ * @param {string} newModule The module that fn will exist in
+ * @param {string} newPackage The module that fn will exist in
+ * @param {*} ctx The context this forwarded call should run in
+ * @param {function} fn The function to forward on to
+ * @return {function} The function that will warn once and then call fn
+ */
+function deprecated(fnName, newModule, newPackage, ctx, fn) {
+ var warned = false;
+ if (process.env.NODE_ENV !== 'production') {
+ var newFn = function () {
+ process.env.NODE_ENV !== 'production' ? warning(warned,
+ // Require examples in this string must be split to prevent React's
+ // build tools from mistaking them for real requires.
+ // Otherwise the build tools will attempt to build a '%s' module.
+ 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
+ warned = true;
+ return fn.apply(ctx, arguments);
+ };
+ // We need to make sure all properties of the original fn are copied over.
+ // In particular, this is needed to support PropTypes
+ return assign(newFn, fn);
+ }
+
+ return fn;
+}
+
+module.exports = deprecated;
\ No newline at end of file

lib/DOMChildrenOperations.js

@@ -12,11 +12,13 @@
'use strict';
-var Danger = require("./Danger");
-var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
-
-var setTextContent = require("./setTextContent");
-var invariant = require("./invariant");
+var Danger = require('./Danger');
+var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
+var ReactPerf = require('./ReactPerf');
+
+var setInnerHTML = require('./setInnerHTML');
+var setTextContent = require('./setTextContent');
+var invariant = require('fbjs/lib/invariant');
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
@@ -31,10 +33,12 @@
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
- parentNode.insertBefore(
- childNode,
- parentNode.childNodes[index] || null
- );
+
+ // fix render order error in safari
+ // IE8 will throw error when index out of list size.
+ var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
+
+ parentNode.insertBefore(childNode, beforeChild);
}
/**
@@ -54,7 +58,7 @@
* @param {array<string>} markupList List of markup strings.
* @internal
*/
- processUpdates: function(updates, markupList) {
+ processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
@@ -63,23 +67,12 @@
for (var i = 0; i < updates.length; i++) {
update = updates[i];
- if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING ||
- update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
+ if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
- ("production" !== process.env.NODE_ENV ? invariant(
- updatedChild,
- 'processUpdates(): Unable to find child %s of element. This ' +
- 'probably means the DOM was unexpectedly mutated (e.g., by the ' +
- 'browser), usually due to forgetting a <tbody> when using tables, ' +
- 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' +
- 'in an <svg> parent. Try inspecting the child nodes of the element ' +
- 'with React ID `%s`.',
- updatedIndex,
- parentID
- ) : invariant(updatedChild));
+ !updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
@@ -90,7 +83,13 @@
}
}
- var renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ var renderedMarkup;
+ // markupList is either a list of markup or just a list of elements
+ if (markupList.length && typeof markupList[0] === 'string') {
+ renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
+ } else {
+ renderedMarkup = markupList;
+ }
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
@@ -103,24 +102,16 @@
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
- insertChildAt(
- update.parentNode,
- renderedMarkup[update.markupIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
- insertChildAt(
- update.parentNode,
- initialChildren[update.parentID][update.fromIndex],
- update.toIndex
- );
+ insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
+ break;
+ case ReactMultiChildUpdateTypes.SET_MARKUP:
+ setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
- setTextContent(
- update.parentNode,
- update.textContent
- );
+ setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
@@ -131,4 +122,8 @@
};
+ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
+ updateTextContent: 'updateTextContent'
+});
+
module.exports = DOMChildrenOperations;

lib/DOMProperty.js

@@ -10,11 +10,9 @@
* @typechecks static-only
*/
-/*jslint bitwise: true */
-
'use strict';
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
@@ -50,6 +48,9 @@
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
+ * DOMAttributeNamespaces: object mapping React attribute name to the DOM
+ * attribute namespace URL. (Attribute names not specified use no namespace.)
+ *
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
@@ -58,92 +59,68 @@
*
* @param {object} domPropertyConfig the config as described above.
*/
- injectDOMPropertyConfig: function(domPropertyConfig) {
+ injectDOMPropertyConfig: function (domPropertyConfig) {
+ var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
+ var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
- DOMProperty._isCustomAttributeFunctions.push(
- domPropertyConfig.isCustomAttribute
- );
+ DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !DOMProperty.isStandardName.hasOwnProperty(propName),
- 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' +
- '\'%s\' which has already been injected. You may be accidentally ' +
- 'injecting the same DOM property config twice, or you may be ' +
- 'injecting two configs that have conflicting property names.',
- propName
- ) : invariant(!DOMProperty.isStandardName.hasOwnProperty(propName)));
-
- DOMProperty.isStandardName[propName] = true;
+ !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
var lowerCased = propName.toLowerCase();
+ var propConfig = Properties[propName];
+
+ var propertyInfo = {
+ attributeName: lowerCased,
+ attributeNamespace: null,
+ propertyName: propName,
+ mutationMethod: null,
+
+ mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
+ mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
+ hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
+ hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
+ hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
+ hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
+ hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
+ };
+
+ !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
+ !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
+
+ if (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
+ }
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
+ propertyInfo.attributeName = attributeName;
+ if (process.env.NODE_ENV !== 'production') {
DOMProperty.getPossibleStandardName[attributeName] = propName;
- DOMProperty.getAttributeName[propName] = attributeName;
- } else {
- DOMProperty.getAttributeName[propName] = lowerCased;
+ }
}
- DOMProperty.getPropertyName[propName] =
- DOMPropertyNames.hasOwnProperty(propName) ?
- DOMPropertyNames[propName] :
- propName;
+ if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
+ propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
+ }
+
+ if (DOMPropertyNames.hasOwnProperty(propName)) {
+ propertyInfo.propertyName = DOMPropertyNames[propName];
+ }
if (DOMMutationMethods.hasOwnProperty(propName)) {
- DOMProperty.getMutationMethod[propName] = DOMMutationMethods[propName];
- } else {
- DOMProperty.getMutationMethod[propName] = null;
+ propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
- var propConfig = Properties[propName];
- DOMProperty.mustUseAttribute[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_ATTRIBUTE);
- DOMProperty.mustUseProperty[propName] =
- checkMask(propConfig, DOMPropertyInjection.MUST_USE_PROPERTY);
- DOMProperty.hasSideEffects[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_SIDE_EFFECTS);
- DOMProperty.hasBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_BOOLEAN_VALUE);
- DOMProperty.hasNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_NUMERIC_VALUE);
- DOMProperty.hasPositiveNumericValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_POSITIVE_NUMERIC_VALUE);
- DOMProperty.hasOverloadedBooleanValue[propName] =
- checkMask(propConfig, DOMPropertyInjection.HAS_OVERLOADED_BOOLEAN_VALUE);
-
- ("production" !== process.env.NODE_ENV ? invariant(
- !DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName],
- 'DOMProperty: Cannot require using both attribute and property: %s',
- propName
- ) : invariant(!DOMProperty.mustUseAttribute[propName] ||
- !DOMProperty.mustUseProperty[propName]));
- ("production" !== process.env.NODE_ENV ? invariant(
- DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName],
- 'DOMProperty: Properties that have side effects must use property: %s',
- propName
- ) : invariant(DOMProperty.mustUseProperty[propName] ||
- !DOMProperty.hasSideEffects[propName]));
- ("production" !== process.env.NODE_ENV ? invariant(
- !!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1,
- 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' +
- 'numeric value, but not a combination: %s',
- propName
- ) : invariant(!!DOMProperty.hasBooleanValue[propName] +
- !!DOMProperty.hasNumericValue[propName] +
- !!DOMProperty.hasOverloadedBooleanValue[propName] <= 1));
+ DOMProperty.properties[propName] = propertyInfo;
}
}
};
@@ -167,87 +144,49 @@
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
- * Checks whether a property name is a standard property.
- * @type {Object}
- */
- isStandardName: {},
-
- /**
- * Mapping from lowercase property names to the properly cased version, used
- * to warn in the case of missing properties.
- * @type {Object}
- */
- getPossibleStandardName: {},
-
- /**
- * Mapping from normalized names to attribute names that differ. Attribute
- * names are used when rendering markup or with `*Attribute()`.
- * @type {Object}
- */
- getAttributeName: {},
-
- /**
- * Mapping from normalized names to properties on DOM node instances.
- * (This includes properties that mutate due to external factors.)
- * @type {Object}
- */
- getPropertyName: {},
-
- /**
- * Mapping from normalized names to mutation methods. This will only exist if
- * mutation cannot be set simply by the property or `setAttribute()`.
- * @type {Object}
- */
- getMutationMethod: {},
-
- /**
- * Whether the property must be accessed and mutated as an object property.
- * @type {Object}
- */
- mustUseAttribute: {},
-
- /**
+ * Map from property "standard name" to an object with info about how to set
+ * the property in the DOM. Each object contains:
+ *
+ * attributeName:
+ * Used when rendering markup or with `*Attribute()`.
+ * attributeNamespace
+ * propertyName:
+ * Used on DOM node instances. (This includes properties that mutate due to
+ * external factors.)
+ * mutationMethod:
+ * If non-null, used instead of the property or `setAttribute()` after
+ * initial render.
+ * mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
- * @type {Object}
- */
- mustUseProperty: {},
-
- /**
+ * mustUseProperty:
+ * Whether the property must be accessed and mutated as an object property.
+ * hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
- * resources to be loaded or text selection changes. We must ensure that
- * the value is only set if it has changed.
- * @type {Object}
- */
- hasSideEffects: {},
-
- /**
+ * resources to be loaded or text selection changes. If true, we read from
+ * the DOM before updating to ensure that the value is only set if it has
+ * changed.
+ * hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
- * @type {Object}
- */
- hasBooleanValue: {},
-
- /**
- * Whether the property must be numeric or parse as a
- * numeric and should be removed when set to a falsey value.
- * @type {Object}
- */
- hasNumericValue: {},
-
- /**
+ * hasNumericValue:
+ * Whether the property must be numeric or parse as a numeric and should be
+ * removed when set to a falsey value.
+ * hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
- * @type {Object}
+ * hasOverloadedBooleanValue:
+ * Whether the property can be used as a flag as well as with a value.
+ * Removed when strictly equal to false; present without a value when
+ * strictly equal to true; present with a value otherwise.
*/
- hasPositiveNumericValue: {},
+ properties: {},
/**
- * Whether the property can be used as a flag as well as with a value. Removed
- * when strictly equal to false; present without a value when strictly equal
- * to true; present with a value otherwise.
+ * Mapping from lowercase property names to the properly cased version, used
+ * to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
- hasOverloadedBooleanValue: {},
+ getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
@@ -258,7 +197,7 @@
* Checks whether a property name is a custom attribute.
* @method
*/
- isCustomAttribute: function(attributeName) {
+ isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
@@ -276,7 +215,7 @@
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
- getDefaultValueForProperty: function(nodeName, prop) {
+ getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {

lib/DOMPropertyOperations.js

@@ -12,20 +12,38 @@
'use strict';
-var DOMProperty = require("./DOMProperty");
+var DOMProperty = require('./DOMProperty');
+var ReactPerf = require('./ReactPerf');
-var quoteAttributeValueForBrowser = require("./quoteAttributeValueForBrowser");
-var warning = require("./warning");
+var quoteAttributeValueForBrowser = require('./quoteAttributeValueForBrowser');
+var warning = require('fbjs/lib/warning');
-function shouldIgnoreValue(name, value) {
- return value == null ||
- (DOMProperty.hasBooleanValue[name] && !value) ||
- (DOMProperty.hasNumericValue[name] && isNaN(value)) ||
- (DOMProperty.hasPositiveNumericValue[name] && (value < 1)) ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === false);
+// Simplified subset
+var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
+var illegalAttributeNameCache = {};
+var validatedAttributeNameCache = {};
+
+function isAttributeNameSafe(attributeName) {
+ if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
+ return true;
+ }
+ if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
+ return false;
+ }
+ if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
+ validatedAttributeNameCache[attributeName] = true;
+ return true;
+ }
+ illegalAttributeNameCache[attributeName] = true;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
+ return false;
}
-if ("production" !== process.env.NODE_ENV) {
+function shouldIgnoreValue(propertyInfo, value) {
+ return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
+}
+
+if (process.env.NODE_ENV !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
@@ -34,9 +52,8 @@
};
var warnedProperties = {};
- var warnUnknownProperty = function(name) {
- if (reactProps.hasOwnProperty(name) && reactProps[name] ||
- warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
+ var warnUnknownProperty = function (name) {
+ if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
@@ -44,23 +61,11 @@
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
- var standardName = (
- DOMProperty.isCustomAttribute(lowerCasedName) ?
- lowerCasedName :
- DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ?
- DOMProperty.getPossibleStandardName[lowerCasedName] :
- null
- );
+ var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
- ("production" !== process.env.NODE_ENV ? warning(
- standardName == null,
- 'Unknown DOM property %s. Did you mean %s?',
- name,
- standardName
- ) : null);
-
+ process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
@@ -75,9 +80,12 @@
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
- createMarkupForID: function(id) {
- return DOMProperty.ID_ATTRIBUTE_NAME + '=' +
- quoteAttributeValueForBrowser(id);
+ createMarkupForID: function (id) {
+ return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
+ },
+
+ setAttributeForID: function (node, id) {
+ node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
@@ -87,16 +95,15 @@
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
- createMarkupForProperty: function(name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- if (shouldIgnoreValue(name, value)) {
+ createMarkupForProperty: function (name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
- var attributeName = DOMProperty.getAttributeName[name];
- if (DOMProperty.hasBooleanValue[name] ||
- (DOMProperty.hasOverloadedBooleanValue[name] && value === true)) {
- return attributeName;
+ var attributeName = propertyInfo.attributeName;
+ if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
@@ -104,51 +111,79 @@
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
- } else if ("production" !== process.env.NODE_ENV) {
+ } else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
+ * Creates markup for a custom property.
+ *
+ * @param {string} name
+ * @param {*} value
+ * @return {string} Markup string, or empty string if the property was invalid.
+ */
+ createMarkupForCustomAttribute: function (name, value) {
+ if (!isAttributeNameSafe(name) || value == null) {
+ return '';
+ }
+ return name + '=' + quoteAttributeValueForBrowser(value);
+ },
+
+ /**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
- setValueForProperty: function(node, name, value) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ setValueForProperty: function (node, name, value) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
- } else if (shouldIgnoreValue(name, value)) {
+ } else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
- } else if (DOMProperty.mustUseAttribute[name]) {
+ } else if (propertyInfo.mustUseAttribute) {
+ var attributeName = propertyInfo.attributeName;
+ var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
- node.setAttribute(DOMProperty.getAttributeName[name], '' + value);
+ if (namespace) {
+ node.setAttributeNS(namespace, attributeName, '' + value);
+ } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
+ node.setAttribute(attributeName, '');
+ } else {
+ node.setAttribute(attributeName, '' + value);
+ }
} else {
- var propName = DOMProperty.getPropertyName[name];
+ var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== ('' + value)) {
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
+ DOMPropertyOperations.setValueForAttribute(node, name, value);
+ } else if (process.env.NODE_ENV !== 'production') {
+ warnUnknownProperty(name);
+ }
+ },
+
+ setValueForAttribute: function (node, name, value) {
+ if (!isAttributeNameSafe(name)) {
+ return;
+ }
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
- } else if ("production" !== process.env.NODE_ENV) {
- warnUnknownProperty(name);
- }
},
/**
@@ -157,32 +192,34 @@
* @param {DOMElement} node
* @param {string} name
*/
- deleteValueForProperty: function(node, name) {
- if (DOMProperty.isStandardName.hasOwnProperty(name) &&
- DOMProperty.isStandardName[name]) {
- var mutationMethod = DOMProperty.getMutationMethod[name];
+ deleteValueForProperty: function (node, name) {
+ var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
+ if (propertyInfo) {
+ var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
- } else if (DOMProperty.mustUseAttribute[name]) {
- node.removeAttribute(DOMProperty.getAttributeName[name]);
+ } else if (propertyInfo.mustUseAttribute) {
+ node.removeAttribute(propertyInfo.attributeName);
} else {
- var propName = DOMProperty.getPropertyName[name];
- var defaultValue = DOMProperty.getDefaultValueForProperty(
- node.nodeName,
- propName
- );
- if (!DOMProperty.hasSideEffects[name] ||
- ('' + node[propName]) !== defaultValue) {
+ var propName = propertyInfo.propertyName;
+ var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
+ if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
- } else if ("production" !== process.env.NODE_ENV) {
+ } else if (process.env.NODE_ENV !== 'production') {
warnUnknownProperty(name);
}
}
};
+ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
+ setValueForProperty: 'setValueForProperty',
+ setValueForAttribute: 'setValueForAttribute',
+ deleteValueForProperty: 'deleteValueForProperty'
+});
+
module.exports = DOMPropertyOperations;

lib/emptyFunction.js

@@ -1,32 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule emptyFunction
- */
-
-function makeEmptyFunction(arg) {
- return function() {
- return arg;
- };
-}
-
-/**
- * This function accepts and discards inputs; it has no side effects. This is
- * primarily useful idiomatically for overridable function endpoints which
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
- */
-function emptyFunction() {}
-
-emptyFunction.thatReturns = makeEmptyFunction;
-emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
-emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
-emptyFunction.thatReturnsNull = makeEmptyFunction(null);
-emptyFunction.thatReturnsThis = function() { return this; };
-emptyFunction.thatReturnsArgument = function(arg) { return arg; };
-
-module.exports = emptyFunction;

lib/emptyObject.js

@@ -1,20 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule emptyObject
- */
-
-"use strict";
-
-var emptyObject = {};
-
-if ("production" !== process.env.NODE_ENV) {
- Object.freeze(emptyObject);
-}
-
-module.exports = emptyObject;

lib/EnterLeaveEventPlugin.js

@@ -12,30 +12,24 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPropagators = require("./EventPropagators");
-var SyntheticMouseEvent = require("./SyntheticMouseEvent");
+var EventConstants = require('./EventConstants');
+var EventPropagators = require('./EventPropagators');
+var SyntheticMouseEvent = require('./SyntheticMouseEvent');
-var ReactMount = require("./ReactMount");
-var keyOf = require("./keyOf");
+var ReactMount = require('./ReactMount');
+var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
- registrationName: keyOf({onMouseEnter: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseEnter: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
- registrationName: keyOf({onMouseLeave: null}),
- dependencies: [
- topLevelTypes.topMouseOut,
- topLevelTypes.topMouseOver
- ]
+ registrationName: keyOf({ onMouseLeave: null }),
+ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
@@ -59,17 +53,11 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topMouseOver &&
- (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
- if (topLevelType !== topLevelTypes.topMouseOut &&
- topLevelType !== topLevelTypes.topMouseOver) {
+ if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
@@ -88,15 +76,24 @@
}
}
- var from, to;
+ var from;
+ var to;
+ var fromID = '';
+ var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
- to =
- getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement) ||
- win;
+ fromID = topLevelTargetID;
+ to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
+ if (to) {
+ toID = ReactMount.getID(to);
+ } else {
+ to = win;
+ }
+ to = to || win;
} else {
from = win;
to = topLevelTarget;
+ toID = topLevelTargetID;
}
if (from === to) {
@@ -104,23 +101,12 @@
return null;
}
- var fromID = from ? ReactMount.getID(from) : '';
- var toID = to ? ReactMount.getID(to) : '';
-
- var leave = SyntheticMouseEvent.getPooled(
- eventTypes.mouseLeave,
- fromID,
- nativeEvent
- );
+ var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
- var enter = SyntheticMouseEvent.getPooled(
- eventTypes.mouseEnter,
- toID,
- nativeEvent
- );
+ var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;

lib/EventConstants.js

@@ -11,15 +11,18 @@
'use strict';
-var keyMirror = require("./keyMirror");
+var keyMirror = require('fbjs/lib/keyMirror');
-var PropagationPhases = keyMirror({bubbled: null, captured: null});
+var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
+ topAbort: null,
topBlur: null,
+ topCanPlay: null,
+ topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
@@ -37,6 +40,10 @@
topDragOver: null,
topDragStart: null,
topDrop: null,
+ topDurationChange: null,
+ topEmptied: null,
+ topEncrypted: null,
+ topEnded: null,
topError: null,
topFocus: null,
topInput: null,
@@ -44,21 +51,36 @@
topKeyPress: null,
topKeyUp: null,
topLoad: null,
+ topLoadedData: null,
+ topLoadedMetadata: null,
+ topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
+ topPause: null,
+ topPlay: null,
+ topPlaying: null,
+ topProgress: null,
+ topRateChange: null,
topReset: null,
topScroll: null,
+ topSeeked: null,
+ topSeeking: null,
topSelectionChange: null,
+ topStalled: null,
topSubmit: null,
+ topSuspend: null,
topTextInput: null,
+ topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
+ topVolumeChange: null,
+ topWaiting: null,
topWheel: null
});

lib/EventListener.js

@@ -1,86 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * @providesModule EventListener
- * @typechecks
- */
-
-var emptyFunction = require("./emptyFunction");
-
-/**
- * Upstream version of event listener. Does not take into account specific
- * nature of platform.
- */
-var EventListener = {
- /**
- * Listen to DOM events during the bubble phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- listen: function(target, eventType, callback) {
- if (target.addEventListener) {
- target.addEventListener(eventType, callback, false);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, false);
- }
- };
- } else if (target.attachEvent) {
- target.attachEvent('on' + eventType, callback);
- return {
- remove: function() {
- target.detachEvent('on' + eventType, callback);
- }
- };
- }
- },
-
- /**
- * Listen to DOM events during the capture phase.
- *
- * @param {DOMEventTarget} target DOM element to register listener on.
- * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
- * @param {function} callback Callback function.
- * @return {object} Object with a `remove` method.
- */
- capture: function(target, eventType, callback) {
- if (!target.addEventListener) {
- if ("production" !== process.env.NODE_ENV) {
- console.error(
- 'Attempted to listen to events during the capture phase on a ' +
- 'browser that does not support the capture phase. Your application ' +
- 'will not receive some events.'
- );
- }
- return {
- remove: emptyFunction
- };
- } else {
- target.addEventListener(eventType, callback, true);
- return {
- remove: function() {
- target.removeEventListener(eventType, callback, true);
- }
- };
- }
- },
-
- registerDefault: function() {}
-};
-
-module.exports = EventListener;

lib/EventPluginHub.js

@@ -11,12 +11,14 @@
'use strict';
-var EventPluginRegistry = require("./EventPluginRegistry");
-var EventPluginUtils = require("./EventPluginUtils");
-
-var accumulateInto = require("./accumulateInto");
-var forEachAccumulated = require("./forEachAccumulated");
-var invariant = require("./invariant");
+var EventPluginRegistry = require('./EventPluginRegistry');
+var EventPluginUtils = require('./EventPluginUtils');
+var ReactErrorUtils = require('./ReactErrorUtils');
+
+var accumulateInto = require('./accumulateInto');
+var forEachAccumulated = require('./forEachAccumulated');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
/**
* Internal store for event listeners
@@ -33,23 +35,24 @@
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
-var executeDispatchesAndRelease = function(event) {
+var executeDispatchesAndRelease = function (event, simulated) {
if (event) {
- var executeDispatch = EventPluginUtils.executeDispatch;
- // Plugins can provide custom behavior when dispatching events.
- var PluginModule = EventPluginRegistry.getPluginModuleForEvent(event);
- if (PluginModule && PluginModule.executeDispatch) {
- executeDispatch = PluginModule.executeDispatch;
- }
- EventPluginUtils.executeDispatchesInOrder(event, executeDispatch);
+ EventPluginUtils.executeDispatchesInOrder(event, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
+var executeDispatchesAndReleaseSimulated = function (e) {
+ return executeDispatchesAndRelease(e, true);
+};
+var executeDispatchesAndReleaseTopLevel = function (e) {
+ return executeDispatchesAndRelease(e, false);
+};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
@@ -58,14 +61,8 @@
var InstanceHandle = null;
function validateInstanceHandle() {
- var valid =
- InstanceHandle &&
- InstanceHandle.traverseTwoPhase &&
- InstanceHandle.traverseEnterLeave;
- ("production" !== process.env.NODE_ENV ? invariant(
- valid,
- 'InstanceHandle not injected before use!'
- ) : invariant(valid));
+ var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
+ process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
}
/**
@@ -107,15 +104,15 @@
* @param {object} InjectedInstanceHandle
* @public
*/
- injectInstanceHandle: function(InjectedInstanceHandle) {
+ injectInstanceHandle: function (InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
validateInstanceHandle();
}
},
- getInstanceHandle: function() {
- if ("production" !== process.env.NODE_ENV) {
+ getInstanceHandle: function () {
+ if (process.env.NODE_ENV !== 'production') {
validateInstanceHandle();
}
return InstanceHandle;
@@ -145,16 +142,16 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
- putListener: function(id, registrationName, listener) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !listener || typeof listener === 'function',
- 'Expected %s listener to be a function, instead got type %s',
- registrationName, typeof listener
- ) : invariant(!listener || typeof listener === 'function'));
+ putListener: function (id, registrationName, listener) {
+ !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
- var bankForRegistrationName =
- listenerBank[registrationName] || (listenerBank[registrationName] = {});
+ var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.didPutListener) {
+ PluginModule.didPutListener(id, registrationName, listener);
+ }
},
/**
@@ -162,7 +159,7 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
- getListener: function(id, registrationName) {
+ getListener: function (id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
@@ -173,8 +170,14 @@
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
- deleteListener: function(id, registrationName) {
+ deleteListener: function (id, registrationName) {
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
var bankForRegistrationName = listenerBank[registrationName];
+ // TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
@@ -185,8 +188,17 @@
*
* @param {string} id ID of the DOM element.
*/
- deleteAllListeners: function(id) {
+ deleteAllListeners: function (id) {
for (var registrationName in listenerBank) {
+ if (!listenerBank[registrationName][id]) {
+ continue;
+ }
+
+ var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
+ if (PluginModule && PluginModule.willDeleteListener) {
+ PluginModule.willDeleteListener(id, registrationName);
+ }
+
delete listenerBank[registrationName][id];
}
},
@@ -202,23 +214,14 @@
* @return {*} An accumulation of synthetic events.
* @internal
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
- for (var i = 0, l = plugins.length; i < l; i++) {
+ for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
- var extractedEvents = possiblePlugin.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
+ var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
@@ -234,7 +237,7 @@
* @param {*} events An accumulation of synthetic events.
* @internal
*/
- enqueueEvents: function(events) {
+ enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
@@ -245,27 +248,29 @@
*
* @internal
*/
- processEventQueue: function() {
+ processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
- forEachAccumulated(processingEventQueue, executeDispatchesAndRelease);
- ("production" !== process.env.NODE_ENV ? invariant(
- !eventQueue,
- 'processEventQueue(): Additional events were enqueued while processing ' +
- 'an event queue. Support for this has not yet been implemented.'
- ) : invariant(!eventQueue));
+ if (simulated) {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
+ } else {
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
+ }
+ !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
+ // This would be a good time to rethrow if any of the event handlers threw.
+ ReactErrorUtils.rethrowCaughtError();
},
/**
* These are needed for tests only. Do not use!
*/
- __purge: function() {
+ __purge: function () {
listenerBank = {};
},
- __getListenerBank: function() {
+ __getListenerBank: function () {
return listenerBank;
}

lib/EventPluginRegistry.js

@@ -12,7 +12,7 @@
'use strict';
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
/**
* Injectable ordering of event plugins.
@@ -37,38 +37,15 @@
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
- ("production" !== process.env.NODE_ENV ? invariant(
- pluginIndex > -1,
- 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' +
- 'the plugin ordering, `%s`.',
- pluginName
- ) : invariant(pluginIndex > -1));
+ !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
- ("production" !== process.env.NODE_ENV ? invariant(
- PluginModule.extractEvents,
- 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' +
- 'method, but `%s` does not.',
- pluginName
- ) : invariant(PluginModule.extractEvents));
+ !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
- ("production" !== process.env.NODE_ENV ? invariant(
- publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- ),
- 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.',
- eventName,
- pluginName
- ) : invariant(publishEventForPlugin(
- publishedEvents[eventName],
- PluginModule,
- eventName
- )));
+ !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
}
}
}
@@ -82,12 +59,7 @@
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName),
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'event name, `%s`.',
- eventName
- ) : invariant(!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName)));
+ !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
@@ -95,20 +67,12 @@
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
- publishRegistrationName(
- phasedRegistrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
- publishRegistrationName(
- dispatchConfig.registrationName,
- PluginModule,
- eventName
- );
+ publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
return true;
}
return false;
@@ -123,15 +87,9 @@
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !EventPluginRegistry.registrationNameModules[registrationName],
- 'EventPluginHub: More than one plugin attempted to publish the same ' +
- 'registration name, `%s`.',
- registrationName
- ) : invariant(!EventPluginRegistry.registrationNameModules[registrationName]));
+ !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
- EventPluginRegistry.registrationNameDependencies[registrationName] =
- PluginModule.eventTypes[eventName].dependencies;
+ EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
}
/**
@@ -170,12 +128,8 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
- injectEventPluginOrder: function(InjectedEventPluginOrder) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !EventPluginOrder,
- 'EventPluginRegistry: Cannot inject event plugin ordering more than ' +
- 'once. You are likely trying to load more than one copy of React.'
- ) : invariant(!EventPluginOrder));
+ injectEventPluginOrder: function (InjectedEventPluginOrder) {
+ !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
@@ -191,21 +145,15 @@
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
- injectEventPluginsByName: function(injectedNamesToPlugins) {
+ injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
- if (!namesToPlugins.hasOwnProperty(pluginName) ||
- namesToPlugins[pluginName] !== PluginModule) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !namesToPlugins[pluginName],
- 'EventPluginRegistry: Cannot inject two different event plugins ' +
- 'using the same name, `%s`.',
- pluginName
- ) : invariant(!namesToPlugins[pluginName]));
+ if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
+ !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
@@ -222,20 +170,16 @@
* @return {?object} The plugin that created the supplied event.
* @internal
*/
- getPluginModuleForEvent: function(event) {
+ getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
- return EventPluginRegistry.registrationNameModules[
- dispatchConfig.registrationName
- ] || null;
+ return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
- var PluginModule = EventPluginRegistry.registrationNameModules[
- dispatchConfig.phasedRegistrationNames[phase]
- ];
+ var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
if (PluginModule) {
return PluginModule;
}
@@ -247,7 +191,7 @@
* Exposed for unit testing.
* @private
*/
- _resetEventPlugins: function() {
+ _resetEventPlugins: function () {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {

lib/EventPluginUtils.js

@@ -11,9 +11,11 @@
'use strict';
-var EventConstants = require("./EventConstants");
+var EventConstants = require('./EventConstants');
+var ReactErrorUtils = require('./ReactErrorUtils');
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
/**
* Injected dependencies:
@@ -25,14 +27,10 @@
*/
var injection = {
Mount: null,
- injectMount: function(InjectedMount) {
+ injectMount: function (InjectedMount) {
injection.Mount = InjectedMount;
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? invariant(
- InjectedMount && InjectedMount.getNode,
- 'EventPluginUtils.injection.injectMount(...): Injected Mount module ' +
- 'is missing getNode.'
- ) : invariant(InjectedMount && InjectedMount.getNode));
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
}
}
};
@@ -40,50 +38,56 @@
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseUp ||
- topLevelType === topLevelTypes.topTouchEnd ||
- topLevelType === topLevelTypes.topTouchCancel;
+ return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseMove ||
- topLevelType === topLevelTypes.topTouchMove;
+ return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
- return topLevelType === topLevelTypes.topMouseDown ||
- topLevelType === topLevelTypes.topTouchStart;
+ return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
}
-
var validateEventDispatches;
-if ("production" !== process.env.NODE_ENV) {
- validateEventDispatches = function(event) {
+if (process.env.NODE_ENV !== 'production') {
+ validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
- var listenersLen = listenersIsArr ?
- dispatchListeners.length :
- dispatchListeners ? 1 : 0;
-
- ("production" !== process.env.NODE_ENV ? invariant(
- idsIsArr === listenersIsArr && IDsLen === listenersLen,
- 'EventPluginUtils: Invalid `event`.'
- ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen));
+ var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
+
+ process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
};
}
/**
- * Invokes `cb(event, listener, id)`. Avoids using call if no scope is
- * provided. The `(listener,id)` pair effectively forms the "dispatch" but are
- * kept separate to conserve memory.
+ * Dispatch the event to the listener.
+ * @param {SyntheticEvent} event SyntheticEvent to handle
+ * @param {boolean} simulated If the event is simulated (changes exn behavior)
+ * @param {function} listener Application-level callback
+ * @param {string} domID DOM id to pass to the callback.
*/
-function forEachEventDispatch(event, cb) {
+function executeDispatch(event, simulated, listener, domID) {
+ var type = event.type || 'unknown-event';
+ event.currentTarget = injection.Mount.getNode(domID);
+ if (simulated) {
+ ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
+ } else {
+ ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
+ }
+ event.currentTarget = null;
+}
+
+/**
+ * Standard/simple iteration through an event's collected dispatches.
+ */
+function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -92,31 +96,11 @@
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
- cb(event, dispatchListeners[i], dispatchIDs[i]);
+ executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
- cb(event, dispatchListeners, dispatchIDs);
+ executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
}
-}
-
-/**
- * Default implementation of PluginModule.executeDispatch().
- * @param {SyntheticEvent} SyntheticEvent to handle
- * @param {function} Application-level callback
- * @param {string} domID DOM id to pass to the callback.
- */
-function executeDispatch(event, listener, domID) {
- event.currentTarget = injection.Mount.getNode(domID);
- var returnValue = listener(event, domID);
- event.currentTarget = null;
- return returnValue;
-}
-
-/**
- * Standard/simple iteration through an event's collected dispatches.
- */
-function executeDispatchesInOrder(event, cb) {
- forEachEventDispatch(event, cb);
event._dispatchListeners = null;
event._dispatchIDs = null;
}
@@ -125,13 +109,13 @@
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
- * @return id of the first dispatch execution who's listener returns true, or
- * null if no listener returned true.
+ * @return {?string} id of the first dispatch execution who's listener returns
+ * true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
@@ -169,21 +153,16 @@
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
- * @return The return value of executing the single dispatch.
+ * @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
- ("production" !== process.env.NODE_ENV ? invariant(
- !Array.isArray(dispatchListener),
- 'executeDirectDispatch(...): Invalid `event`.'
- ) : invariant(!Array.isArray(dispatchListener)));
- var res = dispatchListener ?
- dispatchListener(event, dispatchID) :
- null;
+ !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
+ var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
@@ -191,7 +170,7 @@
/**
* @param {SyntheticEvent} event
- * @return {bool} True iff number of dispatches accumulated is greater than 0.
+ * @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
@@ -206,12 +185,18 @@
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
- executeDispatch: executeDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
- injection: injection,
- useTouchEvents: false
+
+ getNode: function (id) {
+ return injection.Mount.getNode(id);
+ },
+ getID: function (node) {
+ return injection.Mount.getID(node);
+ },
+
+ injection: injection
};
module.exports = EventPluginUtils;

lib/EventPropagators.js

@@ -11,11 +11,13 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPluginHub = require("./EventPluginHub");
+var EventConstants = require('./EventConstants');
+var EventPluginHub = require('./EventPluginHub');
-var accumulateInto = require("./accumulateInto");
-var forEachAccumulated = require("./forEachAccumulated");
+var warning = require('fbjs/lib/warning');
+
+var accumulateInto = require('./accumulateInto');
+var forEachAccumulated = require('./forEachAccumulated');
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
@@ -25,8 +27,7 @@
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
- var registrationName =
- event.dispatchConfig.phasedRegistrationNames[propagationPhase];
+ var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
@@ -37,16 +38,13 @@
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
- if ("production" !== process.env.NODE_ENV) {
- if (!domID) {
- throw new Error('Dispatching id must not be null');
- }
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
@@ -54,20 +52,24 @@
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
- * each event and perform the traversal for each one. We can not perform a
+ * each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
- EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(
- event.dispatchMarker,
- accumulateDirectionalDispatches,
- event
- );
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
+/**
+ * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
+ */
+function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
+ if (event && event.dispatchConfig.phasedRegistrationNames) {
+ EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
+ }
+}
/**
* Accumulates without regard to direction, does not look for phased
@@ -79,8 +81,7 @@
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
- event._dispatchListeners =
- accumulateInto(event._dispatchListeners, listener);
+ event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
@@ -101,16 +102,13 @@
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
-function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
- EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(
- fromID,
- toID,
- accumulateDispatches,
- leave,
- enter
- );
+function accumulateTwoPhaseDispatchesSkipTarget(events) {
+ forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
+function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
+ EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
+}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
@@ -131,6 +127,7 @@
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
+ accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};

lib/ExecutionEnvironment.js

@@ -1,42 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ExecutionEnvironment
- */
-
-/*jslint evil: true */
-
-"use strict";
-
-var canUseDOM = !!(
- (typeof window !== 'undefined' &&
- window.document && window.document.createElement)
-);
-
-/**
- * Simple, lightweight module assisting with the detection and context of
- * Worker. Helps avoid circular dependencies and allows code to reason about
- * whether or not they are in a Worker, even if they never include the main
- * `ReactWorker` dependency.
- */
-var ExecutionEnvironment = {
-
- canUseDOM: canUseDOM,
-
- canUseWorkers: typeof Worker !== 'undefined',
-
- canUseEventListeners:
- canUseDOM && !!(window.addEventListener || window.attachEvent),
-
- canUseViewport: canUseDOM && !!window.screen,
-
- isInWorker: !canUseDOM // For now, this is true - might change in the future.
-
-};
-
-module.exports = ExecutionEnvironment;

lib/FallbackCompositionState.js

@@ -12,10 +12,10 @@
'use strict';
-var PooledClass = require("./PooledClass");
+var PooledClass = require('./PooledClass');
-var assign = require("./Object.assign");
-var getTextContentAccessor = require("./getTextContentAccessor");
+var assign = require('./Object.assign');
+var getTextContentAccessor = require('./getTextContentAccessor');
/**
* This helper class stores information about text content of a target node,
@@ -35,12 +35,18 @@
}
assign(FallbackCompositionState.prototype, {
+ destructor: function () {
+ this._root = null;
+ this._startText = null;
+ this._fallbackText = null;
+ },
+
/**
* Get current text of input.
*
* @return {string}
*/
- getText: function() {
+ getText: function () {
if ('value' in this._root) {
return this._root.value;
}
@@ -53,7 +59,7 @@
*
* @return {string}
*/
- getData: function() {
+ getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}

lib/findDOMNode.js

@@ -12,58 +12,38 @@
'use strict';
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactInstanceMap = require("./ReactInstanceMap");
-var ReactMount = require("./ReactMount");
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactMount = require('./ReactMount');
-var invariant = require("./invariant");
-var isNode = require("./isNode");
-var warning = require("./warning");
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
- * @return {DOMElement} The root node of this element.
+ * @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
- ("production" !== process.env.NODE_ENV ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing getDOMNode or findDOMNode inside its render(). ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
- if (isNode(componentOrElement)) {
+ if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
- ("production" !== process.env.NODE_ENV ? invariant(
- componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function',
- 'Component (with keys: %s) contains `render` method ' +
- 'but is not mounted in the DOM',
- Object.keys(componentOrElement)
- ) : invariant(componentOrElement.render == null ||
- typeof componentOrElement.render !== 'function'));
- ("production" !== process.env.NODE_ENV ? invariant(
- false,
- 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)',
- Object.keys(componentOrElement)
- ) : invariant(false));
+ !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;

lib/flattenChildren.js

@@ -11,8 +11,8 @@
'use strict';
-var traverseAllChildren = require("./traverseAllChildren");
-var warning = require("./warning");
+var traverseAllChildren = require('./traverseAllChildren');
+var warning = require('fbjs/lib/warning');
/**
* @param {function} traverseContext Context passed through traversal.
@@ -22,15 +22,9 @@
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
- var keyUnique = !result.hasOwnProperty(name);
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- keyUnique,
- 'flattenChildren(...): Encountered two children with the same key, ' +
- '`%s`. Child keys must be unique; when two children share a key, only ' +
- 'the first child will be used.',
- name
- ) : null);
+ var keyUnique = result[name] === undefined;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (keyUnique && child != null) {
result[name] = child;

lib/focusNode.js

@@ -1,27 +0,0 @@
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule focusNode
- */
-
-"use strict";
-
-/**
- * @param {DOMElement} node input/textarea to focus
- */
-function focusNode(node) {
- // IE8 can throw "Can't move focus to the control because it is invisible,
- // not enabled, or of a type that does not accept the focus." for all kinds of
- // reasons that are too expensive and fragile to test.
- try {
- node.focus();
- } catch(e) {
- }
-}
-
-module.exports = focusNode;

lib/forEachAccumulated.js

@@ -12,13 +12,13 @@
'use strict';
/**
- * @param {array} an "accumulation" of items which is either an Array or
+ * @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
-var forEachAccumulated = function(arr, cb, scope) {
+var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {

lib/getActiveElement.js

@@ -1,27 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getActiveElement
- * @typechecks
- */
-
-/**
- * Same as document.activeElement but wraps in a try-catch block. In IE it is
- * not safe to call document.activeElement if there is nothing focused.
- *
- * The activeElement will be null only if the document body is not yet defined.
- */
-function getActiveElement() /*?DOMElement*/ {
- try {
- return document.activeElement || document.body;
- } catch (e) {
- return document.body;
- }
-}
-
-module.exports = getActiveElement;

lib/getEventCharCode.js

@@ -20,7 +20,7 @@
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
- * @return {string} Normalized `charCode` property.
+ * @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;

lib/getEventKey.js

@@ -12,7 +12,7 @@
'use strict';
-var getEventCharCode = require("./getEventCharCode");
+var getEventCharCode = require('./getEventCharCode');
/**
* Normalization of deprecated HTML5 `key` values

lib/getEventModifierState.js

@@ -28,7 +28,6 @@
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
- /*jshint validthis:true */
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {

lib/getIteratorFn.js

@@ -31,9 +31,7 @@
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
- var iteratorFn = maybeIterable && (
- (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL])
- );
+ var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}

lib/getMarkupWrap.js

@@ -1,115 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getMarkupWrap
- */
-
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-
-var invariant = require("./invariant");
-
-/**
- * Dummy container used to detect which wraps are necessary.
- */
-var dummyNode =
- ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
-
-/**
- * Some browsers cannot use `innerHTML` to render certain elements standalone,
- * so we wrap them, render the wrapped nodes, then extract the desired node.
- *
- * In IE8, certain elements cannot render alone, so wrap all elements ('*').
- */
-var shouldWrap = {
- // Force wrapping for SVG elements because if they get created inside a <div>,
- // they will be initialized in the wrong namespace (and will not display).
- 'circle': true,
- 'clipPath': true,
- 'defs': true,
- 'ellipse': true,
- 'g': true,
- 'line': true,
- 'linearGradient': true,
- 'path': true,
- 'polygon': true,
- 'polyline': true,
- 'radialGradient': true,
- 'rect': true,
- 'stop': true,
- 'text': true
-};
-
-var selectWrap = [1, '<select multiple="true">', '</select>'];
-var tableWrap = [1, '<table>', '</table>'];
-var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
-
-var svgWrap = [1, '<svg>', '</svg>'];
-
-var markupWrap = {
- '*': [1, '?<div>', '</div>'],
-
- 'area': [1, '<map>', '</map>'],
- 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
- 'legend': [1, '<fieldset>', '</fieldset>'],
- 'param': [1, '<object>', '</object>'],
- 'tr': [2, '<table><tbody>', '</tbody></table>'],
-
- 'optgroup': selectWrap,
- 'option': selectWrap,
-
- 'caption': tableWrap,
- 'colgroup': tableWrap,
- 'tbody': tableWrap,
- 'tfoot': tableWrap,
- 'thead': tableWrap,
-
- 'td': trWrap,
- 'th': trWrap,
-
- 'circle': svgWrap,
- 'clipPath': svgWrap,
- 'defs': svgWrap,
- 'ellipse': svgWrap,
- 'g': svgWrap,
- 'line': svgWrap,
- 'linearGradient': svgWrap,
- 'path': svgWrap,
- 'polygon': svgWrap,
- 'polyline': svgWrap,
- 'radialGradient': svgWrap,
- 'rect': svgWrap,
- 'stop': svgWrap,
- 'text': svgWrap
-};
-
-/**
- * Gets the markup wrap configuration for the supplied `nodeName`.
- *
- * NOTE: This lazily detects which wraps are necessary for the current browser.
- *
- * @param {string} nodeName Lowercase `nodeName`.
- * @return {?array} Markup wrap configuration, if applicable.
- */
-function getMarkupWrap(nodeName) {
- ("production" !== process.env.NODE_ENV ? invariant(!!dummyNode, 'Markup wrapping node not initialized') : invariant(!!dummyNode));
- if (!markupWrap.hasOwnProperty(nodeName)) {
- nodeName = '*';
- }
- if (!shouldWrap.hasOwnProperty(nodeName)) {
- if (nodeName === '*') {
- dummyNode.innerHTML = '<link />';
- } else {
- dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
- }
- shouldWrap[nodeName] = !dummyNode.firstChild;
- }
- return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
-}
-
-
-module.exports = getMarkupWrap;

lib/getReactRootElementInContainer.js

@@ -1,33 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getReactRootElementInContainer
- */
-
-'use strict';
-
-var DOC_NODE_TYPE = 9;
-
-/**
- * @param {DOMElement|DOMDocument} container DOM element that may contain
- * a React component
- * @return {?*} DOM element that may have the reactRoot ID, or null.
- */
-function getReactRootElementInContainer(container) {
- if (!container) {
- return null;
- }
-
- if (container.nodeType === DOC_NODE_TYPE) {
- return container.documentElement;
- } else {
- return container.firstChild;
- }
-}
-
-module.exports = getReactRootElementInContainer;

lib/getTestDocument.js

@@ -0,0 +1,21 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule getTestDocument
+ */
+
+'use strict';
+
+function getTestDocument(markup) {
+ document.open();
+ document.write(markup || '<!doctype html><html><meta charset=utf-8><title>test doc</title>');
+ document.close();
+ return document;
+}
+
+module.exports = getTestDocument;
\ No newline at end of file

lib/getTextContentAccessor.js

@@ -11,7 +11,7 @@
'use strict';
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var contentKey = null;
@@ -25,9 +25,7 @@
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
- contentKey = 'textContent' in document.documentElement ?
- 'textContent' :
- 'innerText';
+ contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}

lib/getUnboundedScrollPosition.js

@@ -1,38 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule getUnboundedScrollPosition
- * @typechecks
- */
-
-"use strict";
-
-/**
- * Gets the scroll position of the supplied element or window.
- *
- * The return values are unbounded, unlike `getScrollPosition`. This means they
- * may be negative or exceed the element boundaries (which is possible using
- * inertial scrolling).
- *
- * @param {DOMWindow|DOMElement} scrollable
- * @return {object} Map with `x` and `y` keys.
- */
-function getUnboundedScrollPosition(scrollable) {
- if (scrollable === window) {
- return {
- x: window.pageXOffset || document.documentElement.scrollLeft,
- y: window.pageYOffset || document.documentElement.scrollTop
- };
- }
- return {
- x: scrollable.scrollLeft,
- y: scrollable.scrollTop
- };
-}
-
-module.exports = getUnboundedScrollPosition;

lib/HTMLDOMPropertyConfig.js

@@ -9,41 +9,27 @@
* @providesModule HTMLDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
-var DOMProperty = require("./DOMProperty");
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var DOMProperty = require('./DOMProperty');
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
-var HAS_POSITIVE_NUMERIC_VALUE =
- DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
-var HAS_OVERLOADED_BOOLEAN_VALUE =
- DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
+var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
+var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
- hasSVG = (
- implementation &&
- implementation.hasFeature &&
- implementation.hasFeature(
- 'http://www.w3.org/TR/SVG11/feature#BasicStructure',
- '1.1'
- )
- );
+ hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
}
-
var HTMLDOMPropertyConfig = {
- isCustomAttribute: RegExp.prototype.test.bind(
- /^(data|aria)-[a-z_][a-z\d_.\-]*$/
- ),
+ isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
Properties: {
/**
* Standard Properties
@@ -57,12 +43,14 @@
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
- // autoFocus is polyfilled/normalized by AutoFocusMixin
+ // autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
+ capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
+ challenge: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
@@ -81,6 +69,7 @@
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
+ 'default': HAS_BOOLEAN_VALUE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
@@ -104,6 +93,12 @@
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
+ inputMode: MUST_USE_ATTRIBUTE,
+ integrity: null,
+ is: MUST_USE_ATTRIBUTE,
+ keyParams: MUST_USE_ATTRIBUTE,
+ keyType: MUST_USE_ATTRIBUTE,
+ kind: null,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
@@ -118,9 +113,11 @@
mediaGroup: null,
method: null,
min: null,
+ minLength: MUST_USE_ATTRIBUTE,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
+ nonce: MUST_USE_ATTRIBUTE,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
optimum: null,
@@ -132,6 +129,7 @@
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
+ reversed: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
@@ -148,10 +146,12 @@
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
+ srcLang: null,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
+ summary: null,
tabIndex: null,
target: null,
title: null,
@@ -160,14 +160,32 @@
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
+ wrap: null,
+
+ /**
+ * RDFa Properties
+ */
+ about: MUST_USE_ATTRIBUTE,
+ datatype: MUST_USE_ATTRIBUTE,
+ inlist: MUST_USE_ATTRIBUTE,
+ prefix: MUST_USE_ATTRIBUTE,
+ // property is also supported for OpenGraph in meta tags.
+ property: MUST_USE_ATTRIBUTE,
+ resource: MUST_USE_ATTRIBUTE,
+ 'typeof': MUST_USE_ATTRIBUTE,
+ vocab: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
- autoCapitalize: null,
- autoCorrect: null,
+ autoCapitalize: MUST_USE_ATTRIBUTE,
+ autoCorrect: MUST_USE_ATTRIBUTE,
+ // autoSave allows WebKit/Blink to persist values of input fields on page reloads
+ autoSave: null,
+ // color is for Safari mask-icon link
+ color: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
@@ -178,8 +196,12 @@
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
- // property is supported for OpenGraph in meta tags.
- property: null,
+ // results show looking glass icon and recent searches on input
+ // search fields in WebKit/Blink
+ results: null,
+ // IE-only attribute that specifies security restrictions on an iframe
+ // as an alternative to the sandbox attribute on IE<10
+ security: MUST_USE_ATTRIBUTE,
// IE-only attribute that controls focus behavior
unselectable: MUST_USE_ATTRIBUTE
},
@@ -190,11 +212,10 @@
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
- autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
- autoCorrect: 'autocorrect',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
+ autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',

lib/hyphenate.js

@@ -1,31 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenate
- * @typechecks
- */
-
-var _uppercasePattern = /([A-Z])/g;
-
-/**
- * Hyphenates a camelcased string, for example:
- *
- * > hyphenate('backgroundColor')
- * < "background-color"
- *
- * For CSS style names, use `hyphenateStyleName` instead which works properly
- * with all vendor prefixes, including `ms`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenate(string) {
- return string.replace(_uppercasePattern, '-$1').toLowerCase();
-}
-
-module.exports = hyphenate;

lib/hyphenateStyleName.js

@@ -1,39 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule hyphenateStyleName
- * @typechecks
- */
-
-"use strict";
-
-var hyphenate = require("./hyphenate");
-
-var msPattern = /^ms-/;
-
-/**
- * Hyphenates a camelcased CSS property name, for example:
- *
- * > hyphenateStyleName('backgroundColor')
- * < "background-color"
- * > hyphenateStyleName('MozTransition')
- * < "-moz-transition"
- * > hyphenateStyleName('msTransition')
- * < "-ms-transition"
- *
- * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
- * is converted to `-ms-`.
- *
- * @param {string} string
- * @return {string}
- */
-function hyphenateStyleName(string) {
- return hyphenate(string).replace(msPattern, '-ms-');
-}
-
-module.exports = hyphenateStyleName;

lib/instantiateReactComponent.js

@@ -12,23 +12,29 @@
'use strict';
-var ReactCompositeComponent = require("./ReactCompositeComponent");
-var ReactEmptyComponent = require("./ReactEmptyComponent");
-var ReactNativeComponent = require("./ReactNativeComponent");
-
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
-var warning = require("./warning");
+var ReactCompositeComponent = require('./ReactCompositeComponent');
+var ReactEmptyComponent = require('./ReactEmptyComponent');
+var ReactNativeComponent = require('./ReactNativeComponent');
+
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
// To avoid a cyclic dependency, we create the final class in this module
-var ReactCompositeComponentWrapper = function() { };
-assign(
- ReactCompositeComponentWrapper.prototype,
- ReactCompositeComponent.Mixin,
- {
+var ReactCompositeComponentWrapper = function () {};
+assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
+});
+
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
}
-);
+ return '';
+}
/**
* Check if the type reference is a known internal type. I.e. not a user
@@ -38,49 +44,31 @@
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
- return (
- typeof type === 'function' &&
- typeof type.prototype !== 'undefined' &&
- typeof type.prototype.mountComponent === 'function' &&
- typeof type.prototype.receiveComponent === 'function'
- );
+ return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
- * @param {*} parentCompositeType The composite type that resolved this.
* @return {object} A new instance of the element's constructor.
* @protected
*/
-function instantiateReactComponent(node, parentCompositeType) {
+function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
- node = ReactEmptyComponent.emptyElement;
- }
-
- if (typeof node === 'object') {
+ instance = new ReactEmptyComponent(instantiateReactComponent);
+ } else if (typeof node === 'object') {
var element = node;
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- element && (typeof element.type === 'function' ||
- typeof element.type === 'string'),
- 'Only functions or strings can be mounted as React components.'
- ) : null);
- }
+ !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
// Special case string values
- if (parentCompositeType === element.type &&
- typeof element.type === 'string') {
- // Avoid recursion if the wrapper renders itself.
+ if (typeof element.type === 'string') {
instance = ReactNativeComponent.createInternalComponent(element);
- // All native components are currently wrapped in a composite so we're
- // safe to assume that this is what we should instantiate.
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
- // represenations. I.e. ART. Once those are updated to use the string
+ // representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
} else {
@@ -89,21 +77,11 @@
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
- ("production" !== process.env.NODE_ENV ? invariant(
- false,
- 'Encountered invalid React node of type %s',
- typeof node
- ) : invariant(false));
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
}
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- typeof instance.construct === 'function' &&
- typeof instance.mountComponent === 'function' &&
- typeof instance.receiveComponent === 'function' &&
- typeof instance.unmountComponent === 'function',
- 'Only React Components can be mounted.'
- ) : null);
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
}
// Sets up the instance. This can probably just move into the constructor now.
@@ -115,14 +93,14 @@
instance._mountIndex = 0;
instance._mountImage = null;
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
instance._isOwnerNecessary = false;
instance._warnedAboutRefsInRender = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}

lib/invariant.js

@@ -1,53 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule invariant
- */
-
-"use strict";
-
-/**
- * Use invariant() to assert state which your program assumes to be true.
- *
- * Provide sprintf-style format (only %s is supported) and arguments
- * to provide information about what broke and what you were
- * expecting.
- *
- * The invariant message will be stripped in production, but the invariant
- * will remain to ensure logic does not differ in production.
- */
-
-var invariant = function(condition, format, a, b, c, d, e, f) {
- if ("production" !== process.env.NODE_ENV) {
- if (format === undefined) {
- throw new Error('invariant requires an error message argument');
- }
- }
-
- if (!condition) {
- var error;
- if (format === undefined) {
- error = new Error(
- 'Minified exception occurred; use the non-minified dev environment ' +
- 'for the full error message and additional helpful warnings.'
- );
- } else {
- var args = [a, b, c, d, e, f];
- var argIndex = 0;
- error = new Error(
- 'Invariant Violation: ' +
- format.replace(/%s/g, function() { return args[argIndex++]; })
- );
- }
-
- error.framesToPop = 1; // we don't care about invariant's own frame
- throw error;
- }
-};
-
-module.exports = invariant;

lib/isEventSupported.js

@@ -11,13 +11,11 @@
'use strict';
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
- useHasFeature =
- document.implementation &&
- document.implementation.hasFeature &&
+ useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
@@ -38,13 +36,12 @@
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
- if (!ExecutionEnvironment.canUseDOM ||
- capture && !('addEventListener' in document)) {
+ if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
- var isSupported = eventName in document;
+ var isSupported = (eventName in document);
if (!isSupported) {
var element = document.createElement('div');

lib/isNode.js

@@ -1,25 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isNode
- * @typechecks
- */
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM node.
- */
-function isNode(object) {
- return !!(object && (
- ((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
- typeof object.nodeType === 'number' &&
- typeof object.nodeName === 'string'))
- ));
-}
-
-module.exports = isNode;

lib/isTextInputElement.js

@@ -33,9 +33,8 @@
};
function isTextInputElement(elem) {
- return elem && (
- (elem.nodeName === 'INPUT' && supportedInputTypes[elem.type] || elem.nodeName === 'TEXTAREA')
- );
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
}
module.exports = isTextInputElement;

lib/isTextNode.js

@@ -1,23 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule isTextNode
- * @typechecks
- */
-
-var isNode = require("./isNode");
-
-/**
- * @param {*} object The object to check.
- * @return {boolean} Whether or not the object is a DOM text node.
- */
-function isTextNode(object) {
- return isNode(object) && object.nodeType == 3;
-}
-
-module.exports = isTextNode;

lib/joinClasses.js

@@ -1,39 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule joinClasses
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Combines multiple className strings into one.
- * http://jsperf.com/joinclasses-args-vs-array
- *
- * @param {...?string} classes
- * @return {string}
- */
-function joinClasses(className/*, ... */) {
- if (!className) {
- className = '';
- }
- var nextClass;
- var argLength = arguments.length;
- if (argLength > 1) {
- for (var ii = 1; ii < argLength; ii++) {
- nextClass = arguments[ii];
- if (nextClass) {
- className = (className ? className + ' ' : '') + nextClass;
- }
- }
- }
- return className;
-}
-
-module.exports = joinClasses;

lib/keyMirror.js

@@ -1,51 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyMirror
- * @typechecks static-only
- */
-
-'use strict';
-
-var invariant = require("./invariant");
-
-/**
- * Constructs an enumeration with keys equal to their value.
- *
- * For example:
- *
- * var COLORS = keyMirror({blue: null, red: null});
- * var myColor = COLORS.blue;
- * var isColorValid = !!COLORS[myColor];
- *
- * The last line could not be performed if the values of the generated enum were
- * not equal to their keys.
- *
- * Input: {key1: val1, key2: val2}
- * Output: {key1: key1, key2: key2}
- *
- * @param {object} obj
- * @return {object}
- */
-var keyMirror = function(obj) {
- var ret = {};
- var key;
- ("production" !== process.env.NODE_ENV ? invariant(
- obj instanceof Object && !Array.isArray(obj),
- 'keyMirror(...): Argument must be an object.'
- ) : invariant(obj instanceof Object && !Array.isArray(obj)));
- for (key in obj) {
- if (!obj.hasOwnProperty(key)) {
- continue;
- }
- ret[key] = key;
- }
- return ret;
-};
-
-module.exports = keyMirror;

lib/keyOf.js

@@ -1,34 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule keyOf
- */
-
-/**
- * Allows extraction of a minified key. Let's the build system minify keys
- * without loosing the ability to dynamically use key strings as values
- * themselves. Pass in an object with a single key/val pair and it will return
- * you the string key of that single record. Suppose you want to grab the
- * value for a key 'className' inside of an object. Key/val minification may
- * have aliased that key to be 'xa12'. keyOf({className: null}) will return
- * 'xa12' in that case. Resolve keys you want to use once at startup time, then
- * reuse those resolutions.
- */
-var keyOf = function(oneKeyObj) {
- var key;
- for (key in oneKeyObj) {
- if (!oneKeyObj.hasOwnProperty(key)) {
- continue;
- }
- return key;
- }
- return null;
-};
-
-
-module.exports = keyOf;

lib/LinkedStateMixin.js

@@ -12,8 +12,8 @@
'use strict';
-var ReactLink = require("./ReactLink");
-var ReactStateSetters = require("./ReactStateSetters");
+var ReactLink = require('./ReactLink');
+var ReactStateSetters = require('./ReactStateSetters');
/**
* A simple mixin around ReactLink.forState().
@@ -28,11 +28,8 @@
* if you're using Google Closure Compiler advanced mode.
* @return {ReactLink} ReactLink instance linking to the state.
*/
- linkState: function(key) {
- return new ReactLink(
- this.state[key],
- ReactStateSetters.createStateKeySetter(this, key)
- );
+ linkState: function (key) {
+ return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
}
};

lib/LinkedValueUtils.js

@@ -12,9 +12,11 @@
'use strict';
-var ReactPropTypes = require("./ReactPropTypes");
+var ReactPropTypes = require('./ReactPropTypes');
+var ReactPropTypeLocations = require('./ReactPropTypeLocations');
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
var hasReadOnlyValue = {
'button': true,
@@ -26,46 +28,44 @@
'submit': true
};
-function _assertSingleLink(input) {
- ("production" !== process.env.NODE_ENV ? invariant(
- input.props.checkedLink == null || input.props.valueLink == null,
- 'Cannot provide a checkedLink and a valueLink. If you want to use ' +
- 'checkedLink, you probably don\'t want to use valueLink and vice versa.'
- ) : invariant(input.props.checkedLink == null || input.props.valueLink == null));
+function _assertSingleLink(inputProps) {
+ !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
}
-function _assertValueLink(input) {
- _assertSingleLink(input);
- ("production" !== process.env.NODE_ENV ? invariant(
- input.props.value == null && input.props.onChange == null,
- 'Cannot provide a valueLink and a value or onChange event. If you want ' +
- 'to use value or onChange, you probably don\'t want to use valueLink.'
- ) : invariant(input.props.value == null && input.props.onChange == null));
+function _assertValueLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
}
-function _assertCheckedLink(input) {
- _assertSingleLink(input);
- ("production" !== process.env.NODE_ENV ? invariant(
- input.props.checked == null && input.props.onChange == null,
- 'Cannot provide a checkedLink and a checked property or onChange event. ' +
- 'If you want to use checked or onChange, you probably don\'t want to ' +
- 'use checkedLink'
- ) : invariant(input.props.checked == null && input.props.onChange == null));
+function _assertCheckedLink(inputProps) {
+ _assertSingleLink(inputProps);
+ !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
}
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedValueChange(e) {
- /*jshint validthis:true */
- this.props.valueLink.requestChange(e.target.value);
-}
+var propTypes = {
+ value: function (props, propName, componentName) {
+ if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ checked: function (props, propName, componentName) {
+ if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
+ return null;
+ }
+ return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
+ },
+ onChange: ReactPropTypes.func
+};
-/**
- * @param {SyntheticEvent} e change event to handle
- */
-function _handleLinkedCheckChange(e) {
- /*jshint validthis:true */
- this.props.checkedLink.requestChange(e.target.checked);
+var loggedTypeFailures = {};
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
+ }
+ }
+ return '';
}
/**
@@ -73,79 +73,61 @@
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
- Mixin: {
- propTypes: {
- value: function(props, propName, componentName) {
- if (!props[propName] ||
- hasReadOnlyValue[props.type] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
- }
- return new Error(
- 'You provided a `value` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultValue`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- checked: function(props, propName, componentName) {
- if (!props[propName] ||
- props.onChange ||
- props.readOnly ||
- props.disabled) {
- return null;
+ checkPropTypes: function (tagName, props, owner) {
+ for (var propName in propTypes) {
+ if (propTypes.hasOwnProperty(propName)) {
+ var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
+ }
+ if (error instanceof Error && !(error.message in loggedTypeFailures)) {
+ // Only monitor this failure once because there tends to be a lot of the
+ // same error.
+ loggedTypeFailures[error.message] = true;
+
+ var addendum = getDeclarationErrorAddendum(owner);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
}
- return new Error(
- 'You provided a `checked` prop to a form field without an ' +
- '`onChange` handler. This will render a read-only field. If ' +
- 'the field should be mutable use `defaultChecked`. Otherwise, ' +
- 'set either `onChange` or `readOnly`.'
- );
- },
- onChange: ReactPropTypes.func
}
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
- getValue: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return input.props.valueLink.value;
+ getValue: function (inputProps) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.value;
}
- return input.props.value;
+ return inputProps.value;
},
/**
- * @param {ReactComponent} input Form component
+ * @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
- getChecked: function(input) {
- if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return input.props.checkedLink.value;
+ getChecked: function (inputProps) {
+ if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.value;
}
- return input.props.checked;
+ return inputProps.checked;
},
/**
- * @param {ReactComponent} input Form component
- * @return {function} change callback either from onChange prop or link.
+ * @param {object} inputProps Props for form component
+ * @param {SyntheticEvent} event change event to handle
*/
- getOnChange: function(input) {
- if (input.props.valueLink) {
- _assertValueLink(input);
- return _handleLinkedValueChange;
- } else if (input.props.checkedLink) {
- _assertCheckedLink(input);
- return _handleLinkedCheckChange;
+ executeOnChange: function (inputProps, event) {
+ if (inputProps.valueLink) {
+ _assertValueLink(inputProps);
+ return inputProps.valueLink.requestChange(event.target.value);
+ } else if (inputProps.checkedLink) {
+ _assertCheckedLink(inputProps);
+ return inputProps.checkedLink.requestChange(event.target.checked);
+ } else if (inputProps.onChange) {
+ return inputProps.onChange.call(undefined, event);
}
- return input.props.onChange;
}
};

lib/LocalEventTrapMixin.js

@@ -1,53 +0,0 @@
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule LocalEventTrapMixin
- */
-
-'use strict';
-
-var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
-
-var accumulateInto = require("./accumulateInto");
-var forEachAccumulated = require("./forEachAccumulated");
-var invariant = require("./invariant");
-
-function remove(event) {
- event.remove();
-}
-
-var LocalEventTrapMixin = {
- trapBubbledEvent:function(topLevelType, handlerBaseName) {
- ("production" !== process.env.NODE_ENV ? invariant(this.isMounted(), 'Must be mounted to trap events') : invariant(this.isMounted()));
- // If a component renders to null or if another component fatals and causes
- // the state of the tree to be corrupted, `node` here can be null.
- var node = this.getDOMNode();
- ("production" !== process.env.NODE_ENV ? invariant(
- node,
- 'LocalEventTrapMixin.trapBubbledEvent(...): Requires node to be rendered.'
- ) : invariant(node));
- var listener = ReactBrowserEventEmitter.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- node
- );
- this._localEventListeners =
- accumulateInto(this._localEventListeners, listener);
- },
-
- // trapCapturedEvent would look nearly identical. We don't implement that
- // method because it isn't currently needed.
-
- componentWillUnmount:function() {
- if (this._localEventListeners) {
- forEachAccumulated(this._localEventListeners, remove);
- }
- }
-};
-
-module.exports = LocalEventTrapMixin;

lib/mapObject.js

@@ -1,51 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule mapObject
- */
-
-'use strict';
-
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-
-/**
- * Executes the provided `callback` once for each enumerable own property in the
- * object and constructs a new object from the results. The `callback` is
- * invoked with three arguments:
- *
- * - the property value
- * - the property name
- * - the object being traversed
- *
- * Properties that are added after the call to `mapObject` will not be visited
- * by `callback`. If the values of existing properties are changed, the value
- * passed to `callback` will be the value at the time `mapObject` visits them.
- * Properties that are deleted before being visited are not visited.
- *
- * @grep function objectMap()
- * @grep function objMap()
- *
- * @param {?object} object
- * @param {function} callback
- * @param {*} context
- * @return {?object}
- */
-function mapObject(object, callback, context) {
- if (!object) {
- return null;
- }
- var result = {};
- for (var name in object) {
- if (hasOwnProperty.call(object, name)) {
- result[name] = callback.call(context, object[name], name, object);
- }
- }
- return result;
-}
-
-module.exports = mapObject;

lib/memoizeStringOnly.js

@@ -1,31 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule memoizeStringOnly
- * @typechecks static-only
- */
-
-'use strict';
-
-/**
- * Memoizes the return value of a function that accepts one string argument.
- *
- * @param {function} callback
- * @return {function}
- */
-function memoizeStringOnly(callback) {
- var cache = {};
- return function(string) {
- if (!cache.hasOwnProperty(string)) {
- cache[string] = callback.call(this, string);
- }
- return cache[string];
- };
-}
-
-module.exports = memoizeStringOnly;

lib/MetaMatchers.js

@@ -0,0 +1,118 @@
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule MetaMatchers
+ */
+
+'use strict';
+
+/**
+ * This modules adds a jasmine matcher toEqualSpecsIn that can be used to
+ * compare the specs in two different "describe" functions and their result.
+ * It can be used to test a test.
+ */
+
+function getRunnerWithResults(describeFunction) {
+ if (describeFunction._cachedRunner) {
+ // Cached result of execution. This is a convenience way to test against
+ // the same authorative function multiple times.
+ return describeFunction._cachedRunner;
+ }
+ // Patch the current global environment.
+ var env = new jasmine.Env();
+ // Execute the tests synchronously.
+ env.updateInterval = 0;
+ var outerGetEnv = jasmine.getEnv;
+ jasmine.getEnv = function () {
+ return env;
+ };
+ // TODO: Bring over matchers from the existing environment.
+ var runner = env.currentRunner();
+ try {
+ env.describe('', describeFunction);
+ env.execute();
+ } finally {
+ // Restore the environment.
+ jasmine.getEnv = outerGetEnv;
+ }
+ describeFunction._cachedRunner = runner;
+ return runner;
+}
+
+function compareSpec(actual, expected) {
+ if (actual.results().totalCount !== expected.results().totalCount) {
+ return 'Expected ' + expected.results().totalCount + ' expects, ' + 'but got ' + actual.results().totalCount + ':' + actual.getFullName();
+ }
+ return null;
+}
+
+function includesDescription(specs, description, startIndex) {
+ for (var i = startIndex; i < specs.length; i++) {
+ if (specs[i].description === description) {
+ return true;
+ }
+ }
+ return false;
+}
+
+function compareSpecs(actualSpecs, expectedSpecs) {
+ for (var i = 0; i < actualSpecs.length && i < expectedSpecs.length; i++) {
+ var actual = actualSpecs[i];
+ var expected = expectedSpecs[i];
+ if (actual.description === expected.description) {
+ var errorMessage = compareSpec(actual, expected);
+ if (errorMessage) {
+ return errorMessage;
+ }
+ continue;
+ } else if (includesDescription(actualSpecs, expected.description, i)) {
+ return 'Did not expect the spec:' + actualSpecs[i].getFullName();
+ } else {
+ return 'Expected an equivalent to:' + expectedSpecs[i].getFullName();
+ }
+ }
+ if (i < actualSpecs.length) {
+ return 'Did not expect the spec:' + actualSpecs[i].getFullName();
+ }
+ if (i < expectedSpecs.length) {
+ return 'Expected an equivalent to:' + expectedSpecs[i].getFullName();
+ }
+ return null;
+}
+
+function compareDescription(a, b) {
+ if (a.description === b.description) {
+ return 0;
+ }
+ return a.description < b.description ? -1 : 1;
+}
+
+function compareRunners(actual, expected) {
+ return compareSpecs(actual.specs().sort(compareDescription), expected.specs().sort(compareDescription));
+}
+
+var MetaMatchers = {
+ toEqualSpecsIn: function (expectedDescribeFunction) {
+ var actualDescribeFunction = this.actual;
+ if (typeof actualDescribeFunction !== 'function') {
+ throw Error('toEqualSpecsIn() should be used on a describe function');
+ }
+ if (typeof expectedDescribeFunction !== 'function') {
+ throw Error('toEqualSpecsIn() should be passed a describe function');
+ }
+ var actual = getRunnerWithResults(actualDescribeFunction);
+ var expected = getRunnerWithResults(expectedDescribeFunction);
+ var errorMessage = compareRunners(actual, expected);
+ this.message = function () {
+ return [errorMessage, 'The specs are equal. Expected them to be different.'];
+ };
+ return !errorMessage;
+ }
+};
+
+module.exports = MetaMatchers;
\ No newline at end of file

lib/MobileSafariClickEventPlugin.js

@@ -1,56 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule MobileSafariClickEventPlugin
- * @typechecks static-only
- */
-
-'use strict';
-
-var EventConstants = require("./EventConstants");
-
-var emptyFunction = require("./emptyFunction");
-
-var topLevelTypes = EventConstants.topLevelTypes;
-
-/**
- * Mobile Safari does not fire properly bubble click events on non-interactive
- * elements, which means delegated click listeners do not fire. The workaround
- * for this bug involves attaching an empty click listener on the target node.
- *
- * This particular plugin works around the bug by attaching an empty click
- * listener on `touchstart` (which does fire on every element).
- */
-var MobileSafariClickEventPlugin = {
-
- eventTypes: null,
-
- /**
- * @param {string} topLevelType Record from `EventConstants`.
- * @param {DOMEventTarget} topLevelTarget The listening component root node.
- * @param {string} topLevelTargetID ID of `topLevelTarget`.
- * @param {object} nativeEvent Native browser event.
- * @return {*} An accumulation of synthetic events.
- * @see {EventPluginHub.extractEvents}
- */
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- if (topLevelType === topLevelTypes.topTouchStart) {
- var target = nativeEvent.target;
- if (target && !target.onclick) {
- target.onclick = emptyFunction;
- }
- }
- }
-
-};
-
-module.exports = MobileSafariClickEventPlugin;

lib/onlyChild.js

@@ -10,9 +10,9 @@
*/
'use strict';
-var ReactElement = require("./ReactElement");
+var ReactElement = require('./ReactElement');
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
/**
* Returns the first child in a collection of children and verifies that there
@@ -26,10 +26,7 @@
* structure.
*/
function onlyChild(children) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactElement.isValidElement(children),
- 'onlyChild must be passed a children with exactly one child.'
- ) : invariant(ReactElement.isValidElement(children)));
+ !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
return children;
}

lib/OrderedMap.js

@@ -0,0 +1,453 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule OrderedMap
+ */
+
+'use strict';
+
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
+
+var PREFIX = 'key:';
+
+/**
+ * Utility to extract a backing object from an initialization `Array`, allowing
+ * the caller to assist in resolving the unique ID for each entry via the
+ * `keyExtractor` callback. The `keyExtractor` must extract non-empty strings or
+ * numbers.
+ * @param {Array<Object!>} arr Array of items.
+ * @param {function} keyExtractor Extracts a unique key from each item.
+ * @return {Object} Map from unique key to originating value that the key was
+ * extracted from.
+ * @throws Exception if the initialization array has duplicate extracted keys.
+ */
+function extractObjectFromArray(arr, keyExtractor) {
+ var normalizedObj = {};
+ for (var i = 0; i < arr.length; i++) {
+ var item = arr[i];
+ var key = keyExtractor(item);
+ assertValidPublicKey(key);
+ var normalizedKey = PREFIX + key;
+ !!(normalizedKey in normalizedObj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: IDs returned by the key extraction function must be unique.') : invariant(false) : undefined;
+ normalizedObj[normalizedKey] = item;
+ }
+ return normalizedObj;
+}
+
+/**
+ * Utility class for mappings with ordering. This class is to be used in an
+ * immutable manner. A `OrderedMap` is very much like the native JavaScript
+ * object, where keys map to values via the `get()` function. Also, like the
+ * native JavaScript object, there is an ordering associated with the mapping.
+ * This class is helpful because it eliminates many of the pitfalls that come
+ * with the native JavaScript ordered mappings. Specifically, there are
+ * inconsistencies with numeric keys in some JavaScript implementations
+ * (enumeration ordering). This class protects against those pitfalls and
+ * provides functional utilities for dealing with these `OrderedMap`s.
+ *
+ * - TODO:
+ * - orderedMergeExclusive: Merges mutually exclusive `OrderedMap`s.
+ * - mapReverse().
+ *
+ * @class {OrderedMap}
+ * @constructor {OrderedMap}
+ * @param {Object} normalizedObj Object that is known to be a defensive copy of
+ * caller supplied data. We require a defensive copy to guard against callers
+ * mutating. It is also assumed that the keys of `normalizedObj` have been
+ * normalized and do not contain any numeric-appearing strings.
+ * @param {number} computedLength The precomputed length of `_normalizedObj`
+ * keys.
+ * @private
+ */
+function OrderedMapImpl(normalizedObj, computedLength) {
+ this._normalizedObj = normalizedObj;
+ this._computedPositions = null;
+ this.length = computedLength;
+}
+
+/**
+ * Validates a "public" key - that is, one that the public facing API supplies.
+ * The key is then normalized for internal storage. In order to be considered
+ * valid, all keys must be non-empty, defined, non-null strings or numbers.
+ *
+ * @param {string?} key Validates that the key is suitable for use in a
+ * `OrderedMap`.
+ * @throws Error if key is not appropriate for use in `OrderedMap`.
+ */
+function assertValidPublicKey(key) {
+ !(key !== '' && (typeof key === 'string' || typeof key === 'number')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: Key must be non-empty, non-null string or number.') : invariant(false) : undefined;
+}
+
+/**
+ * Validates that arguments to range operations are within the correct limits.
+ *
+ * @param {number} start Start of range.
+ * @param {number} length Length of range.
+ * @param {number} actualLen Actual length of range that should not be
+ * exceeded.
+ * @throws Error if range arguments are out of bounds.
+ */
+function assertValidRangeIndices(start, length, actualLen) {
+ !(typeof start === 'number' && typeof length === 'number' && length >= 0 && start >= 0 && start + length <= actualLen) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: `mapRange` and `forEachRange` expect non-negative start and ' + 'length arguments within the bounds of the instance.') : invariant(false) : undefined;
+}
+
+/**
+ * Merges two "normalized" objects (objects who's key have been normalized) into
+ * a `OrderedMap`.
+ *
+ * @param {Object} a Object of key value pairs.
+ * @param {Object} b Object of key value pairs.
+ * @return {OrderedMap} new `OrderedMap` that results in merging `a` and `b`.
+ */
+function _fromNormalizedObjects(a, b) {
+ // Second optional, both must be plain JavaScript objects.
+ !(a && a.constructor === Object && (!b || b.constructor === Object)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap: Corrupted instance of OrderedMap detected.') : invariant(false) : undefined;
+
+ var newSet = {};
+ var length = 0;
+ var key;
+ for (key in a) {
+ if (a.hasOwnProperty(key)) {
+ newSet[key] = a[key];
+ length++;
+ }
+ }
+
+ for (key in b) {
+ if (b.hasOwnProperty(key)) {
+ // Increment length if not already added via first object (a)
+ if (!(key in newSet)) {
+ length++;
+ }
+ newSet[key] = b[key];
+ }
+ }
+ return new OrderedMapImpl(newSet, length);
+}
+
+/**
+ * Methods for `OrderedMap` instances.
+ *
+ * @lends OrderedMap.prototype
+ * TODO: Make this data structure lazy, unify with LazyArray.
+ * TODO: Unify this with ImmutableObject - it is to be used immutably.
+ * TODO: If so, consider providing `fromObject` API.
+ * TODO: Create faster implementation of merging/mapping from original Array,
+ * without having to first create an object - simply for the sake of merging.
+ */
+var OrderedMapMethods = {
+
+ /**
+ * Returns whether or not a given key is present in the map.
+ *
+ * @param {string} key Valid string key to lookup membership for.
+ * @return {boolean} Whether or not `key` is a member of the map.
+ * @throws Error if provided known invalid key.
+ */
+ has: function (key) {
+ assertValidPublicKey(key);
+ var normalizedKey = PREFIX + key;
+ return normalizedKey in this._normalizedObj;
+ },
+
+ /**
+ * Returns the object for a given key, or `undefined` if not present. To
+ * distinguish an undefined entry vs not being in the set, use `has()`.
+ *
+ * @param {string} key String key to lookup the value for.
+ * @return {Object?} Object at key `key`, or undefined if not in map.
+ * @throws Error if provided known invalid key.
+ */
+ get: function (key) {
+ assertValidPublicKey(key);
+ var normalizedKey = PREFIX + key;
+ return this.has(key) ? this._normalizedObj[normalizedKey] : undefined;
+ },
+
+ /**
+ * Merges, appending new keys to the end of the ordering. Keys in `orderedMap`
+ * that are redundant with `this`, maintain the same ordering index that they
+ * had in `this`. This is how standard JavaScript object merging would work.
+ * If you wish to prepend a `OrderedMap` to the beginning of another
+ * `OrderedMap` then simply reverse the order of operation. This is the analog
+ * to `merge(x, y)`.
+ *
+ * @param {OrderedMap} orderedMap OrderedMap to merge onto the end.
+ * @return {OrderedMap} New OrderedMap that represents the result of the
+ * merge.
+ */
+ merge: function (orderedMap) {
+ !(orderedMap instanceof OrderedMapImpl) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.merge(...): Expected an OrderedMap instance.') : invariant(false) : undefined;
+ return _fromNormalizedObjects(this._normalizedObj, orderedMap._normalizedObj);
+ },
+
+ /**
+ * Functional map API. Returns a new `OrderedMap`.
+ *
+ * @param {Function} cb Callback to invoke for each item.
+ * @param {Object?=} context Context to invoke callback from.
+ * @return {OrderedMap} OrderedMap that results from mapping.
+ */
+ map: function (cb, context) {
+ return this.mapRange(cb, 0, this.length, context);
+ },
+
+ /**
+ * The callback `cb` is invoked with the arguments (item, key,
+ * indexInOriginal).
+ *
+ * @param {Function} cb Determines result for each item.
+ * @param {number} start Start index of map range.
+ * @param {end} length End index of map range.
+ * @param {*!?} context Context of callback invocation.
+ * @return {OrderedMap} OrderedMap resulting from mapping the range.
+ */
+ mapRange: function (cb, start, length, context) {
+ var thisSet = this._normalizedObj;
+ var newSet = {};
+ var i = 0;
+ assertValidRangeIndices(start, length, this.length);
+ var end = start + length - 1;
+ for (var key in thisSet) {
+ if (thisSet.hasOwnProperty(key)) {
+ if (i >= start) {
+ if (i > end) {
+ break;
+ }
+ var item = thisSet[key];
+ newSet[key] = cb.call(context, item, key.substr(PREFIX.length), i);
+ }
+ i++;
+ }
+ }
+ return new OrderedMapImpl(newSet, length);
+ },
+
+ /**
+ * Function filter API. Returns new `OrderedMap`.
+ *
+ * @param {Function} cb Callback to invoke for each item.
+ * @param {Object?=} context Context to invoke callback from.
+ * @return {OrderedMap} OrderedMap that results from filtering.
+ */
+ filter: function (cb, context) {
+ return this.filterRange(cb, 0, this.length, context);
+ },
+
+ /**
+ * The callback `cb` is invoked with the arguments (item, key,
+ * indexInOriginal).
+ *
+ * @param {Function} cb Returns true if item should be in result.
+ * @param {number} start Start index of filter range.
+ * @param {number} length End index of map range.
+ * @param {*!?} context Context of callback invocation.
+ * @return {OrderedMap} OrderedMap resulting from filtering the range.
+ */
+ filterRange: function (cb, start, length, context) {
+ var newSet = {};
+ var newSetLength = 0;
+ this.forEachRange(function (item, key, originalIndex) {
+ if (cb.call(context, item, key, originalIndex)) {
+ var normalizedKey = PREFIX + key;
+ newSet[normalizedKey] = item;
+ newSetLength++;
+ }
+ }, start, length);
+ return new OrderedMapImpl(newSet, newSetLength);
+ },
+
+ forEach: function (cb, context) {
+ this.forEachRange(cb, 0, this.length, context);
+ },
+
+ forEachRange: function (cb, start, length, context) {
+ assertValidRangeIndices(start, length, this.length);
+ var thisSet = this._normalizedObj;
+ var i = 0;
+ var end = start + length - 1;
+ for (var key in thisSet) {
+ if (thisSet.hasOwnProperty(key)) {
+ if (i >= start) {
+ if (i > end) {
+ break;
+ }
+ var item = thisSet[key];
+ cb.call(context, item, key.substr(PREFIX.length), i);
+ }
+ i++;
+ }
+ }
+ },
+
+ /**
+ * Even though `mapRange`/`forEachKeyRange` allow zero length mappings, we'll
+ * impose an additional restriction here that the length of mapping be greater
+ * than zero - the only reason is that there are many ways to express length
+ * zero in terms of two keys and that is confusing.
+ */
+ mapKeyRange: function (cb, startKey, endKey, context) {
+ var startIndex = this.indexOfKey(startKey);
+ var endIndex = this.indexOfKey(endKey);
+ !(startIndex !== undefined && endIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mapKeyRange must be given keys that are present.') : invariant(false) : undefined;
+ !(endIndex >= startIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.mapKeyRange(...): `endKey` must not come before `startIndex`.') : invariant(false) : undefined;
+ return this.mapRange(cb, startIndex, endIndex - startIndex + 1, context);
+ },
+
+ forEachKeyRange: function (cb, startKey, endKey, context) {
+ var startIndex = this.indexOfKey(startKey);
+ var endIndex = this.indexOfKey(endKey);
+ !(startIndex !== undefined && endIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'forEachKeyRange must be given keys that are present.') : invariant(false) : undefined;
+ !(endIndex >= startIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.forEachKeyRange(...): `endKey` must not come before ' + '`startIndex`.') : invariant(false) : undefined;
+ this.forEachRange(cb, startIndex, endIndex - startIndex + 1, context);
+ },
+
+ /**
+ * @param {number} pos Index to search for key at.
+ * @return {string|undefined} Either the key at index `pos` or undefined if
+ * not in map.
+ */
+ keyAtIndex: function (pos) {
+ var computedPositions = this._getOrComputePositions();
+ var keyAtPos = computedPositions.keyByIndex[pos];
+ return keyAtPos ? keyAtPos.substr(PREFIX.length) : undefined;
+ },
+
+ /**
+ * @param {string} key String key from which to find the next key.
+ * @return {string|undefined} Either the next key, or undefined if there is no
+ * next key.
+ * @throws Error if `key` is not in this `OrderedMap`.
+ */
+ keyAfter: function (key) {
+ return this.nthKeyAfter(key, 1);
+ },
+
+ /**
+ * @param {string} key String key from which to find the preceding key.
+ * @return {string|undefined} Either the preceding key, or undefined if there
+ * is no preceding.key.
+ * @throws Error if `key` is not in this `OrderedMap`.
+ */
+ keyBefore: function (key) {
+ return this.nthKeyBefore(key, 1);
+ },
+
+ /**
+ * @param {string} key String key from which to find a following key.
+ * @param {number} n Distance to scan forward after `key`.
+ * @return {string|undefined} Either the nth key after `key`, or undefined if
+ * there is no next key.
+ * @throws Error if `key` is not in this `OrderedMap`.
+ */
+ nthKeyAfter: function (key, n) {
+ var curIndex = this.indexOfKey(key);
+ !(curIndex !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.nthKeyAfter: The key `%s` does not exist in this instance.', key) : invariant(false) : undefined;
+ return this.keyAtIndex(curIndex + n);
+ },
+
+ /**
+ * @param {string} key String key from which to find a preceding key.
+ * @param {number} n Distance to scan backwards before `key`.
+ * @return {string|undefined} Either the nth key before `key`, or undefined if
+ * there is no previous key.
+ * @throws Error if `key` is not in this `OrderedMap`.
+ */
+ nthKeyBefore: function (key, n) {
+ return this.nthKeyAfter(key, -n);
+ },
+
+ /**
+ * @param {string} key Key to find the index of.
+ * @return {number|undefined} Index of the provided key, or `undefined` if the
+ * key is not found.
+ */
+ indexOfKey: function (key) {
+ assertValidPublicKey(key);
+ var normalizedKey = PREFIX + key;
+ var computedPositions = this._getOrComputePositions();
+ var computedPosition = computedPositions.indexByKey[normalizedKey];
+ // Just writing it this way to make it clear this is intentional.
+ return computedPosition === undefined ? undefined : computedPosition;
+ },
+
+ /**
+ * @return {Array} An ordered array of this object's values.
+ */
+ toArray: function () {
+ var result = [];
+ var thisSet = this._normalizedObj;
+ for (var key in thisSet) {
+ if (thisSet.hasOwnProperty(key)) {
+ result.push(thisSet[key]);
+ }
+ }
+ return result;
+ },
+
+ /**
+ * Finds the key at a given position, or indicates via `undefined` that that
+ * position does not exist in the `OrderedMap`. It is appropriate to return
+ * undefined, indicating that the key doesn't exist in the `OrderedMap`
+ * because `undefined` is not ever a valid `OrderedMap` key.
+ *
+ * @private
+ * @return {string?} Name of the item at position `pos`, or `undefined` if
+ * there is no item at that position.
+ */
+ _getOrComputePositions: function () {
+ // TODO: Entertain computing this at construction time in some less
+ // performance critical paths.
+ var computedPositions = this._computedPositions;
+ if (!computedPositions) {
+ this._computePositions();
+ }
+ return this._computedPositions;
+ },
+
+ /**
+ * Precomputes the index/key mapping for future lookup. Since `OrderedMap`s
+ * are immutable, there is only ever a need to perform this once.
+ * @private
+ */
+ _computePositions: function () {
+ this._computedPositions = {
+ keyByIndex: {},
+ indexByKey: {}
+ };
+ var keyByIndex = this._computedPositions.keyByIndex;
+ var indexByKey = this._computedPositions.indexByKey;
+ var index = 0;
+ var thisSet = this._normalizedObj;
+ for (var key in thisSet) {
+ if (thisSet.hasOwnProperty(key)) {
+ keyByIndex[index] = key;
+ indexByKey[key] = index;
+ index++;
+ }
+ }
+ }
+};
+
+assign(OrderedMapImpl.prototype, OrderedMapMethods);
+
+var OrderedMap = {
+ from: function (orderedMap) {
+ !(orderedMap instanceof OrderedMapImpl) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.from(...): Expected an OrderedMap instance.') : invariant(false) : undefined;
+ return _fromNormalizedObjects(orderedMap._normalizedObj, null);
+ },
+
+ fromArray: function (arr, keyExtractor) {
+ !Array.isArray(arr) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.fromArray(...): First argument must be an array.') : invariant(false) : undefined;
+ !(typeof keyExtractor === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'OrderedMap.fromArray(...): Second argument must be a function used ' + 'to determine the unique key for each entry.') : invariant(false) : undefined;
+ return new OrderedMapImpl(extractObjectFromArray(arr, keyExtractor), arr.length);
+ }
+};
+
+module.exports = OrderedMap;
\ No newline at end of file

lib/performance.js

@@ -1,26 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule performance
- * @typechecks
- */
-
-"use strict";
-
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-
-var performance;
-
-if (ExecutionEnvironment.canUseDOM) {
- performance =
- window.performance ||
- window.msPerformance ||
- window.webkitPerformance;
-}
-
-module.exports = performance || {};

lib/performanceNow.js

@@ -1,26 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule performanceNow
- * @typechecks
- */
-
-var performance = require("./performance");
-
-/**
- * Detect if we can use `window.performance.now()` and gracefully fallback to
- * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
- * because of Facebook's testing infrastructure.
- */
-if (!performance || !performance.now) {
- performance = Date;
-}
-
-var performanceNow = performance.now.bind(performance);
-
-module.exports = performanceNow;

lib/PooledClass.js

@@ -11,7 +11,7 @@
'use strict';
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
/**
* Static poolers. Several custom versions for each potential number of
@@ -20,7 +20,7 @@
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
-var oneArgumentPooler = function(copyFieldsFrom) {
+var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -31,7 +31,7 @@
}
};
-var twoArgumentPooler = function(a1, a2) {
+var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -42,7 +42,7 @@
}
};
-var threeArgumentPooler = function(a1, a2, a3) {
+var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -53,7 +53,18 @@
}
};
-var fiveArgumentPooler = function(a1, a2, a3, a4, a5) {
+var fourArgumentPooler = function (a1, a2, a3, a4) {
+ var Klass = this;
+ if (Klass.instancePool.length) {
+ var instance = Klass.instancePool.pop();
+ Klass.call(instance, a1, a2, a3, a4);
+ return instance;
+ } else {
+ return new Klass(a1, a2, a3, a4);
+ }
+};
+
+var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
@@ -64,15 +75,10 @@
}
};
-var standardReleaser = function(instance) {
+var standardReleaser = function (instance) {
var Klass = this;
- ("production" !== process.env.NODE_ENV ? invariant(
- instance instanceof Klass,
- 'Trying to release an instance into a pool of a different type.'
- ) : invariant(instance instanceof Klass));
- if (instance.destructor) {
+ !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
instance.destructor();
- }
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
@@ -90,7 +96,7 @@
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
-var addPoolingTo = function(CopyConstructor, pooler) {
+var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
@@ -106,6 +112,7 @@
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
+ fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};

lib/quoteAttributeValueForBrowser.js

@@ -11,7 +11,7 @@
'use strict';
-var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
+var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
/**
* Escapes attribute value to prevent scripting attacks.

lib/ReactBrowserComponentMixin.js

@@ -11,7 +11,12 @@
'use strict';
-var findDOMNode = require("./findDOMNode");
+var ReactInstanceMap = require('./ReactInstanceMap');
+
+var findDOMNode = require('./findDOMNode');
+var warning = require('fbjs/lib/warning');
+
+var didWarnKey = '_getDOMNodeDidWarn';
var ReactBrowserComponentMixin = {
/**
@@ -21,7 +26,9 @@
* @final
* @protected
*/
- getDOMNode: function() {
+ getDOMNode: function () {
+ process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
+ this.constructor[didWarnKey] = true;
return findDOMNode(this);
}
};

lib/ReactBrowserEventEmitter.js

@@ -12,14 +12,15 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPluginHub = require("./EventPluginHub");
-var EventPluginRegistry = require("./EventPluginRegistry");
-var ReactEventEmitterMixin = require("./ReactEventEmitterMixin");
-var ViewportMetrics = require("./ViewportMetrics");
+var EventConstants = require('./EventConstants');
+var EventPluginHub = require('./EventPluginHub');
+var EventPluginRegistry = require('./EventPluginRegistry');
+var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
+var ReactPerf = require('./ReactPerf');
+var ViewportMetrics = require('./ViewportMetrics');
-var assign = require("./Object.assign");
-var isEventSupported = require("./isEventSupported");
+var assign = require('./Object.assign');
+var isEventSupported = require('./isEventSupported');
/**
* Summary of `ReactBrowserEventEmitter` event handling:
@@ -84,7 +85,10 @@
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
+ topAbort: 'abort',
topBlur: 'blur',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
@@ -102,24 +106,44 @@
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
topScroll: 'scroll',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
topTextInput: 'textInput',
+ topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting',
topWheel: 'wheel'
};
@@ -159,10 +183,8 @@
/**
* @param {object} ReactEventListener
*/
- injectReactEventListener: function(ReactEventListener) {
- ReactEventListener.setHandleTopLevel(
- ReactBrowserEventEmitter.handleTopLevel
- );
+ injectReactEventListener: function (ReactEventListener) {
+ ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
@@ -172,7 +194,7 @@
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
@@ -181,10 +203,8 @@
/**
* @return {boolean} True if callbacks are enabled.
*/
- isEnabled: function() {
- return !!(
- (ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled())
- );
+ isEnabled: function () {
+ return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
@@ -208,93 +228,49 @@
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
- listenTo: function(registrationName, contentDocumentHandle) {
+ listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
- var dependencies = EventPluginRegistry.
- registrationNameDependencies[registrationName];
+ var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
- for (var i = 0, l = dependencies.length; i < l; i++) {
+ for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
- if (!(
- (isListening.hasOwnProperty(dependency) && isListening[dependency])
- )) {
+ if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'wheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'mousewheel',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topWheel,
- 'DOMMouseScroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topScroll,
- 'scroll',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topScroll,
- 'scroll',
- ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
- } else if (dependency === topLevelTypes.topFocus ||
- dependency === topLevelTypes.topBlur) {
+ } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topFocus,
- 'focus',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelTypes.topBlur,
- 'blur',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topFocus,
- 'focusin',
- mountAt
- );
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelTypes.topBlur,
- 'focusout',
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- dependency,
- topEventMapping[dependency],
- mountAt
- );
+ ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
@@ -302,20 +278,12 @@
}
},
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
- return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(
- topLevelType,
- handlerBaseName,
- handle
- );
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
+ return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
@@ -326,7 +294,7 @@
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
- ensureScrollValueMonitoring: function() {
+ ensureScrollValueMonitoring: function () {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
@@ -348,4 +316,9 @@
});
+ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
+ putListener: 'putListener',
+ deleteListener: 'deleteListener'
+});
+
module.exports = ReactBrowserEventEmitter;

lib/ReactChildReconciler.js

@@ -12,11 +12,23 @@
'use strict';
-var ReactReconciler = require("./ReactReconciler");
+var ReactReconciler = require('./ReactReconciler');
-var flattenChildren = require("./flattenChildren");
-var instantiateReactComponent = require("./instantiateReactComponent");
-var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
+var instantiateReactComponent = require('./instantiateReactComponent');
+var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
+var traverseAllChildren = require('./traverseAllChildren');
+var warning = require('fbjs/lib/warning');
+
+function instantiateChild(childInstances, child, name) {
+ // We found a component instance.
+ var keyUnique = childInstances[name] === undefined;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
+ }
+ if (child != null && keyUnique) {
+ childInstances[name] = instantiateReactComponent(child, null);
+ }
+}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
@@ -33,41 +44,31 @@
* @return {?object} A set of child instances.
* @internal
*/
- instantiateChildren: function(nestedChildNodes, transaction, context) {
- var children = flattenChildren(nestedChildNodes);
- for (var name in children) {
- if (children.hasOwnProperty(name)) {
- var child = children[name];
- // The rendered children must be turned into instances as they're
- // mounted.
- var childInstance = instantiateReactComponent(child, null);
- children[name] = childInstance;
- }
+ instantiateChildren: function (nestedChildNodes, transaction, context) {
+ if (nestedChildNodes == null) {
+ return null;
}
- return children;
+ var childInstances = {};
+ traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
+ return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
- * @param {?object} nextNestedChildNodes Nested child maps.
+ * @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
- updateChildren: function(
- prevChildren,
- nextNestedChildNodes,
- transaction,
- context) {
+ updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
- var nextChildren = flattenChildren(nextNestedChildNodes);
if (!nextChildren && !prevChildren) {
return null;
}
@@ -79,27 +80,21 @@
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
- if (shouldUpdateReactComponent(prevElement, nextElement)) {
- ReactReconciler.receiveComponent(
- prevChild, nextElement, transaction, context
- );
+ if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
+ ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
- var nextChildInstance = instantiateReactComponent(
- nextElement,
- null
- );
+ var nextChildInstance = instantiateReactComponent(nextElement, null);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
@@ -113,12 +108,14 @@
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
- unmountChildren: function(renderedChildren) {
+ unmountChildren: function (renderedChildren) {
for (var name in renderedChildren) {
+ if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
+ }
};

lib/ReactChildren.js

@@ -11,14 +11,19 @@
'use strict';
-var PooledClass = require("./PooledClass");
-var ReactFragment = require("./ReactFragment");
+var PooledClass = require('./PooledClass');
+var ReactElement = require('./ReactElement');
-var traverseAllChildren = require("./traverseAllChildren");
-var warning = require("./warning");
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var traverseAllChildren = require('./traverseAllChildren');
var twoArgumentPooler = PooledClass.twoArgumentPooler;
-var threeArgumentPooler = PooledClass.threeArgumentPooler;
+var fourArgumentPooler = PooledClass.fourArgumentPooler;
+
+var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
+function escapeUserProvidedKey(text) {
+ return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
+}
/**
* PooledClass representing the bookkeeping associated with performing a child
@@ -29,15 +34,22 @@
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
- this.forEachFunction = forEachFunction;
- this.forEachContext = forEachContext;
-}
+ this.func = forEachFunction;
+ this.context = forEachContext;
+ this.count = 0;
+}
+ForEachBookKeeping.prototype.destructor = function () {
+ this.func = null;
+ this.context = null;
+ this.count = 0;
+};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
-function forEachSingleChild(traverseContext, child, name, i) {
- var forEachBookKeeping = traverseContext;
- forEachBookKeeping.forEachFunction.call(
- forEachBookKeeping.forEachContext, child, i);
+function forEachSingleChild(bookKeeping, child, name) {
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ func.call(context, child, bookKeeping.count++);
}
/**
@@ -47,16 +59,14 @@
* leaf child.
*
* @param {?*} children Children tree container.
- * @param {function(*, int)} forEachFunc.
+ * @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
-
- var traverseContext =
- ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
+ var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
@@ -70,33 +80,50 @@
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
-function MapBookKeeping(mapResult, mapFunction, mapContext) {
- this.mapResult = mapResult;
- this.mapFunction = mapFunction;
- this.mapContext = mapContext;
-}
-PooledClass.addPoolingTo(MapBookKeeping, threeArgumentPooler);
-
-function mapSingleChildIntoContext(traverseContext, child, name, i) {
- var mapBookKeeping = traverseContext;
- var mapResult = mapBookKeeping.mapResult;
-
- var keyUnique = !mapResult.hasOwnProperty(name);
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- keyUnique,
- 'ReactChildren.map(...): Encountered two children with the same key, ' +
- '`%s`. Child keys must be unique; when two children share a key, only ' +
- 'the first child will be used.',
- name
- ) : null);
+function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
+ this.result = mapResult;
+ this.keyPrefix = keyPrefix;
+ this.func = mapFunction;
+ this.context = mapContext;
+ this.count = 0;
+}
+MapBookKeeping.prototype.destructor = function () {
+ this.result = null;
+ this.keyPrefix = null;
+ this.func = null;
+ this.context = null;
+ this.count = 0;
+};
+PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
+
+function mapSingleChildIntoContext(bookKeeping, child, childKey) {
+ var result = bookKeeping.result;
+ var keyPrefix = bookKeeping.keyPrefix;
+ var func = bookKeeping.func;
+ var context = bookKeeping.context;
+
+ var mappedChild = func.call(context, child, bookKeeping.count++);
+ if (Array.isArray(mappedChild)) {
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
+ } else if (mappedChild != null) {
+ if (ReactElement.isValidElement(mappedChild)) {
+ mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
+ // Keep both the (mapped) and old keys if they differ, just as
+ // traverseAllChildren used to do for objects as children
+ keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
}
+ result.push(mappedChild);
+ }
+}
- if (keyUnique) {
- var mappedChild =
- mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i);
- mapResult[name] = mappedChild;
+function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
+ var escapedPrefix = '';
+ if (prefix != null) {
+ escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
+ var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
+ traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
+ MapBookKeeping.release(traverseContext);
}
/**
@@ -105,27 +132,21 @@
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
- * TODO: This may likely break any calls to `ReactChildren.map` that were
- * previously relying on the fact that we guarded against null children.
- *
* @param {?*} children Children tree container.
- * @param {function(*, int)} mapFunction.
- * @param {*} mapContext Context for mapFunction.
+ * @param {function(*, int)} func The map function.
+ * @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
-
- var mapResult = {};
- var traverseContext = MapBookKeeping.getPooled(mapResult, func, context);
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
- MapBookKeeping.release(traverseContext);
- return ReactFragment.create(mapResult);
+ var result = [];
+ mapIntoWithKeyPrefixInternal(children, result, null, func, context);
+ return result;
}
-function forEachSingleChildDummy(traverseContext, child, name, i) {
+function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
@@ -140,10 +161,22 @@
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
+/**
+ * Flatten a children object (typically specified as `props.children`) and
+ * return an array with appropriately re-keyed children.
+ */
+function toArray(children) {
+ var result = [];
+ mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
+ return result;
+}
+
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
- count: countChildren
+ mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
+ count: countChildren,
+ toArray: toArray
};
module.exports = ReactChildren;

lib/ReactClass.js

@@ -11,23 +11,20 @@
'use strict';
-var ReactComponent = require("./ReactComponent");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactElement = require("./ReactElement");
-var ReactErrorUtils = require("./ReactErrorUtils");
-var ReactInstanceMap = require("./ReactInstanceMap");
-var ReactLifeCycle = require("./ReactLifeCycle");
-var ReactPropTypeLocations = require("./ReactPropTypeLocations");
-var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
-var ReactUpdateQueue = require("./ReactUpdateQueue");
-
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
-var keyMirror = require("./keyMirror");
-var keyOf = require("./keyOf");
-var warning = require("./warning");
+var ReactComponent = require('./ReactComponent');
+var ReactElement = require('./ReactElement');
+var ReactPropTypeLocations = require('./ReactPropTypeLocations');
+var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
+var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
+
+var assign = require('./Object.assign');
+var emptyObject = require('fbjs/lib/emptyObject');
+var invariant = require('fbjs/lib/invariant');
+var keyMirror = require('fbjs/lib/keyMirror');
+var keyOf = require('fbjs/lib/keyOf');
+var warning = require('fbjs/lib/warning');
-var MIXINS_KEY = keyOf({mixins: null});
+var MIXINS_KEY = keyOf({ mixins: null });
/**
* Policies that describe methods in `ReactClassInterface`.
@@ -54,9 +51,16 @@
DEFINE_MANY_MERGED: null
});
-
var injectedMixins = [];
+var warnedSetProps = false;
+function warnSetProps() {
+ if (!warnedSetProps) {
+ warnedSetProps = true;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
+ }
+}
+
/**
* Composite components are higher-level components that compose other composite
* or native components.
@@ -74,7 +78,7 @@
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
- * class specification will available on the prototype.
+ * class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
@@ -316,121 +316,72 @@
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
- displayName: function(Constructor, displayName) {
+ displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
- mixins: function(Constructor, mixins) {
+ mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
- childContextTypes: function(Constructor, childContextTypes) {
- if ("production" !== process.env.NODE_ENV) {
- validateTypeDef(
- Constructor,
- childContextTypes,
- ReactPropTypeLocations.childContext
- );
- }
- Constructor.childContextTypes = assign(
- {},
- Constructor.childContextTypes,
- childContextTypes
- );
- },
- contextTypes: function(Constructor, contextTypes) {
- if ("production" !== process.env.NODE_ENV) {
- validateTypeDef(
- Constructor,
- contextTypes,
- ReactPropTypeLocations.context
- );
- }
- Constructor.contextTypes = assign(
- {},
- Constructor.contextTypes,
- contextTypes
- );
+ childContextTypes: function (Constructor, childContextTypes) {
+ if (process.env.NODE_ENV !== 'production') {
+ validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
+ }
+ Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
+ },
+ contextTypes: function (Constructor, contextTypes) {
+ if (process.env.NODE_ENV !== 'production') {
+ validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
+ }
+ Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
- getDefaultProps: function(Constructor, getDefaultProps) {
+ getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
- Constructor.getDefaultProps = createMergedResultFunction(
- Constructor.getDefaultProps,
- getDefaultProps
- );
+ Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
- propTypes: function(Constructor, propTypes) {
- if ("production" !== process.env.NODE_ENV) {
- validateTypeDef(
- Constructor,
- propTypes,
- ReactPropTypeLocations.prop
- );
- }
- Constructor.propTypes = assign(
- {},
- Constructor.propTypes,
- propTypes
- );
+ propTypes: function (Constructor, propTypes) {
+ if (process.env.NODE_ENV !== 'production') {
+ validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
+ }
+ Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
},
- statics: function(Constructor, statics) {
+ statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
- }
-};
+ },
+ autobind: function () {} };
+// noop
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but not in __DEV__
- ("production" !== process.env.NODE_ENV ? warning(
- typeof typeDef[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- Constructor.displayName || 'ReactClass',
- ReactPropTypeLocationNames[location],
- propName
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
}
}
}
function validateMethodOverride(proto, name) {
- var specPolicy = ReactClassInterface.hasOwnProperty(name) ?
- ReactClassInterface[name] :
- null;
+ var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
- ("production" !== process.env.NODE_ENV ? invariant(
- specPolicy === SpecPolicy.OVERRIDE_BASE,
- 'ReactClassInterface: You are attempting to override ' +
- '`%s` from your class specification. Ensure that your method names ' +
- 'do not overlap with React methods.',
- name
- ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
+ !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
- ("production" !== process.env.NODE_ENV ? invariant(
- specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
- 'ReactClassInterface: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be due ' +
- 'to a mixin.',
- name
- ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
- specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
+ !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
}
}
@@ -443,16 +394,8 @@
return;
}
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof spec !== 'function',
- 'ReactClass: You\'re attempting to ' +
- 'use a component class as a mixin. Instead, just use a regular object.'
- ) : invariant(typeof spec !== 'function'));
- ("production" !== process.env.NODE_ENV ? invariant(
- !ReactElement.isValidElement(spec),
- 'ReactClass: You\'re attempting to ' +
- 'use a component as a mixin. Instead, just use a regular object.'
- ) : invariant(!ReactElement.isValidElement(spec)));
+ !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
+ !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
var proto = Constructor.prototype;
@@ -469,7 +412,7 @@
}
if (name === MIXINS_KEY) {
- // We have already handled mixins in a special case above
+ // We have already handled mixins in a special case above.
continue;
}
@@ -483,16 +426,10 @@
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
- var isReactClassMethod =
- ReactClassInterface.hasOwnProperty(name);
+ var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
- var markedDontBind = property && property.__reactDontBind;
var isFunction = typeof property === 'function';
- var shouldAutoBind =
- isFunction &&
- !isReactClassMethod &&
- !isAlreadyDefined &&
- !markedDontBind;
+ var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
@@ -504,18 +441,8 @@
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
- // These cases should already be caught by validateMethodOverride
- ("production" !== process.env.NODE_ENV ? invariant(
- isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- ),
- 'ReactClass: Unexpected spec policy %s for key %s ' +
- 'when mixing in component specs.',
- specPolicy,
- name
- ) : invariant(isReactClassMethod && (
- (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)
- )));
+ // These cases should already be caught by validateMethodOverride.
+ !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
@@ -526,7 +453,7 @@
}
} else {
proto[name] = property;
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
@@ -549,24 +476,11 @@
continue;
}
- var isReserved = name in RESERVED_SPEC_KEYS;
- ("production" !== process.env.NODE_ENV ? invariant(
- !isReserved,
- 'ReactClass: You are attempting to define a reserved ' +
- 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' +
- 'as an instance property instead; it will still be accessible on the ' +
- 'constructor.',
- name
- ) : invariant(!isReserved));
-
- var isInherited = name in Constructor;
- ("production" !== process.env.NODE_ENV ? invariant(
- !isInherited,
- 'ReactClass: You are attempting to define ' +
- '`%s` on your component more than once. This conflict may be ' +
- 'due to a mixin.',
- name
- ) : invariant(!isInherited));
+ var isReserved = (name in RESERVED_SPEC_KEYS);
+ !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
+
+ var isInherited = (name in Constructor);
+ !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
Constructor[name] = property;
}
}
@@ -579,22 +493,11 @@
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
- ("production" !== process.env.NODE_ENV ? invariant(
- one && two && typeof one === 'object' && typeof two === 'object',
- 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'
- ) : invariant(one && two && typeof one === 'object' && typeof two === 'object'));
+ !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
for (var key in two) {
if (two.hasOwnProperty(key)) {
- ("production" !== process.env.NODE_ENV ? invariant(
- one[key] === undefined,
- 'mergeIntoWithNoDuplicateKeys(): ' +
- 'Tried to merge two objects with the same key: `%s`. This conflict ' +
- 'may be due to a mixin; in particular, this may be caused by two ' +
- 'getInitialState() or getDefaultProps() methods returning objects ' +
- 'with clashing keys.',
- key
- ) : invariant(one[key] === undefined));
+ !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
one[key] = two[key];
}
}
@@ -649,32 +552,25 @@
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
- boundMethod.bind = function(newThis ) {for (var args=[],$__0=1,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ boundMethod.bind = function (newThis) {
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ args[_key - 1] = arguments[_key];
+ }
+
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'bind(): React component methods may only be bound to the ' +
- 'component instance. See %s',
- componentName
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
} else if (!args.length) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'bind(): You are binding a component method to the component. ' +
- 'React does this for you automatically in a high-performance ' +
- 'way, so you can safely remove this call. See %s',
- componentName
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
@@ -697,34 +593,11 @@
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
- component[autoBindKey] = bindAutoBindMethod(
- component,
- ReactErrorUtils.guard(
- method,
- component.constructor.displayName + '.' + autoBindKey
- )
- );
+ component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
}
-var typeDeprecationDescriptor = {
- enumerable: false,
- get: function() {
- var displayName = this.displayName || this.name || 'Component';
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- '%s.type is deprecated. Use %s directly to access the class.',
- displayName,
- displayName
- ) : null);
- Object.defineProperty(this, 'type', {
- value: this
- });
- return this;
- }
-};
-
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
@@ -735,10 +608,10 @@
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
- replaceState: function(newState, callback) {
- ReactUpdateQueue.enqueueReplaceState(this, newState);
+ replaceState: function (newState, callback) {
+ this.updater.enqueueReplaceState(this, newState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -748,27 +621,8 @@
* @protected
* @final
*/
- isMounted: function() {
- if ("production" !== process.env.NODE_ENV) {
- var owner = ReactCurrentOwner.current;
- if (owner !== null) {
- ("production" !== process.env.NODE_ENV ? warning(
- owner._warnedAboutRefsInRender,
- '%s is accessing isMounted inside its render() function. ' +
- 'render() should be a pure function of props and state. It should ' +
- 'never access something that requires stale data from the previous ' +
- 'render, such as refs. Move this logic to componentDidMount and ' +
- 'componentDidUpdate instead.',
- owner.getName() || 'A component'
- ) : null);
- owner._warnedAboutRefsInRender = true;
- }
- }
- var internalInstance = ReactInstanceMap.get(this);
- return (
- internalInstance &&
- internalInstance !== ReactLifeCycle.currentlyMountingInstance
- );
+ isMounted: function () {
+ return this.updater.isMounted(this);
},
/**
@@ -780,10 +634,13 @@
* @public
* @deprecated
*/
- setProps: function(partialProps, callback) {
- ReactUpdateQueue.enqueueSetProps(this, partialProps);
+ setProps: function (partialProps, callback) {
+ if (process.env.NODE_ENV !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueSetProps(this, partialProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
},
@@ -796,20 +653,19 @@
* @public
* @deprecated
*/
- replaceProps: function(newProps, callback) {
- ReactUpdateQueue.enqueueReplaceProps(this, newProps);
+ replaceProps: function (newProps, callback) {
+ if (process.env.NODE_ENV !== 'production') {
+ warnSetProps();
+ }
+ this.updater.enqueueReplaceProps(this, newProps);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
}
};
-var ReactClassComponent = function() {};
-assign(
- ReactClassComponent.prototype,
- ReactComponent.prototype,
- ReactClassMixin
-);
+var ReactClassComponent = function () {};
+assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
@@ -825,17 +681,13 @@
* @return {function} Component constructor function.
* @public
*/
- createClass: function(spec) {
- var Constructor = function(props, context) {
+ createClass: function (spec) {
+ var Constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- this instanceof Constructor,
- 'Something is calling a React component directly. Use a factory or ' +
- 'JSX instead. See: https://fb.me/react-legacyfactory'
- ) : null);
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
@@ -845,44 +697,40 @@
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ this.updater = updater || ReactNoopUpdateQueue;
+
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof initialState === 'undefined' &&
- this.getInitialState._isMockFunction) {
+ if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.getInitialState(): must return an object or null',
- Constructor.displayName || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
- injectedMixins.forEach(
- mixSpecIntoComponent.bind(null, Constructor)
- );
+ injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
- // Initialize the defaultProps property after all mixins have been merged
+ // Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
@@ -895,20 +743,11 @@
}
}
- ("production" !== process.env.NODE_ENV ? invariant(
- Constructor.prototype.render,
- 'createClass(...): Class specification must implement a `render` method.'
- ) : invariant(Constructor.prototype.render));
-
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- !Constructor.prototype.componentShouldUpdate,
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- spec.displayName || 'A component'
- ) : null);
+ !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
+
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
}
// Reduce time spent doing lookups by setting these on the prototype.
@@ -918,21 +757,11 @@
}
}
- // Legacy hook
- Constructor.type = Constructor;
- if ("production" !== process.env.NODE_ENV) {
- try {
- Object.defineProperty(Constructor, 'type', typeDeprecationDescriptor);
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
- }
- }
-
return Constructor;
},
injection: {
- injectMixin: function(mixin) {
+ injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}

lib/ReactComponentBrowserEnvironment.js

@@ -9,12 +9,10 @@
* @providesModule ReactComponentBrowserEnvironment
*/
-/*jslint evil: true */
-
'use strict';
-var ReactDOMIDOperations = require("./ReactDOMIDOperations");
-var ReactMount = require("./ReactMount");
+var ReactDOMIDOperations = require('./ReactDOMIDOperations');
+var ReactMount = require('./ReactMount');
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
@@ -23,11 +21,9 @@
*/
var ReactComponentBrowserEnvironment = {
- processChildrenUpdates:
- ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
+ processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
- replaceNodeWithMarkupByID:
- ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
+ replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
@@ -36,7 +32,7 @@
*
* @private
*/
- unmountIDFromEnvironment: function(rootNodeID) {
+ unmountIDFromEnvironment: function (rootNodeID) {
ReactMount.purgeID(rootNodeID);
}

lib/ReactComponentEnvironment.js

@@ -11,7 +11,7 @@
'use strict';
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
var injected = false;
@@ -37,17 +37,11 @@
processChildrenUpdates: null,
injection: {
- injectEnvironment: function(environment) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !injected,
- 'ReactCompositeComponent: injectEnvironment() can only be called once.'
- ) : invariant(!injected));
- ReactComponentEnvironment.unmountIDFromEnvironment =
- environment.unmountIDFromEnvironment;
- ReactComponentEnvironment.replaceNodeWithMarkupByID =
- environment.replaceNodeWithMarkupByID;
- ReactComponentEnvironment.processChildrenUpdates =
- environment.processChildrenUpdates;
+ injectEnvironment: function (environment) {
+ !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
+ ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
+ ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
+ ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}

lib/reactComponentExpect.js

@@ -0,0 +1,216 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule reactComponentExpect
+ * @nolint
+ */
+
+'use strict';
+
+var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactTestUtils = require('./ReactTestUtils');
+
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
+
+function reactComponentExpect(instance) {
+ if (instance instanceof reactComponentExpectInternal) {
+ return instance;
+ }
+
+ if (!(this instanceof reactComponentExpect)) {
+ return new reactComponentExpect(instance);
+ }
+
+ expect(instance).not.toBeNull();
+ expect(instance).not.toBeUndefined();
+
+ !ReactTestUtils.isCompositeComponent(instance) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'reactComponentExpect(...): instance must be a composite component') : invariant(false) : undefined;
+ var internalInstance = ReactInstanceMap.get(instance);
+
+ expect(typeof internalInstance).toBe('object');
+ expect(typeof internalInstance.constructor).toBe('function');
+ expect(ReactTestUtils.isElement(internalInstance)).toBe(false);
+
+ return new reactComponentExpectInternal(internalInstance);
+}
+
+function reactComponentExpectInternal(internalInstance) {
+ this._instance = internalInstance;
+}
+
+assign(reactComponentExpectInternal.prototype, {
+ // Getters -------------------------------------------------------------------
+
+ /**
+ * @instance: Retrieves the backing instance.
+ */
+ instance: function () {
+ return this._instance.getPublicInstance();
+ },
+
+ /**
+ * There are two types of components in the world.
+ * - A component created via React.createClass() - Has a single child
+ * subComponent - the return value from the .render() function. This
+ * function @subComponent expects that this._instance is component created
+ * with React.createClass().
+ * - A primitive DOM component - which has many renderedChildren, each of
+ * which may have a name that is unique with respect to its siblings. This
+ * method will fail if this._instance is a primitive component.
+ *
+ * TL;DR: An instance may have a subComponent (this._renderedComponent) or
+ * renderedChildren, but never both. Neither will actually show up until you
+ * render the component (simply instantiating is not enough).
+ */
+ expectRenderedChild: function () {
+ this.toBeCompositeComponent();
+ var child = this._instance._renderedComponent;
+ // TODO: Hide ReactEmptyComponent instances here?
+ return new reactComponentExpectInternal(child);
+ },
+
+ /**
+ * The nth child of a DOMish component instance that is not falsy.
+ */
+ expectRenderedChildAt: function (childIndex) {
+ // Currently only dom components have arrays of children, but that will
+ // change soon.
+ this.toBeDOMComponent();
+ var renderedChildren = this._instance._renderedChildren || {};
+ for (var name in renderedChildren) {
+ if (!renderedChildren.hasOwnProperty(name)) {
+ continue;
+ }
+ if (renderedChildren[name]) {
+ if (renderedChildren[name]._mountIndex === childIndex) {
+ return new reactComponentExpectInternal(renderedChildren[name]);
+ }
+ }
+ }
+ throw new Error('Child:' + childIndex + ' is not found');
+ },
+
+ toBeDOMComponentWithChildCount: function (count) {
+ this.toBeDOMComponent();
+ var renderedChildren = this._instance._renderedChildren;
+ expect(renderedChildren).toBeTruthy();
+ expect(Object.keys(renderedChildren).length).toBe(count);
+ return this;
+ },
+
+ toBeDOMComponentWithNoChildren: function () {
+ this.toBeDOMComponent();
+ expect(this._instance._renderedChildren).toBeFalsy();
+ return this;
+ },
+
+ // Matchers ------------------------------------------------------------------
+
+ toBeComponentOfType: function (constructor) {
+ expect(this._instance._currentElement.type === constructor).toBe(true);
+ return this;
+ },
+
+ /**
+ * A component that is created with React.createClass. Just duck typing
+ * here.
+ */
+ toBeCompositeComponent: function () {
+ expect(typeof this.instance() === 'object' && typeof this.instance().render === 'function').toBe(true);
+ return this;
+ },
+
+ toBeCompositeComponentWithType: function (constructor) {
+ this.toBeCompositeComponent();
+ expect(this._instance._currentElement.type === constructor).toBe(true);
+ return this;
+ },
+
+ toBeTextComponentWithValue: function (val) {
+ var elementType = typeof this._instance._currentElement;
+ expect(elementType === 'string' || elementType === 'number').toBe(true);
+ expect(this._instance._stringText).toBe(val);
+ return this;
+ },
+
+ toBeEmptyComponent: function () {
+ var element = this._instance._currentElement;
+ return element === null || element === false;
+ },
+
+ toBePresent: function () {
+ expect(this.instance()).toBeTruthy();
+ return this;
+ },
+
+ /**
+ * A terminal type of component representing some virtual dom node. Just duck
+ * typing here.
+ */
+ toBeDOMComponent: function () {
+ expect(ReactTestUtils.isDOMComponent(this.instance())).toBe(true);
+ return this;
+ },
+
+ /**
+ * @deprecated
+ * @see toBeComponentOfType
+ */
+ toBeDOMComponentWithTag: function (tag) {
+ this.toBeDOMComponent();
+ expect(this.instance().tagName).toBe(tag.toUpperCase());
+ return this;
+ },
+
+ /**
+ * Check that internal state values are equal to a state of expected values.
+ */
+ scalarStateEqual: function (stateNameToExpectedValue) {
+ expect(this.instance()).toBeTruthy();
+ for (var stateName in stateNameToExpectedValue) {
+ if (!stateNameToExpectedValue.hasOwnProperty(stateName)) {
+ continue;
+ }
+ expect(this.instance().state[stateName]).toEqual(stateNameToExpectedValue[stateName]);
+ }
+ return this;
+ },
+
+ /**
+ * Check a set of props are equal to a set of expected values - only works
+ * with scalars.
+ */
+ scalarPropsEqual: function (propNameToExpectedValue) {
+ expect(this.instance()).toBeTruthy();
+ for (var propName in propNameToExpectedValue) {
+ if (!propNameToExpectedValue.hasOwnProperty(propName)) {
+ continue;
+ }
+ expect(this.instance().props[propName]).toEqual(propNameToExpectedValue[propName]);
+ }
+ return this;
+ },
+
+ /**
+ * Check a set of props are equal to a set of expected values - only works
+ * with scalars.
+ */
+ scalarContextEqual: function (contextNameToExpectedValue) {
+ expect(this.instance()).toBeTruthy();
+ for (var contextName in contextNameToExpectedValue) {
+ if (!contextNameToExpectedValue.hasOwnProperty(contextName)) {
+ continue;
+ }
+ expect(this.instance().context[contextName]).toEqual(contextNameToExpectedValue[contextName]);
+ }
+ return this;
+ }
+});
+
+module.exports = reactComponentExpect;
\ No newline at end of file

lib/ReactComponent.js

@@ -11,19 +11,27 @@
'use strict';
-var ReactUpdateQueue = require("./ReactUpdateQueue");
+var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
-var invariant = require("./invariant");
-var warning = require("./warning");
+var canDefineProperty = require('./canDefineProperty');
+var emptyObject = require('fbjs/lib/emptyObject');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
/**
* Base class helpers for the updating state of a component.
*/
-function ReactComponent(props, context) {
+function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
+ this.refs = emptyObject;
+ // We initialize the default updater but the real one gets injected by the
+ // renderer.
+ this.updater = updater || ReactNoopUpdateQueue;
}
+ReactComponent.prototype.isReactComponent = {};
+
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
@@ -49,26 +57,14 @@
* @final
* @protected
*/
-ReactComponent.prototype.setState = function(partialState, callback) {
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null,
- 'setState(...): takes an object of state variables to update or a ' +
- 'function which returns an object of state variables.'
- ) : invariant(typeof partialState === 'object' ||
- typeof partialState === 'function' ||
- partialState == null));
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- partialState != null,
- 'setState(...): You passed an undefined or null state object; ' +
- 'instead, use forceUpdate().'
- ) : null);
+ReactComponent.prototype.setState = function (partialState, callback) {
+ !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
}
- ReactUpdateQueue.enqueueSetState(this, partialState);
+ this.updater.enqueueSetState(this, partialState);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -86,10 +82,10 @@
* @final
* @protected
*/
-ReactComponent.prototype.forceUpdate = function(callback) {
- ReactUpdateQueue.enqueueForceUpdate(this);
+ReactComponent.prototype.forceUpdate = function (callback) {
+ this.updater.enqueueForceUpdate(this);
if (callback) {
- ReactUpdateQueue.enqueueCallback(this, callback);
+ this.updater.enqueueCallback(this, callback);
}
};
@@ -98,46 +94,22 @@
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
-if ("production" !== process.env.NODE_ENV) {
+if (process.env.NODE_ENV !== 'production') {
var deprecatedAPIs = {
- getDOMNode: [
- 'getDOMNode',
- 'Use React.findDOMNode(component) instead.'
- ],
- isMounted: [
- 'isMounted',
- 'Instead, make sure to clean up subscriptions and pending requests in ' +
- 'componentWillUnmount to prevent memory leaks.'
- ],
- replaceProps: [
- 'replaceProps',
- 'Instead, call React.render again at the top level.'
- ],
- replaceState: [
- 'replaceState',
- 'Refactor your code to use setState instead (see ' +
- 'https://github.com/facebook/react/issues/3236).'
- ],
- setProps: [
- 'setProps',
- 'Instead, call React.render again at the top level.'
- ]
+ getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
+ isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
+ replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
+ replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
+ setProps: ['setProps', 'Instead, call render again at the top level.']
};
- var defineDeprecationWarning = function(methodName, info) {
- try {
+ var defineDeprecationWarning = function (methodName, info) {
+ if (canDefineProperty) {
Object.defineProperty(ReactComponent.prototype, methodName, {
- get: function() {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- '%s(...) is deprecated in plain JavaScript React classes. %s',
- info[0],
- info[1]
- ) : null);
+ get: function () {
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
return undefined;
}
});
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
}
};
for (var fnName in deprecatedAPIs) {

lib/ReactComponentWithPureRenderMixin.js

@@ -6,12 +6,12 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
-* @providesModule ReactComponentWithPureRenderMixin
-*/
+ * @providesModule ReactComponentWithPureRenderMixin
+ */
'use strict';
-var shallowEqual = require("./shallowEqual");
+var shallowCompare = require('./shallowCompare');
/**
* If your React component's render function is "pure", e.g. it will render the
@@ -38,9 +38,8 @@
* use `forceUpdate()` when you know deep data structures have changed.
*/
var ReactComponentWithPureRenderMixin = {
- shouldComponentUpdate: function(nextProps, nextState) {
- return !shallowEqual(this.props, nextProps) ||
- !shallowEqual(this.state, nextState);
+ shouldComponentUpdate: function (nextProps, nextState) {
+ return shallowCompare(this, nextProps, nextState);
}
};

lib/ReactCompositeComponent.js

@@ -11,25 +11,21 @@
'use strict';
-var ReactComponentEnvironment = require("./ReactComponentEnvironment");
-var ReactContext = require("./ReactContext");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactElement = require("./ReactElement");
-var ReactElementValidator = require("./ReactElementValidator");
-var ReactInstanceMap = require("./ReactInstanceMap");
-var ReactLifeCycle = require("./ReactLifeCycle");
-var ReactNativeComponent = require("./ReactNativeComponent");
-var ReactPerf = require("./ReactPerf");
-var ReactPropTypeLocations = require("./ReactPropTypeLocations");
-var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
-var ReactReconciler = require("./ReactReconciler");
-var ReactUpdates = require("./ReactUpdates");
-
-var assign = require("./Object.assign");
-var emptyObject = require("./emptyObject");
-var invariant = require("./invariant");
-var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
-var warning = require("./warning");
+var ReactComponentEnvironment = require('./ReactComponentEnvironment');
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactElement = require('./ReactElement');
+var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactPerf = require('./ReactPerf');
+var ReactPropTypeLocations = require('./ReactPropTypeLocations');
+var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
+var ReactReconciler = require('./ReactReconciler');
+var ReactUpdateQueue = require('./ReactUpdateQueue');
+
+var assign = require('./Object.assign');
+var emptyObject = require('fbjs/lib/emptyObject');
+var invariant = require('fbjs/lib/invariant');
+var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
+var warning = require('fbjs/lib/warning');
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
@@ -42,6 +38,12 @@
return '';
}
+function StatelessComponent(Component) {}
+StatelessComponent.prototype.render = function () {
+ var Component = ReactInstanceMap.get(this)._currentElement.type;
+ return Component(this.props, this.context, this.updater);
+};
+
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
@@ -89,7 +91,7 @@
* @final
* @internal
*/
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
@@ -104,7 +106,7 @@
this._context = null;
this._mountOrder = 0;
- this._isTopLevel = false;
+ this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
@@ -119,32 +121,54 @@
* @final
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
- var publicContext = this._processContext(this._currentElement._context);
+ var publicContext = this._processContext(context);
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ var Component = this._currentElement.type;
// Initialize the public class
- var inst = new Component(publicProps, publicContext);
+ var inst;
+ var renderedElement;
+
+ // This is a way to detect if Component is a stateless arrow function
+ // component, which is not newable. It might not be 100% reliable but is
+ // something we can do until we start detecting that Component extends
+ // React.Component. We already assume that typeof Component === 'function'.
+ var canInstantiate = ('prototype' in Component);
+
+ if (canInstantiate) {
+ if (process.env.NODE_ENV !== 'production') {
+ ReactCurrentOwner.current = this;
+ try {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ } else {
+ inst = new Component(publicProps, publicContext, ReactUpdateQueue);
+ }
+ }
+
+ if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
+ renderedElement = inst;
+ inst = new StatelessComponent(Component);
+ }
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
- ("production" !== process.env.NODE_ENV ? warning(
- inst.render != null,
- '%s(...): No `render` method found on the returned component ' +
- 'instance: you may have forgotten to define `render` in your ' +
- 'component or you may have accidentally tried to render an element ' +
- 'whose type is a function that isn\'t a React component.',
- Component.displayName || Component.name || 'Component'
- ) : null);
+ if (inst.render == null) {
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
+ } else {
+ // We support ES6 inheriting from React.Component, the module pattern,
+ // and stateless components, but not ES6 classes that don't extend
+ process.env.NODE_ENV !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
+ }
}
// These should be set up in the constructor, but as a convenience for
@@ -152,78 +176,36 @@
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
+ inst.updater = ReactUpdateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
- if ("production" !== process.env.NODE_ENV) {
- this._warnIfContextsDiffer(this._currentElement._context, context);
- }
-
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
- ("production" !== process.env.NODE_ENV ? warning(
- !inst.getInitialState ||
- inst.getInitialState.isReactClassApproved,
- 'getInitialState was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Did you mean to define a state property instead?',
- this.getName() || 'a component'
- ) : null);
- ("production" !== process.env.NODE_ENV ? warning(
- !inst.getDefaultProps ||
- inst.getDefaultProps.isReactClassApproved,
- 'getDefaultProps was defined on %s, a plain JavaScript class. ' +
- 'This is only supported for classes created using React.createClass. ' +
- 'Use a static property to define defaultProps instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== process.env.NODE_ENV ? warning(
- !inst.propTypes,
- 'propTypes was defined as an instance property on %s. Use a static ' +
- 'property to define propTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== process.env.NODE_ENV ? warning(
- !inst.contextTypes,
- 'contextTypes was defined as an instance property on %s. Use a ' +
- 'static property to define contextTypes instead.',
- this.getName() || 'a component'
- ) : null);
- ("production" !== process.env.NODE_ENV ? warning(
- typeof inst.componentShouldUpdate !== 'function',
- '%s has a method called ' +
- 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' +
- 'The name is phrased as a question because the function is ' +
- 'expected to return a value.',
- (this.getName() || 'A component')
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof initialState === 'object' && !Array.isArray(initialState),
- '%s.state: must be set to an object or null',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof initialState === 'object' && !Array.isArray(initialState)));
+ !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
- var childContext;
- var renderedElement;
-
- var previouslyMounting = ReactLifeCycle.currentlyMountingInstance;
- ReactLifeCycle.currentlyMountingInstance = this;
- try {
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
@@ -233,23 +215,14 @@
}
}
- childContext = this._getValidatedChildContext(context);
- renderedElement = this._renderValidatedComponent(childContext);
- } finally {
- ReactLifeCycle.currentlyMountingInstance = previouslyMounting;
+ // If not a stateless component, we now render
+ if (renderedElement === undefined) {
+ renderedElement = this._renderValidatedComponent();
}
- this._renderedComponent = this._instantiateReactComponent(
- renderedElement,
- this._currentElement.type // The wrapping type
- );
-
- var markup = ReactReconciler.mountComponent(
- this._renderedComponent,
- rootID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ this._renderedComponent = this._instantiateReactComponent(renderedElement);
+
+ var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
@@ -263,23 +236,20 @@
* @final
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
var inst = this._instance;
if (inst.componentWillUnmount) {
- var previouslyUnmounting = ReactLifeCycle.currentlyUnmountingInstance;
- ReactLifeCycle.currentlyUnmountingInstance = this;
- try {
inst.componentWillUnmount();
- } finally {
- ReactLifeCycle.currentlyUnmountingInstance = previouslyUnmounting;
- }
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
+ this._instance = null;
// Reset pending fields
+ // Even if this component is scheduled for another update in ReactUpdates,
+ // it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
@@ -290,6 +260,7 @@
// longer accessible.
this._context = null;
this._rootNodeID = null;
+ this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
@@ -304,25 +275,6 @@
},
/**
- * Schedule a partial update to the props. Only used for internal testing.
- *
- * @param {object} partialProps Subset of the next props.
- * @param {?function} callback Called after props are updated.
- * @final
- * @internal
- */
- _setPropsInternal: function(partialProps, callback) {
- // This is a deoptimized path. We optimize for always having an element.
- // This creates an extra internal element.
- var element = this._pendingElement || this._currentElement;
- this._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- assign({}, element.props, partialProps)
- );
- ReactUpdates.enqueueUpdate(this, callback);
- },
-
- /**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
@@ -330,14 +282,10 @@
* @return {?object}
* @private
*/
- _maskContext: function(context) {
+ _maskContext: function (context) {
var maskedContext = null;
- // This really should be getting the component class for the element,
- // but we know that we're not going to need it for built-ins.
- if (typeof this._currentElement.type === 'string') {
- return emptyObject;
- }
- var contextTypes = this._currentElement.type.contextTypes;
+ var Component = this._currentElement.type;
+ var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
@@ -356,18 +304,12 @@
* @return {?object}
* @private
*/
- _processContext: function(context) {
+ _processContext: function (context) {
var maskedContext = this._maskContext(context);
- if ("production" !== process.env.NODE_ENV) {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ if (process.env.NODE_ENV !== 'production') {
+ var Component = this._currentElement.type;
if (Component.contextTypes) {
- this._checkPropTypes(
- Component.contextTypes,
- maskedContext,
- ReactPropTypeLocations.context
- );
+ this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
}
}
return maskedContext;
@@ -378,38 +320,18 @@
* @return {object}
* @private
*/
- _getValidatedChildContext: function(currentContext) {
+ _processChildContext: function (currentContext) {
+ var Component = this._currentElement.type;
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof inst.constructor.childContextTypes === 'object',
- '%s.getChildContext(): childContextTypes must be defined in order to ' +
- 'use getChildContext().',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(typeof inst.constructor.childContextTypes === 'object'));
- if ("production" !== process.env.NODE_ENV) {
- this._checkPropTypes(
- inst.constructor.childContextTypes,
- childContext,
- ReactPropTypeLocations.childContext
- );
+ !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
+ if (process.env.NODE_ENV !== 'production') {
+ this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
- ("production" !== process.env.NODE_ENV ? invariant(
- name in inst.constructor.childContextTypes,
- '%s.getChildContext(): key "%s" is not defined in childContextTypes.',
- this.getName() || 'ReactCompositeComponent',
- name
- ) : invariant(name in inst.constructor.childContextTypes));
+ !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
}
- return childContext;
- }
- return null;
- },
-
- _mergeChildContext: function(currentContext, childContext) {
- if (childContext) {
return assign({}, currentContext, childContext);
}
return currentContext;
@@ -424,17 +346,11 @@
* @return {object}
* @private
*/
- _processProps: function(newProps) {
- if ("production" !== process.env.NODE_ENV) {
- var Component = ReactNativeComponent.getComponentClassForElement(
- this._currentElement
- );
+ _processProps: function (newProps) {
+ if (process.env.NODE_ENV !== 'production') {
+ var Component = this._currentElement.type;
if (Component.propTypes) {
- this._checkPropTypes(
- Component.propTypes,
- newProps,
- ReactPropTypeLocations.prop
- );
+ this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
}
}
return newProps;
@@ -448,7 +364,7 @@
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
- _checkPropTypes: function(propTypes, props, location) {
+ _checkPropTypes: function (propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
@@ -458,58 +374,35 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually ' +
- 'from React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
- // React.render calls, so I'm abstracting it away into
+ // top-level render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Failed Composite propType: %s%s',
- error.message,
- addendum
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
} else {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Failed Context Types: %s%s',
- error.message,
- addendum
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
}
}
}
}
},
- receiveComponent: function(nextElement, transaction, nextContext) {
+ receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
- this.updateComponent(
- transaction,
- prevElement,
- nextElement,
- prevContext,
- nextContext
- );
+ this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
@@ -519,54 +412,13 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(transaction) {
+ performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
- ReactReconciler.receiveComponent(
- this,
- this._pendingElement || this._currentElement,
- transaction,
- this._context
- );
+ ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
- if ("production" !== process.env.NODE_ENV) {
- ReactElementValidator.checkAndWarnForMutatedProps(
- this._currentElement
- );
- }
-
- this.updateComponent(
- transaction,
- this._currentElement,
- this._currentElement,
- this._context,
- this._context
- );
- }
- },
-
- /**
- * Compare two contexts, warning if they are different
- * TODO: Remove this check when owner-context is removed
- */
- _warnIfContextsDiffer: function(ownerBasedContext, parentBasedContext) {
- ownerBasedContext = this._maskContext(ownerBasedContext);
- parentBasedContext = this._maskContext(parentBasedContext);
- var parentKeys = Object.keys(parentBasedContext).sort();
- var displayName = this.getName() || 'ReactCompositeComponent';
- for (var i = 0; i < parentKeys.length; i++) {
- var key = parentKeys[i];
- ("production" !== process.env.NODE_ENV ? warning(
- ownerBasedContext[key] === parentBasedContext[key],
- 'owner-based and parent-based contexts differ ' +
- '(values: `%s` vs `%s`) for key (%s) while mounting %s ' +
- '(see: http://fb.me/react-context-by-parent)',
- ownerBasedContext[key],
- parentBasedContext[key],
- key,
- displayName
- ) : null);
+ this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
}
},
@@ -585,32 +437,19 @@
* @internal
* @overridable
*/
- updateComponent: function(
- transaction,
- prevParentElement,
- nextParentElement,
- prevUnmaskedContext,
- nextUnmaskedContext
- ) {
+ updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
- var nextContext = inst.context;
- var nextProps = inst.props;
+ var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
+ var nextProps;
// Distinguish between a props update versus a simple state update
- if (prevParentElement !== nextParentElement) {
- nextContext = this._processContext(nextParentElement._context);
+ if (prevParentElement === nextParentElement) {
+ // Skip checking prop types again -- we don't read inst.props to avoid
+ // warning for DOM component props in this upgrade
+ nextProps = nextParentElement.props;
+ } else {
nextProps = this._processProps(nextParentElement.props);
-
- if ("production" !== process.env.NODE_ENV) {
- if (nextUnmaskedContext != null) {
- this._warnIfContextsDiffer(
- nextParentElement._context,
- nextUnmaskedContext
- );
- }
- }
-
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
@@ -622,31 +461,16 @@
var nextState = this._processPendingState(nextProps, nextContext);
- var shouldUpdate =
- this._pendingForceUpdate ||
- !inst.shouldComponentUpdate ||
- inst.shouldComponentUpdate(nextProps, nextState, nextContext);
-
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- typeof shouldUpdate !== 'undefined',
- '%s.shouldComponentUpdate(): Returned undefined instead of a ' +
- 'boolean value. Make sure to return true or false.',
- this.getName() || 'ReactCompositeComponent'
- ) : null);
+ var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
+
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
- this._performComponentUpdate(
- nextParentElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- nextUnmaskedContext
- );
+ this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
@@ -658,7 +482,7 @@
}
},
- _processPendingState: function(props, context) {
+ _processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
@@ -676,12 +500,7 @@
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
- assign(
- nextState,
- typeof partial === 'function' ?
- partial.call(inst, nextState, props, context) :
- partial
- );
+ assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
@@ -699,19 +518,18 @@
* @param {?object} unmaskedContext
* @private
*/
- _performComponentUpdate: function(
- nextElement,
- nextProps,
- nextState,
- nextContext,
- transaction,
- unmaskedContext
- ) {
+ _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var inst = this._instance;
- var prevProps = inst.props;
- var prevState = inst.state;
- var prevContext = inst.context;
+ var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
+ var prevProps;
+ var prevState;
+ var prevContext;
+ if (hasComponentDidUpdate) {
+ prevProps = inst.props;
+ prevState = inst.state;
+ prevContext = inst.context;
+ }
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
@@ -725,11 +543,8 @@
this._updateRenderedComponent(transaction, unmaskedContext);
- if (inst.componentDidUpdate) {
- transaction.getReactMountReady().enqueue(
- inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext),
- inst
- );
+ if (hasComponentDidUpdate) {
+ transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
},
@@ -739,34 +554,20 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- _updateRenderedComponent: function(transaction, context) {
+ _updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
- var childContext = this._getValidatedChildContext();
- var nextRenderedElement = this._renderValidatedComponent(childContext);
+ var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
- ReactReconciler.receiveComponent(
- prevComponentInstance,
- nextRenderedElement,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
- this._renderedComponent = this._instantiateReactComponent(
- nextRenderedElement,
- this._currentElement.type
- );
- var nextMarkup = ReactReconciler.mountComponent(
- this._renderedComponent,
- thisID,
- transaction,
- this._mergeChildContext(context, childContext)
- );
+ this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
+ var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
@@ -774,23 +575,19 @@
/**
* @protected
*/
- _replaceNodeWithMarkupByID: function(prevComponentID, nextMarkup) {
- ReactComponentEnvironment.replaceNodeWithMarkupByID(
- prevComponentID,
- nextMarkup
- );
+ _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
+ ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
},
/**
* @protected
*/
- _renderValidatedComponentWithoutOwnerOrContext: function() {
+ _renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedComponent = inst.render();
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
- if (typeof renderedComponent === 'undefined' &&
- inst.render._isMockFunction) {
+ if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
@@ -803,31 +600,17 @@
/**
* @private
*/
- _renderValidatedComponent: function(childContext) {
+ _renderValidatedComponent: function () {
var renderedComponent;
- var previousContext = ReactContext.current;
- ReactContext.current = this._mergeChildContext(
- this._currentElement._context,
- childContext
- );
ReactCurrentOwner.current = this;
try {
- renderedComponent =
- this._renderValidatedComponentWithoutOwnerOrContext();
+ renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
- ReactContext.current = previousContext;
ReactCurrentOwner.current = null;
}
- ("production" !== process.env.NODE_ENV ? invariant(
+ !(
// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent),
- '%s.render(): A valid ReactComponent must be returned. You may have ' +
- 'returned undefined, an array or some other invalid object.',
- this.getName() || 'ReactCompositeComponent'
- ) : invariant(// TODO: An `isValidNode` function would probably be more appropriate
- renderedComponent === null || renderedComponent === false ||
- ReactElement.isValidElement(renderedComponent)));
+ renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
return renderedComponent;
},
@@ -839,10 +622,16 @@
* @final
* @private
*/
- attachRef: function(ref, component) {
+ attachRef: function (ref, component) {
var inst = this.getPublicInstance();
- var refs = inst.refs === emptyObject ? (inst.refs = {}) : inst.refs;
- refs[ref] = component.getPublicInstance();
+ !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
+ var publicComponentInstance = component.getPublicInstance();
+ if (process.env.NODE_ENV !== 'production') {
+ var componentName = component && component.getName ? component.getName() : 'a component';
+ process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
+ }
+ var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
+ refs[ref] = publicComponentInstance;
},
/**
@@ -852,7 +641,7 @@
* @final
* @private
*/
- detachRef: function(ref) {
+ detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
@@ -863,26 +652,26 @@
* @return {string} The name or null.
* @internal
*/
- getName: function() {
+ getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
- return (
- type.displayName || (constructor && constructor.displayName) ||
- type.name || (constructor && constructor.name) ||
- null
- );
+ return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
- * is exposed by refs and returned by React.render. Can be null for stateless
+ * is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
- getPublicInstance: function() {
- return this._instance;
+ getPublicInstance: function () {
+ var inst = this._instance;
+ if (inst instanceof StatelessComponent) {
+ return null;
+ }
+ return inst;
},
// Stub
@@ -890,15 +679,11 @@
};
-ReactPerf.measureMethods(
- ReactCompositeComponentMixin,
- 'ReactCompositeComponent',
- {
+ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
- }
-);
+});
var ReactCompositeComponent = {

lib/ReactContext.js

@@ -1,74 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactContext
- */
-
-'use strict';
-
-var assign = require("./Object.assign");
-var emptyObject = require("./emptyObject");
-var warning = require("./warning");
-
-var didWarn = false;
-
-/**
- * Keeps track of the current context.
- *
- * The context is automatically passed down the component ownership hierarchy
- * and is accessible via `this.context` on ReactCompositeComponents.
- */
-var ReactContext = {
-
- /**
- * @internal
- * @type {object}
- */
- current: emptyObject,
-
- /**
- * Temporarily extends the current context while executing scopedCallback.
- *
- * A typical use case might look like
- *
- * render: function() {
- * var children = ReactContext.withContext({foo: 'foo'}, () => (
- *
- * ));
- * return <div>{children}</div>;
- * }
- *
- * @param {object} newContext New context to merge into the existing context
- * @param {function} scopedCallback Callback to run with the new context
- * @return {ReactComponent|array<ReactComponent>}
- */
- withContext: function(newContext, scopedCallback) {
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- didWarn,
- 'withContext is deprecated and will be removed in a future version. ' +
- 'Use a wrapper component with getChildContext instead.'
- ) : null);
-
- didWarn = true;
- }
-
- var result;
- var previousContext = ReactContext.current;
- ReactContext.current = assign({}, previousContext, newContext);
- try {
- result = scopedCallback();
- } finally {
- ReactContext.current = previousContext;
- }
- return result;
- }
-
-};
-
-module.exports = ReactContext;

lib/ReactCSSTransitionGroupChild.js

@@ -12,53 +12,68 @@
'use strict';
-var React = require("./React");
+var React = require('./React');
+var ReactDOM = require('./ReactDOM');
-var CSSCore = require("./CSSCore");
-var ReactTransitionEvents = require("./ReactTransitionEvents");
+var CSSCore = require('fbjs/lib/CSSCore');
+var ReactTransitionEvents = require('./ReactTransitionEvents');
-var onlyChild = require("./onlyChild");
-var warning = require("./warning");
+var onlyChild = require('./onlyChild');
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
-var NO_EVENT_TIMEOUT = 5000;
-var noEventListener = null;
+var ReactCSSTransitionGroupChild = React.createClass({
+ displayName: 'ReactCSSTransitionGroupChild',
+ propTypes: {
+ name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
+ enter: React.PropTypes.string,
+ leave: React.PropTypes.string,
+ active: React.PropTypes.string
+ }), React.PropTypes.shape({
+ enter: React.PropTypes.string,
+ enterActive: React.PropTypes.string,
+ leave: React.PropTypes.string,
+ leaveActive: React.PropTypes.string,
+ appear: React.PropTypes.string,
+ appearActive: React.PropTypes.string
+ })]).isRequired,
+
+ // Once we require timeouts to be specified, we can remove the
+ // boolean flags (appear etc.) and just accept a number
+ // or a bool for the timeout flags (appearTimeout etc.)
+ appear: React.PropTypes.bool,
+ enter: React.PropTypes.bool,
+ leave: React.PropTypes.bool,
+ appearTimeout: React.PropTypes.number,
+ enterTimeout: React.PropTypes.number,
+ leaveTimeout: React.PropTypes.number
+ },
-if ("production" !== process.env.NODE_ENV) {
- noEventListener = function() {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'transition(): tried to perform an animation without ' +
- 'an animationend or transitionend event after timeout (' +
- '%sms). You should either disable this ' +
- 'transition in JS or add a CSS animation/transition.',
- NO_EVENT_TIMEOUT
- ) : null);
- };
-}
+ transition: function (animationType, finishCallback, userSpecifiedDelay) {
+ var node = ReactDOM.findDOMNode(this);
-var ReactCSSTransitionGroupChild = React.createClass({
- displayName: 'ReactCSSTransitionGroupChild',
+ if (!node) {
+ if (finishCallback) {
+ finishCallback();
+ }
+ return;
+ }
- transition: function(animationType, finishCallback) {
- var node = this.getDOMNode();
- var className = this.props.name + '-' + animationType;
- var activeClassName = className + '-active';
- var noEventTimeout = null;
+ var className = this.props.name[animationType] || this.props.name + '-' + animationType;
+ var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
+ var timeout = null;
- var endListener = function(e) {
+ var endListener = function (e) {
if (e && e.target !== node) {
return;
}
- if ("production" !== process.env.NODE_ENV) {
- clearTimeout(noEventTimeout);
- }
+
+ clearTimeout(timeout);
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
@@ -72,19 +87,23 @@
}
};
- ReactTransitionEvents.addEndEventListener(node, endListener);
-
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
- if ("production" !== process.env.NODE_ENV) {
- noEventTimeout = setTimeout(noEventListener, NO_EVENT_TIMEOUT);
+ // If the user specified a timeout delay.
+ if (userSpecifiedDelay) {
+ // Clean-up the animation after the specified delay
+ timeout = setTimeout(endListener, userSpecifiedDelay);
+ this.transitionTimeouts.push(timeout);
+ } else {
+ // DEPRECATED: this listener will be removed in a future version of react
+ ReactTransitionEvents.addEndEventListener(node, endListener);
}
},
- queueClass: function(className) {
+ queueClass: function (className) {
this.classNameQueue.push(className);
if (!this.timeout) {
@@ -92,51 +111,53 @@
}
},
- flushClassNameQueue: function() {
+ flushClassNameQueue: function () {
if (this.isMounted()) {
- this.classNameQueue.forEach(
- CSSCore.addClass.bind(CSSCore, this.getDOMNode())
- );
+ this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
}
this.classNameQueue.length = 0;
this.timeout = null;
},
- componentWillMount: function() {
+ componentWillMount: function () {
this.classNameQueue = [];
+ this.transitionTimeouts = [];
},
- componentWillUnmount: function() {
+ componentWillUnmount: function () {
if (this.timeout) {
clearTimeout(this.timeout);
}
+ this.transitionTimeouts.forEach(function (timeout) {
+ clearTimeout(timeout);
+ });
},
- componentWillAppear: function(done) {
+ componentWillAppear: function (done) {
if (this.props.appear) {
- this.transition('appear', done);
+ this.transition('appear', done, this.props.appearTimeout);
} else {
done();
}
},
- componentWillEnter: function(done) {
+ componentWillEnter: function (done) {
if (this.props.enter) {
- this.transition('enter', done);
+ this.transition('enter', done, this.props.enterTimeout);
} else {
done();
}
},
- componentWillLeave: function(done) {
+ componentWillLeave: function (done) {
if (this.props.leave) {
- this.transition('leave', done);
+ this.transition('leave', done, this.props.leaveTimeout);
} else {
done();
}
},
- render: function() {
+ render: function () {
return onlyChild(this.props.children);
}
});

lib/ReactCSSTransitionGroup.js

@@ -12,28 +12,47 @@
'use strict';
-var React = require("./React");
+var React = require('./React');
-var assign = require("./Object.assign");
+var assign = require('./Object.assign');
-var ReactTransitionGroup = React.createFactory(
- require("./ReactTransitionGroup")
-);
-var ReactCSSTransitionGroupChild = React.createFactory(
- require("./ReactCSSTransitionGroupChild")
-);
+var ReactTransitionGroup = require('./ReactTransitionGroup');
+var ReactCSSTransitionGroupChild = require('./ReactCSSTransitionGroupChild');
+
+function createTransitionTimeoutPropValidator(transitionType) {
+ var timeoutPropName = 'transition' + transitionType + 'Timeout';
+ var enabledPropName = 'transition' + transitionType;
+
+ return function (props) {
+ // If the transition is enabled
+ if (props[enabledPropName]) {
+ // If no timeout duration is provided
+ if (props[timeoutPropName] == null) {
+ return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
+
+ // If the duration isn't a number
+ } else if (typeof props[timeoutPropName] !== 'number') {
+ return new Error(timeoutPropName + ' must be a number (in milliseconds)');
+ }
+ }
+ };
+}
var ReactCSSTransitionGroup = React.createClass({
displayName: 'ReactCSSTransitionGroup',
propTypes: {
- transitionName: React.PropTypes.string.isRequired,
+ transitionName: ReactCSSTransitionGroupChild.propTypes.name,
+
transitionAppear: React.PropTypes.bool,
transitionEnter: React.PropTypes.bool,
- transitionLeave: React.PropTypes.bool
+ transitionLeave: React.PropTypes.bool,
+ transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
+ transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
+ transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
},
- getDefaultProps: function() {
+ getDefaultProps: function () {
return {
transitionAppear: false,
transitionEnter: true,
@@ -41,27 +60,23 @@
};
},
- _wrapChild: function(child) {
+ _wrapChild: function (child) {
// We need to provide this childFactory so that
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
// leave while it is leaving.
- return ReactCSSTransitionGroupChild(
- {
+ return React.createElement(ReactCSSTransitionGroupChild, {
name: this.props.transitionName,
appear: this.props.transitionAppear,
enter: this.props.transitionEnter,
- leave: this.props.transitionLeave
- },
- child
- );
+ leave: this.props.transitionLeave,
+ appearTimeout: this.props.transitionAppearTimeout,
+ enterTimeout: this.props.transitionEnterTimeout,
+ leaveTimeout: this.props.transitionLeaveTimeout
+ }, child);
},
- render: function() {
- return (
- ReactTransitionGroup(
- assign({}, this.props, {childFactory: this._wrapChild})
- )
- );
+ render: function () {
+ return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
}
});

lib/ReactCurrentOwner.js

@@ -16,8 +16,6 @@
*
* The current owner is the component who should own any components that are
* currently being constructed.
- *
- * The depth indicate how many composite components are above this render level.
*/
var ReactCurrentOwner = {

lib/ReactDefaultBatchingStrategy.js

@@ -11,15 +11,15 @@
'use strict';
-var ReactUpdates = require("./ReactUpdates");
-var Transaction = require("./Transaction");
+var ReactUpdates = require('./ReactUpdates');
+var Transaction = require('./Transaction');
-var assign = require("./Object.assign");
-var emptyFunction = require("./emptyFunction");
+var assign = require('./Object.assign');
+var emptyFunction = require('fbjs/lib/emptyFunction');
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
- close: function() {
+ close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
@@ -35,15 +35,11 @@
this.reinitializeTransaction();
}
-assign(
- ReactDefaultBatchingStrategyTransaction.prototype,
- Transaction.Mixin,
- {
- getTransactionWrappers: function() {
+assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
- }
-);
+});
var transaction = new ReactDefaultBatchingStrategyTransaction();
@@ -54,16 +50,16 @@
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
- batchedUpdates: function(callback, a, b, c, d) {
+ batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
- callback(a, b, c, d);
+ callback(a, b, c, d, e);
} else {
- transaction.perform(callback, null, a, b, c, d);
+ transaction.perform(callback, null, a, b, c, d, e);
}
}
};

lib/ReactDefaultInjection.js

@@ -11,63 +11,40 @@
'use strict';
-var BeforeInputEventPlugin = require("./BeforeInputEventPlugin");
-var ChangeEventPlugin = require("./ChangeEventPlugin");
-var ClientReactRootIndex = require("./ClientReactRootIndex");
-var DefaultEventPluginOrder = require("./DefaultEventPluginOrder");
-var EnterLeaveEventPlugin = require("./EnterLeaveEventPlugin");
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-var HTMLDOMPropertyConfig = require("./HTMLDOMPropertyConfig");
-var MobileSafariClickEventPlugin = require("./MobileSafariClickEventPlugin");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactComponentBrowserEnvironment =
- require("./ReactComponentBrowserEnvironment");
-var ReactDefaultBatchingStrategy = require("./ReactDefaultBatchingStrategy");
-var ReactDOMComponent = require("./ReactDOMComponent");
-var ReactDOMButton = require("./ReactDOMButton");
-var ReactDOMForm = require("./ReactDOMForm");
-var ReactDOMImg = require("./ReactDOMImg");
-var ReactDOMIDOperations = require("./ReactDOMIDOperations");
-var ReactDOMIframe = require("./ReactDOMIframe");
-var ReactDOMInput = require("./ReactDOMInput");
-var ReactDOMOption = require("./ReactDOMOption");
-var ReactDOMSelect = require("./ReactDOMSelect");
-var ReactDOMTextarea = require("./ReactDOMTextarea");
-var ReactDOMTextComponent = require("./ReactDOMTextComponent");
-var ReactElement = require("./ReactElement");
-var ReactEventListener = require("./ReactEventListener");
-var ReactInjection = require("./ReactInjection");
-var ReactInstanceHandles = require("./ReactInstanceHandles");
-var ReactMount = require("./ReactMount");
-var ReactReconcileTransaction = require("./ReactReconcileTransaction");
-var SelectEventPlugin = require("./SelectEventPlugin");
-var ServerReactRootIndex = require("./ServerReactRootIndex");
-var SimpleEventPlugin = require("./SimpleEventPlugin");
-var SVGDOMPropertyConfig = require("./SVGDOMPropertyConfig");
-
-var createFullPageComponent = require("./createFullPageComponent");
-
-function autoGenerateWrapperClass(type) {
- return ReactClass.createClass({
- tagName: type.toUpperCase(),
- render: function() {
- return new ReactElement(
- type,
- null,
- null,
- null,
- null,
- this.props
- );
- }
- });
-}
+var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
+var ChangeEventPlugin = require('./ChangeEventPlugin');
+var ClientReactRootIndex = require('./ClientReactRootIndex');
+var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
+var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
+var ReactBrowserComponentMixin = require('./ReactBrowserComponentMixin');
+var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
+var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
+var ReactDOMComponent = require('./ReactDOMComponent');
+var ReactDOMTextComponent = require('./ReactDOMTextComponent');
+var ReactEventListener = require('./ReactEventListener');
+var ReactInjection = require('./ReactInjection');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+var ReactMount = require('./ReactMount');
+var ReactReconcileTransaction = require('./ReactReconcileTransaction');
+var SelectEventPlugin = require('./SelectEventPlugin');
+var ServerReactRootIndex = require('./ServerReactRootIndex');
+var SimpleEventPlugin = require('./SimpleEventPlugin');
+var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
+
+var alreadyInjected = false;
function inject() {
- ReactInjection.EventEmitter.injectReactEventListener(
- ReactEventListener
- );
+ if (alreadyInjected) {
+ // TODO: This is currently true because these injections are shared between
+ // the client and the server package. They should be built independently
+ // and not share any injection state. Then this problem will be solved.
+ return;
+ }
+ alreadyInjected = true;
+
+ ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
@@ -84,67 +61,32 @@
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
- MobileSafariClickEventPlugin: MobileSafariClickEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
- ReactInjection.NativeComponent.injectGenericComponentClass(
- ReactDOMComponent
- );
-
- ReactInjection.NativeComponent.injectTextComponentClass(
- ReactDOMTextComponent
- );
-
- ReactInjection.NativeComponent.injectAutoWrapper(
- autoGenerateWrapperClass
- );
+ ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
- // This needs to happen before createFullPageComponent() otherwise the mixin
- // won't be included.
- ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
+ ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
- ReactInjection.NativeComponent.injectComponentClasses({
- 'button': ReactDOMButton,
- 'form': ReactDOMForm,
- 'iframe': ReactDOMIframe,
- 'img': ReactDOMImg,
- 'input': ReactDOMInput,
- 'option': ReactDOMOption,
- 'select': ReactDOMSelect,
- 'textarea': ReactDOMTextarea,
-
- 'html': createFullPageComponent('html'),
- 'head': createFullPageComponent('head'),
- 'body': createFullPageComponent('body')
- });
+ ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
- ReactInjection.Updates.injectReconcileTransaction(
- ReactReconcileTransaction
- );
- ReactInjection.Updates.injectBatchingStrategy(
- ReactDefaultBatchingStrategy
- );
-
- ReactInjection.RootIndex.injectCreateReactRootIndex(
- ExecutionEnvironment.canUseDOM ?
- ClientReactRootIndex.createReactRootIndex :
- ServerReactRootIndex.createReactRootIndex
- );
+ ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
+ ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
+
+ ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
- ReactInjection.DOMComponent.injectIDOperations(ReactDOMIDOperations);
- if ("production" !== process.env.NODE_ENV) {
- var url = (ExecutionEnvironment.canUseDOM && window.location.href) || '';
- if ((/[?&]react_perf\b/).test(url)) {
- var ReactDefaultPerf = require("./ReactDefaultPerf");
+ if (process.env.NODE_ENV !== 'production') {
+ var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
+ if (/[?&]react_perf\b/.test(url)) {
+ var ReactDefaultPerf = require('./ReactDefaultPerf');
ReactDefaultPerf.start();
}
}

lib/ReactDefaultPerfAnalysis.js

@@ -9,7 +9,9 @@
* @providesModule ReactDefaultPerfAnalysis
*/
-var assign = require("./Object.assign");
+'use strict';
+
+var assign = require('./Object.assign');
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
@@ -18,12 +20,14 @@
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
+ SET_MARKUP: 'set innerHTML',
TEXT_CONTENT: 'set textContent',
- 'updatePropertyByID': 'update attribute',
- 'deletePropertyByID': 'delete attribute',
- 'updateStylesByID': 'update styles',
- 'updateInnerHTMLByID': 'set innerHTML',
- 'dangerouslyReplaceNodeWithMarkupByID': 'replace'
+ 'setValueForProperty': 'update attribute',
+ 'setValueForAttribute': 'update attribute',
+ 'deleteValueForProperty': 'remove attribute',
+ 'setValueForStyles': 'update styles',
+ 'replaceNodeWithMarkup': 'replace',
+ 'updateTextContent': 'set textContent'
};
function getTotalTime(measurements) {
@@ -41,20 +45,17 @@
function getDOMSummary(measurements) {
var items = [];
- for (var i = 0; i < measurements.length; i++) {
- var measurement = measurements[i];
- var id;
-
- for (id in measurement.writes) {
- measurement.writes[id].forEach(function(write) {
+ measurements.forEach(function (measurement) {
+ Object.keys(measurement.writes).forEach(function (id) {
+ measurement.writes[id].forEach(function (write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
- }
- }
+ });
+ });
return items;
}
@@ -64,11 +65,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
@@ -103,7 +100,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.exclusive - a.exclusive;
});
@@ -116,11 +113,7 @@
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
- var allIDs = assign(
- {},
- measurement.exclusive,
- measurement.inclusive
- );
+ var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
@@ -162,7 +155,7 @@
}
}
- arr.sort(function(a, b) {
+ arr.sort(function (a, b) {
return b.time - a.time;
});
@@ -187,6 +180,10 @@
break;
}
}
+ // check if component newly created
+ if (measurement.created[id]) {
+ isDirty = true;
+ }
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}

lib/ReactDefaultPerf.js

@@ -12,12 +12,12 @@
'use strict';
-var DOMProperty = require("./DOMProperty");
-var ReactDefaultPerfAnalysis = require("./ReactDefaultPerfAnalysis");
-var ReactMount = require("./ReactMount");
-var ReactPerf = require("./ReactPerf");
+var DOMProperty = require('./DOMProperty');
+var ReactDefaultPerfAnalysis = require('./ReactDefaultPerfAnalysis');
+var ReactMount = require('./ReactMount');
+var ReactPerf = require('./ReactPerf');
-var performanceNow = require("./performanceNow");
+var performanceNow = require('fbjs/lib/performanceNow');
function roundFloat(val) {
return Math.floor(val * 100) / 100;
@@ -32,7 +32,7 @@
_mountStack: [0],
_injected: false,
- start: function() {
+ start: function () {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
@@ -41,18 +41,18 @@
ReactPerf.enableMeasure = true;
},
- stop: function() {
+ stop: function () {
ReactPerf.enableMeasure = false;
},
- getLastMeasurements: function() {
+ getLastMeasurements: function () {
return ReactDefaultPerf._allMeasurements;
},
- printExclusive: function(measurements) {
+ printExclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
@@ -67,28 +67,22 @@
// number.
},
- printInclusive: function(measurements) {
+ printInclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- getMeasurementsSummaryMap: function(measurements) {
- var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(
- measurements,
- true
- );
- return summary.map(function(item) {
+ getMeasurementsSummaryMap: function (measurements) {
+ var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
+ return summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
@@ -97,37 +91,28 @@
});
},
- printWasted: function(measurements) {
+ printWasted: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- printDOM: function(measurements) {
+ printDOM: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
- console.table(summary.map(function(item) {
+ console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
- result['type'] = item.type;
- result['args'] = JSON.stringify(item.args);
+ result.type = item.type;
+ result.args = JSON.stringify(item.args);
return result;
}));
- console.log(
- 'Total time:',
- ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms'
- );
+ console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
- _recordWrite: function(id, fnName, totalTime, args) {
+ _recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
- var writes =
- ReactDefaultPerf
- ._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1]
- .writes;
+ var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
@@ -136,14 +121,17 @@
});
},
- measure: function(moduleName, fnName, func) {
- return function() {for (var args=[],$__0=0,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
+ measure: function (moduleName, fnName, func) {
+ return function () {
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key];
+ }
+
var totalTime;
var rv;
var start;
- if (fnName === '_renderNewRootComponent' ||
- fnName === 'flushBatchedUpdates') {
+ if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
@@ -155,16 +143,14 @@
counts: {},
writes: {},
displayNames: {},
- totalTime: 0
+ totalTime: 0,
+ created: {}
});
start = performanceNow();
rv = func.apply(this, args);
- ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ].totalTime = performanceNow() - start;
+ ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
return rv;
- } else if (fnName === '_mountImageIntoNode' ||
- moduleName === 'ReactDOMIDOperations') {
+ } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
@@ -174,7 +160,7 @@
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
- args[0].forEach(function(update) {
+ args[0].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
@@ -188,46 +174,35 @@
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
- ReactDefaultPerf._recordWrite(
- update.parentID,
- update.type,
- totalTime,
- writeArgs
- );
+ ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
});
} else {
// basic format
- ReactDefaultPerf._recordWrite(
- args[0],
- fnName,
- totalTime,
- Array.prototype.slice.call(args, 1)
- );
+ var id = args[0];
+ if (typeof id === 'object') {
+ id = ReactMount.getID(args[0]);
+ }
+ ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
return rv;
- } else if (moduleName === 'ReactCompositeComponent' && (
- (// TODO: receiveComponent()?
- (fnName === 'mountComponent' ||
- fnName === 'updateComponent' || fnName === '_renderValidatedComponent')))) {
+ } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
+ fnName === '_renderValidatedComponent')) {
- if (typeof this._currentElement.type === 'string') {
+ if (this._currentElement.type === ReactMount.TopLevelWrapper) {
return func.apply(this, args);
}
- var rootNodeID = fnName === 'mountComponent' ?
- args[0] :
- this._rootNodeID;
+ var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
- var entry = ReactDefaultPerf._allMeasurements[
- ReactDefaultPerf._allMeasurements.length - 1
- ];
+ var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
+ entry.created[rootNodeID] = true;
mountStack.push(0);
}
@@ -248,9 +223,7 @@
entry.displayNames[rootNodeID] = {
current: this.getName(),
- owner: this._currentElement._owner ?
- this._currentElement._owner.getName() :
- '<root>'
+ owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
};
return rv;

lib/ReactDOMButton.js

@@ -11,16 +11,7 @@
'use strict';
-var AutoFocusMixin = require("./AutoFocusMixin");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-
-var keyMirror = require("./keyMirror");
-
-var button = ReactElement.createFactory('button');
-
-var mouseListenerNames = keyMirror({
+var mouseListenerNames = {
onClick: true,
onDoubleClick: true,
onMouseDown: true,
@@ -26,37 +17,34 @@
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
+
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
-});
+};
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
-var ReactDOMButton = ReactClass.createClass({
- displayName: 'ReactDOMButton',
- tagName: 'BUTTON',
-
- mixins: [AutoFocusMixin, ReactBrowserComponentMixin],
-
- render: function() {
- var props = {};
-
- // Copy the props; except the mouse listeners if we're disabled
- for (var key in this.props) {
- if (this.props.hasOwnProperty(key) &&
- (!this.props.disabled || !mouseListenerNames[key])) {
- props[key] = this.props[key];
- }
+var ReactDOMButton = {
+ getNativeProps: function (inst, props, context) {
+ if (!props.disabled) {
+ return props;
}
- return button(props, this.props.children);
+ // Copy the props, except the mouse listeners
+ var nativeProps = {};
+ for (var key in props) {
+ if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
+ nativeProps[key] = props[key];
+ }
}
-});
+ return nativeProps;
+ }
+};
module.exports = ReactDOMButton;

lib/ReactDOMComponent.js

@@ -14,104 +14,293 @@
'use strict';
-var CSSPropertyOperations = require("./CSSPropertyOperations");
-var DOMProperty = require("./DOMProperty");
-var DOMPropertyOperations = require("./DOMPropertyOperations");
-var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
-var ReactComponentBrowserEnvironment =
- require("./ReactComponentBrowserEnvironment");
-var ReactMount = require("./ReactMount");
-var ReactMultiChild = require("./ReactMultiChild");
-var ReactPerf = require("./ReactPerf");
-
-var assign = require("./Object.assign");
-var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
-var invariant = require("./invariant");
-var isEventSupported = require("./isEventSupported");
-var keyOf = require("./keyOf");
-var warning = require("./warning");
+var AutoFocusUtils = require('./AutoFocusUtils');
+var CSSPropertyOperations = require('./CSSPropertyOperations');
+var DOMProperty = require('./DOMProperty');
+var DOMPropertyOperations = require('./DOMPropertyOperations');
+var EventConstants = require('./EventConstants');
+var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
+var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
+var ReactDOMButton = require('./ReactDOMButton');
+var ReactDOMInput = require('./ReactDOMInput');
+var ReactDOMOption = require('./ReactDOMOption');
+var ReactDOMSelect = require('./ReactDOMSelect');
+var ReactDOMTextarea = require('./ReactDOMTextarea');
+var ReactMount = require('./ReactMount');
+var ReactMultiChild = require('./ReactMultiChild');
+var ReactPerf = require('./ReactPerf');
+var ReactUpdateQueue = require('./ReactUpdateQueue');
+
+var assign = require('./Object.assign');
+var canDefineProperty = require('./canDefineProperty');
+var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
+var invariant = require('fbjs/lib/invariant');
+var isEventSupported = require('./isEventSupported');
+var keyOf = require('fbjs/lib/keyOf');
+var setInnerHTML = require('./setInnerHTML');
+var setTextContent = require('./setTextContent');
+var shallowEqual = require('fbjs/lib/shallowEqual');
+var validateDOMNesting = require('./validateDOMNesting');
+var warning = require('fbjs/lib/warning');
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
-var CONTENT_TYPES = {'string': true, 'number': true};
+var CONTENT_TYPES = { 'string': true, 'number': true };
-var STYLE = keyOf({style: null});
+var CHILDREN = keyOf({ children: null });
+var STYLE = keyOf({ style: null });
+var HTML = keyOf({ __html: null });
var ELEMENT_NODE_TYPE = 1;
-/**
- * Optionally injectable operations for mutating the DOM
- */
-var BackendIDOperations = null;
+function getDeclarationErrorAddendum(internalInstance) {
+ if (internalInstance) {
+ var owner = internalInstance._currentElement._owner || null;
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' This DOM node was rendered by `' + name + '`.';
+ }
+ }
+ }
+ return '';
+}
+
+var legacyPropsDescriptor;
+if (process.env.NODE_ENV !== 'production') {
+ legacyPropsDescriptor = {
+ props: {
+ enumerable: false,
+ get: function () {
+ var component = this._reactInternalComponent;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
+ return component._currentElement.props;
+ }
+ }
+ };
+}
+
+function legacyGetDOMNode() {
+ if (process.env.NODE_ENV !== 'production') {
+ var component = this._reactInternalComponent;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return this;
+}
+
+function legacyIsMounted() {
+ var component = this._reactInternalComponent;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ return !!component;
+}
+
+function legacySetStateEtc() {
+ if (process.env.NODE_ENV !== 'production') {
+ var component = this._reactInternalComponent;
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+}
+
+function legacySetProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function legacyReplaceProps(partialProps, callback) {
+ var component = this._reactInternalComponent;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
+ }
+ if (!component) {
+ return;
+ }
+ ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
+ if (callback) {
+ ReactUpdateQueue.enqueueCallbackInternal(component, callback);
+ }
+}
+
+function friendlyStringify(obj) {
+ if (typeof obj === 'object') {
+ if (Array.isArray(obj)) {
+ return '[' + obj.map(friendlyStringify).join(', ') + ']';
+ } else {
+ var pairs = [];
+ for (var key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
+ pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
+ }
+ }
+ return '{' + pairs.join(', ') + '}';
+ }
+ } else if (typeof obj === 'string') {
+ return JSON.stringify(obj);
+ } else if (typeof obj === 'function') {
+ return '[function object]';
+ }
+ // Differs from JSON.stringify in that undefined becauses undefined and that
+ // inf and nan don't become null
+ return String(obj);
+}
+
+var styleMutationWarning = {};
+
+function checkAndWarnForMutatedStyle(style1, style2, component) {
+ if (style1 == null || style2 == null) {
+ return;
+ }
+ if (shallowEqual(style1, style2)) {
+ return;
+ }
+
+ var componentName = component._tag;
+ var owner = component._currentElement._owner;
+ var ownerName;
+ if (owner) {
+ ownerName = owner.getName();
+ }
+
+ var hash = ownerName + '|' + componentName;
+
+ if (styleMutationWarning.hasOwnProperty(hash)) {
+ return;
+ }
+
+ styleMutationWarning[hash] = true;
+
+ process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
+}
/**
+ * @param {object} component
* @param {?object} props
*/
-function assertValidProps(props) {
+function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
+ if (process.env.NODE_ENV !== 'production') {
+ if (voidElementTags[component._tag]) {
+ process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
+ }
+ }
if (props.dangerouslySetInnerHTML != null) {
- ("production" !== process.env.NODE_ENV ? invariant(
- props.children == null,
- 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.'
- ) : invariant(props.children == null));
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML,
- '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' +
- 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' +
- 'for more information.'
- ) : invariant(typeof props.dangerouslySetInnerHTML === 'object' &&
- '__html' in props.dangerouslySetInnerHTML));
- }
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- props.innerHTML == null,
- 'Directly setting property `innerHTML` is not permitted. ' +
- 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'
- ) : null);
- ("production" !== process.env.NODE_ENV ? warning(
- !props.contentEditable || props.children == null,
- 'A component is `contentEditable` and contains `children` managed by ' +
- 'React. It is now your responsibility to guarantee that none of ' +
- 'those nodes are unexpectedly modified or duplicated. This is ' +
- 'probably not intentional.'
- ) : null);
- }
- ("production" !== process.env.NODE_ENV ? invariant(
- props.style == null || typeof props.style === 'object',
- 'The `style` prop expects a mapping from style properties to values, ' +
- 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' +
- 'using JSX.'
- ) : invariant(props.style == null || typeof props.style === 'object'));
+ !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
+ !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
+ }
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
+ process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
+ }
+ !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
}
-function putListener(id, registrationName, listener, transaction) {
- if ("production" !== process.env.NODE_ENV) {
+function enqueuePutListener(id, registrationName, listener, transaction) {
+ if (process.env.NODE_ENV !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
- ("production" !== process.env.NODE_ENV ? warning(
- registrationName !== 'onScroll' || isEventSupported('scroll', true),
- 'This browser doesn\'t support the `onScroll` event'
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
- var doc = container.nodeType === ELEMENT_NODE_TYPE ?
- container.ownerDocument :
- container;
+ var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
listenTo(registrationName, doc);
}
- transaction.getPutListenerQueue().enqueuePutListener(
- id,
- registrationName,
- listener
- );
+ transaction.getReactMountReady().enqueue(putListener, {
+ id: id,
+ registrationName: registrationName,
+ listener: listener
+ });
+}
+
+function putListener() {
+ var listenerToPut = this;
+ ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
+}
+
+// There are so many media events, it makes sense to just
+// maintain a list rather than create a `trapBubbledEvent` for each
+var mediaEvents = {
+ topAbort: 'abort',
+ topCanPlay: 'canplay',
+ topCanPlayThrough: 'canplaythrough',
+ topDurationChange: 'durationchange',
+ topEmptied: 'emptied',
+ topEncrypted: 'encrypted',
+ topEnded: 'ended',
+ topError: 'error',
+ topLoadedData: 'loadeddata',
+ topLoadedMetadata: 'loadedmetadata',
+ topLoadStart: 'loadstart',
+ topPause: 'pause',
+ topPlay: 'play',
+ topPlaying: 'playing',
+ topProgress: 'progress',
+ topRateChange: 'ratechange',
+ topSeeked: 'seeked',
+ topSeeking: 'seeking',
+ topStalled: 'stalled',
+ topSuspend: 'suspend',
+ topTimeUpdate: 'timeupdate',
+ topVolumeChange: 'volumechange',
+ topWaiting: 'waiting'
+};
+
+function trapBubbledEventsLocal() {
+ var inst = this;
+ // If a component renders to null or if another component fatals and causes
+ // the state of the tree to be corrupted, `node` here can be null.
+ !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
+ var node = ReactMount.getNode(inst._rootNodeID);
+ !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
+
+ switch (inst._tag) {
+ case 'iframe':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'video':
+ case 'audio':
+
+ inst._wrapperState.listeners = [];
+ // create listener for each media event
+ for (var event in mediaEvents) {
+ if (mediaEvents.hasOwnProperty(event)) {
+ inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
+ }
+ }
+
+ break;
+ case 'img':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
+ break;
+ case 'form':
+ inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
+ break;
+ }
+}
+
+function mountReadyInputWrapper() {
+ ReactDOMInput.mountReadyWrapper(this);
+}
+
+function postUpdateSelectWrapper() {
+ ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
@@ -133,24 +322,49 @@
'source': true,
'track': true,
'wbr': true
- // NOTE: menuitem's close tag should be omitted, but that causes problems.
};
-// We accept any tag to be rendered but since this gets injected into abitrary
+// NOTE: menuitem's close tag should be omitted, but that causes problems.
+var newlineEatingTags = {
+ 'listing': true,
+ 'pre': true,
+ 'textarea': true
+};
+
+// For HTML, certain tags cannot have children. This has the same purpose as
+// `omittedCloseTags` except that `menuitem` should still have its closing tag.
+
+var voidElementTags = assign({
+ 'menuitem': true
+}, omittedCloseTags);
+
+// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
-var hasOwnProperty = {}.hasOwnProperty;
+var hasOwnProperty = ({}).hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
- ("production" !== process.env.NODE_ENV ? invariant(VALID_TAG_REGEX.test(tag), 'Invalid tag: %s', tag) : invariant(VALID_TAG_REGEX.test(tag)));
+ !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
validatedTagCache[tag] = true;
}
}
+function processChildContextDev(context, inst) {
+ // Pass down our tag name to child components for validation purposes
+ context = assign({}, context);
+ var info = context[validateDOMNesting.ancestorInfoContextKey];
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
+ return context;
+}
+
+function isCustomComponent(tagName, props) {
+ return tagName.indexOf('-') >= 0 || props.is != null;
+}
+
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
@@ -167,17 +381,25 @@
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
- this._tag = tag;
+ this._tag = tag.toLowerCase();
this._renderedChildren = null;
+ this._previousStyle = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
+ this._wrapperState = null;
+ this._topLevelWrapper = null;
+ this._nodeWithLegacyProperties = null;
+ if (process.env.NODE_ENV !== 'production') {
+ this._unprocessedContextDev = null;
+ this._processedContextDev = null;
+ }
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
- construct: function(element) {
+ construct: function (element) {
this._currentElement = element;
},
@@ -188,17 +410,94 @@
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
* @return {string} The computed markup.
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
this._rootNodeID = rootID;
- assertValidProps(this._currentElement.props);
- var closeTag = omittedCloseTags[this._tag] ? '' : '</' + this._tag + '>';
- return (
- this._createOpenTagMarkupAndPutListeners(transaction) +
- this._createContentMarkup(transaction, context) +
- closeTag
- );
+
+ var props = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ this._wrapperState = {
+ listeners: null
+ };
+ transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
+ break;
+ case 'button':
+ props = ReactDOMButton.getNativeProps(this, props, context);
+ break;
+ case 'input':
+ ReactDOMInput.mountWrapper(this, props, context);
+ props = ReactDOMInput.getNativeProps(this, props, context);
+ break;
+ case 'option':
+ ReactDOMOption.mountWrapper(this, props, context);
+ props = ReactDOMOption.getNativeProps(this, props, context);
+ break;
+ case 'select':
+ ReactDOMSelect.mountWrapper(this, props, context);
+ props = ReactDOMSelect.getNativeProps(this, props, context);
+ context = ReactDOMSelect.processChildContext(this, props, context);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.mountWrapper(this, props, context);
+ props = ReactDOMTextarea.getNativeProps(this, props, context);
+ break;
+ }
+
+ assertValidProps(this, props);
+ if (process.env.NODE_ENV !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
+ if (process.env.NODE_ENV !== 'production') {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ context = this._processedContextDev;
+ }
+
+ var mountImage;
+ if (transaction.useCreateElement) {
+ var ownerDocument = context[ReactMount.ownerDocumentContextKey];
+ var el = ownerDocument.createElement(this._currentElement.type);
+ DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
+ // Populate node cache
+ ReactMount.getID(el);
+ this._updateDOMProperties({}, props, transaction, el);
+ this._createInitialChildren(transaction, props, context, el);
+ mountImage = el;
+ } else {
+ var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
+ var tagContent = this._createContentMarkup(transaction, props, context);
+ if (!tagContent && omittedCloseTags[this._tag]) {
+ mountImage = tagOpen + '/>';
+ } else {
+ mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
+ }
+ }
+
+ switch (this._tag) {
+ case 'input':
+ transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
+ // falls through
+ case 'button':
+ case 'select':
+ case 'textarea':
+ if (props.autoFocus) {
+ transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
+ }
+ break;
+ }
+
+ return mountImage;
},
/**
@@ -211,11 +510,11 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @return {string} Markup of opening tag.
*/
- _createOpenTagMarkupAndPutListeners: function(transaction) {
- var props = this._currentElement.props;
- var ret = '<' + this._tag;
+ _createOpenTagMarkupAndPutListeners: function (transaction, props) {
+ var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
@@ -226,16 +525,28 @@
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, propValue, transaction);
+ if (propValue) {
+ enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
+ }
} else {
if (propKey === STYLE) {
if (propValue) {
+ if (process.env.NODE_ENV !== 'production') {
+ // See `_updateDOMProperties`. style block
+ this._previousStyle = propValue;
+ }
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
- var markup =
- DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ var markup = null;
+ if (this._tag != null && isCustomComponent(this._tag, props)) {
+ if (propKey !== CHILDREN) {
+ markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
+ }
+ } else {
+ markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
+ }
if (markup) {
ret += ' ' + markup;
}
@@ -245,11 +556,11 @@
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
- return ret + '>';
+ return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
- return ret + ' ' + markupForID + '>';
+ return ret + ' ' + markupForID;
},
/**
@@ -257,47 +568,78 @@
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
- _createContentMarkup: function(transaction, context) {
- var prefix = '';
- if (this._tag === 'listing' ||
- this._tag === 'pre' ||
- this._tag === 'textarea') {
- // Add an initial newline because browsers ignore the first newline in
- // a <listing>, <pre>, or <textarea> as an "authoring convenience" -- see
- // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody.
- prefix = '\n';
- }
+ _createContentMarkup: function (transaction, props, context) {
+ var ret = '';
- var props = this._currentElement.props;
+ // Intentional use of != to avoid catching zero/false.
+ var innerHTML = props.dangerouslySetInnerHTML;
+ if (innerHTML != null) {
+ if (innerHTML.__html != null) {
+ ret = innerHTML.__html;
+ }
+ } else {
+ var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
+ var childrenToUse = contentToUse != null ? null : props.children;
+ if (contentToUse != null) {
+ // TODO: Validate that text is allowed as a child of this node
+ ret = escapeTextContentForBrowser(contentToUse);
+ } else if (childrenToUse != null) {
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ ret = mountImages.join('');
+ }
+ }
+ if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
+ // text/html ignores the first character in these tags if it's a newline
+ // Prefer to break application/xml over text/html (for now) by adding
+ // a newline specifically to get eaten by the parser. (Alternately for
+ // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
+ // \r is normalized out by HTMLTextAreaElement#value.)
+ // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
+ // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
+ // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
+ // See: Parsing of "textarea" "listing" and "pre" elements
+ // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
+ return '\n' + ret;
+ } else {
+ return ret;
+ }
+ },
+ _createInitialChildren: function (transaction, props, context, el) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
- return prefix + innerHTML.__html;
+ setInnerHTML(el, innerHTML.__html);
}
} else {
- var contentToUse =
- CONTENT_TYPES[typeof props.children] ? props.children : null;
+ var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
- return prefix + escapeTextContentForBrowser(contentToUse);
+ // TODO: Validate that text is allowed as a child of this node
+ setTextContent(el, contentToUse);
} else if (childrenToUse != null) {
- var mountImages = this.mountChildren(
- childrenToUse,
- transaction,
- context
- );
- return prefix + mountImages.join('');
+ var mountImages = this.mountChildren(childrenToUse, transaction, context);
+ for (var i = 0; i < mountImages.length; i++) {
+ el.appendChild(mountImages[i]);
+ }
}
}
- return prefix;
},
- receiveComponent: function(nextElement, transaction, context) {
+ /**
+ * Receives a next element and updates the component.
+ *
+ * @internal
+ * @param {ReactElement} nextElement
+ * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @param {object} context
+ */
+ receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
@@ -313,10 +655,59 @@
* @internal
* @overridable
*/
- updateComponent: function(transaction, prevElement, nextElement, context) {
- assertValidProps(this._currentElement.props);
- this._updateDOMProperties(prevElement.props, transaction);
- this._updateDOMChildren(prevElement.props, transaction, context);
+ updateComponent: function (transaction, prevElement, nextElement, context) {
+ var lastProps = prevElement.props;
+ var nextProps = this._currentElement.props;
+
+ switch (this._tag) {
+ case 'button':
+ lastProps = ReactDOMButton.getNativeProps(this, lastProps);
+ nextProps = ReactDOMButton.getNativeProps(this, nextProps);
+ break;
+ case 'input':
+ ReactDOMInput.updateWrapper(this);
+ lastProps = ReactDOMInput.getNativeProps(this, lastProps);
+ nextProps = ReactDOMInput.getNativeProps(this, nextProps);
+ break;
+ case 'option':
+ lastProps = ReactDOMOption.getNativeProps(this, lastProps);
+ nextProps = ReactDOMOption.getNativeProps(this, nextProps);
+ break;
+ case 'select':
+ lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
+ nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
+ break;
+ case 'textarea':
+ ReactDOMTextarea.updateWrapper(this);
+ lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
+ nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
+ break;
+ }
+
+ if (process.env.NODE_ENV !== 'production') {
+ // If the context is reference-equal to the old one, pass down the same
+ // processed object so the update bailout in ReactReconciler behaves
+ // correctly (and identically in dev and prod). See #5005.
+ if (this._unprocessedContextDev !== context) {
+ this._unprocessedContextDev = context;
+ this._processedContextDev = processChildContextDev(context, this);
+ }
+ context = this._processedContextDev;
+ }
+
+ assertValidProps(this, nextProps);
+ this._updateDOMProperties(lastProps, nextProps, transaction, null);
+ this._updateDOMChildren(lastProps, nextProps, transaction, context);
+
+ if (!canDefineProperty && this._nodeWithLegacyProperties) {
+ this._nodeWithLegacyProperties.props = nextProps;
+ }
+
+ if (this._tag === 'select') {
+ // <select> value update needs to occur after <option> children
+ // reconciliation
+ transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
+ }
},
/**
@@ -332,16 +723,16 @@
*
* @private
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {?DOMElement} node
*/
- _updateDOMProperties: function(lastProps, transaction) {
- var nextProps = this._currentElement.props;
+ _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
- if (nextProps.hasOwnProperty(propKey) ||
- !lastProps.hasOwnProperty(propKey)) {
+ if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
@@ -354,26 +745,31 @@
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
+ if (lastProps[propKey]) {
+ // Only call deleteListener if there was a listener previously or
+ // else willDeleteListener gets called when there wasn't actually a
+ // listener (e.g., onClick={null})
deleteListener(this._rootNodeID, propKey);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.deletePropertyByID(
- this._rootNodeID,
- propKey
- );
+ }
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
- var lastProp = propKey === STYLE ?
- this._previousStyleCopy :
- lastProps[propKey];
+ var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
+ if (process.env.NODE_ENV !== 'production') {
+ checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
+ this._previousStyle = nextProp;
+ }
nextProp = this._previousStyleCopy = assign({}, nextProp);
} else {
this._previousStyleCopy = null;
@@ -381,16 +777,14 @@
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
- if (lastProp.hasOwnProperty(styleName) &&
- (!nextProp || !nextProp.hasOwnProperty(styleName))) {
+ if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
- if (nextProp.hasOwnProperty(styleName) &&
- lastProp[styleName] !== nextProp[styleName]) {
+ if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
@@ -400,22 +794,38 @@
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
- putListener(this._rootNodeID, propKey, nextProp, transaction);
- } else if (
- DOMProperty.isStandardName[propKey] ||
- DOMProperty.isCustomAttribute(propKey)) {
- BackendIDOperations.updatePropertyByID(
- this._rootNodeID,
- propKey,
- nextProp
- );
+ if (nextProp) {
+ enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
+ } else if (lastProp) {
+ deleteListener(this._rootNodeID, propKey);
+ }
+ } else if (isCustomComponent(this._tag, nextProps)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ if (propKey === CHILDREN) {
+ nextProp = null;
+ }
+ DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
+ } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ // If we're updating to null or undefined, we should remove the property
+ // from the DOM node instead of inadvertantly setting to a string. This
+ // brings us in line with the same behavior we have on initial render.
+ if (nextProp != null) {
+ DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
+ } else {
+ DOMPropertyOperations.deleteValueForProperty(node, propKey);
+ }
}
}
if (styleUpdates) {
- BackendIDOperations.updateStylesByID(
- this._rootNodeID,
- styleUpdates
- );
+ if (!node) {
+ node = ReactMount.getNode(this._rootNodeID);
+ }
+ CSSPropertyOperations.setValueForStyles(node, styleUpdates);
}
},
@@ -424,22 +834,16 @@
* children content.
*
* @param {object} lastProps
+ * @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
+ * @param {object} context
*/
- _updateDOMChildren: function(lastProps, transaction, context) {
- var nextProps = this._currentElement.props;
+ _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
+ var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
+ var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
- var lastContent =
- CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
- var nextContent =
- CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
-
- var lastHtml =
- lastProps.dangerouslySetInnerHTML &&
- lastProps.dangerouslySetInnerHTML.__html;
- var nextHtml =
- nextProps.dangerouslySetInnerHTML &&
- nextProps.dangerouslySetInnerHTML.__html;
+ var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
+ var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
@@ -461,10 +865,7 @@
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
- BackendIDOperations.updateInnerHTMLByID(
- this._rootNodeID,
- nextHtml
- );
+ this.updateMarkup('' + nextHtml);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
@@ -477,11 +878,76 @@
*
* @internal
*/
- unmountComponent: function() {
+ unmountComponent: function () {
+ switch (this._tag) {
+ case 'iframe':
+ case 'img':
+ case 'form':
+ case 'video':
+ case 'audio':
+ var listeners = this._wrapperState.listeners;
+ if (listeners) {
+ for (var i = 0; i < listeners.length; i++) {
+ listeners[i].remove();
+ }
+ }
+ break;
+ case 'input':
+ ReactDOMInput.unmountWrapper(this);
+ break;
+ case 'html':
+ case 'head':
+ case 'body':
+ /**
+ * Components like <html> <head> and <body> can't be removed or added
+ * easily in a cross-browser way, however it's valuable to be able to
+ * take advantage of React's reconciliation for styling and <title>
+ * management. So we just document it and throw in dangerous cases.
+ */
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
+ break;
+ }
+
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
+ this._wrapperState = null;
+ if (this._nodeWithLegacyProperties) {
+ var node = this._nodeWithLegacyProperties;
+ node._reactInternalComponent = null;
+ this._nodeWithLegacyProperties = null;
+ }
+ },
+
+ getPublicInstance: function () {
+ if (!this._nodeWithLegacyProperties) {
+ var node = ReactMount.getNode(this._rootNodeID);
+
+ node._reactInternalComponent = this;
+ node.getDOMNode = legacyGetDOMNode;
+ node.isMounted = legacyIsMounted;
+ node.setState = legacySetStateEtc;
+ node.replaceState = legacySetStateEtc;
+ node.forceUpdate = legacySetStateEtc;
+ node.setProps = legacySetProps;
+ node.replaceProps = legacyReplaceProps;
+
+ if (process.env.NODE_ENV !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperties(node, legacyPropsDescriptor);
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+ } else {
+ // updateComponent will update this property on subsequent renders
+ node.props = this._currentElement.props;
+ }
+
+ this._nodeWithLegacyProperties = node;
+ }
+ return this._nodeWithLegacyProperties;
}
};
@@ -491,16 +957,6 @@
updateComponent: 'updateComponent'
});
-assign(
- ReactDOMComponent.prototype,
- ReactDOMComponent.Mixin,
- ReactMultiChild.Mixin
-);
-
-ReactDOMComponent.injection = {
- injectIDOperations: function(IDOperations) {
- ReactDOMComponent.BackendIDOperations = BackendIDOperations = IDOperations;
- }
-};
+assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;

lib/ReactDOMFactories.js

@@ -0,0 +1,177 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMFactories
+ * @typechecks static-only
+ */
+
+'use strict';
+
+var ReactElement = require('./ReactElement');
+var ReactElementValidator = require('./ReactElementValidator');
+
+var mapObject = require('fbjs/lib/mapObject');
+
+/**
+ * Create a factory that creates HTML tag elements.
+ *
+ * @param {string} tag Tag name (e.g. `div`).
+ * @private
+ */
+function createDOMFactory(tag) {
+ if (process.env.NODE_ENV !== 'production') {
+ return ReactElementValidator.createFactory(tag);
+ }
+ return ReactElement.createFactory(tag);
+}
+
+/**
+ * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
+ * This is also accessible via `React.DOM`.
+ *
+ * @public
+ */
+var ReactDOMFactories = mapObject({
+ a: 'a',
+ abbr: 'abbr',
+ address: 'address',
+ area: 'area',
+ article: 'article',
+ aside: 'aside',
+ audio: 'audio',
+ b: 'b',
+ base: 'base',
+ bdi: 'bdi',
+ bdo: 'bdo',
+ big: 'big',
+ blockquote: 'blockquote',
+ body: 'body',
+ br: 'br',
+ button: 'button',
+ canvas: 'canvas',
+ caption: 'caption',
+ cite: 'cite',
+ code: 'code',
+ col: 'col',
+ colgroup: 'colgroup',
+ data: 'data',
+ datalist: 'datalist',
+ dd: 'dd',
+ del: 'del',
+ details: 'details',
+ dfn: 'dfn',
+ dialog: 'dialog',
+ div: 'div',
+ dl: 'dl',
+ dt: 'dt',
+ em: 'em',
+ embed: 'embed',
+ fieldset: 'fieldset',
+ figcaption: 'figcaption',
+ figure: 'figure',
+ footer: 'footer',
+ form: 'form',
+ h1: 'h1',
+ h2: 'h2',
+ h3: 'h3',
+ h4: 'h4',
+ h5: 'h5',
+ h6: 'h6',
+ head: 'head',
+ header: 'header',
+ hgroup: 'hgroup',
+ hr: 'hr',
+ html: 'html',
+ i: 'i',
+ iframe: 'iframe',
+ img: 'img',
+ input: 'input',
+ ins: 'ins',
+ kbd: 'kbd',
+ keygen: 'keygen',
+ label: 'label',
+ legend: 'legend',
+ li: 'li',
+ link: 'link',
+ main: 'main',
+ map: 'map',
+ mark: 'mark',
+ menu: 'menu',
+ menuitem: 'menuitem',
+ meta: 'meta',
+ meter: 'meter',
+ nav: 'nav',
+ noscript: 'noscript',
+ object: 'object',
+ ol: 'ol',
+ optgroup: 'optgroup',
+ option: 'option',
+ output: 'output',
+ p: 'p',
+ param: 'param',
+ picture: 'picture',
+ pre: 'pre',
+ progress: 'progress',
+ q: 'q',
+ rp: 'rp',
+ rt: 'rt',
+ ruby: 'ruby',
+ s: 's',
+ samp: 'samp',
+ script: 'script',
+ section: 'section',
+ select: 'select',
+ small: 'small',
+ source: 'source',
+ span: 'span',
+ strong: 'strong',
+ style: 'style',
+ sub: 'sub',
+ summary: 'summary',
+ sup: 'sup',
+ table: 'table',
+ tbody: 'tbody',
+ td: 'td',
+ textarea: 'textarea',
+ tfoot: 'tfoot',
+ th: 'th',
+ thead: 'thead',
+ time: 'time',
+ title: 'title',
+ tr: 'tr',
+ track: 'track',
+ u: 'u',
+ ul: 'ul',
+ 'var': 'var',
+ video: 'video',
+ wbr: 'wbr',
+
+ // SVG
+ circle: 'circle',
+ clipPath: 'clipPath',
+ defs: 'defs',
+ ellipse: 'ellipse',
+ g: 'g',
+ image: 'image',
+ line: 'line',
+ linearGradient: 'linearGradient',
+ mask: 'mask',
+ path: 'path',
+ pattern: 'pattern',
+ polygon: 'polygon',
+ polyline: 'polyline',
+ radialGradient: 'radialGradient',
+ rect: 'rect',
+ stop: 'stop',
+ svg: 'svg',
+ text: 'text',
+ tspan: 'tspan'
+
+}, createDOMFactory);
+
+module.exports = ReactDOMFactories;
\ No newline at end of file

lib/ReactDOMFeatureFlags.js

@@ -0,0 +1,18 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMFeatureFlags
+ */
+
+'use strict';
+
+var ReactDOMFeatureFlags = {
+ useCreateElement: false
+};
+
+module.exports = ReactDOMFeatureFlags;
\ No newline at end of file

lib/ReactDOMForm.js

@@ -1,47 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMForm
- */
-
-'use strict';
-
-var EventConstants = require("./EventConstants");
-var LocalEventTrapMixin = require("./LocalEventTrapMixin");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-
-var form = ReactElement.createFactory('form');
-
-/**
- * Since onSubmit doesn't bubble OR capture on the top level in IE8, we need
- * to capture it on the <form> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <form> a
- * composite component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMForm = ReactClass.createClass({
- displayName: 'ReactDOMForm',
- tagName: 'FORM',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- // TODO: Instead of using `ReactDOM` directly, we should use JSX. However,
- // `jshint` fails to parse JSX so in order for linting to work in the open
- // source repo, we need to just use `ReactDOM.form`.
- return form(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');
- }
-});
-
-module.exports = ReactDOMForm;

lib/ReactDOMIDOperations.js

@@ -10,34 +10,28 @@
* @typechecks static-only
*/
-/*jslint evil: true */
-
'use strict';
-var CSSPropertyOperations = require("./CSSPropertyOperations");
-var DOMChildrenOperations = require("./DOMChildrenOperations");
-var DOMPropertyOperations = require("./DOMPropertyOperations");
-var ReactMount = require("./ReactMount");
-var ReactPerf = require("./ReactPerf");
+var DOMChildrenOperations = require('./DOMChildrenOperations');
+var DOMPropertyOperations = require('./DOMPropertyOperations');
+var ReactMount = require('./ReactMount');
+var ReactPerf = require('./ReactPerf');
-var invariant = require("./invariant");
-var setInnerHTML = require("./setInnerHTML");
+var invariant = require('fbjs/lib/invariant');
/**
- * Errors for properties that should not be updated with `updatePropertyById()`.
+ * Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
- dangerouslySetInnerHTML:
- '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
+ dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
- * Operations used to process updates to DOM nodes. This is made injectable via
- * `ReactDOMComponent.BackendIDOperations`.
+ * Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
@@ -50,13 +44,9 @@
* @param {*} value New value of the property.
* @internal
*/
- updatePropertyByID: function(id, name, value) {
+ updatePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
- ("production" !== process.env.NODE_ENV ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
+ !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
@@ -69,61 +59,6 @@
},
/**
- * Updates a DOM node to remove a property. This should only be used to remove
- * DOM properties in `DOMProperty`.
- *
- * @param {string} id ID of the node to update.
- * @param {string} name A property name to remove, see `DOMProperty`.
- * @internal
- */
- deletePropertyByID: function(id, name, value) {
- var node = ReactMount.getNode(id);
- ("production" !== process.env.NODE_ENV ? invariant(
- !INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
- 'updatePropertyByID(...): %s',
- INVALID_PROPERTY_ERRORS[name]
- ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
- DOMPropertyOperations.deleteValueForProperty(node, name, value);
- },
-
- /**
- * Updates a DOM node with new style values. If a value is specified as '',
- * the corresponding style property will be unset.
- *
- * @param {string} id ID of the node to update.
- * @param {object} styles Mapping from styles to values.
- * @internal
- */
- updateStylesByID: function(id, styles) {
- var node = ReactMount.getNode(id);
- CSSPropertyOperations.setValueForStyles(node, styles);
- },
-
- /**
- * Updates a DOM node's innerHTML.
- *
- * @param {string} id ID of the node to update.
- * @param {string} html An HTML string.
- * @internal
- */
- updateInnerHTMLByID: function(id, html) {
- var node = ReactMount.getNode(id);
- setInnerHTML(node, html);
- },
-
- /**
- * Updates a DOM node's text content set by `props.content`.
- *
- * @param {string} id ID of the node to update.
- * @param {string} content Text content.
- * @internal
- */
- updateTextContentByID: function(id, content) {
- var node = ReactMount.getNode(id);
- DOMChildrenOperations.updateTextContent(node, content);
- },
-
- /**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
@@ -131,7 +66,7 @@
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
- dangerouslyReplaceNodeWithMarkupByID: function(id, markup) {
+ dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
@@ -143,7 +78,7 @@
* @param {array<string>} markup List of markup strings.
* @internal
*/
- dangerouslyProcessChildrenUpdates: function(updates, markup) {
+ dangerouslyProcessChildrenUpdates: function (updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
@@ -152,11 +87,6 @@
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
- updatePropertyByID: 'updatePropertyByID',
- deletePropertyByID: 'deletePropertyByID',
- updateStylesByID: 'updateStylesByID',
- updateInnerHTMLByID: 'updateInnerHTMLByID',
- updateTextContentByID: 'updateTextContentByID',
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});

lib/ReactDOMIframe.js

@@ -1,43 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMIframe
- */
-
-'use strict';
-
-var EventConstants = require("./EventConstants");
-var LocalEventTrapMixin = require("./LocalEventTrapMixin");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-
-var iframe = ReactElement.createFactory('iframe');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <iframe> element itself. There are lots of hacks we could
- * do to accomplish this, but the most reliable is to make <iframe> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMIframe = ReactClass.createClass({
- displayName: 'ReactDOMIframe',
- tagName: 'IFRAME',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return iframe(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- }
-});
-
-module.exports = ReactDOMIframe;

lib/ReactDOMImg.js

@@ -1,44 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactDOMImg
- */
-
-'use strict';
-
-var EventConstants = require("./EventConstants");
-var LocalEventTrapMixin = require("./LocalEventTrapMixin");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-
-var img = ReactElement.createFactory('img');
-
-/**
- * Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
- * capture it on the <img> element itself. There are lots of hacks we could do
- * to accomplish this, but the most reliable is to make <img> a composite
- * component and use `componentDidMount` to attach the event handlers.
- */
-var ReactDOMImg = ReactClass.createClass({
- displayName: 'ReactDOMImg',
- tagName: 'IMG',
-
- mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
-
- render: function() {
- return img(this.props);
- },
-
- componentDidMount: function() {
- this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
- this.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error');
- }
-});
-
-module.exports = ReactDOMImg;

lib/ReactDOMInput.js

@@ -11,26 +11,20 @@
'use strict';
-var AutoFocusMixin = require("./AutoFocusMixin");
-var DOMPropertyOperations = require("./DOMPropertyOperations");
-var LinkedValueUtils = require("./LinkedValueUtils");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-var ReactMount = require("./ReactMount");
-var ReactUpdates = require("./ReactUpdates");
+var ReactDOMIDOperations = require('./ReactDOMIDOperations');
+var LinkedValueUtils = require('./LinkedValueUtils');
+var ReactMount = require('./ReactMount');
+var ReactUpdates = require('./ReactUpdates');
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
-
-var input = ReactElement.createFactory('input');
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
var instancesByReactID = {};
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMInput.updateWrapper(this);
}
}
@@ -50,81 +44,75 @@
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
-var ReactDOMInput = ReactClass.createClass({
- displayName: 'ReactDOMInput',
- tagName: 'INPUT',
-
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
-
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
- return {
- initialChecked: this.props.defaultChecked || false,
- initialValue: defaultValue != null ? defaultValue : null
- };
- },
-
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- props.defaultChecked = null;
- props.defaultValue = null;
+var ReactDOMInput = {
+ getNativeProps: function (inst, props, context) {
+ var value = LinkedValueUtils.getValue(props);
+ var checked = LinkedValueUtils.getChecked(props);
+
+ var nativeProps = assign({}, props, {
+ defaultChecked: undefined,
+ defaultValue: undefined,
+ value: value != null ? value : inst._wrapperState.initialValue,
+ checked: checked != null ? checked : inst._wrapperState.initialChecked,
+ onChange: inst._wrapperState.onChange
+ });
- var value = LinkedValueUtils.getValue(this);
- props.value = value != null ? value : this.state.initialValue;
-
- var checked = LinkedValueUtils.getChecked(this);
- props.checked = checked != null ? checked : this.state.initialChecked;
+ return nativeProps;
+ },
- props.onChange = this._handleChange;
+ mountWrapper: function (inst, props) {
+ if (process.env.NODE_ENV !== 'production') {
+ LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
+ }
- return input(props, this.props.children);
+ var defaultValue = props.defaultValue;
+ inst._wrapperState = {
+ initialChecked: props.defaultChecked || false,
+ initialValue: defaultValue != null ? defaultValue : null,
+ onChange: _handleChange.bind(inst)
+ };
},
- componentDidMount: function() {
- var id = ReactMount.getID(this.getDOMNode());
- instancesByReactID[id] = this;
+ mountReadyWrapper: function (inst) {
+ // Can't be in mountWrapper or else server rendering leaks.
+ instancesByReactID[inst._rootNodeID] = inst;
},
- componentWillUnmount: function() {
- var rootNode = this.getDOMNode();
- var id = ReactMount.getID(rootNode);
- delete instancesByReactID[id];
+ unmountWrapper: function (inst) {
+ delete instancesByReactID[inst._rootNodeID];
},
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var rootNode = this.getDOMNode();
- if (this.props.checked != null) {
- DOMPropertyOperations.setValueForProperty(
- rootNode,
- 'checked',
- this.props.checked || false
- );
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // TODO: Shouldn't this be getChecked(props)?
+ var checked = props.checked;
+ if (checked != null) {
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
}
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
+
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
- var name = this.props.name;
- if (this.props.type === 'radio' && name != null) {
- var rootNode = this.getDOMNode();
+ var name = props.name;
+ if (props.type === 'radio' && name != null) {
+ var rootNode = ReactMount.getNode(this._rootNodeID);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
@@ -137,27 +125,21 @@
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
- var group = queryRoot.querySelectorAll(
- 'input[name=' + JSON.stringify('' + name) + '][type="radio"]');
+ var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
- for (var i = 0, groupLen = group.length; i < groupLen; i++) {
+ for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
- if (otherNode === rootNode ||
- otherNode.form !== rootNode.form) {
+ if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
+ // This will throw if radio buttons rendered by different copies of React
+ // and the same name are rendered into the same form (same as #1939).
+ // That's probably okay; we don't support it just as we don't support
+ // mixing React with non-React.
var otherID = ReactMount.getID(otherNode);
- ("production" !== process.env.NODE_ENV ? invariant(
- otherID,
- 'ReactDOMInput: Mixing React and non-React radio inputs with the ' +
- 'same `name` is not supported.'
- ) : invariant(otherID));
+ !otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
var otherInstance = instancesByReactID[otherID];
- ("production" !== process.env.NODE_ENV ? invariant(
- otherInstance,
- 'ReactDOMInput: Unknown radio button ID %s.',
- otherID
- ) : invariant(otherInstance));
+ !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
@@ -166,8 +148,6 @@
}
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMInput;

lib/ReactDOM.js

@@ -7,169 +7,86 @@
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOM
- * @typechecks static-only
*/
+/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
+
'use strict';
-var ReactElement = require("./ReactElement");
-var ReactElementValidator = require("./ReactElementValidator");
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactDOMTextComponent = require('./ReactDOMTextComponent');
+var ReactDefaultInjection = require('./ReactDefaultInjection');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+var ReactMount = require('./ReactMount');
+var ReactPerf = require('./ReactPerf');
+var ReactReconciler = require('./ReactReconciler');
+var ReactUpdates = require('./ReactUpdates');
+var ReactVersion = require('./ReactVersion');
+
+var findDOMNode = require('./findDOMNode');
+var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer');
+var warning = require('fbjs/lib/warning');
+
+ReactDefaultInjection.inject();
+
+var render = ReactPerf.measure('React', 'render', ReactMount.render);
+
+var React = {
+ findDOMNode: findDOMNode,
+ render: render,
+ unmountComponentAtNode: ReactMount.unmountComponentAtNode,
+ version: ReactVersion,
+
+ /* eslint-disable camelcase */
+ unstable_batchedUpdates: ReactUpdates.batchedUpdates,
+ unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
+};
+
+// Inject the runtime into a devtools global hook regardless of browser.
+// Allows for debugging when the hook is injected on the page.
+/* eslint-enable camelcase */
+if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
+ __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
+ CurrentOwner: ReactCurrentOwner,
+ InstanceHandles: ReactInstanceHandles,
+ Mount: ReactMount,
+ Reconciler: ReactReconciler,
+ TextComponent: ReactDOMTextComponent
+ });
+}
-var mapObject = require("./mapObject");
+if (process.env.NODE_ENV !== 'production') {
+ var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+ if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
+
+ // First check if devtools is not installed
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
+ // If we're in Chrome or Firefox, provide a download link if not installed.
+ if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
+ console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
+ }
+ }
-/**
- * Create a factory that creates HTML tag elements.
- *
- * @param {string} tag Tag name (e.g. `div`).
- * @private
- */
-function createDOMFactory(tag) {
- if ("production" !== process.env.NODE_ENV) {
- return ReactElementValidator.createFactory(tag);
+ // If we're in IE8, check to see if we are in compatibility mode and provide
+ // information on preventing compatibility mode
+ var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
+
+ process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
+
+ var expectedFeatures = [
+ // shims
+ Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
+
+ // shams
+ Object.create, Object.freeze];
+
+ for (var i = 0; i < expectedFeatures.length; i++) {
+ if (!expectedFeatures[i]) {
+ console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
+ break;
+ }
+ }
}
- return ReactElement.createFactory(tag);
}
-/**
- * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
- * This is also accessible via `React.DOM`.
- *
- * @public
- */
-var ReactDOM = mapObject({
- a: 'a',
- abbr: 'abbr',
- address: 'address',
- area: 'area',
- article: 'article',
- aside: 'aside',
- audio: 'audio',
- b: 'b',
- base: 'base',
- bdi: 'bdi',
- bdo: 'bdo',
- big: 'big',
- blockquote: 'blockquote',
- body: 'body',
- br: 'br',
- button: 'button',
- canvas: 'canvas',
- caption: 'caption',
- cite: 'cite',
- code: 'code',
- col: 'col',
- colgroup: 'colgroup',
- data: 'data',
- datalist: 'datalist',
- dd: 'dd',
- del: 'del',
- details: 'details',
- dfn: 'dfn',
- dialog: 'dialog',
- div: 'div',
- dl: 'dl',
- dt: 'dt',
- em: 'em',
- embed: 'embed',
- fieldset: 'fieldset',
- figcaption: 'figcaption',
- figure: 'figure',
- footer: 'footer',
- form: 'form',
- h1: 'h1',
- h2: 'h2',
- h3: 'h3',
- h4: 'h4',
- h5: 'h5',
- h6: 'h6',
- head: 'head',
- header: 'header',
- hr: 'hr',
- html: 'html',
- i: 'i',
- iframe: 'iframe',
- img: 'img',
- input: 'input',
- ins: 'ins',
- kbd: 'kbd',
- keygen: 'keygen',
- label: 'label',
- legend: 'legend',
- li: 'li',
- link: 'link',
- main: 'main',
- map: 'map',
- mark: 'mark',
- menu: 'menu',
- menuitem: 'menuitem',
- meta: 'meta',
- meter: 'meter',
- nav: 'nav',
- noscript: 'noscript',
- object: 'object',
- ol: 'ol',
- optgroup: 'optgroup',
- option: 'option',
- output: 'output',
- p: 'p',
- param: 'param',
- picture: 'picture',
- pre: 'pre',
- progress: 'progress',
- q: 'q',
- rp: 'rp',
- rt: 'rt',
- ruby: 'ruby',
- s: 's',
- samp: 'samp',
- script: 'script',
- section: 'section',
- select: 'select',
- small: 'small',
- source: 'source',
- span: 'span',
- strong: 'strong',
- style: 'style',
- sub: 'sub',
- summary: 'summary',
- sup: 'sup',
- table: 'table',
- tbody: 'tbody',
- td: 'td',
- textarea: 'textarea',
- tfoot: 'tfoot',
- th: 'th',
- thead: 'thead',
- time: 'time',
- title: 'title',
- tr: 'tr',
- track: 'track',
- u: 'u',
- ul: 'ul',
- 'var': 'var',
- video: 'video',
- wbr: 'wbr',
-
- // SVG
- circle: 'circle',
- clipPath: 'clipPath',
- defs: 'defs',
- ellipse: 'ellipse',
- g: 'g',
- line: 'line',
- linearGradient: 'linearGradient',
- mask: 'mask',
- path: 'path',
- pattern: 'pattern',
- polygon: 'polygon',
- polyline: 'polyline',
- radialGradient: 'radialGradient',
- rect: 'rect',
- stop: 'stop',
- svg: 'svg',
- text: 'text',
- tspan: 'tspan'
-
-}, createDOMFactory);
-
-module.exports = ReactDOM;
+module.exports = React;
\ No newline at end of file

lib/ReactDOM.native.js

@@ -0,0 +1,12 @@
+'use strict';
+
+var ReactUpdates = require('./ReactUpdates');
+
+// TODO: In React Native, ReactTestUtils depends on ./ReactDOM (for
+// renderIntoDocument, which should never be called) and Relay depends on
+// react-dom (for batching). Once those are fixed, nothing in RN should import
+// this module and this file can go away.
+
+module.exports = {
+ unstable_batchedUpdates: ReactUpdates.batchedUpdates,
+};

lib/ReactDOMOption.js

@@ -11,38 +11,79 @@
'use strict';
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
+var ReactChildren = require('./ReactChildren');
+var ReactDOMSelect = require('./ReactDOMSelect');
-var warning = require("./warning");
+var assign = require('./Object.assign');
+var warning = require('fbjs/lib/warning');
-var option = ReactElement.createFactory('option');
+var valueContextKey = ReactDOMSelect.valueContextKey;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
-var ReactDOMOption = ReactClass.createClass({
- displayName: 'ReactDOMOption',
- tagName: 'OPTION',
+var ReactDOMOption = {
+ mountWrapper: function (inst, props, context) {
+ // TODO (yungsters): Remove support for `selected` in <option>.
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
+ }
- mixins: [ReactBrowserComponentMixin],
+ // Look up whether this option is 'selected' via context
+ var selectValue = context[valueContextKey];
- componentWillMount: function() {
- // TODO (yungsters): Remove support for `selected` in <option>.
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- this.props.selected == null,
- 'Use the `defaultValue` or `value` props on <select> instead of ' +
- 'setting `selected` on <option>.'
- ) : null);
+ // If context key is null (e.g., no specified value or after initial mount)
+ // or missing (e.g., for <datalist>), we don't change props.selected
+ var selected = null;
+ if (selectValue != null) {
+ selected = false;
+ if (Array.isArray(selectValue)) {
+ // multiple
+ for (var i = 0; i < selectValue.length; i++) {
+ if ('' + selectValue[i] === '' + props.value) {
+ selected = true;
+ break;
+ }
}
+ } else {
+ selected = '' + selectValue === '' + props.value;
+ }
+ }
+
+ inst._wrapperState = { selected: selected };
},
- render: function() {
- return option(this.props, this.props.children);
+ getNativeProps: function (inst, props, context) {
+ var nativeProps = assign({ selected: undefined, children: undefined }, props);
+
+ // Read state only from initial mount because <select> updates value
+ // manually; we need the initial state only for server rendering
+ if (inst._wrapperState.selected != null) {
+ nativeProps.selected = inst._wrapperState.selected;
+ }
+
+ var content = '';
+
+ // Flatten children and warn if they aren't strings or numbers;
+ // invalid types are ignored.
+ ReactChildren.forEach(props.children, function (child) {
+ if (child == null) {
+ return;
+ }
+ if (typeof child === 'string' || typeof child === 'number') {
+ content += child;
+ } else {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
+ }
+ });
+
+ if (content) {
+ nativeProps.children = content;
+ }
+
+ return nativeProps;
}
-});
+};
module.exports = ReactDOMOption;

lib/ReactDOMSelection.js

@@ -11,10 +11,10 @@
'use strict';
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
-var getNodeForCharacterOffset = require("./getNodeForCharacterOffset");
-var getTextContentAccessor = require("./getTextContentAccessor");
+var getNodeForCharacterOffset = require('./getNodeForCharacterOffset');
+var getTextContentAccessor = require('./getTextContentAccessor');
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
@@ -76,15 +76,26 @@
var currentRange = selection.getRangeAt(0);
+ // In Firefox, range.startContainer and range.endContainer can be "anonymous
+ // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
+ // divs do not seem to expose properties, triggering a "Permission denied
+ // error" if any of its properties are accessed. The only seemingly possible
+ // way to avoid erroring is to access a property that typically works for
+ // non-anonymous divs and catch any error that may otherwise arise. See
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
+ try {
+ /* eslint-disable no-unused-expressions */
+ currentRange.startContainer.nodeType;
+ currentRange.endContainer.nodeType;
+ /* eslint-enable no-unused-expressions */
+ } catch (e) {
+ return null;
+ }
+
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
- var isSelectionCollapsed = isCollapsed(
- selection.anchorNode,
- selection.anchorOffset,
- selection.focusNode,
- selection.focusOffset
- );
+ var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
@@ -92,12 +103,7 @@
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
- var isTempRangeCollapsed = isCollapsed(
- tempRange.startContainer,
- tempRange.startOffset,
- tempRange.endContainer,
- tempRange.endOffset
- );
+ var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
@@ -160,8 +166,7 @@
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
- var end = typeof offsets.end === 'undefined' ?
- start : Math.min(offsets.end, length);
+ var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
@@ -189,11 +194,7 @@
}
}
-var useIEOffsets = (
- ExecutionEnvironment.canUseDOM &&
- 'selection' in document &&
- !('getSelection' in window)
-);
+var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**

lib/ReactDOMSelect.js

@@ -11,68 +11,77 @@
'use strict';
-var AutoFocusMixin = require("./AutoFocusMixin");
-var LinkedValueUtils = require("./LinkedValueUtils");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-var ReactUpdates = require("./ReactUpdates");
+var LinkedValueUtils = require('./LinkedValueUtils');
+var ReactMount = require('./ReactMount');
+var ReactUpdates = require('./ReactUpdates');
-var assign = require("./Object.assign");
+var assign = require('./Object.assign');
+var warning = require('fbjs/lib/warning');
-var select = ReactElement.createFactory('select');
+var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
function updateOptionsIfPendingUpdateAndMounted() {
- /*jshint validthis:true */
- if (this._pendingUpdate) {
- this._pendingUpdate = false;
- var value = LinkedValueUtils.getValue(this);
- if (value != null && this.isMounted()) {
- updateOptions(this, value);
+ if (this._rootNodeID && this._wrapperState.pendingUpdate) {
+ this._wrapperState.pendingUpdate = false;
+
+ var props = this._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
+
+ if (value != null) {
+ updateOptions(this, Boolean(props.multiple), value);
+ }
+ }
+}
+
+function getDeclarationErrorAddendum(owner) {
+ if (owner) {
+ var name = owner.getName();
+ if (name) {
+ return ' Check the render method of `' + name + '`.';
}
}
+ return '';
}
+var valuePropNames = ['value', 'defaultValue'];
+
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
-function selectValueType(props, propName, componentName) {
+function checkSelectPropTypes(inst, props) {
+ var owner = inst._currentElement._owner;
+ LinkedValueUtils.checkPropTypes('select', props, owner);
+
+ for (var i = 0; i < valuePropNames.length; i++) {
+ var propName = valuePropNames[i];
if (props[propName] == null) {
- return null;
+ continue;
}
if (props.multiple) {
- if (!Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be an array if ") +
- ("`multiple` is true.")
- );
- }
+ process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
} else {
- if (Array.isArray(props[propName])) {
- return new Error(
- ("The `" + propName + "` prop supplied to <select> must be a scalar ") +
- ("value if `multiple` is false.")
- );
+ process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
}
}
}
/**
- * @param {ReactComponent} component Instance of ReactDOMSelect
+ * @param {ReactDOMComponent} inst
+ * @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
-function updateOptions(component, propValue) {
- var selectedValue, i, l;
- var options = component.getDOMNode().options;
+function updateOptions(inst, multiple, propValue) {
+ var selectedValue, i;
+ var options = ReactMount.getNode(inst._rootNodeID).options;
- if (component.props.multiple) {
+ if (multiple) {
selectedValue = {};
- for (i = 0, l = propValue.length; i < l; i++) {
+ for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
@@ -82,7 +91,7 @@
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
- for (i = 0, l = options.length; i < l; i++) {
+ for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
@@ -109,68 +118,71 @@
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
-var ReactDOMSelect = ReactClass.createClass({
- displayName: 'ReactDOMSelect',
- tagName: 'SELECT',
-
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
-
- propTypes: {
- defaultValue: selectValueType,
- value: selectValueType
- },
+var ReactDOMSelect = {
+ valueContextKey: valueContextKey,
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
+ getNativeProps: function (inst, props, context) {
+ return assign({}, props, {
+ onChange: inst._wrapperState.onChange,
+ value: undefined
+ });
+ },
- props.onChange = this._handleChange;
- props.value = null;
+ mountWrapper: function (inst, props) {
+ if (process.env.NODE_ENV !== 'production') {
+ checkSelectPropTypes(inst, props);
+ }
- return select(props, this.props.children);
+ var value = LinkedValueUtils.getValue(props);
+ inst._wrapperState = {
+ pendingUpdate: false,
+ initialValue: value != null ? value : props.defaultValue,
+ onChange: _handleChange.bind(inst),
+ wasMultiple: Boolean(props.multiple)
+ };
},
- componentWillMount: function() {
- this._pendingUpdate = false;
+ processChildContext: function (inst, props, context) {
+ // Pass down initial value so initial generated markup has correct
+ // `selected` attributes
+ var childContext = assign({}, context);
+ childContext[valueContextKey] = inst._wrapperState.initialValue;
+ return childContext;
},
- componentDidMount: function() {
- var value = LinkedValueUtils.getValue(this);
- if (value != null) {
- updateOptions(this, value);
- } else if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
- }
- },
+ postUpdateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+
+ // After the initial mount, we control selected-ness manually so don't pass
+ // the context value down
+ inst._wrapperState.initialValue = undefined;
+
+ var wasMultiple = inst._wrapperState.wasMultiple;
+ inst._wrapperState.wasMultiple = Boolean(props.multiple);
- componentDidUpdate: function(prevProps) {
- var value = LinkedValueUtils.getValue(this);
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- this._pendingUpdate = false;
- updateOptions(this, value);
- } else if (!prevProps.multiple !== !this.props.multiple) {
+ inst._wrapperState.pendingUpdate = false;
+ updateOptions(inst, Boolean(props.multiple), value);
+ } else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
- if (this.props.defaultValue != null) {
- updateOptions(this, this.props.defaultValue);
+ if (props.defaultValue != null) {
+ updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
- updateOptions(this, this.props.multiple ? [] : '');
+ updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
- this._pendingUpdate = true;
+ this._wrapperState.pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMSelect;

lib/ReactDOMServer.js

@@ -0,0 +1,26 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMServer
+ */
+
+'use strict';
+
+var ReactDefaultInjection = require('./ReactDefaultInjection');
+var ReactServerRendering = require('./ReactServerRendering');
+var ReactVersion = require('./ReactVersion');
+
+ReactDefaultInjection.inject();
+
+var ReactDOMServer = {
+ renderToString: ReactServerRendering.renderToString,
+ renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
+ version: ReactVersion
+};
+
+module.exports = ReactDOMServer;
\ No newline at end of file

lib/ReactDOMTextarea.js

@@ -11,25 +11,18 @@
'use strict';
-var AutoFocusMixin = require("./AutoFocusMixin");
-var DOMPropertyOperations = require("./DOMPropertyOperations");
-var LinkedValueUtils = require("./LinkedValueUtils");
-var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
-var ReactClass = require("./ReactClass");
-var ReactElement = require("./ReactElement");
-var ReactUpdates = require("./ReactUpdates");
-
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
-
-var warning = require("./warning");
-
-var textarea = ReactElement.createFactory('textarea');
+var LinkedValueUtils = require('./LinkedValueUtils');
+var ReactDOMIDOperations = require('./ReactDOMIDOperations');
+var ReactUpdates = require('./ReactUpdates');
+
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
function forceUpdateIfMounted() {
- /*jshint validthis:true */
- if (this.isMounted()) {
- this.forceUpdate();
+ if (this._rootNodeID) {
+ // DOM component is still mounted; update
+ ReactDOMTextarea.updateWrapper(this);
}
}
@@ -48,33 +41,37 @@
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
-var ReactDOMTextarea = ReactClass.createClass({
- displayName: 'ReactDOMTextarea',
- tagName: 'TEXTAREA',
+var ReactDOMTextarea = {
+ getNativeProps: function (inst, props, context) {
+ !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
- mixins: [AutoFocusMixin, LinkedValueUtils.Mixin, ReactBrowserComponentMixin],
+ // Always set children to the same thing. In IE9, the selection range will
+ // get reset if `textContent` is mutated.
+ var nativeProps = assign({}, props, {
+ defaultValue: undefined,
+ value: undefined,
+ children: inst._wrapperState.initialValue,
+ onChange: inst._wrapperState.onChange
+ });
- getInitialState: function() {
- var defaultValue = this.props.defaultValue;
+ return nativeProps;
+ },
+
+ mountWrapper: function (inst, props) {
+ if (process.env.NODE_ENV !== 'production') {
+ LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
+ }
+
+ var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
- var children = this.props.children;
+ var children = props.children;
if (children != null) {
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Use the `defaultValue` or `value` props instead of setting ' +
- 'children on <textarea>.'
- ) : null);
- }
- ("production" !== process.env.NODE_ENV ? invariant(
- defaultValue == null,
- 'If you supply `defaultValue` on a <textarea>, do not pass children.'
- ) : invariant(defaultValue == null));
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
+ }
+ !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
if (Array.isArray(children)) {
- ("production" !== process.env.NODE_ENV ? invariant(
- children.length <= 1,
- '<textarea> can only have at most one child.'
- ) : invariant(children.length <= 1));
+ !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
children = children[0];
}
@@ -83,54 +80,34 @@
if (defaultValue == null) {
defaultValue = '';
}
- var value = LinkedValueUtils.getValue(this);
- return {
+ var value = LinkedValueUtils.getValue(props);
+
+ inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
- initialValue: '' + (value != null ? value : defaultValue)
+ initialValue: '' + (value != null ? value : defaultValue),
+ onChange: _handleChange.bind(inst)
};
},
- render: function() {
- // Clone `this.props` so we don't mutate the input.
- var props = assign({}, this.props);
-
- ("production" !== process.env.NODE_ENV ? invariant(
- props.dangerouslySetInnerHTML == null,
- '`dangerouslySetInnerHTML` does not make sense on <textarea>.'
- ) : invariant(props.dangerouslySetInnerHTML == null));
-
- props.defaultValue = null;
- props.value = null;
- props.onChange = this._handleChange;
-
- // Always set children to the same thing. In IE9, the selection range will
- // get reset if `textContent` is mutated.
- return textarea(props, this.state.initialValue);
- },
-
- componentDidUpdate: function(prevProps, prevState, prevContext) {
- var value = LinkedValueUtils.getValue(this);
+ updateWrapper: function (inst) {
+ var props = inst._currentElement.props;
+ var value = LinkedValueUtils.getValue(props);
if (value != null) {
- var rootNode = this.getDOMNode();
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
- DOMPropertyOperations.setValueForProperty(rootNode, 'value', '' + value);
+ ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
- },
-
- _handleChange: function(event) {
- var returnValue;
- var onChange = LinkedValueUtils.getOnChange(this);
- if (onChange) {
- returnValue = onChange.call(this, event);
}
+};
+
+function _handleChange(event) {
+ var props = this._currentElement.props;
+ var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
- }
-
-});
+}
module.exports = ReactDOMTextarea;

lib/ReactDOMTextComponent.js

@@ -12,13 +12,15 @@
'use strict';
-var DOMPropertyOperations = require("./DOMPropertyOperations");
-var ReactComponentBrowserEnvironment =
- require("./ReactComponentBrowserEnvironment");
-var ReactDOMComponent = require("./ReactDOMComponent");
-
-var assign = require("./Object.assign");
-var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
+var DOMChildrenOperations = require('./DOMChildrenOperations');
+var DOMPropertyOperations = require('./DOMPropertyOperations');
+var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
+var ReactMount = require('./ReactMount');
+
+var assign = require('./Object.assign');
+var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
+var setTextContent = require('./setTextContent');
+var validateDOMNesting = require('./validateDOMNesting');
/**
* Text nodes violate a couple assumptions that React makes about components:
@@ -35,7 +37,7 @@
* @extends ReactComponent
* @internal
*/
-var ReactDOMTextComponent = function(props) {
+var ReactDOMTextComponent = function (props) {
// This constructor and its argument is currently used by mocks.
};
@@ -45,7 +47,7 @@
* @param {ReactText} text
* @internal
*/
- construct: function(text) {
+ construct: function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
@@ -64,8 +66,23 @@
* @return {string} Markup for this text node.
* @internal
*/
- mountComponent: function(rootID, transaction, context) {
+ mountComponent: function (rootID, transaction, context) {
+ if (process.env.NODE_ENV !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
this._rootNodeID = rootID;
+ if (transaction.useCreateElement) {
+ var ownerDocument = context[ReactMount.ownerDocumentContextKey];
+ var el = ownerDocument.createElement('span');
+ DOMPropertyOperations.setAttributeForID(el, rootID);
+ // Populate node cache
+ ReactMount.getID(el);
+ setTextContent(el, this._stringText);
+ return el;
+ } else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
@@ -75,11 +92,8 @@
return escapedText;
}
- return (
- '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' +
- escapedText +
- '</span>'
- );
+ return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
+ }
},
/**
@@ -89,7 +103,7 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- receiveComponent: function(nextText, transaction) {
+ receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
@@ -98,15 +112,13 @@
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
- ReactDOMComponent.BackendIDOperations.updateTextContentByID(
- this._rootNodeID,
- nextStringText
- );
+ var node = ReactMount.getNode(this._rootNodeID);
+ DOMChildrenOperations.updateTextContent(node, nextStringText);
}
}
},
- unmountComponent: function() {
+ unmountComponent: function () {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}

lib/ReactElement.js

@@ -11,142 +11,101 @@
'use strict';
-var ReactContext = require("./ReactContext");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
+var ReactCurrentOwner = require('./ReactCurrentOwner');
-var assign = require("./Object.assign");
-var warning = require("./warning");
+var assign = require('./Object.assign');
+var canDefineProperty = require('./canDefineProperty');
+
+// The Symbol used to tag the ReactElement type. If there is no native Symbol
+// nor polyfill, then a plain number is used for performance.
+var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
- ref: true
+ ref: true,
+ __self: true,
+ __source: true
};
/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} object
- * @param {string} key
- */
-function defineWarningProperty(object, key) {
- Object.defineProperty(object, key, {
-
- configurable: false,
- enumerable: true,
-
- get: function() {
- if (!this._store) {
- return null;
- }
- return this._store[key];
- },
-
- set: function(value) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Don\'t set the %s property of the React element. Instead, ' +
- 'specify the correct value when initially creating the element.',
- key
- ) : null);
- this._store[key] = value;
- }
-
- });
-}
-
-/**
- * This is updated to true if the membrane is successfully created.
- */
-var useMutationMembrane = false;
-
-/**
- * Warn for mutations.
- *
- * @internal
- * @param {object} element
- */
-function defineMutationMembrane(prototype) {
- try {
- var pseudoFrozenProperties = {
- props: true
- };
- for (var key in pseudoFrozenProperties) {
- defineWarningProperty(prototype, key);
- }
- useMutationMembrane = true;
- } catch (x) {
- // IE will fail on defineProperty
- }
-}
-
-/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
- * @param {string|object} ref
* @param {*} key
+ * @param {string|object} ref
+ * @param {*} self A *temporary* helper to detect places where `this` is
+ * different from the `owner` when React.createElement is called, so that we
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
+ * functions, and as long as `this` and owner are the same, there will be no
+ * change in behavior.
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
+ * indicating filename, line number, and/or other information.
+ * @param {*} owner
* @param {*} props
* @internal
*/
-var ReactElement = function(type, key, ref, owner, context, props) {
+var ReactElement = function (type, key, ref, self, source, owner, props) {
+ var element = {
+ // This tag allow us to uniquely identify this as a React Element
+ $$typeof: REACT_ELEMENT_TYPE,
+
// Built-in properties that belong on the element
- this.type = type;
- this.key = key;
- this.ref = ref;
+ type: type,
+ key: key,
+ ref: ref,
+ props: props,
// Record the component responsible for creating this element.
- this._owner = owner;
-
- // TODO: Deprecate withContext, and then the context becomes accessible
- // through the owner.
- this._context = context;
+ _owner: owner
+ };
- if ("production" !== process.env.NODE_ENV) {
- // The validation flag and props are currently mutative. We put them on
+ if (process.env.NODE_ENV !== 'production') {
+ // The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
- this._store = {props: props, originalProps: assign({}, props)};
+ element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
- try {
- Object.defineProperty(this._store, 'validated', {
+ if (canDefineProperty) {
+ Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
- writable: true
+ writable: true,
+ value: false
});
- } catch (x) {
- }
- this._store.validated = false;
-
- // We're not allowed to set props directly on the object so we early
- // return and rely on the prototype membrane to forward to the backing
- // store.
- if (useMutationMembrane) {
- Object.freeze(this);
- return;
+ // self and source are DEV only properties.
+ Object.defineProperty(element, '_self', {
+ configurable: false,
+ enumerable: false,
+ writable: false,
+ value: self
+ });
+ // Two elements created in two different places should be considered
+ // equal for testing purposes and therefore we hide it from enumeration.
+ Object.defineProperty(element, '_source', {
+ configurable: false,
+ enumerable: false,
+ writable: false,
+ value: source
+ });
+ } else {
+ element._store.validated = false;
+ element._self = self;
+ element._source = source;
}
+ Object.freeze(element.props);
+ Object.freeze(element);
}
- this.props = props;
+ return element;
};
-// We intentionally don't expose the function on the constructor property.
-// ReactElement should be indistinguishable from a plain object.
-ReactElement.prototype = {
- _isReactElement: true
-};
-
-if ("production" !== process.env.NODE_ENV) {
- defineMutationMembrane(ReactElement.prototype);
-}
-
-ReactElement.createElement = function(type, config, children) {
+ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
@@ -154,14 +113,17 @@
var key = null;
var ref = null;
+ var self = null;
+ var source = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
+ self = config.__self === undefined ? null : config.__self;
+ source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -190,20 +152,13 @@
}
}
- return new ReactElement(
- type,
- key,
- ref,
- ReactCurrentOwner.current,
- ReactContext.current,
- props
- );
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
-ReactElement.createFactory = function(type) {
+ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
- // easily accessed on elements. E.g. <Foo />.type === Foo.type.
+ // easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
@@ -211,17 +166,16 @@
return factory;
};
-ReactElement.cloneAndReplaceProps = function(oldElement, newProps) {
- var newElement = new ReactElement(
- oldElement.type,
- oldElement.key,
- oldElement.ref,
- oldElement._owner,
- oldElement._context,
- newProps
- );
+ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
+ var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
- if ("production" !== process.env.NODE_ENV) {
+ return newElement;
+};
+
+ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
+ var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
+
+ if (process.env.NODE_ENV !== 'production') {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
@@ -225,10 +179,11 @@
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
+
return newElement;
};
-ReactElement.cloneElement = function(element, config, children) {
+ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
@@ -237,6 +192,12 @@
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
+ // Self is preserved since the owner is preserved.
+ var self = element._self;
+ // Source is preserved since cloneElement is unlikely to be targeted by a
+ // transpiler, and the original source is probably a better indicator of the
+ // true owner.
+ var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
@@ -252,8 +213,7 @@
}
// Remaining properties override existing props
for (propName in config) {
- if (config.hasOwnProperty(propName) &&
- !RESERVED_PROPS.hasOwnProperty(propName)) {
+ if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
@@ -272,14 +232,7 @@
props.children = childArray;
}
- return new ReactElement(
- element.type,
- key,
- ref,
- owner,
- element._context,
- props
- );
+ return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
@@ -287,18 +240,8 @@
* @return {boolean} True if `object` is a valid component.
* @final
*/
-ReactElement.isValidElement = function(object) {
- // ReactTestUtils is often used outside of beforeEach where as React is
- // within it. This leads to two different instances of React on the same
- // page. To identify a element from a different React instance we use
- // a flag instead of an instanceof check.
- var isElement = !!(object && object._isReactElement);
- // if (isElement && !(object instanceof ReactElement)) {
- // This is an indicator that you're using multiple versions of React at the
- // same time. This will screw with ownership and stuff. Fix it, please.
- // TODO: We could possibly warn here.
- // }
- return isElement;
+ReactElement.isValidElement = function (object) {
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;

lib/ReactElementValidator.js

@@ -18,16 +18,15 @@
'use strict';
-var ReactElement = require("./ReactElement");
-var ReactFragment = require("./ReactFragment");
-var ReactPropTypeLocations = require("./ReactPropTypeLocations");
-var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactNativeComponent = require("./ReactNativeComponent");
-
-var getIteratorFn = require("./getIteratorFn");
-var invariant = require("./invariant");
-var warning = require("./warning");
+var ReactElement = require('./ReactElement');
+var ReactPropTypeLocations = require('./ReactPropTypeLocations');
+var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+
+var canDefineProperty = require('./canDefineProperty');
+var getIteratorFn = require('./getIteratorFn');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
@@ -48,39 +47,6 @@
var loggedTypeFailures = {};
-var NUMERIC_PROPERTY_REGEX = /^\d+$/;
-
-/**
- * Gets the instance's name for use in warnings.
- *
- * @internal
- * @return {?string} Display name or undefined
- */
-function getName(instance) {
- var publicInstance = instance && instance.getPublicInstance();
- if (!publicInstance) {
- return undefined;
- }
- var constructor = publicInstance.constructor;
- if (!constructor) {
- return undefined;
- }
- return constructor.displayName || constructor.name || undefined;
-}
-
-/**
- * Gets the current owner's displayName for use in warnings.
- *
- * @internal
- * @return {?string} Display name or undefined
- */
-function getCurrentOwnerDisplayName() {
- var current = ReactCurrentOwner.current;
- return (
- current && getName(current) || undefined
- );
-}
-
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
@@ -92,84 +58,59 @@
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
- if (element._store.validated || element.key != null) {
+ if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
- warnAndMonitorForKeyUse(
- 'Each child in an array or iterator should have a unique "key" prop.',
- element,
- parentType
- );
-}
-
-/**
- * Warn if the key is being defined as an object property but has an incorrect
- * value.
- *
- * @internal
- * @param {string} name Property name of the key.
- * @param {ReactElement} element Component that requires a key.
- * @param {*} parentType element's parent's type.
- */
-function validatePropertyKey(name, element, parentType) {
- if (!NUMERIC_PROPERTY_REGEX.test(name)) {
+ var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
+ if (addenda === null) {
+ // we already showed the warning
return;
}
- warnAndMonitorForKeyUse(
- 'Child objects should have non-numeric keys so ordering is preserved.',
- element,
- parentType
- );
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
- * @param {string} message The base warning that gets output.
+ * @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
+ * @returns {?object} A set of addenda to use in the warning message, or null
+ * if the warning has already been shown before (and shouldn't be shown again).
*/
-function warnAndMonitorForKeyUse(message, element, parentType) {
- var ownerName = getCurrentOwnerDisplayName();
- var parentName = typeof parentType === 'string' ?
- parentType : parentType.displayName || parentType.name;
-
- var useName = ownerName || parentName;
- var memoizer = ownerHasKeyUseWarning[message] || (
- (ownerHasKeyUseWarning[message] = {})
- );
- if (memoizer.hasOwnProperty(useName)) {
- return;
+function getAddendaForKeyUse(messageType, element, parentType) {
+ var addendum = getDeclarationErrorAddendum();
+ if (!addendum) {
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
+ if (parentName) {
+ addendum = ' Check the top-level render call using <' + parentName + '>.';
+ }
+ }
+
+ var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
+ if (memoizer[addendum]) {
+ return null;
}
- memoizer[useName] = true;
+ memoizer[addendum] = true;
- var parentOrOwnerAddendum =
- ownerName ? (" Check the render method of " + ownerName + ".") :
- parentName ? (" Check the React.render call using <" + parentName + ">.") :
- '';
+ var addenda = {
+ parentOrOwner: addendum,
+ url: ' See https://fb.me/react-warning-keys for more information.',
+ childOwner: null
+ };
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
- var childOwnerAddendum = '';
- if (element &&
- element._owner &&
- element._owner !== ReactCurrentOwner.current) {
- // Name of the component that originally created this child.
- var childOwnerName = getName(element._owner);
-
- childOwnerAddendum = (" It was passed a child from " + childOwnerName + ".");
- }
-
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- message + '%s%s See https://fb.me/react-warning-keys for more information.',
- parentOrOwnerAddendum,
- childOwnerAddendum
- ) : null);
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
+ // Give the component that originally created this child.
+ addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
+ }
+
+ return addenda;
}
/**
@@ -182,6 +123,9 @@
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
+ if (typeof node !== 'object') {
+ return;
+ }
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
@@ -191,7 +135,9 @@
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
+ if (node._store) {
node._store.validated = true;
+ }
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
@@ -205,13 +151,6 @@
}
}
}
- } else if (typeof node === 'object') {
- var fragment = ReactFragment.extractIfFragment(node);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- validatePropertyKey(key, fragment[key], parentType);
- }
- }
}
}
}
@@ -235,109 +174,19 @@
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof propTypes[propName] === 'function',
- '%s: %s type `%s` is invalid; it must be a function, usually from ' +
- 'React.PropTypes.',
- componentName || 'React class',
- ReactPropTypeLocationNames[location],
- propName
- ) : invariant(typeof propTypes[propName] === 'function'));
- error = propTypes[propName](props, propName, componentName, location);
+ !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
+ error = propTypes[propName](props, propName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error = ex;
}
+ process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
- var addendum = getDeclarationErrorAddendum(this);
- ("production" !== process.env.NODE_ENV ? warning(false, 'Failed propType: %s%s', error.message, addendum) : null);
- }
- }
- }
-}
-
-var warnedPropsMutations = {};
-
-/**
- * Warn about mutating props when setting `propName` on `element`.
- *
- * @param {string} propName The string key within props that was set
- * @param {ReactElement} element
- */
-function warnForPropsMutation(propName, element) {
- var type = element.type;
- var elementName = typeof type === 'string' ? type : type.displayName;
- var ownerName = element._owner ?
- element._owner.getPublicInstance().constructor.displayName : null;
-
- var warningKey = propName + '|' + elementName + '|' + ownerName;
- if (warnedPropsMutations.hasOwnProperty(warningKey)) {
- return;
- }
- warnedPropsMutations[warningKey] = true;
-
- var elementInfo = '';
- if (elementName) {
- elementInfo = ' <' + elementName + ' />';
- }
- var ownerInfo = '';
- if (ownerName) {
- ownerInfo = ' The element was created by ' + ownerName + '.';
- }
-
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Don\'t set .props.%s of the React component%s. Instead, specify the ' +
- 'correct value when initially creating the element or use ' +
- 'React.cloneElement to make a new element with updated props.%s',
- propName,
- elementInfo,
- ownerInfo
- ) : null);
-}
-
-// Inline Object.is polyfill
-function is(a, b) {
- if (a !== a) {
- // NaN
- return b !== b;
- }
- if (a === 0 && b === 0) {
- // +-0
- return 1 / a === 1 / b;
- }
- return a === b;
-}
-
-/**
- * Given an element, check if its props have been mutated since element
- * creation (or the last call to this function). In particular, check if any
- * new props have been added, which we can't directly catch by defining warning
- * properties on the props object.
- *
- * @param {ReactElement} element
- */
-function checkAndWarnForMutatedProps(element) {
- if (!element._store) {
- // Element was created using `new ReactElement` directly or with
- // `ReactElement.createElement`; skip mutation checking
- return;
- }
-
- var originalProps = element._store.originalProps;
- var props = element.props;
-
- for (var propName in props) {
- if (props.hasOwnProperty(propName)) {
- if (!originalProps.hasOwnProperty(propName) ||
- !is(originalProps[propName], props[propName])) {
- warnForPropsMutation(propName, element);
-
- // Copy over the new value so that the two props objects match again
- originalProps[propName] = props[propName];
+ var addendum = getDeclarationErrorAddendum();
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
}
}
}
@@ -350,48 +199,26 @@
* @param {ReactElement} element
*/
function validatePropTypes(element) {
- if (element.type == null) {
- // This has already warned. Don't throw.
+ var componentClass = element.type;
+ if (typeof componentClass !== 'function') {
return;
}
- // Extract the component class from the element. Converts string types
- // to a composite class which may have propTypes.
- // TODO: Validating a string's propTypes is not decoupled from the
- // rendering target which is problematic.
- var componentClass = ReactNativeComponent.getComponentClassForElement(
- element
- );
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
- checkPropTypes(
- name,
- componentClass.propTypes,
- element.props,
- ReactPropTypeLocations.prop
- );
+ checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
- ("production" !== process.env.NODE_ENV ? warning(
- componentClass.getDefaultProps.isReactClassApproved,
- 'getDefaultProps is only used on classic React.createClass ' +
- 'definitions. Use a static property named `defaultProps` instead.'
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
}
}
var ReactElementValidator = {
- checkAndWarnForMutatedProps: checkAndWarnForMutatedProps,
-
- createElement: function(type, props, children) {
+ createElement: function (type, props, children) {
+ var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
- ("production" !== process.env.NODE_ENV ? warning(
- type != null,
- 'React.createElement: type should not be null or undefined. It should ' +
- 'be a string (for DOM elements) or a ReactClass (for composite ' +
- 'components).'
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
var element = ReactElement.createElement.apply(this, arguments);
@@ -401,45 +228,39 @@
return element;
}
+ // Skip key warning if the type isn't valid since our key validation logic
+ // doesn't expect a non-string/function type and can throw confusing errors.
+ // We don't want exception behavior to differ between dev and prod.
+ // (Rendering will throw with a helpful message and as soon as the type is
+ // fixed, the key warnings will appear.)
+ if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
+ }
validatePropTypes(element);
return element;
},
- createFactory: function(type) {
- var validatedFactory = ReactElementValidator.createElement.bind(
- null,
- type
- );
+ createFactory: function (type) {
+ var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
- if ("production" !== process.env.NODE_ENV) {
- try {
- Object.defineProperty(
- validatedFactory,
- 'type',
- {
+ if (process.env.NODE_ENV !== 'production') {
+ if (canDefineProperty) {
+ Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
- get: function() {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'Factory.type is deprecated. Access the class directly ' +
- 'before passing it to createFactory.'
- ) : null);
+ get: function () {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
- }
- );
- } catch (x) {
- // IE will fail on defineProperty (es5-shim/sham too)
+ });
}
}
@@ -443,11 +264,10 @@
}
}
-
return validatedFactory;
},
- cloneElement: function(element, props, children) {
+ cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);

lib/ReactEmptyComponent.js

@@ -11,81 +11,45 @@
'use strict';
-var ReactElement = require("./ReactElement");
-var ReactInstanceMap = require("./ReactInstanceMap");
+var ReactElement = require('./ReactElement');
+var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
+var ReactReconciler = require('./ReactReconciler');
-var invariant = require("./invariant");
+var assign = require('./Object.assign');
-var component;
-// This registry keeps track of the React IDs of the components that rendered to
-// `null` (in reality a placeholder such as `noscript`)
-var nullComponentIDsRegistry = {};
+var placeholderElement;
var ReactEmptyComponentInjection = {
- injectEmptyComponent: function(emptyComponent) {
- component = ReactElement.createFactory(emptyComponent);
+ injectEmptyComponent: function (component) {
+ placeholderElement = ReactElement.createElement(component);
}
};
-var ReactEmptyComponentType = function() {};
-ReactEmptyComponentType.prototype.componentDidMount = function() {
- var internalInstance = ReactInstanceMap.get(this);
- // TODO: Make sure we run these methods in the correct order, we shouldn't
- // need this check. We're going to assume if we're here it means we ran
- // componentWillUnmount already so there is no internal instance (it gets
- // removed as part of the unmounting process).
- if (!internalInstance) {
- return;
- }
- registerNullComponentID(internalInstance._rootNodeID);
-};
-ReactEmptyComponentType.prototype.componentWillUnmount = function() {
- var internalInstance = ReactInstanceMap.get(this);
- // TODO: Get rid of this check. See TODO in componentDidMount.
- if (!internalInstance) {
- return;
- }
- deregisterNullComponentID(internalInstance._rootNodeID);
-};
-ReactEmptyComponentType.prototype.render = function() {
- ("production" !== process.env.NODE_ENV ? invariant(
- component,
- 'Trying to return null from a render, but no null placeholder component ' +
- 'was injected.'
- ) : invariant(component));
- return component();
-};
-
-var emptyElement = ReactElement.createElement(ReactEmptyComponentType);
-
-/**
- * Mark the component as having rendered to null.
- * @param {string} id Component's `_rootNodeID`.
- */
-function registerNullComponentID(id) {
- nullComponentIDsRegistry[id] = true;
+function registerNullComponentID() {
+ ReactEmptyComponentRegistry.registerNullComponentID(this._rootNodeID);
}
-/**
- * Unmark the component as having rendered to null: it renders to something now.
- * @param {string} id Component's `_rootNodeID`.
- */
-function deregisterNullComponentID(id) {
- delete nullComponentIDsRegistry[id];
-}
-
-/**
- * @param {string} id Component's `_rootNodeID`.
- * @return {boolean} True if the component is rendered to null.
- */
-function isNullComponentID(id) {
- return !!nullComponentIDsRegistry[id];
-}
-
-var ReactEmptyComponent = {
- emptyElement: emptyElement,
- injection: ReactEmptyComponentInjection,
- isNullComponentID: isNullComponentID
+var ReactEmptyComponent = function (instantiate) {
+ this._currentElement = null;
+ this._rootNodeID = null;
+ this._renderedComponent = instantiate(placeholderElement);
};
+assign(ReactEmptyComponent.prototype, {
+ construct: function (element) {},
+ mountComponent: function (rootID, transaction, context) {
+ transaction.getReactMountReady().enqueue(registerNullComponentID, this);
+ this._rootNodeID = rootID;
+ return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
+ },
+ receiveComponent: function () {},
+ unmountComponent: function (rootID, transaction, context) {
+ ReactReconciler.unmountComponent(this._renderedComponent);
+ ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
+ this._rootNodeID = null;
+ this._renderedComponent = null;
+ }
+});
+
+ReactEmptyComponent.injection = ReactEmptyComponentInjection;
module.exports = ReactEmptyComponent;

lib/ReactEmptyComponentRegistry.js

@@ -0,0 +1,48 @@
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactEmptyComponentRegistry
+ */
+
+'use strict';
+
+// This registry keeps track of the React IDs of the components that rendered to
+// `null` (in reality a placeholder such as `noscript`)
+var nullComponentIDsRegistry = {};
+
+/**
+ * @param {string} id Component's `_rootNodeID`.
+ * @return {boolean} True if the component is rendered to null.
+ */
+function isNullComponentID(id) {
+ return !!nullComponentIDsRegistry[id];
+}
+
+/**
+ * Mark the component as having rendered to null.
+ * @param {string} id Component's `_rootNodeID`.
+ */
+function registerNullComponentID(id) {
+ nullComponentIDsRegistry[id] = true;
+}
+
+/**
+ * Unmark the component as having rendered to null: it renders to something now.
+ * @param {string} id Component's `_rootNodeID`.
+ */
+function deregisterNullComponentID(id) {
+ delete nullComponentIDsRegistry[id];
+}
+
+var ReactEmptyComponentRegistry = {
+ isNullComponentID: isNullComponentID,
+ registerNullComponentID: registerNullComponentID,
+ deregisterNullComponentID: deregisterNullComponentID
+};
+
+module.exports = ReactEmptyComponentRegistry;
\ No newline at end of file

lib/ReactErrorUtils.js

@@ -10,21 +10,68 @@
* @typechecks
*/
-"use strict";
+'use strict';
+
+var caughtError = null;
+
+/**
+ * Call a function while guarding against errors that happens within it.
+ *
+ * @param {?String} name of the guard to use for logging or debugging
+ * @param {Function} func The function to invoke
+ * @param {*} a First argument
+ * @param {*} b Second argument
+ */
+function invokeGuardedCallback(name, func, a, b) {
+ try {
+ return func(a, b);
+ } catch (x) {
+ if (caughtError === null) {
+ caughtError = x;
+ }
+ return undefined;
+ }
+}
var ReactErrorUtils = {
+ invokeGuardedCallback: invokeGuardedCallback,
+
/**
- * Creates a guarded version of a function. This is supposed to make debugging
- * of event handlers easier. To aid debugging with the browser's debugger,
- * this currently simply returns the original function.
- *
- * @param {function} func Function to be executed
- * @param {string} name The name of the guard
- * @return {function}
+ * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
+ * handler are sure to be rethrown by rethrowCaughtError.
*/
- guard: function(func, name) {
- return func;
+ invokeGuardedCallbackWithCatch: invokeGuardedCallback,
+
+ /**
+ * During execution of guarded functions we will capture the first error which
+ * we will rethrow to be handled by the top level error handler.
+ */
+ rethrowCaughtError: function () {
+ if (caughtError) {
+ var error = caughtError;
+ caughtError = null;
+ throw error;
+ }
}
};
+if (process.env.NODE_ENV !== 'production') {
+ /**
+ * To help development we can get better devtools integration by simulating a
+ * real browser event.
+ */
+ if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
+ var fakeNode = document.createElement('react');
+ ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
+ var boundFunc = func.bind(null, a, b);
+ var evtType = 'react-' + name;
+ fakeNode.addEventListener(evtType, boundFunc, false);
+ var evt = document.createEvent('Event');
+ evt.initEvent(evtType, false, false);
+ fakeNode.dispatchEvent(evt);
+ fakeNode.removeEventListener(evtType, boundFunc, false);
+ };
+ }
+}
+
module.exports = ReactErrorUtils;

lib/ReactEventEmitterMixin.js

@@ -11,11 +11,11 @@
'use strict';
-var EventPluginHub = require("./EventPluginHub");
+var EventPluginHub = require('./EventPluginHub');
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
@@ -29,18 +29,8 @@
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
- handleTopLevel: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
- var events = EventPluginHub.extractEvents(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent
- );
-
+ handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};

lib/ReactEventListener.js

@@ -12,16 +12,18 @@
'use strict';
-var EventListener = require("./EventListener");
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-var PooledClass = require("./PooledClass");
-var ReactInstanceHandles = require("./ReactInstanceHandles");
-var ReactMount = require("./ReactMount");
-var ReactUpdates = require("./ReactUpdates");
-
-var assign = require("./Object.assign");
-var getEventTarget = require("./getEventTarget");
-var getUnboundedScrollPosition = require("./getUnboundedScrollPosition");
+var EventListener = require('fbjs/lib/EventListener');
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var PooledClass = require('./PooledClass');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+var ReactMount = require('./ReactMount');
+var ReactUpdates = require('./ReactUpdates');
+
+var assign = require('./Object.assign');
+var getEventTarget = require('./getEventTarget');
+var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
+
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* Finds the parent React component of `node`.
@@ -48,21 +50,32 @@
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
- destructor: function() {
+ destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
-PooledClass.addPoolingTo(
- TopLevelCallbackBookKeeping,
- PooledClass.twoArgumentPooler
-);
+PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
- var topLevelTarget = ReactMount.getFirstReactDOM(
- getEventTarget(bookKeeping.nativeEvent)
- ) || window;
+ // TODO: Re-enable event.path handling
+ //
+ // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
+ // // New browsers have a path attribute on native events
+ // handleTopLevelWithPath(bookKeeping);
+ // } else {
+ // // Legacy browsers don't have a path attribute on native events
+ // handleTopLevelWithoutPath(bookKeeping);
+ // }
+
+ void handleTopLevelWithPath; // temporarily unused
+ handleTopLevelWithoutPath(bookKeeping);
+}
+
+// Legacy browsers don't have a path attribute on native events
+function handleTopLevelWithoutPath(bookKeeping) {
+ var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
@@ -74,15 +87,44 @@
ancestor = findParent(ancestor);
}
- for (var i = 0, l = bookKeeping.ancestors.length; i < l; i++) {
+ for (var i = 0; i < bookKeeping.ancestors.length; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
- ReactEventListener._handleTopLevel(
- bookKeeping.topLevelType,
- topLevelTarget,
- topLevelTargetID,
- bookKeeping.nativeEvent
- );
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
+ }
+}
+
+// New browsers have a path attribute on native events
+function handleTopLevelWithPath(bookKeeping) {
+ var path = bookKeeping.nativeEvent.path;
+ var currentNativeTarget = path[0];
+ var eventsFired = 0;
+ for (var i = 0; i < path.length; i++) {
+ var currentPathElement = path[i];
+ if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
+ currentNativeTarget = path[i + 1];
+ }
+ // TODO: slow
+ var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
+ if (reactParent === currentPathElement) {
+ var currentPathElementID = ReactMount.getID(currentPathElement);
+ var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
+ bookKeeping.ancestors.push(currentPathElement);
+
+ var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
+ eventsFired++;
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
+
+ // Jump to the root of this React render tree
+ while (currentPathElementID !== newRootID) {
+ i++;
+ currentPathElement = path[i];
+ currentPathElementID = ReactMount.getID(currentPathElement);
+ }
+ }
+ }
+ if (eventsFired === 0) {
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
@@ -97,15 +139,15 @@
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
- setHandleTopLevel: function(handleTopLevel) {
+ setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
- setEnabled: function(enabled) {
+ setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
- isEnabled: function() {
+ isEnabled: function () {
return ReactEventListener._enabled;
},
@@ -109,27 +151,22 @@
return ReactEventListener._enabled;
},
-
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapBubbledEvent: function(topLevelType, handlerBaseName, handle) {
+ trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.listen(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
@@ -138,36 +175,29 @@
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
- * @return {object} An object with a remove function which will forcefully
+ * @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
- trapCapturedEvent: function(topLevelType, handlerBaseName, handle) {
+ trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
- return EventListener.capture(
- element,
- handlerBaseName,
- ReactEventListener.dispatchEvent.bind(null, topLevelType)
- );
+ return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
- monitorScrollValue: function(refresh) {
+ monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
- dispatchEvent: function(topLevelType, nativeEvent) {
+ dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
- var bookKeeping = TopLevelCallbackBookKeeping.getPooled(
- topLevelType,
- nativeEvent
- );
+ var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.

lib/ReactFragment.js

@@ -6,175 +6,58 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
-* @providesModule ReactFragment
-*/
+ * @providesModule ReactFragment
+ */
'use strict';
-var ReactElement = require("./ReactElement");
+var ReactChildren = require('./ReactChildren');
+var ReactElement = require('./ReactElement');
-var warning = require("./warning");
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
/**
* We used to allow keyed objects to serve as a collection of ReactElements,
* or nested sets. This allowed us a way to explicitly key a set a fragment of
* components. This is now being replaced with an opaque data structure.
* The upgrade path is to call React.addons.createFragment({ key: value }) to
- * create a keyed fragment. The resulting data structure is opaque, for now.
+ * create a keyed fragment. The resulting data structure is an array.
*/
-if ("production" !== process.env.NODE_ENV) {
- var fragmentKey = '_reactFragment';
- var didWarnKey = '_reactDidWarn';
- var canWarnForReactFragment = false;
-
- try {
- // Feature test. Don't even try to issue this warning if we can't use
- // enumerable: false.
-
- var dummy = function() {
- return 1;
- };
-
- Object.defineProperty(
- {},
- fragmentKey,
- {enumerable: false, value: true}
- );
-
- Object.defineProperty(
- {},
- 'key',
- {enumerable: true, get: dummy}
- );
-
- canWarnForReactFragment = true;
- } catch (x) { }
-
- var proxyPropertyAccessWithWarning = function(obj, key) {
- Object.defineProperty(obj, key, {
- enumerable: true,
- get: function() {
- ("production" !== process.env.NODE_ENV ? warning(
- this[didWarnKey],
- 'A ReactFragment is an opaque type. Accessing any of its ' +
- 'properties is deprecated. Pass it to one of the React.Children ' +
- 'helpers.'
- ) : null);
- this[didWarnKey] = true;
- return this[fragmentKey][key];
- },
- set: function(value) {
- ("production" !== process.env.NODE_ENV ? warning(
- this[didWarnKey],
- 'A ReactFragment is an immutable opaque type. Mutating its ' +
- 'properties is deprecated.'
- ) : null);
- this[didWarnKey] = true;
- this[fragmentKey][key] = value;
- }
- });
- };
-
- var issuedWarnings = {};
-
- var didWarnForFragment = function(fragment) {
- // We use the keys and the type of the value as a heuristic to dedupe the
- // warning to avoid spamming too much.
- var fragmentCacheKey = '';
- for (var key in fragment) {
- fragmentCacheKey += key + ':' + (typeof fragment[key]) + ',';
- }
- var alreadyWarnedOnce = !!issuedWarnings[fragmentCacheKey];
- issuedWarnings[fragmentCacheKey] = true;
- return alreadyWarnedOnce;
- };
-}
+var numericPropertyRegex = /^\d+$/;
+
+var warnedAboutNumeric = false;
var ReactFragment = {
// Wrap a keyed object in an opaque proxy that warns you if you access any
// of its properties.
- create: function(object) {
- if ("production" !== process.env.NODE_ENV) {
+ create: function (object) {
if (typeof object !== 'object' || !object || Array.isArray(object)) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'React.addons.createFragment only accepts a single object.',
- object
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
return object;
}
if (ReactElement.isValidElement(object)) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'React.addons.createFragment does not accept a ReactElement ' +
- 'without a wrapper object.'
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
return object;
}
- if (canWarnForReactFragment) {
- var proxy = {};
- Object.defineProperty(proxy, fragmentKey, {
- enumerable: false,
- value: object
- });
- Object.defineProperty(proxy, didWarnKey, {
- writable: true,
- enumerable: false,
- value: false
- });
+
+ !(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
+
+ var result = [];
+
for (var key in object) {
- proxyPropertyAccessWithWarning(proxy, key);
+ if (process.env.NODE_ENV !== 'production') {
+ if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
+ warnedAboutNumeric = true;
}
- Object.preventExtensions(proxy);
- return proxy;
}
+ ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
}
- return object;
- },
- // Extract the original keyed object from the fragment opaque type. Warn if
- // a plain object is passed here.
- extract: function(fragment) {
- if ("production" !== process.env.NODE_ENV) {
- if (canWarnForReactFragment) {
- if (!fragment[fragmentKey]) {
- ("production" !== process.env.NODE_ENV ? warning(
- didWarnForFragment(fragment),
- 'Any use of a keyed object should be wrapped in ' +
- 'React.addons.createFragment(object) before being passed as a ' +
- 'child.'
- ) : null);
- return fragment;
- }
- return fragment[fragmentKey];
- }
- }
- return fragment;
- },
- // Check if this is a fragment and if so, extract the keyed object. If it
- // is a fragment-like object, warn that it should be wrapped. Ignore if we
- // can't determine what kind of object this is.
- extractIfFragment: function(fragment) {
- if ("production" !== process.env.NODE_ENV) {
- if (canWarnForReactFragment) {
- // If it is the opaque type, return the keyed object.
- if (fragment[fragmentKey]) {
- return fragment[fragmentKey];
- }
- // Otherwise, check each property if it has an element, if it does
- // it is probably meant as a fragment, so we can warn early. Defer,
- // the warning to extract.
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key) &&
- ReactElement.isValidElement(fragment[key])) {
- // This looks like a fragment object, we should provide an
- // early warning.
- return ReactFragment.extract(fragment);
- }
- }
- }
- }
- return fragment;
+
+ return result;
}
};

lib/ReactInjection.js

@@ -11,22 +11,20 @@
'use strict';
-var DOMProperty = require("./DOMProperty");
-var EventPluginHub = require("./EventPluginHub");
-var ReactComponentEnvironment = require("./ReactComponentEnvironment");
-var ReactClass = require("./ReactClass");
-var ReactEmptyComponent = require("./ReactEmptyComponent");
-var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
-var ReactNativeComponent = require("./ReactNativeComponent");
-var ReactDOMComponent = require("./ReactDOMComponent");
-var ReactPerf = require("./ReactPerf");
-var ReactRootIndex = require("./ReactRootIndex");
-var ReactUpdates = require("./ReactUpdates");
+var DOMProperty = require('./DOMProperty');
+var EventPluginHub = require('./EventPluginHub');
+var ReactComponentEnvironment = require('./ReactComponentEnvironment');
+var ReactClass = require('./ReactClass');
+var ReactEmptyComponent = require('./ReactEmptyComponent');
+var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
+var ReactNativeComponent = require('./ReactNativeComponent');
+var ReactPerf = require('./ReactPerf');
+var ReactRootIndex = require('./ReactRootIndex');
+var ReactUpdates = require('./ReactUpdates');
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
- DOMComponent: ReactDOMComponent.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,

lib/ReactInputSelection.js

@@ -11,11 +11,11 @@
'use strict';
-var ReactDOMSelection = require("./ReactDOMSelection");
+var ReactDOMSelection = require('./ReactDOMSelection');
-var containsNode = require("./containsNode");
-var focusNode = require("./focusNode");
-var getActiveElement = require("./getActiveElement");
+var containsNode = require('fbjs/lib/containsNode');
+var focusNode = require('fbjs/lib/focusNode');
+var getActiveElement = require('fbjs/lib/getActiveElement');
function isInDocument(node) {
return containsNode(document.documentElement, node);
@@ -29,21 +29,16 @@
*/
var ReactInputSelection = {
- hasSelectionCapabilities: function(elem) {
- return elem && (
- ((elem.nodeName === 'INPUT' && elem.type === 'text') ||
- elem.nodeName === 'TEXTAREA' || elem.contentEditable === 'true')
- );
+ hasSelectionCapabilities: function (elem) {
+ var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
+ return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
- getSelectionInformation: function() {
+ getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
- selectionRange:
- ReactInputSelection.hasSelectionCapabilities(focusedElem) ?
- ReactInputSelection.getSelection(focusedElem) :
- null
+ selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
@@ -52,17 +47,13 @@
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
- restoreSelection: function(priorSelectionInformation) {
+ restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
- if (curFocusedElem !== priorFocusedElem &&
- isInDocument(priorFocusedElem)) {
+ if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
- ReactInputSelection.setSelection(
- priorFocusedElem,
- priorSelectionRange
- );
+ ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
@@ -74,7 +65,7 @@
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
- getSelection: function(input) {
+ getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
@@ -83,7 +74,7 @@
start: input.selectionStart,
end: input.selectionEnd
};
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
@@ -99,7 +90,7 @@
selection = ReactDOMSelection.getOffsets(input);
}
- return selection || {start: 0, end: 0};
+ return selection || { start: 0, end: 0 };
},
/**
@@ -108,7 +99,7 @@
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
- setSelection: function(input, offsets) {
+ setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
@@ -118,7 +109,7 @@
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
- } else if (document.selection && input.nodeName === 'INPUT') {
+ } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);

lib/ReactInstanceHandles.js

@@ -12,9 +12,9 @@
'use strict';
-var ReactRootIndex = require("./ReactRootIndex");
+var ReactRootIndex = require('./ReactRootIndex');
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
@@ -22,7 +22,7 @@
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
-var MAX_TREE_DEPTH = 100;
+var MAX_TREE_DEPTH = 10000;
/**
* Creates a DOM ID prefix to use when mounting React components.
@@ -55,9 +55,7 @@
* @private
*/
function isValidID(id) {
- return id === '' || (
- id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
- );
+ return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
}
/**
@@ -69,10 +67,7 @@
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
- return (
- descendantID.indexOf(ancestorID) === 0 &&
- isBoundary(descendantID, ancestorID.length)
- );
+ return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
}
/**
@@ -96,19 +91,8 @@
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
- ("production" !== process.env.NODE_ENV ? invariant(
- isValidID(ancestorID) && isValidID(destinationID),
- 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.',
- ancestorID,
- destinationID
- ) : invariant(isValidID(ancestorID) && isValidID(destinationID)));
- ("production" !== process.env.NODE_ENV ? invariant(
- isAncestorIDOf(ancestorID, destinationID),
- 'getNextDescendantID(...): React has made an invalid assumption about ' +
- 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.',
- ancestorID,
- destinationID
- ) : invariant(isAncestorIDOf(ancestorID, destinationID)));
+ !(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
+ !isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
if (ancestorID === destinationID) {
return ancestorID;
}
@@ -150,13 +134,7 @@
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
- ("production" !== process.env.NODE_ENV ? invariant(
- isValidID(longestCommonID),
- 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s',
- oneID,
- twoID,
- longestCommonID
- ) : invariant(isValidID(longestCommonID)));
+ !isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
return longestCommonID;
}
@@ -168,6 +146,7 @@
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
+ * @param {*} arg Argument to invoke the callback with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
@@ -175,23 +154,13 @@
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
- ("production" !== process.env.NODE_ENV ? invariant(
- start !== stop,
- 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.',
- start
- ) : invariant(start !== stop));
+ !(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
var traverseUp = isAncestorIDOf(stop, start);
- ("production" !== process.env.NODE_ENV ? invariant(
- traverseUp || isAncestorIDOf(start, stop),
- 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' +
- 'not have a parent path.',
- start,
- stop
- ) : invariant(traverseUp || isAncestorIDOf(start, stop)));
+ !(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
- for (var id = start; /* until break */; id = traverse(id, stop)) {
+ for (var id = start;; /* until break */id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
@@ -200,12 +169,7 @@
// Only break //after// visiting `stop`.
break;
}
- ("production" !== process.env.NODE_ENV ? invariant(
- depth++ < MAX_TREE_DEPTH,
- 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' +
- 'traversing the React DOM ID tree. This may be due to malformed IDs: %s',
- start, stop
- ) : invariant(depth++ < MAX_TREE_DEPTH));
+ !(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
}
}
@@ -222,7 +186,7 @@
* Constructs a React root ID
* @return {string} A React root ID.
*/
- createReactRootID: function() {
+ createReactRootID: function () {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
@@ -234,7 +198,7 @@
* @return {string} A React ID.
* @internal
*/
- createReactID: function(rootID, name) {
+ createReactID: function (rootID, name) {
return rootID + name;
},
@@ -246,7 +210,7 @@
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
- getReactRootIDFromNodeID: function(id) {
+ getReactRootIDFromNodeID: function (id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
@@ -268,7 +232,7 @@
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
- traverseEnterLeave: function(leaveID, enterID, cb, upArg, downArg) {
+ traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
@@ -288,7 +252,7 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseTwoPhase: function(targetID, cb, arg) {
+ traverseTwoPhase: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
@@ -296,6 +260,16 @@
},
/**
+ * Same as `traverseTwoPhase` but skips the `targetID`.
+ */
+ traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
+ if (targetID) {
+ traverseParentPath('', targetID, cb, arg, true, true);
+ traverseParentPath(targetID, '', cb, arg, true, true);
+ }
+ },
+
+ /**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
@@ -307,15 +281,11 @@
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
- traverseAncestors: function(targetID, cb, arg) {
+ traverseAncestors: function (targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
- /**
- * Exposed for unit testing.
- * @private
- */
- _getFirstCommonAncestorID: getFirstCommonAncestorID,
+ getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.

lib/ReactInstanceMap.js

@@ -26,19 +26,19 @@
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
- remove: function(key) {
+ remove: function (key) {
key._reactInternalInstance = undefined;
},
- get: function(key) {
+ get: function (key) {
return key._reactInternalInstance;
},
- has: function(key) {
+ has: function (key) {
return key._reactInternalInstance !== undefined;
},
- set: function(key, value) {
+ set: function (key, value) {
key._reactInternalInstance = value;
}

lib/ReactIsomorphic.js

@@ -0,0 +1,74 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactIsomorphic
+ */
+
+'use strict';
+
+var ReactChildren = require('./ReactChildren');
+var ReactComponent = require('./ReactComponent');
+var ReactClass = require('./ReactClass');
+var ReactDOMFactories = require('./ReactDOMFactories');
+var ReactElement = require('./ReactElement');
+var ReactElementValidator = require('./ReactElementValidator');
+var ReactPropTypes = require('./ReactPropTypes');
+var ReactVersion = require('./ReactVersion');
+
+var assign = require('./Object.assign');
+var onlyChild = require('./onlyChild');
+
+var createElement = ReactElement.createElement;
+var createFactory = ReactElement.createFactory;
+var cloneElement = ReactElement.cloneElement;
+
+if (process.env.NODE_ENV !== 'production') {
+ createElement = ReactElementValidator.createElement;
+ createFactory = ReactElementValidator.createFactory;
+ cloneElement = ReactElementValidator.cloneElement;
+}
+
+var React = {
+
+ // Modern
+
+ Children: {
+ map: ReactChildren.map,
+ forEach: ReactChildren.forEach,
+ count: ReactChildren.count,
+ toArray: ReactChildren.toArray,
+ only: onlyChild
+ },
+
+ Component: ReactComponent,
+
+ createElement: createElement,
+ cloneElement: cloneElement,
+ isValidElement: ReactElement.isValidElement,
+
+ // Classic
+
+ PropTypes: ReactPropTypes,
+ createClass: ReactClass.createClass,
+ createFactory: createFactory,
+ createMixin: function (mixin) {
+ // Currently a noop. Will be used to validate and trace mixins.
+ return mixin;
+ },
+
+ // This looks DOM specific but these are actually isomorphic helpers
+ // since they are just generating DOM strings.
+ DOM: ReactDOMFactories,
+
+ version: ReactVersion,
+
+ // Hook for JSX spread, don't use this for anything else.
+ __spread: assign
+};
+
+module.exports = React;
\ No newline at end of file

lib/React.js

@@ -9,140 +9,32 @@
* @providesModule React
*/
-/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
-
'use strict';
-var EventPluginUtils = require("./EventPluginUtils");
-var ReactChildren = require("./ReactChildren");
-var ReactComponent = require("./ReactComponent");
-var ReactClass = require("./ReactClass");
-var ReactContext = require("./ReactContext");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactElement = require("./ReactElement");
-var ReactElementValidator = require("./ReactElementValidator");
-var ReactDOM = require("./ReactDOM");
-var ReactDOMTextComponent = require("./ReactDOMTextComponent");
-var ReactDefaultInjection = require("./ReactDefaultInjection");
-var ReactInstanceHandles = require("./ReactInstanceHandles");
-var ReactMount = require("./ReactMount");
-var ReactPerf = require("./ReactPerf");
-var ReactPropTypes = require("./ReactPropTypes");
-var ReactReconciler = require("./ReactReconciler");
-var ReactServerRendering = require("./ReactServerRendering");
-
-var assign = require("./Object.assign");
-var findDOMNode = require("./findDOMNode");
-var onlyChild = require("./onlyChild");
-
-ReactDefaultInjection.inject();
-
-var createElement = ReactElement.createElement;
-var createFactory = ReactElement.createFactory;
-var cloneElement = ReactElement.cloneElement;
-
-if ("production" !== process.env.NODE_ENV) {
- createElement = ReactElementValidator.createElement;
- createFactory = ReactElementValidator.createFactory;
- cloneElement = ReactElementValidator.cloneElement;
-}
-
-var render = ReactPerf.measure('React', 'render', ReactMount.render);
-
-var React = {
- Children: {
- map: ReactChildren.map,
- forEach: ReactChildren.forEach,
- count: ReactChildren.count,
- only: onlyChild
- },
- Component: ReactComponent,
- DOM: ReactDOM,
- PropTypes: ReactPropTypes,
- initializeTouchEvents: function(shouldUseTouch) {
- EventPluginUtils.useTouchEvents = shouldUseTouch;
- },
- createClass: ReactClass.createClass,
- createElement: createElement,
- cloneElement: cloneElement,
- createFactory: createFactory,
- createMixin: function(mixin) {
- // Currently a noop. Will be used to validate and trace mixins.
- return mixin;
- },
- constructAndRenderComponent: ReactMount.constructAndRenderComponent,
- constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
- findDOMNode: findDOMNode,
- render: render,
- renderToString: ReactServerRendering.renderToString,
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
- unmountComponentAtNode: ReactMount.unmountComponentAtNode,
- isValidElement: ReactElement.isValidElement,
- withContext: ReactContext.withContext,
-
- // Hook for JSX spread, don't use this for anything else.
- __spread: assign
-};
-
-// Inject the runtime into a devtools global hook regardless of browser.
-// Allows for debugging when the hook is injected on the page.
-if (
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
- __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
- CurrentOwner: ReactCurrentOwner,
- InstanceHandles: ReactInstanceHandles,
- Mount: ReactMount,
- Reconciler: ReactReconciler,
- TextComponent: ReactDOMTextComponent
- });
-}
-
-if ("production" !== process.env.NODE_ENV) {
- var ExecutionEnvironment = require("./ExecutionEnvironment");
- if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
-
- // If we're in Chrome, look for the devtools marker and provide a download
- // link if not installed.
- if (navigator.userAgent.indexOf('Chrome') > -1) {
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
- console.debug(
- 'Download the React DevTools for a better development experience: ' +
- 'https://fb.me/react-devtools'
- );
- }
- }
-
- var expectedFeatures = [
- // shims
- Array.isArray,
- Array.prototype.every,
- Array.prototype.forEach,
- Array.prototype.indexOf,
- Array.prototype.map,
- Date.now,
- Function.prototype.bind,
- Object.keys,
- String.prototype.split,
- String.prototype.trim,
-
- // shams
- Object.create,
- Object.freeze
- ];
-
- for (var i = 0; i < expectedFeatures.length; i++) {
- if (!expectedFeatures[i]) {
- console.error(
- 'One or more ES5 shim/shams expected by React are not available: ' +
- 'https://fb.me/react-warning-polyfills'
- );
- break;
- }
- }
- }
-}
+var ReactDOM = require('./ReactDOM');
+var ReactDOMServer = require('./ReactDOMServer');
+var ReactIsomorphic = require('./ReactIsomorphic');
+
+var assign = require('./Object.assign');
+var deprecated = require('./deprecated');
+
+// `version` will be added here by ReactIsomorphic.
+var React = {};
+
+assign(React, ReactIsomorphic);
+
+assign(React, {
+ // ReactDOM
+ findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
+ render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
+ unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
+
+ // ReactDOMServer
+ renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
+ renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
+});
-React.version = '0.13.3';
+React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
+React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
module.exports = React;

lib/ReactLifeCycle.js

@@ -1,35 +0,0 @@
-/**
- * Copyright 2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactLifeCycle
- */
-
-'use strict';
-
-/**
- * This module manages the bookkeeping when a component is in the process
- * of being mounted or being unmounted. This is used as a way to enforce
- * invariants (or warnings) when it is not recommended to call
- * setState/forceUpdate.
- *
- * currentlyMountingInstance: During the construction phase, it is not possible
- * to trigger an update since the instance is not fully mounted yet. However, we
- * currently allow this as a convenience for mutating the initial state.
- *
- * currentlyUnmountingInstance: During the unmounting phase, the instance is
- * still mounted and can therefore schedule an update. However, this is not
- * recommended and probably an error since it's about to be unmounted.
- * Therefore we still want to trigger in an error for that case.
- */
-
-var ReactLifeCycle = {
- currentlyMountingInstance: null,
- currentlyUnmountingInstance: null
-};
-
-module.exports = ReactLifeCycle;

lib/ReactLink.js

@@ -26,7 +26,7 @@
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
- * this._handleValueChange: function(newValue) {
+ * _handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
@@ -35,7 +35,7 @@
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
*/
-var React = require("./React");
+var React = require('./React');
/**
* @param {*} value current value of the link
@@ -56,9 +56,7 @@
*/
function createLinkTypeChecker(linkType) {
var shapes = {
- value: typeof linkType === 'undefined' ?
- React.PropTypes.any.isRequired :
- linkType.isRequired,
+ value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired,
requestChange: React.PropTypes.func.isRequired
};
return React.PropTypes.shape(shapes);

lib/ReactMarkupChecksum.js

@@ -11,7 +11,9 @@
'use strict';
-var adler32 = require("./adler32");
+var adler32 = require('./adler32');
+
+var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
@@ -20,12 +22,11 @@
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
- addChecksumToMarkup: function(markup) {
+ addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
- return markup.replace(
- '>',
- ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '">'
- );
+
+ // Add checksum (handle both parent tags and self-closing tags)
+ return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
},
/**
@@ -33,10 +34,8 @@
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
- canReuseMarkup: function(markup, element) {
- var existingChecksum = element.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ canReuseMarkup: function (markup, element) {
+ var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;

lib/ReactMount.js

@@ -11,36 +11,38 @@
'use strict';
-var DOMProperty = require("./DOMProperty");
-var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactElement = require("./ReactElement");
-var ReactElementValidator = require("./ReactElementValidator");
-var ReactEmptyComponent = require("./ReactEmptyComponent");
-var ReactInstanceHandles = require("./ReactInstanceHandles");
-var ReactInstanceMap = require("./ReactInstanceMap");
-var ReactMarkupChecksum = require("./ReactMarkupChecksum");
-var ReactPerf = require("./ReactPerf");
-var ReactReconciler = require("./ReactReconciler");
-var ReactUpdateQueue = require("./ReactUpdateQueue");
-var ReactUpdates = require("./ReactUpdates");
-
-var emptyObject = require("./emptyObject");
-var containsNode = require("./containsNode");
-var getReactRootElementInContainer = require("./getReactRootElementInContainer");
-var instantiateReactComponent = require("./instantiateReactComponent");
-var invariant = require("./invariant");
-var setInnerHTML = require("./setInnerHTML");
-var shouldUpdateReactComponent = require("./shouldUpdateReactComponent");
-var warning = require("./warning");
-
-var SEPARATOR = ReactInstanceHandles.SEPARATOR;
+var DOMProperty = require('./DOMProperty');
+var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
+var ReactElement = require('./ReactElement');
+var ReactEmptyComponentRegistry = require('./ReactEmptyComponentRegistry');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactMarkupChecksum = require('./ReactMarkupChecksum');
+var ReactPerf = require('./ReactPerf');
+var ReactReconciler = require('./ReactReconciler');
+var ReactUpdateQueue = require('./ReactUpdateQueue');
+var ReactUpdates = require('./ReactUpdates');
+
+var assign = require('./Object.assign');
+var emptyObject = require('fbjs/lib/emptyObject');
+var containsNode = require('fbjs/lib/containsNode');
+var instantiateReactComponent = require('./instantiateReactComponent');
+var invariant = require('fbjs/lib/invariant');
+var setInnerHTML = require('./setInnerHTML');
+var shouldUpdateReactComponent = require('./shouldUpdateReactComponent');
+var validateDOMNesting = require('./validateDOMNesting');
+var warning = require('fbjs/lib/warning');
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
+var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
+
+var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
@@ -48,7 +50,7 @@
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
-if ("production" !== process.env.NODE_ENV) {
+if (process.env.NODE_ENV !== 'production') {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
@@ -73,6 +75,23 @@
}
/**
+ * @param {DOMElement|DOMDocument} container DOM element that may contain
+ * a React component
+ * @return {?*} DOM element that may have the reactRoot ID, or null.
+ */
+function getReactRootElementInContainer(container) {
+ if (!container) {
+ return null;
+ }
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ return container.documentElement;
+ } else {
+ return container.firstChild;
+ }
+}
+
+/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
@@ -97,11 +116,7 @@
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !isValid(cached, id),
- 'ReactMount: Two valid but unequal nodes with the same `%s`: %s',
- ATTR_NAME, id
- ) : invariant(!isValid(cached, id)));
+ !!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
nodeCache[id] = node;
}
@@ -158,7 +173,7 @@
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
- if (ReactEmptyComponent.isNullComponentID(id)) {
+ if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
@@ -179,11 +194,7 @@
*/
function isValid(node, id) {
if (node) {
- ("production" !== process.env.NODE_ENV ? invariant(
- internalGetID(node) === id,
- 'ReactMount: Unexpected modification of `%s`',
- ATTR_NAME
- ) : invariant(internalGetID(node) === id));
+ !(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
@@ -220,10 +231,7 @@
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
- ReactInstanceHandles.traverseAncestors(
- targetID,
- findDeepestCachedAncestorImpl
- );
+ ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
@@ -239,17 +247,25 @@
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function mountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup) {
- var markup = ReactReconciler.mountComponent(
- componentInstance, rootID, transaction, emptyObject
- );
- componentInstance._isTopLevel = true;
- ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup);
+function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
+ if (ReactDOMFeatureFlags.useCreateElement) {
+ context = assign({}, context);
+ if (container.nodeType === DOC_NODE_TYPE) {
+ context[ownerDocumentContextKey] = container;
+ } else {
+ context[ownerDocumentContextKey] = container.ownerDocument;
+ }
+ }
+ if (process.env.NODE_ENV !== 'production') {
+ if (context === emptyObject) {
+ context = {};
+ }
+ var tag = container.nodeName.toLowerCase();
+ context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
+ }
+ var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
+ componentInstance._renderedComponent._topLevelWrapper = componentInstance;
+ ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}
/**
@@ -260,25 +276,107 @@
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
-function batchedMountComponentIntoNode(
- componentInstance,
- rootID,
- container,
- shouldReuseMarkup) {
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
- transaction.perform(
- mountComponentIntoNode,
- null,
- componentInstance,
- rootID,
- container,
- transaction,
- shouldReuseMarkup
- );
+function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
+ /* forceHTML */shouldReuseMarkup);
+ transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
+ * Unmounts a component and removes it from the DOM.
+ *
+ * @param {ReactComponent} instance React component instance.
+ * @param {DOMElement} container DOM element to unmount from.
+ * @final
+ * @internal
+ * @see {ReactMount.unmountComponentAtNode}
+ */
+function unmountComponentFromNode(instance, container) {
+ ReactReconciler.unmountComponent(instance);
+
+ if (container.nodeType === DOC_NODE_TYPE) {
+ container = container.documentElement;
+ }
+
+ // http://jsperf.com/emptying-a-node
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+}
+
+/**
+ * True if the supplied DOM node has a direct React-rendered child that is
+ * not a React root element. Useful for warning in `render`,
+ * `unmountComponentAtNode`, etc.
+ *
+ * @param {?DOMElement} node The candidate DOM node.
+ * @return {boolean} True if the DOM element contains a direct child that was
+ * rendered by React but is not a root element.
+ * @internal
+ */
+function hasNonRootReactChild(node) {
+ var reactRootID = getReactRootID(node);
+ return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
+}
+
+/**
+ * Returns the first (deepest) ancestor of a node which is rendered by this copy
+ * of React.
+ */
+function findFirstReactDOMImpl(node) {
+ // This node might be from another React instance, so we make sure not to
+ // examine the node cache here
+ for (; node && node.parentNode !== node; node = node.parentNode) {
+ if (node.nodeType !== 1) {
+ // Not a DOMElement, therefore not a React component
+ continue;
+ }
+ var nodeID = internalGetID(node);
+ if (!nodeID) {
+ continue;
+ }
+ var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
+
+ // If containersByReactRootID contains the container we find by crawling up
+ // the tree, we know that this instance of React rendered the node.
+ // nb. isValid's strategy (with containsNode) does not work because render
+ // trees may be nested and we don't want a false positive in that case.
+ var current = node;
+ var lastID;
+ do {
+ lastID = internalGetID(current);
+ current = current.parentNode;
+ if (current == null) {
+ // The passed-in node has been detached from the container it was
+ // originally rendered into.
+ return null;
+ }
+ } while (lastID !== reactRootID);
+
+ if (current === containersByReactRootID[reactRootID]) {
+ return node;
+ }
+ }
+ return null;
+}
+
+/**
+ * Temporary (?) hack so that we can store all top-level pending updates on
+ * composites instead of having to worry about different types of components
+ * here.
+ */
+var TopLevelWrapper = function () {};
+TopLevelWrapper.prototype.isReactComponent = {};
+if (process.env.NODE_ENV !== 'production') {
+ TopLevelWrapper.displayName = 'TopLevelWrapper';
+}
+TopLevelWrapper.prototype.render = function () {
+ // this.props is actually a ReactElement
+ return this.props;
+};
+
+/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
@@ -297,6 +395,9 @@
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
+
+ TopLevelWrapper: TopLevelWrapper,
+
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
@@ -308,7 +409,7 @@
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
- scrollMonitor: function(container, renderCallback) {
+ scrollMonitor: function (container, renderCallback) {
renderCallback();
},
@@ -319,26 +420,17 @@
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
- _updateRootComponent: function(
- prevComponent,
- nextElement,
- container,
- callback) {
- if ("production" !== process.env.NODE_ENV) {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
- }
-
- ReactMount.scrollMonitor(container, function() {
+ _updateRootComponent: function (prevComponent, nextElement, container, callback) {
+ ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[getReactRootID(container)] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
}
return prevComponent;
@@ -351,15 +443,8 @@
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
- _registerComponent: function(nextComponent, container) {
- ("production" !== process.env.NODE_ENV ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- '_registerComponent(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ _registerComponent: function (nextComponent, container) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
@@ -375,44 +460,24 @@
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
- _renderNewRootComponent: function(
- nextElement,
- container,
- shouldReuseMarkup
- ) {
+ _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
- ("production" !== process.env.NODE_ENV ? warning(
- ReactCurrentOwner.current == null,
- '_renderNewRootComponent(): Render methods should be a pure function ' +
- 'of props and state; triggering nested component updates from ' +
- 'render is not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
var componentInstance = instantiateReactComponent(nextElement, null);
- var reactRootID = ReactMount._registerComponent(
- componentInstance,
- container
- );
+ var reactRootID = ReactMount._registerComponent(componentInstance, container);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
- ReactUpdates.batchedUpdates(
- batchedMountComponentIntoNode,
- componentInstance,
- reactRootID,
- container,
- shouldReuseMarkup
- );
+ ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// Record the root element in case it later gets transplanted.
- rootElementsByReactRootID[reactRootID] =
- getReactRootElementInContainer(container);
+ rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
}
return componentInstance;
@@ -425,76 +490,64 @@
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
+ * @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- render: function(nextElement, container, callback) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactElement.isValidElement(nextElement),
- 'React.render(): Invalid component element.%s',
- (
- typeof nextElement === 'string' ?
- ' Instead of passing an element string, make sure to instantiate ' +
- 'it by passing it to React.createElement.' :
- typeof nextElement === 'function' ?
- ' Instead of passing a component class, make sure to instantiate ' +
- 'it by passing it to React.createElement.' :
+ renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
+ return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
+ },
+
+ _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
+ !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
// Check if it quacks like an element
- nextElement != null && nextElement.props !== undefined ?
- ' This may be caused by unintentionally loading two independent ' +
- 'copies of React.' :
- ''
- )
- ) : invariant(ReactElement.isValidElement(nextElement)));
+ nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
+
+ process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
+
+ var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
- var prevElement = prevComponent._currentElement;
+ var prevWrappedElement = prevComponent._currentElement;
+ var prevElement = prevWrappedElement.props;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
- return ReactMount._updateRootComponent(
- prevComponent,
- nextElement,
- container,
- callback
- ).getPublicInstance();
+ var publicInst = prevComponent._renderedComponent.getPublicInstance();
+ var updatedCallback = callback && function () {
+ callback.call(publicInst);
+ };
+ ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
+ return publicInst;
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
- var containerHasReactMarkup =
- reactRootElement && ReactMount.isRenderedByReact(reactRootElement);
+ var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
+ var containerHasNonRootReactChild = hasNonRootReactChild(container);
+
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
- if ("production" !== process.env.NODE_ENV) {
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
- if (ReactMount.isRenderedByReact(rootElementSibling)) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'render(): Target node has markup rendered by React, but there ' +
- 'are unrelated nodes as well. This is most commonly caused by ' +
- 'white-space inserted around server-rendered markup.'
- ) : null);
+ if (internalGetID(rootElementSibling)) {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
break;
}
-
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
- var shouldReuseMarkup = containerHasReactMarkup && !prevComponent;
-
- var component = ReactMount._renderNewRootComponent(
- nextElement,
- container,
- shouldReuseMarkup
- ).getPublicInstance();
+ var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
+ var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
@@ -502,36 +555,19 @@
},
/**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into the supplied `container`.
+ * Renders a React component into the DOM in the supplied `container`.
+ *
+ * If the React component was previously rendered into `container`, this will
+ * perform an update on it and only mutate the DOM as necessary to reflect the
+ * latest React component.
*
- * @param {function} constructor React component constructor.
- * @param {?object} props Initial props of the component instance.
+ * @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
+ * @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
- constructAndRenderComponent: function(constructor, props, container) {
- var element = ReactElement.createElement(constructor, props);
- return ReactMount.render(element, container);
- },
-
- /**
- * Constructs a component instance of `constructor` with `initialProps` and
- * renders it into a container node identified by supplied `id`.
- *
- * @param {function} componentConstructor React component constructor
- * @param {?object} props Initial props of the component instance.
- * @param {string} id ID of the DOM element to render into.
- * @return {ReactComponent} Component instance rendered in the container node.
- */
- constructAndRenderComponentByID: function(constructor, props, id) {
- var domNode = document.getElementById(id);
- ("production" !== process.env.NODE_ENV ? invariant(
- domNode,
- 'Tried to get element with id of "%s" but it is not present on the page.',
- id
- ) : invariant(domNode));
- return ReactMount.constructAndRenderComponent(constructor, props, domNode);
+ render: function (nextElement, container, callback) {
+ return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
@@ -542,7 +578,7 @@
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
- registerContainer: function(container) {
+ registerContainer: function (container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
@@ -563,101 +599,68 @@
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
- unmountComponentAtNode: function(container) {
+ unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
- ("production" !== process.env.NODE_ENV ? warning(
- ReactCurrentOwner.current == null,
- 'unmountComponentAtNode(): Render methods should be a pure function of ' +
- 'props and state; triggering nested component updates from render is ' +
- 'not allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
-
- ("production" !== process.env.NODE_ENV ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'unmountComponentAtNode(...): Target container is not a DOM element.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
+
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
+ // Check if the node being unmounted was rendered by React, but isn't a
+ // root node.
+ var containerHasNonRootReactChild = hasNonRootReactChild(container);
+
+ // Check if the container itself is a React root node.
+ var containerID = internalGetID(container);
+ var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
+
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
+ }
+
return false;
}
- ReactMount.unmountComponentFromNode(component, container);
+ ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
- * Unmounts a component and removes it from the DOM.
- *
- * @param {ReactComponent} instance React component instance.
- * @param {DOMElement} container DOM element to unmount from.
- * @final
- * @internal
- * @see {ReactMount.unmountComponentAtNode}
- */
- unmountComponentFromNode: function(instance, container) {
- ReactReconciler.unmountComponent(instance);
-
- if (container.nodeType === DOC_NODE_TYPE) {
- container = container.documentElement;
- }
-
- // http://jsperf.com/emptying-a-node
- while (container.lastChild) {
- container.removeChild(container.lastChild);
- }
- },
-
- /**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
- findReactContainerForID: function(id) {
+ findReactContainerForID: function (id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
- ("production" !== process.env.NODE_ENV ? invariant(
+ process.env.NODE_ENV !== 'production' ? warning(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID,
- 'ReactMount: Root element ID differed from reactRootID.'
- ) : invariant(// Call internalGetID here because getID calls isValid which calls
- // findReactContainerForID (this function).
- internalGetID(rootElement) === reactRootID));
-
+ internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
var containerChild = container.firstChild;
- if (containerChild &&
- reactRootID === internalGetID(containerChild)) {
+ if (containerChild && reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'ReactMount: Root element has been removed from its original ' +
- 'container. New container:', rootElement.parentNode
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
}
}
}
@@ -671,44 +674,21 @@
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
- findReactNodeByID: function(id) {
+ findReactNodeByID: function (id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
- * True if the supplied `node` is rendered by React.
- *
- * @param {*} node DOM Element to check.
- * @return {boolean} True if the DOM Element appears to be rendered by React.
- * @internal
- */
- isRenderedByReact: function(node) {
- if (node.nodeType !== 1) {
- // Not a DOMElement, therefore not a React component
- return false;
- }
- var id = ReactMount.getID(node);
- return id ? id.charAt(0) === SEPARATOR : false;
- },
-
- /**
* Traverses up the ancestors of the supplied node to find a node that is a
- * DOM representation of a React component.
+ * DOM representation of a React component rendered by this copy of React.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
- getFirstReactDOM: function(node) {
- var current = node;
- while (current && current.parentNode !== current) {
- if (ReactMount.isRenderedByReact(current)) {
- return current;
- }
- current = current.parentNode;
- }
- return null;
+ getFirstReactDOM: function (node) {
+ return findFirstReactDOMImpl(node);
},
/**
@@ -721,12 +701,17 @@
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
- findComponentRoot: function(ancestorNode, targetID) {
+ findComponentRoot: function (ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
+ if (process.env.NODE_ENV !== 'production') {
+ // This will throw on the next line; give an early warning
+ process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
+ }
+
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
@@ -777,91 +761,68 @@
firstChildren.length = 0;
- ("production" !== process.env.NODE_ENV ? invariant(
- false,
- 'findComponentRoot(..., %s): Unable to find element. This probably ' +
- 'means the DOM was unexpectedly mutated (e.g., by the browser), ' +
- 'usually due to forgetting a <tbody> when using tables, nesting tags ' +
- 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' +
- 'parent. ' +
- 'Try inspecting the child nodes of the element with React ID `%s`.',
- targetID,
- ReactMount.getID(ancestorNode)
- ) : invariant(false));
- },
-
- _mountImageIntoNode: function(markup, container, shouldReuseMarkup) {
- ("production" !== process.env.NODE_ENV ? invariant(
- container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- ),
- 'mountComponentIntoNode(...): Target container is not valid.'
- ) : invariant(container && (
- (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
- )));
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
+ },
+
+ _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
+ !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
return;
} else {
- var checksum = rootElement.getAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME
- );
+ var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
- rootElement.setAttribute(
- ReactMarkupChecksum.CHECKSUM_ATTR_NAME,
- checksum
- );
-
- var diffIndex = firstDifferenceIndex(markup, rootMarkup);
- var difference = ' (client) ' +
- markup.substring(diffIndex - 20, diffIndex + 20) +
- '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
-
- ("production" !== process.env.NODE_ENV ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- 'You\'re trying to render a component to the document using ' +
- 'server rendering but the checksum was invalid. This usually ' +
- 'means you rendered a different component type or props on ' +
- 'the client from the one on the server, or your render() ' +
- 'methods are impure. React cannot handle this case due to ' +
- 'cross-browser quirks by rendering at the document root. You ' +
- 'should look for environment dependent code in your components ' +
- 'and ensure the props are the same client and server side:\n%s',
- difference
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
-
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- 'React attempted to reuse markup in a container but the ' +
- 'checksum was invalid. This generally means that you are ' +
- 'using server rendering and the markup generated on the ' +
- 'server was not what the client was expecting. React injected ' +
- 'new markup to compensate which works but you have lost many ' +
- 'of the benefits of server rendering. Instead, figure out ' +
- 'why the markup being generated is different on the client ' +
- 'or server:\n%s',
- difference
- ) : null);
+ rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
+
+ var normalizedMarkup = markup;
+ if (process.env.NODE_ENV !== 'production') {
+ // because rootMarkup is retrieved from the DOM, various normalizations
+ // will have occurred which will not be present in `markup`. Here,
+ // insert markup into a <div> or <iframe> depending on the container
+ // type to perform the same normalizations before comparing.
+ var normalizer;
+ if (container.nodeType === ELEMENT_NODE_TYPE) {
+ normalizer = document.createElement('div');
+ normalizer.innerHTML = markup;
+ normalizedMarkup = normalizer.innerHTML;
+ } else {
+ normalizer = document.createElement('iframe');
+ document.body.appendChild(normalizer);
+ normalizer.contentDocument.write(markup);
+ normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
+ document.body.removeChild(normalizer);
+ }
+ }
+
+ var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
+ var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
+
+ !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
+
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
}
}
}
- ("production" !== process.env.NODE_ENV ? invariant(
- container.nodeType !== DOC_NODE_TYPE,
- 'You\'re trying to render a component to the document but ' +
- 'you didn\'t use server rendering. We can\'t do this ' +
- 'without using server rendering due to cross-browser quirks. ' +
- 'See React.renderToString() for server rendering.'
- ) : invariant(container.nodeType !== DOC_NODE_TYPE));
+ !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
+ if (transaction.useCreateElement) {
+ while (container.lastChild) {
+ container.removeChild(container.lastChild);
+ }
+ container.appendChild(markup);
+ } else {
setInnerHTML(container, markup);
+ }
},
+ ownerDocumentContextKey: ownerDocumentContextKey,
+
/**
* React ID utilities.
*/
@@ -876,6 +837,8 @@
getNodeFromInstance: getNodeFromInstance,
+ isValid: isValid,
+
purgeID: purgeID
};

lib/ReactMultiChild.js

@@ -12,11 +12,14 @@
'use strict';
-var ReactComponentEnvironment = require("./ReactComponentEnvironment");
-var ReactMultiChildUpdateTypes = require("./ReactMultiChildUpdateTypes");
+var ReactComponentEnvironment = require('./ReactComponentEnvironment');
+var ReactMultiChildUpdateTypes = require('./ReactMultiChildUpdateTypes');
-var ReactReconciler = require("./ReactReconciler");
-var ReactChildReconciler = require("./ReactChildReconciler");
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactReconciler = require('./ReactReconciler');
+var ReactChildReconciler = require('./ReactChildReconciler');
+
+var flattenChildren = require('./flattenChildren');
/**
* Updating children of a component may trigger recursive updates. The depth is
@@ -53,14 +56,14 @@
* @param {number} toIndex Destination index.
* @private
*/
-function enqueueMarkup(parentID, markup, toIndex) {
+function enqueueInsertMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
- textContent: null,
+ content: null,
fromIndex: null,
toIndex: toIndex
});
@@ -81,7 +84,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: toIndex
});
@@ -101,13 +104,33 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
- textContent: null,
+ content: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
+ * Enqueues setting the markup of a node.
+ *
+ * @param {string} parentID ID of the parent component.
+ * @param {string} markup Markup that renders into an element.
+ * @private
+ */
+function enqueueSetMarkup(parentID, markup) {
+ // NOTE: Null values reduce hidden classes.
+ updateQueue.push({
+ parentID: parentID,
+ parentNode: null,
+ type: ReactMultiChildUpdateTypes.SET_MARKUP,
+ markupIndex: null,
+ content: markup,
+ fromIndex: null,
+ toIndex: null
+ });
+}
+
+/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
@@ -121,7 +144,7 @@
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
- textContent: textContent,
+ content: textContent,
fromIndex: null,
toIndex: null
});
@@ -134,10 +157,7 @@
*/
function processQueue() {
if (updateQueue.length) {
- ReactComponentEnvironment.processChildrenUpdates(
- updateQueue,
- markupQueue
- );
+ ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
clearQueue();
}
}
@@ -169,6 +189,37 @@
*/
Mixin: {
+ _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
+ if (process.env.NODE_ENV !== 'production') {
+ if (this._currentElement) {
+ try {
+ ReactCurrentOwner.current = this._currentElement._owner;
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ }
+ }
+ return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
+ },
+
+ _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
+ var nextChildren;
+ if (process.env.NODE_ENV !== 'production') {
+ if (this._currentElement) {
+ try {
+ ReactCurrentOwner.current = this._currentElement._owner;
+ nextChildren = flattenChildren(nextNestedChildrenElements);
+ } finally {
+ ReactCurrentOwner.current = null;
+ }
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ }
+ }
+ nextChildren = flattenChildren(nextNestedChildrenElements);
+ return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
+ },
+
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
@@ -177,10 +228,8 @@
* @return {array} An array of mounted representations.
* @internal
*/
- mountChildren: function(nestedChildren, transaction, context) {
- var children = ReactChildReconciler.instantiateChildren(
- nestedChildren, transaction, context
- );
+ mountChildren: function (nestedChildren, transaction, context) {
+ var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
@@ -189,15 +238,9 @@
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
- child._mountIndex = index;
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
+ child._mountIndex = index++;
mountImages.push(mountImage);
- index++;
}
}
return mountImages;
@@ -209,7 +252,7 @@
* @param {string} nextContent String of content.
* @internal
*/
- updateTextContent: function(nextContent) {
+ updateTextContent: function (nextContent) {
updateDepth++;
var errorThrown = true;
try {
@@ -219,7 +262,7 @@
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
- this._unmountChildByName(prevChildren[name], name);
+ this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
@@ -238,17 +281,49 @@
},
/**
+ * Replaces any rendered children with a markup string.
+ *
+ * @param {string} nextMarkup String of markup.
+ * @internal
+ */
+ updateMarkup: function (nextMarkup) {
+ updateDepth++;
+ var errorThrown = true;
+ try {
+ var prevChildren = this._renderedChildren;
+ // Remove any rendered children.
+ ReactChildReconciler.unmountChildren(prevChildren);
+ for (var name in prevChildren) {
+ if (prevChildren.hasOwnProperty(name)) {
+ this._unmountChildByName(prevChildren[name], name);
+ }
+ }
+ this.setMarkup(nextMarkup);
+ errorThrown = false;
+ } finally {
+ updateDepth--;
+ if (!updateDepth) {
+ if (errorThrown) {
+ clearQueue();
+ } else {
+ processQueue();
+ }
+ }
+ }
+ },
+
+ /**
* Updates the rendered children with new children.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- updateChildren: function(nextNestedChildren, transaction, context) {
+ updateChildren: function (nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
- this._updateChildren(nextNestedChildren, transaction, context);
+ this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
@@ -267,16 +341,14 @@
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
- * @param {?object} nextNestedChildren Nested child maps.
+ * @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
- _updateChildren: function(nextNestedChildren, transaction, context) {
+ _updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
- var nextChildren = ReactChildReconciler.updateChildren(
- prevChildren, nextNestedChildren, transaction, context
- );
+ var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
@@ -300,20 +372,17 @@
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
- this._unmountChildByName(prevChild, name);
+ this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
- this._mountChildByNameAtIndex(
- nextChild, name, nextIndex, transaction, context
- );
+ this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
- if (prevChildren.hasOwnProperty(name) &&
- !(nextChildren && nextChildren.hasOwnProperty(name))) {
- this._unmountChildByName(prevChildren[name], name);
+ if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
+ this._unmountChild(prevChildren[name]);
}
}
},
@@ -324,7 +393,7 @@
*
* @internal
*/
- unmountChildren: function() {
+ unmountChildren: function () {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
@@ -338,7 +407,7 @@
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
- moveChild: function(child, toIndex, lastIndex) {
+ moveChild: function (child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
@@ -354,8 +423,8 @@
* @param {string} mountImage Markup to insert.
* @protected
*/
- createChild: function(child, mountImage) {
- enqueueMarkup(this._rootNodeID, mountImage, child._mountIndex);
+ createChild: function (child, mountImage) {
+ enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
@@ -364,7 +433,7 @@
* @param {ReactComponent} child Child to remove.
* @protected
*/
- removeChild: function(child) {
+ removeChild: function (child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
@@ -374,11 +443,21 @@
* @param {string} textContent Text content to set.
* @protected
*/
- setTextContent: function(textContent) {
+ setTextContent: function (textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
+ * Sets this markup string.
+ *
+ * @param {string} markup Markup to set.
+ * @protected
+ */
+ setMarkup: function (markup) {
+ enqueueSetMarkup(this._rootNodeID, markup);
+ },
+
+ /**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
@@ -389,34 +468,23 @@
* @param {ReactReconcileTransaction} transaction
* @private
*/
- _mountChildByNameAtIndex: function(
- child,
- name,
- index,
- transaction,
- context) {
+ _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
- var mountImage = ReactReconciler.mountComponent(
- child,
- rootID,
- transaction,
- context
- );
+ var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
- * Unmounts a rendered child by name.
+ * Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
- * @param {string} name Name of the child in `this._renderedChildren`.
* @private
*/
- _unmountChildByName: function(child, name) {
+ _unmountChild: function (child) {
this.removeChild(child);
child._mountIndex = null;
}

lib/ReactMultiChildUpdateTypes.js

@@ -11,7 +11,7 @@
'use strict';
-var keyMirror = require("./keyMirror");
+var keyMirror = require('fbjs/lib/keyMirror');
/**
* When a component's children are updated, a series of update configuration
@@ -25,6 +25,7 @@
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
+ SET_MARKUP: null,
TEXT_CONTENT: null
});

lib/ReactNativeComponent.js

@@ -11,35 +11,30 @@
'use strict';
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
-// This registry keeps track of wrapper classes around native tags
+// This registry keeps track of wrapper classes around native tags.
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
- injectGenericComponentClass: function(componentClass) {
+ injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
- injectTextComponentClass: function(componentClass) {
+ injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
- injectComponentClasses: function(componentClasses) {
+ injectComponentClasses: function (componentClasses) {
assign(tagToComponentClass, componentClasses);
- },
- // Temporary hack since we expect DOM refs to behave like composites,
- // for this release.
- injectAutoWrapper: function(wrapperFactory) {
- autoGenerateWrapperClass = wrapperFactory;
}
};
@@ -68,11 +63,7 @@
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
- ("production" !== process.env.NODE_ENV ? invariant(
- genericComponentClass,
- 'There is no registered component for the tag %s',
- element.type
- ) : invariant(genericComponentClass));
+ !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
return new genericComponentClass(element.type, element.props);
}

lib/React.native.js

@@ -0,0 +1,5 @@
+'use strict';
+
+// TODO: Once we remove the DOM bits from React, this shim can go away.
+
+module.exports = require('./ReactIsomorphic');

lib/ReactNoopUpdateQueue.js

@@ -0,0 +1,118 @@
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactNoopUpdateQueue
+ */
+
+'use strict';
+
+var warning = require('fbjs/lib/warning');
+
+function warnTDZ(publicInstance, callerName) {
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
+ }
+}
+
+/**
+ * This is the abstract API for an update queue.
+ */
+var ReactNoopUpdateQueue = {
+
+ /**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ return false;
+ },
+
+ /**
+ * Enqueue a callback that will be executed after all the pending updates
+ * have processed.
+ *
+ * @param {ReactClass} publicInstance The instance to use as `this` context.
+ * @param {?function} callback Called after state is updated.
+ * @internal
+ */
+ enqueueCallback: function (publicInstance, callback) {},
+
+ /**
+ * Forces an update. This should only be invoked when it is known with
+ * certainty that we are **not** in a DOM transaction.
+ *
+ * You may want to call this when you know that some deeper aspect of the
+ * component's state has changed but `setState` was not called.
+ *
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
+ * `componentWillUpdate` and `componentDidUpdate`.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @internal
+ */
+ enqueueForceUpdate: function (publicInstance) {
+ warnTDZ(publicInstance, 'forceUpdate');
+ },
+
+ /**
+ * Replaces all of the state. Always use this or `setState` to mutate state.
+ * You should treat `this.state` as immutable.
+ *
+ * There is no guarantee that `this.state` will be immediately updated, so
+ * accessing `this.state` after calling this method may return the old value.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} completeState Next state.
+ * @internal
+ */
+ enqueueReplaceState: function (publicInstance, completeState) {
+ warnTDZ(publicInstance, 'replaceState');
+ },
+
+ /**
+ * Sets a subset of the state. This only exists because _pendingState is
+ * internal. This provides a merging strategy that is not available to deep
+ * properties which is confusing. TODO: Expose pendingState or don't use it
+ * during the merge.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialState Next partial state to be merged with state.
+ * @internal
+ */
+ enqueueSetState: function (publicInstance, partialState) {
+ warnTDZ(publicInstance, 'setState');
+ },
+
+ /**
+ * Sets a subset of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} partialProps Subset of the next props.
+ * @internal
+ */
+ enqueueSetProps: function (publicInstance, partialProps) {
+ warnTDZ(publicInstance, 'setProps');
+ },
+
+ /**
+ * Replaces all of the props.
+ *
+ * @param {ReactClass} publicInstance The instance that should rerender.
+ * @param {object} props New props.
+ * @internal
+ */
+ enqueueReplaceProps: function (publicInstance, props) {
+ warnTDZ(publicInstance, 'replaceProps');
+ }
+
+};
+
+module.exports = ReactNoopUpdateQueue;
\ No newline at end of file

lib/ReactOwner.js

@@ -11,7 +11,7 @@
'use strict';
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
/**
* ReactOwners are capable of storing references to owned components.
@@ -50,11 +50,8 @@
* @return {boolean} True if `object` is a valid owner.
* @final
*/
- isValidOwner: function(object) {
- return !!(
- (object &&
- typeof object.attachRef === 'function' && typeof object.detachRef === 'function')
- );
+ isValidOwner: function (object) {
+ return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
@@ -66,15 +63,8 @@
* @final
* @internal
*/
- addComponentAsRefTo: function(component, ref, owner) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactOwner.isValidOwner(owner),
- 'addComponentAsRefTo(...): Only a ReactOwner can have refs. This ' +
- 'usually means that you\'re trying to add a ref to a component that ' +
- 'doesn\'t have an owner (that is, was not created inside of another ' +
- 'component\'s `render` method). Try rendering this component inside of ' +
- 'a new top-level component which will hold the ref.'
- ) : invariant(ReactOwner.isValidOwner(owner)));
+ addComponentAsRefTo: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);
},
@@ -87,15 +77,8 @@
* @final
* @internal
*/
- removeComponentAsRefFrom: function(component, ref, owner) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactOwner.isValidOwner(owner),
- 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. This ' +
- 'usually means that you\'re trying to remove a ref to a component that ' +
- 'doesn\'t have an owner (that is, was not created inside of another ' +
- 'component\'s `render` method). Try rendering this component inside of ' +
- 'a new top-level component which will hold the ref.'
- ) : invariant(ReactOwner.isValidOwner(owner)));
+ removeComponentAsRefFrom: function (component, ref, owner) {
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {

lib/ReactPerf.js

@@ -34,17 +34,13 @@
* @param {string} objectName
* @param {object<string>} methodNames
*/
- measureMethods: function(object, objectName, methodNames) {
- if ("production" !== process.env.NODE_ENV) {
+ measureMethods: function (object, objectName, methodNames) {
+ if (process.env.NODE_ENV !== 'production') {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
- object[key] = ReactPerf.measure(
- objectName,
- methodNames[key],
- object[key]
- );
+ object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
}
}
},
@@ -57,10 +53,10 @@
* @param {function} func
* @return {function}
*/
- measure: function(objName, fnName, func) {
- if ("production" !== process.env.NODE_ENV) {
+ measure: function (objName, fnName, func) {
+ if (process.env.NODE_ENV !== 'production') {
var measuredFunc = null;
- var wrapper = function() {
+ var wrapper = function () {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
@@ -79,7 +75,7 @@
/**
* @param {function} measure
*/
- injectMeasure: function(measure) {
+ injectMeasure: function (measure) {
ReactPerf.storedMeasure = measure;
}
}

lib/ReactPropTransferer.js

@@ -11,9 +11,9 @@
'use strict';
-var assign = require("./Object.assign");
-var emptyFunction = require("./emptyFunction");
-var joinClasses = require("./joinClasses");
+var assign = require('./Object.assign');
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var joinClasses = require('fbjs/lib/joinClasses');
/**
* Creates a transfer strategy that will merge prop values using the supplied
@@ -23,7 +23,7 @@
* @return {function}
*/
function createTransferStrategy(mergeStrategy) {
- return function(props, key, value) {
+ return function (props, key, value) {
if (!props.hasOwnProperty(key)) {
props[key] = value;
} else {
@@ -32,7 +32,7 @@
};
}
-var transferStrategyMerge = createTransferStrategy(function(a, b) {
+var transferStrategyMerge = createTransferStrategy(function (a, b) {
// `merge` overrides the first object's (`props[key]` above) keys using the
// second object's (`value`) keys. An object's style's existing `propA` would
// get overridden. Flip the order here.
@@ -99,7 +99,7 @@
* @param {object} newProps new props to merge in
* @return {object} a new object containing both sets of props merged.
*/
- mergeProps: function(oldProps, newProps) {
+ mergeProps: function (oldProps, newProps) {
return transferInto(assign({}, oldProps), newProps);
}

lib/ReactPropTypeLocationNames.js

@@ -13,7 +13,7 @@
var ReactPropTypeLocationNames = {};
-if ("production" !== process.env.NODE_ENV) {
+if (process.env.NODE_ENV !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',

lib/ReactPropTypeLocations.js

@@ -11,7 +11,7 @@
'use strict';
-var keyMirror = require("./keyMirror");
+var keyMirror = require('fbjs/lib/keyMirror');
var ReactPropTypeLocations = keyMirror({
prop: null,

lib/ReactPropTypes.js

@@ -11,11 +11,11 @@
'use strict';
-var ReactElement = require("./ReactElement");
-var ReactFragment = require("./ReactFragment");
-var ReactPropTypeLocationNames = require("./ReactPropTypeLocationNames");
+var ReactElement = require('./ReactElement');
+var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
-var emptyFunction = require("./emptyFunction");
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var getIteratorFn = require('./getIteratorFn');
/**
* Collection of methods that allow declaration and validation of props that are
@@ -66,9 +66,6 @@
var ANONYMOUS = '<<anonymous>>';
-var elementTypeChecker = createElementTypeChecker();
-var nodeTypeChecker = createNodeChecker();
-
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
@@ -79,9 +76,9 @@
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
- element: elementTypeChecker,
+ element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
- node: nodeTypeChecker,
+ node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
@@ -89,19 +86,17 @@
};
function createChainableTypeChecker(validate) {
- function checkType(isRequired, props, propName, componentName, location) {
+ function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
+ propFullName = propFullName || propName;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
- return new Error(
- ("Required " + locationName + " `" + propName + "` was not specified in ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
}
return null;
} else {
- return validate(props, propName, componentName, location);
+ return validate(props, propName, componentName, location, propFullName);
}
}
@@ -112,7 +107,7 @@
}
function createPrimitiveTypeChecker(expectedType) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
@@ -122,10 +117,7 @@
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + preciseType + "` ") +
- ("supplied to `" + componentName + "`, expected `" + expectedType + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
@@ -137,18 +129,15 @@
}
function createArrayOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
- var error = typeChecker(propValue, i, componentName, location);
+ var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -159,13 +148,10 @@
}
function createElementTypeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactElement.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
@@ -173,14 +159,12 @@
}
function createInstanceTypeChecker(expectedClass) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected instance of `" + expectedClassName + "`.")
- );
+ var actualClassName = getClassName(props[propName]);
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
@@ -188,7 +172,13 @@
}
function createEnumTypeChecker(expectedValues) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(expectedValues)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
@@ -198,28 +188,22 @@
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of value `" + propValue + "` ") +
- ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type ") +
- ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
- var error = typeChecker(propValue, key, componentName, location);
+ var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error instanceof Error) {
return error;
}
@@ -231,31 +215,31 @@
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
- function validate(props, propName, componentName, location) {
+ if (!Array.isArray(arrayOfTypeCheckers)) {
+ return createChainableTypeChecker(function () {
+ return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
+ });
+ }
+
+ function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
- if (checker(props, propName, componentName, location) == null) {
+ if (checker(props, propName, componentName, location, propFullName, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED') == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` supplied to ") +
- ("`" + componentName + "`, expected a ReactNode.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
@@ -263,22 +247,19 @@
}
function createShapeTypeChecker(shapeTypes) {
- function validate(props, propName, componentName, location) {
+ function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
- return new Error(
- ("Invalid " + locationName + " `" + propName + "` of type `" + propType + "` ") +
- ("supplied to `" + componentName + "`, expected `object`.")
- );
+ return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
- var error = checker(propValue, key, componentName, location);
+ var error = checker(propValue, key, componentName, location, propFullName + '.' + key, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
if (error) {
return error;
}
@@ -303,12 +284,32 @@
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
- propValue = ReactFragment.extractIfFragment(propValue);
- for (var k in propValue) {
- if (!isNode(propValue[k])) {
+
+ var iteratorFn = getIteratorFn(propValue);
+ if (iteratorFn) {
+ var iterator = iteratorFn.call(propValue);
+ var step;
+ if (iteratorFn !== propValue.entries) {
+ while (!(step = iterator.next()).done) {
+ if (!isNode(step.value)) {
+ return false;
+ }
+ }
+ } else {
+ // Iterator will provide entry [k,v] tuples rather than values.
+ while (!(step = iterator.next()).done) {
+ var entry = step.value;
+ if (entry) {
+ if (!isNode(entry[1])) {
return false;
}
}
+ }
+ }
+ } else {
+ return false;
+ }
+
return true;
default:
return false;
@@ -344,4 +345,12 @@
return propType;
}
+// Returns class name of the object, if any.
+function getClassName(propValue) {
+ if (!propValue.constructor || !propValue.constructor.name) {
+ return '<<anonymous>>';
+ }
+ return propValue.constructor.name;
+}
+
module.exports = ReactPropTypes;

lib/ReactPutListenerQueue.js

@@ -1,54 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule ReactPutListenerQueue
- */
-
-'use strict';
-
-var PooledClass = require("./PooledClass");
-var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
-
-var assign = require("./Object.assign");
-
-function ReactPutListenerQueue() {
- this.listenersToPut = [];
-}
-
-assign(ReactPutListenerQueue.prototype, {
- enqueuePutListener: function(rootNodeID, propKey, propValue) {
- this.listenersToPut.push({
- rootNodeID: rootNodeID,
- propKey: propKey,
- propValue: propValue
- });
- },
-
- putListeners: function() {
- for (var i = 0; i < this.listenersToPut.length; i++) {
- var listenerToPut = this.listenersToPut[i];
- ReactBrowserEventEmitter.putListener(
- listenerToPut.rootNodeID,
- listenerToPut.propKey,
- listenerToPut.propValue
- );
- }
- },
-
- reset: function() {
- this.listenersToPut.length = 0;
- },
-
- destructor: function() {
- this.reset();
- }
-});
-
-PooledClass.addPoolingTo(ReactPutListenerQueue);
-
-module.exports = ReactPutListenerQueue;

lib/ReactReconciler.js

@@ -11,8 +11,7 @@
'use strict';
-var ReactRef = require("./ReactRef");
-var ReactElementValidator = require("./ReactElementValidator");
+var ReactRef = require('./ReactRef');
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
@@ -34,14 +33,11 @@
* @final
* @internal
*/
- mountComponent: function(internalInstance, rootID, transaction, context) {
+ mountComponent: function (internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
- if ("production" !== process.env.NODE_ENV) {
- ReactElementValidator.checkAndWarnForMutatedProps(
- internalInstance._currentElement
- );
- }
+ if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
+ }
return markup;
},
@@ -51,7 +47,7 @@
* @final
* @internal
*/
- unmountComponent: function(internalInstance) {
+ unmountComponent: function (internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
@@ -65,12 +61,10 @@
* @param {object} context
* @internal
*/
- receiveComponent: function(
- internalInstance, nextElement, transaction, context
- ) {
+ receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
- if (nextElement === prevElement && nextElement._owner != null) {
+ if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
@@ -78,17 +72,13 @@
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
- return;
- }
- if ("production" !== process.env.NODE_ENV) {
- ReactElementValidator.checkAndWarnForMutatedProps(nextElement);
+ // TODO: Bailing out early is just a perf optimization right?
+ // TODO: Removing the return statement should affect correctness?
+ return;
}
- var refsChanged = ReactRef.shouldUpdateRefs(
- prevElement,
- nextElement
- );
+ var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
@@ -96,7 +86,7 @@
internalInstance.receiveComponent(nextElement, transaction, context);
- if (refsChanged) {
+ if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
@@ -108,10 +98,7 @@
* @param {ReactReconcileTransaction} transaction
* @internal
*/
- performUpdateIfNecessary: function(
- internalInstance,
- transaction
- ) {
+ performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
}

lib/ReactReconcileTransaction.js

@@ -12,14 +12,14 @@
'use strict';
-var CallbackQueue = require("./CallbackQueue");
-var PooledClass = require("./PooledClass");
-var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
-var ReactInputSelection = require("./ReactInputSelection");
-var ReactPutListenerQueue = require("./ReactPutListenerQueue");
-var Transaction = require("./Transaction");
+var CallbackQueue = require('./CallbackQueue');
+var PooledClass = require('./PooledClass');
+var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
+var ReactDOMFeatureFlags = require('./ReactDOMFeatureFlags');
+var ReactInputSelection = require('./ReactInputSelection');
+var Transaction = require('./Transaction');
-var assign = require("./Object.assign");
+var assign = require('./Object.assign');
/**
* Ensures that, when possible, the selection range (currently selected text
@@ -46,7 +46,7 @@
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
- initialize: function() {
+ initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
@@ -54,10 +54,10 @@
/**
* @param {boolean} previouslyEnabled Enabled status of
- * `ReactBrowserEventEmitter` before the reconciliation occured. `close`
+ * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
- close: function(previouslyEnabled) {
+ close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
@@ -70,39 +70,24 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
- close: function() {
+ close: function () {
this.reactMountReady.notifyAll();
}
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: function() {
- this.putListenerQueue.putListeners();
- }
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- SELECTION_RESTORATION,
- EVENT_SUPPRESSION,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
/**
* Currently:
@@ -118,7 +103,7 @@
*
* @class ReactReconcileTransaction
*/
-function ReactReconcileTransaction() {
+function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
@@ -127,7 +112,7 @@
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}
var Mixin = {
@@ -135,34 +120,27 @@
* @see Transaction
* @abstract
* @final
- * @return {array<object>} List of operation wrap proceedures.
+ * @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};

lib/ReactRef.js

@@ -11,7 +11,7 @@
'use strict';
-var ReactOwner = require("./ReactOwner");
+var ReactOwner = require('./ReactOwner');
var ReactRef = {};
@@ -33,14 +33,17 @@
}
}
-ReactRef.attachRefs = function(instance, element) {
+ReactRef.attachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
-ReactRef.shouldUpdateRefs = function(prevElement, nextElement) {
+ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
@@ -53,13 +56,19 @@
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
- return (
- nextElement._owner !== prevElement._owner ||
- nextElement.ref !== prevElement.ref
+ var prevEmpty = prevElement === null || prevElement === false;
+ var nextEmpty = nextElement === null || nextElement === false;
+
+ return(
+ // This has a few false positives w/r/t empty components.
+ prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
-ReactRef.detachRefs = function(instance, element) {
+ReactRef.detachRefs = function (instance, element) {
+ if (element === null || element === false) {
+ return;
+ }
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);

lib/ReactRootIndex.js

@@ -16,7 +16,7 @@
/**
* @param {function} _createReactRootIndex
*/
- injectCreateReactRootIndex: function(_createReactRootIndex) {
+ injectCreateReactRootIndex: function (_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};

lib/ReactServerBatchingStrategy.js

@@ -0,0 +1,23 @@
+/**
+ * Copyright 2014-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactServerBatchingStrategy
+ * @typechecks
+ */
+
+'use strict';
+
+var ReactServerBatchingStrategy = {
+ isBatchingUpdates: false,
+ batchedUpdates: function (callback) {
+ // Don't do anything here. During the server rendering we don't want to
+ // schedule any updates. We will simply ignore them.
+ }
+};
+
+module.exports = ReactServerBatchingStrategy;
\ No newline at end of file

lib/ReactServerRendering.js

@@ -11,39 +11,42 @@
*/
'use strict';
-var ReactElement = require("./ReactElement");
-var ReactInstanceHandles = require("./ReactInstanceHandles");
-var ReactMarkupChecksum = require("./ReactMarkupChecksum");
-var ReactServerRenderingTransaction =
- require("./ReactServerRenderingTransaction");
-
-var emptyObject = require("./emptyObject");
-var instantiateReactComponent = require("./instantiateReactComponent");
-var invariant = require("./invariant");
+var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
+var ReactElement = require('./ReactElement');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+var ReactMarkupChecksum = require('./ReactMarkupChecksum');
+var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
+var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
+var ReactUpdates = require('./ReactUpdates');
+
+var emptyObject = require('fbjs/lib/emptyObject');
+var instantiateReactComponent = require('./instantiateReactComponent');
+var invariant = require('fbjs/lib/invariant');
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactElement.isValidElement(element),
- 'renderToString(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
- var markup =
- componentInstance.mountComponent(id, transaction, emptyObject);
+ var markup = componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
@@ -53,22 +56,24 @@
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactElement.isValidElement(element),
- 'renderToStaticMarkup(): You must pass a valid ReactElement.'
- ) : invariant(ReactElement.isValidElement(element)));
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
+ ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
+
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
- return transaction.perform(function() {
+ return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
+ // Revert to the DOM batching strategy since these two renderers
+ // currently share these stateful modules.
+ ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}

lib/ReactServerRenderingTransaction.js

@@ -12,13 +12,12 @@
'use strict';
-var PooledClass = require("./PooledClass");
-var CallbackQueue = require("./CallbackQueue");
-var ReactPutListenerQueue = require("./ReactPutListenerQueue");
-var Transaction = require("./Transaction");
+var PooledClass = require('./PooledClass');
+var CallbackQueue = require('./CallbackQueue');
+var Transaction = require('./Transaction');
-var assign = require("./Object.assign");
-var emptyFunction = require("./emptyFunction");
+var assign = require('./Object.assign');
+var emptyFunction = require('fbjs/lib/emptyFunction');
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
@@ -28,30 +27,19 @@
/**
* Initializes the internal `onDOMReady` queue.
*/
- initialize: function() {
+ initialize: function () {
this.reactMountReady.reset();
},
close: emptyFunction
};
-var PUT_LISTENER_QUEUEING = {
- initialize: function() {
- this.putListenerQueue.reset();
- },
-
- close: emptyFunction
-};
-
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
-var TRANSACTION_WRAPPERS = [
- PUT_LISTENER_QUEUEING,
- ON_DOM_READY_QUEUEING
-];
+var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
/**
* @class ReactServerRenderingTransaction
@@ -61,7 +49,7 @@
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
- this.putListenerQueue = ReactPutListenerQueue.getPooled();
+ this.useCreateElement = false;
}
var Mixin = {
@@ -69,42 +57,30 @@
* @see Transaction
* @abstract
* @final
- * @return {array} Empty list of operation wrap proceedures.
+ * @return {array} Empty list of operation wrap procedures.
*/
- getTransactionWrappers: function() {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
- getReactMountReady: function() {
+ getReactMountReady: function () {
return this.reactMountReady;
},
- getPutListenerQueue: function() {
- return this.putListenerQueue;
- },
-
/**
* `PooledClass` looks for this, and will invoke this before allowing this
- * instance to be resused.
+ * instance to be reused.
*/
- destructor: function() {
+ destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
-
- ReactPutListenerQueue.release(this.putListenerQueue);
- this.putListenerQueue = null;
}
};
-
-assign(
- ReactServerRenderingTransaction.prototype,
- Transaction.Mixin,
- Mixin
-);
+assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);

lib/ReactStateSetters.js

@@ -22,8 +22,8 @@
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
- createStateSetter: function(component, funcReturningState) {
- return function(a, b, c, d, e, f) {
+ createStateSetter: function (component, funcReturningState) {
+ return function (a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
@@ -42,7 +42,7 @@
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
- createStateKeySetter: function(component, key) {
+ createStateKeySetter: function (component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
@@ -77,7 +77,7 @@
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
- createStateSetter: function(funcReturningState) {
+ createStateSetter: function (funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
@@ -96,7 +96,7 @@
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
- createStateKeySetter: function(key) {
+ createStateKeySetter: function (key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};

lib/ReactTestUtils.js

@@ -11,22 +11,24 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPluginHub = require("./EventPluginHub");
-var EventPropagators = require("./EventPropagators");
-var React = require("./React");
-var ReactElement = require("./ReactElement");
-var ReactEmptyComponent = require("./ReactEmptyComponent");
-var ReactBrowserEventEmitter = require("./ReactBrowserEventEmitter");
-var ReactCompositeComponent = require("./ReactCompositeComponent");
-var ReactInstanceHandles = require("./ReactInstanceHandles");
-var ReactInstanceMap = require("./ReactInstanceMap");
-var ReactMount = require("./ReactMount");
-var ReactUpdates = require("./ReactUpdates");
-var SyntheticEvent = require("./SyntheticEvent");
-
-var assign = require("./Object.assign");
-var emptyObject = require("./emptyObject");
+var EventConstants = require('./EventConstants');
+var EventPluginHub = require('./EventPluginHub');
+var EventPropagators = require('./EventPropagators');
+var React = require('./React');
+var ReactDOM = require('./ReactDOM');
+var ReactElement = require('./ReactElement');
+var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
+var ReactCompositeComponent = require('./ReactCompositeComponent');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactMount = require('./ReactMount');
+var ReactUpdates = require('./ReactUpdates');
+var SyntheticEvent = require('./SyntheticEvent');
+
+var assign = require('./Object.assign');
+var emptyObject = require('fbjs/lib/emptyObject');
+var findDOMNode = require('./findDOMNode');
+var invariant = require('fbjs/lib/invariant');
var topLevelTypes = EventConstants.topLevelTypes;
@@ -36,74 +38,97 @@
* @class ReactTestUtils
*/
+function findAllInRenderedTreeInternal(inst, test) {
+ if (!inst || !inst.getPublicInstance) {
+ return [];
+ }
+ var publicInst = inst.getPublicInstance();
+ var ret = test(publicInst) ? [publicInst] : [];
+ var currentElement = inst._currentElement;
+ if (ReactTestUtils.isDOMComponent(publicInst)) {
+ var renderedChildren = inst._renderedChildren;
+ var key;
+ for (key in renderedChildren) {
+ if (!renderedChildren.hasOwnProperty(key)) {
+ continue;
+ }
+ ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
+ }
+ } else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
+ ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
+ }
+ return ret;
+}
+
/**
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
var ReactTestUtils = {
- renderIntoDocument: function(instance) {
+ renderIntoDocument: function (instance) {
var div = document.createElement('div');
// None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
- return React.render(instance, div);
+ return ReactDOM.render(instance, div);
},
- isElement: function(element) {
+ isElement: function (element) {
return ReactElement.isValidElement(element);
},
- isElementOfType: function(inst, convenienceConstructor) {
- return (
- ReactElement.isValidElement(inst) &&
- inst.type === convenienceConstructor
- );
+ isElementOfType: function (inst, convenienceConstructor) {
+ return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
},
- isDOMComponent: function(inst) {
- // TODO: Fix this heuristic. It's just here because composites can currently
- // pretend to be DOM components.
- return !!(inst && inst.tagName && inst.getDOMNode);
+ isDOMComponent: function (inst) {
+ return !!(inst && inst.nodeType === 1 && inst.tagName);
},
- isDOMComponentElement: function(inst) {
- return !!(inst &&
- ReactElement.isValidElement(inst) &&
- !!inst.tagName);
+ isDOMComponentElement: function (inst) {
+ return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
},
- isCompositeComponent: function(inst) {
- return typeof inst.render === 'function' &&
- typeof inst.setState === 'function';
+ isCompositeComponent: function (inst) {
+ if (ReactTestUtils.isDOMComponent(inst)) {
+ // Accessing inst.setState warns; just return false as that'll be what
+ // this returns when we have DOM nodes as refs directly
+ return false;
+ }
+ return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
},
- isCompositeComponentWithType: function(inst, type) {
- return !!(ReactTestUtils.isCompositeComponent(inst) &&
- (inst.constructor === type));
+ isCompositeComponentWithType: function (inst, type) {
+ if (!ReactTestUtils.isCompositeComponent(inst)) {
+ return false;
+ }
+ var internalInstance = ReactInstanceMap.get(inst);
+ var constructor = internalInstance._currentElement.type;
+
+ return constructor === type;
},
- isCompositeComponentElement: function(inst) {
+ isCompositeComponentElement: function (inst) {
if (!ReactElement.isValidElement(inst)) {
return false;
}
// We check the prototype of the type that will get mounted, not the
// instance itself. This is a future proof way of duck typing.
var prototype = inst.type.prototype;
- return (
- typeof prototype.render === 'function' &&
- typeof prototype.setState === 'function'
- );
+ return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
},
- isCompositeComponentElementWithType: function(inst, type) {
- return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
- (inst.constructor === type));
+ isCompositeComponentElementWithType: function (inst, type) {
+ var internalInstance = ReactInstanceMap.get(inst);
+ var constructor = internalInstance._currentElement.type;
+
+ return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
},
- getRenderedChildOfCompositeComponent: function(inst) {
+ getRenderedChildOfCompositeComponent: function (inst) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return null;
}
@@ -111,53 +136,36 @@
return internalInstance._renderedComponent.getPublicInstance();
},
- findAllInRenderedTree: function(inst, test) {
+ findAllInRenderedTree: function (inst, test) {
if (!inst) {
return [];
}
- var ret = test(inst) ? [inst] : [];
- if (ReactTestUtils.isDOMComponent(inst)) {
- var internalInstance = ReactInstanceMap.get(inst);
- var renderedChildren = internalInstance
- ._renderedComponent
- ._renderedChildren;
- var key;
- for (key in renderedChildren) {
- if (!renderedChildren.hasOwnProperty(key)) {
- continue;
- }
- if (!renderedChildren[key].getPublicInstance) {
- continue;
- }
- ret = ret.concat(
- ReactTestUtils.findAllInRenderedTree(
- renderedChildren[key].getPublicInstance(),
- test
- )
- );
- }
- } else if (ReactTestUtils.isCompositeComponent(inst)) {
- ret = ret.concat(
- ReactTestUtils.findAllInRenderedTree(
- ReactTestUtils.getRenderedChildOfCompositeComponent(inst),
- test
- )
- );
- }
- return ret;
+ !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
+ return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the class name matching `className`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedDOMComponentsWithClass: function(root, className) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- var instClassName = inst.props.className;
- return ReactTestUtils.isDOMComponent(inst) && (
- (instClassName && (' ' + instClassName + ' ').indexOf(' ' + className + ' ') !== -1)
- );
+ scryRenderedDOMComponentsWithClass: function (root, classNames) {
+ if (!Array.isArray(classNames)) {
+ classNames = classNames.split(/\s+/);
+ }
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ if (ReactTestUtils.isDOMComponent(inst)) {
+ var className = inst.className;
+ if (typeof className !== 'string') {
+ // SVG, probably.
+ className = inst.getAttribute('class') || '';
+ }
+ var classList = className.split(/\s+/);
+ return classNames.every(function (name) {
+ return classList.indexOf(name) !== -1;
+ });
+ }
+ return false;
});
},
@@ -167,13 +175,10 @@
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
- findRenderedDOMComponentWithClass: function(root, className) {
- var all =
- ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
+ findRenderedDOMComponentWithClass: function (root, className) {
+ var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
- throw new Error('Did not find exactly one match ' +
- '(found: ' + all.length + ') for class:' + className
- );
+ throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
}
return all[0];
},
@@ -178,16 +183,14 @@
return all[0];
},
-
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedDOMComponentsWithTag: function(root, tagName) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- return ReactTestUtils.isDOMComponent(inst) &&
- inst.tagName === tagName.toUpperCase();
+ scryRenderedDOMComponentsWithTag: function (root, tagName) {
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
},
@@ -197,7 +200,7 @@
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
- findRenderedDOMComponentWithTag: function(root, tagName) {
+ findRenderedDOMComponentWithTag: function (root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for tag:' + tagName);
@@ -205,17 +208,13 @@
return all[0];
},
-
/**
* Finds all instances of components with type equal to `componentType`.
- * @return an array of all the matches.
+ * @return {array} an array of all the matches.
*/
- scryRenderedComponentsWithType: function(root, componentType) {
- return ReactTestUtils.findAllInRenderedTree(root, function(inst) {
- return ReactTestUtils.isCompositeComponentWithType(
- inst,
- componentType
- );
+ scryRenderedComponentsWithType: function (root, componentType) {
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
+ return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
},
@@ -225,15 +224,10 @@
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
- findRenderedComponentWithType: function(root, componentType) {
- var all = ReactTestUtils.scryRenderedComponentsWithType(
- root,
- componentType
- );
+ findRenderedComponentWithType: function (root, componentType) {
+ var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
- throw new Error(
- 'Did not find exactly one match for componentType:' + componentType
- );
+ throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
}
return all[0];
},
@@ -251,62 +245,46 @@
* module.mockTagName if provided)
* @return {object} the ReactTestUtils object (for chaining)
*/
- mockComponent: function(module, mockTagName) {
- mockTagName = mockTagName || module.mockTagName || "div";
+ mockComponent: function (module, mockTagName) {
+ mockTagName = mockTagName || module.mockTagName || 'div';
- module.prototype.render.mockImplementation(function() {
- return React.createElement(
- mockTagName,
- null,
- this.props.children
- );
+ module.prototype.render.mockImplementation(function () {
+ return React.createElement(mockTagName, null, this.props.children);
});
return this;
},
/**
- * Simulates a top level event being dispatched from a raw event that occured
+ * Simulates a top level event being dispatched from a raw event that occurred
* on an `Element` node.
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
* @param {!Element} node The dom to simulate an event occurring on.
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
- simulateNativeEventOnNode: function(topLevelType, node, fakeNativeEvent) {
+ simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
- ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(
- topLevelType,
- fakeNativeEvent
- );
+ ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
},
/**
- * Simulates a top level event being dispatched from a raw event that occured
+ * Simulates a top level event being dispatched from a raw event that occurred
* on the `ReactDOMComponent` `comp`.
- * @param topLevelType {Object} A type from `EventConstants.topLevelTypes`.
- * @param comp {!ReactDOMComponent}
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
+ * @param {!ReactDOMComponent} comp
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
- simulateNativeEventOnDOMComponent: function(
- topLevelType,
- comp,
- fakeNativeEvent) {
- ReactTestUtils.simulateNativeEventOnNode(
- topLevelType,
- comp.getDOMNode(),
- fakeNativeEvent
- );
+ simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
+ ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
},
- nativeTouchData: function(x, y) {
+ nativeTouchData: function (x, y) {
return {
- touches: [
- {pageX: x, pageY: y}
- ]
+ touches: [{ pageX: x, pageY: y }]
};
},
- createRenderer: function() {
+ createRenderer: function () {
return new ReactShallowRenderer();
},
@@ -317,73 +295,70 @@
/**
* @class ReactShallowRenderer
*/
-var ReactShallowRenderer = function() {
+var ReactShallowRenderer = function () {
this._instance = null;
};
-ReactShallowRenderer.prototype.getRenderOutput = function() {
- return (
- (this._instance && this._instance._renderedComponent &&
- this._instance._renderedComponent._renderedOutput)
- || null
- );
+ReactShallowRenderer.prototype.getRenderOutput = function () {
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
};
-var NoopInternalComponent = function(element) {
+var NoopInternalComponent = function (element) {
this._renderedOutput = element;
- this._currentElement = element === null || element === false ?
- ReactEmptyComponent.emptyElement :
- element;
+ this._currentElement = element;
};
NoopInternalComponent.prototype = {
- mountComponent: function() {
- },
+ mountComponent: function () {},
- receiveComponent: function(element) {
+ receiveComponent: function (element) {
this._renderedOutput = element;
- this._currentElement = element === null || element === false ?
- ReactEmptyComponent.emptyElement :
- element;
+ this._currentElement = element;
},
- unmountComponent: function() {
- }
+ unmountComponent: function () {},
+ getPublicInstance: function () {
+ return null;
+ }
};
-var ShallowComponentWrapper = function() { };
-assign(
- ShallowComponentWrapper.prototype,
- ReactCompositeComponent.Mixin, {
- _instantiateReactComponent: function(element) {
+var ShallowComponentWrapper = function () {};
+assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
+ _instantiateReactComponent: function (element) {
return new NoopInternalComponent(element);
},
- _replaceNodeWithMarkupByID: function() {},
- _renderValidatedComponent:
- ReactCompositeComponent.Mixin.
- _renderValidatedComponentWithoutOwnerOrContext
- }
-);
+ _replaceNodeWithMarkupByID: function () {},
+ _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
+});
+
+ReactShallowRenderer.prototype.render = function (element, context) {
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : undefined;
+ !(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : undefined;
-ReactShallowRenderer.prototype.render = function(element, context) {
if (!context) {
context = emptyObject;
}
- var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
- this._render(element, transaction, context);
- ReactUpdates.ReactReconcileTransaction.release(transaction);
+ ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
};
-ReactShallowRenderer.prototype.unmount = function() {
+function _batchedRender(renderer, element, context) {
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
+ renderer._render(element, transaction, context);
+ ReactUpdates.ReactReconcileTransaction.release(transaction);
+}
+
+ReactShallowRenderer.prototype.unmount = function () {
if (this._instance) {
this._instance.unmountComponent();
}
};
-ReactShallowRenderer.prototype._render = function(element, transaction, context) {
- if (!this._instance) {
+ReactShallowRenderer.prototype._render = function (element, transaction, context) {
+ if (this._instance) {
+ this._instance.receiveComponent(element, transaction, context);
+ } else {
var rootID = ReactInstanceHandles.createReactRootID();
var instance = new ShallowComponentWrapper(element.type);
instance.construct(element);
@@ -391,8 +366,6 @@
instance.mountComponent(rootID, transaction, context);
this._instance = instance;
- } else {
- this._instance.receiveComponent(element, transaction, context);
}
};
@@ -405,29 +378,32 @@
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
- return function(domComponentOrNode, eventData) {
+ return function (domComponentOrNode, eventData) {
var node;
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- node = domComponentOrNode.getDOMNode();
+ node = findDOMNode(domComponentOrNode);
} else if (domComponentOrNode.tagName) {
node = domComponentOrNode;
}
+ var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
+
var fakeNativeEvent = new Event();
fakeNativeEvent.target = node;
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
- var event = new SyntheticEvent(
- ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType],
- ReactMount.getID(node),
- fakeNativeEvent
- );
+ var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
assign(event, eventData);
+
+ if (dispatchConfig.phasedRegistrationNames) {
EventPropagators.accumulateTwoPhaseDispatches(event);
+ } else {
+ EventPropagators.accumulateDirectDispatches(event);
+ }
- ReactUpdates.batchedUpdates(function() {
+ ReactUpdates.batchedUpdates(function () {
EventPluginHub.enqueueEvents(event);
- EventPluginHub.processEventQueue();
+ EventPluginHub.processEventQueue(true);
});
};
}
@@ -438,7 +414,7 @@
var eventType;
for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
/**
- * @param {!Element || ReactDOMComponent} domComponentOrNode
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
@@ -447,12 +423,12 @@
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
-EventPluginHub.injection.injectEventPluginOrder = function() {
+EventPluginHub.injection.injectEventPluginOrder = function () {
oldInjectEventPluginOrder.apply(this, arguments);
buildSimulators();
};
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
-EventPluginHub.injection.injectEventPluginsByName = function() {
+EventPluginHub.injection.injectEventPluginsByName = function () {
oldInjectEventPlugins.apply(this, arguments);
buildSimulators();
};
@@ -476,37 +452,26 @@
*/
function makeNativeSimulator(eventType) {
- return function(domComponentOrNode, nativeEventData) {
+ return function (domComponentOrNode, nativeEventData) {
var fakeNativeEvent = new Event(eventType);
assign(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
- ReactTestUtils.simulateNativeEventOnDOMComponent(
- eventType,
- domComponentOrNode,
- fakeNativeEvent
- );
- } else if (!!domComponentOrNode.tagName) {
+ ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
+ } else if (domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
- ReactTestUtils.simulateNativeEventOnNode(
- eventType,
- domComponentOrNode,
- fakeNativeEvent
- );
+ ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
}
};
}
-var eventType;
-for (eventType in topLevelTypes) {
+Object.keys(topLevelTypes).forEach(function (eventType) {
// Event type is stored as 'topClick' - we transform that to 'click'
- var convenienceName = eventType.indexOf('top') === 0 ?
- eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
+ var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
/**
- * @param {!Element || ReactDOMComponent} domComponentOrNode
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
- ReactTestUtils.SimulateNative[convenienceName] =
- makeNativeSimulator(eventType);
-}
+ ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
+});
module.exports = ReactTestUtils;

lib/ReactTransitionChildMapping.js

@@ -12,24 +12,21 @@
'use strict';
-var ReactChildren = require("./ReactChildren");
-var ReactFragment = require("./ReactFragment");
+var flattenChildren = require('./flattenChildren');
var ReactTransitionChildMapping = {
/**
* Given `this.props.children`, return an object mapping key to child. Just
- * simple syntactic sugar around ReactChildren.map().
+ * simple syntactic sugar around flattenChildren().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
- getChildMapping: function(children) {
+ getChildMapping: function (children) {
if (!children) {
return children;
}
- return ReactFragment.extract(ReactChildren.map(children, function(child) {
- return child;
- }));
+ return flattenChildren(children);
},
/**
@@ -49,7 +46,7 @@
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
- mergeChildMappings: function(prev, next) {
+ mergeChildMappings: function (prev, next) {
prev = prev || {};
next = next || {};
@@ -83,9 +80,7 @@
if (nextKeysPending.hasOwnProperty(nextKey)) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
- childMapping[nextKeysPending[nextKey][i]] = getValueForKey(
- pendingNextKey
- );
+ childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
}
}
childMapping[nextKey] = getValueForKey(nextKey);

lib/ReactTransitionEvents.js

@@ -11,7 +11,7 @@
'use strict';
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
/**
* EVENT_NAME_MAP is used to determine which event fired when a
@@ -84,23 +84,23 @@
}
var ReactTransitionEvents = {
- addEndEventListener: function(node, eventListener) {
+ addEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
- endEvents.forEach(function(endEvent) {
+ endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
- removeEndEventListener: function(node, eventListener) {
+ removeEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
return;
}
- endEvents.forEach(function(endEvent) {
+ endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}

lib/ReactTransitionGroup.js

@@ -11,12 +11,11 @@
'use strict';
-var React = require("./React");
-var ReactTransitionChildMapping = require("./ReactTransitionChildMapping");
+var React = require('./React');
+var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
-var assign = require("./Object.assign");
-var cloneWithProps = require("./cloneWithProps");
-var emptyFunction = require("./emptyFunction");
+var assign = require('./Object.assign');
+var emptyFunction = require('fbjs/lib/emptyFunction');
var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
@@ -26,26 +25,26 @@
childFactory: React.PropTypes.func
},
- getDefaultProps: function() {
+ getDefaultProps: function () {
return {
component: 'span',
childFactory: emptyFunction.thatReturnsArgument
};
},
- getInitialState: function() {
+ getInitialState: function () {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
- componentWillMount: function() {
+ componentWillMount: function () {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
- componentDidMount: function() {
+ componentDidMount: function () {
var initialChildMapping = this.state.children;
for (var key in initialChildMapping) {
if (initialChildMapping[key]) {
@@ -54,33 +53,26 @@
}
},
- componentWillReceiveProps: function(nextProps) {
- var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
- nextProps.children
- );
+ componentWillReceiveProps: function (nextProps) {
+ var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
var prevChildMapping = this.state.children;
this.setState({
- children: ReactTransitionChildMapping.mergeChildMappings(
- prevChildMapping,
- nextChildMapping
- )
+ children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
- if (nextChildMapping[key] && !hasPrev &&
- !this.currentlyTransitioningKeys[key]) {
+ if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
- if (prevChildMapping[key] && !hasNext &&
- !this.currentlyTransitioningKeys[key]) {
+ if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
@@ -88,7 +80,7 @@
// If we want to someday check for reordering, we could do it here.
},
- componentDidUpdate: function() {
+ componentDidUpdate: function () {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
@@ -98,21 +90,19 @@
keysToLeave.forEach(this.performLeave);
},
- performAppear: function(key) {
+ performAppear: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillAppear) {
- component.componentWillAppear(
- this._handleDoneAppearing.bind(this, key)
- );
+ component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
} else {
this._handleDoneAppearing(key);
}
},
- _handleDoneAppearing: function(key) {
+ _handleDoneAppearing: function (key) {
var component = this.refs[key];
if (component.componentDidAppear) {
component.componentDidAppear();
@@ -120,9 +110,7 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully appeared. Remove it.
@@ -130,21 +118,19 @@
}
},
- performEnter: function(key) {
+ performEnter: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
- component.componentWillEnter(
- this._handleDoneEntering.bind(this, key)
- );
+ component.componentWillEnter(this._handleDoneEntering.bind(this, key));
} else {
this._handleDoneEntering(key);
}
},
- _handleDoneEntering: function(key) {
+ _handleDoneEntering: function (key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
@@ -152,9 +138,7 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
@@ -162,7 +146,7 @@
}
},
- performLeave: function(key) {
+ performLeave: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
@@ -176,7 +160,7 @@
}
},
- _handleDoneLeaving: function(key) {
+ _handleDoneLeaving: function (key) {
var component = this.refs[key];
if (component.componentDidLeave) {
@@ -185,21 +169,21 @@
delete this.currentlyTransitioningKeys[key];
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
- this.props.children
- );
+ var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
- var newChildren = assign({}, this.state.children);
+ this.setState(function (state) {
+ var newChildren = assign({}, state.children);
delete newChildren[key];
- this.setState({children: newChildren});
+ return { children: newChildren };
+ });
}
},
- render: function() {
+ render: function () {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = [];
@@ -211,17 +195,10 @@
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
- childrenToRender.push(cloneWithProps(
- this.props.childFactory(child),
- {ref: key, key: key}
- ));
+ childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
}
}
- return React.createElement(
- this.props.component,
- this.props,
- childrenToRender
- );
+ return React.createElement(this.props.component, this.props, childrenToRender);
}
});

lib/ReactUpdateQueue.js

@@ -11,55 +11,33 @@
'use strict';
-var ReactLifeCycle = require("./ReactLifeCycle");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactElement = require("./ReactElement");
-var ReactInstanceMap = require("./ReactInstanceMap");
-var ReactUpdates = require("./ReactUpdates");
-
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
-var warning = require("./warning");
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactElement = require('./ReactElement');
+var ReactInstanceMap = require('./ReactInstanceMap');
+var ReactUpdates = require('./ReactUpdates');
+
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
function enqueueUpdate(internalInstance) {
- if (internalInstance !== ReactLifeCycle.currentlyMountingInstance) {
- // If we're in a componentWillMount handler, don't enqueue a rerender
- // because ReactUpdates assumes we're in a browser context (which is
- // wrong for server rendering) and we're about to do a render anyway.
- // See bug in #1740.
ReactUpdates.enqueueUpdate(internalInstance);
- }
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactCurrentOwner.current == null,
- '%s(...): Cannot update during an existing state transition ' +
- '(such as within `render`). Render methods should be a pure function ' +
- 'of props and state.',
- callerName
- ) : invariant(ReactCurrentOwner.current == null));
-
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
- if ("production" !== process.env.NODE_ENV) {
+ if (process.env.NODE_ENV !== 'production') {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
- ("production" !== process.env.NODE_ENV ? warning(
- !callerName,
- '%s(...): Can only update a mounted or mounting component. ' +
- 'This usually means you called %s() on an unmounted ' +
- 'component. This is a no-op.',
- callerName,
- callerName
- ) : null);
+ process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
}
return null;
}
- if (internalInstance === ReactLifeCycle.currentlyUnmountingInstance) {
- return null;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
return internalInstance;
@@ -72,6 +50,32 @@
var ReactUpdateQueue = {
/**
+ * Checks whether or not this composite component is mounted.
+ * @param {ReactClass} publicInstance The instance we want to test.
+ * @return {boolean} True if mounted, false otherwise.
+ * @protected
+ * @final
+ */
+ isMounted: function (publicInstance) {
+ if (process.env.NODE_ENV !== 'production') {
+ var owner = ReactCurrentOwner.current;
+ if (owner !== null) {
+ process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
+ owner._warnedAboutRefsInRender = true;
+ }
+ }
+ var internalInstance = ReactInstanceMap.get(publicInstance);
+ if (internalInstance) {
+ // During componentWillMount and render this will still be null but after
+ // that will always render to something. At least for now. So we can use
+ // this hack.
+ return !!internalInstance._renderedComponent;
+ } else {
+ return false;
+ }
+ },
+
+ /**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
@@ -79,13 +83,8 @@
* @param {?function} callback Called after state is updated.
* @internal
*/
- enqueueCallback: function(publicInstance, callback) {
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallback: function (publicInstance, callback) {
+ !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
@@ -93,8 +92,7 @@
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
- if (!internalInstance ||
- internalInstance === ReactLifeCycle.currentlyMountingInstance) {
+ if (!internalInstance) {
return null;
}
@@ -110,13 +108,8 @@
enqueueUpdate(internalInstance);
},
- enqueueCallbackInternal: function(internalInstance, callback) {
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof callback === 'function',
- 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' +
- '`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
- 'isn\'t callable.'
- ) : invariant(typeof callback === 'function'));
+ enqueueCallbackInternal: function (internalInstance, callback) {
+ !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
@@ -132,17 +125,14 @@
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
- * This will not invoke `shouldUpdateComponent`, but it will invoke
+ * This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
- enqueueForceUpdate: function(publicInstance) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'forceUpdate'
- );
+ enqueueForceUpdate: function (publicInstance) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
@@ -164,11 +154,8 @@
* @param {object} completeState Next state.
* @internal
*/
- enqueueReplaceState: function(publicInstance, completeState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceState'
- );
+ enqueueReplaceState: function (publicInstance, completeState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
@@ -190,19 +177,14 @@
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
- enqueueSetState: function(publicInstance, partialState) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setState'
- );
+ enqueueSetState: function (publicInstance, partialState) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
- var queue =
- internalInstance._pendingStateQueue ||
- (internalInstance._pendingStateQueue = []);
+ var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
@@ -215,36 +197,26 @@
* @param {object} partialProps Subset of the next props.
* @internal
*/
- enqueueSetProps: function(publicInstance, partialProps) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'setProps'
- );
-
+ enqueueSetProps: function (publicInstance, partialProps) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
+ },
- ("production" !== process.env.NODE_ENV ? invariant(
- internalInstance._isTopLevel,
- 'setProps(...): You called `setProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueSetPropsInternal: function (internalInstance, partialProps) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
/**
@@ -254,38 +226,28 @@
* @param {object} props New props.
* @internal
*/
- enqueueReplaceProps: function(publicInstance, props) {
- var internalInstance = getInternalInstanceReadyForUpdate(
- publicInstance,
- 'replaceProps'
- );
-
+ enqueueReplaceProps: function (publicInstance, props) {
+ var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
if (!internalInstance) {
return;
}
+ ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
+ },
- ("production" !== process.env.NODE_ENV ? invariant(
- internalInstance._isTopLevel,
- 'replaceProps(...): You called `replaceProps` on a ' +
- 'component with a parent. This is an anti-pattern since props will ' +
- 'get reactively updated when rendered. Instead, change the owner\'s ' +
- '`render` method to pass the correct value as props to the component ' +
- 'where it is created.'
- ) : invariant(internalInstance._isTopLevel));
+ enqueueReplacePropsInternal: function (internalInstance, props) {
+ var topLevelWrapper = internalInstance._topLevelWrapper;
+ !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
- var element = internalInstance._pendingElement ||
- internalInstance._currentElement;
- internalInstance._pendingElement = ReactElement.cloneAndReplaceProps(
- element,
- props
- );
+ var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
+ var element = wrapElement.props;
+ topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
- enqueueUpdate(internalInstance);
+ enqueueUpdate(topLevelWrapper);
},
- enqueueElementInternal: function(internalInstance, newElement) {
+ enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}

lib/ReactUpdates.js

@@ -11,16 +11,14 @@
'use strict';
-var CallbackQueue = require("./CallbackQueue");
-var PooledClass = require("./PooledClass");
-var ReactCurrentOwner = require("./ReactCurrentOwner");
-var ReactPerf = require("./ReactPerf");
-var ReactReconciler = require("./ReactReconciler");
-var Transaction = require("./Transaction");
-
-var assign = require("./Object.assign");
-var invariant = require("./invariant");
-var warning = require("./warning");
+var CallbackQueue = require('./CallbackQueue');
+var PooledClass = require('./PooledClass');
+var ReactPerf = require('./ReactPerf');
+var ReactReconciler = require('./ReactReconciler');
+var Transaction = require('./Transaction');
+
+var assign = require('./Object.assign');
+var invariant = require('fbjs/lib/invariant');
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
@@ -29,18 +27,14 @@
var batchingStrategy = null;
function ensureInjected() {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReactUpdates.ReactReconcileTransaction && batchingStrategy,
- 'ReactUpdates: must inject a reconcile transaction class and batching ' +
- 'strategy'
- ) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
+ !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
}
var NESTED_UPDATES = {
- initialize: function() {
+ initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
- close: function() {
+ close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
@@ -56,10 +50,10 @@
};
var UPDATE_QUEUEING = {
- initialize: function() {
+ initialize: function () {
this.callbackQueue.reset();
},
- close: function() {
+ close: function () {
this.callbackQueue.notifyAll();
}
};
@@ -70,18 +64,15 @@
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
- this.reconcileTransaction =
- ReactUpdates.ReactReconcileTransaction.getPooled();
+ this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}
-assign(
- ReactUpdatesFlushTransaction.prototype,
- Transaction.Mixin, {
- getTransactionWrappers: function() {
+assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
+ getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
- destructor: function() {
+ destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
@@ -89,25 +80,18 @@
this.reconcileTransaction = null;
},
- perform: function(method, scope, a) {
+ perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
- return Transaction.Mixin.perform.call(
- this,
- this.reconcileTransaction.perform,
- this.reconcileTransaction,
- method,
- scope,
- a
- );
+ return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
-function batchedUpdates(callback, a, b, c, d) {
+function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
- batchingStrategy.batchedUpdates(callback, a, b, c, d);
+ batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
@@ -123,13 +107,7 @@
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
- ("production" !== process.env.NODE_ENV ? invariant(
- len === dirtyComponents.length,
- 'Expected flush transaction\'s stored dirty-components length (%s) to ' +
- 'match dirty-components array length (%s).',
- len,
- dirtyComponents.length
- ) : invariant(len === dirtyComponents.length));
+ !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
@@ -148,23 +126,17 @@
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
- ReactReconciler.performUpdateIfNecessary(
- component,
- transaction.reconcileTransaction
- );
+ ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
- transaction.callbackQueue.enqueue(
- callbacks[j],
- component.getPublicInstance()
- );
+ transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
-var flushBatchedUpdates = function() {
+var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
@@ -185,11 +157,7 @@
}
}
};
-flushBatchedUpdates = ReactPerf.measure(
- 'ReactUpdates',
- 'flushBatchedUpdates',
- flushBatchedUpdates
-);
+flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
/**
* Mark a component as needing a rerender, adding an optional callback to a
@@ -203,13 +171,6 @@
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
- ("production" !== process.env.NODE_ENV ? warning(
- ReactCurrentOwner.current == null,
- 'enqueueUpdate(): Render methods should be a pure function of props ' +
- 'and state; triggering nested component updates from render is not ' +
- 'allowed. If necessary, trigger nested updates in ' +
- 'componentDidUpdate.'
- ) : null);
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
@@ -224,37 +185,21 @@
* if no updates are currently being performed.
*/
function asap(callback, context) {
- ("production" !== process.env.NODE_ENV ? invariant(
- batchingStrategy.isBatchingUpdates,
- 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
- 'updates are not being batched.'
- ) : invariant(batchingStrategy.isBatchingUpdates));
+ !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
- injectReconcileTransaction: function(ReconcileTransaction) {
- ("production" !== process.env.NODE_ENV ? invariant(
- ReconcileTransaction,
- 'ReactUpdates: must provide a reconcile transaction class'
- ) : invariant(ReconcileTransaction));
+ injectReconcileTransaction: function (ReconcileTransaction) {
+ !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
- injectBatchingStrategy: function(_batchingStrategy) {
- ("production" !== process.env.NODE_ENV ? invariant(
- _batchingStrategy,
- 'ReactUpdates: must provide a batching strategy'
- ) : invariant(_batchingStrategy));
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof _batchingStrategy.batchedUpdates === 'function',
- 'ReactUpdates: must provide a batchedUpdates() function'
- ) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof _batchingStrategy.isBatchingUpdates === 'boolean',
- 'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
- ) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
+ injectBatchingStrategy: function (_batchingStrategy) {
+ !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
+ !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
batchingStrategy = _batchingStrategy;
}
};

lib/ReactVersion.js

@@ -0,0 +1,14 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactVersion
+ */
+
+'use strict';
+
+module.exports = '0.14.9';
\ No newline at end of file

lib/ReactWithAddons.js

@@ -18,18 +18,20 @@
'use strict';
-var LinkedStateMixin = require("./LinkedStateMixin");
-var React = require("./React");
-var ReactComponentWithPureRenderMixin =
- require("./ReactComponentWithPureRenderMixin");
-var ReactCSSTransitionGroup = require("./ReactCSSTransitionGroup");
-var ReactFragment = require("./ReactFragment");
-var ReactTransitionGroup = require("./ReactTransitionGroup");
-var ReactUpdates = require("./ReactUpdates");
-
-var cx = require("./cx");
-var cloneWithProps = require("./cloneWithProps");
-var update = require("./update");
+var LinkedStateMixin = require('./LinkedStateMixin');
+var React = require('./React');
+var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderMixin');
+var ReactCSSTransitionGroup = require('./ReactCSSTransitionGroup');
+var ReactFragment = require('./ReactFragment');
+var ReactTransitionGroup = require('./ReactTransitionGroup');
+var ReactUpdates = require('./ReactUpdates');
+
+var cloneWithProps = require('./cloneWithProps');
+var shallowCompare = require('./shallowCompare');
+var update = require('./update');
+var warning = require('fbjs/lib/warning');
+
+var warnedAboutBatchedUpdates = false;
React.addons = {
CSSTransitionGroup: ReactCSSTransitionGroup,
@@ -37,16 +39,22 @@
PureRenderMixin: ReactComponentWithPureRenderMixin,
TransitionGroup: ReactTransitionGroup,
- batchedUpdates: ReactUpdates.batchedUpdates,
- classSet: cx,
+ batchedUpdates: function () {
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
+ warnedAboutBatchedUpdates = true;
+ }
+ return ReactUpdates.batchedUpdates.apply(this, arguments);
+ },
cloneWithProps: cloneWithProps,
createFragment: ReactFragment.create,
+ shallowCompare: shallowCompare,
update: update
};
-if ("production" !== process.env.NODE_ENV) {
- React.addons.Perf = require("./ReactDefaultPerf");
- React.addons.TestUtils = require("./ReactTestUtils");
+if (process.env.NODE_ENV !== 'production') {
+ React.addons.Perf = require('./ReactDefaultPerf');
+ React.addons.TestUtils = require('./ReactTestUtils');
}
module.exports = React;

lib/renderSubtreeIntoContainer.js

@@ -0,0 +1,16 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+* @providesModule renderSubtreeIntoContainer
+*/
+
+'use strict';
+
+var ReactMount = require('./ReactMount');
+
+module.exports = ReactMount.renderSubtreeIntoContainer;
\ No newline at end of file

lib/ResponderEventPlugin.js

@@ -0,0 +1,519 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ResponderEventPlugin
+ */
+
+'use strict';
+
+var EventConstants = require('./EventConstants');
+var EventPluginUtils = require('./EventPluginUtils');
+var EventPropagators = require('./EventPropagators');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+var ResponderSyntheticEvent = require('./ResponderSyntheticEvent');
+var ResponderTouchHistoryStore = require('./ResponderTouchHistoryStore');
+
+var accumulate = require('./accumulate');
+var invariant = require('fbjs/lib/invariant');
+var keyOf = require('fbjs/lib/keyOf');
+
+var isStartish = EventPluginUtils.isStartish;
+var isMoveish = EventPluginUtils.isMoveish;
+var isEndish = EventPluginUtils.isEndish;
+var executeDirectDispatch = EventPluginUtils.executeDirectDispatch;
+var hasDispatches = EventPluginUtils.hasDispatches;
+var executeDispatchesInOrderStopAtTrue = EventPluginUtils.executeDispatchesInOrderStopAtTrue;
+
+/**
+ * ID of element that should respond to touch/move types of interactions, as
+ * indicated explicitly by relevant callbacks.
+ */
+var responderID = null;
+
+/**
+ * Count of current touches. A textInput should become responder iff the
+ * the selection changes while there is a touch on the screen.
+ */
+var trackedTouchCount = 0;
+
+/**
+ * Last reported number of active touches.
+ */
+var previousActiveTouches = 0;
+
+var changeResponder = function (nextResponderID, blockNativeResponder) {
+ var oldResponderID = responderID;
+ responderID = nextResponderID;
+ if (ResponderEventPlugin.GlobalResponderHandler !== null) {
+ ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderID, nextResponderID, blockNativeResponder);
+ }
+};
+
+var eventTypes = {
+ /**
+ * On a `touchStart`/`mouseDown`, is it desired that this element become the
+ * responder?
+ */
+ startShouldSetResponder: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onStartShouldSetResponder: null }),
+ captured: keyOf({ onStartShouldSetResponderCapture: null })
+ }
+ },
+
+ /**
+ * On a `scroll`, is it desired that this element become the responder? This
+ * is usually not needed, but should be used to retroactively infer that a
+ * `touchStart` had occured during momentum scroll. During a momentum scroll,
+ * a touch start will be immediately followed by a scroll event if the view is
+ * currently scrolling.
+ *
+ * TODO: This shouldn't bubble.
+ */
+ scrollShouldSetResponder: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onScrollShouldSetResponder: null }),
+ captured: keyOf({ onScrollShouldSetResponderCapture: null })
+ }
+ },
+
+ /**
+ * On text selection change, should this element become the responder? This
+ * is needed for text inputs or other views with native selection, so the
+ * JS view can claim the responder.
+ *
+ * TODO: This shouldn't bubble.
+ */
+ selectionChangeShouldSetResponder: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSelectionChangeShouldSetResponder: null }),
+ captured: keyOf({ onSelectionChangeShouldSetResponderCapture: null })
+ }
+ },
+
+ /**
+ * On a `touchMove`/`mouseMove`, is it desired that this element become the
+ * responder?
+ */
+ moveShouldSetResponder: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onMoveShouldSetResponder: null }),
+ captured: keyOf({ onMoveShouldSetResponderCapture: null })
+ }
+ },
+
+ /**
+ * Direct responder events dispatched directly to responder. Do not bubble.
+ */
+ responderStart: { registrationName: keyOf({ onResponderStart: null }) },
+ responderMove: { registrationName: keyOf({ onResponderMove: null }) },
+ responderEnd: { registrationName: keyOf({ onResponderEnd: null }) },
+ responderRelease: { registrationName: keyOf({ onResponderRelease: null }) },
+ responderTerminationRequest: {
+ registrationName: keyOf({ onResponderTerminationRequest: null })
+ },
+ responderGrant: { registrationName: keyOf({ onResponderGrant: null }) },
+ responderReject: { registrationName: keyOf({ onResponderReject: null }) },
+ responderTerminate: { registrationName: keyOf({ onResponderTerminate: null }) }
+};
+
+/**
+ *
+ * Responder System:
+ * ----------------
+ *
+ * - A global, solitary "interaction lock" on a view.
+ * - If a node becomes the responder, it should convey visual feedback
+ * immediately to indicate so, either by highlighting or moving accordingly.
+ * - To be the responder means, that touches are exclusively important to that
+ * responder view, and no other view.
+ * - While touches are still occuring, the responder lock can be transfered to
+ * a new view, but only to increasingly "higher" views (meaning ancestors of
+ * the current responder).
+ *
+ * Responder being granted:
+ * ------------------------
+ *
+ * - Touch starts, moves, and scrolls can cause an ID to become the responder.
+ * - We capture/bubble `startShouldSetResponder`/`moveShouldSetResponder` to
+ * the "appropriate place".
+ * - If nothing is currently the responder, the "appropriate place" is the
+ * initiating event's `targetID`.
+ * - If something *is* already the responder, the "appropriate place" is the
+ * first common ancestor of the event target and the current `responderID`.
+ * - Some negotiation happens: See the timing diagram below.
+ * - Scrolled views automatically become responder. The reasoning is that a
+ * platform scroll view that isn't built on top of the responder system has
+ * began scrolling, and the active responder must now be notified that the
+ * interaction is no longer locked to it - the system has taken over.
+ *
+ * - Responder being released:
+ * As soon as no more touches that *started* inside of descendents of the
+ * *current* responderID, an `onResponderRelease` event is dispatched to the
+ * current responder, and the responder lock is released.
+ *
+ * TODO:
+ * - on "end", a callback hook for `onResponderEndShouldRemainResponder` that
+ * determines if the responder lock should remain.
+ * - If a view shouldn't "remain" the responder, any active touches should by
+ * default be considered "dead" and do not influence future negotiations or
+ * bubble paths. It should be as if those touches do not exist.
+ * -- For multitouch: Usually a translate-z will choose to "remain" responder
+ * after one out of many touches ended. For translate-y, usually the view
+ * doesn't wish to "remain" responder after one of many touches end.
+ * - Consider building this on top of a `stopPropagation` model similar to
+ * `W3C` events.
+ * - Ensure that `onResponderTerminate` is called on touch cancels, whether or
+ * not `onResponderTerminationRequest` returns `true` or `false`.
+ *
+ */
+
+/* Negotiation Performed
+ +-----------------------+
+ / \
+Process low level events to + Current Responder + wantsResponderID
+determine who to perform negot-| (if any exists at all) |
+iation/transition | Otherwise just pass through|
+-------------------------------+----------------------------+------------------+
+Bubble to find first ID | |
+to return true:wantsResponderID| |
+ | |
+ +-------------+ | |
+ | onTouchStart| | |
+ +------+------+ none | |
+ | return| |
++-----------v-------------+true| +------------------------+ |
+|onStartShouldSetResponder|----->|onResponderStart (cur) |<-----------+
++-----------+-------------+ | +------------------------+ | |
+ | | | +--------+-------+
+ | returned true for| false:REJECT +-------->|onResponderReject
+ | wantsResponderID | | | +----------------+
+ | (now attempt | +------------------+-----+ |
+ | handoff) | | onResponder | |
+ +------------------->| TerminationRequest| |
+ | +------------------+-----+ |
+ | | | +----------------+
+ | true:GRANT +-------->|onResponderGrant|
+ | | +--------+-------+
+ | +------------------------+ | |
+ | | onResponderTerminate |<-----------+
+ | +------------------+-----+ |
+ | | | +----------------+
+ | +-------->|onResponderStart|
+ | | +----------------+
+Bubble to find first ID | |
+to return true:wantsResponderID| |
+ | |
+ +-------------+ | |
+ | onTouchMove | | |
+ +------+------+ none | |
+ | return| |
++-----------v-------------+true| +------------------------+ |
+|onMoveShouldSetResponder |----->|onResponderMove (cur) |<-----------+
++-----------+-------------+ | +------------------------+ | |
+ | | | +--------+-------+
+ | returned true for| false:REJECT +-------->|onResponderRejec|
+ | wantsResponderID | | | +----------------+
+ | (now attempt | +------------------+-----+ |
+ | handoff) | | onResponder | |
+ +------------------->| TerminationRequest| |
+ | +------------------+-----+ |
+ | | | +----------------+
+ | true:GRANT +-------->|onResponderGrant|
+ | | +--------+-------+
+ | +------------------------+ | |
+ | | onResponderTerminate |<-----------+
+ | +------------------+-----+ |
+ | | | +----------------+
+ | +-------->|onResponderMove |
+ | | +----------------+
+ | |
+ | |
+ Some active touch started| |
+ inside current responder | +------------------------+ |
+ +------------------------->| onResponderEnd | |
+ | | +------------------------+ |
+ +---+---------+ | |
+ | onTouchEnd | | |
+ +---+---------+ | |
+ | | +------------------------+ |
+ +------------------------->| onResponderEnd | |
+ No active touches started| +-----------+------------+ |
+ inside current responder | | |
+ | v |
+ | +------------------------+ |
+ | | onResponderRelease | |
+ | +------------------------+ |
+ | |
+ + + */
+
+/**
+ * A note about event ordering in the `EventPluginHub`.
+ *
+ * Suppose plugins are injected in the following order:
+ *
+ * `[R, S, C]`
+ *
+ * To help illustrate the example, assume `S` is `SimpleEventPlugin` (for
+ * `onClick` etc) and `R` is `ResponderEventPlugin`.
+ *
+ * "Deferred-Dispatched Events":
+ *
+ * - The current event plugin system will traverse the list of injected plugins,
+ * in order, and extract events by collecting the plugin's return value of
+ * `extractEvents()`.
+ * - These events that are returned from `extractEvents` are "deferred
+ * dispatched events".
+ * - When returned from `extractEvents`, deferred-dispatched events contain an
+ * "accumulation" of deferred dispatches.
+ * - These deferred dispatches are accumulated/collected before they are
+ * returned, but processed at a later time by the `EventPluginHub` (hence the
+ * name deferred).
+ *
+ * In the process of returning their deferred-dispatched events, event plugins
+ * themselves can dispatch events on-demand without returning them from
+ * `extractEvents`. Plugins might want to do this, so that they can use event
+ * dispatching as a tool that helps them decide which events should be extracted
+ * in the first place.
+ *
+ * "On-Demand-Dispatched Events":
+ *
+ * - On-demand-dispatched events are not returned from `extractEvents`.
+ * - On-demand-dispatched events are dispatched during the process of returning
+ * the deferred-dispatched events.
+ * - They should not have side effects.
+ * - They should be avoided, and/or eventually be replaced with another
+ * abstraction that allows event plugins to perform multiple "rounds" of event
+ * extraction.
+ *
+ * Therefore, the sequence of event dispatches becomes:
+ *
+ * - `R`s on-demand events (if any) (dispatched by `R` on-demand)
+ * - `S`s on-demand events (if any) (dispatched by `S` on-demand)
+ * - `C`s on-demand events (if any) (dispatched by `C` on-demand)
+ * - `R`s extracted events (if any) (dispatched by `EventPluginHub`)
+ * - `S`s extracted events (if any) (dispatched by `EventPluginHub`)
+ * - `C`s extracted events (if any) (dispatched by `EventPluginHub`)
+ *
+ * In the case of `ResponderEventPlugin`: If the `startShouldSetResponder`
+ * on-demand dispatch returns `true` (and some other details are satisfied) the
+ * `onResponderGrant` deferred dispatched event is returned from
+ * `extractEvents`. The sequence of dispatch executions in this case
+ * will appear as follows:
+ *
+ * - `startShouldSetResponder` (`ResponderEventPlugin` dispatches on-demand)
+ * - `touchStartCapture` (`EventPluginHub` dispatches as usual)
+ * - `touchStart` (`EventPluginHub` dispatches as usual)
+ * - `responderGrant/Reject` (`EventPluginHub` dispatches as usual)
+ *
+ * @param {string} topLevelType Record from `EventConstants`.
+ * @param {string} topLevelTargetID ID of deepest React rendered element.
+ * @param {object} nativeEvent Native browser event.
+ * @return {*} An accumulation of synthetic events.
+ */
+function setResponderAndExtractTransfer(topLevelType, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === EventConstants.topLevelTypes.topSelectionChange ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
+
+ // TODO: stop one short of the the current responder.
+ var bubbleShouldSetFrom = !responderID ? topLevelTargetID : ReactInstanceHandles.getFirstCommonAncestorID(responderID, topLevelTargetID);
+
+ // When capturing/bubbling the "shouldSet" event, we want to skip the target
+ // (deepest ID) if it happens to be the current responder. The reasoning:
+ // It's strange to get an `onMoveShouldSetResponder` when you're *already*
+ // the responder.
+ var skipOverBubbleShouldSetFrom = bubbleShouldSetFrom === responderID;
+ var shouldSetEvent = ResponderSyntheticEvent.getPooled(shouldSetEventType, bubbleShouldSetFrom, nativeEvent, nativeEventTarget);
+ shouldSetEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
+ if (skipOverBubbleShouldSetFrom) {
+ EventPropagators.accumulateTwoPhaseDispatchesSkipTarget(shouldSetEvent);
+ } else {
+ EventPropagators.accumulateTwoPhaseDispatches(shouldSetEvent);
+ }
+ var wantsResponderID = executeDispatchesInOrderStopAtTrue(shouldSetEvent);
+ if (!shouldSetEvent.isPersistent()) {
+ shouldSetEvent.constructor.release(shouldSetEvent);
+ }
+
+ if (!wantsResponderID || wantsResponderID === responderID) {
+ return null;
+ }
+ var extracted;
+ var grantEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderGrant, wantsResponderID, nativeEvent, nativeEventTarget);
+ grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
+
+ EventPropagators.accumulateDirectDispatches(grantEvent);
+ var blockNativeResponder = executeDirectDispatch(grantEvent) === true;
+ if (responderID) {
+
+ var terminationRequestEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderTerminationRequest, responderID, nativeEvent, nativeEventTarget);
+ terminationRequestEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
+ EventPropagators.accumulateDirectDispatches(terminationRequestEvent);
+ var shouldSwitch = !hasDispatches(terminationRequestEvent) || executeDirectDispatch(terminationRequestEvent);
+ if (!terminationRequestEvent.isPersistent()) {
+ terminationRequestEvent.constructor.release(terminationRequestEvent);
+ }
+
+ if (shouldSwitch) {
+ var terminateType = eventTypes.responderTerminate;
+ var terminateEvent = ResponderSyntheticEvent.getPooled(terminateType, responderID, nativeEvent, nativeEventTarget);
+ terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
+ EventPropagators.accumulateDirectDispatches(terminateEvent);
+ extracted = accumulate(extracted, [grantEvent, terminateEvent]);
+ changeResponder(wantsResponderID, blockNativeResponder);
+ } else {
+ var rejectEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderReject, wantsResponderID, nativeEvent, nativeEventTarget);
+ rejectEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
+ EventPropagators.accumulateDirectDispatches(rejectEvent);
+ extracted = accumulate(extracted, rejectEvent);
+ }
+ } else {
+ extracted = accumulate(extracted, grantEvent);
+ changeResponder(wantsResponderID, blockNativeResponder);
+ }
+ return extracted;
+}
+
+/**
+ * A transfer is a negotiation between a currently set responder and the next
+ * element to claim responder status. Any start event could trigger a transfer
+ * of responderID. Any move event could trigger a transfer.
+ *
+ * @param {string} topLevelType Record from `EventConstants`.
+ * @return {boolean} True if a transfer of responder could possibly occur.
+ */
+function canTriggerTransfer(topLevelType, topLevelTargetID, nativeEvent) {
+ return topLevelTargetID && (
+ // responderIgnoreScroll: We are trying to migrate away from specifically tracking native scroll
+ // events here and responderIgnoreScroll indicates we will send topTouchCancel to handle
+ // canceling touch events instead
+ topLevelType === EventConstants.topLevelTypes.topScroll && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === EventConstants.topLevelTypes.topSelectionChange || isStartish(topLevelType) || isMoveish(topLevelType));
+}
+
+/**
+ * Returns whether or not this touch end event makes it such that there are no
+ * longer any touches that started inside of the current `responderID`.
+ *
+ * @param {NativeEvent} nativeEvent Native touch end event.
+ * @return {boolean} Whether or not this touch end event ends the responder.
+ */
+function noResponderTouches(nativeEvent) {
+ var touches = nativeEvent.touches;
+ if (!touches || touches.length === 0) {
+ return true;
+ }
+ for (var i = 0; i < touches.length; i++) {
+ var activeTouch = touches[i];
+ var target = activeTouch.target;
+ if (target !== null && target !== undefined && target !== 0) {
+ // Is the original touch location inside of the current responder?
+ var isAncestor = ReactInstanceHandles.isAncestorIDOf(responderID, EventPluginUtils.getID(target));
+ if (isAncestor) {
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+var ResponderEventPlugin = {
+
+ getResponderID: function () {
+ return responderID;
+ },
+
+ eventTypes: eventTypes,
+
+ /**
+ * We must be resilient to `topLevelTargetID` being `undefined` on
+ * `touchMove`, or `touchEnd`. On certain platforms, this means that a native
+ * scroll has assumed control and the original touch targets are destroyed.
+ *
+ * @param {string} topLevelType Record from `EventConstants`.
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
+ * @param {object} nativeEvent Native browser event.
+ * @return {*} An accumulation of synthetic events.
+ * @see {EventPluginHub.extractEvents}
+ */
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (isStartish(topLevelType)) {
+ trackedTouchCount += 1;
+ } else if (isEndish(topLevelType)) {
+ trackedTouchCount -= 1;
+ !(trackedTouchCount >= 0) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Ended a touch event which was not counted in trackedTouchCount.') : invariant(false) : undefined;
+ }
+
+ ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent, nativeEventTarget);
+
+ var extracted = canTriggerTransfer(topLevelType, topLevelTargetID, nativeEvent) ? setResponderAndExtractTransfer(topLevelType, topLevelTargetID, nativeEvent, nativeEventTarget) : null;
+ // Responder may or may not have transfered on a new touch start/move.
+ // Regardless, whoever is the responder after any potential transfer, we
+ // direct all touch start/move/ends to them in the form of
+ // `onResponderMove/Start/End`. These will be called for *every* additional
+ // finger that move/start/end, dispatched directly to whoever is the
+ // current responder at that moment, until the responder is "released".
+ //
+ // These multiple individual change touch events are are always bookended
+ // by `onResponderGrant`, and one of
+ // (`onResponderRelease/onResponderTerminate`).
+ var isResponderTouchStart = responderID && isStartish(topLevelType);
+ var isResponderTouchMove = responderID && isMoveish(topLevelType);
+ var isResponderTouchEnd = responderID && isEndish(topLevelType);
+ var incrementalTouch = isResponderTouchStart ? eventTypes.responderStart : isResponderTouchMove ? eventTypes.responderMove : isResponderTouchEnd ? eventTypes.responderEnd : null;
+
+ if (incrementalTouch) {
+ var gesture = ResponderSyntheticEvent.getPooled(incrementalTouch, responderID, nativeEvent, nativeEventTarget);
+ gesture.touchHistory = ResponderTouchHistoryStore.touchHistory;
+ EventPropagators.accumulateDirectDispatches(gesture);
+ extracted = accumulate(extracted, gesture);
+ }
+
+ var isResponderTerminate = responderID && topLevelType === EventConstants.topLevelTypes.topTouchCancel;
+ var isResponderRelease = responderID && !isResponderTerminate && isEndish(topLevelType) && noResponderTouches(nativeEvent);
+ var finalTouch = isResponderTerminate ? eventTypes.responderTerminate : isResponderRelease ? eventTypes.responderRelease : null;
+ if (finalTouch) {
+ var finalEvent = ResponderSyntheticEvent.getPooled(finalTouch, responderID, nativeEvent, nativeEventTarget);
+ finalEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
+ EventPropagators.accumulateDirectDispatches(finalEvent);
+ extracted = accumulate(extracted, finalEvent);
+ changeResponder(null);
+ }
+
+ var numberActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
+ if (ResponderEventPlugin.GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches) {
+ ResponderEventPlugin.GlobalInteractionHandler.onChange(numberActiveTouches);
+ }
+ previousActiveTouches = numberActiveTouches;
+
+ return extracted;
+ },
+
+ GlobalResponderHandler: null,
+ GlobalInteractionHandler: null,
+
+ injection: {
+ /**
+ * @param {{onChange: (ReactID, ReactID) => void} GlobalResponderHandler
+ * Object that handles any change in responder. Use this to inject
+ * integration with an existing touch handling system etc.
+ */
+ injectGlobalResponderHandler: function (GlobalResponderHandler) {
+ ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
+ },
+
+ /**
+ * @param {{onChange: (numberActiveTouches) => void} GlobalInteractionHandler
+ * Object that handles any change in the number of active touches.
+ */
+ injectGlobalInteractionHandler: function (GlobalInteractionHandler) {
+ ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
+ }
+ }
+};
+
+module.exports = ResponderEventPlugin;
\ No newline at end of file

lib/ResponderSyntheticEvent.js

@@ -0,0 +1,40 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ResponderSyntheticEvent
+ * @typechecks static-only
+ */
+
+'use strict';
+
+var SyntheticEvent = require('./SyntheticEvent');
+
+/**
+ * `touchHistory` isn't actually on the native event, but putting it in the
+ * interface will ensure that it is cleaned up when pooled/destroyed. The
+ * `ResponderEventPlugin` will populate it appropriately.
+ */
+var ResponderEventInterface = {
+ touchHistory: function (nativeEvent) {
+ return null; // Actually doesn't even look at the native event.
+ }
+};
+
+/**
+ * @param {object} dispatchConfig Configuration used to dispatch this event.
+ * @param {string} dispatchMarker Marker identifying the event target.
+ * @param {object} nativeEvent Native event.
+ * @extends {SyntheticEvent}
+ */
+function ResponderSyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
+}
+
+SyntheticEvent.augmentClass(ResponderSyntheticEvent, ResponderEventInterface);
+
+module.exports = ResponderSyntheticEvent;
\ No newline at end of file

lib/ResponderTouchHistoryStore.js

@@ -0,0 +1,180 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ResponderTouchHistoryStore
+ */
+
+'use strict';
+
+var EventPluginUtils = require('./EventPluginUtils');
+
+var invariant = require('fbjs/lib/invariant');
+
+var isMoveish = EventPluginUtils.isMoveish;
+var isStartish = EventPluginUtils.isStartish;
+var isEndish = EventPluginUtils.isEndish;
+
+var MAX_TOUCH_BANK = 20;
+
+/**
+ * Touch position/time tracking information by touchID. Typically, we'll only
+ * see IDs with a range of 1-20 (they are recycled when touches end and then
+ * start again). This data is commonly needed by many different interaction
+ * logic modules so precomputing it is very helpful to do once.
+ * Each touch object in `touchBank` is of the following form:
+ * { touchActive: boolean,
+ * startTimeStamp: number,
+ * startPageX: number,
+ * startPageY: number,
+ * currentPageX: number,
+ * currentPageY: number,
+ * currentTimeStamp: number
+ * }
+ */
+var touchHistory = {
+ touchBank: [],
+ numberActiveTouches: 0,
+ // If there is only one active touch, we remember its location. This prevents
+ // us having to loop through all of the touches all the time in the most
+ // common case.
+ indexOfSingleActiveTouch: -1,
+ mostRecentTimeStamp: 0
+};
+
+var timestampForTouch = function (touch) {
+ // The legacy internal implementation provides "timeStamp", which has been
+ // renamed to "timestamp". Let both work for now while we iron it out
+ // TODO (evv): rename timeStamp to timestamp in internal code
+ return touch.timeStamp || touch.timestamp;
+};
+
+/**
+ * TODO: Instead of making gestures recompute filtered velocity, we could
+ * include a built in velocity computation that can be reused globally.
+ * @param {Touch} touch Native touch object.
+ */
+var initializeTouchData = function (touch) {
+ return {
+ touchActive: true,
+ startTimeStamp: timestampForTouch(touch),
+ startPageX: touch.pageX,
+ startPageY: touch.pageY,
+ currentPageX: touch.pageX,
+ currentPageY: touch.pageY,
+ currentTimeStamp: timestampForTouch(touch),
+ previousPageX: touch.pageX,
+ previousPageY: touch.pageY,
+ previousTimeStamp: timestampForTouch(touch)
+ };
+};
+
+var reinitializeTouchTrack = function (touchTrack, touch) {
+ touchTrack.touchActive = true;
+ touchTrack.startTimeStamp = timestampForTouch(touch);
+ touchTrack.startPageX = touch.pageX;
+ touchTrack.startPageY = touch.pageY;
+ touchTrack.currentPageX = touch.pageX;
+ touchTrack.currentPageY = touch.pageY;
+ touchTrack.currentTimeStamp = timestampForTouch(touch);
+ touchTrack.previousPageX = touch.pageX;
+ touchTrack.previousPageY = touch.pageY;
+ touchTrack.previousTimeStamp = timestampForTouch(touch);
+};
+
+var validateTouch = function (touch) {
+ var identifier = touch.identifier;
+ !(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') : invariant(false) : undefined;
+ if (identifier > MAX_TOUCH_BANK) {
+ console.warn('Touch identifier ' + identifier + ' is greater than maximum ' + 'supported ' + MAX_TOUCH_BANK + ' which causes performance issues ' + 'backfilling array locations for all of the indices.');
+ }
+};
+
+var recordStartTouchData = function (touch) {
+ var touchBank = touchHistory.touchBank;
+ var identifier = touch.identifier;
+ var touchTrack = touchBank[identifier];
+ if (process.env.NODE_ENV !== 'production') {
+ validateTouch(touch);
+ }
+ if (touchTrack) {
+ reinitializeTouchTrack(touchTrack, touch);
+ } else {
+ touchBank[touch.identifier] = initializeTouchData(touch);
+ }
+ touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
+};
+
+var recordMoveTouchData = function (touch) {
+ var touchBank = touchHistory.touchBank;
+ var touchTrack = touchBank[touch.identifier];
+ if (process.env.NODE_ENV !== 'production') {
+ validateTouch(touch);
+ !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : undefined;
+ }
+ touchTrack.touchActive = true;
+ touchTrack.previousPageX = touchTrack.currentPageX;
+ touchTrack.previousPageY = touchTrack.currentPageY;
+ touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
+ touchTrack.currentPageX = touch.pageX;
+ touchTrack.currentPageY = touch.pageY;
+ touchTrack.currentTimeStamp = timestampForTouch(touch);
+ touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
+};
+
+var recordEndTouchData = function (touch) {
+ var touchBank = touchHistory.touchBank;
+ var touchTrack = touchBank[touch.identifier];
+ if (process.env.NODE_ENV !== 'production') {
+ validateTouch(touch);
+ !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : undefined;
+ }
+ touchTrack.previousPageX = touchTrack.currentPageX;
+ touchTrack.previousPageY = touchTrack.currentPageY;
+ touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
+ touchTrack.currentPageX = touch.pageX;
+ touchTrack.currentPageY = touch.pageY;
+ touchTrack.currentTimeStamp = timestampForTouch(touch);
+ touchTrack.touchActive = false;
+ touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
+};
+
+var ResponderTouchHistoryStore = {
+ recordTouchTrack: function (topLevelType, nativeEvent) {
+ var touchBank = touchHistory.touchBank;
+ if (isMoveish(topLevelType)) {
+ nativeEvent.changedTouches.forEach(recordMoveTouchData);
+ } else if (isStartish(topLevelType)) {
+ nativeEvent.changedTouches.forEach(recordStartTouchData);
+ touchHistory.numberActiveTouches = nativeEvent.touches.length;
+ if (touchHistory.numberActiveTouches === 1) {
+ touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier;
+ }
+ } else if (isEndish(topLevelType)) {
+ nativeEvent.changedTouches.forEach(recordEndTouchData);
+ touchHistory.numberActiveTouches = nativeEvent.touches.length;
+ if (touchHistory.numberActiveTouches === 1) {
+ for (var i = 0; i < touchBank.length; i++) {
+ var touchTrackToCheck = touchBank[i];
+ if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
+ touchHistory.indexOfSingleActiveTouch = i;
+ break;
+ }
+ }
+ if (process.env.NODE_ENV !== 'production') {
+ var activeTouchData = touchBank[touchHistory.indexOfSingleActiveTouch];
+ var foundActive = activeTouchData != null && !!activeTouchData.touchActive;
+ !foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') : invariant(false) : undefined;
+ }
+ }
+ }
+ },
+
+ touchHistory: touchHistory
+};
+
+module.exports = ResponderTouchHistoryStore;
\ No newline at end of file

lib/SelectEventPlugin.js

@@ -11,33 +11,28 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPropagators = require("./EventPropagators");
-var ReactInputSelection = require("./ReactInputSelection");
-var SyntheticEvent = require("./SyntheticEvent");
-
-var getActiveElement = require("./getActiveElement");
-var isTextInputElement = require("./isTextInputElement");
-var keyOf = require("./keyOf");
-var shallowEqual = require("./shallowEqual");
+var EventConstants = require('./EventConstants');
+var EventPropagators = require('./EventPropagators');
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var ReactInputSelection = require('./ReactInputSelection');
+var SyntheticEvent = require('./SyntheticEvent');
+
+var getActiveElement = require('fbjs/lib/getActiveElement');
+var isTextInputElement = require('./isTextInputElement');
+var keyOf = require('fbjs/lib/keyOf');
+var shallowEqual = require('fbjs/lib/shallowEqual');
var topLevelTypes = EventConstants.topLevelTypes;
+var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
+
var eventTypes = {
select: {
phasedRegistrationNames: {
- bubbled: keyOf({onSelect: null}),
- captured: keyOf({onSelectCapture: null})
+ bubbled: keyOf({ onSelect: null }),
+ captured: keyOf({ onSelectCapture: null })
},
- dependencies: [
- topLevelTypes.topBlur,
- topLevelTypes.topContextMenu,
- topLevelTypes.topFocus,
- topLevelTypes.topKeyDown,
- topLevelTypes.topMouseDown,
- topLevelTypes.topMouseUp,
- topLevelTypes.topSelectionChange
- ]
+ dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
}
};
@@ -46,6 +41,11 @@
var lastSelection = null;
var mouseDown = false;
+// Track whether a listener exists for this plugin. If none exist, we do
+// not extract events.
+var hasListener = false;
+var ON_SELECT_KEY = keyOf({ onSelect: null });
+
/**
* Get an object which is a unique representation of the current selection.
*
@@ -53,11 +53,10 @@
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
- * @param {object}
+ * @return {object}
*/
function getSelection(node) {
- if ('selectionStart' in node &&
- ReactInputSelection.hasSelectionCapabilities(node)) {
+ if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
@@ -87,14 +86,12 @@
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
-function constructSelectEvent(nativeEvent) {
+function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
- if (mouseDown ||
- activeElement == null ||
- activeElement !== getActiveElement()) {
+ if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
@@ -103,11 +100,7 @@
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
- var syntheticEvent = SyntheticEvent.getPooled(
- eventTypes.select,
- activeElementID,
- nativeEvent
- );
+ var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
@@ -116,6 +109,8 @@
return syntheticEvent;
}
+
+ return null;
}
/**
@@ -144,17 +139,15 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (!hasListener) {
+ return null;
+ }
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
- if (isTextInputElement(topLevelTarget) ||
- topLevelTarget.contentEditable === 'true') {
+ if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
@@ -174,18 +167,33 @@
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
- // sometimes when it hasn't).
+ // sometimes when it hasn't). IE's event fires out of order with respect
+ // to key and input events on deletion, so we discard it.
+ //
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
+ // This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
+ if (skipSelectionChangeEvent) {
+ break;
+ }
+ // falls through
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
- return constructSelectEvent(nativeEvent);
+ return constructSelectEvent(nativeEvent, nativeEventTarget);
+ }
+
+ return null;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ if (registrationName === ON_SELECT_KEY) {
+ hasListener = true;
}
}
};

lib/ServerReactRootIndex.js

@@ -21,7 +21,7 @@
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
- createReactRootIndex: function() {
+ createReactRootIndex: function () {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};

lib/setInnerHTML.js

@@ -13,7 +13,7 @@
'use strict';
-var ExecutionEnvironment = require("./ExecutionEnvironment");
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
@@ -26,14 +26,14 @@
* @param {string} html
* @internal
*/
-var setInnerHTML = function(node, html) {
+var setInnerHTML = function (node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
- setInnerHTML = function(node, html) {
- MSApp.execUnsafeLocalFunction(function() {
+ setInnerHTML = function (node, html) {
+ MSApp.execUnsafeLocalFunction(function () {
node.innerHTML = html;
});
};
@@ -49,7 +49,7 @@
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
- setInnerHTML = function(node, html) {
+ setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
@@ -63,11 +63,14 @@
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
- if (WHITESPACE_TEST.test(html) ||
- html[0] === '<' && NONVISIBLE_TEST.test(html)) {
+ if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
- node.innerHTML = '\uFEFF' + html;
+ // UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
+ // in hopes that this is preserved even if "\uFEFF" is transformed to
+ // the actual Unicode character (by Babel, for example).
+ // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
+ node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.

lib/setTextContent.js

@@ -11,9 +11,9 @@
'use strict';
-var ExecutionEnvironment = require("./ExecutionEnvironment");
-var escapeTextContentForBrowser = require("./escapeTextContentForBrowser");
-var setInnerHTML = require("./setInnerHTML");
+var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
+var escapeTextContentForBrowser = require('./escapeTextContentForBrowser');
+var setInnerHTML = require('./setInnerHTML');
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
@@ -25,13 +25,13 @@
* @param {string} text
* @internal
*/
-var setTextContent = function(node, text) {
+var setTextContent = function (node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
- setTextContent = function(node, text) {
+ setTextContent = function (node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}

lib/shallowCompare.js

@@ -0,0 +1,24 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+* @providesModule shallowCompare
+*/
+
+'use strict';
+
+var shallowEqual = require('fbjs/lib/shallowEqual');
+
+/**
+ * Does a shallow comparison for props and state.
+ * See ReactComponentWithPureRenderMixin
+ */
+function shallowCompare(instance, nextProps, nextState) {
+ return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
+}
+
+module.exports = shallowCompare;
\ No newline at end of file

lib/shallowEqual.js

@@ -1,42 +0,0 @@
-/**
- * Copyright 2013-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule shallowEqual
- */
-
-'use strict';
-
-/**
- * Performs equality by iterating through keys on an object and returning
- * false when any key has values which are not strictly equal between
- * objA and objB. Returns true when the values of all keys are strictly equal.
- *
- * @return {boolean}
- */
-function shallowEqual(objA, objB) {
- if (objA === objB) {
- return true;
- }
- var key;
- // Test for A's keys different from B.
- for (key in objA) {
- if (objA.hasOwnProperty(key) &&
- (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) {
- return false;
- }
- }
- // Test for B's keys missing from A.
- for (key in objB) {
- if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
- return false;
- }
- }
- return true;
-}
-
-module.exports = shallowEqual;

lib/shouldUpdateReactComponent.js

@@ -12,8 +12,6 @@
'use strict';
-var warning = require("./warning");
-
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
@@ -26,73 +24,18 @@
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
- if (prevElement != null && nextElement != null) {
+ var prevEmpty = prevElement === null || prevElement === false;
+ var nextEmpty = nextElement === null || nextElement === false;
+ if (prevEmpty || nextEmpty) {
+ return prevEmpty === nextEmpty;
+ }
+
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
- return (nextType === 'string' || nextType === 'number');
+ return nextType === 'string' || nextType === 'number';
} else {
- if (nextType === 'object' &&
- prevElement.type === nextElement.type &&
- prevElement.key === nextElement.key) {
- var ownersMatch = prevElement._owner === nextElement._owner;
- var prevName = null;
- var nextName = null;
- var nextDisplayName = null;
- if ("production" !== process.env.NODE_ENV) {
- if (!ownersMatch) {
- if (prevElement._owner != null &&
- prevElement._owner.getPublicInstance() != null &&
- prevElement._owner.getPublicInstance().constructor != null) {
- prevName =
- prevElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement._owner != null &&
- nextElement._owner.getPublicInstance() != null &&
- nextElement._owner.getPublicInstance().constructor != null) {
- nextName =
- nextElement._owner.getPublicInstance().constructor.displayName;
- }
- if (nextElement.type != null &&
- nextElement.type.displayName != null) {
- nextDisplayName = nextElement.type.displayName;
- }
- if (nextElement.type != null && typeof nextElement.type === 'string') {
- nextDisplayName = nextElement.type;
- }
- if (typeof nextElement.type !== 'string' ||
- nextElement.type === 'input' ||
- nextElement.type === 'textarea') {
- if ((prevElement._owner != null &&
- prevElement._owner._isOwnerNecessary === false) ||
- (nextElement._owner != null &&
- nextElement._owner._isOwnerNecessary === false)) {
- if (prevElement._owner != null) {
- prevElement._owner._isOwnerNecessary = true;
- }
- if (nextElement._owner != null) {
- nextElement._owner._isOwnerNecessary = true;
- }
- ("production" !== process.env.NODE_ENV ? warning(
- false,
- '<%s /> is being rendered by both %s and %s using the same ' +
- 'key (%s) in the same place. Currently, this means that ' +
- 'they don\'t preserve state. This behavior should be very ' +
- 'rare so we\'re considering deprecating it. Please contact ' +
- 'the React team and explain your use case so that we can ' +
- 'take that into consideration.',
- nextDisplayName || 'Unknown Component',
- prevName || '[Unknown]',
- nextName || '[Unknown]',
- prevElement.key
- ) : null);
- }
- }
- }
- }
- return ownersMatch;
- }
- }
+ return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;
}

lib/SimpleEventPlugin.js

@@ -11,244 +11,379 @@
'use strict';
-var EventConstants = require("./EventConstants");
-var EventPluginUtils = require("./EventPluginUtils");
-var EventPropagators = require("./EventPropagators");
-var SyntheticClipboardEvent = require("./SyntheticClipboardEvent");
-var SyntheticEvent = require("./SyntheticEvent");
-var SyntheticFocusEvent = require("./SyntheticFocusEvent");
-var SyntheticKeyboardEvent = require("./SyntheticKeyboardEvent");
-var SyntheticMouseEvent = require("./SyntheticMouseEvent");
-var SyntheticDragEvent = require("./SyntheticDragEvent");
-var SyntheticTouchEvent = require("./SyntheticTouchEvent");
-var SyntheticUIEvent = require("./SyntheticUIEvent");
-var SyntheticWheelEvent = require("./SyntheticWheelEvent");
-
-var getEventCharCode = require("./getEventCharCode");
-
-var invariant = require("./invariant");
-var keyOf = require("./keyOf");
-var warning = require("./warning");
+var EventConstants = require('./EventConstants');
+var EventListener = require('fbjs/lib/EventListener');
+var EventPropagators = require('./EventPropagators');
+var ReactMount = require('./ReactMount');
+var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
+var SyntheticEvent = require('./SyntheticEvent');
+var SyntheticFocusEvent = require('./SyntheticFocusEvent');
+var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
+var SyntheticMouseEvent = require('./SyntheticMouseEvent');
+var SyntheticDragEvent = require('./SyntheticDragEvent');
+var SyntheticTouchEvent = require('./SyntheticTouchEvent');
+var SyntheticUIEvent = require('./SyntheticUIEvent');
+var SyntheticWheelEvent = require('./SyntheticWheelEvent');
+
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var getEventCharCode = require('./getEventCharCode');
+var invariant = require('fbjs/lib/invariant');
+var keyOf = require('fbjs/lib/keyOf');
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
+ abort: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onAbort: true }),
+ captured: keyOf({ onAbortCapture: true })
+ }
+ },
blur: {
phasedRegistrationNames: {
- bubbled: keyOf({onBlur: true}),
- captured: keyOf({onBlurCapture: true})
+ bubbled: keyOf({ onBlur: true }),
+ captured: keyOf({ onBlurCapture: true })
+ }
+ },
+ canPlay: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlay: true }),
+ captured: keyOf({ onCanPlayCapture: true })
+ }
+ },
+ canPlayThrough: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onCanPlayThrough: true }),
+ captured: keyOf({ onCanPlayThroughCapture: true })
}
},
click: {
phasedRegistrationNames: {
- bubbled: keyOf({onClick: true}),
- captured: keyOf({onClickCapture: true})
+ bubbled: keyOf({ onClick: true }),
+ captured: keyOf({ onClickCapture: true })
}
},
contextMenu: {
phasedRegistrationNames: {
- bubbled: keyOf({onContextMenu: true}),
- captured: keyOf({onContextMenuCapture: true})
+ bubbled: keyOf({ onContextMenu: true }),
+ captured: keyOf({ onContextMenuCapture: true })
}
},
copy: {
phasedRegistrationNames: {
- bubbled: keyOf({onCopy: true}),
- captured: keyOf({onCopyCapture: true})
+ bubbled: keyOf({ onCopy: true }),
+ captured: keyOf({ onCopyCapture: true })
}
},
cut: {
phasedRegistrationNames: {
- bubbled: keyOf({onCut: true}),
- captured: keyOf({onCutCapture: true})
+ bubbled: keyOf({ onCut: true }),
+ captured: keyOf({ onCutCapture: true })
}
},
doubleClick: {
phasedRegistrationNames: {
- bubbled: keyOf({onDoubleClick: true}),
- captured: keyOf({onDoubleClickCapture: true})
+ bubbled: keyOf({ onDoubleClick: true }),
+ captured: keyOf({ onDoubleClickCapture: true })
}
},
drag: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrag: true}),
- captured: keyOf({onDragCapture: true})
+ bubbled: keyOf({ onDrag: true }),
+ captured: keyOf({ onDragCapture: true })
}
},
dragEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnd: true}),
- captured: keyOf({onDragEndCapture: true})
+ bubbled: keyOf({ onDragEnd: true }),
+ captured: keyOf({ onDragEndCapture: true })
}
},
dragEnter: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragEnter: true}),
- captured: keyOf({onDragEnterCapture: true})
+ bubbled: keyOf({ onDragEnter: true }),
+ captured: keyOf({ onDragEnterCapture: true })
}
},
dragExit: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragExit: true}),
- captured: keyOf({onDragExitCapture: true})
+ bubbled: keyOf({ onDragExit: true }),
+ captured: keyOf({ onDragExitCapture: true })
}
},
dragLeave: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragLeave: true}),
- captured: keyOf({onDragLeaveCapture: true})
+ bubbled: keyOf({ onDragLeave: true }),
+ captured: keyOf({ onDragLeaveCapture: true })
}
},
dragOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragOver: true}),
- captured: keyOf({onDragOverCapture: true})
+ bubbled: keyOf({ onDragOver: true }),
+ captured: keyOf({ onDragOverCapture: true })
}
},
dragStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onDragStart: true}),
- captured: keyOf({onDragStartCapture: true})
+ bubbled: keyOf({ onDragStart: true }),
+ captured: keyOf({ onDragStartCapture: true })
}
},
drop: {
phasedRegistrationNames: {
- bubbled: keyOf({onDrop: true}),
- captured: keyOf({onDropCapture: true})
+ bubbled: keyOf({ onDrop: true }),
+ captured: keyOf({ onDropCapture: true })
+ }
+ },
+ durationChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onDurationChange: true }),
+ captured: keyOf({ onDurationChangeCapture: true })
+ }
+ },
+ emptied: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEmptied: true }),
+ captured: keyOf({ onEmptiedCapture: true })
+ }
+ },
+ encrypted: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEncrypted: true }),
+ captured: keyOf({ onEncryptedCapture: true })
+ }
+ },
+ ended: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onEnded: true }),
+ captured: keyOf({ onEndedCapture: true })
+ }
+ },
+ error: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onError: true }),
+ captured: keyOf({ onErrorCapture: true })
}
},
focus: {
phasedRegistrationNames: {
- bubbled: keyOf({onFocus: true}),
- captured: keyOf({onFocusCapture: true})
+ bubbled: keyOf({ onFocus: true }),
+ captured: keyOf({ onFocusCapture: true })
}
},
input: {
phasedRegistrationNames: {
- bubbled: keyOf({onInput: true}),
- captured: keyOf({onInputCapture: true})
+ bubbled: keyOf({ onInput: true }),
+ captured: keyOf({ onInputCapture: true })
}
},
keyDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyDown: true}),
- captured: keyOf({onKeyDownCapture: true})
+ bubbled: keyOf({ onKeyDown: true }),
+ captured: keyOf({ onKeyDownCapture: true })
}
},
keyPress: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyPress: true}),
- captured: keyOf({onKeyPressCapture: true})
+ bubbled: keyOf({ onKeyPress: true }),
+ captured: keyOf({ onKeyPressCapture: true })
}
},
keyUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onKeyUp: true}),
- captured: keyOf({onKeyUpCapture: true})
+ bubbled: keyOf({ onKeyUp: true }),
+ captured: keyOf({ onKeyUpCapture: true })
}
},
load: {
phasedRegistrationNames: {
- bubbled: keyOf({onLoad: true}),
- captured: keyOf({onLoadCapture: true})
+ bubbled: keyOf({ onLoad: true }),
+ captured: keyOf({ onLoadCapture: true })
}
},
- error: {
+ loadedData: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadedData: true }),
+ captured: keyOf({ onLoadedDataCapture: true })
+ }
+ },
+ loadedMetadata: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onLoadedMetadata: true }),
+ captured: keyOf({ onLoadedMetadataCapture: true })
+ }
+ },
+ loadStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onError: true}),
- captured: keyOf({onErrorCapture: true})
+ bubbled: keyOf({ onLoadStart: true }),
+ captured: keyOf({ onLoadStartCapture: true })
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseDown: true}),
- captured: keyOf({onMouseDownCapture: true})
+ bubbled: keyOf({ onMouseDown: true }),
+ captured: keyOf({ onMouseDownCapture: true })
}
},
mouseMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseMove: true}),
- captured: keyOf({onMouseMoveCapture: true})
+ bubbled: keyOf({ onMouseMove: true }),
+ captured: keyOf({ onMouseMoveCapture: true })
}
},
mouseOut: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOut: true}),
- captured: keyOf({onMouseOutCapture: true})
+ bubbled: keyOf({ onMouseOut: true }),
+ captured: keyOf({ onMouseOutCapture: true })
}
},
mouseOver: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseOver: true}),
- captured: keyOf({onMouseOverCapture: true})
+ bubbled: keyOf({ onMouseOver: true }),
+ captured: keyOf({ onMouseOverCapture: true })
}
},
mouseUp: {
phasedRegistrationNames: {
- bubbled: keyOf({onMouseUp: true}),
- captured: keyOf({onMouseUpCapture: true})
+ bubbled: keyOf({ onMouseUp: true }),
+ captured: keyOf({ onMouseUpCapture: true })
}
},
paste: {
phasedRegistrationNames: {
- bubbled: keyOf({onPaste: true}),
- captured: keyOf({onPasteCapture: true})
+ bubbled: keyOf({ onPaste: true }),
+ captured: keyOf({ onPasteCapture: true })
+ }
+ },
+ pause: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPause: true }),
+ captured: keyOf({ onPauseCapture: true })
+ }
+ },
+ play: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlay: true }),
+ captured: keyOf({ onPlayCapture: true })
+ }
+ },
+ playing: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onPlaying: true }),
+ captured: keyOf({ onPlayingCapture: true })
+ }
+ },
+ progress: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onProgress: true }),
+ captured: keyOf({ onProgressCapture: true })
+ }
+ },
+ rateChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onRateChange: true }),
+ captured: keyOf({ onRateChangeCapture: true })
}
},
reset: {
phasedRegistrationNames: {
- bubbled: keyOf({onReset: true}),
- captured: keyOf({onResetCapture: true})
+ bubbled: keyOf({ onReset: true }),
+ captured: keyOf({ onResetCapture: true })
}
},
scroll: {
phasedRegistrationNames: {
- bubbled: keyOf({onScroll: true}),
- captured: keyOf({onScrollCapture: true})
+ bubbled: keyOf({ onScroll: true }),
+ captured: keyOf({ onScrollCapture: true })
+ }
+ },
+ seeked: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeked: true }),
+ captured: keyOf({ onSeekedCapture: true })
+ }
+ },
+ seeking: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSeeking: true }),
+ captured: keyOf({ onSeekingCapture: true })
+ }
+ },
+ stalled: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onStalled: true }),
+ captured: keyOf({ onStalledCapture: true })
}
},
submit: {
phasedRegistrationNames: {
- bubbled: keyOf({onSubmit: true}),
- captured: keyOf({onSubmitCapture: true})
+ bubbled: keyOf({ onSubmit: true }),
+ captured: keyOf({ onSubmitCapture: true })
+ }
+ },
+ suspend: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onSuspend: true }),
+ captured: keyOf({ onSuspendCapture: true })
+ }
+ },
+ timeUpdate: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onTimeUpdate: true }),
+ captured: keyOf({ onTimeUpdateCapture: true })
}
},
touchCancel: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchCancel: true}),
- captured: keyOf({onTouchCancelCapture: true})
+ bubbled: keyOf({ onTouchCancel: true }),
+ captured: keyOf({ onTouchCancelCapture: true })
}
},
touchEnd: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchEnd: true}),
- captured: keyOf({onTouchEndCapture: true})
+ bubbled: keyOf({ onTouchEnd: true }),
+ captured: keyOf({ onTouchEndCapture: true })
}
},
touchMove: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchMove: true}),
- captured: keyOf({onTouchMoveCapture: true})
+ bubbled: keyOf({ onTouchMove: true }),
+ captured: keyOf({ onTouchMoveCapture: true })
}
},
touchStart: {
phasedRegistrationNames: {
- bubbled: keyOf({onTouchStart: true}),
- captured: keyOf({onTouchStartCapture: true})
+ bubbled: keyOf({ onTouchStart: true }),
+ captured: keyOf({ onTouchStartCapture: true })
+ }
+ },
+ volumeChange: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onVolumeChange: true }),
+ captured: keyOf({ onVolumeChangeCapture: true })
+ }
+ },
+ waiting: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onWaiting: true }),
+ captured: keyOf({ onWaitingCapture: true })
}
},
wheel: {
phasedRegistrationNames: {
- bubbled: keyOf({onWheel: true}),
- captured: keyOf({onWheelCapture: true})
+ bubbled: keyOf({ onWheel: true }),
+ captured: keyOf({ onWheelCapture: true })
}
}
};
var topLevelEventsToDispatchConfig = {
+ topAbort: eventTypes.abort,
topBlur: eventTypes.blur,
+ topCanPlay: eventTypes.canPlay,
+ topCanPlayThrough: eventTypes.canPlayThrough,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
@@ -262,6 +397,10 @@
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
+ topDurationChange: eventTypes.durationChange,
+ topEmptied: eventTypes.emptied,
+ topEncrypted: eventTypes.encrypted,
+ topEnded: eventTypes.ended,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
@@ -269,19 +408,34 @@
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
+ topLoadedData: eventTypes.loadedData,
+ topLoadedMetadata: eventTypes.loadedMetadata,
+ topLoadStart: eventTypes.loadStart,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
+ topPause: eventTypes.pause,
+ topPlay: eventTypes.play,
+ topPlaying: eventTypes.playing,
+ topProgress: eventTypes.progress,
+ topRateChange: eventTypes.rateChange,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
+ topSeeked: eventTypes.seeked,
+ topSeeking: eventTypes.seeking,
+ topStalled: eventTypes.stalled,
topSubmit: eventTypes.submit,
+ topSuspend: eventTypes.suspend,
+ topTimeUpdate: eventTypes.timeUpdate,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
+ topVolumeChange: eventTypes.volumeChange,
+ topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
};
@@ -289,35 +443,14 @@
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
+var ON_CLICK_KEY = keyOf({ onClick: null });
+var onClickListeners = {};
+
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
- * Same as the default implementation, except cancels the event when return
- * value is false. This behavior will be disabled in a future release.
- *
- * @param {object} Event to be dispatched.
- * @param {function} Application-level callback.
- * @param {string} domID DOM ID to pass to the callback.
- */
- executeDispatch: function(event, listener, domID) {
- var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
-
- ("production" !== process.env.NODE_ENV ? warning(
- typeof returnValue !== 'boolean',
- 'Returning `false` from an event handler is deprecated and will be ' +
- 'ignored in a future release. Instead, manually call ' +
- 'e.stopPropagation() or e.preventDefault(), as appropriate.'
- ) : null);
-
- if (returnValue === false) {
- event.stopPropagation();
- event.preventDefault();
- }
- },
-
- /**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
@@ -325,22 +458,40 @@
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
- extractEvents: function(
- topLevelType,
- topLevelTarget,
- topLevelTargetID,
- nativeEvent) {
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
+ case topLevelTypes.topAbort:
+ case topLevelTypes.topCanPlay:
+ case topLevelTypes.topCanPlayThrough:
+ case topLevelTypes.topDurationChange:
+ case topLevelTypes.topEmptied:
+ case topLevelTypes.topEncrypted:
+ case topLevelTypes.topEnded:
+ case topLevelTypes.topError:
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
- case topLevelTypes.topError:
+ case topLevelTypes.topLoadedData:
+ case topLevelTypes.topLoadedMetadata:
+ case topLevelTypes.topLoadStart:
+ case topLevelTypes.topPause:
+ case topLevelTypes.topPlay:
+ case topLevelTypes.topPlaying:
+ case topLevelTypes.topProgress:
+ case topLevelTypes.topRateChange:
case topLevelTypes.topReset:
+ case topLevelTypes.topSeeked:
+ case topLevelTypes.topSeeking:
+ case topLevelTypes.topStalled:
case topLevelTypes.topSubmit:
+ case topLevelTypes.topSuspend:
+ case topLevelTypes.topTimeUpdate:
+ case topLevelTypes.topVolumeChange:
+ case topLevelTypes.topWaiting:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
@@ -405,18 +556,30 @@
EventConstructor = SyntheticClipboardEvent;
break;
}
- ("production" !== process.env.NODE_ENV ? invariant(
- EventConstructor,
- 'SimpleEventPlugin: Unhandled event type, `%s`.',
- topLevelType
- ) : invariant(EventConstructor));
- var event = EventConstructor.getPooled(
- dispatchConfig,
- topLevelTargetID,
- nativeEvent
- );
+ !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
+ var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
+ },
+
+ didPutListener: function (id, registrationName, listener) {
+ // Mobile Safari does not fire properly bubble click events on
+ // non-interactive elements, which means delegated click listeners do not
+ // fire. The workaround for this bug involves attaching an empty click
+ // listener on the target node.
+ if (registrationName === ON_CLICK_KEY) {
+ var node = ReactMount.getNode(id);
+ if (!onClickListeners[id]) {
+ onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
+ }
+ }
+ },
+
+ willDeleteListener: function (id, registrationName) {
+ if (registrationName === ON_CLICK_KEY) {
+ onClickListeners[id].remove();
+ delete onClickListeners[id];
+ }
}
};

lib/sliceChildren.js

@@ -0,0 +1,34 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule sliceChildren
+ */
+
+'use strict';
+
+var ReactChildren = require('./ReactChildren');
+
+/**
+ * Slice children that are typically specified as `props.children`. This version
+ * of slice children ignores empty child components.
+ *
+ * @param {*} children The children set to filter.
+ * @param {number} start The first zero-based index to include in the subset.
+ * @param {?number} end The non-inclusive last index of the subset.
+ * @return {object} mirrored array with mapped children
+ */
+function sliceChildren(children, start, end) {
+ if (children == null) {
+ return children;
+ }
+
+ var array = ReactChildren.toArray(children);
+ return array.slice(start, end);
+}
+
+module.exports = sliceChildren;
\ No newline at end of file

lib/SVGDOMPropertyConfig.js

@@ -9,14 +9,17 @@
* @providesModule SVGDOMPropertyConfig
*/
-/*jslint bitwise: true*/
-
'use strict';
-var DOMProperty = require("./DOMProperty");
+var DOMProperty = require('./DOMProperty');
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
+var NS = {
+ xlink: 'http://www.w3.org/1999/xlink',
+ xml: 'http://www.w3.org/XML/1998/namespace'
+};
+
var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
@@ -60,10 +63,32 @@
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
+ xlinkActuate: MUST_USE_ATTRIBUTE,
+ xlinkArcrole: MUST_USE_ATTRIBUTE,
+ xlinkHref: MUST_USE_ATTRIBUTE,
+ xlinkRole: MUST_USE_ATTRIBUTE,
+ xlinkShow: MUST_USE_ATTRIBUTE,
+ xlinkTitle: MUST_USE_ATTRIBUTE,
+ xlinkType: MUST_USE_ATTRIBUTE,
+ xmlBase: MUST_USE_ATTRIBUTE,
+ xmlLang: MUST_USE_ATTRIBUTE,
+ xmlSpace: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
+ DOMAttributeNamespaces: {
+ xlinkActuate: NS.xlink,
+ xlinkArcrole: NS.xlink,
+ xlinkHref: NS.xlink,
+ xlinkRole: NS.xlink,
+ xlinkShow: NS.xlink,
+ xlinkTitle: NS.xlink,
+ xlinkType: NS.xlink,
+ xmlBase: NS.xml,
+ xmlLang: NS.xml,
+ xmlSpace: NS.xml
+ },
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
@@ -85,7 +110,17 @@
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
- viewBox: 'viewBox'
+ viewBox: 'viewBox',
+ xlinkActuate: 'xlink:actuate',
+ xlinkArcrole: 'xlink:arcrole',
+ xlinkHref: 'xlink:href',
+ xlinkRole: 'xlink:role',
+ xlinkShow: 'xlink:show',
+ xlinkTitle: 'xlink:title',
+ xlinkType: 'xlink:type',
+ xmlBase: 'xml:base',
+ xmlLang: 'xml:lang',
+ xmlSpace: 'xml:space'
}
};

lib/SyntheticClipboardEvent.js

@@ -12,19 +12,15 @@
'use strict';
-var SyntheticEvent = require("./SyntheticEvent");
+var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
- clipboardData: function(event) {
- return (
- 'clipboardData' in event ?
- event.clipboardData :
- window.clipboardData
- );
+ clipboardData: function (event) {
+ return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
@@ -34,8 +30,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);

lib/SyntheticCompositionEvent.js

@@ -12,7 +12,7 @@
'use strict';
-var SyntheticEvent = require("./SyntheticEvent");
+var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
@@ -28,16 +28,10 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticCompositionEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticCompositionEvent,
- CompositionEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;

lib/SyntheticDragEvent.js

@@ -12,7 +12,7 @@
'use strict';
-var SyntheticMouseEvent = require("./SyntheticMouseEvent");
+var SyntheticMouseEvent = require('./SyntheticMouseEvent');
/**
* @interface DragEvent
@@ -28,8 +28,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);

lib/SyntheticEvent.js

@@ -12,11 +12,11 @@
'use strict';
-var PooledClass = require("./PooledClass");
+var PooledClass = require('./PooledClass');
-var assign = require("./Object.assign");
-var emptyFunction = require("./emptyFunction");
-var getEventTarget = require("./getEventTarget");
+var assign = require('./Object.assign');
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var warning = require('fbjs/lib/warning');
/**
* @interface Event
@@ -24,13 +24,13 @@
*/
var EventInterface = {
type: null,
- target: getEventTarget,
+ target: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
- timeStamp: function(event) {
+ timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
@@ -54,7 +54,7 @@
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
-function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent) {
+function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
@@ -68,13 +68,15 @@
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
+ if (propName === 'target') {
+ this.target = nativeEventTarget;
+ } else {
this[propName] = nativeEvent[propName];
}
}
+ }
- var defaultPrevented = nativeEvent.defaultPrevented != null ?
- nativeEvent.defaultPrevented :
- nativeEvent.returnValue === false;
+ var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
@@ -85,9 +87,16 @@
assign(SyntheticEvent.prototype, {
- preventDefault: function() {
+ preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
+ }
+ if (!event) {
+ return;
+ }
+
if (event.preventDefault) {
event.preventDefault();
} else {
@@ -96,8 +105,15 @@
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
- stopPropagation: function() {
+ stopPropagation: function () {
var event = this.nativeEvent;
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
+ }
+ if (!event) {
+ return;
+ }
+
if (event.stopPropagation) {
event.stopPropagation();
} else {
@@ -111,7 +127,7 @@
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
- persist: function() {
+ persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
@@ -125,7 +141,7 @@
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
- destructor: function() {
+ destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
@@ -145,7 +161,7 @@
* @param {function} Class
* @param {?object} Interface
*/
-SyntheticEvent.augmentClass = function(Class, Interface) {
+SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
@@ -156,9 +172,9 @@
Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
- PooledClass.addPoolingTo(Class, PooledClass.threeArgumentPooler);
+ PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
-PooledClass.addPoolingTo(SyntheticEvent, PooledClass.threeArgumentPooler);
+PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;

lib/SyntheticFocusEvent.js

@@ -12,7 +12,7 @@
'use strict';
-var SyntheticUIEvent = require("./SyntheticUIEvent");
+var SyntheticUIEvent = require('./SyntheticUIEvent');
/**
* @interface FocusEvent
@@ -28,8 +28,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);

lib/SyntheticInputEvent.js

@@ -12,7 +12,7 @@
'use strict';
-var SyntheticEvent = require("./SyntheticEvent");
+var SyntheticEvent = require('./SyntheticEvent');
/**
* @interface Event
@@ -29,16 +29,10 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticInputEvent(
- dispatchConfig,
- dispatchMarker,
- nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
-SyntheticEvent.augmentClass(
- SyntheticInputEvent,
- InputEventInterface
-);
+SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;

lib/SyntheticKeyboardEvent.js

@@ -12,11 +12,11 @@
'use strict';
-var SyntheticUIEvent = require("./SyntheticUIEvent");
+var SyntheticUIEvent = require('./SyntheticUIEvent');
-var getEventCharCode = require("./getEventCharCode");
-var getEventKey = require("./getEventKey");
-var getEventModifierState = require("./getEventModifierState");
+var getEventCharCode = require('./getEventCharCode');
+var getEventKey = require('./getEventKey');
+var getEventModifierState = require('./getEventModifierState');
/**
* @interface KeyboardEvent
@@ -33,7 +33,7 @@
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
- charCode: function(event) {
+ charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
@@ -44,7 +44,7 @@
}
return 0;
},
- keyCode: function(event) {
+ keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
@@ -57,7 +57,7 @@
}
return 0;
},
- which: function(event) {
+ which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
@@ -76,8 +76,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);

lib/SyntheticMouseEvent.js

@@ -12,10 +12,10 @@
'use strict';
-var SyntheticUIEvent = require("./SyntheticUIEvent");
-var ViewportMetrics = require("./ViewportMetrics");
+var SyntheticUIEvent = require('./SyntheticUIEvent');
+var ViewportMetrics = require('./ViewportMetrics');
-var getEventModifierState = require("./getEventModifierState");
+var getEventModifierState = require('./getEventModifierState');
/**
* @interface MouseEvent
@@ -31,7 +31,7 @@
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
- button: function(event) {
+ button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
@@ -46,21 +46,15 @@
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
- relatedTarget: function(event) {
- return event.relatedTarget || (
- ((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
- );
+ relatedTarget: function (event) {
+ return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
- pageX: function(event) {
- return 'pageX' in event ?
- event.pageX :
- event.clientX + ViewportMetrics.currentScrollLeft;
+ pageX: function (event) {
+ return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
},
- pageY: function(event) {
- return 'pageY' in event ?
- event.pageY :
- event.clientY + ViewportMetrics.currentScrollTop;
+ pageY: function (event) {
+ return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
@@ -70,8 +64,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);

lib/SyntheticTouchEvent.js

@@ -12,9 +12,9 @@
'use strict';
-var SyntheticUIEvent = require("./SyntheticUIEvent");
+var SyntheticUIEvent = require('./SyntheticUIEvent');
-var getEventModifierState = require("./getEventModifierState");
+var getEventModifierState = require('./getEventModifierState');
/**
* @interface TouchEvent
@@ -37,8 +37,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
-function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);

lib/SyntheticUIEvent.js

@@ -12,16 +12,16 @@
'use strict';
-var SyntheticEvent = require("./SyntheticEvent");
+var SyntheticEvent = require('./SyntheticEvent');
-var getEventTarget = require("./getEventTarget");
+var getEventTarget = require('./getEventTarget');
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
- view: function(event) {
+ view: function (event) {
if (event.view) {
return event.view;
}
@@ -40,7 +40,7 @@
return window;
}
},
- detail: function(event) {
+ detail: function (event) {
return event.detail || 0;
}
};
@@ -51,8 +51,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
-function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);

lib/SyntheticWheelEvent.js

@@ -12,28 +12,24 @@
'use strict';
-var SyntheticMouseEvent = require("./SyntheticMouseEvent");
+var SyntheticMouseEvent = require('./SyntheticMouseEvent');
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
- deltaX: function(event) {
- return (
- 'deltaX' in event ? event.deltaX :
+ deltaX: function (event) {
+ return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
- 'wheelDeltaX' in event ? -event.wheelDeltaX : 0
- );
+ 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
- deltaY: function(event) {
- return (
- 'deltaY' in event ? event.deltaY :
+ deltaY: function (event) {
+ return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
- 'wheelDelta' in event ? -event.wheelDelta : 0
- );
+ 'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
@@ -50,8 +46,8 @@
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
-function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent) {
- SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
+function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
+ SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);

lib/TapEventPlugin.js

@@ -0,0 +1,119 @@
+/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule TapEventPlugin
+ * @typechecks static-only
+ */
+
+'use strict';
+
+var EventConstants = require('./EventConstants');
+var EventPluginUtils = require('./EventPluginUtils');
+var EventPropagators = require('./EventPropagators');
+var SyntheticUIEvent = require('./SyntheticUIEvent');
+var TouchEventUtils = require('fbjs/lib/TouchEventUtils');
+var ViewportMetrics = require('./ViewportMetrics');
+
+var keyOf = require('fbjs/lib/keyOf');
+var topLevelTypes = EventConstants.topLevelTypes;
+
+var isStartish = EventPluginUtils.isStartish;
+var isEndish = EventPluginUtils.isEndish;
+
+/**
+ * Number of pixels that are tolerated in between a `touchStart` and `touchEnd`
+ * in order to still be considered a 'tap' event.
+ */
+var tapMoveThreshold = 10;
+var startCoords = { x: null, y: null };
+
+var Axis = {
+ x: { page: 'pageX', client: 'clientX', envScroll: 'currentPageScrollLeft' },
+ y: { page: 'pageY', client: 'clientY', envScroll: 'currentPageScrollTop' }
+};
+
+function getAxisCoordOfEvent(axis, nativeEvent) {
+ var singleTouch = TouchEventUtils.extractSingleTouch(nativeEvent);
+ if (singleTouch) {
+ return singleTouch[axis.page];
+ }
+ return axis.page in nativeEvent ? nativeEvent[axis.page] : nativeEvent[axis.client] + ViewportMetrics[axis.envScroll];
+}
+
+function getDistance(coords, nativeEvent) {
+ var pageX = getAxisCoordOfEvent(Axis.x, nativeEvent);
+ var pageY = getAxisCoordOfEvent(Axis.y, nativeEvent);
+ return Math.pow(Math.pow(pageX - coords.x, 2) + Math.pow(pageY - coords.y, 2), 0.5);
+}
+
+var touchEvents = [topLevelTypes.topTouchStart, topLevelTypes.topTouchCancel, topLevelTypes.topTouchEnd, topLevelTypes.topTouchMove];
+
+var dependencies = [topLevelTypes.topMouseDown, topLevelTypes.topMouseMove, topLevelTypes.topMouseUp].concat(touchEvents);
+
+var eventTypes = {
+ touchTap: {
+ phasedRegistrationNames: {
+ bubbled: keyOf({ onTouchTap: null }),
+ captured: keyOf({ onTouchTapCapture: null })
+ },
+ dependencies: dependencies
+ }
+};
+
+var usedTouch = false;
+var usedTouchTime = 0;
+var TOUCH_DELAY = 1000;
+
+var TapEventPlugin = {
+
+ tapMoveThreshold: tapMoveThreshold,
+
+ eventTypes: eventTypes,
+
+ /**
+ * @param {string} topLevelType Record from `EventConstants`.
+ * @param {DOMEventTarget} topLevelTarget The listening component root node.
+ * @param {string} topLevelTargetID ID of `topLevelTarget`.
+ * @param {object} nativeEvent Native browser event.
+ * @return {*} An accumulation of synthetic events.
+ * @see {EventPluginHub.extractEvents}
+ */
+ extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
+ if (!isStartish(topLevelType) && !isEndish(topLevelType)) {
+ return null;
+ }
+ // on ios, there is a delay after touch event and synthetic
+ // mouse events, so that user can perform double tap
+ // solution: ignore mouse events following touchevent within small timeframe
+ if (touchEvents.indexOf(topLevelType) !== -1) {
+ usedTouch = true;
+ usedTouchTime = Date.now();
+ } else {
+ if (usedTouch && Date.now() - usedTouchTime < TOUCH_DELAY) {
+ return null;
+ }
+ }
+ var event = null;
+ var distance = getDistance(startCoords, nativeEvent);
+ if (isEndish(topLevelType) && distance < tapMoveThreshold) {
+ event = SyntheticUIEvent.getPooled(eventTypes.touchTap, topLevelTargetID, nativeEvent, nativeEventTarget);
+ }
+ if (isStartish(topLevelType)) {
+ startCoords.x = getAxisCoordOfEvent(Axis.x, nativeEvent);
+ startCoords.y = getAxisCoordOfEvent(Axis.y, nativeEvent);
+ } else if (isEndish(topLevelType)) {
+ startCoords.x = 0;
+ startCoords.y = 0;
+ }
+ EventPropagators.accumulateTwoPhaseDispatches(event);
+ return event;
+ }
+
+};
+
+module.exports = TapEventPlugin;
\ No newline at end of file

lib/toArray.js

@@ -1,68 +0,0 @@
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule toArray
- * @typechecks
- */
-
-var invariant = require("./invariant");
-
-/**
- * Convert array-like objects to arrays.
- *
- * This API assumes the caller knows the contents of the data type. For less
- * well defined inputs use createArrayFromMixed.
- *
- * @param {object|function|filelist} obj
- * @return {array}
- */
-function toArray(obj) {
- var length = obj.length;
-
- // Some browse builtin objects can report typeof 'function' (e.g. NodeList in
- // old versions of Safari).
- ("production" !== process.env.NODE_ENV ? invariant(
- !Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function'),
- 'toArray: Array-like object expected'
- ) : invariant(!Array.isArray(obj) &&
- (typeof obj === 'object' || typeof obj === 'function')));
-
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof length === 'number',
- 'toArray: Object needs a length property'
- ) : invariant(typeof length === 'number'));
-
- ("production" !== process.env.NODE_ENV ? invariant(
- length === 0 ||
- (length - 1) in obj,
- 'toArray: Object should have keys for indices'
- ) : invariant(length === 0 ||
- (length - 1) in obj));
-
- // Old IE doesn't give collections access to hasOwnProperty. Assume inputs
- // without method will throw during the slice call and skip straight to the
- // fallback.
- if (obj.hasOwnProperty) {
- try {
- return Array.prototype.slice.call(obj);
- } catch (e) {
- // IE < 9 does not support Array#slice on collections objects
- }
- }
-
- // Fall back to copying key by key. This assumes all keys have a value,
- // so will not preserve sparsely populated inputs.
- var ret = Array(length);
- for (var ii = 0; ii < length; ii++) {
- ret[ii] = obj[ii];
- }
- return ret;
-}
-
-module.exports = toArray;

lib/Transaction.js

@@ -11,7 +11,7 @@
'use strict';
-var invariant = require("./invariant");
+var invariant = require('fbjs/lib/invariant');
/**
* `Transaction` creates a black box that is able to wrap any method such that
@@ -82,12 +82,12 @@
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
- reinitializeTransaction: function() {
+ reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
- if (!this.wrapperInitData) {
- this.wrapperInitData = [];
- } else {
+ if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
+ } else {
+ this.wrapperInitData = [];
}
this._isInTransaction = false;
},
@@ -100,27 +100,29 @@
*/
getTransactionWrappers: null,
- isInTransaction: function() {
+ isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
- * need to be safety checked.
+ * need to be safety checked. The optional arguments helps prevent the need
+ * to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
- * @param {Object?=} args... Arguments to pass to the method (optional).
- * Helps prevent need to bind in many cases.
- * @return Return value from `method`.
- */
- perform: function(method, scope, a, b, c, d, e, f) {
- ("production" !== process.env.NODE_ENV ? invariant(
- !this.isInTransaction(),
- 'Transaction.perform(...): Cannot initialize a transaction when there ' +
- 'is already an outstanding transaction.'
- ) : invariant(!this.isInTransaction()));
+ * @param {Object?=} a Argument to pass to the method.
+ * @param {Object?=} b Argument to pass to the method.
+ * @param {Object?=} c Argument to pass to the method.
+ * @param {Object?=} d Argument to pass to the method.
+ * @param {Object?=} e Argument to pass to the method.
+ * @param {Object?=} f Argument to pass to the method.
+ *
+ * @return {*} Return value from `method`.
+ */
+ perform: function (method, scope, a, b, c, d, e, f) {
+ !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
var errorThrown;
var ret;
try {
@@ -140,8 +142,7 @@
// by invoking `closeAll`.
try {
this.closeAll(0);
- } catch (err) {
- }
+ } catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
@@ -154,7 +155,7 @@
return ret;
},
- initializeAll: function(startIndex) {
+ initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -164,9 +165,7 @@
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
- this.wrapperInitData[i] = wrapper.initialize ?
- wrapper.initialize.call(this) :
- null;
+ this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
@@ -174,8 +173,7 @@
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
- } catch (err) {
- }
+ } catch (err) {}
}
}
}
@@ -187,11 +185,8 @@
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
- closeAll: function(startIndex) {
- ("production" !== process.env.NODE_ENV ? invariant(
- this.isInTransaction(),
- 'Transaction.closeAll(): Cannot close transaction when none are open.'
- ) : invariant(this.isInTransaction()));
+ closeAll: function (startIndex) {
+ !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
@@ -214,8 +209,7 @@
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
- } catch (e) {
- }
+ } catch (e) {}
}
}
}
@@ -228,7 +222,7 @@
Mixin: Mixin,
/**
- * Token to look for to determine if an error occured.
+ * Token to look for to determine if an error occurred.
*/
OBSERVED_ERROR: {}

lib/traverseAllChildren.js

@@ -11,13 +11,13 @@
'use strict';
-var ReactElement = require("./ReactElement");
-var ReactFragment = require("./ReactFragment");
-var ReactInstanceHandles = require("./ReactInstanceHandles");
-
-var getIteratorFn = require("./getIteratorFn");
-var invariant = require("./invariant");
-var warning = require("./warning");
+var ReactCurrentOwner = require('./ReactCurrentOwner');
+var ReactElement = require('./ReactElement');
+var ReactInstanceHandles = require('./ReactInstanceHandles');
+
+var getIteratorFn = require('./getIteratorFn');
+var invariant = require('fbjs/lib/invariant');
+var warning = require('fbjs/lib/warning');
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
@@ -60,14 +60,11 @@
/**
* Escape a component key so that it is safe to use in a reactid.
*
- * @param {*} key Component key to be escaped.
+ * @param {*} text Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
- return ('' + text).replace(
- userProvidedKeyEscapeRegex,
- userProvidedKeyEscaper
- );
+ return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
}
/**
@@ -84,19 +81,12 @@
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
- * @param {!number} indexSoFar Number of children encountered until this point.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
-function traverseAllChildrenImpl(
- children,
- nameSoFar,
- indexSoFar,
- callback,
- traverseContext
-) {
+function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
@@ -104,39 +94,24 @@
children = null;
}
- if (children === null ||
- type === 'string' ||
- type === 'number' ||
- ReactElement.isValidElement(children)) {
- callback(
- traverseContext,
- children,
+ if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
+ callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar,
- indexSoFar
- );
+ nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
- var child, nextName, nextIndex;
+ var child;
+ var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
+ var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, i)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, i);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
@@ -147,27 +122,12 @@
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- getComponentKey(child, ii++)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + getComponentKey(child, ii++);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
- if ("production" !== process.env.NODE_ENV) {
- ("production" !== process.env.NODE_ENV ? warning(
- didWarnAboutMaps,
- 'Using Maps as children is not yet fully supported. It is an ' +
- 'experimental feature that might be removed. Convert it to a ' +
- 'sequence / iterable of keyed ReactElements instead.'
- ) : null);
+ if (process.env.NODE_ENV !== 'production') {
+ process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
@@ -175,49 +135,29 @@
var entry = step.value;
if (entry) {
child = entry[1];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(entry[0]) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
+ subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
- ("production" !== process.env.NODE_ENV ? invariant(
- children.nodeType !== 1,
- 'traverseAllChildren(...): Encountered an invalid child; DOM ' +
- 'elements are not valid children of React components.'
- ) : invariant(children.nodeType !== 1));
- var fragment = ReactFragment.extract(children);
- for (var key in fragment) {
- if (fragment.hasOwnProperty(key)) {
- child = fragment[key];
- nextName = (
- (nameSoFar !== '' ? nameSoFar + SUBSEPARATOR : SEPARATOR) +
- wrapUserProvidedKey(key) + SUBSEPARATOR +
- getComponentKey(child, 0)
- );
- nextIndex = indexSoFar + subtreeCount;
- subtreeCount += traverseAllChildrenImpl(
- child,
- nextName,
- nextIndex,
- callback,
- traverseContext
- );
+ var addendum = '';
+ if (process.env.NODE_ENV !== 'production') {
+ addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
+ if (children._isReactElement) {
+ addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
+ if (ReactCurrentOwner.current) {
+ var name = ReactCurrentOwner.current.getName();
+ if (name) {
+ addendum += ' Check the render method of `' + name + '`.';
}
}
}
+ var childrenString = String(children);
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
+ }
+ }
return subtreeCount;
}
@@ -243,7 +183,7 @@
return 0;
}
- return traverseAllChildrenImpl(children, '', 0, callback, traverseContext);
+ return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;

lib/update.js

@@ -9,14 +9,14 @@
* @providesModule update
*/
- /* global hasOwnProperty:true */
+/* global hasOwnProperty:true */
'use strict';
-var assign = require("./Object.assign");
-var keyOf = require("./keyOf");
-var invariant = require("./invariant");
-var hasOwnProperty = {}.hasOwnProperty;
+var assign = require('./Object.assign');
+var keyOf = require('fbjs/lib/keyOf');
+var invariant = require('fbjs/lib/invariant');
+var hasOwnProperty = ({}).hasOwnProperty;
function shallowCopy(x) {
if (Array.isArray(x)) {
@@ -28,60 +28,32 @@
}
}
-var COMMAND_PUSH = keyOf({$push: null});
-var COMMAND_UNSHIFT = keyOf({$unshift: null});
-var COMMAND_SPLICE = keyOf({$splice: null});
-var COMMAND_SET = keyOf({$set: null});
-var COMMAND_MERGE = keyOf({$merge: null});
-var COMMAND_APPLY = keyOf({$apply: null});
-
-var ALL_COMMANDS_LIST = [
- COMMAND_PUSH,
- COMMAND_UNSHIFT,
- COMMAND_SPLICE,
- COMMAND_SET,
- COMMAND_MERGE,
- COMMAND_APPLY
-];
+var COMMAND_PUSH = keyOf({ $push: null });
+var COMMAND_UNSHIFT = keyOf({ $unshift: null });
+var COMMAND_SPLICE = keyOf({ $splice: null });
+var COMMAND_SET = keyOf({ $set: null });
+var COMMAND_MERGE = keyOf({ $merge: null });
+var COMMAND_APPLY = keyOf({ $apply: null });
+
+var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
var ALL_COMMANDS_SET = {};
-ALL_COMMANDS_LIST.forEach(function(command) {
+ALL_COMMANDS_LIST.forEach(function (command) {
ALL_COMMANDS_SET[command] = true;
});
function invariantArrayCase(value, spec, command) {
- ("production" !== process.env.NODE_ENV ? invariant(
- Array.isArray(value),
- 'update(): expected target of %s to be an array; got %s.',
- command,
- value
- ) : invariant(Array.isArray(value)));
+ !Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
var specValue = spec[command];
- ("production" !== process.env.NODE_ENV ? invariant(
- Array.isArray(specValue),
- 'update(): expected spec of %s to be an array; got %s. ' +
- 'Did you forget to wrap your parameter in an array?',
- command,
- specValue
- ) : invariant(Array.isArray(specValue)));
+ !Array.isArray(specValue) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
}
function update(value, spec) {
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof spec === 'object',
- 'update(): You provided a key path to update() that did not contain one ' +
- 'of %s. Did you forget to include {%s: ...}?',
- ALL_COMMANDS_LIST.join(', '),
- COMMAND_SET
- ) : invariant(typeof spec === 'object'));
+ !(typeof spec === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
if (hasOwnProperty.call(spec, COMMAND_SET)) {
- ("production" !== process.env.NODE_ENV ? invariant(
- Object.keys(spec).length === 1,
- 'Cannot have more than one key in an object with %s',
- COMMAND_SET
- ) : invariant(Object.keys(spec).length === 1));
+ !(Object.keys(spec).length === 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
return spec[COMMAND_SET];
}
@@ -90,68 +62,36 @@
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
var mergeObj = spec[COMMAND_MERGE];
- ("production" !== process.env.NODE_ENV ? invariant(
- mergeObj && typeof mergeObj === 'object',
- 'update(): %s expects a spec of type \'object\'; got %s',
- COMMAND_MERGE,
- mergeObj
- ) : invariant(mergeObj && typeof mergeObj === 'object'));
- ("production" !== process.env.NODE_ENV ? invariant(
- nextValue && typeof nextValue === 'object',
- 'update(): %s expects a target of type \'object\'; got %s',
- COMMAND_MERGE,
- nextValue
- ) : invariant(nextValue && typeof nextValue === 'object'));
+ !(mergeObj && typeof mergeObj === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
+ !(nextValue && typeof nextValue === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
assign(nextValue, spec[COMMAND_MERGE]);
}
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
invariantArrayCase(value, spec, COMMAND_PUSH);
- spec[COMMAND_PUSH].forEach(function(item) {
+ spec[COMMAND_PUSH].forEach(function (item) {
nextValue.push(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
- spec[COMMAND_UNSHIFT].forEach(function(item) {
+ spec[COMMAND_UNSHIFT].forEach(function (item) {
nextValue.unshift(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
- ("production" !== process.env.NODE_ENV ? invariant(
- Array.isArray(value),
- 'Expected %s target to be an array; got %s',
- COMMAND_SPLICE,
- value
- ) : invariant(Array.isArray(value)));
- ("production" !== process.env.NODE_ENV ? invariant(
- Array.isArray(spec[COMMAND_SPLICE]),
- 'update(): expected spec of %s to be an array of arrays; got %s. ' +
- 'Did you forget to wrap your parameters in an array?',
- COMMAND_SPLICE,
- spec[COMMAND_SPLICE]
- ) : invariant(Array.isArray(spec[COMMAND_SPLICE])));
- spec[COMMAND_SPLICE].forEach(function(args) {
- ("production" !== process.env.NODE_ENV ? invariant(
- Array.isArray(args),
- 'update(): expected spec of %s to be an array of arrays; got %s. ' +
- 'Did you forget to wrap your parameters in an array?',
- COMMAND_SPLICE,
- spec[COMMAND_SPLICE]
- ) : invariant(Array.isArray(args)));
+ !Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
+ !Array.isArray(spec[COMMAND_SPLICE]) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
+ spec[COMMAND_SPLICE].forEach(function (args) {
+ !Array.isArray(args) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
nextValue.splice.apply(nextValue, args);
});
}
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
- ("production" !== process.env.NODE_ENV ? invariant(
- typeof spec[COMMAND_APPLY] === 'function',
- 'update(): expected spec of %s to be a function; got %s.',
- COMMAND_APPLY,
- spec[COMMAND_APPLY]
- ) : invariant(typeof spec[COMMAND_APPLY] === 'function'));
+ !(typeof spec[COMMAND_APPLY] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
nextValue = spec[COMMAND_APPLY](nextValue);
}

lib/validateDOMNesting.js

@@ -0,0 +1,363 @@
+/**
+ * Copyright 2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule validateDOMNesting
+ */
+
+'use strict';
+
+var assign = require('./Object.assign');
+var emptyFunction = require('fbjs/lib/emptyFunction');
+var warning = require('fbjs/lib/warning');
+
+var validateDOMNesting = emptyFunction;
+
+if (process.env.NODE_ENV !== 'production') {
+ // This validation code was written based on the HTML5 parsing spec:
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ //
+ // Note: this does not catch all invalid nesting, nor does it try to (as it's
+ // not clear what practical benefit doing so provides); instead, we warn only
+ // for cases where the parser will give a parse tree differing from what React
+ // intended. For example, <b><div></div></b> is invalid but we don't warn
+ // because it still parses correctly; we do warn for other cases like nested
+ // <p> tags where the beginning of the second element implicitly closes the
+ // first, causing a confusing mess.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#special
+ var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
+ var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
+ // TODO: Distinguish by namespace here -- for <title>, including it here
+ // errs on the side of fewer warnings
+ 'foreignObject', 'desc', 'title'];
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
+ var buttonScopeTags = inScopeTags.concat(['button']);
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
+ var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
+
+ var emptyAncestorInfo = {
+ parentTag: null,
+
+ formTag: null,
+ aTagInScope: null,
+ buttonTagInScope: null,
+ nobrTagInScope: null,
+ pTagInButtonScope: null,
+
+ listItemTagAutoclosing: null,
+ dlItemTagAutoclosing: null
+ };
+
+ var updatedAncestorInfo = function (oldInfo, tag, instance) {
+ var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
+ var info = { tag: tag, instance: instance };
+
+ if (inScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.aTagInScope = null;
+ ancestorInfo.buttonTagInScope = null;
+ ancestorInfo.nobrTagInScope = null;
+ }
+ if (buttonScopeTags.indexOf(tag) !== -1) {
+ ancestorInfo.pTagInButtonScope = null;
+ }
+
+ // See rules for 'li', 'dd', 'dt' start tags in
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
+ ancestorInfo.listItemTagAutoclosing = null;
+ ancestorInfo.dlItemTagAutoclosing = null;
+ }
+
+ ancestorInfo.parentTag = info;
+
+ if (tag === 'form') {
+ ancestorInfo.formTag = info;
+ }
+ if (tag === 'a') {
+ ancestorInfo.aTagInScope = info;
+ }
+ if (tag === 'button') {
+ ancestorInfo.buttonTagInScope = info;
+ }
+ if (tag === 'nobr') {
+ ancestorInfo.nobrTagInScope = info;
+ }
+ if (tag === 'p') {
+ ancestorInfo.pTagInButtonScope = info;
+ }
+ if (tag === 'li') {
+ ancestorInfo.listItemTagAutoclosing = info;
+ }
+ if (tag === 'dd' || tag === 'dt') {
+ ancestorInfo.dlItemTagAutoclosing = info;
+ }
+
+ return ancestorInfo;
+ };
+
+ /**
+ * Returns whether
+ */
+ var isTagValidWithParent = function (tag, parentTag) {
+ // First, let's check if we're in an unusual parsing mode...
+ switch (parentTag) {
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
+ case 'select':
+ return tag === 'option' || tag === 'optgroup' || tag === '#text';
+ case 'optgroup':
+ return tag === 'option' || tag === '#text';
+ // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
+ // but
+ case 'option':
+ return tag === '#text';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
+ // No special behavior since these rules fall back to "in body" mode for
+ // all except special table nodes which cause bad parsing behavior anyway.
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
+ case 'tr':
+ return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
+ case 'tbody':
+ case 'thead':
+ case 'tfoot':
+ return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
+ case 'colgroup':
+ return tag === 'col' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
+ case 'table':
+ return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
+ case 'head':
+ return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
+
+ // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
+ case 'html':
+ return tag === 'head' || tag === 'body';
+ }
+
+ // Probably in the "in body" parsing mode, so we outlaw only tag combos
+ // where the parsing rules cause implicit opens or closes to be added.
+ // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+ switch (tag) {
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
+
+ case 'rp':
+ case 'rt':
+ return impliedEndTags.indexOf(parentTag) === -1;
+
+ case 'caption':
+ case 'col':
+ case 'colgroup':
+ case 'frame':
+ case 'head':
+ case 'tbody':
+ case 'td':
+ case 'tfoot':
+ case 'th':
+ case 'thead':
+ case 'tr':
+ // These tags are only valid with a few parents that have special child
+ // parsing rules -- if we're down here, then none of those matched and
+ // so we allow it only if we don't know what the parent is, as all other
+ // cases are invalid.
+ return parentTag == null;
+ }
+
+ return true;
+ };
+
+ /**
+ * Returns whether
+ */
+ var findInvalidAncestorForTag = function (tag, ancestorInfo) {
+ switch (tag) {
+ case 'address':
+ case 'article':
+ case 'aside':
+ case 'blockquote':
+ case 'center':
+ case 'details':
+ case 'dialog':
+ case 'dir':
+ case 'div':
+ case 'dl':
+ case 'fieldset':
+ case 'figcaption':
+ case 'figure':
+ case 'footer':
+ case 'header':
+ case 'hgroup':
+ case 'main':
+ case 'menu':
+ case 'nav':
+ case 'ol':
+ case 'p':
+ case 'section':
+ case 'summary':
+ case 'ul':
+
+ case 'pre':
+ case 'listing':
+
+ case 'table':
+
+ case 'hr':
+
+ case 'xmp':
+
+ case 'h1':
+ case 'h2':
+ case 'h3':
+ case 'h4':
+ case 'h5':
+ case 'h6':
+ return ancestorInfo.pTagInButtonScope;
+
+ case 'form':
+ return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
+
+ case 'li':
+ return ancestorInfo.listItemTagAutoclosing;
+
+ case 'dd':
+ case 'dt':
+ return ancestorInfo.dlItemTagAutoclosing;
+
+ case 'button':
+ return ancestorInfo.buttonTagInScope;
+
+ case 'a':
+ // Spec says something about storing a list of markers, but it sounds
+ // equivalent to this check.
+ return ancestorInfo.aTagInScope;
+
+ case 'nobr':
+ return ancestorInfo.nobrTagInScope;
+ }
+
+ return null;
+ };
+
+ /**
+ * Given a ReactCompositeComponent instance, return a list of its recursive
+ * owners, starting at the root and ending with the instance itself.
+ */
+ var findOwnerStack = function (instance) {
+ if (!instance) {
+ return [];
+ }
+
+ var stack = [];
+ /*eslint-disable space-after-keywords */
+ do {
+ /*eslint-enable space-after-keywords */
+ stack.push(instance);
+ } while (instance = instance._currentElement._owner);
+ stack.reverse();
+ return stack;
+ };
+
+ var didWarn = {};
+
+ validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+
+ var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
+ var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
+ var problematic = invalidParent || invalidAncestor;
+
+ if (problematic) {
+ var ancestorTag = problematic.tag;
+ var ancestorInstance = problematic.instance;
+
+ var childOwner = childInstance && childInstance._currentElement._owner;
+ var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
+
+ var childOwners = findOwnerStack(childOwner);
+ var ancestorOwners = findOwnerStack(ancestorOwner);
+
+ var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
+ var i;
+
+ var deepestCommon = -1;
+ for (i = 0; i < minStackLen; i++) {
+ if (childOwners[i] === ancestorOwners[i]) {
+ deepestCommon = i;
+ } else {
+ break;
+ }
+ }
+
+ var UNKNOWN = '(unknown)';
+ var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
+ return inst.getName() || UNKNOWN;
+ });
+ var ownerInfo = [].concat(
+ // If the parent and child instances have a common owner ancestor, start
+ // with that -- otherwise we just start with the parent's owners.
+ deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
+ // If we're warning about an invalid (non-parent) ancestry, add '...'
+ invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
+
+ var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
+ if (didWarn[warnKey]) {
+ return;
+ }
+ didWarn[warnKey] = true;
+
+ if (invalidParent) {
+ var info = '';
+ if (ancestorTag === 'table' && childTag === 'tr') {
+ info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
+ }
+ process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
+ } else {
+ process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
+ }
+ }
+ };
+
+ validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
+
+ validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
+
+ // For testing
+ validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
+ ancestorInfo = ancestorInfo || emptyAncestorInfo;
+ var parentInfo = ancestorInfo.parentTag;
+ var parentTag = parentInfo && parentInfo.tag;
+ return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
+ };
+}
+
+module.exports = validateDOMNesting;
\ No newline at end of file

lib/ViewportMetrics.js

@@ -17,7 +17,7 @@
currentScrollTop: 0,
- refreshScrollValues: function(scrollPosition) {
+ refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}

lib/warning.js

@@ -1,59 +0,0 @@
-/**
- * Copyright 2014-2015, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * LICENSE file in the root directory of this source tree. An additional grant
- * of patent rights can be found in the PATENTS file in the same directory.
- *
- * @providesModule warning
- */
-
-"use strict";
-
-var emptyFunction = require("./emptyFunction");
-
-/**
- * Similar to invariant but only logs a warning if the condition is not met.
- * This can be used to log issues in development environments in critical
- * paths. Removing the logging code for production environments will keep the
- * same logic and follow the same code paths.
- */
-
-var warning = emptyFunction;
-
-if ("production" !== process.env.NODE_ENV) {
- warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
- if (format === undefined) {
- throw new Error(
- '`warning(condition, format, ...args)` requires a warning ' +
- 'message argument'
- );
- }
-
- if (format.length < 10 || /^[s\W]*$/.test(format)) {
- throw new Error(
- 'The warning format should be able to uniquely identify this ' +
- 'warning. Please, use a more descriptive format than: ' + format
- );
- }
-
- if (format.indexOf('Failed Composite propType: ') === 0) {
- return; // Ignore CompositeComponent proptype check.
- }
-
- if (!condition) {
- var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function() {return args[argIndex++];});
- console.warn(message);
- try {
- // --- Welcome to debugging React ---
- // This error was thrown as a convenience so that you can use this stack
- // to find the callsite that caused this warning to fire.
- throw new Error(message);
- } catch(x) {}
- }
- };
-}
-
-module.exports = warning;

lib/webcomponents.js

@@ -0,0 +1,6379 @@
+/**
+ * @license
+ * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+ * @providesModule WebComponents
+ */
+// @version 0.5.1
+window.WebComponents = window.WebComponents || {};
+
+(function(scope) {
+ var flags = scope.flags || {};
+ var file = "webcomponents.js";
+ var script = document.querySelector('script[src*="' + file + '"]');
+ var flags = {};
+ if (!flags.noOpts) {
+ location.search.slice(1).split("&").forEach(function(o) {
+ o = o.split("=");
+ o[0] && (flags[o[0]] = o[1] || true);
+ });
+ if (script) {
+ for (var i = 0, a; a = script.attributes[i]; i++) {
+ if (a.name !== "src") {
+ flags[a.name] = a.value || true;
+ }
+ }
+ }
+ if (flags.log) {
+ var parts = flags.log.split(",");
+ flags.log = {};
+ parts.forEach(function(f) {
+ flags.log[f] = true;
+ });
+ } else {
+ flags.log = {};
+ }
+ }
+ flags.shadow = flags.shadow || flags.shadowdom || flags.polyfill;
+ if (flags.shadow === "native") {
+ flags.shadow = false;
+ } else {
+ flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot;
+ }
+ if (flags.register) {
+ window.CustomElements = window.CustomElements || {
+ flags: {}
+ };
+ window.CustomElements.flags.register = flags.register;
+ }
+ scope.flags = flags;
+})(WebComponents);
+
+if (WebComponents.flags.shadow) {
+ if (typeof WeakMap === "undefined") {
+ (function() {
+ var defineProperty = Object.defineProperty;
+ var counter = Date.now() % 1e9;
+ var WeakMap = function() {
+ this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
+ };
+ WeakMap.prototype = {
+ set: function(key, value) {
+ var entry = key[this.name];
+ if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
+ value: [ key, value ],
+ writable: true
+ });
+ return this;
+ },
+ get: function(key) {
+ var entry;
+ return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
+ },
+ "delete": function(key) {
+ var entry = key[this.name];
+ if (!entry || entry[0] !== key) return false;
+ entry[0] = entry[1] = undefined;
+ return true;
+ },
+ has: function(key) {
+ var entry = key[this.name];
+ if (!entry) return false;
+ return entry[0] === key;
+ }
+ };
+ window.WeakMap = WeakMap;
+ })();
+ }
+ window.ShadowDOMPolyfill = {};
+ (function(scope) {
+ "use strict";
+ var constructorTable = new WeakMap();
+ var nativePrototypeTable = new WeakMap();
+ var wrappers = Object.create(null);
+ function detectEval() {
+ if (typeof chrome !== "undefined" && chrome.app && chrome.app.runtime) {
+ return false;
+ }
+ if (navigator.getDeviceStorage) {
+ return false;
+ }
+ try {
+ var f = new Function("return true;");
+ return f();
+ } catch (ex) {
+ return false;
+ }
+ }
+ var hasEval = detectEval();
+ function assert(b) {
+ if (!b) throw new Error("Assertion failed");
+ }
+ var defineProperty = Object.defineProperty;
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
+ function mixin(to, from) {
+ var names = getOwnPropertyNames(from);
+ for (var i = 0; i < names.length; i++) {
+ var name = names[i];
+ defineProperty(to, name, getOwnPropertyDescriptor(from, name));
+ }
+ return to;
+ }
+ function mixinStatics(to, from) {
+ var names = getOwnPropertyNames(from);
+ for (var i = 0; i < names.length; i++) {
+ var name = names[i];
+ switch (name) {
+ case "arguments":
+ case "caller":
+ case "length":
+ case "name":
+ case "prototype":
+ case "toString":
+ continue;
+ }
+ defineProperty(to, name, getOwnPropertyDescriptor(from, name));
+ }
+ return to;
+ }
+ function oneOf(object, propertyNames) {
+ for (var i = 0; i < propertyNames.length; i++) {
+ if (propertyNames[i] in object) return propertyNames[i];
+ }
+ }
+ var nonEnumerableDataDescriptor = {
+ value: undefined,
+ configurable: true,
+ enumerable: false,
+ writable: true
+ };
+ function defineNonEnumerableDataProperty(object, name, value) {
+ nonEnumerableDataDescriptor.value = value;
+ defineProperty(object, name, nonEnumerableDataDescriptor);
+ }
+ getOwnPropertyNames(window);
+ function getWrapperConstructor(node) {
+ var nativePrototype = node.__proto__ || Object.getPrototypeOf(node);
+ var wrapperConstructor = constructorTable.get(nativePrototype);
+ if (wrapperConstructor) return wrapperConstructor;
+ var parentWrapperConstructor = getWrapperConstructor(nativePrototype);
+ var GeneratedWrapper = createWrapperConstructor(parentWrapperConstructor);
+ registerInternal(nativePrototype, GeneratedWrapper, node);
+ return GeneratedWrapper;
+ }
+ function addForwardingProperties(nativePrototype, wrapperPrototype) {
+ installProperty(nativePrototype, wrapperPrototype, true);
+ }
+ function registerInstanceProperties(wrapperPrototype, instanceObject) {
+ installProperty(instanceObject, wrapperPrototype, false);
+ }
+ var isFirefox = /Firefox/.test(navigator.userAgent);
+ var dummyDescriptor = {
+ get: function() {},
+ set: function(v) {},
+ configurable: true,
+ enumerable: true
+ };
+ function isEventHandlerName(name) {
+ return /^on[a-z]+$/.test(name);
+ }
+ function isIdentifierName(name) {
+ return /^\w[a-zA-Z_0-9]*$/.test(name);
+ }
+ function getGetter(name) {
+ return hasEval && isIdentifierName(name) ? new Function("return this.__impl4cf1e782hg__." + name) : function() {
+ return this.__impl4cf1e782hg__[name];
+ };
+ }
+ function getSetter(name) {
+ return hasEval && isIdentifierName(name) ? new Function("v", "this.__impl4cf1e782hg__." + name + " = v") : function(v) {
+ this.__impl4cf1e782hg__[name] = v;
+ };
+ }
+ function getMethod(name) {
+ return hasEval && isIdentifierName(name) ? new Function("return this.__impl4cf1e782hg__." + name + ".apply(this.__impl4cf1e782hg__, arguments)") : function() {
+ return this.__impl4cf1e782hg__[name].apply(this.__impl4cf1e782hg__, arguments);
+ };
+ }
+ function getDescriptor(source, name) {
+ try {
+ return Object.getOwnPropertyDescriptor(source, name);
+ } catch (ex) {
+ return dummyDescriptor;
+ }
+ }
+ var isBrokenSafari = function() {
+ var descr = Object.getOwnPropertyDescriptor(Node.prototype, "nodeType");
+ return descr && !descr.get && !descr.set;
+ }();
+ function installProperty(source, target, allowMethod, opt_blacklist) {
+ var names = getOwnPropertyNames(source);
+ for (var i = 0; i < names.length; i++) {
+ var name = names[i];
+ if (name === "polymerBlackList_") continue;
+ if (name in target) continue;
+ if (source.polymerBlackList_ && source.polymerBlackList_[name]) continue;
+ if (isFirefox) {
+ source.__lookupGetter__(name);
+ }
+ var descriptor = getDescriptor(source, name);
+ var getter, setter;
+ if (allowMethod && typeof descriptor.value === "function") {
+ target[name] = getMethod(name);
+ continue;
+ }
+ var isEvent = isEventHandlerName(name);
+ if (isEvent) getter = scope.getEventHandlerGetter(name); else getter = getGetter(name);
+ if (descriptor.writable || descriptor.set || isBrokenSafari) {
+ if (isEvent) setter = scope.getEventHandlerSetter(name); else setter = getSetter(name);
+ }
+ defineProperty(target, name, {
+ get: getter,
+ set: setter,
+ configurable: descriptor.configurable,
+ enumerable: descriptor.enumerable
+ });
+ }
+ }
+ function register(nativeConstructor, wrapperConstructor, opt_instance) {
+ var nativePrototype = nativeConstructor.prototype;
+ registerInternal(nativePrototype, wrapperConstructor, opt_instance);
+ mixinStatics(wrapperConstructor, nativeConstructor);
+ }
+ function registerInternal(nativePrototype, wrapperConstructor, opt_instance) {
+ var wrapperPrototype = wrapperConstructor.prototype;
+ assert(constructorTable.get(nativePrototype) === undefined);
+ constructorTable.set(nativePrototype, wrapperConstructor);
+ nativePrototypeTable.set(wrapperPrototype, nativePrototype);
+ addForwardingProperties(nativePrototype, wrapperPrototype);
+ if (opt_instance) registerInstanceProperties(wrapperPrototype, opt_instance);
+ defineNonEnumerableDataProperty(wrapperPrototype, "constructor", wrapperConstructor);
+ wrapperConstructor.prototype = wrapperPrototype;
+ }
+ function isWrapperFor(wrapperConstructor, nativeConstructor) {
+ return constructorTable.get(nativeConstructor.prototype) === wrapperConstructor;
+ }
+ function registerObject(object) {
+ var nativePrototype = Object.getPrototypeOf(object);
+ var superWrapperConstructor = getWrapperConstructor(nativePrototype);
+ var GeneratedWrapper = createWrapperConstructor(superWrapperConstructor);
+ registerInternal(nativePrototype, GeneratedWrapper, object);
+ return GeneratedWrapper;
+ }
+ function createWrapperConstructor(superWrapperConstructor) {
+ function GeneratedWrapper(node) {
+ superWrapperConstructor.call(this, node);
+ }
+ var p = Object.create(superWrapperConstructor.prototype);
+ p.constructor = GeneratedWrapper;
+ GeneratedWrapper.prototype = p;
+ return GeneratedWrapper;
+ }
+ function isWrapper(object) {
+ return object && object.__impl4cf1e782hg__;
+ }
+ function isNative(object) {
+ return !isWrapper(object);
+ }
+ function wrap(impl) {
+ if (impl === null) return null;
+ assert(isNative(impl));
+ return impl.__wrapper8e3dd93a60__ || (impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl))(impl));
+ }
+ function unwrap(wrapper) {
+ if (wrapper === null) return null;
+ assert(isWrapper(wrapper));
+ return wrapper.__impl4cf1e782hg__;
+ }
+ function unsafeUnwrap(wrapper) {
+ return wrapper.__impl4cf1e782hg__;
+ }
+ function setWrapper(impl, wrapper) {
+ wrapper.__impl4cf1e782hg__ = impl;
+ impl.__wrapper8e3dd93a60__ = wrapper;
+ }
+ function unwrapIfNeeded(object) {
+ return object && isWrapper(object) ? unwrap(object) : object;
+ }
+ function wrapIfNeeded(object) {
+ return object && !isWrapper(object) ? wrap(object) : object;
+ }
+ function rewrap(node, wrapper) {
+ if (wrapper === null) return;
+ assert(isNative(node));
+ assert(wrapper === undefined || isWrapper(wrapper));
+ node.__wrapper8e3dd93a60__ = wrapper;
+ }
+ var getterDescriptor = {
+ get: undefined,
+ configurable: true,
+ enumerable: true
+ };
+ function defineGetter(constructor, name, getter) {
+ getterDescriptor.get = getter;
+ defineProperty(constructor.prototype, name, getterDescriptor);
+ }
+ function defineWrapGetter(constructor, name) {
+ defineGetter(constructor, name, function() {
+ return wrap(this.__impl4cf1e782hg__[name]);
+ });
+ }
+ function forwardMethodsToWrapper(constructors, names) {
+ constructors.forEach(function(constructor) {
+ names.forEach(function(name) {
+ constructor.prototype[name] = function() {
+ var w = wrapIfNeeded(this);
+ return w[name].apply(w, arguments);
+ };
+ });
+ });
+ }
+ scope.assert = assert;
+ scope.constructorTable = constructorTable;
+ scope.defineGetter = defineGetter;
+ scope.defineWrapGetter = defineWrapGetter;
+ scope.forwardMethodsToWrapper = forwardMethodsToWrapper;
+ scope.isWrapper = isWrapper;
+ scope.isWrapperFor = isWrapperFor;
+ scope.mixin = mixin;
+ scope.nativePrototypeTable = nativePrototypeTable;
+ scope.oneOf = oneOf;
+ scope.registerObject = registerObject;
+ scope.registerWrapper = register;
+ scope.rewrap = rewrap;
+ scope.setWrapper = setWrapper;
+ scope.unsafeUnwrap = unsafeUnwrap;
+ scope.unwrap = unwrap;
+ scope.unwrapIfNeeded = unwrapIfNeeded;
+ scope.wrap = wrap;
+ scope.wrapIfNeeded = wrapIfNeeded;
+ scope.wrappers = wrappers;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ function newSplice(index, removed, addedCount) {
+ return {
+ index: index,
+ removed: removed,
+ addedCount: addedCount
+ };
+ }
+ var EDIT_LEAVE = 0;
+ var EDIT_UPDATE = 1;
+ var EDIT_ADD = 2;
+ var EDIT_DELETE = 3;
+ function ArraySplice() {}
+ ArraySplice.prototype = {
+ calcEditDistances: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
+ var rowCount = oldEnd - oldStart + 1;
+ var columnCount = currentEnd - currentStart + 1;
+ var distances = new Array(rowCount);
+ for (var i = 0; i < rowCount; i++) {
+ distances[i] = new Array(columnCount);
+ distances[i][0] = i;
+ }
+ for (var j = 0; j < columnCount; j++) distances[0][j] = j;
+ for (var i = 1; i < rowCount; i++) {
+ for (var j = 1; j < columnCount; j++) {
+ if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1])) distances[i][j] = distances[i - 1][j - 1]; else {
+ var north = distances[i - 1][j] + 1;
+ var west = distances[i][j - 1] + 1;
+ distances[i][j] = north < west ? north : west;
+ }
+ }
+ }
+ return distances;
+ },
+ spliceOperationsFromEditDistances: function(distances) {
+ var i = distances.length - 1;
+ var j = distances[0].length - 1;
+ var current = distances[i][j];
+ var edits = [];
+ while (i > 0 || j > 0) {
+ if (i == 0) {
+ edits.push(EDIT_ADD);
+ j--;
+ continue;
+ }
+ if (j == 0) {
+ edits.push(EDIT_DELETE);
+ i--;
+ continue;
+ }
+ var northWest = distances[i - 1][j - 1];
+ var west = distances[i - 1][j];
+ var north = distances[i][j - 1];
+ var min;
+ if (west < north) min = west < northWest ? west : northWest; else min = north < northWest ? north : northWest;
+ if (min == northWest) {
+ if (northWest == current) {
+ edits.push(EDIT_LEAVE);
+ } else {
+ edits.push(EDIT_UPDATE);
+ current = northWest;
+ }
+ i--;
+ j--;
+ } else if (min == west) {
+ edits.push(EDIT_DELETE);
+ i--;
+ current = west;
+ } else {
+ edits.push(EDIT_ADD);
+ j--;
+ current = north;
+ }
+ }
+ edits.reverse();
+ return edits;
+ },
+ calcSplices: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
+ var prefixCount = 0;
+ var suffixCount = 0;
+ var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
+ if (currentStart == 0 && oldStart == 0) prefixCount = this.sharedPrefix(current, old, minLength);
+ if (currentEnd == current.length && oldEnd == old.length) suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
+ currentStart += prefixCount;
+ oldStart += prefixCount;
+ currentEnd -= suffixCount;
+ oldEnd -= suffixCount;
+ if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) return [];
+ if (currentStart == currentEnd) {
+ var splice = newSplice(currentStart, [], 0);
+ while (oldStart < oldEnd) splice.removed.push(old[oldStart++]);
+ return [ splice ];
+ } else if (oldStart == oldEnd) return [ newSplice(currentStart, [], currentEnd - currentStart) ];
+ var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
+ var splice = undefined;
+ var splices = [];
+ var index = currentStart;
+ var oldIndex = oldStart;
+ for (var i = 0; i < ops.length; i++) {
+ switch (ops[i]) {
+ case EDIT_LEAVE:
+ if (splice) {
+ splices.push(splice);
+ splice = undefined;
+ }
+ index++;
+ oldIndex++;
+ break;
+
+ case EDIT_UPDATE:
+ if (!splice) splice = newSplice(index, [], 0);
+ splice.addedCount++;
+ index++;
+ splice.removed.push(old[oldIndex]);
+ oldIndex++;
+ break;
+
+ case EDIT_ADD:
+ if (!splice) splice = newSplice(index, [], 0);
+ splice.addedCount++;
+ index++;
+ break;
+
+ case EDIT_DELETE:
+ if (!splice) splice = newSplice(index, [], 0);
+ splice.removed.push(old[oldIndex]);
+ oldIndex++;
+ break;
+ }
+ }
+ if (splice) {
+ splices.push(splice);
+ }
+ return splices;
+ },
+ sharedPrefix: function(current, old, searchLength) {
+ for (var i = 0; i < searchLength; i++) if (!this.equals(current[i], old[i])) return i;
+ return searchLength;
+ },
+ sharedSuffix: function(current, old, searchLength) {
+ var index1 = current.length;
+ var index2 = old.length;
+ var count = 0;
+ while (count < searchLength && this.equals(current[--index1], old[--index2])) count++;
+ return count;
+ },
+ calculateSplices: function(current, previous) {
+ return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
+ },
+ equals: function(currentValue, previousValue) {
+ return currentValue === previousValue;
+ }
+ };
+ scope.ArraySplice = ArraySplice;
+ })(window.ShadowDOMPolyfill);
+ (function(context) {
+ "use strict";
+ var OriginalMutationObserver = window.MutationObserver;
+ var callbacks = [];
+ var pending = false;
+ var timerFunc;
+ function handle() {
+ pending = false;
+ var copies = callbacks.slice(0);
+ callbacks = [];
+ for (var i = 0; i < copies.length; i++) {
+ (0, copies[i])();
+ }
+ }
+ if (OriginalMutationObserver) {
+ var counter = 1;
+ var observer = new OriginalMutationObserver(handle);
+ var textNode = document.createTextNode(counter);
+ observer.observe(textNode, {
+ characterData: true
+ });
+ timerFunc = function() {
+ counter = (counter + 1) % 2;
+ textNode.data = counter;
+ };
+ } else {
+ timerFunc = window.setTimeout;
+ }
+ function setEndOfMicrotask(func) {
+ callbacks.push(func);
+ if (pending) return;
+ pending = true;
+ timerFunc(handle, 0);
+ }
+ context.setEndOfMicrotask = setEndOfMicrotask;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var setEndOfMicrotask = scope.setEndOfMicrotask;
+ var wrapIfNeeded = scope.wrapIfNeeded;
+ var wrappers = scope.wrappers;
+ var registrationsTable = new WeakMap();
+ var globalMutationObservers = [];
+ var isScheduled = false;
+ function scheduleCallback(observer) {
+ if (observer.scheduled_) return;
+ observer.scheduled_ = true;
+ globalMutationObservers.push(observer);
+ if (isScheduled) return;
+ setEndOfMicrotask(notifyObservers);
+ isScheduled = true;
+ }
+ function notifyObservers() {
+ isScheduled = false;
+ while (globalMutationObservers.length) {
+ var notifyList = globalMutationObservers;
+ globalMutationObservers = [];
+ notifyList.sort(function(x, y) {
+ return x.uid_ - y.uid_;
+ });
+ for (var i = 0; i < notifyList.length; i++) {
+ var mo = notifyList[i];
+ mo.scheduled_ = false;
+ var queue = mo.takeRecords();
+ removeTransientObserversFor(mo);
+ if (queue.length) {
+ mo.callback_(queue, mo);
+ }
+ }
+ }
+ }
+ function MutationRecord(type, target) {
+ this.type = type;
+ this.target = target;
+ this.addedNodes = new wrappers.NodeList();
+ this.removedNodes = new wrappers.NodeList();
+ this.previousSibling = null;
+ this.nextSibling = null;
+ this.attributeName = null;
+ this.attributeNamespace = null;
+ this.oldValue = null;
+ }
+ function registerTransientObservers(ancestor, node) {
+ for (;ancestor; ancestor = ancestor.parentNode) {
+ var registrations = registrationsTable.get(ancestor);
+ if (!registrations) continue;
+ for (var i = 0; i < registrations.length; i++) {
+ var registration = registrations[i];
+ if (registration.options.subtree) registration.addTransientObserver(node);
+ }
+ }
+ }
+ function removeTransientObserversFor(observer) {
+ for (var i = 0; i < observer.nodes_.length; i++) {
+ var node = observer.nodes_[i];
+ var registrations = registrationsTable.get(node);
+ if (!registrations) return;
+ for (var j = 0; j < registrations.length; j++) {
+ var registration = registrations[j];
+ if (registration.observer === observer) registration.removeTransientObservers();
+ }
+ }
+ }
+ function enqueueMutation(target, type, data) {
+ var interestedObservers = Object.create(null);
+ var associatedStrings = Object.create(null);
+ for (var node = target; node; node = node.parentNode) {
+ var registrations = registrationsTable.get(node);
+ if (!registrations) continue;
+ for (var j = 0; j < registrations.length; j++) {
+ var registration = registrations[j];
+ var options = registration.options;
+ if (node !== target && !options.subtree) continue;
+ if (type === "attributes" && !options.attributes) continue;
+ if (type === "attributes" && options.attributeFilter && (data.namespace !== null || options.attributeFilter.indexOf(data.name) === -1)) {
+ continue;
+ }
+ if (type === "characterData" && !options.characterData) continue;
+ if (type === "childList" && !options.childList) continue;
+ var observer = registration.observer;
+ interestedObservers[observer.uid_] = observer;
+ if (type === "attributes" && options.attributeOldValue || type === "characterData" && options.characterDataOldValue) {
+ associatedStrings[observer.uid_] = data.oldValue;
+ }
+ }
+ }
+ for (var uid in interestedObservers) {
+ var observer = interestedObservers[uid];
+ var record = new MutationRecord(type, target);
+ if ("name" in data && "namespace" in data) {
+ record.attributeName = data.name;
+ record.attributeNamespace = data.namespace;
+ }
+ if (data.addedNodes) record.addedNodes = data.addedNodes;
+ if (data.removedNodes) record.removedNodes = data.removedNodes;
+ if (data.previousSibling) record.previousSibling = data.previousSibling;
+ if (data.nextSibling) record.nextSibling = data.nextSibling;
+ if (associatedStrings[uid] !== undefined) record.oldValue = associatedStrings[uid];
+ scheduleCallback(observer);
+ observer.records_.push(record);
+ }
+ }
+ var slice = Array.prototype.slice;
+ function MutationObserverOptions(options) {
+ this.childList = !!options.childList;
+ this.subtree = !!options.subtree;
+ if (!("attributes" in options) && ("attributeOldValue" in options || "attributeFilter" in options)) {
+ this.attributes = true;
+ } else {
+ this.attributes = !!options.attributes;
+ }
+ if ("characterDataOldValue" in options && !("characterData" in options)) this.characterData = true; else this.characterData = !!options.characterData;
+ if (!this.attributes && (options.attributeOldValue || "attributeFilter" in options) || !this.characterData && options.characterDataOldValue) {
+ throw new TypeError();
+ }
+ this.characterData = !!options.characterData;
+ this.attributeOldValue = !!options.attributeOldValue;
+ this.characterDataOldValue = !!options.characterDataOldValue;
+ if ("attributeFilter" in options) {
+ if (options.attributeFilter == null || typeof options.attributeFilter !== "object") {
+ throw new TypeError();
+ }
+ this.attributeFilter = slice.call(options.attributeFilter);
+ } else {
+ this.attributeFilter = null;
+ }
+ }
+ var uidCounter = 0;
+ function MutationObserver(callback) {
+ this.callback_ = callback;
+ this.nodes_ = [];
+ this.records_ = [];
+ this.uid_ = ++uidCounter;
+ this.scheduled_ = false;
+ }
+ MutationObserver.prototype = {
+ constructor: MutationObserver,
+ observe: function(target, options) {
+ target = wrapIfNeeded(target);
+ var newOptions = new MutationObserverOptions(options);
+ var registration;
+ var registrations = registrationsTable.get(target);
+ if (!registrations) registrationsTable.set(target, registrations = []);
+ for (var i = 0; i < registrations.length; i++) {
+ if (registrations[i].observer === this) {
+ registration = registrations[i];
+ registration.removeTransientObservers();
+ registration.options = newOptions;
+ }
+ }
+ if (!registration) {
+ registration = new Registration(this, target, newOptions);
+ registrations.push(registration);
+ this.nodes_.push(target);
+ }
+ },
+ disconnect: function() {
+ this.nodes_.forEach(function(node) {
+ var registrations = registrationsTable.get(node);
+ for (var i = 0; i < registrations.length; i++) {
+ var registration = registrations[i];
+ if (registration.observer === this) {
+ registrations.splice(i, 1);
+ break;
+ }
+ }
+ }, this);
+ this.records_ = [];
+ },
+ takeRecords: function() {
+ var copyOfRecords = this.records_;
+ this.records_ = [];
+ return copyOfRecords;
+ }
+ };
+ function Registration(observer, target, options) {
+ this.observer = observer;
+ this.target = target;
+ this.options = options;
+ this.transientObservedNodes = [];
+ }
+ Registration.prototype = {
+ addTransientObserver: function(node) {
+ if (node === this.target) return;
+ scheduleCallback(this.observer);
+ this.transientObservedNodes.push(node);
+ var registrations = registrationsTable.get(node);
+ if (!registrations) registrationsTable.set(node, registrations = []);
+ registrations.push(this);
+ },
+ removeTransientObservers: function() {
+ var transientObservedNodes = this.transientObservedNodes;
+ this.transientObservedNodes = [];
+ for (var i = 0; i < transientObservedNodes.length; i++) {
+ var node = transientObservedNodes[i];
+ var registrations = registrationsTable.get(node);
+ for (var j = 0; j < registrations.length; j++) {
+ if (registrations[j] === this) {
+ registrations.splice(j, 1);
+ break;
+ }
+ }
+ }
+ }
+ };
+ scope.enqueueMutation = enqueueMutation;
+ scope.registerTransientObservers = registerTransientObservers;
+ scope.wrappers.MutationObserver = MutationObserver;
+ scope.wrappers.MutationRecord = MutationRecord;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ function TreeScope(root, parent) {
+ this.root = root;
+ this.parent = parent;
+ }
+ TreeScope.prototype = {
+ get renderer() {
+ if (this.root instanceof scope.wrappers.ShadowRoot) {
+ return scope.getRendererForHost(this.root.host);
+ }
+ return null;
+ },
+ contains: function(treeScope) {
+ for (;treeScope; treeScope = treeScope.parent) {
+ if (treeScope === this) return true;
+ }
+ return false;
+ }
+ };
+ function setTreeScope(node, treeScope) {
+ if (node.treeScope_ !== treeScope) {
+ node.treeScope_ = treeScope;
+ for (var sr = node.shadowRoot; sr; sr = sr.olderShadowRoot) {
+ sr.treeScope_.parent = treeScope;
+ }
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ setTreeScope(child, treeScope);
+ }
+ }
+ }
+ function getTreeScope(node) {
+ if (node instanceof scope.wrappers.Window) {
+ debugger;
+ }
+ if (node.treeScope_) return node.treeScope_;
+ var parent = node.parentNode;
+ var treeScope;
+ if (parent) treeScope = getTreeScope(parent); else treeScope = new TreeScope(node, null);
+ return node.treeScope_ = treeScope;
+ }
+ scope.TreeScope = TreeScope;
+ scope.getTreeScope = getTreeScope;
+ scope.setTreeScope = setTreeScope;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
+ var getTreeScope = scope.getTreeScope;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var wrappers = scope.wrappers;
+ var wrappedFuns = new WeakMap();
+ var listenersTable = new WeakMap();
+ var handledEventsTable = new WeakMap();
+ var currentlyDispatchingEvents = new WeakMap();
+ var targetTable = new WeakMap();
+ var currentTargetTable = new WeakMap();
+ var relatedTargetTable = new WeakMap();
+ var eventPhaseTable = new WeakMap();
+ var stopPropagationTable = new WeakMap();
+ var stopImmediatePropagationTable = new WeakMap();
+ var eventHandlersTable = new WeakMap();
+ var eventPathTable = new WeakMap();
+ function isShadowRoot(node) {
+ return node instanceof wrappers.ShadowRoot;
+ }
+ function rootOfNode(node) {
+ return getTreeScope(node).root;
+ }
+ function getEventPath(node, event) {
+ var path = [];
+ var current = node;
+ path.push(current);
+ while (current) {
+ var destinationInsertionPoints = getDestinationInsertionPoints(current);
+ if (destinationInsertionPoints && destinationInsertionPoints.length > 0) {
+ for (var i = 0; i < destinationInsertionPoints.length; i++) {
+ var insertionPoint = destinationInsertionPoints[i];
+ if (isShadowInsertionPoint(insertionPoint)) {
+ var shadowRoot = rootOfNode(insertionPoint);
+ var olderShadowRoot = shadowRoot.olderShadowRoot;
+ if (olderShadowRoot) path.push(olderShadowRoot);
+ }
+ path.push(insertionPoint);
+ }
+ current = destinationInsertionPoints[destinationInsertionPoints.length - 1];
+ } else {
+ if (isShadowRoot(current)) {
+ if (inSameTree(node, current) && eventMustBeStopped(event)) {
+ break;
+ }
+ current = current.host;
+ path.push(current);
+ } else {
+ current = current.parentNode;
+ if (current) path.push(current);
+ }
+ }
+ }
+ return path;
+ }
+ function eventMustBeStopped(event) {
+ if (!event) return false;
+ switch (event.type) {
+ case "abort":
+ case "error":
+ case "select":
+ case "change":
+ case "load":
+ case "reset":
+ case "resize":
+ case "scroll":
+ case "selectstart":
+ return true;
+ }
+ return false;
+ }
+ function isShadowInsertionPoint(node) {
+ return node instanceof HTMLShadowElement;
+ }
+ function getDestinationInsertionPoints(node) {
+ return scope.getDestinationInsertionPoints(node);
+ }
+ function eventRetargetting(path, currentTarget) {
+ if (path.length === 0) return currentTarget;
+ if (currentTarget instanceof wrappers.Window) currentTarget = currentTarget.document;
+ var currentTargetTree = getTreeScope(currentTarget);
+ var originalTarget = path[0];
+ var originalTargetTree = getTreeScope(originalTarget);
+ var relativeTargetTree = lowestCommonInclusiveAncestor(currentTargetTree, originalTargetTree);
+ for (var i = 0; i < path.length; i++) {
+ var node = path[i];
+ if (getTreeScope(node) === relativeTargetTree) return node;
+ }
+ return path[path.length - 1];
+ }
+ function getTreeScopeAncestors(treeScope) {
+ var ancestors = [];
+ for (;treeScope; treeScope = treeScope.parent) {
+ ancestors.push(treeScope);
+ }
+ return ancestors;
+ }
+ function lowestCommonInclusiveAncestor(tsA, tsB) {
+ var ancestorsA = getTreeScopeAncestors(tsA);
+ var ancestorsB = getTreeScopeAncestors(tsB);
+ var result = null;
+ while (ancestorsA.length > 0 && ancestorsB.length > 0) {
+ var a = ancestorsA.pop();
+ var b = ancestorsB.pop();
+ if (a === b) result = a; else break;
+ }
+ return result;
+ }
+ function getTreeScopeRoot(ts) {
+ if (!ts.parent) return ts;
+ return getTreeScopeRoot(ts.parent);
+ }
+ function relatedTargetResolution(event, currentTarget, relatedTarget) {
+ if (currentTarget instanceof wrappers.Window) currentTarget = currentTarget.document;
+ var currentTargetTree = getTreeScope(currentTarget);
+ var relatedTargetTree = getTreeScope(relatedTarget);
+ var relatedTargetEventPath = getEventPath(relatedTarget, event);
+ var lowestCommonAncestorTree;
+ var lowestCommonAncestorTree = lowestCommonInclusiveAncestor(currentTargetTree, relatedTargetTree);
+ if (!lowestCommonAncestorTree) lowestCommonAncestorTree = relatedTargetTree.root;
+ for (var commonAncestorTree = lowestCommonAncestorTree; commonAncestorTree; commonAncestorTree = commonAncestorTree.parent) {
+ var adjustedRelatedTarget;
+ for (var i = 0; i < relatedTargetEventPath.length; i++) {
+ var node = relatedTargetEventPath[i];
+ if (getTreeScope(node) === commonAncestorTree) return node;
+ }
+ }
+ return null;
+ }
+ function inSameTree(a, b) {
+ return getTreeScope(a) === getTreeScope(b);
+ }
+ var NONE = 0;
+ var CAPTURING_PHASE = 1;
+ var AT_TARGET = 2;
+ var BUBBLING_PHASE = 3;
+ var pendingError;
+ function dispatchOriginalEvent(originalEvent) {
+ if (handledEventsTable.get(originalEvent)) return;
+ handledEventsTable.set(originalEvent, true);
+ dispatchEvent(wrap(originalEvent), wrap(originalEvent.target));
+ if (pendingError) {
+ var err = pendingError;
+ pendingError = null;
+ throw err;
+ }
+ }
+ function isLoadLikeEvent(event) {
+ switch (event.type) {
+ case "load":
+ case "beforeunload":
+ case "unload":
+ return true;
+ }
+ return false;
+ }
+ function dispatchEvent(event, originalWrapperTarget) {
+ if (currentlyDispatchingEvents.get(event)) throw new Error("InvalidStateError");
+ currentlyDispatchingEvents.set(event, true);
+ scope.renderAllPending();
+ var eventPath;
+ var overrideTarget;
+ var win;
+ if (isLoadLikeEvent(event) && !event.bubbles) {
+ var doc = originalWrapperTarget;
+ if (doc instanceof wrappers.Document && (win = doc.defaultView)) {
+ overrideTarget = doc;
+ eventPath = [];
+ }
+ }
+ if (!eventPath) {
+ if (originalWrapperTarget instanceof wrappers.Window) {
+ win = originalWrapperTarget;
+ eventPath = [];
+ } else {
+ eventPath = getEventPath(originalWrapperTarget, event);
+ if (!isLoadLikeEvent(event)) {
+ var doc = eventPath[eventPath.length - 1];
+ if (doc instanceof wrappers.Document) win = doc.defaultView;
+ }
+ }
+ }
+ eventPathTable.set(event, eventPath);
+ if (dispatchCapturing(event, eventPath, win, overrideTarget)) {
+ if (dispatchAtTarget(event, eventPath, win, overrideTarget)) {
+ dispatchBubbling(event, eventPath, win, overrideTarget);
+ }
+ }
+ eventPhaseTable.set(event, NONE);
+ currentTargetTable.delete(event, null);
+ currentlyDispatchingEvents.delete(event);
+ return event.defaultPrevented;
+ }
+ function dispatchCapturing(event, eventPath, win, overrideTarget) {
+ var phase = CAPTURING_PHASE;
+ if (win) {
+ if (!invoke(win, event, phase, eventPath, overrideTarget)) return false;
+ }
+ for (var i = eventPath.length - 1; i > 0; i--) {
+ if (!invoke(eventPath[i], event, phase, eventPath, overrideTarget)) return false;
+ }
+ return true;
+ }
+ function dispatchAtTarget(event, eventPath, win, overrideTarget) {
+ var phase = AT_TARGET;
+ var currentTarget = eventPath[0] || win;
+ return invoke(currentTarget, event, phase, eventPath, overrideTarget);
+ }
+ function dispatchBubbling(event, eventPath, win, overrideTarget) {
+ var phase = BUBBLING_PHASE;
+ for (var i = 1; i < eventPath.length; i++) {
+ if (!invoke(eventPath[i], event, phase, eventPath, overrideTarget)) return;
+ }
+ if (win && eventPath.length > 0) {
+ invoke(win, event, phase, eventPath, overrideTarget);
+ }
+ }
+ function invoke(currentTarget, event, phase, eventPath, overrideTarget) {
+ var listeners = listenersTable.get(currentTarget);
+ if (!listeners) return true;
+ var target = overrideTarget || eventRetargetting(eventPath, currentTarget);
+ if (target === currentTarget) {
+ if (phase === CAPTURING_PHASE) return true;
+ if (phase === BUBBLING_PHASE) phase = AT_TARGET;
+ } else if (phase === BUBBLING_PHASE && !event.bubbles) {
+ return true;
+ }
+ if ("relatedTarget" in event) {
+ var originalEvent = unwrap(event);
+ var unwrappedRelatedTarget = originalEvent.relatedTarget;
+ if (unwrappedRelatedTarget) {
+ if (unwrappedRelatedTarget instanceof Object && unwrappedRelatedTarget.addEventListener) {
+ var relatedTarget = wrap(unwrappedRelatedTarget);
+ var adjusted = relatedTargetResolution(event, currentTarget, relatedTarget);
+ if (adjusted === target) return true;
+ } else {
+ adjusted = null;
+ }
+ relatedTargetTable.set(event, adjusted);
+ }
+ }
+ eventPhaseTable.set(event, phase);
+ var type = event.type;
+ var anyRemoved = false;
+ targetTable.set(event, target);
+ currentTargetTable.set(event, currentTarget);
+ listeners.depth++;
+ for (var i = 0, len = listeners.length; i < len; i++) {
+ var listener = listeners[i];
+ if (listener.removed) {
+ anyRemoved = true;
+ continue;
+ }
+ if (listener.type !== type || !listener.capture && phase === CAPTURING_PHASE || listener.capture && phase === BUBBLING_PHASE) {
+ continue;
+ }
+ try {
+ if (typeof listener.handler === "function") listener.handler.call(currentTarget, event); else listener.handler.handleEvent(event);
+ if (stopImmediatePropagationTable.get(event)) return false;
+ } catch (ex) {
+ if (!pendingError) pendingError = ex;
+ }
+ }
+ listeners.depth--;
+ if (anyRemoved && listeners.depth === 0) {
+ var copy = listeners.slice();
+ listeners.length = 0;
+ for (var i = 0; i < copy.length; i++) {
+ if (!copy[i].removed) listeners.push(copy[i]);
+ }
+ }
+ return !stopPropagationTable.get(event);
+ }
+ function Listener(type, handler, capture) {
+ this.type = type;
+ this.handler = handler;
+ this.capture = Boolean(capture);
+ }
+ Listener.prototype = {
+ equals: function(that) {
+ return this.handler === that.handler && this.type === that.type && this.capture === that.capture;
+ },
+ get removed() {
+ return this.handler === null;
+ },
+ remove: function() {
+ this.handler = null;
+ }
+ };
+ var OriginalEvent = window.Event;
+ OriginalEvent.prototype.polymerBlackList_ = {
+ returnValue: true,
+ keyLocation: true
+ };
+ function Event(type, options) {
+ if (type instanceof OriginalEvent) {
+ var impl = type;
+ if (!OriginalBeforeUnloadEvent && impl.type === "beforeunload" && !(this instanceof BeforeUnloadEvent)) {
+ return new BeforeUnloadEvent(impl);
+ }
+ setWrapper(impl, this);
+ } else {
+ return wrap(constructEvent(OriginalEvent, "Event", type, options));
+ }
+ }
+ Event.prototype = {
+ get target() {
+ return targetTable.get(this);
+ },
+ get currentTarget() {
+ return currentTargetTable.get(this);
+ },
+ get eventPhase() {
+ return eventPhaseTable.get(this);
+ },
+ get path() {
+ var eventPath = eventPathTable.get(this);
+ if (!eventPath) return [];
+ return eventPath.slice();
+ },
+ stopPropagation: function() {
+ stopPropagationTable.set(this, true);
+ },
+ stopImmediatePropagation: function() {
+ stopPropagationTable.set(this, true);
+ stopImmediatePropagationTable.set(this, true);
+ }
+ };
+ registerWrapper(OriginalEvent, Event, document.createEvent("Event"));
+ function unwrapOptions(options) {
+ if (!options || !options.relatedTarget) return options;
+ return Object.create(options, {
+ relatedTarget: {
+ value: unwrap(options.relatedTarget)
+ }
+ });
+ }
+ function registerGenericEvent(name, SuperEvent, prototype) {
+ var OriginalEvent = window[name];
+ var GenericEvent = function(type, options) {
+ if (type instanceof OriginalEvent) setWrapper(type, this); else return wrap(constructEvent(OriginalEvent, name, type, options));
+ };
+ GenericEvent.prototype = Object.create(SuperEvent.prototype);
+ if (prototype) mixin(GenericEvent.prototype, prototype);
+ if (OriginalEvent) {
+ try {
+ registerWrapper(OriginalEvent, GenericEvent, new OriginalEvent("temp"));
+ } catch (ex) {
+ registerWrapper(OriginalEvent, GenericEvent, document.createEvent(name));
+ }
+ }
+ return GenericEvent;
+ }
+ var UIEvent = registerGenericEvent("UIEvent", Event);
+ var CustomEvent = registerGenericEvent("CustomEvent", Event);
+ var relatedTargetProto = {
+ get relatedTarget() {
+ var relatedTarget = relatedTargetTable.get(this);
+ if (relatedTarget !== undefined) return relatedTarget;
+ return wrap(unwrap(this).relatedTarget);
+ }
+ };
+ function getInitFunction(name, relatedTargetIndex) {
+ return function() {
+ arguments[relatedTargetIndex] = unwrap(arguments[relatedTargetIndex]);
+ var impl = unwrap(this);
+ impl[name].apply(impl, arguments);
+ };
+ }
+ var mouseEventProto = mixin({
+ initMouseEvent: getInitFunction("initMouseEvent", 14)
+ }, relatedTargetProto);
+ var focusEventProto = mixin({
+ initFocusEvent: getInitFunction("initFocusEvent", 5)
+ }, relatedTargetProto);
+ var MouseEvent = registerGenericEvent("MouseEvent", UIEvent, mouseEventProto);
+ var FocusEvent = registerGenericEvent("FocusEvent", UIEvent, focusEventProto);
+ var defaultInitDicts = Object.create(null);
+ var supportsEventConstructors = function() {
+ try {
+ new window.FocusEvent("focus");
+ } catch (ex) {
+ return false;
+ }
+ return true;
+ }();
+ function constructEvent(OriginalEvent, name, type, options) {
+ if (supportsEventConstructors) return new OriginalEvent(type, unwrapOptions(options));
+ var event = unwrap(document.createEvent(name));
+ var defaultDict = defaultInitDicts[name];
+ var args = [ type ];
+ Object.keys(defaultDict).forEach(function(key) {
+ var v = options != null && key in options ? options[key] : defaultDict[key];
+ if (key === "relatedTarget") v = unwrap(v);
+ args.push(v);
+ });
+ event["init" + name].apply(event, args);
+ return event;
+ }
+ if (!supportsEventConstructors) {
+ var configureEventConstructor = function(name, initDict, superName) {
+ if (superName) {
+ var superDict = defaultInitDicts[superName];
+ initDict = mixin(mixin({}, superDict), initDict);
+ }
+ defaultInitDicts[name] = initDict;
+ };
+ configureEventConstructor("Event", {
+ bubbles: false,
+ cancelable: false
+ });
+ configureEventConstructor("CustomEvent", {
+ detail: null
+ }, "Event");
+ configureEventConstructor("UIEvent", {
+ view: null,
+ detail: 0
+ }, "Event");
+ configureEventConstructor("MouseEvent", {
+ screenX: 0,
+ screenY: 0,
+ clientX: 0,
+ clientY: 0,
+ ctrlKey: false,
+ altKey: false,
+ shiftKey: false,
+ metaKey: false,
+ button: 0,
+ relatedTarget: null
+ }, "UIEvent");
+ configureEventConstructor("FocusEvent", {
+ relatedTarget: null
+ }, "UIEvent");
+ }
+ var OriginalBeforeUnloadEvent = window.BeforeUnloadEvent;
+ function BeforeUnloadEvent(impl) {
+ Event.call(this, impl);
+ }
+ BeforeUnloadEvent.prototype = Object.create(Event.prototype);
+ mixin(BeforeUnloadEvent.prototype, {
+ get returnValue() {
+ return unsafeUnwrap(this).returnValue;
+ },
+ set returnValue(v) {
+ unsafeUnwrap(this).returnValue = v;
+ }
+ });
+ if (OriginalBeforeUnloadEvent) registerWrapper(OriginalBeforeUnloadEvent, BeforeUnloadEvent);
+ function isValidListener(fun) {
+ if (typeof fun === "function") return true;
+ return fun && fun.handleEvent;
+ }
+ function isMutationEvent(type) {
+ switch (type) {
+ case "DOMAttrModified":
+ case "DOMAttributeNameChanged":
+ case "DOMCharacterDataModified":
+ case "DOMElementNameChanged":
+ case "DOMNodeInserted":
+ case "DOMNodeInsertedIntoDocument":
+ case "DOMNodeRemoved":
+ case "DOMNodeRemovedFromDocument":
+ case "DOMSubtreeModified":
+ return true;
+ }
+ return false;
+ }
+ var OriginalEventTarget = window.EventTarget;
+ function EventTarget(impl) {
+ setWrapper(impl, this);
+ }
+ var methodNames = [ "addEventListener", "removeEventListener", "dispatchEvent" ];
+ [ Node, Window ].forEach(function(constructor) {
+ var p = constructor.prototype;
+ methodNames.forEach(function(name) {
+ Object.defineProperty(p, name + "_", {
+ value: p[name]
+ });
+ });
+ });
+ function getTargetToListenAt(wrapper) {
+ if (wrapper instanceof wrappers.ShadowRoot) wrapper = wrapper.host;
+ return unwrap(wrapper);
+ }
+ EventTarget.prototype = {
+ addEventListener: function(type, fun, capture) {
+ if (!isValidListener(fun) || isMutationEvent(type)) return;
+ var listener = new Listener(type, fun, capture);
+ var listeners = listenersTable.get(this);
+ if (!listeners) {
+ listeners = [];
+ listeners.depth = 0;
+ listenersTable.set(this, listeners);
+ } else {
+ for (var i = 0; i < listeners.length; i++) {
+ if (listener.equals(listeners[i])) return;
+ }
+ }
+ listeners.push(listener);
+ var target = getTargetToListenAt(this);
+ target.addEventListener_(type, dispatchOriginalEvent, true);
+ },
+ removeEventListener: function(type, fun, capture) {
+ capture = Boolean(capture);
+ var listeners = listenersTable.get(this);
+ if (!listeners) return;
+ var count = 0, found = false;
+ for (var i = 0; i < listeners.length; i++) {
+ if (listeners[i].type === type && listeners[i].capture === capture) {
+ count++;
+ if (listeners[i].handler === fun) {
+ found = true;
+ listeners[i].remove();
+ }
+ }
+ }
+ if (found && count === 1) {
+ var target = getTargetToListenAt(this);
+ target.removeEventListener_(type, dispatchOriginalEvent, true);
+ }
+ },
+ dispatchEvent: function(event) {
+ var nativeEvent = unwrap(event);
+ var eventType = nativeEvent.type;
+ handledEventsTable.set(nativeEvent, false);
+ scope.renderAllPending();
+ var tempListener;
+ if (!hasListenerInAncestors(this, eventType)) {
+ tempListener = function() {};
+ this.addEventListener(eventType, tempListener, true);
+ }
+ try {
+ return unwrap(this).dispatchEvent_(nativeEvent);
+ } finally {
+ if (tempListener) this.removeEventListener(eventType, tempListener, true);
+ }
+ }
+ };
+ function hasListener(node, type) {
+ var listeners = listenersTable.get(node);
+ if (listeners) {
+ for (var i = 0; i < listeners.length; i++) {
+ if (!listeners[i].removed && listeners[i].type === type) return true;
+ }
+ }
+ return false;
+ }
+ function hasListenerInAncestors(target, type) {
+ for (var node = unwrap(target); node; node = node.parentNode) {
+ if (hasListener(wrap(node), type)) return true;
+ }
+ return false;
+ }
+ if (OriginalEventTarget) registerWrapper(OriginalEventTarget, EventTarget);
+ function wrapEventTargetMethods(constructors) {
+ forwardMethodsToWrapper(constructors, methodNames);
+ }
+ var originalElementFromPoint = document.elementFromPoint;
+ function elementFromPoint(self, document, x, y) {
+ scope.renderAllPending();
+ var element = wrap(originalElementFromPoint.call(unsafeUnwrap(document), x, y));
+ if (!element) return null;
+ var path = getEventPath(element, null);
+ var idx = path.lastIndexOf(self);
+ if (idx == -1) return null; else path = path.slice(0, idx);
+ return eventRetargetting(path, self);
+ }
+ function getEventHandlerGetter(name) {
+ return function() {
+ var inlineEventHandlers = eventHandlersTable.get(this);
+ return inlineEventHandlers && inlineEventHandlers[name] && inlineEventHandlers[name].value || null;
+ };
+ }
+ function getEventHandlerSetter(name) {
+ var eventType = name.slice(2);
+ return function(value) {
+ var inlineEventHandlers = eventHandlersTable.get(this);
+ if (!inlineEventHandlers) {
+ inlineEventHandlers = Object.create(null);
+ eventHandlersTable.set(this, inlineEventHandlers);
+ }
+ var old = inlineEventHandlers[name];
+ if (old) this.removeEventListener(eventType, old.wrapped, false);
+ if (typeof value === "function") {
+ var wrapped = function(e) {
+ var rv = value.call(this, e);
+ if (rv === false) e.preventDefault(); else if (name === "onbeforeunload" && typeof rv === "string") e.returnValue = rv;
+ };
+ this.addEventListener(eventType, wrapped, false);
+ inlineEventHandlers[name] = {
+ value: value,
+ wrapped: wrapped
+ };
+ }
+ };
+ }
+ scope.elementFromPoint = elementFromPoint;
+ scope.getEventHandlerGetter = getEventHandlerGetter;
+ scope.getEventHandlerSetter = getEventHandlerSetter;
+ scope.wrapEventTargetMethods = wrapEventTargetMethods;
+ scope.wrappers.BeforeUnloadEvent = BeforeUnloadEvent;
+ scope.wrappers.CustomEvent = CustomEvent;
+ scope.wrappers.Event = Event;
+ scope.wrappers.EventTarget = EventTarget;
+ scope.wrappers.FocusEvent = FocusEvent;
+ scope.wrappers.MouseEvent = MouseEvent;
+ scope.wrappers.UIEvent = UIEvent;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var UIEvent = scope.wrappers.UIEvent;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var wrap = scope.wrap;
+ var OriginalTouchEvent = window.TouchEvent;
+ if (!OriginalTouchEvent) return;
+ var nativeEvent;
+ try {
+ nativeEvent = document.createEvent("TouchEvent");
+ } catch (ex) {
+ return;
+ }
+ var nonEnumDescriptor = {
+ enumerable: false
+ };
+ function nonEnum(obj, prop) {
+ Object.defineProperty(obj, prop, nonEnumDescriptor);
+ }
+ function Touch(impl) {
+ setWrapper(impl, this);
+ }
+ Touch.prototype = {
+ get target() {
+ return wrap(unsafeUnwrap(this).target);
+ }
+ };
+ var descr = {
+ configurable: true,
+ enumerable: true,
+ get: null
+ };
+ [ "clientX", "clientY", "screenX", "screenY", "pageX", "pageY", "identifier", "webkitRadiusX", "webkitRadiusY", "webkitRotationAngle", "webkitForce" ].forEach(function(name) {
+ descr.get = function() {
+ return unsafeUnwrap(this)[name];
+ };
+ Object.defineProperty(Touch.prototype, name, descr);
+ });
+ function TouchList() {
+ this.length = 0;
+ nonEnum(this, "length");
+ }
+ TouchList.prototype = {
+ item: function(index) {
+ return this[index];
+ }
+ };
+ function wrapTouchList(nativeTouchList) {
+ var list = new TouchList();
+ for (var i = 0; i < nativeTouchList.length; i++) {
+ list[i] = new Touch(nativeTouchList[i]);
+ }
+ list.length = i;
+ return list;
+ }
+ function TouchEvent(impl) {
+ UIEvent.call(this, impl);
+ }
+ TouchEvent.prototype = Object.create(UIEvent.prototype);
+ mixin(TouchEvent.prototype, {
+ get touches() {
+ return wrapTouchList(unsafeUnwrap(this).touches);
+ },
+ get targetTouches() {
+ return wrapTouchList(unsafeUnwrap(this).targetTouches);
+ },
+ get changedTouches() {
+ return wrapTouchList(unsafeUnwrap(this).changedTouches);
+ },
+ initTouchEvent: function() {
+ throw new Error("Not implemented");
+ }
+ });
+ registerWrapper(OriginalTouchEvent, TouchEvent, nativeEvent);
+ scope.wrappers.Touch = Touch;
+ scope.wrappers.TouchEvent = TouchEvent;
+ scope.wrappers.TouchList = TouchList;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var wrap = scope.wrap;
+ var nonEnumDescriptor = {
+ enumerable: false
+ };
+ function nonEnum(obj, prop) {
+ Object.defineProperty(obj, prop, nonEnumDescriptor);
+ }
+ function NodeList() {
+ this.length = 0;
+ nonEnum(this, "length");
+ }
+ NodeList.prototype = {
+ item: function(index) {
+ return this[index];
+ }
+ };
+ nonEnum(NodeList.prototype, "item");
+ function wrapNodeList(list) {
+ if (list == null) return list;
+ var wrapperList = new NodeList();
+ for (var i = 0, length = list.length; i < length; i++) {
+ wrapperList[i] = wrap(list[i]);
+ }
+ wrapperList.length = length;
+ return wrapperList;
+ }
+ function addWrapNodeListMethod(wrapperConstructor, name) {
+ wrapperConstructor.prototype[name] = function() {
+ return wrapNodeList(unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments));
+ };
+ }
+ scope.wrappers.NodeList = NodeList;
+ scope.addWrapNodeListMethod = addWrapNodeListMethod;
+ scope.wrapNodeList = wrapNodeList;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ scope.wrapHTMLCollection = scope.wrapNodeList;
+ scope.wrappers.HTMLCollection = scope.wrappers.NodeList;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var EventTarget = scope.wrappers.EventTarget;
+ var NodeList = scope.wrappers.NodeList;
+ var TreeScope = scope.TreeScope;
+ var assert = scope.assert;
+ var defineWrapGetter = scope.defineWrapGetter;
+ var enqueueMutation = scope.enqueueMutation;
+ var getTreeScope = scope.getTreeScope;
+ var isWrapper = scope.isWrapper;
+ var mixin = scope.mixin;
+ var registerTransientObservers = scope.registerTransientObservers;
+ var registerWrapper = scope.registerWrapper;
+ var setTreeScope = scope.setTreeScope;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var unwrapIfNeeded = scope.unwrapIfNeeded;
+ var wrap = scope.wrap;
+ var wrapIfNeeded = scope.wrapIfNeeded;
+ var wrappers = scope.wrappers;
+ function assertIsNodeWrapper(node) {
+ assert(node instanceof Node);
+ }
+ function createOneElementNodeList(node) {
+ var nodes = new NodeList();
+ nodes[0] = node;
+ nodes.length = 1;
+ return nodes;
+ }
+ var surpressMutations = false;
+ function enqueueRemovalForInsertedNodes(node, parent, nodes) {
+ enqueueMutation(parent, "childList", {
+ removedNodes: nodes,
+ previousSibling: node.previousSibling,
+ nextSibling: node.nextSibling
+ });
+ }
+ function enqueueRemovalForInsertedDocumentFragment(df, nodes) {
+ enqueueMutation(df, "childList", {
+ removedNodes: nodes
+ });
+ }
+ function collectNodes(node, parentNode, previousNode, nextNode) {
+ if (node instanceof DocumentFragment) {
+ var nodes = collectNodesForDocumentFragment(node);
+ surpressMutations = true;
+ for (var i = nodes.length - 1; i >= 0; i--) {
+ node.removeChild(nodes[i]);
+ nodes[i].parentNode_ = parentNode;
+ }
+ surpressMutations = false;
+ for (var i = 0; i < nodes.length; i++) {
+ nodes[i].previousSibling_ = nodes[i - 1] || previousNode;
+ nodes[i].nextSibling_ = nodes[i + 1] || nextNode;
+ }
+ if (previousNode) previousNode.nextSibling_ = nodes[0];
+ if (nextNode) nextNode.previousSibling_ = nodes[nodes.length - 1];
+ return nodes;
+ }
+ var nodes = createOneElementNodeList(node);
+ var oldParent = node.parentNode;
+ if (oldParent) {
+ oldParent.removeChild(node);
+ }
+ node.parentNode_ = parentNode;
+ node.previousSibling_ = previousNode;
+ node.nextSibling_ = nextNode;
+ if (previousNode) previousNode.nextSibling_ = node;
+ if (nextNode) nextNode.previousSibling_ = node;
+ return nodes;
+ }
+ function collectNodesNative(node) {
+ if (node instanceof DocumentFragment) return collectNodesForDocumentFragment(node);
+ var nodes = createOneElementNodeList(node);
+ var oldParent = node.parentNode;
+ if (oldParent) enqueueRemovalForInsertedNodes(node, oldParent, nodes);
+ return nodes;
+ }
+ function collectNodesForDocumentFragment(node) {
+ var nodes = new NodeList();
+ var i = 0;
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ nodes[i++] = child;
+ }
+ nodes.length = i;
+ enqueueRemovalForInsertedDocumentFragment(node, nodes);
+ return nodes;
+ }
+ function snapshotNodeList(nodeList) {
+ return nodeList;
+ }
+ function nodeWasAdded(node, treeScope) {
+ setTreeScope(node, treeScope);
+ node.nodeIsInserted_();
+ }
+ function nodesWereAdded(nodes, parent) {
+ var treeScope = getTreeScope(parent);
+ for (var i = 0; i < nodes.length; i++) {
+ nodeWasAdded(nodes[i], treeScope);
+ }
+ }
+ function nodeWasRemoved(node) {
+ setTreeScope(node, new TreeScope(node, null));
+ }
+ function nodesWereRemoved(nodes) {
+ for (var i = 0; i < nodes.length; i++) {
+ nodeWasRemoved(nodes[i]);
+ }
+ }
+ function ensureSameOwnerDocument(parent, child) {
+ var ownerDoc = parent.nodeType === Node.DOCUMENT_NODE ? parent : parent.ownerDocument;
+ if (ownerDoc !== child.ownerDocument) ownerDoc.adoptNode(child);
+ }
+ function adoptNodesIfNeeded(owner, nodes) {
+ if (!nodes.length) return;
+ var ownerDoc = owner.ownerDocument;
+ if (ownerDoc === nodes[0].ownerDocument) return;
+ for (var i = 0; i < nodes.length; i++) {
+ scope.adoptNodeNoRemove(nodes[i], ownerDoc);
+ }
+ }
+ function unwrapNodesForInsertion(owner, nodes) {
+ adoptNodesIfNeeded(owner, nodes);
+ var length = nodes.length;
+ if (length === 1) return unwrap(nodes[0]);
+ var df = unwrap(owner.ownerDocument.createDocumentFragment());
+ for (var i = 0; i < length; i++) {
+ df.appendChild(unwrap(nodes[i]));
+ }
+ return df;
+ }
+ function clearChildNodes(wrapper) {
+ if (wrapper.firstChild_ !== undefined) {
+ var child = wrapper.firstChild_;
+ while (child) {
+ var tmp = child;
+ child = child.nextSibling_;
+ tmp.parentNode_ = tmp.previousSibling_ = tmp.nextSibling_ = undefined;
+ }
+ }
+ wrapper.firstChild_ = wrapper.lastChild_ = undefined;
+ }
+ function removeAllChildNodes(wrapper) {
+ if (wrapper.invalidateShadowRenderer()) {
+ var childWrapper = wrapper.firstChild;
+ while (childWrapper) {
+ assert(childWrapper.parentNode === wrapper);
+ var nextSibling = childWrapper.nextSibling;
+ var childNode = unwrap(childWrapper);
+ var parentNode = childNode.parentNode;
+ if (parentNode) originalRemoveChild.call(parentNode, childNode);
+ childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = null;
+ childWrapper = nextSibling;
+ }
+ wrapper.firstChild_ = wrapper.lastChild_ = null;
+ } else {
+ var node = unwrap(wrapper);
+ var child = node.firstChild;
+ var nextSibling;
+ while (child) {
+ nextSibling = child.nextSibling;
+ originalRemoveChild.call(node, child);
+ child = nextSibling;
+ }
+ }
+ }
+ function invalidateParent(node) {
+ var p = node.parentNode;
+ return p && p.invalidateShadowRenderer();
+ }
+ function cleanupNodes(nodes) {
+ for (var i = 0, n; i < nodes.length; i++) {
+ n = nodes[i];
+ n.parentNode.removeChild(n);
+ }
+ }
+ var originalImportNode = document.importNode;
+ var originalCloneNode = window.Node.prototype.cloneNode;
+ function cloneNode(node, deep, opt_doc) {
+ var clone;
+ if (opt_doc) clone = wrap(originalImportNode.call(opt_doc, unsafeUnwrap(node), false)); else clone = wrap(originalCloneNode.call(unsafeUnwrap(node), false));
+ if (deep) {
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ clone.appendChild(cloneNode(child, true, opt_doc));
+ }
+ if (node instanceof wrappers.HTMLTemplateElement) {
+ var cloneContent = clone.content;
+ for (var child = node.content.firstChild; child; child = child.nextSibling) {
+ cloneContent.appendChild(cloneNode(child, true, opt_doc));
+ }
+ }
+ }
+ return clone;
+ }
+ function contains(self, child) {
+ if (!child || getTreeScope(self) !== getTreeScope(child)) return false;
+ for (var node = child; node; node = node.parentNode) {
+ if (node === self) return true;
+ }
+ return false;
+ }
+ var OriginalNode = window.Node;
+ function Node(original) {
+ assert(original instanceof OriginalNode);
+ EventTarget.call(this, original);
+ this.parentNode_ = undefined;
+ this.firstChild_ = undefined;
+ this.lastChild_ = undefined;
+ this.nextSibling_ = undefined;
+ this.previousSibling_ = undefined;
+ this.treeScope_ = undefined;
+ }
+ var OriginalDocumentFragment = window.DocumentFragment;
+ var originalAppendChild = OriginalNode.prototype.appendChild;
+ var originalCompareDocumentPosition = OriginalNode.prototype.compareDocumentPosition;
+ var originalInsertBefore = OriginalNode.prototype.insertBefore;
+ var originalRemoveChild = OriginalNode.prototype.removeChild;
+ var originalReplaceChild = OriginalNode.prototype.replaceChild;
+ var isIe = /Trident/.test(navigator.userAgent);
+ var removeChildOriginalHelper = isIe ? function(parent, child) {
+ try {
+ originalRemoveChild.call(parent, child);
+ } catch (ex) {
+ if (!(parent instanceof OriginalDocumentFragment)) throw ex;
+ }
+ } : function(parent, child) {
+ originalRemoveChild.call(parent, child);
+ };
+ Node.prototype = Object.create(EventTarget.prototype);
+ mixin(Node.prototype, {
+ appendChild: function(childWrapper) {
+ return this.insertBefore(childWrapper, null);
+ },
+ insertBefore: function(childWrapper, refWrapper) {
+ assertIsNodeWrapper(childWrapper);
+ var refNode;
+ if (refWrapper) {
+ if (isWrapper(refWrapper)) {
+ refNode = unwrap(refWrapper);
+ } else {
+ refNode = refWrapper;
+ refWrapper = wrap(refNode);
+ }
+ } else {
+ refWrapper = null;
+ refNode = null;
+ }
+ refWrapper && assert(refWrapper.parentNode === this);
+ var nodes;
+ var previousNode = refWrapper ? refWrapper.previousSibling : this.lastChild;
+ var useNative = !this.invalidateShadowRenderer() && !invalidateParent(childWrapper);
+ if (useNative) nodes = collectNodesNative(childWrapper); else nodes = collectNodes(childWrapper, this, previousNode, refWrapper);
+ if (useNative) {
+ ensureSameOwnerDocument(this, childWrapper);
+ clearChildNodes(this);
+ originalInsertBefore.call(unsafeUnwrap(this), unwrap(childWrapper), refNode);
+ } else {
+ if (!previousNode) this.firstChild_ = nodes[0];
+ if (!refWrapper) {
+ this.lastChild_ = nodes[nodes.length - 1];
+ if (this.firstChild_ === undefined) this.firstChild_ = this.firstChild;
+ }
+ var parentNode = refNode ? refNode.parentNode : unsafeUnwrap(this);
+ if (parentNode) {
+ originalInsertBefore.call(parentNode, unwrapNodesForInsertion(this, nodes), refNode);
+ } else {
+ adoptNodesIfNeeded(this, nodes);
+ }
+ }
+ enqueueMutation(this, "childList", {
+ addedNodes: nodes,
+ nextSibling: refWrapper,
+ previousSibling: previousNode
+ });
+ nodesWereAdded(nodes, this);
+ return childWrapper;
+ },
+ removeChild: function(childWrapper) {
+ assertIsNodeWrapper(childWrapper);
+ if (childWrapper.parentNode !== this) {
+ var found = false;
+ var childNodes = this.childNodes;
+ for (var ieChild = this.firstChild; ieChild; ieChild = ieChild.nextSibling) {
+ if (ieChild === childWrapper) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ throw new Error("NotFoundError");
+ }
+ }
+ var childNode = unwrap(childWrapper);
+ var childWrapperNextSibling = childWrapper.nextSibling;
+ var childWrapperPreviousSibling = childWrapper.previousSibling;
+ if (this.invalidateShadowRenderer()) {
+ var thisFirstChild = this.firstChild;
+ var thisLastChild = this.lastChild;
+ var parentNode = childNode.parentNode;
+ if (parentNode) removeChildOriginalHelper(parentNode, childNode);
+ if (thisFirstChild === childWrapper) this.firstChild_ = childWrapperNextSibling;
+ if (thisLastChild === childWrapper) this.lastChild_ = childWrapperPreviousSibling;
+ if (childWrapperPreviousSibling) childWrapperPreviousSibling.nextSibling_ = childWrapperNextSibling;
+ if (childWrapperNextSibling) {
+ childWrapperNextSibling.previousSibling_ = childWrapperPreviousSibling;
+ }
+ childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = undefined;
+ } else {
+ clearChildNodes(this);
+ removeChildOriginalHelper(unsafeUnwrap(this), childNode);
+ }
+ if (!surpressMutations) {
+ enqueueMutation(this, "childList", {
+ removedNodes: createOneElementNodeList(childWrapper),
+ nextSibling: childWrapperNextSibling,
+ previousSibling: childWrapperPreviousSibling
+ });
+ }
+ registerTransientObservers(this, childWrapper);
+ return childWrapper;
+ },
+ replaceChild: function(newChildWrapper, oldChildWrapper) {
+ assertIsNodeWrapper(newChildWrapper);
+ var oldChildNode;
+ if (isWrapper(oldChildWrapper)) {
+ oldChildNode = unwrap(oldChildWrapper);
+ } else {
+ oldChildNode = oldChildWrapper;
+ oldChildWrapper = wrap(oldChildNode);
+ }
+ if (oldChildWrapper.parentNode !== this) {
+ throw new Error("NotFoundError");
+ }
+ var nextNode = oldChildWrapper.nextSibling;
+ var previousNode = oldChildWrapper.previousSibling;
+ var nodes;
+ var useNative = !this.invalidateShadowRenderer() && !invalidateParent(newChildWrapper);
+ if (useNative) {
+ nodes = collectNodesNative(newChildWrapper);
+ } else {
+ if (nextNode === newChildWrapper) nextNode = newChildWrapper.nextSibling;
+ nodes = collectNodes(newChildWrapper, this, previousNode, nextNode);
+ }
+ if (!useNative) {
+ if (this.firstChild === oldChildWrapper) this.firstChild_ = nodes[0];
+ if (this.lastChild === oldChildWrapper) this.lastChild_ = nodes[nodes.length - 1];
+ oldChildWrapper.previousSibling_ = oldChildWrapper.nextSibling_ = oldChildWrapper.parentNode_ = undefined;
+ if (oldChildNode.parentNode) {
+ originalReplaceChild.call(oldChildNode.parentNode, unwrapNodesForInsertion(this, nodes), oldChildNode);
+ }
+ } else {
+ ensureSameOwnerDocument(this, newChildWrapper);
+ clearChildNodes(this);
+ originalReplaceChild.call(unsafeUnwrap(this), unwrap(newChildWrapper), oldChildNode);
+ }
+ enqueueMutation(this, "childList", {
+ addedNodes: nodes,
+ removedNodes: createOneElementNodeList(oldChildWrapper),
+ nextSibling: nextNode,
+ previousSibling: previousNode
+ });
+ nodeWasRemoved(oldChildWrapper);
+ nodesWereAdded(nodes, this);
+ return oldChildWrapper;
+ },
+ nodeIsInserted_: function() {
+ for (var child = this.firstChild; child; child = child.nextSibling) {
+ child.nodeIsInserted_();
+ }
+ },
+ hasChildNodes: function() {
+ return this.firstChild !== null;
+ },
+ get parentNode() {
+ return this.parentNode_ !== undefined ? this.parentNode_ : wrap(unsafeUnwrap(this).parentNode);
+ },
+ get firstChild() {
+ return this.firstChild_ !== undefined ? this.firstChild_ : wrap(unsafeUnwrap(this).firstChild);
+ },
+ get lastChild() {
+ return this.lastChild_ !== undefined ? this.lastChild_ : wrap(unsafeUnwrap(this).lastChild);
+ },
+ get nextSibling() {
+ return this.nextSibling_ !== undefined ? this.nextSibling_ : wrap(unsafeUnwrap(this).nextSibling);
+ },
+ get previousSibling() {
+ return this.previousSibling_ !== undefined ? this.previousSibling_ : wrap(unsafeUnwrap(this).previousSibling);
+ },
+ get parentElement() {
+ var p = this.parentNode;
+ while (p && p.nodeType !== Node.ELEMENT_NODE) {
+ p = p.parentNode;
+ }
+ return p;
+ },
+ get textContent() {
+ var s = "";
+ for (var child = this.firstChild; child; child = child.nextSibling) {
+ if (child.nodeType != Node.COMMENT_NODE) {
+ s += child.textContent;
+ }
+ }
+ return s;
+ },
+ set textContent(textContent) {
+ if (textContent == null) textContent = "";
+ var removedNodes = snapshotNodeList(this.childNodes);
+ if (this.invalidateShadowRenderer()) {
+ removeAllChildNodes(this);
+ if (textContent !== "") {
+ var textNode = unsafeUnwrap(this).ownerDocument.createTextNode(textContent);
+ this.appendChild(textNode);
+ }
+ } else {
+ clearChildNodes(this);
+ unsafeUnwrap(this).textContent = textContent;
+ }
+ var addedNodes = snapshotNodeList(this.childNodes);
+ enqueueMutation(this, "childList", {
+ addedNodes: addedNodes,
+ removedNodes: removedNodes
+ });
+ nodesWereRemoved(removedNodes);
+ nodesWereAdded(addedNodes, this);
+ },
+ get childNodes() {
+ var wrapperList = new NodeList();
+ var i = 0;
+ for (var child = this.firstChild; child; child = child.nextSibling) {
+ wrapperList[i++] = child;
+ }
+ wrapperList.length = i;
+ return wrapperList;
+ },
+ cloneNode: function(deep) {
+ return cloneNode(this, deep);
+ },
+ contains: function(child) {
+ return contains(this, wrapIfNeeded(child));
+ },
+ compareDocumentPosition: function(otherNode) {
+ return originalCompareDocumentPosition.call(unsafeUnwrap(this), unwrapIfNeeded(otherNode));
+ },
+ normalize: function() {
+ var nodes = snapshotNodeList(this.childNodes);
+ var remNodes = [];
+ var s = "";
+ var modNode;
+ for (var i = 0, n; i < nodes.length; i++) {
+ n = nodes[i];
+ if (n.nodeType === Node.TEXT_NODE) {
+ if (!modNode && !n.data.length) this.removeNode(n); else if (!modNode) modNode = n; else {
+ s += n.data;
+ remNodes.push(n);
+ }
+ } else {
+ if (modNode && remNodes.length) {
+ modNode.data += s;
+ cleanupNodes(remNodes);
+ }
+ remNodes = [];
+ s = "";
+ modNode = null;
+ if (n.childNodes.length) n.normalize();
+ }
+ }
+ if (modNode && remNodes.length) {
+ modNode.data += s;
+ cleanupNodes(remNodes);
+ }
+ }
+ });
+ defineWrapGetter(Node, "ownerDocument");
+ registerWrapper(OriginalNode, Node, document.createDocumentFragment());
+ delete Node.prototype.querySelector;
+ delete Node.prototype.querySelectorAll;
+ Node.prototype = mixin(Object.create(EventTarget.prototype), Node.prototype);
+ scope.cloneNode = cloneNode;
+ scope.nodeWasAdded = nodeWasAdded;
+ scope.nodeWasRemoved = nodeWasRemoved;
+ scope.nodesWereAdded = nodesWereAdded;
+ scope.nodesWereRemoved = nodesWereRemoved;
+ scope.originalInsertBefore = originalInsertBefore;
+ scope.originalRemoveChild = originalRemoveChild;
+ scope.snapshotNodeList = snapshotNodeList;
+ scope.wrappers.Node = Node;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLCollection = scope.wrappers.HTMLCollection;
+ var NodeList = scope.wrappers.NodeList;
+ var getTreeScope = scope.getTreeScope;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var wrap = scope.wrap;
+ var originalDocumentQuerySelector = document.querySelector;
+ var originalElementQuerySelector = document.documentElement.querySelector;
+ var originalDocumentQuerySelectorAll = document.querySelectorAll;
+ var originalElementQuerySelectorAll = document.documentElement.querySelectorAll;
+ var originalDocumentGetElementsByTagName = document.getElementsByTagName;
+ var originalElementGetElementsByTagName = document.documentElement.getElementsByTagName;
+ var originalDocumentGetElementsByTagNameNS = document.getElementsByTagNameNS;
+ var originalElementGetElementsByTagNameNS = document.documentElement.getElementsByTagNameNS;
+ var OriginalElement = window.Element;
+ var OriginalDocument = window.HTMLDocument || window.Document;
+ function filterNodeList(list, index, result, deep) {
+ var wrappedItem = null;
+ var root = null;
+ for (var i = 0, length = list.length; i < length; i++) {
+ wrappedItem = wrap(list[i]);
+ if (!deep && (root = getTreeScope(wrappedItem).root)) {
+ if (root instanceof scope.wrappers.ShadowRoot) {
+ continue;
+ }
+ }
+ result[index++] = wrappedItem;
+ }
+ return index;
+ }
+ function shimSelector(selector) {
+ return String(selector).replace(/\/deep\//g, " ");
+ }
+ function findOne(node, selector) {
+ var m, el = node.firstElementChild;
+ while (el) {
+ if (el.matches(selector)) return el;
+ m = findOne(el, selector);
+ if (m) return m;
+ el = el.nextElementSibling;
+ }
+ return null;
+ }
+ function matchesSelector(el, selector) {
+ return el.matches(selector);
+ }
+ var XHTML_NS = "http://www.w3.org/1999/xhtml";
+ function matchesTagName(el, localName, localNameLowerCase) {
+ var ln = el.localName;
+ return ln === localName || ln === localNameLowerCase && el.namespaceURI === XHTML_NS;
+ }
+ function matchesEveryThing() {
+ return true;
+ }
+ function matchesLocalNameOnly(el, ns, localName) {
+ return el.localName === localName;
+ }
+ function matchesNameSpace(el, ns) {
+ return el.namespaceURI === ns;
+ }
+ function matchesLocalNameNS(el, ns, localName) {
+ return el.namespaceURI === ns && el.localName === localName;
+ }
+ function findElements(node, index, result, p, arg0, arg1) {
+ var el = node.firstElementChild;
+ while (el) {
+ if (p(el, arg0, arg1)) result[index++] = el;
+ index = findElements(el, index, result, p, arg0, arg1);
+ el = el.nextElementSibling;
+ }
+ return index;
+ }
+ function querySelectorAllFiltered(p, index, result, selector, deep) {
+ var target = unsafeUnwrap(this);
+ var list;
+ var root = getTreeScope(this).root;
+ if (root instanceof scope.wrappers.ShadowRoot) {
+ return findElements(this, index, result, p, selector, null);
+ } else if (target instanceof OriginalElement) {
+ list = originalElementQuerySelectorAll.call(target, selector);
+ } else if (target instanceof OriginalDocument) {
+ list = originalDocumentQuerySelectorAll.call(target, selector);
+ } else {
+ return findElements(this, index, result, p, selector, null);
+ }
+ return filterNodeList(list, index, result, deep);
+ }
+ var SelectorsInterface = {
+ querySelector: function(selector) {
+ var shimmed = shimSelector(selector);
+ var deep = shimmed !== selector;
+ selector = shimmed;
+ var target = unsafeUnwrap(this);
+ var wrappedItem;
+ var root = getTreeScope(this).root;
+ if (root instanceof scope.wrappers.ShadowRoot) {
+ return findOne(this, selector);
+ } else if (target instanceof OriginalElement) {
+ wrappedItem = wrap(originalElementQuerySelector.call(target, selector));
+ } else if (target instanceof OriginalDocument) {
+ wrappedItem = wrap(originalDocumentQuerySelector.call(target, selector));
+ } else {
+ return findOne(this, selector);
+ }
+ if (!wrappedItem) {
+ return wrappedItem;
+ } else if (!deep && (root = getTreeScope(wrappedItem).root)) {
+ if (root instanceof scope.wrappers.ShadowRoot) {
+ return findOne(this, selector);
+ }
+ }
+ return wrappedItem;
+ },
+ querySelectorAll: function(selector) {
+ var shimmed = shimSelector(selector);
+ var deep = shimmed !== selector;
+ selector = shimmed;
+ var result = new NodeList();
+ result.length = querySelectorAllFiltered.call(this, matchesSelector, 0, result, selector, deep);
+ return result;
+ }
+ };
+ function getElementsByTagNameFiltered(p, index, result, localName, lowercase) {
+ var target = unsafeUnwrap(this);
+ var list;
+ var root = getTreeScope(this).root;
+ if (root instanceof scope.wrappers.ShadowRoot) {
+ return findElements(this, index, result, p, localName, lowercase);
+ } else if (target instanceof OriginalElement) {
+ list = originalElementGetElementsByTagName.call(target, localName, lowercase);
+ } else if (target instanceof OriginalDocument) {
+ list = originalDocumentGetElementsByTagName.call(target, localName, lowercase);
+ } else {
+ return findElements(this, index, result, p, localName, lowercase);
+ }
+ return filterNodeList(list, index, result, false);
+ }
+ function getElementsByTagNameNSFiltered(p, index, result, ns, localName) {
+ var target = unsafeUnwrap(this);
+ var list;
+ var root = getTreeScope(this).root;
+ if (root instanceof scope.wrappers.ShadowRoot) {
+ return findElements(this, index, result, p, ns, localName);
+ } else if (target instanceof OriginalElement) {
+ list = originalElementGetElementsByTagNameNS.call(target, ns, localName);
+ } else if (target instanceof OriginalDocument) {
+ list = originalDocumentGetElementsByTagNameNS.call(target, ns, localName);
+ } else {
+ return findElements(this, index, result, p, ns, localName);
+ }
+ return filterNodeList(list, index, result, false);
+ }
+ var GetElementsByInterface = {
+ getElementsByTagName: function(localName) {
+ var result = new HTMLCollection();
+ var match = localName === "*" ? matchesEveryThing : matchesTagName;
+ result.length = getElementsByTagNameFiltered.call(this, match, 0, result, localName, localName.toLowerCase());
+ return result;
+ },
+ getElementsByClassName: function(className) {
+ return this.querySelectorAll("." + className);
+ },
+ getElementsByTagNameNS: function(ns, localName) {
+ var result = new HTMLCollection();
+ var match = null;
+ if (ns === "*") {
+ match = localName === "*" ? matchesEveryThing : matchesLocalNameOnly;
+ } else {
+ match = localName === "*" ? matchesNameSpace : matchesLocalNameNS;
+ }
+ result.length = getElementsByTagNameNSFiltered.call(this, match, 0, result, ns || null, localName);
+ return result;
+ }
+ };
+ scope.GetElementsByInterface = GetElementsByInterface;
+ scope.SelectorsInterface = SelectorsInterface;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var NodeList = scope.wrappers.NodeList;
+ function forwardElement(node) {
+ while (node && node.nodeType !== Node.ELEMENT_NODE) {
+ node = node.nextSibling;
+ }
+ return node;
+ }
+ function backwardsElement(node) {
+ while (node && node.nodeType !== Node.ELEMENT_NODE) {
+ node = node.previousSibling;
+ }
+ return node;
+ }
+ var ParentNodeInterface = {
+ get firstElementChild() {
+ return forwardElement(this.firstChild);
+ },
+ get lastElementChild() {
+ return backwardsElement(this.lastChild);
+ },
+ get childElementCount() {
+ var count = 0;
+ for (var child = this.firstElementChild; child; child = child.nextElementSibling) {
+ count++;
+ }
+ return count;
+ },
+ get children() {
+ var wrapperList = new NodeList();
+ var i = 0;
+ for (var child = this.firstElementChild; child; child = child.nextElementSibling) {
+ wrapperList[i++] = child;
+ }
+ wrapperList.length = i;
+ return wrapperList;
+ },
+ remove: function() {
+ var p = this.parentNode;
+ if (p) p.removeChild(this);
+ }
+ };
+ var ChildNodeInterface = {
+ get nextElementSibling() {
+ return forwardElement(this.nextSibling);
+ },
+ get previousElementSibling() {
+ return backwardsElement(this.previousSibling);
+ }
+ };
+ scope.ChildNodeInterface = ChildNodeInterface;
+ scope.ParentNodeInterface = ParentNodeInterface;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var ChildNodeInterface = scope.ChildNodeInterface;
+ var Node = scope.wrappers.Node;
+ var enqueueMutation = scope.enqueueMutation;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var OriginalCharacterData = window.CharacterData;
+ function CharacterData(node) {
+ Node.call(this, node);
+ }
+ CharacterData.prototype = Object.create(Node.prototype);
+ mixin(CharacterData.prototype, {
+ get textContent() {
+ return this.data;
+ },
+ set textContent(value) {
+ this.data = value;
+ },
+ get data() {
+ return unsafeUnwrap(this).data;
+ },
+ set data(value) {
+ var oldValue = unsafeUnwrap(this).data;
+ enqueueMutation(this, "characterData", {
+ oldValue: oldValue
+ });
+ unsafeUnwrap(this).data = value;
+ }
+ });
+ mixin(CharacterData.prototype, ChildNodeInterface);
+ registerWrapper(OriginalCharacterData, CharacterData, document.createTextNode(""));
+ scope.wrappers.CharacterData = CharacterData;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var CharacterData = scope.wrappers.CharacterData;
+ var enqueueMutation = scope.enqueueMutation;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ function toUInt32(x) {
+ return x >>> 0;
+ }
+ var OriginalText = window.Text;
+ function Text(node) {
+ CharacterData.call(this, node);
+ }
+ Text.prototype = Object.create(CharacterData.prototype);
+ mixin(Text.prototype, {
+ splitText: function(offset) {
+ offset = toUInt32(offset);
+ var s = this.data;
+ if (offset > s.length) throw new Error("IndexSizeError");
+ var head = s.slice(0, offset);
+ var tail = s.slice(offset);
+ this.data = head;
+ var newTextNode = this.ownerDocument.createTextNode(tail);
+ if (this.parentNode) this.parentNode.insertBefore(newTextNode, this.nextSibling);
+ return newTextNode;
+ }
+ });
+ registerWrapper(OriginalText, Text, document.createTextNode(""));
+ scope.wrappers.Text = Text;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ function invalidateClass(el) {
+ scope.invalidateRendererBasedOnAttribute(el, "class");
+ }
+ function DOMTokenList(impl, ownerElement) {
+ setWrapper(impl, this);
+ this.ownerElement_ = ownerElement;
+ }
+ DOMTokenList.prototype = {
+ constructor: DOMTokenList,
+ get length() {
+ return unsafeUnwrap(this).length;
+ },
+ item: function(index) {
+ return unsafeUnwrap(this).item(index);
+ },
+ contains: function(token) {
+ return unsafeUnwrap(this).contains(token);
+ },
+ add: function() {
+ unsafeUnwrap(this).add.apply(unsafeUnwrap(this), arguments);
+ invalidateClass(this.ownerElement_);
+ },
+ remove: function() {
+ unsafeUnwrap(this).remove.apply(unsafeUnwrap(this), arguments);
+ invalidateClass(this.ownerElement_);
+ },
+ toggle: function(token) {
+ var rv = unsafeUnwrap(this).toggle.apply(unsafeUnwrap(this), arguments);
+ invalidateClass(this.ownerElement_);
+ return rv;
+ },
+ toString: function() {
+ return unsafeUnwrap(this).toString();
+ }
+ };
+ scope.wrappers.DOMTokenList = DOMTokenList;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var ChildNodeInterface = scope.ChildNodeInterface;
+ var GetElementsByInterface = scope.GetElementsByInterface;
+ var Node = scope.wrappers.Node;
+ var DOMTokenList = scope.wrappers.DOMTokenList;
+ var ParentNodeInterface = scope.ParentNodeInterface;
+ var SelectorsInterface = scope.SelectorsInterface;
+ var addWrapNodeListMethod = scope.addWrapNodeListMethod;
+ var enqueueMutation = scope.enqueueMutation;
+ var mixin = scope.mixin;
+ var oneOf = scope.oneOf;
+ var registerWrapper = scope.registerWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var wrappers = scope.wrappers;
+ var OriginalElement = window.Element;
+ var matchesNames = [ "matches", "mozMatchesSelector", "msMatchesSelector", "webkitMatchesSelector" ].filter(function(name) {
+ return OriginalElement.prototype[name];
+ });
+ var matchesName = matchesNames[0];
+ var originalMatches = OriginalElement.prototype[matchesName];
+ function invalidateRendererBasedOnAttribute(element, name) {
+ var p = element.parentNode;
+ if (!p || !p.shadowRoot) return;
+ var renderer = scope.getRendererForHost(p);
+ if (renderer.dependsOnAttribute(name)) renderer.invalidate();
+ }
+ function enqueAttributeChange(element, name, oldValue) {
+ enqueueMutation(element, "attributes", {
+ name: name,
+ namespace: null,
+ oldValue: oldValue
+ });
+ }
+ var classListTable = new WeakMap();
+ function Element(node) {
+ Node.call(this, node);
+ }
+ Element.prototype = Object.create(Node.prototype);
+ mixin(Element.prototype, {
+ createShadowRoot: function() {
+ var newShadowRoot = new wrappers.ShadowRoot(this);
+ unsafeUnwrap(this).polymerShadowRoot_ = newShadowRoot;
+ var renderer = scope.getRendererForHost(this);
+ renderer.invalidate();
+ return newShadowRoot;
+ },
+ get shadowRoot() {
+ return unsafeUnwrap(this).polymerShadowRoot_ || null;
+ },
+ setAttribute: function(name, value) {
+ var oldValue = unsafeUnwrap(this).getAttribute(name);
+ unsafeUnwrap(this).setAttribute(name, value);
+ enqueAttributeChange(this, name, oldValue);
+ invalidateRendererBasedOnAttribute(this, name);
+ },
+ removeAttribute: function(name) {
+ var oldValue = unsafeUnwrap(this).getAttribute(name);
+ unsafeUnwrap(this).removeAttribute(name);
+ enqueAttributeChange(this, name, oldValue);
+ invalidateRendererBasedOnAttribute(this, name);
+ },
+ matches: function(selector) {
+ return originalMatches.call(unsafeUnwrap(this), selector);
+ },
+ get classList() {
+ var list = classListTable.get(this);
+ if (!list) {
+ classListTable.set(this, list = new DOMTokenList(unsafeUnwrap(this).classList, this));
+ }
+ return list;
+ },
+ get className() {
+ return unsafeUnwrap(this).className;
+ },
+ set className(v) {
+ this.setAttribute("class", v);
+ },
+ get id() {
+ return unsafeUnwrap(this).id;
+ },
+ set id(v) {
+ this.setAttribute("id", v);
+ }
+ });
+ matchesNames.forEach(function(name) {
+ if (name !== "matches") {
+ Element.prototype[name] = function(selector) {
+ return this.matches(selector);
+ };
+ }
+ });
+ if (OriginalElement.prototype.webkitCreateShadowRoot) {
+ Element.prototype.webkitCreateShadowRoot = Element.prototype.createShadowRoot;
+ }
+ mixin(Element.prototype, ChildNodeInterface);
+ mixin(Element.prototype, GetElementsByInterface);
+ mixin(Element.prototype, ParentNodeInterface);
+ mixin(Element.prototype, SelectorsInterface);
+ registerWrapper(OriginalElement, Element, document.createElementNS(null, "x"));
+ scope.invalidateRendererBasedOnAttribute = invalidateRendererBasedOnAttribute;
+ scope.matchesNames = matchesNames;
+ scope.wrappers.Element = Element;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var Element = scope.wrappers.Element;
+ var defineGetter = scope.defineGetter;
+ var enqueueMutation = scope.enqueueMutation;
+ var mixin = scope.mixin;
+ var nodesWereAdded = scope.nodesWereAdded;
+ var nodesWereRemoved = scope.nodesWereRemoved;
+ var registerWrapper = scope.registerWrapper;
+ var snapshotNodeList = scope.snapshotNodeList;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var wrappers = scope.wrappers;
+ var escapeAttrRegExp = /[&\u00A0"]/g;
+ var escapeDataRegExp = /[&\u00A0<>]/g;
+ function escapeReplace(c) {
+ switch (c) {
+ case "&":
+ return "&amp;";
+
+ case "<":
+ return "&lt;";
+
+ case ">":
+ return "&gt;";
+
+ case '"':
+ return "&quot;";
+
+ case " ":
+ return "&nbsp;";
+ }
+ }
+ function escapeAttr(s) {
+ return s.replace(escapeAttrRegExp, escapeReplace);
+ }
+ function escapeData(s) {
+ return s.replace(escapeDataRegExp, escapeReplace);
+ }
+ function makeSet(arr) {
+ var set = {};
+ for (var i = 0; i < arr.length; i++) {
+ set[arr[i]] = true;
+ }
+ return set;
+ }
+ var voidElements = makeSet([ "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" ]);
+ var plaintextParents = makeSet([ "style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript" ]);
+ function getOuterHTML(node, parentNode) {
+ switch (node.nodeType) {
+ case Node.ELEMENT_NODE:
+ var tagName = node.tagName.toLowerCase();
+ var s = "<" + tagName;
+ var attrs = node.attributes;
+ for (var i = 0, attr; attr = attrs[i]; i++) {
+ s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
+ }
+ s += ">";
+ if (voidElements[tagName]) return s;
+ return s + getInnerHTML(node) + "</" + tagName + ">";
+
+ case Node.TEXT_NODE:
+ var data = node.data;
+ if (parentNode && plaintextParents[parentNode.localName]) return data;
+ return escapeData(data);
+
+ case Node.COMMENT_NODE:
+ return "<!--" + node.data + "-->";
+
+ default:
+ console.error(node);
+ throw new Error("not implemented");
+ }
+ }
+ function getInnerHTML(node) {
+ if (node instanceof wrappers.HTMLTemplateElement) node = node.content;
+ var s = "";
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ s += getOuterHTML(child, node);
+ }
+ return s;
+ }
+ function setInnerHTML(node, value, opt_tagName) {
+ var tagName = opt_tagName || "div";
+ node.textContent = "";
+ var tempElement = unwrap(node.ownerDocument.createElement(tagName));
+ tempElement.innerHTML = value;
+ var firstChild;
+ while (firstChild = tempElement.firstChild) {
+ node.appendChild(wrap(firstChild));
+ }
+ }
+ var oldIe = /MSIE/.test(navigator.userAgent);
+ var OriginalHTMLElement = window.HTMLElement;
+ var OriginalHTMLTemplateElement = window.HTMLTemplateElement;
+ function HTMLElement(node) {
+ Element.call(this, node);
+ }
+ HTMLElement.prototype = Object.create(Element.prototype);
+ mixin(HTMLElement.prototype, {
+ get innerHTML() {
+ return getInnerHTML(this);
+ },
+ set innerHTML(value) {
+ if (oldIe && plaintextParents[this.localName]) {
+ this.textContent = value;
+ return;
+ }
+ var removedNodes = snapshotNodeList(this.childNodes);
+ if (this.invalidateShadowRenderer()) {
+ if (this instanceof wrappers.HTMLTemplateElement) setInnerHTML(this.content, value); else setInnerHTML(this, value, this.tagName);
+ } else if (!OriginalHTMLTemplateElement && this instanceof wrappers.HTMLTemplateElement) {
+ setInnerHTML(this.content, value);
+ } else {
+ unsafeUnwrap(this).innerHTML = value;
+ }
+ var addedNodes = snapshotNodeList(this.childNodes);
+ enqueueMutation(this, "childList", {
+ addedNodes: addedNodes,
+ removedNodes: removedNodes
+ });
+ nodesWereRemoved(removedNodes);
+ nodesWereAdded(addedNodes, this);
+ },
+ get outerHTML() {
+ return getOuterHTML(this, this.parentNode);
+ },
+ set outerHTML(value) {
+ var p = this.parentNode;
+ if (p) {
+ p.invalidateShadowRenderer();
+ var df = frag(p, value);
+ p.replaceChild(df, this);
+ }
+ },
+ insertAdjacentHTML: function(position, text) {
+ var contextElement, refNode;
+ switch (String(position).toLowerCase()) {
+ case "beforebegin":
+ contextElement = this.parentNode;
+ refNode = this;
+ break;
+
+ case "afterend":
+ contextElement = this.parentNode;
+ refNode = this.nextSibling;
+ break;
+
+ case "afterbegin":
+ contextElement = this;
+ refNode = this.firstChild;
+ break;
+
+ case "beforeend":
+ contextElement = this;
+ refNode = null;
+ break;
+
+ default:
+ return;
+ }
+ var df = frag(contextElement, text);
+ contextElement.insertBefore(df, refNode);
+ },
+ get hidden() {
+ return this.hasAttribute("hidden");
+ },
+ set hidden(v) {
+ if (v) {
+ this.setAttribute("hidden", "");
+ } else {
+ this.removeAttribute("hidden");
+ }
+ }
+ });
+ function frag(contextElement, html) {
+ var p = unwrap(contextElement.cloneNode(false));
+ p.innerHTML = html;
+ var df = unwrap(document.createDocumentFragment());
+ var c;
+ while (c = p.firstChild) {
+ df.appendChild(c);
+ }
+ return wrap(df);
+ }
+ function getter(name) {
+ return function() {
+ scope.renderAllPending();
+ return unsafeUnwrap(this)[name];
+ };
+ }
+ function getterRequiresRendering(name) {
+ defineGetter(HTMLElement, name, getter(name));
+ }
+ [ "clientHeight", "clientLeft", "clientTop", "clientWidth", "offsetHeight", "offsetLeft", "offsetTop", "offsetWidth", "scrollHeight", "scrollWidth" ].forEach(getterRequiresRendering);
+ function getterAndSetterRequiresRendering(name) {
+ Object.defineProperty(HTMLElement.prototype, name, {
+ get: getter(name),
+ set: function(v) {
+ scope.renderAllPending();
+ unsafeUnwrap(this)[name] = v;
+ },
+ configurable: true,
+ enumerable: true
+ });
+ }
+ [ "scrollLeft", "scrollTop" ].forEach(getterAndSetterRequiresRendering);
+ function methodRequiresRendering(name) {
+ Object.defineProperty(HTMLElement.prototype, name, {
+ value: function() {
+ scope.renderAllPending();
+ return unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments);
+ },
+ configurable: true,
+ enumerable: true
+ });
+ }
+ [ "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(methodRequiresRendering);
+ registerWrapper(OriginalHTMLElement, HTMLElement, document.createElement("b"));
+ scope.wrappers.HTMLElement = HTMLElement;
+ scope.getInnerHTML = getInnerHTML;
+ scope.setInnerHTML = setInnerHTML;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var wrap = scope.wrap;
+ var OriginalHTMLCanvasElement = window.HTMLCanvasElement;
+ function HTMLCanvasElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLCanvasElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLCanvasElement.prototype, {
+ getContext: function() {
+ var context = unsafeUnwrap(this).getContext.apply(unsafeUnwrap(this), arguments);
+ return context && wrap(context);
+ }
+ });
+ registerWrapper(OriginalHTMLCanvasElement, HTMLCanvasElement, document.createElement("canvas"));
+ scope.wrappers.HTMLCanvasElement = HTMLCanvasElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var OriginalHTMLContentElement = window.HTMLContentElement;
+ function HTMLContentElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLContentElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLContentElement.prototype, {
+ constructor: HTMLContentElement,
+ get select() {
+ return this.getAttribute("select");
+ },
+ set select(value) {
+ this.setAttribute("select", value);
+ },
+ setAttribute: function(n, v) {
+ HTMLElement.prototype.setAttribute.call(this, n, v);
+ if (String(n).toLowerCase() === "select") this.invalidateShadowRenderer(true);
+ }
+ });
+ if (OriginalHTMLContentElement) registerWrapper(OriginalHTMLContentElement, HTMLContentElement);
+ scope.wrappers.HTMLContentElement = HTMLContentElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var wrapHTMLCollection = scope.wrapHTMLCollection;
+ var unwrap = scope.unwrap;
+ var OriginalHTMLFormElement = window.HTMLFormElement;
+ function HTMLFormElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLFormElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLFormElement.prototype, {
+ get elements() {
+ return wrapHTMLCollection(unwrap(this).elements);
+ }
+ });
+ registerWrapper(OriginalHTMLFormElement, HTMLFormElement, document.createElement("form"));
+ scope.wrappers.HTMLFormElement = HTMLFormElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var registerWrapper = scope.registerWrapper;
+ var unwrap = scope.unwrap;
+ var rewrap = scope.rewrap;
+ var OriginalHTMLImageElement = window.HTMLImageElement;
+ function HTMLImageElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLImageElement.prototype = Object.create(HTMLElement.prototype);
+ registerWrapper(OriginalHTMLImageElement, HTMLImageElement, document.createElement("img"));
+ function Image(width, height) {
+ if (!(this instanceof Image)) {
+ throw new TypeError("DOM object constructor cannot be called as a function.");
+ }
+ var node = unwrap(document.createElement("img"));
+ HTMLElement.call(this, node);
+ rewrap(node, this);
+ if (width !== undefined) node.width = width;
+ if (height !== undefined) node.height = height;
+ }
+ Image.prototype = HTMLImageElement.prototype;
+ scope.wrappers.HTMLImageElement = HTMLImageElement;
+ scope.wrappers.Image = Image;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var NodeList = scope.wrappers.NodeList;
+ var registerWrapper = scope.registerWrapper;
+ var OriginalHTMLShadowElement = window.HTMLShadowElement;
+ function HTMLShadowElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLShadowElement.prototype = Object.create(HTMLElement.prototype);
+ HTMLShadowElement.prototype.constructor = HTMLShadowElement;
+ if (OriginalHTMLShadowElement) registerWrapper(OriginalHTMLShadowElement, HTMLShadowElement);
+ scope.wrappers.HTMLShadowElement = HTMLShadowElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var contentTable = new WeakMap();
+ var templateContentsOwnerTable = new WeakMap();
+ function getTemplateContentsOwner(doc) {
+ if (!doc.defaultView) return doc;
+ var d = templateContentsOwnerTable.get(doc);
+ if (!d) {
+ d = doc.implementation.createHTMLDocument("");
+ while (d.lastChild) {
+ d.removeChild(d.lastChild);
+ }
+ templateContentsOwnerTable.set(doc, d);
+ }
+ return d;
+ }
+ function extractContent(templateElement) {
+ var doc = getTemplateContentsOwner(templateElement.ownerDocument);
+ var df = unwrap(doc.createDocumentFragment());
+ var child;
+ while (child = templateElement.firstChild) {
+ df.appendChild(child);
+ }
+ return df;
+ }
+ var OriginalHTMLTemplateElement = window.HTMLTemplateElement;
+ function HTMLTemplateElement(node) {
+ HTMLElement.call(this, node);
+ if (!OriginalHTMLTemplateElement) {
+ var content = extractContent(node);
+ contentTable.set(this, wrap(content));
+ }
+ }
+ HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLTemplateElement.prototype, {
+ constructor: HTMLTemplateElement,
+ get content() {
+ if (OriginalHTMLTemplateElement) return wrap(unsafeUnwrap(this).content);
+ return contentTable.get(this);
+ }
+ });
+ if (OriginalHTMLTemplateElement) registerWrapper(OriginalHTMLTemplateElement, HTMLTemplateElement);
+ scope.wrappers.HTMLTemplateElement = HTMLTemplateElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var registerWrapper = scope.registerWrapper;
+ var OriginalHTMLMediaElement = window.HTMLMediaElement;
+ if (!OriginalHTMLMediaElement) return;
+ function HTMLMediaElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLMediaElement.prototype = Object.create(HTMLElement.prototype);
+ registerWrapper(OriginalHTMLMediaElement, HTMLMediaElement, document.createElement("audio"));
+ scope.wrappers.HTMLMediaElement = HTMLMediaElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLMediaElement = scope.wrappers.HTMLMediaElement;
+ var registerWrapper = scope.registerWrapper;
+ var unwrap = scope.unwrap;
+ var rewrap = scope.rewrap;
+ var OriginalHTMLAudioElement = window.HTMLAudioElement;
+ if (!OriginalHTMLAudioElement) return;
+ function HTMLAudioElement(node) {
+ HTMLMediaElement.call(this, node);
+ }
+ HTMLAudioElement.prototype = Object.create(HTMLMediaElement.prototype);
+ registerWrapper(OriginalHTMLAudioElement, HTMLAudioElement, document.createElement("audio"));
+ function Audio(src) {
+ if (!(this instanceof Audio)) {
+ throw new TypeError("DOM object constructor cannot be called as a function.");
+ }
+ var node = unwrap(document.createElement("audio"));
+ HTMLMediaElement.call(this, node);
+ rewrap(node, this);
+ node.setAttribute("preload", "auto");
+ if (src !== undefined) node.setAttribute("src", src);
+ }
+ Audio.prototype = HTMLAudioElement.prototype;
+ scope.wrappers.HTMLAudioElement = HTMLAudioElement;
+ scope.wrappers.Audio = Audio;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var rewrap = scope.rewrap;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var OriginalHTMLOptionElement = window.HTMLOptionElement;
+ function trimText(s) {
+ return s.replace(/\s+/g, " ").trim();
+ }
+ function HTMLOptionElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLOptionElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLOptionElement.prototype, {
+ get text() {
+ return trimText(this.textContent);
+ },
+ set text(value) {
+ this.textContent = trimText(String(value));
+ },
+ get form() {
+ return wrap(unwrap(this).form);
+ }
+ });
+ registerWrapper(OriginalHTMLOptionElement, HTMLOptionElement, document.createElement("option"));
+ function Option(text, value, defaultSelected, selected) {
+ if (!(this instanceof Option)) {
+ throw new TypeError("DOM object constructor cannot be called as a function.");
+ }
+ var node = unwrap(document.createElement("option"));
+ HTMLElement.call(this, node);
+ rewrap(node, this);
+ if (text !== undefined) node.text = text;
+ if (value !== undefined) node.setAttribute("value", value);
+ if (defaultSelected === true) node.setAttribute("selected", "");
+ node.selected = selected === true;
+ }
+ Option.prototype = HTMLOptionElement.prototype;
+ scope.wrappers.HTMLOptionElement = HTMLOptionElement;
+ scope.wrappers.Option = Option;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var OriginalHTMLSelectElement = window.HTMLSelectElement;
+ function HTMLSelectElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLSelectElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLSelectElement.prototype, {
+ add: function(element, before) {
+ if (typeof before === "object") before = unwrap(before);
+ unwrap(this).add(unwrap(element), before);
+ },
+ remove: function(indexOrNode) {
+ if (indexOrNode === undefined) {
+ HTMLElement.prototype.remove.call(this);
+ return;
+ }
+ if (typeof indexOrNode === "object") indexOrNode = unwrap(indexOrNode);
+ unwrap(this).remove(indexOrNode);
+ },
+ get form() {
+ return wrap(unwrap(this).form);
+ }
+ });
+ registerWrapper(OriginalHTMLSelectElement, HTMLSelectElement, document.createElement("select"));
+ scope.wrappers.HTMLSelectElement = HTMLSelectElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var wrapHTMLCollection = scope.wrapHTMLCollection;
+ var OriginalHTMLTableElement = window.HTMLTableElement;
+ function HTMLTableElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLTableElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLTableElement.prototype, {
+ get caption() {
+ return wrap(unwrap(this).caption);
+ },
+ createCaption: function() {
+ return wrap(unwrap(this).createCaption());
+ },
+ get tHead() {
+ return wrap(unwrap(this).tHead);
+ },
+ createTHead: function() {
+ return wrap(unwrap(this).createTHead());
+ },
+ createTFoot: function() {
+ return wrap(unwrap(this).createTFoot());
+ },
+ get tFoot() {
+ return wrap(unwrap(this).tFoot);
+ },
+ get tBodies() {
+ return wrapHTMLCollection(unwrap(this).tBodies);
+ },
+ createTBody: function() {
+ return wrap(unwrap(this).createTBody());
+ },
+ get rows() {
+ return wrapHTMLCollection(unwrap(this).rows);
+ },
+ insertRow: function(index) {
+ return wrap(unwrap(this).insertRow(index));
+ }
+ });
+ registerWrapper(OriginalHTMLTableElement, HTMLTableElement, document.createElement("table"));
+ scope.wrappers.HTMLTableElement = HTMLTableElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var wrapHTMLCollection = scope.wrapHTMLCollection;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var OriginalHTMLTableSectionElement = window.HTMLTableSectionElement;
+ function HTMLTableSectionElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLTableSectionElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLTableSectionElement.prototype, {
+ constructor: HTMLTableSectionElement,
+ get rows() {
+ return wrapHTMLCollection(unwrap(this).rows);
+ },
+ insertRow: function(index) {
+ return wrap(unwrap(this).insertRow(index));
+ }
+ });
+ registerWrapper(OriginalHTMLTableSectionElement, HTMLTableSectionElement, document.createElement("thead"));
+ scope.wrappers.HTMLTableSectionElement = HTMLTableSectionElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var wrapHTMLCollection = scope.wrapHTMLCollection;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var OriginalHTMLTableRowElement = window.HTMLTableRowElement;
+ function HTMLTableRowElement(node) {
+ HTMLElement.call(this, node);
+ }
+ HTMLTableRowElement.prototype = Object.create(HTMLElement.prototype);
+ mixin(HTMLTableRowElement.prototype, {
+ get cells() {
+ return wrapHTMLCollection(unwrap(this).cells);
+ },
+ insertCell: function(index) {
+ return wrap(unwrap(this).insertCell(index));
+ }
+ });
+ registerWrapper(OriginalHTMLTableRowElement, HTMLTableRowElement, document.createElement("tr"));
+ scope.wrappers.HTMLTableRowElement = HTMLTableRowElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLContentElement = scope.wrappers.HTMLContentElement;
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var HTMLShadowElement = scope.wrappers.HTMLShadowElement;
+ var HTMLTemplateElement = scope.wrappers.HTMLTemplateElement;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var OriginalHTMLUnknownElement = window.HTMLUnknownElement;
+ function HTMLUnknownElement(node) {
+ switch (node.localName) {
+ case "content":
+ return new HTMLContentElement(node);
+
+ case "shadow":
+ return new HTMLShadowElement(node);
+
+ case "template":
+ return new HTMLTemplateElement(node);
+ }
+ HTMLElement.call(this, node);
+ }
+ HTMLUnknownElement.prototype = Object.create(HTMLElement.prototype);
+ registerWrapper(OriginalHTMLUnknownElement, HTMLUnknownElement);
+ scope.wrappers.HTMLUnknownElement = HTMLUnknownElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var Element = scope.wrappers.Element;
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var registerObject = scope.registerObject;
+ var SVG_NS = "http://www.w3.org/2000/svg";
+ var svgTitleElement = document.createElementNS(SVG_NS, "title");
+ var SVGTitleElement = registerObject(svgTitleElement);
+ var SVGElement = Object.getPrototypeOf(SVGTitleElement.prototype).constructor;
+ if (!("classList" in svgTitleElement)) {
+ var descr = Object.getOwnPropertyDescriptor(Element.prototype, "classList");
+ Object.defineProperty(HTMLElement.prototype, "classList", descr);
+ delete Element.prototype.classList;
+ }
+ scope.wrappers.SVGElement = SVGElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var OriginalSVGUseElement = window.SVGUseElement;
+ var SVG_NS = "http://www.w3.org/2000/svg";
+ var gWrapper = wrap(document.createElementNS(SVG_NS, "g"));
+ var useElement = document.createElementNS(SVG_NS, "use");
+ var SVGGElement = gWrapper.constructor;
+ var parentInterfacePrototype = Object.getPrototypeOf(SVGGElement.prototype);
+ var parentInterface = parentInterfacePrototype.constructor;
+ function SVGUseElement(impl) {
+ parentInterface.call(this, impl);
+ }
+ SVGUseElement.prototype = Object.create(parentInterfacePrototype);
+ if ("instanceRoot" in useElement) {
+ mixin(SVGUseElement.prototype, {
+ get instanceRoot() {
+ return wrap(unwrap(this).instanceRoot);
+ },
+ get animatedInstanceRoot() {
+ return wrap(unwrap(this).animatedInstanceRoot);
+ }
+ });
+ }
+ registerWrapper(OriginalSVGUseElement, SVGUseElement, useElement);
+ scope.wrappers.SVGUseElement = SVGUseElement;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var EventTarget = scope.wrappers.EventTarget;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var wrap = scope.wrap;
+ var OriginalSVGElementInstance = window.SVGElementInstance;
+ if (!OriginalSVGElementInstance) return;
+ function SVGElementInstance(impl) {
+ EventTarget.call(this, impl);
+ }
+ SVGElementInstance.prototype = Object.create(EventTarget.prototype);
+ mixin(SVGElementInstance.prototype, {
+ get correspondingElement() {
+ return wrap(unsafeUnwrap(this).correspondingElement);
+ },
+ get correspondingUseElement() {
+ return wrap(unsafeUnwrap(this).correspondingUseElement);
+ },
+ get parentNode() {
+ return wrap(unsafeUnwrap(this).parentNode);
+ },
+ get childNodes() {
+ throw new Error("Not implemented");
+ },
+ get firstChild() {
+ return wrap(unsafeUnwrap(this).firstChild);
+ },
+ get lastChild() {
+ return wrap(unsafeUnwrap(this).lastChild);
+ },
+ get previousSibling() {
+ return wrap(unsafeUnwrap(this).previousSibling);
+ },
+ get nextSibling() {
+ return wrap(unsafeUnwrap(this).nextSibling);
+ }
+ });
+ registerWrapper(OriginalSVGElementInstance, SVGElementInstance);
+ scope.wrappers.SVGElementInstance = SVGElementInstance;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var unwrapIfNeeded = scope.unwrapIfNeeded;
+ var wrap = scope.wrap;
+ var OriginalCanvasRenderingContext2D = window.CanvasRenderingContext2D;
+ function CanvasRenderingContext2D(impl) {
+ setWrapper(impl, this);
+ }
+ mixin(CanvasRenderingContext2D.prototype, {
+ get canvas() {
+ return wrap(unsafeUnwrap(this).canvas);
+ },
+ drawImage: function() {
+ arguments[0] = unwrapIfNeeded(arguments[0]);
+ unsafeUnwrap(this).drawImage.apply(unsafeUnwrap(this), arguments);
+ },
+ createPattern: function() {
+ arguments[0] = unwrap(arguments[0]);
+ return unsafeUnwrap(this).createPattern.apply(unsafeUnwrap(this), arguments);
+ }
+ });
+ registerWrapper(OriginalCanvasRenderingContext2D, CanvasRenderingContext2D, document.createElement("canvas").getContext("2d"));
+ scope.wrappers.CanvasRenderingContext2D = CanvasRenderingContext2D;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrapIfNeeded = scope.unwrapIfNeeded;
+ var wrap = scope.wrap;
+ var OriginalWebGLRenderingContext = window.WebGLRenderingContext;
+ if (!OriginalWebGLRenderingContext) return;
+ function WebGLRenderingContext(impl) {
+ setWrapper(impl, this);
+ }
+ mixin(WebGLRenderingContext.prototype, {
+ get canvas() {
+ return wrap(unsafeUnwrap(this).canvas);
+ },
+ texImage2D: function() {
+ arguments[5] = unwrapIfNeeded(arguments[5]);
+ unsafeUnwrap(this).texImage2D.apply(unsafeUnwrap(this), arguments);
+ },
+ texSubImage2D: function() {
+ arguments[6] = unwrapIfNeeded(arguments[6]);
+ unsafeUnwrap(this).texSubImage2D.apply(unsafeUnwrap(this), arguments);
+ }
+ });
+ var instanceProperties = /WebKit/.test(navigator.userAgent) ? {
+ drawingBufferHeight: null,
+ drawingBufferWidth: null
+ } : {};
+ registerWrapper(OriginalWebGLRenderingContext, WebGLRenderingContext, instanceProperties);
+ scope.wrappers.WebGLRenderingContext = WebGLRenderingContext;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var registerWrapper = scope.registerWrapper;
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var unwrapIfNeeded = scope.unwrapIfNeeded;
+ var wrap = scope.wrap;
+ var OriginalRange = window.Range;
+ function Range(impl) {
+ setWrapper(impl, this);
+ }
+ Range.prototype = {
+ get startContainer() {
+ return wrap(unsafeUnwrap(this).startContainer);
+ },
+ get endContainer() {
+ return wrap(unsafeUnwrap(this).endContainer);
+ },
+ get commonAncestorContainer() {
+ return wrap(unsafeUnwrap(this).commonAncestorContainer);
+ },
+ setStart: function(refNode, offset) {
+ unsafeUnwrap(this).setStart(unwrapIfNeeded(refNode), offset);
+ },
+ setEnd: function(refNode, offset) {
+ unsafeUnwrap(this).setEnd(unwrapIfNeeded(refNode), offset);
+ },
+ setStartBefore: function(refNode) {
+ unsafeUnwrap(this).setStartBefore(unwrapIfNeeded(refNode));
+ },
+ setStartAfter: function(refNode) {
+ unsafeUnwrap(this).setStartAfter(unwrapIfNeeded(refNode));
+ },
+ setEndBefore: function(refNode) {
+ unsafeUnwrap(this).setEndBefore(unwrapIfNeeded(refNode));
+ },
+ setEndAfter: function(refNode) {
+ unsafeUnwrap(this).setEndAfter(unwrapIfNeeded(refNode));
+ },
+ selectNode: function(refNode) {
+ unsafeUnwrap(this).selectNode(unwrapIfNeeded(refNode));
+ },
+ selectNodeContents: function(refNode) {
+ unsafeUnwrap(this).selectNodeContents(unwrapIfNeeded(refNode));
+ },
+ compareBoundaryPoints: function(how, sourceRange) {
+ return unsafeUnwrap(this).compareBoundaryPoints(how, unwrap(sourceRange));
+ },
+ extractContents: function() {
+ return wrap(unsafeUnwrap(this).extractContents());
+ },
+ cloneContents: function() {
+ return wrap(unsafeUnwrap(this).cloneContents());
+ },
+ insertNode: function(node) {
+ unsafeUnwrap(this).insertNode(unwrapIfNeeded(node));
+ },
+ surroundContents: function(newParent) {
+ unsafeUnwrap(this).surroundContents(unwrapIfNeeded(newParent));
+ },
+ cloneRange: function() {
+ return wrap(unsafeUnwrap(this).cloneRange());
+ },
+ isPointInRange: function(node, offset) {
+ return unsafeUnwrap(this).isPointInRange(unwrapIfNeeded(node), offset);
+ },
+ comparePoint: function(node, offset) {
+ return unsafeUnwrap(this).comparePoint(unwrapIfNeeded(node), offset);
+ },
+ intersectsNode: function(node) {
+ return unsafeUnwrap(this).intersectsNode(unwrapIfNeeded(node));
+ },
+ toString: function() {
+ return unsafeUnwrap(this).toString();
+ }
+ };
+ if (OriginalRange.prototype.createContextualFragment) {
+ Range.prototype.createContextualFragment = function(html) {
+ return wrap(unsafeUnwrap(this).createContextualFragment(html));
+ };
+ }
+ registerWrapper(window.Range, Range, document.createRange());
+ scope.wrappers.Range = Range;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var GetElementsByInterface = scope.GetElementsByInterface;
+ var ParentNodeInterface = scope.ParentNodeInterface;
+ var SelectorsInterface = scope.SelectorsInterface;
+ var mixin = scope.mixin;
+ var registerObject = scope.registerObject;
+ var DocumentFragment = registerObject(document.createDocumentFragment());
+ mixin(DocumentFragment.prototype, ParentNodeInterface);
+ mixin(DocumentFragment.prototype, SelectorsInterface);
+ mixin(DocumentFragment.prototype, GetElementsByInterface);
+ var Comment = registerObject(document.createComment(""));
+ scope.wrappers.Comment = Comment;
+ scope.wrappers.DocumentFragment = DocumentFragment;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var DocumentFragment = scope.wrappers.DocumentFragment;
+ var TreeScope = scope.TreeScope;
+ var elementFromPoint = scope.elementFromPoint;
+ var getInnerHTML = scope.getInnerHTML;
+ var getTreeScope = scope.getTreeScope;
+ var mixin = scope.mixin;
+ var rewrap = scope.rewrap;
+ var setInnerHTML = scope.setInnerHTML;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var shadowHostTable = new WeakMap();
+ var nextOlderShadowTreeTable = new WeakMap();
+ var spaceCharRe = /[ \t\n\r\f]/;
+ function ShadowRoot(hostWrapper) {
+ var node = unwrap(unsafeUnwrap(hostWrapper).ownerDocument.createDocumentFragment());
+ DocumentFragment.call(this, node);
+ rewrap(node, this);
+ var oldShadowRoot = hostWrapper.shadowRoot;
+ nextOlderShadowTreeTable.set(this, oldShadowRoot);
+ this.treeScope_ = new TreeScope(this, getTreeScope(oldShadowRoot || hostWrapper));
+ shadowHostTable.set(this, hostWrapper);
+ }
+ ShadowRoot.prototype = Object.create(DocumentFragment.prototype);
+ mixin(ShadowRoot.prototype, {
+ constructor: ShadowRoot,
+ get innerHTML() {
+ return getInnerHTML(this);
+ },
+ set innerHTML(value) {
+ setInnerHTML(this, value);
+ this.invalidateShadowRenderer();
+ },
+ get olderShadowRoot() {
+ return nextOlderShadowTreeTable.get(this) || null;
+ },
+ get host() {
+ return shadowHostTable.get(this) || null;
+ },
+ invalidateShadowRenderer: function() {
+ return shadowHostTable.get(this).invalidateShadowRenderer();
+ },
+ elementFromPoint: function(x, y) {
+ return elementFromPoint(this, this.ownerDocument, x, y);
+ },
+ getElementById: function(id) {
+ if (spaceCharRe.test(id)) return null;
+ return this.querySelector('[id="' + id + '"]');
+ }
+ });
+ scope.wrappers.ShadowRoot = ShadowRoot;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var Element = scope.wrappers.Element;
+ var HTMLContentElement = scope.wrappers.HTMLContentElement;
+ var HTMLShadowElement = scope.wrappers.HTMLShadowElement;
+ var Node = scope.wrappers.Node;
+ var ShadowRoot = scope.wrappers.ShadowRoot;
+ var assert = scope.assert;
+ var getTreeScope = scope.getTreeScope;
+ var mixin = scope.mixin;
+ var oneOf = scope.oneOf;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var ArraySplice = scope.ArraySplice;
+ function updateWrapperUpAndSideways(wrapper) {
+ wrapper.previousSibling_ = wrapper.previousSibling;
+ wrapper.nextSibling_ = wrapper.nextSibling;
+ wrapper.parentNode_ = wrapper.parentNode;
+ }
+ function updateWrapperDown(wrapper) {
+ wrapper.firstChild_ = wrapper.firstChild;
+ wrapper.lastChild_ = wrapper.lastChild;
+ }
+ function updateAllChildNodes(parentNodeWrapper) {
+ assert(parentNodeWrapper instanceof Node);
+ for (var childWrapper = parentNodeWrapper.firstChild; childWrapper; childWrapper = childWrapper.nextSibling) {
+ updateWrapperUpAndSideways(childWrapper);
+ }
+ updateWrapperDown(parentNodeWrapper);
+ }
+ function insertBefore(parentNodeWrapper, newChildWrapper, refChildWrapper) {
+ var parentNode = unwrap(parentNodeWrapper);
+ var newChild = unwrap(newChildWrapper);
+ var refChild = refChildWrapper ? unwrap(refChildWrapper) : null;
+ remove(newChildWrapper);
+ updateWrapperUpAndSideways(newChildWrapper);
+ if (!refChildWrapper) {
+ parentNodeWrapper.lastChild_ = parentNodeWrapper.lastChild;
+ if (parentNodeWrapper.lastChild === parentNodeWrapper.firstChild) parentNodeWrapper.firstChild_ = parentNodeWrapper.firstChild;
+ var lastChildWrapper = wrap(parentNode.lastChild);
+ if (lastChildWrapper) lastChildWrapper.nextSibling_ = lastChildWrapper.nextSibling;
+ } else {
+ if (parentNodeWrapper.firstChild === refChildWrapper) parentNodeWrapper.firstChild_ = refChildWrapper;
+ refChildWrapper.previousSibling_ = refChildWrapper.previousSibling;
+ }
+ scope.originalInsertBefore.call(parentNode, newChild, refChild);
+ }
+ function remove(nodeWrapper) {
+ var node = unwrap(nodeWrapper);
+ var parentNode = node.parentNode;
+ if (!parentNode) return;
+ var parentNodeWrapper = wrap(parentNode);
+ updateWrapperUpAndSideways(nodeWrapper);
+ if (nodeWrapper.previousSibling) nodeWrapper.previousSibling.nextSibling_ = nodeWrapper;
+ if (nodeWrapper.nextSibling) nodeWrapper.nextSibling.previousSibling_ = nodeWrapper;
+ if (parentNodeWrapper.lastChild === nodeWrapper) parentNodeWrapper.lastChild_ = nodeWrapper;
+ if (parentNodeWrapper.firstChild === nodeWrapper) parentNodeWrapper.firstChild_ = nodeWrapper;
+ scope.originalRemoveChild.call(parentNode, node);
+ }
+ var distributedNodesTable = new WeakMap();
+ var destinationInsertionPointsTable = new WeakMap();
+ var rendererForHostTable = new WeakMap();
+ function resetDistributedNodes(insertionPoint) {
+ distributedNodesTable.set(insertionPoint, []);
+ }
+ function getDistributedNodes(insertionPoint) {
+ var rv = distributedNodesTable.get(insertionPoint);
+ if (!rv) distributedNodesTable.set(insertionPoint, rv = []);
+ return rv;
+ }
+ function getChildNodesSnapshot(node) {
+ var result = [], i = 0;
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ result[i++] = child;
+ }
+ return result;
+ }
+ var request = oneOf(window, [ "requestAnimationFrame", "mozRequestAnimationFrame", "webkitRequestAnimationFrame", "setTimeout" ]);
+ var pendingDirtyRenderers = [];
+ var renderTimer;
+ function renderAllPending() {
+ for (var i = 0; i < pendingDirtyRenderers.length; i++) {
+ var renderer = pendingDirtyRenderers[i];
+ var parentRenderer = renderer.parentRenderer;
+ if (parentRenderer && parentRenderer.dirty) continue;
+ renderer.render();
+ }
+ pendingDirtyRenderers = [];
+ }
+ function handleRequestAnimationFrame() {
+ renderTimer = null;
+ renderAllPending();
+ }
+ function getRendererForHost(host) {
+ var renderer = rendererForHostTable.get(host);
+ if (!renderer) {
+ renderer = new ShadowRenderer(host);
+ rendererForHostTable.set(host, renderer);
+ }
+ return renderer;
+ }
+ function getShadowRootAncestor(node) {
+ var root = getTreeScope(node).root;
+ if (root instanceof ShadowRoot) return root;
+ return null;
+ }
+ function getRendererForShadowRoot(shadowRoot) {
+ return getRendererForHost(shadowRoot.host);
+ }
+ var spliceDiff = new ArraySplice();
+ spliceDiff.equals = function(renderNode, rawNode) {
+ return unwrap(renderNode.node) === rawNode;
+ };
+ function RenderNode(node) {
+ this.skip = false;
+ this.node = node;
+ this.childNodes = [];
+ }
+ RenderNode.prototype = {
+ append: function(node) {
+ var rv = new RenderNode(node);
+ this.childNodes.push(rv);
+ return rv;
+ },
+ sync: function(opt_added) {
+ if (this.skip) return;
+ var nodeWrapper = this.node;
+ var newChildren = this.childNodes;
+ var oldChildren = getChildNodesSnapshot(unwrap(nodeWrapper));
+ var added = opt_added || new WeakMap();
+ var splices = spliceDiff.calculateSplices(newChildren, oldChildren);
+ var newIndex = 0, oldIndex = 0;
+ var lastIndex = 0;
+ for (var i = 0; i < splices.length; i++) {
+ var splice = splices[i];
+ for (;lastIndex < splice.index; lastIndex++) {
+ oldIndex++;
+ newChildren[newIndex++].sync(added);
+ }
+ var removedCount = splice.removed.length;
+ for (var j = 0; j < removedCount; j++) {
+ var wrapper = wrap(oldChildren[oldIndex++]);
+ if (!added.get(wrapper)) remove(wrapper);
+ }
+ var addedCount = splice.addedCount;
+ var refNode = oldChildren[oldIndex] && wrap(oldChildren[oldIndex]);
+ for (var j = 0; j < addedCount; j++) {
+ var newChildRenderNode = newChildren[newIndex++];
+ var newChildWrapper = newChildRenderNode.node;
+ insertBefore(nodeWrapper, newChildWrapper, refNode);
+ added.set(newChildWrapper, true);
+ newChildRenderNode.sync(added);
+ }
+ lastIndex += addedCount;
+ }
+ for (var i = lastIndex; i < newChildren.length; i++) {
+ newChildren[i].sync(added);
+ }
+ }
+ };
+ function ShadowRenderer(host) {
+ this.host = host;
+ this.dirty = false;
+ this.invalidateAttributes();
+ this.associateNode(host);
+ }
+ ShadowRenderer.prototype = {
+ render: function(opt_renderNode) {
+ if (!this.dirty) return;
+ this.invalidateAttributes();
+ var host = this.host;
+ this.distribution(host);
+ var renderNode = opt_renderNode || new RenderNode(host);
+ this.buildRenderTree(renderNode, host);
+ var topMostRenderer = !opt_renderNode;
+ if (topMostRenderer) renderNode.sync();
+ this.dirty = false;
+ },
+ get parentRenderer() {
+ return getTreeScope(this.host).renderer;
+ },
+ invalidate: function() {
+ if (!this.dirty) {
+ this.dirty = true;
+ var parentRenderer = this.parentRenderer;
+ if (parentRenderer) parentRenderer.invalidate();
+ pendingDirtyRenderers.push(this);
+ if (renderTimer) return;
+ renderTimer = window[request](handleRequestAnimationFrame, 0);
+ }
+ },
+ distribution: function(root) {
+ this.resetAllSubtrees(root);
+ this.distributionResolution(root);
+ },
+ resetAll: function(node) {
+ if (isInsertionPoint(node)) resetDistributedNodes(node); else resetDestinationInsertionPoints(node);
+ this.resetAllSubtrees(node);
+ },
+ resetAllSubtrees: function(node) {
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ this.resetAll(child);
+ }
+ if (node.shadowRoot) this.resetAll(node.shadowRoot);
+ if (node.olderShadowRoot) this.resetAll(node.olderShadowRoot);
+ },
+ distributionResolution: function(node) {
+ if (isShadowHost(node)) {
+ var shadowHost = node;
+ var pool = poolPopulation(shadowHost);
+ var shadowTrees = getShadowTrees(shadowHost);
+ for (var i = 0; i < shadowTrees.length; i++) {
+ this.poolDistribution(shadowTrees[i], pool);
+ }
+ for (var i = shadowTrees.length - 1; i >= 0; i--) {
+ var shadowTree = shadowTrees[i];
+ var shadow = getShadowInsertionPoint(shadowTree);
+ if (shadow) {
+ var olderShadowRoot = shadowTree.olderShadowRoot;
+ if (olderShadowRoot) {
+ pool = poolPopulation(olderShadowRoot);
+ }
+ for (var j = 0; j < pool.length; j++) {
+ destributeNodeInto(pool[j], shadow);
+ }
+ }
+ this.distributionResolution(shadowTree);
+ }
+ }
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ this.distributionResolution(child);
+ }
+ },
+ poolDistribution: function(node, pool) {
+ if (node instanceof HTMLShadowElement) return;
+ if (node instanceof HTMLContentElement) {
+ var content = node;
+ this.updateDependentAttributes(content.getAttribute("select"));
+ var anyDistributed = false;
+ for (var i = 0; i < pool.length; i++) {
+ var node = pool[i];
+ if (!node) continue;
+ if (matches(node, content)) {
+ destributeNodeInto(node, content);
+ pool[i] = undefined;
+ anyDistributed = true;
+ }
+ }
+ if (!anyDistributed) {
+ for (var child = content.firstChild; child; child = child.nextSibling) {
+ destributeNodeInto(child, content);
+ }
+ }
+ return;
+ }
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ this.poolDistribution(child, pool);
+ }
+ },
+ buildRenderTree: function(renderNode, node) {
+ var children = this.compose(node);
+ for (var i = 0; i < children.length; i++) {
+ var child = children[i];
+ var childRenderNode = renderNode.append(child);
+ this.buildRenderTree(childRenderNode, child);
+ }
+ if (isShadowHost(node)) {
+ var renderer = getRendererForHost(node);
+ renderer.dirty = false;
+ }
+ },
+ compose: function(node) {
+ var children = [];
+ var p = node.shadowRoot || node;
+ for (var child = p.firstChild; child; child = child.nextSibling) {
+ if (isInsertionPoint(child)) {
+ this.associateNode(p);
+ var distributedNodes = getDistributedNodes(child);
+ for (var j = 0; j < distributedNodes.length; j++) {
+ var distributedNode = distributedNodes[j];
+ if (isFinalDestination(child, distributedNode)) children.push(distributedNode);
+ }
+ } else {
+ children.push(child);
+ }
+ }
+ return children;
+ },
+ invalidateAttributes: function() {
+ this.attributes = Object.create(null);
+ },
+ updateDependentAttributes: function(selector) {
+ if (!selector) return;
+ var attributes = this.attributes;
+ if (/\.\w+/.test(selector)) attributes["class"] = true;
+ if (/#\w+/.test(selector)) attributes["id"] = true;
+ selector.replace(/\[\s*([^\s=\|~\]]+)/g, function(_, name) {
+ attributes[name] = true;
+ });
+ },
+ dependsOnAttribute: function(name) {
+ return this.attributes[name];
+ },
+ associateNode: function(node) {
+ unsafeUnwrap(node).polymerShadowRenderer_ = this;
+ }
+ };
+ function poolPopulation(node) {
+ var pool = [];
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ if (isInsertionPoint(child)) {
+ pool.push.apply(pool, getDistributedNodes(child));
+ } else {
+ pool.push(child);
+ }
+ }
+ return pool;
+ }
+ function getShadowInsertionPoint(node) {
+ if (node instanceof HTMLShadowElement) return node;
+ if (node instanceof HTMLContentElement) return null;
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ var res = getShadowInsertionPoint(child);
+ if (res) return res;
+ }
+ return null;
+ }
+ function destributeNodeInto(child, insertionPoint) {
+ getDistributedNodes(insertionPoint).push(child);
+ var points = destinationInsertionPointsTable.get(child);
+ if (!points) destinationInsertionPointsTable.set(child, [ insertionPoint ]); else points.push(insertionPoint);
+ }
+ function getDestinationInsertionPoints(node) {
+ return destinationInsertionPointsTable.get(node);
+ }
+ function resetDestinationInsertionPoints(node) {
+ destinationInsertionPointsTable.set(node, undefined);
+ }
+ var selectorStartCharRe = /^(:not\()?[*.#[a-zA-Z_|]/;
+ function matches(node, contentElement) {
+ var select = contentElement.getAttribute("select");
+ if (!select) return true;
+ select = select.trim();
+ if (!select) return true;
+ if (!(node instanceof Element)) return false;
+ if (!selectorStartCharRe.test(select)) return false;
+ try {
+ return node.matches(select);
+ } catch (ex) {
+ return false;
+ }
+ }
+ function isFinalDestination(insertionPoint, node) {
+ var points = getDestinationInsertionPoints(node);
+ return points && points[points.length - 1] === insertionPoint;
+ }
+ function isInsertionPoint(node) {
+ return node instanceof HTMLContentElement || node instanceof HTMLShadowElement;
+ }
+ function isShadowHost(shadowHost) {
+ return shadowHost.shadowRoot;
+ }
+ function getShadowTrees(host) {
+ var trees = [];
+ for (var tree = host.shadowRoot; tree; tree = tree.olderShadowRoot) {
+ trees.push(tree);
+ }
+ return trees;
+ }
+ function render(host) {
+ new ShadowRenderer(host).render();
+ }
+ Node.prototype.invalidateShadowRenderer = function(force) {
+ var renderer = unsafeUnwrap(this).polymerShadowRenderer_;
+ if (renderer) {
+ renderer.invalidate();
+ return true;
+ }
+ return false;
+ };
+ HTMLContentElement.prototype.getDistributedNodes = HTMLShadowElement.prototype.getDistributedNodes = function() {
+ renderAllPending();
+ return getDistributedNodes(this);
+ };
+ Element.prototype.getDestinationInsertionPoints = function() {
+ renderAllPending();
+ return getDestinationInsertionPoints(this) || [];
+ };
+ HTMLContentElement.prototype.nodeIsInserted_ = HTMLShadowElement.prototype.nodeIsInserted_ = function() {
+ this.invalidateShadowRenderer();
+ var shadowRoot = getShadowRootAncestor(this);
+ var renderer;
+ if (shadowRoot) renderer = getRendererForShadowRoot(shadowRoot);
+ unsafeUnwrap(this).polymerShadowRenderer_ = renderer;
+ if (renderer) renderer.invalidate();
+ };
+ scope.getRendererForHost = getRendererForHost;
+ scope.getShadowTrees = getShadowTrees;
+ scope.renderAllPending = renderAllPending;
+ scope.getDestinationInsertionPoints = getDestinationInsertionPoints;
+ scope.visual = {
+ insertBefore: insertBefore,
+ remove: remove
+ };
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var HTMLElement = scope.wrappers.HTMLElement;
+ var assert = scope.assert;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var elementsWithFormProperty = [ "HTMLButtonElement", "HTMLFieldSetElement", "HTMLInputElement", "HTMLKeygenElement", "HTMLLabelElement", "HTMLLegendElement", "HTMLObjectElement", "HTMLOutputElement", "HTMLTextAreaElement" ];
+ function createWrapperConstructor(name) {
+ if (!window[name]) return;
+ assert(!scope.wrappers[name]);
+ var GeneratedWrapper = function(node) {
+ HTMLElement.call(this, node);
+ };
+ GeneratedWrapper.prototype = Object.create(HTMLElement.prototype);
+ mixin(GeneratedWrapper.prototype, {
+ get form() {
+ return wrap(unwrap(this).form);
+ }
+ });
+ registerWrapper(window[name], GeneratedWrapper, document.createElement(name.slice(4, -7)));
+ scope.wrappers[name] = GeneratedWrapper;
+ }
+ elementsWithFormProperty.forEach(createWrapperConstructor);
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var registerWrapper = scope.registerWrapper;
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var unwrapIfNeeded = scope.unwrapIfNeeded;
+ var wrap = scope.wrap;
+ var OriginalSelection = window.Selection;
+ function Selection(impl) {
+ setWrapper(impl, this);
+ }
+ Selection.prototype = {
+ get anchorNode() {
+ return wrap(unsafeUnwrap(this).anchorNode);
+ },
+ get focusNode() {
+ return wrap(unsafeUnwrap(this).focusNode);
+ },
+ addRange: function(range) {
+ unsafeUnwrap(this).addRange(unwrap(range));
+ },
+ collapse: function(node, index) {
+ unsafeUnwrap(this).collapse(unwrapIfNeeded(node), index);
+ },
+ containsNode: function(node, allowPartial) {
+ return unsafeUnwrap(this).containsNode(unwrapIfNeeded(node), allowPartial);
+ },
+ extend: function(node, offset) {
+ unsafeUnwrap(this).extend(unwrapIfNeeded(node), offset);
+ },
+ getRangeAt: function(index) {
+ return wrap(unsafeUnwrap(this).getRangeAt(index));
+ },
+ removeRange: function(range) {
+ unsafeUnwrap(this).removeRange(unwrap(range));
+ },
+ selectAllChildren: function(node) {
+ unsafeUnwrap(this).selectAllChildren(unwrapIfNeeded(node));
+ },
+ toString: function() {
+ return unsafeUnwrap(this).toString();
+ }
+ };
+ registerWrapper(window.Selection, Selection, window.getSelection());
+ scope.wrappers.Selection = Selection;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var GetElementsByInterface = scope.GetElementsByInterface;
+ var Node = scope.wrappers.Node;
+ var ParentNodeInterface = scope.ParentNodeInterface;
+ var Selection = scope.wrappers.Selection;
+ var SelectorsInterface = scope.SelectorsInterface;
+ var ShadowRoot = scope.wrappers.ShadowRoot;
+ var TreeScope = scope.TreeScope;
+ var cloneNode = scope.cloneNode;
+ var defineWrapGetter = scope.defineWrapGetter;
+ var elementFromPoint = scope.elementFromPoint;
+ var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
+ var matchesNames = scope.matchesNames;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var renderAllPending = scope.renderAllPending;
+ var rewrap = scope.rewrap;
+ var setWrapper = scope.setWrapper;
+ var unsafeUnwrap = scope.unsafeUnwrap;
+ var unwrap = scope.unwrap;
+ var wrap = scope.wrap;
+ var wrapEventTargetMethods = scope.wrapEventTargetMethods;
+ var wrapNodeList = scope.wrapNodeList;
+ var implementationTable = new WeakMap();
+ function Document(node) {
+ Node.call(this, node);
+ this.treeScope_ = new TreeScope(this, null);
+ }
+ Document.prototype = Object.create(Node.prototype);
+ defineWrapGetter(Document, "documentElement");
+ defineWrapGetter(Document, "body");
+ defineWrapGetter(Document, "head");
+ function wrapMethod(name) {
+ var original = document[name];
+ Document.prototype[name] = function() {
+ return wrap(original.apply(unsafeUnwrap(this), arguments));
+ };
+ }
+ [ "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "getElementById" ].forEach(wrapMethod);
+ var originalAdoptNode = document.adoptNode;
+ function adoptNodeNoRemove(node, doc) {
+ originalAdoptNode.call(unsafeUnwrap(doc), unwrap(node));
+ adoptSubtree(node, doc);
+ }
+ function adoptSubtree(node, doc) {
+ if (node.shadowRoot) doc.adoptNode(node.shadowRoot);
+ if (node instanceof ShadowRoot) adoptOlderShadowRoots(node, doc);
+ for (var child = node.firstChild; child; child = child.nextSibling) {
+ adoptSubtree(child, doc);
+ }
+ }
+ function adoptOlderShadowRoots(shadowRoot, doc) {
+ var oldShadowRoot = shadowRoot.olderShadowRoot;
+ if (oldShadowRoot) doc.adoptNode(oldShadowRoot);
+ }
+ var originalGetSelection = document.getSelection;
+ mixin(Document.prototype, {
+ adoptNode: function(node) {
+ if (node.parentNode) node.parentNode.removeChild(node);
+ adoptNodeNoRemove(node, this);
+ return node;
+ },
+ elementFromPoint: function(x, y) {
+ return elementFromPoint(this, this, x, y);
+ },
+ importNode: function(node, deep) {
+ return cloneNode(node, deep, unsafeUnwrap(this));
+ },
+ getSelection: function() {
+ renderAllPending();
+ return new Selection(originalGetSelection.call(unwrap(this)));
+ },
+ getElementsByName: function(name) {
+ return SelectorsInterface.querySelectorAll.call(this, "[name=" + JSON.stringify(String(name)) + "]");
+ }
+ });
+ if (document.registerElement) {
+ var originalRegisterElement = document.registerElement;
+ Document.prototype.registerElement = function(tagName, object) {
+ var prototype, extendsOption;
+ if (object !== undefined) {
+ prototype = object.prototype;
+ extendsOption = object.extends;
+ }
+ if (!prototype) prototype = Object.create(HTMLElement.prototype);
+ if (scope.nativePrototypeTable.get(prototype)) {
+ throw new Error("NotSupportedError");
+ }
+ var proto = Object.getPrototypeOf(prototype);
+ var nativePrototype;
+ var prototypes = [];
+ while (proto) {
+ nativePrototype = scope.nativePrototypeTable.get(proto);
+ if (nativePrototype) break;
+ prototypes.push(proto);
+ proto = Object.getPrototypeOf(proto);
+ }
+ if (!nativePrototype) {
+ throw new Error("NotSupportedError");
+ }
+ var newPrototype = Object.create(nativePrototype);
+ for (var i = prototypes.length - 1; i >= 0; i--) {
+ newPrototype = Object.create(newPrototype);
+ }
+ [ "createdCallback", "attachedCallback", "detachedCallback", "attributeChangedCallback" ].forEach(function(name) {
+ var f = prototype[name];
+ if (!f) return;
+ newPrototype[name] = function() {
+ if (!(wrap(this) instanceof CustomElementConstructor)) {
+ rewrap(this);
+ }
+ f.apply(wrap(this), arguments);
+ };
+ });
+ var p = {
+ prototype: newPrototype
+ };
+ if (extendsOption) p.extends = extendsOption;
+ function CustomElementConstructor(node) {
+ if (!node) {
+ if (extendsOption) {
+ return document.createElement(extendsOption, tagName);
+ } else {
+ return document.createElement(tagName);
+ }
+ }
+ setWrapper(node, this);
+ }
+ CustomElementConstructor.prototype = prototype;
+ CustomElementConstructor.prototype.constructor = CustomElementConstructor;
+ scope.constructorTable.set(newPrototype, CustomElementConstructor);
+ scope.nativePrototypeTable.set(prototype, newPrototype);
+ var nativeConstructor = originalRegisterElement.call(unwrap(this), tagName, p);
+ return CustomElementConstructor;
+ };
+ forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "registerElement" ]);
+ }
+ forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement, window.HTMLHtmlElement ], [ "appendChild", "compareDocumentPosition", "contains", "getElementsByClassName", "getElementsByTagName", "getElementsByTagNameNS", "insertBefore", "querySelector", "querySelectorAll", "removeChild", "replaceChild" ].concat(matchesNames));
+ forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "adoptNode", "importNode", "contains", "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "elementFromPoint", "getElementById", "getElementsByName", "getSelection" ]);
+ mixin(Document.prototype, GetElementsByInterface);
+ mixin(Document.prototype, ParentNodeInterface);
+ mixin(Document.prototype, SelectorsInterface);
+ mixin(Document.prototype, {
+ get implementation() {
+ var implementation = implementationTable.get(this);
+ if (implementation) return implementation;
+ implementation = new DOMImplementation(unwrap(this).implementation);
+ implementationTable.set(this, implementation);
+ return implementation;
+ },
+ get defaultView() {
+ return wrap(unwrap(this).defaultView);
+ }
+ });
+ registerWrapper(window.Document, Document, document.implementation.createHTMLDocument(""));
+ if (window.HTMLDocument) registerWrapper(window.HTMLDocument, Document);
+ wrapEventTargetMethods([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement ]);
+ function DOMImplementation(impl) {
+ setWrapper(impl, this);
+ }
+ function wrapImplMethod(constructor, name) {
+ var original = document.implementation[name];
+ constructor.prototype[name] = function() {
+ return wrap(original.apply(unsafeUnwrap(this), arguments));
+ };
+ }
+ function forwardImplMethod(constructor, name) {
+ var original = document.implementation[name];
+ constructor.prototype[name] = function() {
+ return original.apply(unsafeUnwrap(this), arguments);
+ };
+ }
+ wrapImplMethod(DOMImplementation, "createDocumentType");
+ wrapImplMethod(DOMImplementation, "createDocument");
+ wrapImplMethod(DOMImplementation, "createHTMLDocument");
+ forwardImplMethod(DOMImplementation, "hasFeature");
+ registerWrapper(window.DOMImplementation, DOMImplementation);
+ forwardMethodsToWrapper([ window.DOMImplementation ], [ "createDocumentType", "createDocument", "createHTMLDocument", "hasFeature" ]);
+ scope.adoptNodeNoRemove = adoptNodeNoRemove;
+ scope.wrappers.DOMImplementation = DOMImplementation;
+ scope.wrappers.Document = Document;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var EventTarget = scope.wrappers.EventTarget;
+ var Selection = scope.wrappers.Selection;
+ var mixin = scope.mixin;
+ var registerWrapper = scope.registerWrapper;
+ var renderAllPending = scope.renderAllPending;
+ var unwrap = scope.unwrap;
+ var unwrapIfNeeded = scope.unwrapIfNeeded;
+ var wrap = scope.wrap;
+ var OriginalWindow = window.Window;
+ var originalGetComputedStyle = window.getComputedStyle;
+ var originalGetDefaultComputedStyle = window.getDefaultComputedStyle;
+ var originalGetSelection = window.getSelection;
+ function Window(impl) {
+ EventTarget.call(this, impl);
+ }
+ Window.prototype = Object.create(EventTarget.prototype);
+ OriginalWindow.prototype.getComputedStyle = function(el, pseudo) {
+ return wrap(this || window).getComputedStyle(unwrapIfNeeded(el), pseudo);
+ };
+ if (originalGetDefaultComputedStyle) {
+ OriginalWindow.prototype.getDefaultComputedStyle = function(el, pseudo) {
+ return wrap(this || window).getDefaultComputedStyle(unwrapIfNeeded(el), pseudo);
+ };
+ }
+ OriginalWindow.prototype.getSelection = function() {
+ return wrap(this || window).getSelection();
+ };
+ delete window.getComputedStyle;
+ delete window.getDefaultComputedStyle;
+ delete window.getSelection;
+ [ "addEventListener", "removeEventListener", "dispatchEvent" ].forEach(function(name) {
+ OriginalWindow.prototype[name] = function() {
+ var w = wrap(this || window);
+ return w[name].apply(w, arguments);
+ };
+ delete window[name];
+ });
+ mixin(Window.prototype, {
+ getComputedStyle: function(el, pseudo) {
+ renderAllPending();
+ return originalGetComputedStyle.call(unwrap(this), unwrapIfNeeded(el), pseudo);
+ },
+ getSelection: function() {
+ renderAllPending();
+ return new Selection(originalGetSelection.call(unwrap(this)));
+ },
+ get document() {
+ return wrap(unwrap(this).document);
+ }
+ });
+ if (originalGetDefaultComputedStyle) {
+ Window.prototype.getDefaultComputedStyle = function(el, pseudo) {
+ renderAllPending();
+ return originalGetDefaultComputedStyle.call(unwrap(this), unwrapIfNeeded(el), pseudo);
+ };
+ }
+ registerWrapper(OriginalWindow, Window, window);
+ scope.wrappers.Window = Window;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var unwrap = scope.unwrap;
+ var OriginalDataTransfer = window.DataTransfer || window.Clipboard;
+ var OriginalDataTransferSetDragImage = OriginalDataTransfer.prototype.setDragImage;
+ if (OriginalDataTransferSetDragImage) {
+ OriginalDataTransfer.prototype.setDragImage = function(image, x, y) {
+ OriginalDataTransferSetDragImage.call(this, unwrap(image), x, y);
+ };
+ }
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var registerWrapper = scope.registerWrapper;
+ var setWrapper = scope.setWrapper;
+ var unwrap = scope.unwrap;
+ var OriginalFormData = window.FormData;
+ if (!OriginalFormData) return;
+ function FormData(formElement) {
+ var impl;
+ if (formElement instanceof OriginalFormData) {
+ impl = formElement;
+ } else {
+ impl = new OriginalFormData(formElement && unwrap(formElement));
+ }
+ setWrapper(impl, this);
+ }
+ registerWrapper(OriginalFormData, FormData, new OriginalFormData());
+ scope.wrappers.FormData = FormData;
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var unwrapIfNeeded = scope.unwrapIfNeeded;
+ var originalSend = XMLHttpRequest.prototype.send;
+ XMLHttpRequest.prototype.send = function(obj) {
+ return originalSend.call(this, unwrapIfNeeded(obj));
+ };
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ "use strict";
+ var isWrapperFor = scope.isWrapperFor;
+ var elements = {
+ a: "HTMLAnchorElement",
+ area: "HTMLAreaElement",
+ audio: "HTMLAudioElement",
+ base: "HTMLBaseElement",
+ body: "HTMLBodyElement",
+ br: "HTMLBRElement",
+ button: "HTMLButtonElement",
+ canvas: "HTMLCanvasElement",
+ caption: "HTMLTableCaptionElement",
+ col: "HTMLTableColElement",
+ content: "HTMLContentElement",
+ data: "HTMLDataElement",
+ datalist: "HTMLDataListElement",
+ del: "HTMLModElement",
+ dir: "HTMLDirectoryElement",
+ div: "HTMLDivElement",
+ dl: "HTMLDListElement",
+ embed: "HTMLEmbedElement",
+ fieldset: "HTMLFieldSetElement",
+ font: "HTMLFontElement",
+ form: "HTMLFormElement",
+ frame: "HTMLFrameElement",
+ frameset: "HTMLFrameSetElement",
+ h1: "HTMLHeadingElement",
+ head: "HTMLHeadElement",
+ hr: "HTMLHRElement",
+ html: "HTMLHtmlElement",
+ iframe: "HTMLIFrameElement",
+ img: "HTMLImageElement",
+ input: "HTMLInputElement",
+ keygen: "HTMLKeygenElement",
+ label: "HTMLLabelElement",
+ legend: "HTMLLegendElement",
+ li: "HTMLLIElement",
+ link: "HTMLLinkElement",
+ map: "HTMLMapElement",
+ marquee: "HTMLMarqueeElement",
+ menu: "HTMLMenuElement",
+ menuitem: "HTMLMenuItemElement",
+ meta: "HTMLMetaElement",
+ meter: "HTMLMeterElement",
+ object: "HTMLObjectElement",
+ ol: "HTMLOListElement",
+ optgroup: "HTMLOptGroupElement",
+ option: "HTMLOptionElement",
+ output: "HTMLOutputElement",
+ p: "HTMLParagraphElement",
+ param: "HTMLParamElement",
+ pre: "HTMLPreElement",
+ progress: "HTMLProgressElement",
+ q: "HTMLQuoteElement",
+ script: "HTMLScriptElement",
+ select: "HTMLSelectElement",
+ shadow: "HTMLShadowElement",
+ source: "HTMLSourceElement",
+ span: "HTMLSpanElement",
+ style: "HTMLStyleElement",
+ table: "HTMLTableElement",
+ tbody: "HTMLTableSectionElement",
+ template: "HTMLTemplateElement",
+ textarea: "HTMLTextAreaElement",
+ thead: "HTMLTableSectionElement",
+ time: "HTMLTimeElement",
+ title: "HTMLTitleElement",
+ tr: "HTMLTableRowElement",
+ track: "HTMLTrackElement",
+ ul: "HTMLUListElement",
+ video: "HTMLVideoElement"
+ };
+ function overrideConstructor(tagName) {
+ var nativeConstructorName = elements[tagName];
+ var nativeConstructor = window[nativeConstructorName];
+ if (!nativeConstructor) return;
+ var element = document.createElement(tagName);
+ var wrapperConstructor = element.constructor;
+ window[nativeConstructorName] = wrapperConstructor;
+ }
+ Object.keys(elements).forEach(overrideConstructor);
+ Object.getOwnPropertyNames(scope.wrappers).forEach(function(name) {
+ window[name] = scope.wrappers[name];
+ });
+ })(window.ShadowDOMPolyfill);
+ (function(scope) {
+ var ShadowCSS = {
+ strictStyling: false,
+ registry: {},
+ shimStyling: function(root, name, extendsName) {
+ var scopeStyles = this.prepareRoot(root, name, extendsName);
+ var typeExtension = this.isTypeExtension(extendsName);
+ var scopeSelector = this.makeScopeSelector(name, typeExtension);
+ var cssText = stylesToCssText(scopeStyles, true);
+ cssText = this.scopeCssText(cssText, scopeSelector);
+ if (root) {
+ root.shimmedStyle = cssText;
+ }
+ this.addCssToDocument(cssText, name);
+ },
+ shimStyle: function(style, selector) {
+ return this.shimCssText(style.textContent, selector);
+ },
+ shimCssText: function(cssText, selector) {
+ cssText = this.insertDirectives(cssText);
+ return this.scopeCssText(cssText, selector);
+ },
+ makeScopeSelector: function(name, typeExtension) {
+ if (name) {
+ return typeExtension ? "[is=" + name + "]" : name;
+ }
+ return "";
+ },
+ isTypeExtension: function(extendsName) {
+ return extendsName && extendsName.indexOf("-") < 0;
+ },
+ prepareRoot: function(root, name, extendsName) {
+ var def = this.registerRoot(root, name, extendsName);
+ this.replaceTextInStyles(def.rootStyles, this.insertDirectives);
+ this.removeStyles(root, def.rootStyles);
+ if (this.strictStyling) {
+ this.applyScopeToContent(root, name);
+ }
+ return def.scopeStyles;
+ },
+ removeStyles: function(root, styles) {
+ for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
+ s.parentNode.removeChild(s);
+ }
+ },
+ registerRoot: function(root, name, extendsName) {
+ var def = this.registry[name] = {
+ root: root,
+ name: name,
+ extendsName: extendsName
+ };
+ var styles = this.findStyles(root);
+ def.rootStyles = styles;
+ def.scopeStyles = def.rootStyles;
+ var extendee = this.registry[def.extendsName];
+ if (extendee) {
+ def.scopeStyles = extendee.scopeStyles.concat(def.scopeStyles);
+ }
+ return def;
+ },
+ findStyles: function(root) {
+ if (!root) {
+ return [];
+ }
+ var styles = root.querySelectorAll("style");
+ return Array.prototype.filter.call(styles, function(s) {
+ return !s.hasAttribute(NO_SHIM_ATTRIBUTE);
+ });
+ },
+ applyScopeToContent: function(root, name) {
+ if (root) {
+ Array.prototype.forEach.call(root.querySelectorAll("*"), function(node) {
+ node.setAttribute(name, "");
+ });
+ Array.prototype.forEach.call(root.querySelectorAll("template"), function(template) {
+ this.applyScopeToContent(template.content, name);
+ }, this);
+ }
+ },
+ insertDirectives: function(cssText) {
+ cssText = this.insertPolyfillDirectivesInCssText(cssText);
+ return this.insertPolyfillRulesInCssText(cssText);
+ },
+ insertPolyfillDirectivesInCssText: function(cssText) {
+ cssText = cssText.replace(cssCommentNextSelectorRe, function(match, p1) {
+ return p1.slice(0, -2) + "{";
+ });
+ return cssText.replace(cssContentNextSelectorRe, function(match, p1) {
+ return p1 + " {";
+ });
+ },
+ insertPolyfillRulesInCssText: function(cssText) {
+ cssText = cssText.replace(cssCommentRuleRe, function(match, p1) {
+ return p1.slice(0, -1);
+ });
+ return cssText.replace(cssContentRuleRe, function(match, p1, p2, p3) {
+ var rule = match.replace(p1, "").replace(p2, "");
+ return p3 + rule;
+ });
+ },
+ scopeCssText: function(cssText, scopeSelector) {
+ var unscoped = this.extractUnscopedRulesFromCssText(cssText);
+ cssText = this.insertPolyfillHostInCssText(cssText);
+ cssText = this.convertColonHost(cssText);
+ cssText = this.convertColonHostContext(cssText);
+ cssText = this.convertShadowDOMSelectors(cssText);
+ if (scopeSelector) {
+ var self = this, cssText;
+ withCssRules(cssText, function(rules) {
+ cssText = self.scopeRules(rules, scopeSelector);
+ });
+ }
+ cssText = cssText + "\n" + unscoped;
+ return cssText.trim();
+ },
+ extractUnscopedRulesFromCssText: function(cssText) {
+ var r = "", m;
+ while (m = cssCommentUnscopedRuleRe.exec(cssText)) {
+ r += m[1].slice(0, -1) + "\n\n";
+ }
+ while (m = cssContentUnscopedRuleRe.exec(cssText)) {
+ r += m[0].replace(m[2], "").replace(m[1], m[3]) + "\n\n";
+ }
+ return r;
+ },
+ convertColonHost: function(cssText) {
+ return this.convertColonRule(cssText, cssColonHostRe, this.colonHostPartReplacer);
+ },
+ convertColonHostContext: function(cssText) {
+ return this.convertColonRule(cssText, cssColonHostContextRe, this.colonHostContextPartReplacer);
+ },
+ convertColonRule: function(cssText, regExp, partReplacer) {
+ return cssText.replace(regExp, function(m, p1, p2, p3) {
+ p1 = polyfillHostNoCombinator;
+ if (p2) {
+ var parts = p2.split(","), r = [];
+ for (var i = 0, l = parts.length, p; i < l && (p = parts[i]); i++) {
+ p = p.trim();
+ r.push(partReplacer(p1, p, p3));
+ }
+ return r.join(",");
+ } else {
+ return p1 + p3;
+ }
+ });
+ },
+ colonHostContextPartReplacer: function(host, part, suffix) {
+ if (part.match(polyfillHost)) {
+ return this.colonHostPartReplacer(host, part, suffix);
+ } else {
+ return host + part + suffix + ", " + part + " " + host + suffix;
+ }
+ },
+ colonHostPartReplacer: function(host, part, suffix) {
+ return host + part.replace(polyfillHost, "") + suffix;
+ },
+ convertShadowDOMSelectors: function(cssText) {
+ for (var i = 0; i < shadowDOMSelectorsRe.length; i++) {
+ cssText = cssText.replace(shadowDOMSelectorsRe[i], " ");
+ }
+ return cssText;
+ },
+ scopeRules: function(cssRules, scopeSelector) {
+ var cssText = "";
+ if (cssRules) {
+ Array.prototype.forEach.call(cssRules, function(rule) {
+ if (rule.selectorText && (rule.style && rule.style.cssText !== undefined)) {
+ cssText += this.scopeSelector(rule.selectorText, scopeSelector, this.strictStyling) + " {\n ";
+ cssText += this.propertiesFromRule(rule) + "\n}\n\n";
+ } else if (rule.type === CSSRule.MEDIA_RULE) {
+ cssText += "@media " + rule.media.mediaText + " {\n";
+ cssText += this.scopeRules(rule.cssRules, scopeSelector);
+ cssText += "\n}\n\n";
+ } else {
+ try {
+ if (rule.cssText) {
+ cssText += rule.cssText + "\n\n";
+ }
+ } catch (x) {
+ if (rule.type === CSSRule.KEYFRAMES_RULE && rule.cssRules) {
+ cssText += this.ieSafeCssTextFromKeyFrameRule(rule);
+ }
+ }
+ }
+ }, this);
+ }
+ return cssText;
+ },
+ ieSafeCssTextFromKeyFrameRule: function(rule) {
+ var cssText = "@keyframes " + rule.name + " {";
+ Array.prototype.forEach.call(rule.cssRules, function(rule) {
+ cssText += " " + rule.keyText + " {" + rule.style.cssText + "}";
+ });
+ cssText += " }";
+ return cssText;
+ },
+ scopeSelector: function(selector, scopeSelector, strict) {
+ var r = [], parts = selector.split(",");
+ parts.forEach(function(p) {
+ p = p.trim();
+ if (this.selectorNeedsScoping(p, scopeSelector)) {
+ p = strict && !p.match(polyfillHostNoCombinator) ? this.applyStrictSelectorScope(p, scopeSelector) : this.applySelectorScope(p, scopeSelector);
+ }
+ r.push(p);
+ }, this);
+ return r.join(", ");
+ },
+ selectorNeedsScoping: function(selector, scopeSelector) {
+ if (Array.isArray(scopeSelector)) {
+ return true;
+ }
+ var re = this.makeScopeMatcher(scopeSelector);
+ return !selector.match(re);
+ },
+ makeScopeMatcher: function(scopeSelector) {
+ scopeSelector = scopeSelector.replace(/\[/g, "\\[").replace(/\[/g, "\\]");
+ return new RegExp("^(" + scopeSelector + ")" + selectorReSuffix, "m");
+ },
+ applySelectorScope: function(selector, selectorScope) {
+ return Array.isArray(selectorScope) ? this.applySelectorScopeList(selector, selectorScope) : this.applySimpleSelectorScope(selector, selectorScope);
+ },
+ applySelectorScopeList: function(selector, scopeSelectorList) {
+ var r = [];
+ for (var i = 0, s; s = scopeSelectorList[i]; i++) {
+ r.push(this.applySimpleSelectorScope(selector, s));
+ }
+ return r.join(", ");
+ },
+ applySimpleSelectorScope: function(selector, scopeSelector) {
+ if (selector.match(polyfillHostRe)) {
+ selector = selector.replace(polyfillHostNoCombinator, scopeSelector);
+ return selector.replace(polyfillHostRe, scopeSelector + " ");
+ } else {
+ return scopeSelector + " " + selector;
+ }
+ },
+ applyStrictSelectorScope: function(selector, scopeSelector) {
+ scopeSelector = scopeSelector.replace(/\[is=([^\]]*)\]/g, "$1");
+ var splits = [ " ", ">", "+", "~" ], scoped = selector, attrName = "[" + scopeSelector + "]";
+ splits.forEach(function(sep) {
+ var parts = scoped.split(sep);
+ scoped = parts.map(function(p) {
+ var t = p.trim().replace(polyfillHostRe, "");
+ if (t && splits.indexOf(t) < 0 && t.indexOf(attrName) < 0) {
+ p = t.replace(/([^:]*)(:*)(.*)/, "$1" + attrName + "$2$3");
+ }
+ return p;
+ }).join(sep);
+ });
+ return scoped;
+ },
+ insertPolyfillHostInCssText: function(selector) {
+ return selector.replace(colonHostContextRe, polyfillHostContext).replace(colonHostRe, polyfillHost);
+ },
+ propertiesFromRule: function(rule) {
+ var cssText = rule.style.cssText;
+ if (rule.style.content && !rule.style.content.match(/['"]+|attr/)) {
+ cssText = cssText.replace(/content:[^;]*;/g, "content: '" + rule.style.content + "';");
+ }
+ var style = rule.style;
+ for (var i in style) {
+ if (style[i] === "initial") {
+ cssText += i + ": initial; ";
+ }
+ }
+ return cssText;
+ },
+ replaceTextInStyles: function(styles, action) {
+ if (styles && action) {
+ if (!(styles instanceof Array)) {
+ styles = [ styles ];
+ }
+ Array.prototype.forEach.call(styles, function(s) {
+ s.textContent = action.call(this, s.textContent);
+ }, this);
+ }
+ },
+ addCssToDocument: function(cssText, name) {
+ if (cssText.match("@import")) {
+ addOwnSheet(cssText, name);
+ } else {
+ addCssToDocument(cssText);
+ }
+ }
+ };
+ var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s@polyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/gim, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext", parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)";
+ var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cssColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim"), selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, colonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost + "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHostContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ /\^\^/g, /\^/g, /\/shadow\//g, /\/shadow-deep\//g, /::shadow/g, /\/deep\//g, /::content/g ];
+ function stylesToCssText(styles, preserveComments) {
+ var cssText = "";
+ Array.prototype.forEach.call(styles, function(s) {
+ cssText += s.textContent + "\n\n";
+ });
+ if (!preserveComments) {
+ cssText = cssText.replace(cssCommentRe, "");
+ }
+ return cssText;
+ }
+ function cssTextToStyle(cssText) {
+ var style = document.createElement("style");
+ style.textContent = cssText;
+ return style;
+ }
+ function cssToRules(cssText) {
+ var style = cssTextToStyle(cssText);
+ document.head.appendChild(style);
+ var rules = [];
+ if (style.sheet) {
+ try {
+ rules = style.sheet.cssRules;
+ } catch (e) {}
+ } else {
+ console.warn("sheet not found", style);
+ }
+ style.parentNode.removeChild(style);
+ return rules;
+ }
+ var frame = document.createElement("iframe");
+ frame.style.display = "none";
+ function initFrame() {
+ frame.initialized = true;
+ document.body.appendChild(frame);
+ var doc = frame.contentDocument;
+ var base = doc.createElement("base");
+ base.href = document.baseURI;
+ doc.head.appendChild(base);
+ }
+ function inFrame(fn) {
+ if (!frame.initialized) {
+ initFrame();
+ }
+ document.body.appendChild(frame);
+ fn(frame.contentDocument);
+ document.body.removeChild(frame);
+ }
+ var isChrome = navigator.userAgent.match("Chrome");
+ function withCssRules(cssText, callback) {
+ if (!callback) {
+ return;
+ }
+ var rules;
+ if (cssText.match("@import") && isChrome) {
+ var style = cssTextToStyle(cssText);
+ inFrame(function(doc) {
+ doc.head.appendChild(style.impl);
+ rules = Array.prototype.slice.call(style.sheet.cssRules, 0);
+ callback(rules);
+ });
+ } else {
+ rules = cssToRules(cssText);
+ callback(rules);
+ }
+ }
+ function rulesToCss(cssRules) {
+ for (var i = 0, css = []; i < cssRules.length; i++) {
+ css.push(cssRules[i].cssText);
+ }
+ return css.join("\n\n");
+ }
+ function addCssToDocument(cssText) {
+ if (cssText) {
+ getSheet().appendChild(document.createTextNode(cssText));
+ }
+ }
+ function addOwnSheet(cssText, name) {
+ var style = cssTextToStyle(cssText);
+ style.setAttribute(name, "");
+ style.setAttribute(SHIMMED_ATTRIBUTE, "");
+ document.head.appendChild(style);
+ }
+ var SHIM_ATTRIBUTE = "shim-shadowdom";
+ var SHIMMED_ATTRIBUTE = "shim-shadowdom-css";
+ var NO_SHIM_ATTRIBUTE = "no-shim";
+ var sheet;
+ function getSheet() {
+ if (!sheet) {
+ sheet = document.createElement("style");
+ sheet.setAttribute(SHIMMED_ATTRIBUTE, "");
+ sheet[SHIMMED_ATTRIBUTE] = true;
+ }
+ return sheet;
+ }
+ if (window.ShadowDOMPolyfill) {
+ addCssToDocument("style { display: none !important; }\n");
+ var doc = ShadowDOMPolyfill.wrap(document);
+ var head = doc.querySelector("head");
+ head.insertBefore(getSheet(), head.childNodes[0]);
+ document.addEventListener("DOMContentLoaded", function() {
+ var urlResolver = scope.urlResolver;
+ if (window.HTMLImports && !HTMLImports.useNative) {
+ var SHIM_SHEET_SELECTOR = "link[rel=stylesheet]" + "[" + SHIM_ATTRIBUTE + "]";
+ var SHIM_STYLE_SELECTOR = "style[" + SHIM_ATTRIBUTE + "]";
+ HTMLImports.importer.documentPreloadSelectors += "," + SHIM_SHEET_SELECTOR;
+ HTMLImports.importer.importsPreloadSelectors += "," + SHIM_SHEET_SELECTOR;
+ HTMLImports.parser.documentSelectors = [ HTMLImports.parser.documentSelectors, SHIM_SHEET_SELECTOR, SHIM_STYLE_SELECTOR ].join(",");
+ var originalParseGeneric = HTMLImports.parser.parseGeneric;
+ HTMLImports.parser.parseGeneric = function(elt) {
+ if (elt[SHIMMED_ATTRIBUTE]) {
+ return;
+ }
+ var style = elt.__importElement || elt;
+ if (!style.hasAttribute(SHIM_ATTRIBUTE)) {
+ originalParseGeneric.call(this, elt);
+ return;
+ }
+ if (elt.__resource) {
+ style = elt.ownerDocument.createElement("style");
+ style.textContent = elt.__resource;
+ }
+ HTMLImports.path.resolveUrlsInStyle(style);
+ style.textContent = ShadowCSS.shimStyle(style);
+ style.removeAttribute(SHIM_ATTRIBUTE, "");
+ style.setAttribute(SHIMMED_ATTRIBUTE, "");
+ style[SHIMMED_ATTRIBUTE] = true;
+ if (style.parentNode !== head) {
+ if (elt.parentNode === head) {
+ head.replaceChild(style, elt);
+ } else {
+ this.addElementToDocument(style);
+ }
+ }
+ style.__importParsed = true;
+ this.markParsingComplete(elt);
+ this.parseNext();
+ };
+ var hasResource = HTMLImports.parser.hasResource;
+ HTMLImports.parser.hasResource = function(node) {
+ if (node.localName === "link" && node.rel === "stylesheet" && node.hasAttribute(SHIM_ATTRIBUTE)) {
+ return node.__resource;
+ } else {
+ return hasResource.call(this, node);
+ }
+ };
+ }
+ });
+ }
+ scope.ShadowCSS = ShadowCSS;
+ })(window.WebComponents);
+}
+
+(function(scope) {
+ if (window.ShadowDOMPolyfill) {
+ window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
+ window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
+ } else {
+ window.wrap = window.unwrap = function(n) {
+ return n;
+ };
+ }
+})(window.WebComponents);
+
+(function(global) {
+ var registrationsTable = new WeakMap();
+ var setImmediate;
+ if (/Trident/.test(navigator.userAgent)) {
+ setImmediate = setTimeout;
+ } else if (window.setImmediate) {
+ setImmediate = window.setImmediate;
+ } else {
+ var setImmediateQueue = [];
+ var sentinel = String(Math.random());
+ window.addEventListener("message", function(e) {
+ if (e.data === sentinel) {
+ var queue = setImmediateQueue;
+ setImmediateQueue = [];
+ queue.forEach(function(func) {
+ func();
+ });
+ }
+ });
+ setImmediate = function(func) {
+ setImmediateQueue.push(func);
+ window.postMessage(sentinel, "*");
+ };
+ }
+ var isScheduled = false;
+ var scheduledObservers = [];
+ function scheduleCallback(observer) {
+ scheduledObservers.push(observer);
+ if (!isScheduled) {
+ isScheduled = true;
+ setImmediate(dispatchCallbacks);
+ }
+ }
+ function wrapIfNeeded(node) {
+ return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
+ }
+ function dispatchCallbacks() {
+ isScheduled = false;
+ var observers = scheduledObservers;
+ scheduledObservers = [];
+ observers.sort(function(o1, o2) {
+ return o1.uid_ - o2.uid_;
+ });
+ var anyNonEmpty = false;
+ observers.forEach(function(observer) {
+ var queue = observer.takeRecords();
+ removeTransientObserversFor(observer);
+ if (queue.length) {
+ observer.callback_(queue, observer);
+ anyNonEmpty = true;
+ }
+ });
+ if (anyNonEmpty) dispatchCallbacks();
+ }
+ function removeTransientObserversFor(observer) {
+ observer.nodes_.forEach(function(node) {
+ var registrations = registrationsTable.get(node);
+ if (!registrations) return;
+ registrations.forEach(function(registration) {
+ if (registration.observer === observer) registration.removeTransientObservers();
+ });
+ });
+ }
+ function forEachAncestorAndObserverEnqueueRecord(target, callback) {
+ for (var node = target; node; node = node.parentNode) {
+ var registrations = registrationsTable.get(node);
+ if (registrations) {
+ for (var j = 0; j < registrations.length; j++) {
+ var registration = registrations[j];
+ var options = registration.options;
+ if (node !== target && !options.subtree) continue;
+ var record = callback(options);
+ if (record) registration.enqueue(record);
+ }
+ }
+ }
+ }
+ var uidCounter = 0;
+ function JsMutationObserver(callback) {
+ this.callback_ = callback;
+ this.nodes_ = [];
+ this.records_ = [];
+ this.uid_ = ++uidCounter;
+ }
+ JsMutationObserver.prototype = {
+ observe: function(target, options) {
+ target = wrapIfNeeded(target);
+ if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
+ throw new SyntaxError();
+ }
+ var registrations = registrationsTable.get(target);
+ if (!registrations) registrationsTable.set(target, registrations = []);
+ var registration;
+ for (var i = 0; i < registrations.length; i++) {
+ if (registrations[i].observer === this) {
+ registration = registrations[i];
+ registration.removeListeners();
+ registration.options = options;
+ break;
+ }
+ }
+ if (!registration) {
+ registration = new Registration(this, target, options);
+ registrations.push(registration);
+ this.nodes_.push(target);
+ }
+ registration.addListeners();
+ },
+ disconnect: function() {
+ this.nodes_.forEach(function(node) {
+ var registrations = registrationsTable.get(node);
+ for (var i = 0; i < registrations.length; i++) {
+ var registration = registrations[i];
+ if (registration.observer === this) {
+ registration.removeListeners();
+ registrations.splice(i, 1);
+ break;
+ }
+ }
+ }, this);
+ this.records_ = [];
+ },
+ takeRecords: function() {
+ var copyOfRecords = this.records_;
+ this.records_ = [];
+ return copyOfRecords;
+ }
+ };
+ function MutationRecord(type, target) {
+ this.type = type;
+ this.target = target;
+ this.addedNodes = [];
+ this.removedNodes = [];
+ this.previousSibling = null;
+ this.nextSibling = null;
+ this.attributeName = null;
+ this.attributeNamespace = null;
+ this.oldValue = null;
+ }
+ function copyMutationRecord(original) {
+ var record = new MutationRecord(original.type, original.target);
+ record.addedNodes = original.addedNodes.slice();
+ record.removedNodes = original.removedNodes.slice();
+ record.previousSibling = original.previousSibling;
+ record.nextSibling = original.nextSibling;
+ record.attributeName = original.attributeName;
+ record.attributeNamespace = original.attributeNamespace;
+ record.oldValue = original.oldValue;
+ return record;
+ }
+ var currentRecord, recordWithOldValue;
+ function getRecord(type, target) {
+ return currentRecord = new MutationRecord(type, target);
+ }
+ function getRecordWithOldValue(oldValue) {
+ if (recordWithOldValue) return recordWithOldValue;
+ recordWithOldValue = copyMutationRecord(currentRecord);
+ recordWithOldValue.oldValue = oldValue;
+ return recordWithOldValue;
+ }
+ function clearRecords() {
+ currentRecord = recordWithOldValue = undefined;
+ }
+ function recordRepresentsCurrentMutation(record) {
+ return record === recordWithOldValue || record === currentRecord;
+ }
+ function selectRecord(lastRecord, newRecord) {
+ if (lastRecord === newRecord) return lastRecord;
+ if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
+ return null;
+ }
+ function Registration(observer, target, options) {
+ this.observer = observer;
+ this.target = target;
+ this.options = options;
+ this.transientObservedNodes = [];
+ }
+ Registration.prototype = {
+ enqueue: function(record) {
+ var records = this.observer.records_;
+ var length = records.length;
+ if (records.length > 0) {
+ var lastRecord = records[length - 1];
+ var recordToReplaceLast = selectRecord(lastRecord, record);
+ if (recordToReplaceLast) {
+ records[length - 1] = recordToReplaceLast;
+ return;
+ }
+ } else {
+ scheduleCallback(this.observer);
+ }
+ records[length] = record;
+ },
+ addListeners: function() {
+ this.addListeners_(this.target);
+ },
+ addListeners_: function(node) {
+ var options = this.options;
+ if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
+ if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
+ if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
+ if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
+ },
+ removeListeners: function() {
+ this.removeListeners_(this.target);
+ },
+ removeListeners_: function(node) {
+ var options = this.options;
+ if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
+ if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
+ if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
+ if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
+ },
+ addTransientObserver: function(node) {
+ if (node === this.target) return;
+ this.addListeners_(node);
+ this.transientObservedNodes.push(node);
+ var registrations = registrationsTable.get(node);
+ if (!registrations) registrationsTable.set(node, registrations = []);
+ registrations.push(this);
+ },
+ removeTransientObservers: function() {
+ var transientObservedNodes = this.transientObservedNodes;
+ this.transientObservedNodes = [];
+ transientObservedNodes.forEach(function(node) {
+ this.removeListeners_(node);
+ var registrations = registrationsTable.get(node);
+ for (var i = 0; i < registrations.length; i++) {
+ if (registrations[i] === this) {
+ registrations.splice(i, 1);
+ break;
+ }
+ }
+ }, this);
+ },
+ handleEvent: function(e) {
+ e.stopImmediatePropagation();
+ switch (e.type) {
+ case "DOMAttrModified":
+ var name = e.attrName;
+ var namespace = e.relatedNode.namespaceURI;
+ var target = e.target;
+ var record = new getRecord("attributes", target);
+ record.attributeName = name;
+ record.attributeNamespace = namespace;
+ var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
+ if (!options.attributes) return;
+ if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
+ return;
+ }
+ if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
+ return record;
+ });
+ break;
+
+ case "DOMCharacterDataModified":
+ var target = e.target;
+ var record = getRecord("characterData", target);
+ var oldValue = e.prevValue;
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
+ if (!options.characterData) return;
+ if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
+ return record;
+ });
+ break;
+
+ case "DOMNodeRemoved":
+ this.addTransientObserver(e.target);
+
+ case "DOMNodeInserted":
+ var target = e.relatedNode;
+ var changedNode = e.target;
+ var addedNodes, removedNodes;
+ if (e.type === "DOMNodeInserted") {
+ addedNodes = [ changedNode ];
+ removedNodes = [];
+ } else {
+ addedNodes = [];
+ removedNodes = [ changedNode ];
+ }
+ var previousSibling = changedNode.previousSibling;
+ var nextSibling = changedNode.nextSibling;
+ var record = getRecord("childList", target);
+ record.addedNodes = addedNodes;
+ record.removedNodes = removedNodes;
+ record.previousSibling = previousSibling;
+ record.nextSibling = nextSibling;
+ forEachAncestorAndObserverEnqueueRecord(target, function(options) {
+ if (!options.childList) return;
+ return record;
+ });
+ }
+ clearRecords();
+ }
+ };
+ global.JsMutationObserver = JsMutationObserver;
+ if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
+})(this);
+
+window.HTMLImports = window.HTMLImports || {
+ flags: {}
+};
+
+(function(scope) {
+ var IMPORT_LINK_TYPE = "import";
+ var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
+ var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
+ var wrap = function(node) {
+ return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
+ };
+ var rootDocument = wrap(document);
+ var currentScriptDescriptor = {
+ get: function() {
+ var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
+ return wrap(script);
+ },
+ configurable: true
+ };
+ Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
+ Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
+ var isIE = /Trident/.test(navigator.userAgent);
+ function whenReady(callback, doc) {
+ doc = doc || rootDocument;
+ whenDocumentReady(function() {
+ watchImportsLoad(callback, doc);
+ }, doc);
+ }
+ var requiredReadyState = isIE ? "complete" : "interactive";
+ var READY_EVENT = "readystatechange";
+ function isDocumentReady(doc) {
+ return doc.readyState === "complete" || doc.readyState === requiredReadyState;
+ }
+ function whenDocumentReady(callback, doc) {
+ if (!isDocumentReady(doc)) {
+ var checkReady = function() {
+ if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
+ doc.removeEventListener(READY_EVENT, checkReady);
+ whenDocumentReady(callback, doc);
+ }
+ };
+ doc.addEventListener(READY_EVENT, checkReady);
+ } else if (callback) {
+ callback();
+ }
+ }
+ function markTargetLoaded(event) {
+ event.target.__loaded = true;
+ }
+ function watchImportsLoad(callback, doc) {
+ var imports = doc.querySelectorAll("link[rel=import]");
+ var loaded = 0, l = imports.length;
+ function checkDone(d) {
+ if (loaded == l && callback) {
+ callback();
+ }
+ }
+ function loadedImport(e) {
+ markTargetLoaded(e);
+ loaded++;
+ checkDone();
+ }
+ if (l) {
+ for (var i = 0, imp; i < l && (imp = imports[i]); i++) {
+ if (isImportLoaded(imp)) {
+ loadedImport.call(imp, {
+ target: imp
+ });
+ } else {
+ imp.addEventListener("load", loadedImport);
+ imp.addEventListener("error", loadedImport);
+ }
+ }
+ } else {
+ checkDone();
+ }
+ }
+ function isImportLoaded(link) {
+ return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
+ }
+ if (useNative) {
+ new MutationObserver(function(mxns) {
+ for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
+ if (m.addedNodes) {
+ handleImports(m.addedNodes);
+ }
+ }
+ }).observe(document.head, {
+ childList: true
+ });
+ function handleImports(nodes) {
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
+ if (isImport(n)) {
+ handleImport(n);
+ }
+ }
+ }
+ function isImport(element) {
+ return element.localName === "link" && element.rel === "import";
+ }
+ function handleImport(element) {
+ var loaded = element.import;
+ if (loaded) {
+ markTargetLoaded({
+ target: element
+ });
+ } else {
+ element.addEventListener("load", markTargetLoaded);
+ element.addEventListener("error", markTargetLoaded);
+ }
+ }
+ (function() {
+ if (document.readyState === "loading") {
+ var imports = document.querySelectorAll("link[rel=import]");
+ for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
+ handleImport(imp);
+ }
+ }
+ })();
+ }
+ whenReady(function() {
+ HTMLImports.ready = true;
+ HTMLImports.readyTime = new Date().getTime();
+ rootDocument.dispatchEvent(new CustomEvent("HTMLImportsLoaded", {
+ bubbles: true
+ }));
+ });
+ scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
+ scope.useNative = useNative;
+ scope.rootDocument = rootDocument;
+ scope.whenReady = whenReady;
+ scope.isIE = isIE;
+})(HTMLImports);
+
+(function(scope) {
+ var modules = [];
+ var addModule = function(module) {
+ modules.push(module);
+ };
+ var initializeModules = function() {
+ modules.forEach(function(module) {
+ module(scope);
+ });
+ };
+ scope.addModule = addModule;
+ scope.initializeModules = initializeModules;
+})(HTMLImports);
+
+HTMLImports.addModule(function(scope) {
+ var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
+ var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
+ var path = {
+ resolveUrlsInStyle: function(style) {
+ var doc = style.ownerDocument;
+ var resolver = doc.createElement("a");
+ style.textContent = this.resolveUrlsInCssText(style.textContent, resolver);
+ return style;
+ },
+ resolveUrlsInCssText: function(cssText, urlObj) {
+ var r = this.replaceUrls(cssText, urlObj, CSS_URL_REGEXP);
+ r = this.replaceUrls(r, urlObj, CSS_IMPORT_REGEXP);
+ return r;
+ },
+ replaceUrls: function(text, urlObj, regexp) {
+ return text.replace(regexp, function(m, pre, url, post) {
+ var urlPath = url.replace(/["']/g, "");
+ urlObj.href = urlPath;
+ urlPath = urlObj.href;
+ return pre + "'" + urlPath + "'" + post;
+ });
+ }
+ };
+ scope.path = path;
+});
+
+HTMLImports.addModule(function(scope) {
+ xhr = {
+ async: true,
+ ok: function(request) {
+ return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
+ },
+ load: function(url, next, nextContext) {
+ var request = new XMLHttpRequest();
+ if (scope.flags.debug || scope.flags.bust) {
+ url += "?" + Math.random();
+ }
+ request.open("GET", url, xhr.async);
+ request.addEventListener("readystatechange", function(e) {
+ if (request.readyState === 4) {
+ var locationHeader = request.getResponseHeader("Location");
+ var redirectedUrl = null;
+ if (locationHeader) {
+ var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
+ }
+ next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
+ }
+ });
+ request.send();
+ return request;
+ },
+ loadDocument: function(url, next, nextContext) {
+ this.load(url, next, nextContext).responseType = "document";
+ }
+ };
+ scope.xhr = xhr;
+});
+
+HTMLImports.addModule(function(scope) {
+ var xhr = scope.xhr;
+ var flags = scope.flags;
+ var Loader = function(onLoad, onComplete) {
+ this.cache = {};
+ this.onload = onLoad;
+ this.oncomplete = onComplete;
+ this.inflight = 0;
+ this.pending = {};
+ };
+ Loader.prototype = {
+ addNodes: function(nodes) {
+ this.inflight += nodes.length;
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
+ this.require(n);
+ }
+ this.checkDone();
+ },
+ addNode: function(node) {
+ this.inflight++;
+ this.require(node);
+ this.checkDone();
+ },
+ require: function(elt) {
+ var url = elt.src || elt.href;
+ elt.__nodeUrl = url;
+ if (!this.dedupe(url, elt)) {
+ this.fetch(url, elt);
+ }
+ },
+ dedupe: function(url, elt) {
+ if (this.pending[url]) {
+ this.pending[url].push(elt);
+ return true;
+ }
+ var resource;
+ if (this.cache[url]) {
+ this.onload(url, elt, this.cache[url]);
+ this.tail();
+ return true;
+ }
+ this.pending[url] = [ elt ];
+ return false;
+ },
+ fetch: function(url, elt) {
+ flags.load && console.log("fetch", url, elt);
+ if (url.match(/^data:/)) {
+ var pieces = url.split(",");
+ var header = pieces[0];
+ var body = pieces[1];
+ if (header.indexOf(";base64") > -1) {
+ body = atob(body);
+ } else {
+ body = decodeURIComponent(body);
+ }
+ setTimeout(function() {
+ this.receive(url, elt, null, body);
+ }.bind(this), 0);
+ } else {
+ var receiveXhr = function(err, resource, redirectedUrl) {
+ this.receive(url, elt, err, resource, redirectedUrl);
+ }.bind(this);
+ xhr.load(url, receiveXhr);
+ }
+ },
+ receive: function(url, elt, err, resource, redirectedUrl) {
+ this.cache[url] = resource;
+ var $p = this.pending[url];
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
+ this.onload(url, p, resource, err, redirectedUrl);
+ this.tail();
+ }
+ this.pending[url] = null;
+ },
+ tail: function() {
+ --this.inflight;
+ this.checkDone();
+ },
+ checkDone: function() {
+ if (!this.inflight) {
+ this.oncomplete();
+ }
+ }
+ };
+ scope.Loader = Loader;
+});
+
+HTMLImports.addModule(function(scope) {
+ var Observer = function(addCallback) {
+ this.addCallback = addCallback;
+ this.mo = new MutationObserver(this.handler.bind(this));
+ };
+ Observer.prototype = {
+ handler: function(mutations) {
+ for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
+ if (m.type === "childList" && m.addedNodes.length) {
+ this.addedNodes(m.addedNodes);
+ }
+ }
+ },
+ addedNodes: function(nodes) {
+ if (this.addCallback) {
+ this.addCallback(nodes);
+ }
+ for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
+ if (n.children && n.children.length) {
+ this.addedNodes(n.children);
+ }
+ }
+ },
+ observe: function(root) {
+ this.mo.observe(root, {
+ childList: true,
+ subtree: true
+ });
+ }
+ };
+ scope.Observer = Observer;
+});
+
+HTMLImports.addModule(function(scope) {
+ var path = scope.path;
+ var rootDocument = scope.rootDocument;
+ var flags = scope.flags;
+ var isIE = scope.isIE;
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
+ var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
+ var importParser = {
+ documentSelectors: IMPORT_SELECTOR,
+ importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="text/javascript"]' ].join(","),
+ map: {
+ link: "parseLink",
+ script: "parseScript",
+ style: "parseStyle"
+ },
+ dynamicElements: [],
+ parseNext: function() {
+ var next = this.nextToParse();
+ if (next) {
+ this.parse(next);
+ }
+ },
+ parse: function(elt) {
+ if (this.isParsed(elt)) {
+ flags.parse && console.log("[%s] is already parsed", elt.localName);
+ return;
+ }
+ var fn = this[this.map[elt.localName]];
+ if (fn) {
+ this.markParsing(elt);
+ fn.call(this, elt);
+ }
+ },
+ parseDynamic: function(elt, quiet) {
+ this.dynamicElements.push(elt);
+ if (!quiet) {
+ this.parseNext();
+ }
+ },
+ markParsing: function(elt) {
+ flags.parse && console.log("parsing", elt);
+ this.parsingElement = elt;
+ },
+ markParsingComplete: function(elt) {
+ elt.__importParsed = true;
+ this.markDynamicParsingComplete(elt);
+ if (elt.__importElement) {
+ elt.__importElement.__importParsed = true;
+ this.markDynamicParsingComplete(elt.__importElement);
+ }
+ this.parsingElement = null;
+ flags.parse && console.log("completed", elt);
+ },
+ markDynamicParsingComplete: function(elt) {
+ var i = this.dynamicElements.indexOf(elt);
+ if (i >= 0) {
+ this.dynamicElements.splice(i, 1);
+ }
+ },
+ parseImport: function(elt) {
+ if (HTMLImports.__importsParsingHook) {
+ HTMLImports.__importsParsingHook(elt);
+ }
+ if (elt.import) {
+ elt.import.__importParsed = true;
+ }
+ this.markParsingComplete(elt);
+ if (elt.__resource && !elt.__error) {
+ elt.dispatchEvent(new CustomEvent("load", {
+ bubbles: false
+ }));
+ } else {
+ elt.dispatchEvent(new CustomEvent("error", {
+ bubbles: false
+ }));
+ }
+ if (elt.__pending) {
+ var fn;
+ while (elt.__pending.length) {
+ fn = elt.__pending.shift();
+ if (fn) {
+ fn({
+ target: elt
+ });
+ }
+ }
+ }
+ this.parseNext();
+ },
+ parseLink: function(linkElt) {
+ if (nodeIsImport(linkElt)) {
+ this.parseImport(linkElt);
+ } else {
+ linkElt.href = linkElt.href;
+ this.parseGeneric(linkElt);
+ }
+ },
+ parseStyle: function(elt) {
+ var src = elt;
+ elt = cloneStyle(elt);
+ elt.__importElement = src;
+ this.parseGeneric(elt);
+ },
+ parseGeneric: function(elt) {
+ this.trackElement(elt);
+ this.addElementToDocument(elt);
+ },
+ rootImportForElement: function(elt) {
+ var n = elt;
+ while (n.ownerDocument.__importLink) {
+ n = n.ownerDocument.__importLink;
+ }
+ return n;
+ },
+ addElementToDocument: function(elt) {
+ var port = this.rootImportForElement(elt.__importElement || elt);
+ var l = port.__insertedElements = port.__insertedElements || 0;
+ var refNode = port.nextElementSibling;
+ for (var i = 0; i < l; i++) {
+ refNode = refNode && refNode.nextElementSibling;
+ }
+ port.parentNode.insertBefore(elt, refNode);
+ },
+ trackElement: function(elt, callback) {
+ var self = this;
+ var done = function(e) {
+ if (callback) {
+ callback(e);
+ }
+ self.markParsingComplete(elt);
+ self.parseNext();
+ };
+ elt.addEventListener("load", done);
+ elt.addEventListener("error", done);
+ if (isIE && elt.localName === "style") {
+ var fakeLoad = false;
+ if (elt.textContent.indexOf("@import") == -1) {
+ fakeLoad = true;
+ } else if (elt.sheet) {
+ fakeLoad = true;
+ var csr = elt.sheet.cssRules;
+ var len = csr ? csr.length : 0;
+ for (var i = 0, r; i < len && (r = csr[i]); i++) {
+ if (r.type === CSSRule.IMPORT_RULE) {
+ fakeLoad = fakeLoad && Boolean(r.styleSheet);
+ }
+ }
+ }
+ if (fakeLoad) {
+ elt.dispatchEvent(new CustomEvent("load", {
+ bubbles: false
+ }));
+ }
+ }
+ },
+ parseScript: function(scriptElt) {
+ var script = document.createElement("script");
+ script.__importElement = scriptElt;
+ script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
+ scope.currentScript = scriptElt;
+ this.trackElement(script, function(e) {
+ script.parentNode.removeChild(script);
+ scope.currentScript = null;
+ });
+ this.addElementToDocument(script);
+ },
+ nextToParse: function() {
+ this._mayParse = [];
+ return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
+ },
+ nextToParseInDoc: function(doc, link) {
+ if (doc && this._mayParse.indexOf(doc) < 0) {
+ this._mayParse.push(doc);
+ var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
+ for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
+ if (!this.isParsed(n)) {
+ if (this.hasResource(n)) {
+ return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
+ } else {
+ return;
+ }
+ }
+ }
+ }
+ return link;
+ },
+ nextToParseDynamic: function() {
+ return this.dynamicElements[0];
+ },
+ parseSelectorsForNode: function(node) {
+ var doc = node.ownerDocument || node;
+ return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
+ },
+ isParsed: function(node) {
+ return node.__importParsed;
+ },
+ needsDynamicParsing: function(elt) {
+ return this.dynamicElements.indexOf(elt) >= 0;
+ },
+ hasResource: function(node) {
+ if (nodeIsImport(node) && node.import === undefined) {
+ return false;
+ }
+ return true;
+ }
+ };
+ function nodeIsImport(elt) {
+ return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
+ }
+ function generateScriptDataUrl(script) {
+ var scriptContent = generateScriptContent(script);
+ return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
+ }
+ function generateScriptContent(script) {
+ return script.textContent + generateSourceMapHint(script);
+ }
+ function generateSourceMapHint(script) {
+ var owner = script.ownerDocument;
+ owner.__importedScripts = owner.__importedScripts || 0;
+ var moniker = script.ownerDocument.baseURI;
+ var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
+ owner.__importedScripts++;
+ return "\n//# sourceURL=" + moniker + num + ".js\n";
+ }
+ function cloneStyle(style) {
+ var clone = style.ownerDocument.createElement("style");
+ clone.textContent = style.textContent;
+ path.resolveUrlsInStyle(clone);
+ return clone;
+ }
+ scope.parser = importParser;
+ scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
+});
+
+HTMLImports.addModule(function(scope) {
+ var flags = scope.flags;
+ var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
+ var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
+ var rootDocument = scope.rootDocument;
+ var Loader = scope.Loader;
+ var Observer = scope.Observer;
+ var parser = scope.parser;
+ var importer = {
+ documents: {},
+ documentPreloadSelectors: IMPORT_SELECTOR,
+ importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
+ loadNode: function(node) {
+ importLoader.addNode(node);
+ },
+ loadSubtree: function(parent) {
+ var nodes = this.marshalNodes(parent);
+ importLoader.addNodes(nodes);
+ },
+ marshalNodes: function(parent) {
+ return parent.querySelectorAll(this.loadSelectorsForNode(parent));
+ },
+ loadSelectorsForNode: function(node) {
+ var doc = node.ownerDocument || node;
+ return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
+ },
+ loaded: function(url, elt, resource, err, redirectedUrl) {
+ flags.load && console.log("loaded", url, elt);
+ elt.__resource = resource;
+ elt.__error = err;
+ if (isImportLink(elt)) {
+ var doc = this.documents[url];
+ if (doc === undefined) {
+ doc = err ? null : makeDocument(resource, redirectedUrl || url);
+ if (doc) {
+ doc.__importLink = elt;
+ this.bootDocument(doc);
+ }
+ this.documents[url] = doc;
+ }
+ elt.import = doc;
+ }
+ parser.parseNext();
+ },
+ bootDocument: function(doc) {
+ this.loadSubtree(doc);
+ this.observer.observe(doc);
+ parser.parseNext();
+ },
+ loadedAll: function() {
+ parser.parseNext();
+ }
+ };
+ var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
+ importer.observer = new Observer();
+ function isImportLink(elt) {
+ return isLinkRel(elt, IMPORT_LINK_TYPE);
+ }
+ function isLinkRel(elt, rel) {
+ return elt.localName === "link" && elt.getAttribute("rel") === rel;
+ }
+ function makeDocument(resource, url) {
+ var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
+ doc._URL = url;
+ var base = doc.createElement("base");
+ base.setAttribute("href", url);
+ if (!doc.baseURI) {
+ doc.baseURI = url;
+ }
+ var meta = doc.createElement("meta");
+ meta.setAttribute("charset", "utf-8");
+ doc.head.appendChild(meta);
+ doc.head.appendChild(base);
+ doc.body.innerHTML = resource;
+ if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
+ HTMLTemplateElement.bootstrap(doc);
+ }
+ return doc;
+ }
+ if (!document.baseURI) {
+ var baseURIDescriptor = {
+ get: function() {
+ var base = document.querySelector("base");
+ return base ? base.href : window.location.href;
+ },
+ configurable: true
+ };
+ Object.defineProperty(document, "baseURI", baseURIDescriptor);
+ Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
+ }
+ scope.importer = importer;
+ scope.importLoader = importLoader;
+});
+
+HTMLImports.addModule(function(scope) {
+ var parser = scope.parser;
+ var importer = scope.importer;
+ var dynamic = {
+ added: function(nodes) {
+ var owner, parsed;
+ for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
+ if (!owner) {
+ owner = n.ownerDocument;
+ parsed = parser.isParsed(owner);
+ }
+ loading = this.shouldLoadNode(n);
+ if (loading) {
+ importer.loadNode(n);
+ }
+ if (this.shouldParseNode(n) && parsed) {
+ parser.parseDynamic(n, loading);
+ }
+ }
+ },
+ shouldLoadNode: function(node) {
+ return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
+ },
+ shouldParseNode: function(node) {
+ return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
+ }
+ };
+ importer.observer.addCallback = dynamic.added.bind(dynamic);
+ var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
+});
+
+(function(scope) {
+ initializeModules = scope.initializeModules;
+ if (scope.useNative) {
+ return;
+ }
+ if (typeof window.CustomEvent !== "function") {
+ window.CustomEvent = function(inType, dictionary) {
+ var e = document.createEvent("HTMLEvents");
+ e.initEvent(inType, dictionary.bubbles === false ? false : true, dictionary.cancelable === false ? false : true, dictionary.detail);
+ return e;
+ };
+ }
+ initializeModules();
+ var rootDocument = scope.rootDocument;
+ function bootstrap() {
+ HTMLImports.importer.bootDocument(rootDocument);
+ }
+ if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
+ bootstrap();
+ } else {
+ document.addEventListener("DOMContentLoaded", bootstrap);
+ }
+})(HTMLImports);
+
+window.CustomElements = window.CustomElements || {
+ flags: {}
+};
+
+(function(scope) {
+ var flags = scope.flags;
+ var modules = [];
+ var addModule = function(module) {
+ modules.push(module);
+ };
+ var initializeModules = function() {
+ modules.forEach(function(module) {
+ module(scope);
+ });
+ };
+ scope.addModule = addModule;
+ scope.initializeModules = initializeModules;
+ scope.hasNative = Boolean(document.registerElement);
+ scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
+})(CustomElements);
+
+CustomElements.addModule(function(scope) {
+ var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
+ function forSubtree(node, cb) {
+ findAllElements(node, function(e) {
+ if (cb(e)) {
+ return true;
+ }
+ forRoots(e, cb);
+ });
+ forRoots(node, cb);
+ }
+ function findAllElements(node, find, data) {
+ var e = node.firstElementChild;
+ if (!e) {
+ e = node.firstChild;
+ while (e && e.nodeType !== Node.ELEMENT_NODE) {
+ e = e.nextSibling;
+ }
+ }
+ while (e) {
+ if (find(e, data) !== true) {
+ findAllElements(e, find, data);
+ }
+ e = e.nextElementSibling;
+ }
+ return null;
+ }
+ function forRoots(node, cb) {
+ var root = node.shadowRoot;
+ while (root) {
+ forSubtree(root, cb);
+ root = root.olderShadowRoot;
+ }
+ }
+ var processingDocuments;
+ function forDocumentTree(doc, cb) {
+ processingDocuments = [];
+ _forDocumentTree(doc, cb);
+ processingDocuments = null;
+ }
+ function _forDocumentTree(doc, cb) {
+ doc = wrap(doc);
+ if (processingDocuments.indexOf(doc) >= 0) {
+ return;
+ }
+ processingDocuments.push(doc);
+ var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
+ for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
+ if (n.import) {
+ _forDocumentTree(n.import, cb);
+ }
+ }
+ cb(doc);
+ }
+ scope.forDocumentTree = forDocumentTree;
+ scope.forSubtree = forSubtree;
+});
+
+CustomElements.addModule(function(scope) {
+ var flags = scope.flags;
+ var forSubtree = scope.forSubtree;
+ var forDocumentTree = scope.forDocumentTree;
+ function addedNode(node) {
+ return added(node) || addedSubtree(node);
+ }
+ function added(node) {
+ if (scope.upgrade(node)) {
+ return true;
+ }
+ attached(node);
+ }
+ function addedSubtree(node) {
+ forSubtree(node, function(e) {
+ if (added(e)) {
+ return true;
+ }
+ });
+ }
+ function attachedNode(node) {
+ attached(node);
+ if (inDocument(node)) {
+ forSubtree(node, function(e) {
+ attached(e);
+ });
+ }
+ }
+ var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
+ scope.hasPolyfillMutations = hasPolyfillMutations;
+ var isPendingMutations = false;
+ var pendingMutations = [];
+ function deferMutation(fn) {
+ pendingMutations.push(fn);
+ if (!isPendingMutations) {
+ isPendingMutations = true;
+ setTimeout(takeMutations);
+ }
+ }
+ function takeMutations() {
+ isPendingMutations = false;
+ var $p = pendingMutations;
+ for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
+ p();
+ }
+ pendingMutations = [];
+ }
+ function attached(element) {
+ if (hasPolyfillMutations) {
+ deferMutation(function() {
+ _attached(element);
+ });
+ } else {
+ _attached(element);
+ }
+ }
+ function _attached(element) {
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
+ if (!element.__attached && inDocument(element)) {
+ element.__attached = true;
+ if (element.attachedCallback) {
+ element.attachedCallback();
+ }
+ }
+ }
+ }
+ function detachedNode(node) {
+ detached(node);
+ forSubtree(node, function(e) {
+ detached(e);
+ });
+ }
+ function detached(element) {
+ if (hasPolyfillMutations) {
+ deferMutation(function() {
+ _detached(element);
+ });
+ } else {
+ _detached(element);
+ }
+ }
+ function _detached(element) {
+ if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
+ if (element.__attached && !inDocument(element)) {
+ element.__attached = false;
+ if (element.detachedCallback) {
+ element.detachedCallback();
+ }
+ }
+ }
+ }
+ function inDocument(element) {
+ var p = element;
+ var doc = wrap(document);
+ while (p) {
+ if (p == doc) {
+ return true;
+ }
+ p = p.parentNode || p.host;
+ }
+ }
+ function watchShadow(node) {
+ if (node.shadowRoot && !node.shadowRoot.__watched) {
+ flags.dom && console.log("watching shadow-root for: ", node.localName);
+ var root = node.shadowRoot;
+ while (root) {
+ observe(root);
+ root = root.olderShadowRoot;
+ }
+ }
+ }
+ function handler(mutations) {
+ if (flags.dom) {
+ var mx = mutations[0];
+ if (mx && mx.type === "childList" && mx.addedNodes) {
+ if (mx.addedNodes) {
+ var d = mx.addedNodes[0];
+ while (d && d !== document && !d.host) {
+ d = d.parentNode;
+ }
+ var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
+ u = u.split("/?").shift().split("/").pop();
+ }
+ }
+ console.group("mutations (%d) [%s]", mutations.length, u || "");
+ }
+ mutations.forEach(function(mx) {
+ if (mx.type === "childList") {
+ forEach(mx.addedNodes, function(n) {
+ if (!n.localName) {
+ return;
+ }
+ addedNode(n);
+ });
+ forEach(mx.removedNodes, function(n) {
+ if (!n.localName) {
+ return;
+ }
+ detachedNode(n);
+ });
+ }
+ });
+ flags.dom && console.groupEnd();
+ }
+ function takeRecords(node) {
+ node = wrap(node);
+ if (!node) {
+ node = wrap(document);
+ }
+ while (node.parentNode) {
+ node = node.parentNode;
+ }
+ var observer = node.__observer;
+ if (observer) {
+ handler(observer.takeRecords());
+ takeMutations();
+ }
+ }
+ var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
+ function observe(inRoot) {
+ if (inRoot.__observer) {
+ return;
+ }
+ var observer = new MutationObserver(handler);
+ observer.observe(inRoot, {
+ childList: true,
+ subtree: true
+ });
+ inRoot.__observer = observer;
+ }
+ function upgradeDocument(doc) {
+ doc = wrap(doc);
+ flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
+ addedNode(doc);
+ observe(doc);
+ flags.dom && console.groupEnd();
+ }
+ function upgradeDocumentTree(doc) {
+ forDocumentTree(doc, upgradeDocument);
+ }
+ var originalCreateShadowRoot = Element.prototype.createShadowRoot;
+ Element.prototype.createShadowRoot = function() {
+ var root = originalCreateShadowRoot.call(this);
+ CustomElements.watchShadow(this);
+ return root;
+ };
+ scope.watchShadow = watchShadow;
+ scope.upgradeDocumentTree = upgradeDocumentTree;
+ scope.upgradeSubtree = addedSubtree;
+ scope.upgradeAll = addedNode;
+ scope.attachedNode = attachedNode;
+ scope.takeRecords = takeRecords;
+});
+
+CustomElements.addModule(function(scope) {
+ var flags = scope.flags;
+ function upgrade(node) {
+ if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
+ var is = node.getAttribute("is");
+ var definition = scope.getRegisteredDefinition(is || node.localName);
+ if (definition) {
+ if (is && definition.tag == node.localName) {
+ return upgradeWithDefinition(node, definition);
+ } else if (!is && !definition.extends) {
+ return upgradeWithDefinition(node, definition);
+ }
+ }
+ }
+ }
+ function upgradeWithDefinition(element, definition) {
+ flags.upgrade && console.group("upgrade:", element.localName);
+ if (definition.is) {
+ element.setAttribute("is", definition.is);
+ }
+ implementPrototype(element, definition);
+ element.__upgraded__ = true;
+ created(element);
+ scope.attachedNode(element);
+ scope.upgradeSubtree(element);
+ flags.upgrade && console.groupEnd();
+ return element;
+ }
+ function implementPrototype(element, definition) {
+ if (Object.__proto__) {
+ element.__proto__ = definition.prototype;
+ } else {
+ customMixin(element, definition.prototype, definition.native);
+ element.__proto__ = definition.prototype;
+ }
+ }
+ function customMixin(inTarget, inSrc, inNative) {
+ var used = {};
+ var p = inSrc;
+ while (p !== inNative && p !== HTMLElement.prototype) {
+ var keys = Object.getOwnPropertyNames(p);
+ for (var i = 0, k; k = keys[i]; i++) {
+ if (!used[k]) {
+ Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
+ used[k] = 1;
+ }
+ }
+ p = Object.getPrototypeOf(p);
+ }
+ }
+ function created(element) {
+ if (element.createdCallback) {
+ element.createdCallback();
+ }
+ }
+ scope.upgrade = upgrade;
+ scope.upgradeWithDefinition = upgradeWithDefinition;
+ scope.implementPrototype = implementPrototype;
+});
+
+CustomElements.addModule(function(scope) {
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
+ var upgrade = scope.upgrade;
+ var upgradeWithDefinition = scope.upgradeWithDefinition;
+ var implementPrototype = scope.implementPrototype;
+ var useNative = scope.useNative;
+ function register(name, options) {
+ var definition = options || {};
+ if (!name) {
+ throw new Error("document.registerElement: first argument `name` must not be empty");
+ }
+ if (name.indexOf("-") < 0) {
+ throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
+ }
+ if (isReservedTag(name)) {
+ throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
+ }
+ if (getRegisteredDefinition(name)) {
+ throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
+ }
+ if (!definition.prototype) {
+ definition.prototype = Object.create(HTMLElement.prototype);
+ }
+ definition.__name = name.toLowerCase();
+ definition.lifecycle = definition.lifecycle || {};
+ definition.ancestry = ancestry(definition.extends);
+ resolveTagName(definition);
+ resolvePrototypeChain(definition);
+ overrideAttributeApi(definition.prototype);
+ registerDefinition(definition.__name, definition);
+ definition.ctor = generateConstructor(definition);
+ definition.ctor.prototype = definition.prototype;
+ definition.prototype.constructor = definition.ctor;
+ if (scope.ready) {
+ upgradeDocumentTree(document);
+ }
+ return definition.ctor;
+ }
+ function overrideAttributeApi(prototype) {
+ if (prototype.setAttribute._polyfilled) {
+ return;
+ }
+ var setAttribute = prototype.setAttribute;
+ prototype.setAttribute = function(name, value) {
+ changeAttribute.call(this, name, value, setAttribute);
+ };
+ var removeAttribute = prototype.removeAttribute;
+ prototype.removeAttribute = function(name) {
+ changeAttribute.call(this, name, null, removeAttribute);
+ };
+ prototype.setAttribute._polyfilled = true;
+ }
+ function changeAttribute(name, value, operation) {
+ name = name.toLowerCase();
+ var oldValue = this.getAttribute(name);
+ operation.apply(this, arguments);
+ var newValue = this.getAttribute(name);
+ if (this.attributeChangedCallback && newValue !== oldValue) {
+ this.attributeChangedCallback(name, oldValue, newValue);
+ }
+ }
+ function isReservedTag(name) {
+ for (var i = 0; i < reservedTagList.length; i++) {
+ if (name === reservedTagList[i]) {
+ return true;
+ }
+ }
+ }
+ var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
+ function ancestry(extnds) {
+ var extendee = getRegisteredDefinition(extnds);
+ if (extendee) {
+ return ancestry(extendee.extends).concat([ extendee ]);
+ }
+ return [];
+ }
+ function resolveTagName(definition) {
+ var baseTag = definition.extends;
+ for (var i = 0, a; a = definition.ancestry[i]; i++) {
+ baseTag = a.is && a.tag;
+ }
+ definition.tag = baseTag || definition.__name;
+ if (baseTag) {
+ definition.is = definition.__name;
+ }
+ }
+ function resolvePrototypeChain(definition) {
+ if (!Object.__proto__) {
+ var nativePrototype = HTMLElement.prototype;
+ if (definition.is) {
+ var inst = document.createElement(definition.tag);
+ var expectedPrototype = Object.getPrototypeOf(inst);
+ if (expectedPrototype === definition.prototype) {
+ nativePrototype = expectedPrototype;
+ }
+ }
+ var proto = definition.prototype, ancestor;
+ while (proto && proto !== nativePrototype) {
+ ancestor = Object.getPrototypeOf(proto);
+ proto.__proto__ = ancestor;
+ proto = ancestor;
+ }
+ definition.native = nativePrototype;
+ }
+ }
+ function instantiate(definition) {
+ return upgradeWithDefinition(domCreateElement(definition.tag), definition);
+ }
+ var registry = {};
+ function getRegisteredDefinition(name) {
+ if (name) {
+ return registry[name.toLowerCase()];
+ }
+ }
+ function registerDefinition(name, definition) {
+ registry[name] = definition;
+ }
+ function generateConstructor(definition) {
+ return function() {
+ return instantiate(definition);
+ };
+ }
+ var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
+ function createElementNS(namespace, tag, typeExtension) {
+ if (namespace === HTML_NAMESPACE) {
+ return createElement(tag, typeExtension);
+ } else {
+ return domCreateElementNS(namespace, tag);
+ }
+ }
+ function createElement(tag, typeExtension) {
+ var definition = getRegisteredDefinition(typeExtension || tag);
+ if (definition) {
+ if (tag == definition.tag && typeExtension == definition.is) {
+ return new definition.ctor();
+ }
+ if (!typeExtension && !definition.is) {
+ return new definition.ctor();
+ }
+ }
+ var element;
+ if (typeExtension) {
+ element = createElement(tag);
+ element.setAttribute("is", typeExtension);
+ return element;
+ }
+ element = domCreateElement(tag);
+ if (tag.indexOf("-") >= 0) {
+ implementPrototype(element, HTMLElement);
+ }
+ return element;
+ }
+ function cloneNode(deep) {
+ var n = domCloneNode.call(this, deep);
+ upgrade(n);
+ return n;
+ }
+ var domCreateElement = document.createElement.bind(document);
+ var domCreateElementNS = document.createElementNS.bind(document);
+ var domCloneNode = Node.prototype.cloneNode;
+ var isInstance;
+ if (!Object.__proto__ && !useNative) {
+ isInstance = function(obj, ctor) {
+ var p = obj;
+ while (p) {
+ if (p === ctor.prototype) {
+ return true;
+ }
+ p = p.__proto__;
+ }
+ return false;
+ };
+ } else {
+ isInstance = function(obj, base) {
+ return obj instanceof base;
+ };
+ }
+ document.registerElement = register;
+ document.createElement = createElement;
+ document.createElementNS = createElementNS;
+ Node.prototype.cloneNode = cloneNode;
+ scope.registry = registry;
+ scope.instanceof = isInstance;
+ scope.reservedTagList = reservedTagList;
+ scope.getRegisteredDefinition = getRegisteredDefinition;
+ document.register = document.registerElement;
+});
+
+(function(scope) {
+ var useNative = scope.useNative;
+ var initializeModules = scope.initializeModules;
+ if (useNative) {
+ var nop = function() {};
+ scope.watchShadow = nop;
+ scope.upgrade = nop;
+ scope.upgradeAll = nop;
+ scope.upgradeDocumentTree = nop;
+ scope.upgradeSubtree = nop;
+ scope.takeRecords = nop;
+ scope.instanceof = function(obj, base) {
+ return obj instanceof base;
+ };
+ } else {
+ initializeModules();
+ }
+ var upgradeDocumentTree = scope.upgradeDocumentTree;
+ if (!window.wrap) {
+ if (window.ShadowDOMPolyfill) {
+ window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
+ window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
+ } else {
+ window.wrap = window.unwrap = function(node) {
+ return node;
+ };
+ }
+ }
+ function bootstrap() {
+ upgradeDocumentTree(wrap(document));
+ if (window.HTMLImports) {
+ HTMLImports.__importsParsingHook = function(elt) {
+ upgradeDocumentTree(wrap(elt.import));
+ };
+ }
+ CustomElements.ready = true;
+ setTimeout(function() {
+ CustomElements.readyTime = Date.now();
+ if (window.HTMLImports) {
+ CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
+ }
+ document.dispatchEvent(new CustomEvent("WebComponentsReady", {
+ bubbles: true
+ }));
+ });
+ }
+ if (typeof window.CustomEvent !== "function") {
+ window.CustomEvent = function(inType, params) {
+ params = params || {};
+ var e = document.createEvent("CustomEvent");
+ e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
+ return e;
+ };
+ window.CustomEvent.prototype = window.Event.prototype;
+ }
+ if (document.readyState === "complete" || scope.flags.eager) {
+ bootstrap();
+ } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
+ bootstrap();
+ } else {
+ var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
+ window.addEventListener(loadEvent, bootstrap);
+ }
+})(window.CustomElements);
+
+(function(scope) {
+ if (!Function.prototype.bind) {
+ Function.prototype.bind = function(scope) {
+ var self = this;
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function() {
+ var args2 = args.slice();
+ args2.push.apply(args2, arguments);
+ return self.apply(scope, args2);
+ };
+ };
+ }
+})(window.WebComponents);
+
+(function(scope) {
+ "use strict";
+ if (!window.performance) {
+ var start = Date.now();
+ window.performance = {
+ now: function() {
+ return Date.now() - start;
+ }
+ };
+ }
+ if (!window.requestAnimationFrame) {
+ window.requestAnimationFrame = function() {
+ var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
+ return nativeRaf ? function(callback) {
+ return nativeRaf(function() {
+ callback(performance.now());
+ });
+ } : function(callback) {
+ return window.setTimeout(callback, 1e3 / 60);
+ };
+ }();
+ }
+ if (!window.cancelAnimationFrame) {
+ window.cancelAnimationFrame = function() {
+ return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
+ clearTimeout(id);
+ };
+ }();
+ }
+ var elementDeclarations = [];
+ var polymerStub = function(name, dictionary) {
+ if (typeof name !== "string" && arguments.length === 1) {
+ Array.prototype.push.call(arguments, document._currentScript);
+ }
+ elementDeclarations.push(arguments);
+ };
+ window.Polymer = polymerStub;
+ scope.consumeDeclarations = function(callback) {
+ scope.consumeDeclarations = function() {
+ throw "Possible attempt to load Polymer twice";
+ };
+ if (callback) {
+ callback(elementDeclarations);
+ }
+ elementDeclarations = null;
+ };
+ function installPolymerWarning() {
+ if (window.Polymer === polymerStub) {
+ window.Polymer = function() {
+ throw new Error("You tried to use polymer without loading it first. To " + 'load polymer, <link rel="import" href="' + 'components/polymer/polymer.html">');
+ };
+ }
+ }
+ if (HTMLImports.useNative) {
+ installPolymerWarning();
+ } else {
+ addEventListener("DOMContentLoaded", installPolymerWarning);
+ }
+})(window.WebComponents);
+
+(function(scope) {
+ var style = document.createElement("style");
+ style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
+ var head = document.querySelector("head");
+ head.insertBefore(style, head.firstChild);
+})(window.WebComponents);
+
+(function(scope) {
+ window.Platform = scope;
+})(window.WebComponents);
+
+if (typeof exports !== 'undefined') {
+ module.exports = window.WebComponents;
+}

LICENSE

@@ -0,0 +1,31 @@
+BSD License
+
+For React software
+
+Copyright (c) 2013-2015, Facebook, Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package.json

@@ -1,30 +1,30 @@
{
"name": "react",
"description": "React is a JavaScript library for building user interfaces.",
- "version": "0.13.3",
+ "version": "0.14.9",
"keywords": [
"react"
],
- "homepage": "https://github.com/facebook/react/tree/master/npm-react",
- "bugs": "https://github.com/facebook/react/issues?labels=react-core",
+ "homepage": "https://facebook.github.io/react/",
+ "bugs": "https://github.com/facebook/react/issues",
"license": "BSD-3-Clause",
"files": [
- "README.md",
+ "LICENSE",
+ "PATENTS",
"addons.js",
"react.js",
+ "addons/",
"dist/",
"lib/"
],
"main": "react.js",
- "repository": {
- "type": "git",
- "url": "https://github.com/facebook/react"
- },
+ "repository": "facebook/react",
"engines": {
"node": ">=0.10.0"
},
"dependencies": {
- "envify": "^3.0.0"
+ "envify": "^3.0.0",
+ "fbjs": "^0.6.1"
},
"browserify": {
"transform": [

PATENTS

@@ -0,0 +1,33 @@
+Additional Grant of Patent Rights Version 2
+
+"Software" means the React software distributed by Facebook, Inc.
+
+Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
+("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
+(subject to the termination provision below) license under any Necessary
+Claims, to make, have made, use, sell, offer to sell, import, and otherwise
+transfer the Software. For avoidance of doubt, no license is granted under
+Facebook's rights in any patent claims that are infringed by (i) modifications
+to the Software made by you or any third party or (ii) the Software in
+combination with any software or other technology.
+
+The license granted hereunder will terminate, automatically and without notice,
+if you (or any of your subsidiaries, corporate affiliates or agents) initiate
+directly or indirectly, or take a direct financial interest in, any Patent
+Assertion: (i) against Facebook or any of its subsidiaries or corporate
+affiliates, (ii) against any party if such Patent Assertion arises in whole or
+in part from any software, technology, product or service of Facebook or any of
+its subsidiaries or corporate affiliates, or (iii) against any party relating
+to the Software. Notwithstanding the foregoing, if Facebook or any of its
+subsidiaries or corporate affiliates files a lawsuit alleging patent
+infringement against you in the first instance, and you respond by filing a
+patent infringement counterclaim in that lawsuit against that party that is
+unrelated to the Software, the license granted hereunder will not terminate
+under section (i) of this paragraph due to such counterclaim.
+
+A "Necessary Claim" is a claim of a patent owned by Facebook that is
+necessarily infringed by the Software standing alone.
+
+A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
+or contributory infringement or inducement to infringe any patent, including a
+cross-claim or counterclaim.

react.js

@@ -1 +1,3 @@
+'use strict';
+
module.exports = require('./lib/React');

README.md

@@ -14,7 +14,10 @@
```js
var React = require('react');
-// You can also access ReactWithAddons.
-var React = require('react/addons');
+// Addons are in separate packages:
+var createFragment = require('react-addons-create-fragment');
+var immutabilityHelpers = require('react-addons-update');
+var CSSTransitionGroup = require('react-addons-css-transition-group');
```
+For a complete list of addons visit the [addons documentation page](https://facebook.github.io/react/docs/addons.html).